| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,214 +0,0 @@ |
| 1 |
-( repl |
|
| 2 |
- |
|
| 3 |
- implemented: hardly anything |
|
| 4 |
- |
|
| 5 |
- yet to implement: practically everything |
|
| 6 |
-) |
|
| 7 |
- |
|
| 8 |
-( devices ) |
|
| 9 |
- |
|
| 10 |
-|00 @System &vector $2 &pad $6 &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 |
-|80 @Controller [ &vector $2 &button $1 &key $1 ] |
|
| 13 |
-|a0 @File &vector $2 &success $2 &offset-hs $2 &offset-ls $2 &name $2 &length $2 &load $2 &save $2 |
|
| 14 |
- |
|
| 15 |
-( init ) |
|
| 16 |
- |
|
| 17 |
-|0100 ( -> ) |
|
| 18 |
-@user-program |
|
| 19 |
- ;init ;repl/fn STA2 |
|
| 20 |
- #2000 JMP2 |
|
| 21 |
- &erase-end |
|
| 22 |
- |
|
| 23 |
-|2000 ( -> ) |
|
| 24 |
- &end |
|
| 25 |
- ,repl/fn LDR2 JSR2 |
|
| 26 |
- BRK |
|
| 27 |
- |
|
| 28 |
-@repl [ &fn $2 &font-height $1 &font-cells $1 ] |
|
| 29 |
-@buffer [ &cursor $2 &end $2 ] |
|
| 30 |
- |
|
| 31 |
-@init |
|
| 32 |
- ( theme ) |
|
| 33 |
- #0fa7 .System/r DEO2 |
|
| 34 |
- #0fa7 .System/g DEO2 |
|
| 35 |
- #0fa7 .System/b DEO2 |
|
| 36 |
- |
|
| 37 |
- ( vectors ) |
|
| 38 |
- #2000 .Screen/vector DEO2 |
|
| 39 |
- ;on-key .Controller/vector DEO2 |
|
| 40 |
- |
|
| 41 |
- ( default function ) |
|
| 42 |
- ;main ,repl/fn STR2 |
|
| 43 |
- |
|
| 44 |
- ( buffer ) |
|
| 45 |
- ;ring-buffer |
|
| 46 |
- DUP2 ,buffer/cursor STR2 |
|
| 47 |
- ,buffer/end STR2 |
|
| 48 |
- |
|
| 49 |
- ( clear out user-program ) |
|
| 50 |
- ;user-program/erase-end ;user-program |
|
| 51 |
- &clear-loop |
|
| 52 |
- #0000 OVR2 STA2 |
|
| 53 |
- #0002 ADD2 |
|
| 54 |
- GTH2k ,&clear-loop JCN |
|
| 55 |
- POP2 POP2 |
|
| 56 |
- |
|
| 57 |
- ( load font ) |
|
| 58 |
- ;font ;load-font JMP2 ( tail call ) |
|
| 59 |
- |
|
| 60 |
-@main ( -- ) |
|
| 61 |
- JMP2r |
|
| 62 |
- |
|
| 63 |
-@on-key ( -> ) |
|
| 64 |
- .Controller/button DEI #01 AND ,&skip JCN |
|
| 65 |
- .Controller/key DEI |
|
| 66 |
- DUP #e0 AND ,&append JCN |
|
| 67 |
- DUP #08 EQU ,&backspace JCN |
|
| 68 |
- DUP #0d EQU ,&execute JCN |
|
| 69 |
- POP &skip BRK |
|
| 70 |
- |
|
| 71 |
- &append |
|
| 72 |
- ;buffer/cursor LDA2 |
|
| 73 |
- STH2k STA |
|
| 74 |
- STH2r INC2 ;ring-buffer ORA2 ;buffer/cursor STA2 |
|
| 75 |
- ,&draw JMP |
|
| 76 |
- |
|
| 77 |
- &backspace |
|
| 78 |
- &execute |
|
| 79 |
- DUP EOR |
|
| 80 |
- ;buffer/cursor LDA2 |
|
| 81 |
- #0001 SUB2 ;ring-buffer ORA2 DUP2 ;buffer/cursor STA2 |
|
| 82 |
- STA |
|
| 83 |
- |
|
| 84 |
- &draw |
|
| 85 |
- #0000 DUP2 .Screen/x DEO2 .Screen/y DEO2 |
|
| 86 |
- ;ring-buffer ;wrapped-write JSR2 |
|
| 87 |
- |
|
| 88 |
- #00 ;draw-glyph JSR2 |
|
| 89 |
- BRK |
|
| 90 |
- |
|
| 91 |
-@load-font ( filename* -- ) |
|
| 92 |
- DUP2 .File/name DEO2 |
|
| 93 |
- ( find end of string for suffix ) |
|
| 94 |
- &loop |
|
| 95 |
- INC2 |
|
| 96 |
- LDAk ,&loop JCN |
|
| 97 |
- ( suffix is cell size ) |
|
| 98 |
- #0001 SUB2 LDAk #0f AND ;repl/font-cells STA |
|
| 99 |
- ( search backwards for number ) |
|
| 100 |
- &loop2 |
|
| 101 |
- #0001 SUB2 |
|
| 102 |
- LDAk DUP #2f GTH STH #3a LTH STHr #0101 NEQ2 ,&loop2 JCN |
|
| 103 |
- ( parse number to find font height ) |
|
| 104 |
- #0001 STH2 |
|
| 105 |
- &loop3 |
|
| 106 |
- LDAk DUPk #2f GTH STH #3a LTH STHr #0101 NEQ2 ,&end-loop3 JCN |
|
| 107 |
- #30 SUB STHr MULk STH ADDr #0a MUL STH POP |
|
| 108 |
- #0001 SUB2 |
|
| 109 |
- ,&loop3 JMP |
|
| 110 |
- &end-loop3 |
|
| 111 |
- STH2r POP ;repl/font-height STA |
|
| 112 |
- POP |
|
| 113 |
- POP2 |
|
| 114 |
- |
|
| 115 |
- ;repl/font-cells LDA DUP MUL #08 MUL INC #00 .File/length DEO2 |
|
| 116 |
- ;font-data .File/load DEO2 |
|
| 117 |
- |
|
| 118 |
- JMP2r |
|
| 119 |
- |
|
| 120 |
-@get-word-width ( string* -- string* width* ) |
|
| 121 |
- DUP2 LIT2r 0000 |
|
| 122 |
- &loop |
|
| 123 |
- LDAk DUP #20 GTH ,¬-end JCN |
|
| 124 |
- POP |
|
| 125 |
- POP2 STH2r |
|
| 126 |
- JMP2r |
|
| 127 |
- |
|
| 128 |
- ¬-end |
|
| 129 |
- #00 SWP ;font-data ADD2 LDA |
|
| 130 |
- LITr 00 STH ADD2r |
|
| 131 |
- INC2 |
|
| 132 |
- ,&loop JMP |
|
| 133 |
- |
|
| 134 |
-@wrapped-write ( string* -- ) |
|
| 135 |
- LDAk ,¬-end JCN |
|
| 136 |
- POP2 |
|
| 137 |
- JMP2r |
|
| 138 |
- |
|
| 139 |
- ¬-end |
|
| 140 |
- ,get-word-width JSR .Screen/x DEI2 ADD2 .Screen/width DEI2 LTH2 ,&no-cr JCN |
|
| 141 |
- ,cr JSR |
|
| 142 |
- &no-cr |
|
| 143 |
- ,write JSR |
|
| 144 |
- ,wrapped-write JMP |
|
| 145 |
- |
|
| 146 |
-@cr ( -- ) |
|
| 147 |
- #0000 .Screen/x DEO2 |
|
| 148 |
- .Screen/y DEI2 #00 ;repl/font-height LDA ADD2 .Screen/y DEO2 |
|
| 149 |
- JMP2r |
|
| 150 |
- |
|
| 151 |
-@write ( string* -- end-of-string* ) |
|
| 152 |
- LDAk DUP ,¬-end JCN |
|
| 153 |
- POP |
|
| 154 |
- JMP2r |
|
| 155 |
- |
|
| 156 |
- ¬-end |
|
| 157 |
- #00 SWP #00 ;repl/font-cells LDA MUL2k MUL2 #0008 MUL2 #0100 ADD2 ( string* char* tile* ) |
|
| 158 |
- ;font-data ADD2 .Screen/addr DEO2 |
|
| 159 |
- #0d ,draw-glyph JSR |
|
| 160 |
- #00 ;repl/font-cells LDA #fff8 MUL2 .Screen/y DEI2 ADD2 .Screen/y DEO2 |
|
| 161 |
- ;font-data ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 .Screen/x DEO2 |
|
| 162 |
- LDAk STH |
|
| 163 |
- INC2 |
|
| 164 |
- STHr #20 GTH ;write JCN2 |
|
| 165 |
- JMP2r |
|
| 166 |
- |
|
| 167 |
-@draw-glyph ( color -- ) |
|
| 168 |
- STH |
|
| 169 |
- ;repl/font-cells LDA |
|
| 170 |
- &outer |
|
| 171 |
- DUP #00 EQU ,&end-outer JCN |
|
| 172 |
- ;repl/font-cells LDA |
|
| 173 |
- &inner |
|
| 174 |
- DUP #00 EQU ,&end-inner JCN |
|
| 175 |
- STHkr .Screen/sprite DEO |
|
| 176 |
- #0008 DUP2 |
|
| 177 |
- .Screen/x DEI2 ADD2 .Screen/x DEO2 |
|
| 178 |
- .Screen/addr DEI2 ADD2 .Screen/addr DEO2 |
|
| 179 |
- #01 SUB |
|
| 180 |
- ,&inner JMP |
|
| 181 |
- &end-inner |
|
| 182 |
- POP |
|
| 183 |
- #00 ;repl/font-cells LDA #fff8 MUL2 .Screen/x DEI2 ADD2 .Screen/x DEO2 |
|
| 184 |
- #0008 .Screen/y DEI2 ADD2 .Screen/y DEO2 |
|
| 185 |
- #01 SUB |
|
| 186 |
- ,&outer JMP |
|
| 187 |
- &end-outer |
|
| 188 |
- POP |
|
| 189 |
- POPr |
|
| 190 |
- JMP2r |
|
| 191 |
- |
|
| 192 |
-@body |
|
| 193 |
- 4927 6c6c 206d 616b 6520 6120 736f 756e |
|
| 194 |
- 6420 7468 6174 2773 2073 6f20 616c 6f6e |
|
| 195 |
- 6520 74 6861 7420 6e6f 206f 6e65 2063 |
|
| 196 |
- 616e 206d 6973 7320 6974 2c20 7468 6174 |
|
| 197 |
- 2077 686f 6576 6572 20 6865 6172 7320 |
|
| 198 |
- 6974 2077 696c 6c20 7765 6570 2069 6e20 |
|
| 199 |
- 7468 6569 7220 736f 756c 732c 20 616e |
|
| 200 |
- 6420 6865 6172 7468 7320 7769 6c6c 2073 |
|
| 201 |
- 6565 6d20 7761 726d 6572 2c20 61 6e64 |
|
| 202 |
- 2062 6569 6e67 2069 6e73 6964 6520 7769 |
|
| 203 |
- 6c6c 2073 6565 6d20 6265 7474 6572 20 |
|
| 204 |
- 746f 2061 6c6c 2077 686f 2068 6561 7220 |
|
| 205 |
- 6974 2069 6e20 7468 6520 6469 7374 616e |
|
| 206 |
- 7420 746f 776e 732e 20 $1 |
|
| 207 |
- |
|
| 208 |
-@font |
|
| 209 |
- "projects/fonts/venice14.uf2 $1 |
|
| 210 |
- |
|
| 211 |
-@font-data |
|
| 212 |
- |
|
| 213 |
-|fe00 @ring-buffer |
|
| 214 |
- |