A83: Please help me with my code!
[Prev][Next][Index][Thread]
A83: Please help me with my code!
I have been looking for the bugs in my code for over a week now.. the Calc
always crashes..
could someone be nice enough to tell me what I'm doing wrong here..
Thanx
.NOLIST
#define equ .equ
#define EQU .equ
#define end .end
#include "ti83asm.inc"
#include "sos.inc"
.LIST
.org 9327h
Fish_Mem = $8265
Size1 = Fish_mem
Size2 = Fish_mem+1
FishX1 = Fish_mem+2
FishX2 = Fish_mem+3
FishY1 = Fish_mem+4
FishY2 = Fish_mem+5
FishDir1 = Fish_mem+6
FishDir2 = Fish_mem+7
FishSpeedX1 = Fish_mem+8
FishSpeedY1 = Fish_mem+9
Badfish1X = Fish_mem+10
Badfish1Y = Fish_mem+11
Badfish1size = Fish_mem+12
Badfish1dir = Fish_mem+13
ccf
jr Start1
.dw libraries-$9327
.dw Name
Name:
.db "Shark By Bruce Link ",0
libraries:
.db "ZLIB",0,0,0,0,lib1,vec1
.db "ZLIB",0,0,0,0,lib2,vec2
.db $FF
Start1:
ld a,33
ld (BadFish1X),a
ld (Badfish1Y),a
ld a,0
ld (BadFish1size),a
ld (Badfish1dir),a
ld a,11
ld (FishX1),a
ld (FishY1),a
ld a,50
ld (FishX2),a
ld (FishY2),a
ld a,127
ld (FishSpeedX1),a
ld (FishSpeedY1),a
Start2:
call getkey
call fishslow
call moveloop
call disploop
call badmoveloop
call _grbufcpy_v
call _grbufclr
halt
halt
halt
ld a,0ffh
out (1),a
ld a,0fdh
out (1),a
in a,(1)
cp 191
jp z,quit
jp Start2
getkey:
ld a,0ffh
out (1),a
ld a,0feh
out (1),a
in a,(1)
cp 254
call z,down
cp 253
call z,left
cp 251
call z,right
cp 247
call z,up
ret
left:
ld a,(FishSpeedX1)
cp 117
ret c
dec a
dec a
ld (FishSpeedX1),a
ld a,5
ld (FishDir1),a
ret
right:
ld a,(FishSpeedX1)
cp 137
ret nc
inc a
inc a
ld (FishSpeedX1),a
ld a,1
ld (FishDir1),a
ret
up:
ld a,(FishspeedY1)
cp 117
ret c
dec a
dec a
ld (FishSpeedY1),a
ld a,7
ld (FishDir1),a
ret
down:
ld a,(FishspeedY1)
cp 137
ret nc
inc a
inc a
ld (FishSpeedY1),a
ld a,3
ld (FishDir1),a
ret
fishslow:
ld a,(FishSpeedX1)
cp 127
call c,speedXup
ld a,(FishSpeedX1)
cp 128
call nc,speedXdown
ld a,(FishSpeedY1)
cp 127
call c,speedYup
ld a,(FishSpeedY1)
cp 128
call nc,speedYDown
ret
speedXup:
ld a,(FishSpeedX1)
inc a
ld (FishSpeedX1),a
ret
speedXdown:
ld a,(FishSpeedX1)
dec a
ld (FishSpeedX1),a
ret
speedYup:
ld a,(FishSpeedY1)
inc a
ld (FishSpeedY1),a
ret
speedYdown:
ld a,(FishSpeedY1)
dec a
ld (FishSpeedY1),a
ret
moveloop:
ld a,(FishSpeedX1)
cp 127
call c,X_less
ld a,(FishSpeedY1)
cp 127
call c,Y_less
ld a,(FishSpeedX1)
cp 128
call nc,X_More
ld a,(FishSpeedY1)
cp 128
call nc,Y_More
ld a,(FishX1)
cp 106
call nc,SetX0
ld a,(FishX1)
cp 11
call c,SetX93
ret
SetX0:
ld a,11
ld (FishX1),a
ret
SetX93:
ld a,105
ld (FishX1),a
ret
X_More:
ld a,(FishSpeedX1)
sub 127
ld b,a
ld a,(FishX1)
add a,b
ld (FishX1),a
ret
Y_More:
ld a,(FishSpeedY1)
sub 127
ld b,a
ld a,(FishY1)
add a,b
cp 75
jp nc,a75
ld (FishY1),a
ret
a75:
ld a,74
ret
X_less:
ld a,(FishSpeedX1)
ld b,a
ld a,127
sub b
ld b,a
ld a,(FishX1)
sub b
ld (FishX1),a
ret
Y_less:
ld a,(FishSpeedY1)
ld b,a ;Fishspeed -> b
ld a,127
sub b ;127 - Fishspeed -> a
ld b,a ;negative speed (end offset) -> b
ld a,(FishY1)
sub b
cp 11
jp c,a11
ld (FishY1),a
ret
a11:
ld a,11
ret
Disploop:
call dispFishdir1
ld a,(FishY1)
sub 11
ld l,a
ld a,(FishX1)
sub 11
call vector1
ret
dispfishdir1:
ld a,(Fishdir1)
cp 5
jp z,sfish1right
cp 1
jp z,sfish1left
cp 7
jp z,sfish1up
cp 3
jp z,sfish1down
ret
sfish1right:
ld ix,fish1right
ld b,3
ret
sfish1left:
ld ix,fish1left
ld b,3
ret
sfish1up:
ld ix,fish1up
ld b,5
ret
sfish1down:
ld ix,fish1down
ld b,5
ret
Quit:
call _clrLCDFull
call _grbufclr
ret
badmoveloop:
ld a,(BadFish1Size)
cp 0
jp z,shoulddisplaybadfish1
cp 0
ret z
ld a,(badfish1dir)
cp 1
jp z,badfish1left
jp nz,badfish1right
ld a,(Badfish1X)
cp 106
jp nc,deadbadfish1
cp 11
jp c,deadbadfish1
jp badfish1ypos
jp dispBadFish1
ret
deadbadfish1:
ld a,0
ld (Badfish1size),a
ret
shoulddisplaybadfish1:
ld b,9
call vector2
cp 3
jp z,showbadfish1
ret
showbadfish1:
ld b,8
call vector2
inc a
ld (Badfish1size),a
ld b,1
call vector2
inc a
ld (badfish1dir),a
cp 1
jp z,badfish1goleft
jp nz,badfish1goright
ld b,63
call vector2
add a,11
ld (badfish1Y),a
ret
badfish1goright:
ld a,11
ld (Badfish1X),a
ret
badfish1goleft:
ld a,105
ld (Badfish1X),a
ret
badfish1left:
ld a,(badfish1size)
cp 0
ret z
ld b,3
call vector2
ld c,a
ld a,(BadFish1X)
sub c
ld (BadFish1X),a
ret
badfish1right:
ld a,(badfish1size)
cp 0
ret z
ld b,3
call vector2
ld c,a
ld a,(BadFish1X)
add a,c
ld (BadFish1X),a
ret
badfish1ypos:
ld a,(Badfish1size)
cp 0
ret z
ld b,5
call vector2
ld c,a
ld a,(BadFish1Y)
sub c
cp 11
ret c
ld (Badfish1Y),a
ld b,5
call vector2
ld c,a
ld a,(Badfish1Y)
add a,c
cp 74
ret nc
ld (badfish1Y),a
ret
dispbadfish1:
ld a,(BadFish1Size)
cp 0
ret z
ld a,(Badfish1X)
sub 11
ld l,a
ld b,3
ld a,(Badfish1Y)
sub 11
ld ix,fish1left
call vector1
ret
eatcheck:
ret
Xmit:
ret
fish1left:
.db %10110000
.db %11111000
.db %10110000
fish1right:
.db %01101000
.db %11111000
.db %01101000
fish1up:
.db %01000000
.db %11100000
.db %11100000
.db %01000000
.db %11100000
fish1down:
.db %11100000
.db %01000000
.db %11100000
.db %11100000
.db %01000000
fish1upright:
.db %00011100
.db %00111100
.db %10110000
.db %01000000
.db %00100000
fish1upleft:
.db %11100000
.db %11110000
.db %00110100
.db %00001000
.db %00010000
fish1downright:
.db %00100000
.db %01000000
.db %10110000
.db %00111100
.db %00011100
fish1downleft:
.db %00010000
.db %00001000
.db %00110100
.db %11110000
.db %11100000
.end
END