-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonster.fs
189 lines (170 loc) · 2.44 KB
/
monster.fs
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
( start monster: ) here dup hex.
\ original invader from atari as 3 chars
\ load with LCD_ram
\ load: invader $40 LCD_ram
\ use: 0 LCD_send 1 LCD_send 2 LCD_send
create invader
hex
04
02
07
0D h ,
1F
15
14
03 h ,
02
04
1E
1B h ,
1F
1A
02
0C h ,
00
00
00
00 h ,
10
10
10
00 h ,
FFFF
,
decimal
\ half monster only 8 bytes allowed for loading with LCD_monster
\ just for fun
create monster
hex
04
02
07
0D h ,
1F
15
14
03 h
,
decimal
create monster2
hex
01
03
07
0D h ,
0F
02
05
0A h
,
decimal
\ loader for above symetric Monster in 3 chars
\ with possibility to move it pixelwise
\ see monster_demo below
\ load: monster 0 $40
\ load with 1 pixel shift: monster 1 $40 LCD_monster
: LCD_monster ( addr shift start - - )
over 4 > if 2drop drop exit then \ bad shift
dup $40 < if 2drop drop exit then \ bad addr
lcd_cmd
8 0 do
over i + c@
0
2 pick negate 5 + 0 do
i 10 > if exit then
over 4 i - bit and
0<> if
2 pick i + negate 4 + bit or
then
loop
lcd_send
drop
loop
dup 0<> if
8 0 do
over i + c@
0
2 pick 1+ 1 do
over 3 pick i - bit and
0<> if
5 i - bit or
then
loop
2 pick 5 swap do
over 3 pick negate i + bit and
0<> if
4 i - bit or
then
loop
lcd_send
drop
loop
then
dup 0= if 5 + then
8 0 do
over i + c@
\ mirror bytes
0
2 pick 0 do
\ CR $20 emit i .
over 4 i - bit and
0<> if
\ CR 84 emit
2 pick negate i + 5 + bit or
then
loop
lcd_send
drop
loop
5 = if
8 0 do
0 lcd_send
loop
then
drop
0 0 lcd_pos
;
\ Monster moving pixelwise demo
\ just start after LCD_init
: monster_demo
LCD_init
LCD_on \ just in case we have something on stack and BL is off therefore
$0C LCD_cmd \ disp on + cursor off
17 0 do
monster 0 $40 LCD_monster
$80 i + LCD_cmd \ direct write to display memory
0 LCD_send
1 LCD_send
2 LCD_send
5 1 do
100 ms
monster i $40 LCD_monster
loop
$80 i + LCD_cmd
$20 LCD_send
loop
\ and back ins second row
17 0 do
\ direct write to display memory doesn't work in second row, why??
16 i - 1 LCD_pos
0 LCD_send
1 LCD_send
2 LCD_send
$20 LCD_send
5 0 do
monster 4 i - $40 LCD_monster
100 ms
loop
loop
\ slowly delete from char mem
$40 lcd_cmd
8 0 do
0 lcd_send
100 ms
loop
200 ms
LCD_clear
LCD_on
;
( end monster: ) here dup hex.
( size monster: ) swap - hex.