heres the current code for my map generator for SC
I know there isn't nearly enough error checking, however, that isn't a problem yet because for some reason the code that would present the possibility of errors doesn't actually seem to get called (popisland), so any help would be appreciated.
Code:
I know there isn't nearly enough error checking, however, that isn't a problem yet because for some reason the code that would present the possibility of errors doesn't actually seem to get called (popisland), so any help would be appreciated.
Code:
.nolist
#include "dcs6.inc"
_strcpy =$44E3
_MultAbyE =$8042
OCEAN =$00
LAND =$00
.list
.org progstart
#IFDEF TI83P
.db $BB,$6D
#ENDIF
INIT:
xor d
#IFDEF TI83P
.db $C9
#ENDIF
jr Start
.dw $0000
.db $06,$00
.dw Icon
.dw $0000
.dw $0000
Icon: ;a 16x16 icon
.db $3C,$09,$66,$3F,$C3,$7E,$C1,$10,$60,$00,$3C,$3E,$06,$63,$83,$41
.db $C3,$40,$66,$40,$3C,$C1,$01,$63,$76,$3E,$FF,$81,$FF,$8E,$63,$1F
START:
bcall(_cleargbuf)
bcall(_ClrLcdf);
call seed
call iFastCopy
call pause
ret
seed:
ld b,10
call iRandom
ld b,a
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
inc b
ld a,b
ld (numseeds),a
seedjump:
push bc
ld b,60
call iRandom
inc a
inc a
ld e,a
ld b,92
call iRandom
inc a
inc a
ld (coordx),a
ld a,e
ld (coordy),a
call iGetPixel
OR (HL)
LD (HL), A
call popisland
pop bc
djnz seedjump
ret
popisland:
ld a,(numseeds)
ld e,a
ld d,0
ld hl,25
scf
ccf
sbc hl,de
ld a,l
ld (mdist),a
ld e,a
ld h,a
call H_Times_E
islandloop:
push hl
ld a,(mdist)
ld b,a
call iRandom
ld e,a
ld a,(coordy)
add a,e
ld e,a
ld a,(mdist)
ld b,a
call iRandom
ld b,a
ld a,(coordx)
add a,b
call iGetPixel
OR (HL)
LD (HL),A
pop hl
dec hl
cp l
jr z,islandloop
ret
numseeds:
.db 0
coordx:
.db 0
coordy:
.db 0
mdist:
.db 0
H_Times_E: ; HL = H × E
LD D, 0 ; Zero D and L
LD L, D
LD B, 8
_loop:
ADD HL, HL ; Get most-significant bit of HL
JR NC, _skip
ADD HL, DE
_skip:
DJNZ _loop
RET
.end
END