A82: programming
[Prev][Next][Index][Thread]
A82: programming
The following is a program that is meant to move a paddle back and forth
around the screen. Since I do not know how to compile it I was wondering if
somebody would check it for mistakes. I am hoping to turn this meager program
into a major pong game some day. I would also appreciate any information
about compiling, because I would like to see if the program actually works
and if there are any bugs.
Thanks a lot,
Gerad
p.s. Is $58 equal to 88 decimal, I am not sure.
All the rest of this message is assembly code. . .
------------------------------------------------------------------------------
---------------------------------------------
#include "ti82.h"
#include "graph.h"
.org start_addr
.db "Pong! by Gerad S.",0
paddle = $808F
ballx = $8090
bally = $8091
balldirection = $8092
keypressed = $8093
graph_start
start:
ld a, $00
ld (paddle), a
drawpaddle:
ld b, (paddle)
ld c, $01
points:
call point_on
inc b
call point_on
inc b
call point_on
inc b
call point_on
inc b
call point_on
inc b
call point_on
inc c
ld a,c
cp $03
jr z, points
getkey:
call (key_hand)
cp $01
jr nz, right
cp $02
jr nz, left
cp $06
jr nz, quit
jr getkey
right:
ld a, (paddle)
cp $58
jr nz, getkey
ld b,a
ld c, $01
call point_off
inc b
call point_off
inc c
call point_off
dec b
call point_off
ld a, (paddle)
inc a
inc a
ld (paddle), a
jr drawpaddle
left:
ld a, (paddle)
cp $00
jr nz, getkey
add a, 5
ld b,a
ld c, $01
call point_off
inc b
call point_off
inc c
call point_off
dec b
call point_off
ld a, (paddle)
dec a
dec a
ld (paddle), a
jr drawpaddle
quit:
call clear_disp
halt
graph_end
ret
#include "graph.inc"
.end
Follow-Ups: