home *** CD-ROM | disk | FTP | other *** search
- ; *** Bounce ver 1.1 ***
- ; This is the TI82 version of the zshell program called
- ; bounce made by Dan Eble. The program works in exactly
- ; the same way as the zshell program, the only difference
- ; is that adresses has been changed to TI82, and that the
- ; pixel rutines now uses the display controller.
- ;
- ; This program uses the graphics rutines from Graph.inc
- ;
- ; Dines Justesen, 1997
-
- #INCLUDE "ti82.h"
- #INCLUDE "graph.h"
-
- ;────────────────────────────────────────────────────────────────────────────
- ; Program data
- ;────────────────────────────────────────────────────────────────────────────
-
- Y =TEXT_MEM ; y position
- X =TEXT_MEM+1 ; x position
- DY =TEXT_MEM+2 ; y velocity
- DX =TEXT_MEM+3 ; x velocity
-
- .ORG START_ADDR
- .DB "Bounce ver 1.1 by Dan Eble",0
- GRAPH_START
- Launch:
- SUB A
- LD (Y), A ; set initial values
- INC A
- LD (X), A
- INC A
- LD (DX), A
- LD A, 11
- LD (DY), A
-
- Fly:
- LD BC, (Y) ; load ball coordinates into BC
- PUSH BC
- CALL Point_on ; display the square ball
- DEC B
- CALL Point_on
- INC C
- CALL Point_on
- INC B
- CALL Point_on
- CALL Delay ; wait a while
- LD HL, DY
- LD A, (HL)
- DEC A ; decrease y velocity (accelerate toward the ground)
- LD (HL), A
- LD A, (Y)
- ADD A, (hl) ; change y position
- BIT 7, A ; if y>=0, don't bounce
- JR Z, NoBounce
- LD A, (HL) ; if y<0, don't bounce
- NEG ; make the downward velocity negative (point it up)
- LD B, A ; multiply it by 7/8 (don't bounce as high)
- SLA A
- ADD A, B
- SLA A
- ADD A, B
- SRL A
- SRL A
- SRL A
- LD (HL), A
- SUB A
- NoBounce:
- LD (Y), A
- LD HL, DX ; change x position
- LD A, (X)
- ADD A, (HL)
- LD (X), A
- POP BC
- CP 96 ; if x>=96 ... (continued below)
- PUSH AF
- CALL Point_off ; first erase ball
- DEC B
- CALL Point_off
- INC C
- CALL Point_off
- INC B
- CALL Point_off
- POP AF ; (continued from above) ... launch ball again
- JR NC, Launch
-
- CALL GET_KEY
- CP $37
- JR NZ,Fly ; otherwise, keep ball in flight
- RET
-
- ;────────────────────────────────────────────────────────────────────────────
- ; Graphics rutines
- ;────────────────────────────────────────────────────────────────────────────
-
- #INCLUDE "graph.inc"
-
- ;────────────────────────────────────────────────────────────────────────────
- ; Produce delay
- ;────────────────────────────────────────────────────────────────────────────
-
- Delay:
- PUSH AF
- PUSH BC
- LD BC, $2000
- DelayLoop:
- DEC BC
- LD A, B
- OR C
- JR NZ, DelayLoop
- POP BC
- POP AF
- RET
-
- .END
-
-