-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOUNCE.ASM
More file actions
155 lines (134 loc) · 3.5 KB
/
Copy pathBOUNCE.ASM
File metadata and controls
155 lines (134 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
; This is a simple demonstration of graphics on the TI-85 with ZShell.
; Do what you will with it.
; Dan Eble
#INCLUDE "TI-85.H"
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; Program data stored in text memory (80DF)
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Y =$80DF ; y position
X =$80E0 ; x position
DY =$80E1 ; y velocity
DX =$80E2 ; x velocity
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; Program Title
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
.org 0
.db "Projectile",0
ld a, 4 ; set memory page 4 (graphic routines are here)
out (5), a
ROM_CALL(CLEARLCD)
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 128 ; if x>=128 ... (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
ret z ; return if [EXIT] is pressed
jr Fly ; otherwise, keep ball in flight
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; Turn on point. B=x C=y ;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; . (0,63) . (127,63) ;
; ;
; Screen Layout ;
; ;
; . (0,0) . (127,0) ;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Point_on:
push bc
call $6c9a ; HL=byte offset in video buffer, A=2^(bit to change)
ld de, $FC00
add hl, de
or (hl)
ld (hl),a
pop bc
ret
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; Turn off point. B=x C=y ;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; . (0,63) . (127,63) ;
; ;
; Screen Layout ;
; ;
; . (0,0) . (127,0) ;
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
Point_off:
push bc
call $6c9a ; HL=offset, A=2^bit
ld de, $FC00
add hl, de
xor 255
and (hl)
ld (hl),a
pop bc
ret
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
; 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