... | ... |
@@ -1,22 +1,23 @@ |
1 | 1 |
( polycat ) |
2 | 2 |
|
3 |
-%RTN { JMP2r } |
|
4 | 3 |
%2// { #01 SFT2 } |
5 |
-%4// { #02 SFT2 } |
|
6 |
-%!~ { NEQk NIP } |
|
4 |
+%!~ { NEQk NIP } |
|
5 |
+%AUTO-XADDR { #05 .Screen/auto DEO } |
|
7 | 6 |
|
8 | 7 |
( devices ) |
9 | 8 |
|
10 |
-|00 @System [ &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 ] |
|
11 |
-|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 ] |
|
12 |
-|90 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &wheel $1 ] |
|
9 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
10 |
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
11 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 |
|
13 | 12 |
|
14 | 13 |
( variables ) |
15 | 14 |
|
16 | 15 |
|0000 |
17 | 16 |
|
18 |
-@cat [ &x $2 &y $2 &timer $1 ] |
|
19 |
-@pointer [ &x $2 &y $2 ] |
|
17 |
+@cat |
|
18 |
+ &x $2 &y $2 &timer $1 |
|
19 |
+@pointer |
|
20 |
+ &x $2 &y $2 |
|
20 | 21 |
|
21 | 22 |
( program ) |
22 | 23 |
|
... | ... |
@@ -26,124 +27,121 @@ |
26 | 27 |
#0a3f .System/r DEO2 |
27 | 28 |
#05df .System/g DEO2 |
28 | 29 |
#0caf .System/b DEO2 |
29 |
- |
|
30 |
- ( find center ) |
|
31 |
- .Screen/width DEI2 2// #0008 SUB2 .cat/x STZ2 |
|
32 |
- .Screen/height DEI2 4// DUP2k ADD2 ADD2 #0018 SUB2 .cat/y STZ2 |
|
33 |
- |
|
30 |
+ ( DOS resolution ) |
|
31 |
+ #0140 .Screen/width DEO2 |
|
32 |
+ #00c8 .Screen/height DEO2 |
|
34 | 33 |
( vectors ) |
35 | 34 |
;on-mouse .Mouse/vector DEO2 |
36 |
- ;on-frame .Screen/vector DEO2 |
|
37 |
- |
|
38 |
- ;draw-polycat JSR2 |
|
39 |
- ;draw-ground JSR2 |
|
40 |
- |
|
41 |
-BRK |
|
42 |
- |
|
43 |
-@on-mouse ( -> ) |
|
44 |
- |
|
45 |
- ;draw-cursor JSR2 |
|
46 |
- |
|
47 |
- .Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT |
|
48 |
- .Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT |
|
49 |
- ADD #00 SWP ;draw-eye JSR2 |
|
35 |
+ ( find center ) |
|
36 |
+ .Screen/width DEI2 2// .cat/x STZ2 |
|
37 |
+ .Screen/height DEI2 2// .cat/y STZ2 |
|
38 |
+ ( set screen mode ) |
|
39 |
+ AUTO-XADDR |
|
40 |
+ ( init ) |
|
41 |
+ #ff ;draw-eye/last STA |
|
42 |
+ #ff ;draw-tail/last STA |
|
43 |
+ ,draw-polycat JSR |
|
44 |
+ ,draw-ground JSR |
|
50 | 45 |
|
51 | 46 |
BRK |
52 | 47 |
|
53 |
-@on-frame ( -> ) |
|
48 |
+@draw-ground ( -- ) |
|
54 | 49 |
|
55 |
- .cat/timer LDZ INC [ DUP ] .cat/timer STZ |
|
56 |
- DUP ,&skip0 JCN #0000 ;draw-tail JSR2 &skip0 |
|
57 |
- [ #10 ] !~ ,&skip1 JCN #0001 ;draw-tail JSR2 &skip1 |
|
58 |
- [ #20 ] !~ ,&skip2 JCN #0002 ;draw-tail JSR2 &skip2 |
|
59 |
- [ #30 ] !~ ,&skip3 JCN #0003 ;draw-tail JSR2 &skip3 |
|
60 |
- [ #40 ] !~ ,&skip4 JCN #0002 ;draw-tail JSR2 &skip4 |
|
61 |
- [ #50 ] !~ ,&skip5 JCN #0001 ;draw-tail JSR2 &skip5 |
|
62 |
- POP |
|
50 |
+ .cat/y LDZ2 #0018 ADD2 .Screen/y DEO2 |
|
51 |
+ .cat/x LDZ2 #0010 SUB2 .Screen/x DEO2 |
|
52 |
+ ;ground .Screen/addr DEO2 |
|
53 |
+ #1000 |
|
54 |
+ &loop |
|
55 |
+ #01 .Screen/sprite DEO |
|
56 |
+ INC GTHk ,&loop JCN |
|
57 |
+ POP2 |
|
63 | 58 |
|
64 |
-BRK |
|
59 |
+JMP2r |
|
65 | 60 |
|
66 | 61 |
@draw-polycat ( -- ) |
67 | 62 |
|
68 | 63 |
( ears ) |
69 | 64 |
.cat/y LDZ2 .Screen/y DEO2 |
70 |
- .cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2 |
|
65 |
+ .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 |
|
71 | 66 |
;ears .Screen/addr DEO2 |
67 |
+ #81 .Screen/sprite DEOk DEO |
|
68 |
+ ( body ) |
|
69 |
+ .cat/y LDZ2 #0010 ADD2 .Screen/y DEO2 |
|
70 |
+ .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 |
|
71 |
+ ;body .Screen/addr DEO2 |
|
72 | 72 |
#81 .Screen/sprite DEO |
73 |
- STH2r .Screen/x DEO2 |
|
74 |
- ;ears #0010 ADD2 .Screen/addr DEO2 |
|
75 |
- #81 .Screen/sprite DEO |
|
76 |
- |
|
77 |
- #0000 ,draw-eye JSR |
|
78 |
- #0000 ,draw-tail JSR |
|
73 |
+ ( eye/tail ) |
|
74 |
+ #00 ,draw-eye JSR |
|
75 |
+ #00 ,draw-tail JSR |
|
79 | 76 |
|
80 |
-RTN |
|
77 |
+JMP2r |
|
81 | 78 |
|
82 |
-@draw-eye ( quad* -- ) |
|
79 |
+@on-mouse ( -> ) |
|
83 | 80 |
|
84 |
- .cat/y LDZ2 #0008 ADD2 .Screen/y DEO2 |
|
85 |
- .cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2 |
|
86 |
- DUP2 ;eye ADD2 .Screen/addr DEO2 |
|
87 |
- ( draw ) #81 .Screen/sprite DEO |
|
88 |
- STH2r .Screen/x DEO2 |
|
89 |
- ;eye #0010 ADD2 ADD2 .Screen/addr DEO2 |
|
90 |
- ( draw ) #81 .Screen/sprite DEO |
|
91 |
- |
|
92 |
-RTN |
|
81 |
+ .Mouse/x DEI2 .cat/x LDZ2 GTH2 #50 SFT |
|
82 |
+ .Mouse/y DEI2 .cat/y LDZ2 GTH2 #60 SFT |
|
83 |
+ ADD ,draw-eye JSR |
|
84 |
+ .cat/timer LDZ INC [ DUP ] .cat/timer STZ |
|
85 |
+ #04 SFT ,draw-tail JSR |
|
86 |
+ ,draw-cursor JSR |
|
93 | 87 |
|
94 |
-@draw-tail ( frame* -- ) |
|
88 |
+BRK |
|
95 | 89 |
|
90 |
+@draw-eye ( quad -- ) |
|
91 |
+ |
|
92 |
+ DUP ,&last LDR NEQ ,&changed JCN |
|
93 |
+ POP JMP2r &changed |
|
94 |
+ ( only redraw on change ) |
|
95 |
+ DUP |
|
96 |
+ #00 SWP ;eye ADD2 .Screen/addr DEO2 |
|
97 |
+ .cat/y LDZ2 #0008 ADD2 .Screen/y DEO2 |
|
98 |
+ .cat/x LDZ2 #0008 SUB2 .Screen/x DEO2 |
|
99 |
+ #81 .Screen/sprite DEOk DEO |
|
100 |
+ ,&last STR |
|
101 |
+ |
|
102 |
+JMP2r |
|
103 |
+ &last $1 |
|
104 |
+ |
|
105 |
+@draw-tail ( frame -- ) |
|
106 |
+ |
|
107 |
+ DUP ,&last LDR NEQ ,&changed JCN |
|
108 |
+ POP JMP2r &changed |
|
109 |
+ ( only redraw on change ) |
|
110 |
+ DUP |
|
111 |
+ ;frames ROT #00 SWP ADD2 LDA |
|
112 |
+ #00 SWP #40 SFT2 ;body/tail ADD2 |
|
113 |
+ .Screen/addr DEO2 |
|
114 |
+ .cat/x LDZ2 .Screen/x DEO2 |
|
96 | 115 |
.cat/y LDZ2 #0010 ADD2 .Screen/y DEO2 |
97 |
- .cat/x LDZ2 STH2k #0008 SUB2 .Screen/x DEO2 |
|
98 |
- ;body .Screen/addr DEO2 |
|
99 |
- ( draw ) #81 .Screen/sprite DEO |
|
100 |
- STH2r .Screen/x DEO2 |
|
101 |
- #40 SFT2 ;body #0010 ADD2 ADD2 .Screen/addr DEO2 |
|
102 |
- ( draw ) #81 .Screen/sprite DEO |
|
116 |
+ #81 .Screen/sprite DEO |
|
117 |
+ ,&last STR |
|
103 | 118 |
|
104 |
-RTN |
|
119 |
+JMP2r |
|
120 |
+ &last $1 |
|
105 | 121 |
|
106 | 122 |
@draw-cursor ( -- ) |
107 | 123 |
|
108 |
- ( clear last cursor ) |
|
109 |
- ;cursor .Screen/addr DEO2 |
|
124 |
+ ( last cursor ) |
|
125 |
+ ;cursor STH2k .Screen/addr DEO2 |
|
110 | 126 |
.pointer/x LDZ2 .Screen/x DEO2 |
111 | 127 |
.pointer/y LDZ2 .Screen/y DEO2 |
112 | 128 |
#40 .Screen/sprite DEO |
113 |
- |
|
114 |
- ( record pointer positions ) |
|
129 |
+ ( new cursor ) |
|
130 |
+ STH2r .Screen/addr DEO2 |
|
115 | 131 |
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
116 | 132 |
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
133 |
+ #41 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO |
|
117 | 134 |
|
118 |
- ( colorize on state ) |
|
119 |
- #41 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/sprite DEO |
|
120 |
- |
|
121 |
-RTN |
|
122 |
- |
|
123 |
-@draw-ground ( -- ) |
|
124 |
- |
|
125 |
- .cat/y LDZ2 #0018 ADD2 .Screen/y DEO2 |
|
126 |
- .cat/x LDZ2 #0010 SUB2 .Screen/x DEO2 |
|
127 |
- ;ground .Screen/addr DEO2 |
|
128 |
- |
|
129 |
- #10 #00 |
|
130 |
- &loop |
|
131 |
- ( draw ) #01 .Screen/sprite DEO |
|
132 |
- ( sety ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2 |
|
133 |
- ( setx ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2 |
|
134 |
- ( incr ) INC |
|
135 |
- GTHk ,&loop JCN |
|
136 |
- POP2 |
|
137 |
- |
|
138 |
-RTN |
|
135 |
+JMP2r |
|
139 | 136 |
|
140 | 137 |
@cursor |
141 | 138 |
80c0 e0f0 f8e0 1000 |
142 |
- |
|
139 |
+@frames |
|
140 |
+ 00 01 02 03 02 01 00 00 |
|
141 |
+ 00 00 00 00 00 00 00 00 |
|
143 | 142 |
@ears |
144 | 143 |
081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc |
145 | 144 |
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f |
146 |
- |
|
147 | 145 |
@eye |
148 | 146 |
ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f |
149 | 147 |
ffff ffff fffe fcf0 87c3 c183 071e fcf0 |
... | ... |
@@ -153,16 +151,15 @@ RTN |
153 | 151 |
ffff ffff fffe fcf0 0783 c1c3 871e fcf0 |
154 | 152 |
ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f |
155 | 153 |
ffff ffff fffe fcf0 07f3 f9fb f71e fcf0 |
156 |
- |
|
157 | 154 |
@body |
158 | 155 |
0707 0707 0302 0200 0107 0707 0300 0000 |
156 |
+ &tail |
|
159 | 157 |
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000 |
160 | 158 |
e0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000 |
161 | 159 |
e0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000 |
162 | 160 |
e0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000 |
163 | 161 |
0707 0707 0f08 1000 0307 0707 0f00 0000 |
164 | 162 |
e0e0 e0e0 e080 8000 f2f9 f9fe b884 8400 |
165 |
- |
|
166 | 163 |
@ground |
167 | 164 |
bf00 5c02 0202 020c ef10 6f90 8080 8074 |
168 | 165 |
ff00 fe01 0100 0116 fd00 3c40 4040 4028 |