A89: Oops, here's the file
[Prev][Next][Index][Thread]
A89: Oops, here's the file
here
include "tios.h"
include "util.h"
xdef _main
xdef _comment
xdef _ti89
_main:
move.w #2,-(a7) ; use font #2 (large font)
jsr tios::FontSetSys ; set the font
add.l #2,a7 ; clean up the stack
bsr while ; begin program loop
rts
while:
add.w #1,count ; add one to cycle counter
cmp #200,count ; if counter = 200 then
beq end_while ; goto end_while
bsr change_dir ; goto change_dir
bsr move_ball ; goto move_ball
bsr while ; repeat program loop
rts
end_while:
rts
move_ball:
cmp #1,xdir
beq move_right
cmp #2,xdir
beq move_left
cmp #1,ydir
beq move_down
cmp #2,ydir
beq move_up
rts
move_right:
add.w #1,xpos
rts
move_left:
sub.w #1,xpos
rts
move_down:
add.w #1,ypos
rts
move_up:
sub.w #1,ypos
rts
change_dir:
cmp #0,xpos
beq change_right
cmp #140,xpos
beq change_left
cmp #0,ypos
beq change_down
cmp #50,ypos
beq change_up
rts
change_right:
move.w #1,xdir
rts
change_left:
move.w #2,xdir
rts
change_down:
move.w #1,ydir
rts
change_up:
move.w #2,ydir
rts
; jsr util::idle_loop ; library routine which waits until a key
delay:
move.w #0,D7
bsr delay_loop
rts
delay_loop:
add.w #1,D7
cmp delay_len,D7
beq delay_end
bsr delay_loop
rts
delay_end:
rts
drawstuff:
jsr util::clr_scr ; clear the screen
move.w #4,-(a7) ; move the first param to the stack
lea string(pc),a0 ; move adress of string to the stack
move.l a0,-(a7)
move.w ypos,-(a7) ; push position for y pos
move.w xpos,-(a7) ; push position for x pos
jsr tios::DrawStrXY ; call the DrawStrXY ROM function
add.l #10,a7 ; restore the stack pointer
rts
string dc.b "O",0
xpos dc.w 74
ypos dc.w 25
xdir dc.w 1,0
ydir dc.w 1,0
count dc.w 0
delay_len dc.w 700
_comment dc.b "Bouncing Ball",0
end