| ... | ... |
@@ -20,7 +20,7 @@ |
| 20 | 20 |
#0f0f .System/b DEO2 |
| 21 | 21 |
( find center ) |
| 22 | 22 |
.Screen/width DEI2 #01 SFT2 .center/x STZ2 |
| 23 |
- .Screen/height DEI2 #01 SFT2 .center/y STZ2 |
|
| 23 |
+ .Screen/height DEI2 #01 SFT2 #0020 ADD2 .center/y STZ2 |
|
| 24 | 24 |
( place controller ) |
| 25 | 25 |
#0068 .frame/w STZ2 |
| 26 | 26 |
#0030 .frame/h STZ2 |
| ... | ... |
@@ -33,15 +33,15 @@ |
| 33 | 33 |
( frame ) |
| 34 | 34 |
.frame/x0 LDZ2 .frame/y0 LDZ2 |
| 35 | 35 |
.frame/x1 LDZ2 .frame/y1 LDZ2 |
| 36 |
- #03 ;line-rect JSR2 |
|
| 36 |
+ #03 line-rect |
|
| 37 | 37 |
|
| 38 |
- ,draw-controller JSR |
|
| 38 |
+ draw-controller |
|
| 39 | 39 |
|
| 40 | 40 |
BRK |
| 41 | 41 |
|
| 42 | 42 |
@on-button ( -> ) |
| 43 | 43 |
|
| 44 |
- ,draw-controller JSR |
|
| 44 |
+ draw-controller |
|
| 45 | 45 |
|
| 46 | 46 |
( print stack on start button ) |
| 47 | 47 |
.Controller/button DEI #08 EQU [ JMP BRK ] #010e DEO |
| ... | ... |
@@ -55,52 +55,52 @@ BRK |
| 55 | 55 |
( d-pad ) |
| 56 | 56 |
.frame/x0 LDZ2 #0010 ADD2 .Screen/x DEO2 |
| 57 | 57 |
.frame/y0 LDZ2 #0010 ADD2 .Screen/y DEO2 |
| 58 |
- ;controller-icn/dpad-up .Screen/addr DEO2 |
|
| 58 |
+ ;ctrl-icns/dpad-up .Screen/addr DEO2 |
|
| 59 | 59 |
#03 STHkr #04 SFT #01 AND SUB .Screen/sprite DEO |
| 60 | 60 |
.Screen/y DEI2 #0010 ADD2 .Screen/y DEO2 |
| 61 |
- ;controller-icn/dpad-down .Screen/addr DEO2 |
|
| 61 |
+ ;ctrl-icns/dpad-down .Screen/addr DEO2 |
|
| 62 | 62 |
#03 STHkr #05 SFT #01 AND SUB .Screen/sprite DEO |
| 63 | 63 |
.Screen/y DEI2 #0008 SUB2 .Screen/y DEO2 |
| 64 | 64 |
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 |
| 65 |
- ;controller-icn/dpad-left .Screen/addr DEO2 |
|
| 65 |
+ ;ctrl-icns/dpad-left .Screen/addr DEO2 |
|
| 66 | 66 |
#03 STHkr #06 SFT #01 AND SUB .Screen/sprite DEO |
| 67 | 67 |
.Screen/x DEI2 #0010 ADD2 .Screen/x DEO2 |
| 68 |
- ;controller-icn/dpad-right .Screen/addr DEO2 |
|
| 68 |
+ ;ctrl-icns/dpad-right .Screen/addr DEO2 |
|
| 69 | 69 |
#03 STHkr #07 SFT #01 AND SUB .Screen/sprite DEO |
| 70 | 70 |
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2 |
| 71 |
- ;controller-icn/dpad .Screen/addr DEO2 |
|
| 72 |
- #03 .Screen/sprite DEO |
|
| 71 |
+ ;ctrl-icns/dpad .Screen/addr DEO2 |
|
| 72 |
+ [ LIT2 03 -Screen/sprite ] DEO |
|
| 73 | 73 |
|
| 74 | 74 |
( options ) |
| 75 | 75 |
.center/y LDZ2 #0009 ADD2 .Screen/y DEO2 |
| 76 | 76 |
.center/x LDZ2 #0009 SUB2 .Screen/x DEO2 |
| 77 |
- ;controller-icn/option .Screen/addr DEO2 |
|
| 77 |
+ ;ctrl-icns/option .Screen/addr DEO2 |
|
| 78 | 78 |
#03 STHkr #03 SFT #01 AND SUB .Screen/sprite DEO |
| 79 | 79 |
.center/x LDZ2 #0004 ADD2 .Screen/x DEO2 |
| 80 |
- ;controller-icn/option .Screen/addr DEO2 |
|
| 80 |
+ ;ctrl-icns/option .Screen/addr DEO2 |
|
| 81 | 81 |
#03 STHkr #02 SFT #01 AND SUB .Screen/sprite DEO |
| 82 | 82 |
|
| 83 | 83 |
( buttons ) |
| 84 | 84 |
.center/y LDZ2 .Screen/y DEO2 |
| 85 | 85 |
.center/x LDZ2 #0018 ADD2 .Screen/x DEO2 |
| 86 |
- ;controller-icn/button .Screen/addr DEO2 |
|
| 86 |
+ ;ctrl-icns/button .Screen/addr DEO2 |
|
| 87 | 87 |
#03 STHkr #01 SFT #01 AND SUB .Screen/sprite DEO |
| 88 | 88 |
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2 |
| 89 | 89 |
;font-hex/b .Screen/addr DEO2 |
| 90 |
- #03 .Screen/sprite DEO |
|
| 90 |
+ [ LIT2 03 -Screen/sprite ] DEO |
|
| 91 | 91 |
|
| 92 | 92 |
.center/y LDZ2 .Screen/y DEO2 |
| 93 | 93 |
.center/x LDZ2 #0024 ADD2 .Screen/x DEO2 |
| 94 |
- ;controller-icn/button .Screen/addr DEO2 |
|
| 94 |
+ ;ctrl-icns/button .Screen/addr DEO2 |
|
| 95 | 95 |
#03 STHr #01 AND SUB .Screen/sprite DEO |
| 96 | 96 |
.Screen/y DEI2 #000a ADD2 .Screen/y DEO2 |
| 97 | 97 |
;font-hex/a .Screen/addr DEO2 |
| 98 |
- #03 .Screen/sprite DEO |
|
| 98 |
+ [ LIT2 03 -Screen/sprite ] DEO |
|
| 99 | 99 |
|
| 100 | 100 |
.center/x LDZ2 #0010 SUB2 .Screen/x DEO2 |
| 101 | 101 |
.center/y LDZ2 #0010 SUB2 .Screen/y DEO2 |
| 102 | 102 |
#01 .Screen/auto DEO |
| 103 |
- .Controller/button DEI2 ,draw-short JSR |
|
| 103 |
+ .Controller/button DEI2 draw-short |
|
| 104 | 104 |
#00 .Screen/auto DEO |
| 105 | 105 |
|
| 106 | 106 |
JMP2r |
| ... | ... |
@@ -109,16 +109,16 @@ JMP2r |
| 109 | 109 |
|
| 110 | 110 |
@draw-short ( short* -- ) |
| 111 | 111 |
|
| 112 |
- SWP ,draw-byte JSR |
|
| 112 |
+ SWP draw-byte |
|
| 113 | 113 |
|
| 114 | 114 |
@draw-byte ( byte -- ) |
| 115 | 115 |
|
| 116 |
- DUP #04 SFT ,draw-hex JSR |
|
| 116 |
+ DUP #04 SFT draw-hex |
|
| 117 | 117 |
|
| 118 | 118 |
@draw-hex ( char -- ) |
| 119 | 119 |
|
| 120 | 120 |
#00 SWP #0f AND #30 SFT2 ;font-hex ADD2 .Screen/addr DEO2 |
| 121 |
- #03 .Screen/sprite DEO |
|
| 121 |
+ [ LIT2 03 -Screen/sprite ] DEO |
|
| 122 | 122 |
|
| 123 | 123 |
JMP2r |
| 124 | 124 |
|
| ... | ... |
@@ -135,7 +135,7 @@ JMP2r |
| 135 | 135 |
DUP2 .Screen/x DEO2 |
| 136 | 136 |
[ LIT2 &hor-y1 $2 ] .Screen/y DEO2 STHkr .Screen/pixel DEOk |
| 137 | 137 |
[ LIT2 &hor-y2 $2 ] .Screen/y DEO2 DEO |
| 138 |
- INC2 GTH2k ,&hor JCN |
|
| 138 |
+ INC2 GTH2k ?&hor |
|
| 139 | 139 |
POP2 POP2 |
| 140 | 140 |
( vertical ) |
| 141 | 141 |
[ LIT2 &ver-y2 $2 ] [ LIT2 &ver-y1 $2 ] |
| ... | ... |
@@ -143,20 +143,20 @@ JMP2r |
| 143 | 143 |
DUP2 .Screen/y DEO2 |
| 144 | 144 |
[ LIT2 &ver-x1 $2 ] .Screen/x DEO2 STHkr .Screen/pixel DEOk |
| 145 | 145 |
[ LIT2 &ver-x2 $2 ] .Screen/x DEO2 DEO |
| 146 |
- INC2 GTH2k ,&ver JCN |
|
| 146 |
+ INC2 GTH2k ?&ver |
|
| 147 | 147 |
POP2 POP2 |
| 148 | 148 |
POPr |
| 149 | 149 |
|
| 150 | 150 |
JMP2r |
| 151 | 151 |
|
| 152 |
-@controller-icn |
|
| 152 |
+@ctrl-icns [ |
|
| 153 | 153 |
&dpad ffff ffff ffff ffff |
| 154 | 154 |
&dpad-up 7eff e7c3 ffff ffff |
| 155 | 155 |
&dpad-down ffff ffff c3e7 ff7e |
| 156 | 156 |
&dpad-left 7fff efcf cfef ff7f |
| 157 | 157 |
&dpad-right feff f7f3 f3f7 fffe |
| 158 | 158 |
&option 0000 7eff ff7e 0000 |
| 159 |
- &button 3c7e ffff ffff 7e3c |
|
| 159 |
+ &button 3c7e ffff ffff 7e3c ] |
|
| 160 | 160 |
|
| 161 | 161 |
@font-hex |
| 162 | 162 |
007c 8282 8282 827c 0030 1010 1010 1010 |
| ... | ... |
@@ -31,7 +31,7 @@ BRK |
| 31 | 31 |
|
| 32 | 32 |
@on-frame ( -> ) |
| 33 | 33 |
|
| 34 |
- .Mouse/state DEI ,&skip JCN |
|
| 34 |
+ .Mouse/state DEI ?&skip |
|
| 35 | 35 |
;run DUP2 JSR2 JSR2 |
| 36 | 36 |
&skip |
| 37 | 37 |
|
| ... | ... |
@@ -43,15 +43,15 @@ BRK |
| 43 | 43 |
( clear last cursor ) |
| 44 | 44 |
.pointer/x LDZ2 .Screen/x DEO2 |
| 45 | 45 |
.pointer/y LDZ2 .Screen/y DEO2 |
| 46 |
- #40 .Screen/sprite DEO |
|
| 46 |
+ [ LIT2 40 -Screen/sprite ] DEO |
|
| 47 | 47 |
( draw new cursor ) |
| 48 | 48 |
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .Screen/x DEO2 |
| 49 | 49 |
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .Screen/y DEO2 |
| 50 | 50 |
#42 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO |
| 51 | 51 |
( on down ) |
| 52 |
- .Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU AND ,on-mouse-down JCN |
|
| 52 |
+ .Mouse/state DEI #00 NEQ .pointer/state LDZ #00 EQU AND ?on-mouse-down |
|
| 53 | 53 |
( on drag ) |
| 54 |
- .Mouse/state DEI ,on-mouse-drag JCN |
|
| 54 |
+ .Mouse/state DEI ?on-mouse-drag |
|
| 55 | 55 |
.Mouse/state DEI .pointer/state STZ |
| 56 | 56 |
|
| 57 | 57 |
BRK |
| ... | ... |
@@ -59,7 +59,7 @@ BRK |
| 59 | 59 |
@on-mouse-down ( -> ) |
| 60 | 60 |
|
| 61 | 61 |
#0000 DUP2 .length STZ2 .frame STZ2 |
| 62 |
- ;clear-screen JSR2 |
|
| 62 |
+ clear-screen |
|
| 63 | 63 |
( record start position ) |
| 64 | 64 |
.Mouse/x DEI2 DUP2 .pointer/x STZ2 .pointer/lastx STZ2 |
| 65 | 65 |
.Mouse/y DEI2 DUP2 .pointer/y STZ2 .pointer/lasty STZ2 |
| ... | ... |
@@ -80,8 +80,7 @@ BRK |
| 80 | 80 |
.pointer/lasty LDZ2 |
| 81 | 81 |
.pointer/x LDZ2 |
| 82 | 82 |
.pointer/y LDZ2 |
| 83 |
- #01 |
|
| 84 |
- ;draw-line JSR2 |
|
| 83 |
+ #01 draw-line |
|
| 85 | 84 |
( record last position ) |
| 86 | 85 |
.Mouse/x DEI2 |
| 87 | 86 |
DUP2 .pointer/lastx STZ2 |
| ... | ... |
@@ -104,7 +103,7 @@ BRK |
| 104 | 103 |
( line ) |
| 105 | 104 |
.pen/x LDZ2 .pen/y LDZ2 |
| 106 | 105 |
.pen/x2 LDZ2 .pen/y2 LDZ2 |
| 107 |
- .frame LDZ2 #01 SFT2 NIP #01 AND INC ;draw-line JSR2 |
|
| 106 |
+ .frame LDZ2 #01 SFT2 NIP #01 AND INC draw-line |
|
| 108 | 107 |
( history ) |
| 109 | 108 |
.pen/x LDZ2 .pen/x2 STZ2 |
| 110 | 109 |
.pen/y LDZ2 .pen/y2 STZ2 |
| ... | ... |
@@ -116,26 +115,26 @@ JMP2r |
| 116 | 115 |
@draw-line ( x1* y1* x2* y2* color -- ) |
| 117 | 116 |
|
| 118 | 117 |
( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2 |
| 119 |
- ,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2 |
|
| 120 |
- #0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2 |
|
| 121 |
- #ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sx STR2 |
|
| 122 |
- #ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 DUP2 ADD2 ADD2 ,&sy STR2 |
|
| 118 |
+ ,&x LDR2 .line/x LDZ2 SUB2 abs2 .line/dx STZ2 |
|
| 119 |
+ #0000 ,&y LDR2 .line/y LDZ2 SUB2 abs2 SUB2 .line/dy STZ2 |
|
| 120 |
+ #ffff #00 .line/x LDZ2 ,&x LDR2 lts2 DUP2 ADD2 ADD2 ,&sx STR2 |
|
| 121 |
+ #ffff #00 .line/y LDZ2 ,&y LDR2 lts2 DUP2 ADD2 ADD2 ,&sy STR2 |
|
| 123 | 122 |
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 |
| 124 | 123 |
&loop |
| 125 | 124 |
.line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2 |
| 126 | 125 |
.line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2 |
| 127 | 126 |
STHkr .Screen/pixel DEO |
| 128 |
- AND ,&end JCN |
|
| 127 |
+ AND ?&end |
|
| 129 | 128 |
.line/e1 LDZ2 DUP2 ADD2 DUP2 |
| 130 |
- .line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN |
|
| 129 |
+ .line/dy LDZ2 lts2 ?&skipy |
|
| 131 | 130 |
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2 |
| 132 | 131 |
.line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2 |
| 133 | 132 |
&skipy |
| 134 |
- .line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN |
|
| 133 |
+ .line/dx LDZ2 gts2 ?&skipx |
|
| 135 | 134 |
.line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2 |
| 136 | 135 |
.line/y LDZ2 [ LIT2 &sy $2 ] ADD2 .line/y STZ2 |
| 137 | 136 |
&skipx |
| 138 |
- ,&loop JMP |
|
| 137 |
+ !&loop |
|
| 139 | 138 |
&end |
| 140 | 139 |
POPr |
| 141 | 140 |
|
| ... | ... |
@@ -153,10 +152,10 @@ JMP2r |
| 153 | 152 |
.Screen/width DEI2 #03 SFT2 NIP #00 |
| 154 | 153 |
&x |
| 155 | 154 |
#00 OVR #30 SFT2 .Screen/x DEO2 |
| 156 |
- #00 .Screen/sprite DEO |
|
| 157 |
- INC GTHk ,&x JCN |
|
| 155 |
+ [ LIT2 00 -Screen/sprite ] DEO |
|
| 156 |
+ INC GTHk ?&x |
|
| 158 | 157 |
POP2 |
| 159 |
- INC GTHk ,&y JCN |
|
| 158 |
+ INC GTHk ?&y |
|
| 160 | 159 |
POP2 |
| 161 | 160 |
|
| 162 | 161 |
JMP2r |
| ... | ... |
@@ -6,18 +6,17 @@ |
| 6 | 6 |
|
| 7 | 7 |
#0000 INC2k ADD2k |
| 8 | 8 |
&loop |
| 9 |
- DUP2 ,print-hex JSR #0a18 DEO |
|
| 10 |
- ADD2k LTH2k ,&loop JCN |
|
| 11 |
- |
|
| 9 |
+ DUP2 print #0a18 DEO |
|
| 10 |
+ ADD2k LTH2k ?&loop |
|
| 12 | 11 |
( halt ) |
| 13 | 12 |
#010f DEO |
| 14 | 13 |
|
| 15 | 14 |
BRK |
| 16 | 15 |
|
| 17 |
-@print-hex ( short* -- ) |
|
| 16 |
+@print ( short* -- ) |
|
| 18 | 17 |
|
| 19 |
- SWP ,&byte JSR |
|
| 20 |
- &byte ( byte -- ) DUP #04 SFT ,&char JSR |
|
| 18 |
+ SWP print/byte |
|
| 19 |
+ &byte ( byte -- ) DUP #04 SFT print/char |
|
| 21 | 20 |
&char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO |
| 22 | 21 |
|
| 23 | 22 |
JMP2r |