| ... | ... |
@@ -12,9 +12,11 @@ |
| 12 | 12 |
faketime '23:59:42' bin/emulator bin/boot.rom |
| 13 | 13 |
) |
| 14 | 14 |
|
| 15 |
+%HCF { #0000 DIV }
|
|
| 16 |
+ |
|
| 15 | 17 |
;fps { current 1 next 1 second 1 }
|
| 16 | 18 |
;number { started 1 count 1 }
|
| 17 |
-;linee { var 2 }
|
|
| 19 |
+;lines { x1 2 x2 2 y1 2 y2 2 addr 2 }
|
|
| 18 | 20 |
;neralie { n6543 2 n21 1 }
|
| 19 | 21 |
|
| 20 | 22 |
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
| ... | ... |
@@ -26,19 +28,32 @@ |
| 26 | 28 |
|
| 27 | 29 |
|0200 @RESET |
| 28 | 30 |
#3c =fps.current |
| 31 |
+ |
|
| 32 |
+ #000a |
|
| 33 |
+ DUP2 =lines.x1 |
|
| 34 |
+ DUP2 =lines.y1 |
|
| 35 |
+ DUP2 ~Screen.width SWP2 SUB2 =lines.x2 |
|
| 36 |
+ ~Screen.height SWP2 SUB2 =lines.y2 |
|
| 37 |
+ |
|
| 38 |
+ ~lines.x1 ~lines.x2 ~lines.y1 ,h JSR2 |
|
| 39 |
+ ~lines.x1 ~lines.x2 ~lines.y2 ,h JSR2 |
|
| 40 |
+ ~lines.y1 ~lines.y2 ~lines.x1 ,v JSR2 |
|
| 41 |
+ ~lines.y1 ~lines.y2 ~lines.x2 ,v JSR2 |
|
| 42 |
+ |
|
| 29 | 43 |
@ERROR BRK |
| 30 | 44 |
|
| 31 | 45 |
@FRAME |
| 32 | 46 |
,update-fps JSR2 |
| 33 | 47 |
,neralie-calc JSR2 |
| 48 |
+ ,arvelie-text JSR2 |
|
| 49 |
+ ,neralie-text JSR2 |
|
| 34 | 50 |
BRK |
| 35 | 51 |
|
| 36 |
- ,font #00 ~number.count #08 MUL ADD2 =Sprite.addr |
|
| 37 | 52 |
#02 =Sprite.color |
| 38 | 53 |
#0000 #00 ~number.count DUP2 ,h JSR2 |
| 39 | 54 |
~number.count #01 ADD =number.count |
| 40 | 55 |
|
| 41 |
-@neralie-calc |
|
| 56 |
+@neralie-calc ( -- ) |
|
| 42 | 57 |
( add up fractions of a pulse ) |
| 43 | 58 |
#0120 #00 ~DateTime.hour MUL2 |
| 44 | 59 |
#00c0 #00 ~DateTime.minute MUL2 ADD2 |
| ... | ... |
@@ -57,38 +72,70 @@ |
| 57 | 72 |
#01a0 #00 ~DateTime.hour MUL2 ADD2 |
| 58 | 73 |
#0006 #00 ~DateTime.minute MUL2 ADD2 =neralie.n6543 |
| 59 | 74 |
|
| 60 |
- ~neralie.n6543 ,print-short-decimal JSR2 |
|
| 61 |
- #20 =Console.char |
|
| 62 |
- ~neralie.n21 ,print-byte-decimal JSR2 |
|
| 63 |
- #0a =Console.char |
|
| 64 | 75 |
JMP2r |
| 65 | 76 |
|
| 77 |
+@arvelie-text ( -- ) |
|
| 78 |
+ ~Screen.width #0002 DIV2 #0034 SUB2 =Sprite.x |
|
| 79 |
+ ~Screen.height #0008 SUB2 =Sprite.y |
|
| 80 |
+ ~DateTime.year #07d6 SUB2 |
|
| 81 |
+ #000a ,modf JSR2 ,digit JSR2 |
|
| 82 |
+ ,digit JSR2 |
|
| 83 |
+ ~DateTime.doy |
|
| 84 |
+ #000e ,modf JSR2 ^letter JSR |
|
| 85 |
+ #000a ,modf JSR2 ^digit JSR |
|
| 86 |
+ ^digit JSR |
|
| 87 |
+ JMP2r |
|
| 88 |
+ |
|
| 89 |
+@neralie-text ( -- ) |
|
| 90 |
+ ~Screen.width #0002 DIV2 #0004 SUB2 =Sprite.x |
|
| 91 |
+ ~neralie.n6543 |
|
| 92 |
+ #03e8 ,modf JSR2 ^digit JSR |
|
| 93 |
+ #0064 ,modf JSR2 ^digit JSR |
|
| 94 |
+ #000a ,modf JSR2 ^digit JSR |
|
| 95 |
+ #000a ^digit JSR ( the colon ) |
|
| 96 |
+ ^digit JSR |
|
| 97 |
+ #00 ~neralie.n21 |
|
| 98 |
+ #000a ,modf JSR2 ^digit JSR |
|
| 99 |
+ ^digit JSR |
|
| 100 |
+ JMP2r |
|
| 101 |
+ |
|
| 102 |
+@letter ( index₂ -- ) |
|
| 103 |
+ #0008 MUL2 ,font-letters ADD2 =Sprite.addr |
|
| 104 |
+ ^digit-middle JMP |
|
| 105 |
+ |
|
| 106 |
+@digit ( index₂ -- ) |
|
| 107 |
+ #0008 MUL2 ,font-numbers ADD2 =Sprite.addr |
|
| 108 |
+ $middle |
|
| 109 |
+ #02 =Sprite.color |
|
| 110 |
+ ~Sprite.x #0008 ADD2 =Sprite.x |
|
| 111 |
+ JMP2r |
|
| 112 |
+ |
|
| 113 |
+ |
|
| 66 | 114 |
@h ( x1₂ x2₂ y₂ -- ) |
| 67 | 115 |
=Screen.y |
| 68 |
- ,Screen.x =linee.var |
|
| 69 |
- ^line JMP |
|
| 116 |
+ ,Screen.x =lines.addr |
|
| 117 |
+ ^draw-line JMP |
|
| 70 | 118 |
|
| 71 | 119 |
@v ( y1₂ y2₂ x₂ -- ) |
| 72 | 120 |
=Screen.x |
| 73 |
- ,Screen.y =linee.var |
|
| 74 |
- ( ^line JMP is redundant ) |
|
| 121 |
+ ,Screen.y =lines.addr |
|
| 75 | 122 |
|
| 76 |
-@line ( v1₂ v2₂ -- ) |
|
| 123 |
+@draw-line ( v1₂ v2₂ -- ) |
|
| 77 | 124 |
OVR2 OVR2 LTH2 #01 JNZ SWP2 |
| 78 | 125 |
STH2 |
| 79 | 126 |
|
| 80 | 127 |
$loop |
| 81 |
- DUP2 DUP2r STH2r GTH2 ^$end JNZ |
|
| 82 |
- DUP2 ~linee.var STR2 |
|
| 83 |
- #03 =Screen.color |
|
| 84 | 128 |
#0001 ADD2 |
| 85 |
- ^$loop JMP |
|
| 86 |
- |
|
| 87 |
- $end |
|
| 129 |
+ DUP2 DUP2r STH2r LTH2 ^$keep-going JNZ |
|
| 88 | 130 |
POP2 POP2r |
| 89 | 131 |
JMP2r |
| 90 | 132 |
|
| 91 |
-@update-fps |
|
| 133 |
+ $keep-going |
|
| 134 |
+ DUP2 ~lines.addr STR2 |
|
| 135 |
+ #02 =Screen.color |
|
| 136 |
+ ^$loop JMP |
|
| 137 |
+ |
|
| 138 |
+@update-fps ( -- ) |
|
| 92 | 139 |
#00 =DateTime.get |
| 93 | 140 |
~fps.next #01 ADD =fps.next |
| 94 | 141 |
~DateTime.second ~fps.second NEQ JMP JMP2r |
| ... | ... |
@@ -101,22 +148,6 @@ |
| 101 | 148 |
#00 =fps.next |
| 102 | 149 |
JMP2r |
| 103 | 150 |
|
| 104 |
-@print-byte-decimal ( byte₁ -- ) |
|
| 105 |
- #00 =number.started |
|
| 106 |
- DUP #64 DIV DUP ^$digit JSR #64 MUL SUB |
|
| 107 |
- DUP #0a DIV DUP ^$digit JSR #0a MUL SUB |
|
| 108 |
- ^$digit JSR |
|
| 109 |
- ~number.started ^$end JNZ |
|
| 110 |
- #30 =Console.char |
|
| 111 |
- $end JMP2r |
|
| 112 |
- |
|
| 113 |
- $digit |
|
| 114 |
- OVR ~number.started ORA #02 JNZ |
|
| 115 |
- POP JMP2r |
|
| 116 |
- #30 ADD =Console.char |
|
| 117 |
- #01 =number.started |
|
| 118 |
- JMP2r |
|
| 119 |
- |
|
| 120 | 151 |
@print-string ( string₂ -- ) |
| 121 | 152 |
DUP2 PEK2 DUP ^$not-end JNZ |
| 122 | 153 |
|
| ... | ... |
@@ -127,34 +158,55 @@ |
| 127 | 158 |
=Console.char |
| 128 | 159 |
#0001 ADD2 ^print-string JMP |
| 129 | 160 |
|
| 161 |
+@print-byte-decimal ( byte₁ -- ) |
|
| 162 |
+ #00 =number.started |
|
| 163 |
+ #00 SWP |
|
| 164 |
+ ^print-short-decimal-byte-start JMP |
|
| 165 |
+ |
|
| 130 | 166 |
@print-short-decimal ( short₂ -- ) |
| 131 | 167 |
#00 =number.started |
| 132 |
- DUP2 #2710 DIV2 DUP2 ^$digit JSR #2710 MUL2 SUB2 |
|
| 133 |
- DUP2 #03e8 DIV2 DUP2 ^$digit JSR #03e8 MUL2 SUB2 |
|
| 134 |
- DUP2 #0064 DIV2 DUP2 ^$digit JSR #0064 MUL2 SUB2 |
|
| 135 |
- DUP2 #000a DIV2 DUP2 ^$digit JSR #000a MUL2 SUB2 |
|
| 136 |
- ^$digit JSR |
|
| 168 |
+ #2710 ^modf JSR ^$digit JSR |
|
| 169 |
+ #03e8 ^modf JSR ^$digit JSR |
|
| 170 |
+ $byte-start |
|
| 171 |
+ #0064 ^modf JSR ^$digit JSR |
|
| 172 |
+ #000a ^modf JSR ^$digit JSR |
|
| 173 |
+ ^$digit JSR |
|
| 137 | 174 |
~number.started ^$end JNZ |
| 138 | 175 |
#30 =Console.char |
| 139 | 176 |
$end JMP2r |
| 140 | 177 |
|
| 141 | 178 |
$digit |
| 142 | 179 |
SWP POP |
| 143 |
- OVR ~number.started ORA #02 JNZ |
|
| 180 |
+ DUP ~number.started ORA #02 JNZ |
|
| 144 | 181 |
POP JMP2r |
| 145 | 182 |
#30 ADD =Console.char |
| 146 | 183 |
#01 =number.started |
| 147 | 184 |
JMP2r |
| 148 | 185 |
|
| 186 |
+@modf ( dividend₂ divisor₂ -- remainder₂ quotient₂ ) |
|
| 187 |
+ OVR2 OVR2 DIV2 DUP2 STH2 MUL2 SUB2 STH2r JMP2r |
|
| 188 |
+ |
|
| 149 | 189 |
@strings |
| 150 | 190 |
$fps [ 20 fps 0a 00 ] |
| 151 | 191 |
|
| 152 |
-@font |
|
| 192 |
+@font-numbers |
|
| 193 |
+[ |
|
| 194 |
+ 7cc6 ced6 e6c6 7c00 1838 1818 1818 7e00 3c66 063c 6066 7e00 |
|
| 195 |
+ 3c66 061c 0666 3c00 1c3c 6ccc fe0c 1e00 7e62 607c 0666 3c00 |
|
| 196 |
+ 3c66 607c 6666 3c00 7e66 060c 1818 1800 3c66 663c 6666 3c00 |
|
| 197 |
+ 3c66 663e 0666 3c00 0018 1800 1818 0000 |
|
| 198 |
+] |
|
| 199 |
+ |
|
| 200 |
+@font-letters |
|
| 153 | 201 |
[ |
| 154 |
- 003c 464a 5262 3c00 0018 0808 0808 1c00 |
|
| 155 |
- 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
|
| 156 |
- 000c 1424 447e 0400 007e 407c 0242 3c00 |
|
| 157 |
- 003c 407c 4242 3c00 007e 0204 0810 1000 |
|
| 158 |
- 003c 423c 4242 3c00 003c 4242 3e02 3c00 |
|
| 202 |
+ 183c 6666 7e66 6600 fc66 667c 6666 fc00 3c66 c0c0 c066 3c00 |
|
| 203 |
+ f86c 6666 666c f800 fe62 6878 6862 fe00 fe62 6878 6860 f000 |
|
| 204 |
+ 3c66 c0c0 ce66 3e00 6666 667e 6666 6600 7e18 1818 1818 7e00 |
|
| 205 |
+ 1e0c 0c0c cccc 7800 e666 6c78 6c66 e600 f060 6060 6266 fe00 |
|
| 206 |
+ c6ee fefe d6c6 c600 c6e6 f6de cec6 c600 386c c6c6 c66c 3800 |
|
| 207 |
+ fc66 667c 6060 f000 386c c6c6 dacc 7600 fc66 667c 6c66 e600 |
|
| 208 |
+ 3c66 603c 0666 3c00 7e5a 1818 1818 3c00 6666 6666 6666 3c00 |
|
| 209 |
+ 6666 6666 663c 1800 c6c6 c6d6 feee c600 c66c 3838 6cc6 c600 |
|
| 210 |
+ 6666 663c 1818 3c00 fec6 8c18 3266 fe00 0018 187e 1818 0000 |
|
| 159 | 211 |
] |
| 160 | 212 |
|