... | ... |
@@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr |
20 | 20 |
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator |
21 | 21 |
|
22 | 22 |
# run |
23 |
-./bin/assembler projects/examples/dev.controller.usm bin/boot.rom |
|
23 |
+./bin/assembler projects/software/left.usm bin/boot.rom |
|
24 | 24 |
./bin/emulator bin/boot.rom |
... | ... |
@@ -42,7 +42,7 @@ RTN |
42 | 42 |
|
43 | 43 |
@blink-cursor |
44 | 44 |
|
45 |
- ,skip ~timer #10 LTH JMP2? POP2 |
|
45 |
+ ,skip ~timer #10 LTH JMP2? |
|
46 | 46 |
#00 =timer |
47 | 47 |
~blink #00 EQU =blink |
48 | 48 |
,cursor =Sprite.addr |
... | ... |
@@ -61,9 +61,9 @@ RTN |
61 | 61 |
$hor |
62 | 62 |
( draw ) ~color =Sprite.color |
63 | 63 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
64 |
- ,$hor ~Sprite.x ~rect.x2 LTH2 JMP2? POP2 |
|
64 |
+ ,$hor ~Sprite.x ~rect.x2 LTH2 JMP2? |
|
65 | 65 |
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y |
66 |
- ,$ver ~Sprite.y ~rect.y2 LTH2 JMP2? POP2 |
|
66 |
+ ,$ver ~Sprite.y ~rect.y2 LTH2 JMP2? |
|
67 | 67 |
|
68 | 68 |
RTN |
69 | 69 |
|
... | ... |
@@ -75,9 +75,9 @@ RTN |
75 | 75 |
$hor |
76 | 76 |
( draw ) ~color =Screen.color |
77 | 77 |
( incr ) ~Screen.x #0001 ADD2 =Screen.x |
78 |
- ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? POP2 |
|
78 |
+ ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? |
|
79 | 79 |
( incr ) ~Screen.y #0001 ADD2 =Screen.y |
80 |
- ,$ver ~Screen.y ~rect.y2 LTH2 JMP2? POP2 |
|
80 |
+ ,$ver ~Screen.y ~rect.y2 LTH2 JMP2? |
|
81 | 81 |
|
82 | 82 |
RTN |
83 | 83 |
|
... | ... |
@@ -88,13 +88,13 @@ RTN |
88 | 88 |
( incr ) ~Screen.x #0001 ADD2 =Screen.x |
89 | 89 |
( draw ) ~rect.y1 =Screen.y ~color =Screen.color |
90 | 90 |
( draw ) ~rect.y2 =Screen.y ~color =Screen.color |
91 |
- ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? POP2 |
|
91 |
+ ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? |
|
92 | 92 |
~rect.y1 =Screen.y |
93 | 93 |
$ver |
94 | 94 |
( draw ) ~rect.x1 =Screen.x ~color =Screen.color |
95 | 95 |
( draw ) ~rect.x2 =Screen.x ~color =Screen.color |
96 | 96 |
( incr ) ~Screen.y #0001 ADD2 =Screen.y |
97 |
- ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 |
|
97 |
+ ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? |
|
98 | 98 |
|
99 | 99 |
RTN |
100 | 100 |
|
... | ... |
@@ -105,14 +105,14 @@ RTN |
105 | 105 |
$loop |
106 | 106 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~textarea.color =Sprite.color |
107 | 107 |
( detect linebreaks ) |
108 |
- DUP2 LDR #0d NEQ ,$no-return ROT JMP2? POP2 |
|
108 |
+ DUP2 LDR #0d NEQ ,$no-return ROT JMP2? |
|
109 | 109 |
~textarea.x1 =Sprite.x |
110 | 110 |
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y |
111 | 111 |
( decr ) ~Sprite.x #0008 SUB2 =Sprite.x |
112 | 112 |
$no-return |
113 | 113 |
( incr ) #0001 ADD2 |
114 | 114 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
115 |
- DUP2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
115 |
+ DUP2 LDR #00 NEQ ,$loop ROT JMP2? |
|
116 | 116 |
POP2 |
117 | 117 |
|
118 | 118 |
RTN |
... | ... |
@@ -120,10 +120,10 @@ RTN |
120 | 120 |
@do-textarea |
121 | 121 |
|
122 | 122 |
( ,blink-cursor JSR2 ) |
123 |
- ,do-textarea-end ~Keys #00 EQU JMP2? POP2 ( skip on no key ) |
|
123 |
+ ,do-textarea-end ~Keys #00 EQU JMP2? ( skip on no key ) |
|
124 | 124 |
( backspace ) |
125 |
- ,any-key ~Keys #08 NEQ JMP2? POP2 |
|
126 |
- ,input-end ~textarea.cursor #00 EQU JMP2? POP2 |
|
125 |
+ ,any-key ~Keys #08 NEQ JMP2? |
|
126 |
+ ,input-end ~textarea.cursor #00 EQU JMP2? |
|
127 | 127 |
( decr ) ~textarea.cursor #01 SUB =textarea.cursor |
128 | 128 |
#00 ~textarea.addr #00 ~textarea.cursor ADD2 STR |
129 | 129 |
,input-end JMP2 |
... | ... |
@@ -142,7 +142,7 @@ RTN |
142 | 142 |
|
143 | 143 |
@do-cursor |
144 | 144 |
|
145 |
- ,skip-drag ~Mouse.state #01 NEQ JMP2? POP2 |
|
145 |
+ ,skip-drag ~Mouse.state #01 NEQ JMP2? |
|
146 | 146 |
~mouse.x =textarea.x1 ~mouse.y =textarea.y1 |
147 | 147 |
,redraw-window JSR2 |
148 | 148 |
,redraw JSR2 |
... | ... |
@@ -22,23 +22,23 @@ BRK |
22 | 22 |
,draw-cursor JSR2 |
23 | 23 |
|
24 | 24 |
( reset timer -> move cat tail ) |
25 |
- ,no-click ~Mouse.state #00 EQU JMP2? POP2 |
|
25 |
+ ,no-click ~Mouse.state #00 EQU JMP2? |
|
26 | 26 |
#50 =timer |
27 | 27 |
@no-click |
28 | 28 |
( detect click ) |
29 |
- ,no-click12 ~Mouse.state #11 NEQ JMP2? POP2 |
|
29 |
+ ,no-click12 ~Mouse.state #11 NEQ JMP2? |
|
30 | 30 |
#0058 #0040 #01 ,mouse12_text ,draw-label JSR2 |
31 | 31 |
#10 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2 |
32 | 32 |
~color ,mouse12_icn #0048 #0040 ,draw-sprite JSR2 |
33 | 33 |
,end-click JMP2 |
34 | 34 |
@no-click12 |
35 |
- ,no-click1 ~Mouse.state #01 NEQ JMP2? POP2 |
|
35 |
+ ,no-click1 ~Mouse.state #01 NEQ JMP2? |
|
36 | 36 |
#0058 #0040 #01 ,mouse1_text ,draw-label JSR2 |
37 | 37 |
#12 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2 |
38 | 38 |
~color ,mouse1_icn #0048 #0040 ,draw-sprite JSR2 |
39 | 39 |
,end-click JMP2 |
40 | 40 |
@no-click1 |
41 |
- ,no-click2 ~Mouse.state #10 NEQ JMP2? POP2 |
|
41 |
+ ,no-click2 ~Mouse.state #10 NEQ JMP2? |
|
42 | 42 |
#0058 #0040 #01 ,mouse2_text ,draw-label JSR2 |
43 | 43 |
#13 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2 |
44 | 44 |
~color ,mouse2_icn #0048 #0040 ,draw-sprite JSR2 |
... | ... |
@@ -91,18 +91,18 @@ RTN |
91 | 91 |
@animate-polycat |
92 | 92 |
|
93 | 93 |
( tail ) |
94 |
- ~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP2? POP2 |
|
94 |
+ ~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP2? |
|
95 | 95 |
,polycat #00c0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 |
96 | 96 |
@animate-polycat-tail-next0 |
97 |
- ~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP2? POP2 |
|
97 |
+ ~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP2? |
|
98 | 98 |
,polycat #00d0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 |
99 | 99 |
@animate-polycat-tail-next1 |
100 |
- ~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP2? POP2 |
|
100 |
+ ~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP2? |
|
101 | 101 |
,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2 |
102 | 102 |
@animate-polycat-tail-next2 |
103 | 103 |
( look-at ) |
104 |
- ~pointer.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP2? POP2 |
|
105 |
- ~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP2? POP2 |
|
104 |
+ ~pointer.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP2? |
|
105 |
+ ~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP2? |
|
106 | 106 |
,polycat #0040 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 |
107 | 107 |
,polycat #0050 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 |
108 | 108 |
RTN |
... | ... |
@@ -111,7 +111,7 @@ RTN |
111 | 111 |
,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 |
112 | 112 |
RTN |
113 | 113 |
@animate-polycat-right |
114 |
- ~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP2? POP2 |
|
114 |
+ ~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP2? |
|
115 | 115 |
,polycat #0060 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 |
116 | 116 |
,polycat #0070 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2 |
117 | 117 |
RTN |
... | ... |
@@ -130,7 +130,7 @@ RTN |
130 | 130 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
131 | 131 |
( incr ) #0001 ADD2 |
132 | 132 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
133 |
- DUP2 #0001 ADD2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
133 |
+ DUP2 #0001 ADD2 LDR #00 NEQ ,$loop ROT JMP2? |
|
134 | 134 |
POP2 |
135 | 135 |
|
136 | 136 |
RTN |
... | ... |
@@ -15,7 +15,7 @@ |
15 | 15 |
$draw-hor NOP |
16 | 16 |
( draw ) #01 =Screen.color |
17 | 17 |
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 |
18 |
- OVR2 OVR2 LTH2 ^$draw-hor SWP JMPS? POP |
|
18 |
+ OVR2 OVR2 LTH2 ^$draw-hor SWP JMPS? |
|
19 | 19 |
POP2 POP2 |
20 | 20 |
|
21 | 21 |
( draw ver line ) |
... | ... |
@@ -24,7 +24,7 @@ |
24 | 24 |
$draw-ver NOP |
25 | 25 |
( draw ) #02 =Screen.color |
26 | 26 |
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
27 |
- OVR2 OVR2 LTH2 ^$draw-ver SWP JMPS? POP |
|
27 |
+ OVR2 OVR2 LTH2 ^$draw-ver SWP JMPS? |
|
28 | 28 |
POP2 POP2 |
29 | 29 |
|
30 | 30 |
( draw blending modes ) |
... | ... |
@@ -34,7 +34,7 @@ |
34 | 34 |
( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x |
35 | 35 |
( draw ) OVR =Sprite.color |
36 | 36 |
( incr ) SWP #01 ADD SWP |
37 |
- DUP2 LTH ^$draw-blends SWP JMPS? POP |
|
37 |
+ DUP2 LTH ^$draw-blends SWP JMPS? |
|
38 | 38 |
POP POP |
39 | 39 |
|
40 | 40 |
BRK |
... | ... |
@@ -42,16 +42,16 @@ BRK |
42 | 42 |
@FRAME |
43 | 43 |
|
44 | 44 |
( update colors every 40 frames ) |
45 |
- ~timer #40 NEQ ,skip1 ROT JMP2? POP2 |
|
45 |
+ ~timer #40 NEQ ,skip1 ROT JMP2? |
|
46 | 46 |
#0fac #fffa STR2 #f0bb #fffc STR2 #f053 #fff8 STR2 |
47 | 47 |
@skip1 |
48 |
- ~timer #80 NEQ ,skip2 ROT JMP2? POP2 |
|
48 |
+ ~timer #80 NEQ ,skip2 ROT JMP2? |
|
49 | 49 |
#00fc #fffc STR2 #f0bb #fff8 STR2 #f053 #fffa STR2 |
50 | 50 |
@skip2 |
51 |
- ~timer #c0 NEQ ,skip3 ROT JMP2? POP2 |
|
51 |
+ ~timer #c0 NEQ ,skip3 ROT JMP2? |
|
52 | 52 |
#000f #fff8 STR2 #0f0f #fffa STR2 #ff00 #fffc STR2 |
53 | 53 |
@skip3 |
54 |
- ~timer #00 NEQ ,skip4 ROT JMP2? POP2 |
|
54 |
+ ~timer #00 NEQ ,skip4 ROT JMP2? |
|
55 | 55 |
#f0ac #fff8 STR2 #f0bb #fffa STR2 #f053 #fffc STR2 |
56 | 56 |
@skip4 |
57 | 57 |
~timer #01 ADD =timer |
58 | 58 |
similarity index 95% |
59 | 59 |
rename from projects/examples/win.editor.usm |
60 | 60 |
rename to projects/examples/gui.editor.usm |
... | ... |
@@ -26,15 +26,15 @@ BRK |
26 | 26 |
|
27 | 27 |
@FRAME |
28 | 28 |
|
29 |
- ,no-ctrl ~Controller.buttons #00 EQU JMP2? POP2 |
|
29 |
+ ,no-ctrl ~Controller.buttons #00 EQU JMP2? |
|
30 | 30 |
|
31 |
- ,no-ctrl-up ~Controller.buttons #10 EQU JMP2? POP2 |
|
31 |
+ ,no-ctrl-up ~Controller.buttons #10 EQU JMP2? |
|
32 | 32 |
~editor.addr #0001 ADD2 =editor.addr |
33 | 33 |
,draw-window JSR2 |
34 | 34 |
,draw-editor JSR2 |
35 | 35 |
@no-ctrl-up |
36 | 36 |
|
37 |
- ,no-ctrl-down ~Controller.buttons #20 EQU JMP2? POP2 |
|
37 |
+ ,no-ctrl-down ~Controller.buttons #20 EQU JMP2? |
|
38 | 38 |
~editor.addr #0001 SUB2 =editor.addr |
39 | 39 |
,draw-window JSR2 |
40 | 40 |
,draw-editor JSR2 |
... | ... |
@@ -42,7 +42,7 @@ BRK |
42 | 42 |
|
43 | 43 |
@no-ctrl |
44 | 44 |
|
45 |
- ,no-click ~Mouse.state #00 EQU JMP2? POP2 |
|
45 |
+ ,no-click ~Mouse.state #00 EQU JMP2? |
|
46 | 46 |
|
47 | 47 |
( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR |
48 | 48 |
( mask ) #01 #07 ~Mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB ROL |
... | ... |
@@ -85,10 +85,10 @@ RTN |
85 | 85 |
( draw ) #08 =Sprite.color |
86 | 86 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
87 | 87 |
( incr ) ~pixel.x #01 ADD =pixel.x |
88 |
- ,$hor ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP2? POP2 |
|
88 |
+ ,$hor ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP2? |
|
89 | 89 |
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y |
90 | 90 |
( incr ) ~pixel.y #01 ADD =pixel.y |
91 |
- ,$ver ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP2? POP2 |
|
91 |
+ ,$ver ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP2? |
|
92 | 92 |
~editor.addr =Sprite.addr |
93 | 93 |
~window.y1 =Sprite.y |
94 | 94 |
~window.x2 #0008 SUB2 =Sprite.x |
... | ... |
@@ -28,22 +28,22 @@ BRK |
28 | 28 |
( matrix comparison ) |
29 | 29 |
~Mouse.x ~r1.x1 GTH2 ~Mouse.x ~r1.x2 LTH2 #0101 EQU2 |
30 | 30 |
~Mouse.y ~r1.y1 GTH2 ~Mouse.y ~r1.y2 LTH2 #0101 EQU2 |
31 |
- #0101 NEQ2 ,$draw1 ROT JMP2? POP2 #02 =color ,hand_icn =pointer.sprite |
|
31 |
+ #0101 NEQ2 ,$draw1 ROT JMP2? #02 =color ,hand_icn =pointer.sprite |
|
32 | 32 |
$draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR2 |
33 | 33 |
|
34 | 34 |
#01 =color |
35 | 35 |
( 2-step comparison ) |
36 |
- ,$draw2 ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP2? POP2 |
|
37 |
- ,$draw2 ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP2? POP2 |
|
36 |
+ ,$draw2 ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP2? |
|
37 |
+ ,$draw2 ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP2? |
|
38 | 38 |
#03 =color ,hand_icn =pointer.sprite |
39 | 39 |
$draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR2 |
40 | 40 |
|
41 | 41 |
#01 =color |
42 | 42 |
( 4-step comparison ) |
43 |
- ,$draw3 ~Mouse.x ~r3.x1 LTH2 JMP2? POP2 |
|
44 |
- ,$draw3 ~Mouse.x ~r3.x2 GTH2 JMP2? POP2 |
|
45 |
- ,$draw3 ~Mouse.y ~r3.y1 LTH2 JMP2? POP2 |
|
46 |
- ,$draw3 ~Mouse.y ~r3.y2 GTH2 JMP2? POP2 |
|
43 |
+ ,$draw3 ~Mouse.x ~r3.x1 LTH2 JMP2? |
|
44 |
+ ,$draw3 ~Mouse.x ~r3.x2 GTH2 JMP2? |
|
45 |
+ ,$draw3 ~Mouse.y ~r3.y1 LTH2 JMP2? |
|
46 |
+ ,$draw3 ~Mouse.y ~r3.y2 GTH2 JMP2? |
|
47 | 47 |
#02 =color ,hand_icn =pointer.sprite |
48 | 48 |
$draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR2 |
49 | 49 |
|
... | ... |
@@ -77,13 +77,13 @@ RTN |
77 | 77 |
( incr ) ~Screen.x #0001 ADD2 =Screen.x |
78 | 78 |
( draw ) ~rect.y1 =Screen.y ~color =Screen.color |
79 | 79 |
( draw ) ~rect.y2 =Screen.y ~color =Screen.color |
80 |
- ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? POP2 |
|
80 |
+ ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? |
|
81 | 81 |
~rect.y1 =Screen.y |
82 | 82 |
$ver |
83 | 83 |
( draw ) ~rect.x1 =Screen.x ~color =Screen.color |
84 | 84 |
( draw ) ~rect.x2 =Screen.x ~color =Screen.color |
85 | 85 |
( incr ) ~Screen.y #0001 ADD2 =Screen.y |
86 |
- ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 |
|
86 |
+ ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? |
|
87 | 87 |
|
88 | 88 |
RTN |
89 | 89 |
|
... | ... |
@@ -16,7 +16,7 @@ |
16 | 16 |
$draw-ver |
17 | 17 |
( draw ) #02 =Screen.color |
18 | 18 |
( incr ) ~Screen.y #0002 ADD2 =Screen.y |
19 |
- ,$draw-ver ~Screen.y ~Screen.height LTH2 JMP2? POP2 |
|
19 |
+ ,$draw-ver ~Screen.y ~Screen.height LTH2 JMP2? |
|
20 | 20 |
|
21 | 21 |
~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR2 |
22 | 22 |
~center.x ~center.y #0c ,text2 ,draw-label-middle JSR2 |
... | ... |
@@ -34,7 +34,7 @@ BRK |
34 | 34 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
35 | 35 |
( incr ) #0001 ADD2 |
36 | 36 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
37 |
- DUP2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
37 |
+ DUP2 LDR #00 NEQ ,$loop ROT JMP2? |
|
38 | 38 |
POP2 |
39 | 39 |
|
40 | 40 |
RTN |
... | ... |
@@ -48,7 +48,7 @@ RTN |
48 | 48 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
49 | 49 |
( incr ) #0001 ADD2 |
50 | 50 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
51 |
- DUP2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
51 |
+ DUP2 LDR #00 NEQ ,$loop ROT JMP2? |
|
52 | 52 |
POP2 |
53 | 53 |
|
54 | 54 |
RTN |
... | ... |
@@ -62,7 +62,7 @@ RTN |
62 | 62 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
63 | 63 |
( incr ) #0001 ADD2 |
64 | 64 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
65 |
- DUP2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
65 |
+ DUP2 LDR #00 NEQ ,$loop ROT JMP2? |
|
66 | 66 |
POP2 |
67 | 67 |
|
68 | 68 |
RTN |
... | ... |
@@ -72,7 +72,7 @@ RTN |
72 | 72 |
#0000 ( counter ) |
73 | 73 |
$loop |
74 | 74 |
( incr ) #0001 ADD2 OVR2 OVR2 ADD2 |
75 |
- LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
75 |
+ LDR #00 NEQ ,$loop ROT JMP2? |
|
76 | 76 |
SWP2 POP2 |
77 | 77 |
|
78 | 78 |
RTN |
... | ... |
@@ -19,9 +19,9 @@ BRK |
19 | 19 |
( draw ) ~pict.color =Sprite.color |
20 | 20 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
21 | 21 |
( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr |
22 |
- ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? POP2 |
|
22 |
+ ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? |
|
23 | 23 |
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y |
24 |
- ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? POP2 |
|
24 |
+ ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? |
|
25 | 25 |
|
26 | 26 |
RTN |
27 | 27 |
|
... | ... |
@@ -33,13 +33,13 @@ BRK |
33 | 33 |
( incr ) ~Screen.x #0001 ADD2 =Screen.x |
34 | 34 |
( draw ) ~rect.y1 =Screen.y ~color =Screen.color |
35 | 35 |
( draw ) ~rect.y2 =Screen.y ~color =Screen.color |
36 |
- ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? POP2 |
|
36 |
+ ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? |
|
37 | 37 |
~rect.y1 =Screen.y |
38 | 38 |
$ver |
39 | 39 |
( draw ) ~rect.x1 =Screen.x ~color =Screen.color |
40 | 40 |
( draw ) ~rect.x2 =Screen.x ~color =Screen.color |
41 | 41 |
( incr ) ~Screen.y #0001 ADD2 =Screen.y |
42 |
- ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? POP2 |
|
42 |
+ ,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2? |
|
43 | 43 |
|
44 | 44 |
RTN |
45 | 45 |
|
... | ... |
@@ -51,9 +51,9 @@ RTN |
51 | 51 |
$hor |
52 | 52 |
( draw ) ~color =Screen.color |
53 | 53 |
( incr ) ~Screen.x #0001 ADD2 =Screen.x |
54 |
- ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? POP2 |
|
54 |
+ ,$hor ~Screen.x ~rect.x2 LTH2 JMP2? |
|
55 | 55 |
( incr ) ~Screen.y #0001 ADD2 =Screen.y |
56 |
- ,$ver ~Screen.y ~rect.y2 LTH2 JMP2? POP2 |
|
56 |
+ ,$ver ~Screen.y ~rect.y2 LTH2 JMP2? |
|
57 | 57 |
|
58 | 58 |
RTN |
59 | 59 |
|
... | ... |
@@ -66,9 +66,9 @@ RTN |
66 | 66 |
( draw ) ~pict.color =Sprite.color |
67 | 67 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
68 | 68 |
( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr |
69 |
- ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? POP2 |
|
69 |
+ ,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2? |
|
70 | 70 |
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y |
71 |
- ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? POP2 |
|
71 |
+ ,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2? |
|
72 | 72 |
|
73 | 73 |
RTN |
74 | 74 |
|
... | ... |
@@ -79,7 +79,7 @@ RTN |
79 | 79 |
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color |
80 | 80 |
( incr ) #0001 ADD2 |
81 | 81 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
82 |
- DUP2 LDR #00 NEQ ,$loop ROT JMP2? POP2 |
|
82 |
+ DUP2 LDR #00 NEQ ,$loop ROT JMP2? |
|
83 | 83 |
POP2 |
84 | 84 |
|
85 | 85 |
RTN |
... | ... |
@@ -46,62 +46,62 @@ BRK |
46 | 46 |
|
47 | 47 |
( ctrl ) |
48 | 48 |
|
49 |
- ,ctrl-end ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP2? POP2 |
|
49 |
+ ,ctrl-end ~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 JMP2? |
|
50 | 50 |
( lock ) #04 =lock |
51 |
- ,no-ctrl-up ~Controller #10 NEQ JMP2? POP2 |
|
52 |
- ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2? POP2 |
|
51 |
+ ,no-ctrl-up ~Controller #10 NEQ JMP2? |
|
52 |
+ ( clamp ) ,no-ctrl-up ~position.y #0000 EQU2 JMP2? |
|
53 | 53 |
,find-lineoffset JSR2 =position.x |
54 | 54 |
~position.y #0001 SUB2 =position.y |
55 | 55 |
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to |
56 | 56 |
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
57 | 57 |
@no-ctrl-up |
58 |
- ,no-ctrl-down ~Controller #20 NEQ JMP2? POP2 |
|
58 |
+ ,no-ctrl-down ~Controller #20 NEQ JMP2? |
|
59 | 59 |
,find-lineoffset JSR2 =position.x ~position.y #0001 ADD2 =position.y |
60 | 60 |
,find-selection JSR2 DUP2 =selection.from #0001 ADD2 =selection.to |
61 | 61 |
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
62 | 62 |
@no-ctrl-down |
63 |
- ,no-ctrl-left ~Controller #40 NEQ JMP2? POP2 |
|
64 |
- ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2? POP2 |
|
63 |
+ ,no-ctrl-left ~Controller #40 NEQ JMP2? |
|
64 |
+ ( clamp ) ,no-ctrl-left ~selection.from ,document.body EQU2 JMP2? |
|
65 | 65 |
~selection.from #0001 SUB2 DUP2 =selection.from #0001 ADD2 =selection.to |
66 | 66 |
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
67 | 67 |
@no-ctrl-left |
68 |
- ,no-ctrl-right ~Controller #80 NEQ JMP2? POP2 |
|
68 |
+ ,no-ctrl-right ~Controller #80 NEQ JMP2? |
|
69 | 69 |
~selection.from #0001 ADD2 DUP2 =selection.from #0001 ADD2 =selection.to |
70 | 70 |
,clamp-selection JSR2 ,follow-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
71 | 71 |
@no-ctrl-right |
72 | 72 |
( alt ) |
73 |
- ,no-alt ~Controller #0f AND #02 NEQ JMP2? POP2 |
|
74 |
- ,no-aup ~Controller #04 ROR #01 NEQ JMP2? POP2 |
|
73 |
+ ,no-alt ~Controller #0f AND #02 NEQ JMP2? |
|
74 |
+ ,no-aup ~Controller #04 ROR #01 NEQ JMP2? |
|
75 | 75 |
,find-wordstart JSR2 =selection.to |
76 | 76 |
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
77 | 77 |
@no-aup |
78 |
- ,no-adown ~Controller #04 ROR #02 NEQ JMP2? POP2 |
|
78 |
+ ,no-adown ~Controller #04 ROR #02 NEQ JMP2? |
|
79 | 79 |
,find-wordend JSR2 =selection.to |
80 | 80 |
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
81 | 81 |
@no-adown |
82 |
- ,no-aleft ~Controller #04 ROR #04 NEQ JMP2? POP2 |
|
82 |
+ ,no-aleft ~Controller #04 ROR #04 NEQ JMP2? |
|
83 | 83 |
~selection.to #0001 SUB2 =selection.to |
84 | 84 |
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
85 | 85 |
@no-aleft |
86 |
- ,no-aright ~Controller #04 ROR #08 NEQ JMP2? POP2 |
|
86 |
+ ,no-aright ~Controller #04 ROR #08 NEQ JMP2? |
|
87 | 87 |
~selection.to #0001 ADD2 =selection.to |
88 | 88 |
,clamp-selection JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
89 | 89 |
@no-aright |
90 | 90 |
@no-alt |
91 | 91 |
( ctrl ) |
92 |
- ,no-ctrl ~Controller #0f AND #01 NEQ JMP2? POP2 |
|
93 |
- ,no-cup ~Controller #04 ROR #01 NEQ JMP2? POP2 |
|
92 |
+ ,no-ctrl ~Controller #0f AND #01 NEQ JMP2? |
|
93 |
+ ,no-cup ~Controller #04 ROR #01 NEQ JMP2? |
|
94 | 94 |
#0004 ,scroll-up JSR2 |
95 | 95 |
,redraw JSR2 ,ctrl-end JMP2 |
96 | 96 |
@no-cup |
97 |
- ,no-cdown ~Controller #04 ROR #02 NEQ JMP2? POP2 |
|
97 |
+ ,no-cdown ~Controller #04 ROR #02 NEQ JMP2? |
|
98 | 98 |
#0004 ,scroll-down JSR2 |
99 | 99 |
,redraw JSR2 ,ctrl-end JMP2 |
100 | 100 |
@no-cdown |
101 |
- ,no-cleft ~Controller #04 ROR #04 NEQ JMP2? POP2 |
|
101 |
+ ,no-cleft ~Controller #04 ROR #04 NEQ JMP2? |
|
102 | 102 |
,goto-linestart JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
103 | 103 |
@no-cleft |
104 |
- ,no-cright ~Controller #04 ROR #08 NEQ JMP2? POP2 |
|
104 |
+ ,no-cright ~Controller #04 ROR #08 NEQ JMP2? |
|
105 | 105 |
,goto-lineend JSR2 ,redraw JSR2 ,ctrl-end JMP2 |
106 | 106 |
@no-cright |
107 | 107 |
@no-ctrl |
... | ... |
@@ -110,11 +110,11 @@ BRK |
110 | 110 |
|
111 | 111 |
( keys ) |
112 | 112 |
|
113 |
- ,no-keys ~Keys #00 EQU JMP2? POP2 |
|
113 |
+ ,no-keys ~Keys #00 EQU JMP2? |
|
114 | 114 |
|
115 |
- ,$no-backspace ~Keys #08 NEQ JMP2? POP2 |
|
115 |
+ ,$no-backspace ~Keys #08 NEQ JMP2? |
|
116 | 116 |
( erase ) |
117 |
- ,$erase-multiple ~selection.to ~selection.from SUB2 #0001 NEQ2 JMP2? POP2 |
|
117 |
+ ,$erase-multiple ~selection.to ~selection.from SUB2 #0001 NEQ2 JMP2? |
|
118 | 118 |
~selection.to ~selection.from SUB2 ,shift-left JSR2 |
119 | 119 |
,$erase-end JMP2 |
120 | 120 |
$erase-multiple |
... | ... |
@@ -139,28 +139,28 @@ BRK |
139 | 139 |
|
140 | 140 |
( mouse ) |
141 | 141 |
|
142 |
- ,no-change ~Mouse.state ~touch.state EQU JMP2? POP2 |
|
142 |
+ ,no-change ~Mouse.state ~touch.state EQU JMP2? |
|
143 | 143 |
|
144 | 144 |
#0000 =Sprite.x ~Screen.height #0008 SUB2 =Sprite.y |
145 | 145 |
,mouse00icn =Sprite.addr |
146 |
- ,nobutton1 ~Mouse.state #01 NEQ JMP2? POP2 ,mouse01icn =Sprite.addr @nobutton1 |
|
147 |
- ,nobutton2 ~Mouse.state #10 NEQ JMP2? POP2 ,mouse10icn =Sprite.addr @nobutton2 |
|
148 |
- ,nobutton3 ~Mouse.state #11 NEQ JMP2? POP2 ,mouse11icn =Sprite.addr @nobutton3 |
|
146 |
+ ,nobutton1 ~Mouse.state #01 NEQ JMP2? ,mouse01icn =Sprite.addr @nobutton1 |
|
147 |
+ ,nobutton2 ~Mouse.state #10 NEQ JMP2? ,mouse10icn =Sprite.addr @nobutton2 |
|
148 |
+ ,nobutton3 ~Mouse.state #11 NEQ JMP2? ,mouse11icn =Sprite.addr @nobutton3 |
|
149 | 149 |
#01 =Sprite.color |
150 | 150 |
|
151 | 151 |
@no-change |
152 | 152 |
|
153 |
- ,touch-end ~Mouse.state #00 EQU JMP2? POP2 |
|
153 |
+ ,touch-end ~Mouse.state #00 EQU JMP2? |
|
154 | 154 |
|
155 |
- ,touch-linebar ~Mouse.x #0010 LTH2 JMP2? POP2 |
|
156 |
- ,touch-body ~Mouse.x ~Screen.width #0008 SUB2 LTH2 JMP2? POP2 |
|
155 |
+ ,touch-linebar ~Mouse.x #0010 LTH2 JMP2? |
|
156 |
+ ,touch-body ~Mouse.x ~Screen.width #0008 SUB2 LTH2 JMP2? |
|
157 | 157 |
,touch-scrollbar JMP2 |
158 | 158 |
|
159 | 159 |
@touch-end |
160 | 160 |
|
161 | 161 |
~Mouse.state =touch.state |
162 | 162 |
|
163 |
- ( unlock ) ,skip-unlock ~lock #00 EQU JMP2? POP2 ~lock #01 SUB =lock @skip-unlock |
|
163 |
+ ( unlock ) ,skip-unlock ~lock #00 EQU JMP2? ~lock #01 SUB =lock @skip-unlock |
|
164 | 164 |
|
165 | 165 |
,draw-cursor JSR2 |
166 | 166 |
|
... | ... |
@@ -168,11 +168,11 @@ BRK |
168 | 168 |
|
169 | 169 |
@touch-scrollbar |
170 | 170 |
|
171 |
- ,$no-up ~Mouse.y #0008 GTH2 JMP2? POP2 |
|
171 |
+ ,$no-up ~Mouse.y #0008 GTH2 JMP2? |
|
172 | 172 |
( decr ) ~scroll.y #00 ~scroll.y #0000 NEQ2 SUB2 =scroll.y |
173 | 173 |
^$end JMPS |
174 | 174 |
$no-up |
175 |
- ,$no-down ~Mouse.y ~Screen.height #0008 SUB2 LTH2 JMP2? POP2 |
|
175 |
+ ,$no-down ~Mouse.y ~Screen.height #0008 SUB2 LTH2 JMP2? |
|
176 | 176 |
( incr ) ~scroll.y #0001 ADD2 =scroll.y |
177 | 177 |
^$end JMPS |
178 | 178 |
$no-down |
... | ... |
@@ -197,20 +197,20 @@ RTN |
197 | 197 |
~Mouse.y #0008 DIV2 ~scroll.y ADD2 =position.y |
198 | 198 |
~Mouse.x ~textarea.x1 SUB2 #0007 ADD2 #0007 DIV2 =position.x |
199 | 199 |
|
200 |
- ,$no-chord-cut ~Mouse.chord #01 NEQ JMP2? POP2 |
|
200 |
+ ,$no-chord-cut ~Mouse.chord #01 NEQ JMP2? |
|
201 | 201 |
,cut JSR2 |
202 | 202 |
( release ) #00 DUP =Mouse.state =Mouse.chord |
203 | 203 |
^$end JMPS |
204 | 204 |
$no-chord-cut |
205 |
- ,$no-chord-paste ~Mouse.chord #10 NEQ JMP2? POP2 |
|
205 |
+ ,$no-chord-paste ~Mouse.chord #10 NEQ JMP2? |
|
206 | 206 |
,paste JSR2 |
207 | 207 |
( release ) #00 DUP =Mouse.state =Mouse.chord |
208 | 208 |
^$end JMPS |
209 | 209 |
$no-chord-paste |
210 | 210 |
|
211 |
- ,$end ~Mouse.state #11 EQU JMP2? POP2 |
|
211 |
+ ,$end ~Mouse.state #11 EQU JMP2? |
|
212 | 212 |
|
213 |
- ,$no-drag ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 JMP2? POP2 |
|
213 |
+ ,$no-drag ~Mouse.state ~touch.state NEQ ~Controller #0f AND #02 NEQ #0101 EQU2 JMP2? |
|
214 | 214 |
( on drag ) |
215 | 215 |
,find-selection JSR2 #0001 ADD2 =selection.to |
216 | 216 |
,clamp-selection JSR2 |
... | ... |
@@ -237,7 +237,7 @@ RTN |
237 | 237 |
|
238 | 238 |
@scroll-up ( length ) |
239 | 239 |
|
240 |
- DUP2 ~scroll.y LTH2 ,$clamp ROT JMP2? POP2 |
|
240 |
+ DUP2 ~scroll.y LTH2 ,$clamp ROT JMP2? |
|
241 | 241 |
#0000 =scroll.y POP2 RTN |
242 | 242 |
$clamp |
243 | 243 |
~scroll.y SWP2 SUB2 =scroll.y |
... | ... |
@@ -277,10 +277,10 @@ RTN |
277 | 277 |
|
278 | 278 |
@follow-selection |
279 | 279 |
|
280 |
- ,$no-up ~position.y ~scroll.y GTH2 JMP2? POP2 |
|
280 |
+ ,$no-up ~position.y ~scroll.y GTH2 JMP2? |
|
281 | 281 |
~position.y =scroll.y RTN |
282 | 282 |
$no-up |
283 |
- ,$no-down ~position.y ~Screen.height #0010 SUB2 #0008 DIV2 ~scroll.y ADD2 LTH2 JMP2? POP2 |
|
283 |
+ ,$no-down ~position.y ~Screen.height #0010 SUB2 #0008 DIV2 ~scroll.y ADD2 LTH2 JMP2? |
|
284 | 284 |
~position.y ~Screen.height #0010 SUB2 #0008 DIV2 SUB2 =scroll.y RTN |
285 | 285 |
$no-down |
286 | 286 |
|
... | ... |
@@ -324,9 +324,9 @@ RTN |
324 | 324 |
~selection.to =j |
325 | 325 |
$loop NOP |
326 | 326 |
( decr ) ~j #0001 SUB2 =j |
327 |
- ,$end ~j LDR #20 EQU JMP2? POP2 |
|
328 |
- ,$end ~j LDR #0a EQU JMP2? POP2 |
|
329 |
- ,$end ~j LDR #0d EQU JMP2? POP2 |
|
327 |
+ ,$end ~j LDR #20 EQU JMP2? |
|
328 |
+ ,$end ~j LDR #0a EQU JMP2? |
|
329 |
+ ,$end ~j LDR #0d EQU JMP2? |
|
330 | 330 |
~j ,document.body GTH2 ^$loop MUL JMPS |
331 | 331 |
$end |
332 | 332 |
( return ) ~j #0001 SUB2 |
... | ... |
@@ -338,9 +338,9 @@ RTN |
338 | 338 |
~selection.to =j |
339 | 339 |
$loop NOP |
340 | 340 |
( incr ) ~j #0001 ADD2 =j |
341 |
- ,$end ~j LDR #20 EQU JMP2? POP2 |
|
342 |
- ,$end ~j LDR #0a EQU JMP2? POP2 |
|
343 |
- ,$end ~j LDR #0d EQU JMP2? POP2 |
|
341 |
+ ,$end ~j LDR #20 EQU JMP2? |
|
342 |
+ ,$end ~j LDR #0a EQU JMP2? |
|
343 |
+ ,$end ~j LDR #0d EQU JMP2? |
|
344 | 344 |
~j ,document.body GTH2 ^$loop MUL JMPS |
345 | 345 |
$end |
346 | 346 |
( return ) ~j #0001 ADD2 |
... | ... |
@@ -352,8 +352,8 @@ RTN |
352 | 352 |
#0000 =j |
353 | 353 |
$loop NOP |
354 | 354 |
( incr ) ~j #0001 ADD2 =j |
355 |
- ,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2? POP2 |
|
356 |
- ,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2? POP2 |
|
355 |
+ ,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2? |
|
356 |
+ ,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2? |
|
357 | 357 |
~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMPS |
358 | 358 |
$end |
359 | 359 |
( return ) ~j |
... | ... |
@@ -364,8 +364,8 @@ RTN |
364 | 364 |
|
365 | 365 |
,document.body =j #0000 =pt.y |
366 | 366 |
$loop NOP |
367 |
- ,$end ~pt.y ~position.y #0001 SUB2 GTH2 JMP2? POP2 |
|
368 |
- ,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? POP2 |
|
367 |
+ ,$end ~pt.y ~position.y #0001 SUB2 GTH2 JMP2? |
|
368 |
+ ,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? |
|
369 | 369 |
( incr ) ~pt.y #0001 ADD2 =pt.y |
370 | 370 |
$no-space |
371 | 371 |
( incr ) ~j #0001 ADD2 =j |
... | ... |
@@ -380,8 +380,8 @@ RTN |
380 | 380 |
,find-line JSR2 ( find line ) |
381 | 381 |
#0000 =pt.x |
382 | 382 |
$loop NOP |
383 |
- ,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2? POP2 |
|
384 |
- ,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2? POP2 |
|
383 |
+ ,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2? |
|
384 |
+ ,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2? |
|
385 | 385 |
( incr ) ~pt.x #0001 ADD2 =pt.x |
386 | 386 |
~pt.x ~position.x #0001 SUB2 LTH2 ^$loop MUL JMPS |
387 | 387 |
$end |
... | ... |
@@ -425,17 +425,17 @@ RTN |
425 | 425 |
|
426 | 426 |
,document.body =selection.from #0000 =pt.x #0000 =pt.y |
427 | 427 |
$loop |
428 |
- ,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2? POP2 |
|
428 |
+ ,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2? |
|
429 | 429 |
( incr ) ~pt.y #0001 ADD2 =pt.y |
430 | 430 |
#0000 =pt.x |
431 | 431 |
$no-space |
432 |
- ,$no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP2? POP2 |
|
432 |
+ ,$no-reached ~pt.y ~position.y #0001 SUB2 GTH2 ~pt.x ~position.x #0001 SUB2 GTH2 #0101 NEQ2 JMP2? |
|
433 | 433 |
~selection.from #0001 ADD2 =selection.to |
434 | 434 |
RTN |
435 | 435 |
$no-reached |
436 | 436 |
( incr ) ~pt.x #0001 ADD2 =pt.x |
437 | 437 |
( incr ) ~selection.from #0001 ADD2 =selection.from |
438 |
- ,$loop ~selection.from LDR #00 NEQ JMP2? POP2 |
|
438 |
+ ,$loop ~selection.from LDR #00 NEQ JMP2? |
|
439 | 439 |
|
440 | 440 |
RTN |
441 | 441 |
|
... | ... |
@@ -507,8 +507,8 @@ RTN |
507 | 507 |
( scroll to position ) |
508 | 508 |
#0000 =j ( j is linebreaks ) |
509 | 509 |
$find-offset NOP |
510 |
- ,$find-offset-end ~scroll.y ~j EQU2 JMP2? POP2 |
|
511 |
- ,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2? POP2 |
|
510 |
+ ,$find-offset-end ~scroll.y ~j EQU2 JMP2? |
|
511 |
+ ,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2? |
|
512 | 512 |
( incr ) ~j #0001 ADD2 =j |
513 | 513 |
$no-break |
514 | 514 |
( incr ) ~textarea.addr #0001 ADD2 =textarea.addr |
... | ... |
@@ -520,7 +520,7 @@ RTN |
520 | 520 |
|
521 | 521 |
$loop |
522 | 522 |
|
523 |
- ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2? POP2 |
|
523 |
+ ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2? |
|
524 | 524 |
|
525 | 525 |
( get character ) |
526 | 526 |
,font #00 ~i LDR #20 SUB #0008 MUL2 ADD2 =Sprite.addr |
... | ... |
@@ -530,7 +530,7 @@ RTN |
530 | 530 |
~i ~selection.to LTH2 #0101 EQU2 |
531 | 531 |
#05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color |
532 | 532 |
|
533 |
- ,$no-linebreak ~i LDR #0a NEQ ~i LDR #0d NEQ #0101 EQU2 JMP2? POP2 |
|
533 |
+ ,$no-linebreak ~i LDR #0a NEQ ~i LDR #0d NEQ #0101 EQU2 JMP2? |
|
534 | 534 |
( draw linebreak ) |
535 | 535 |
,linebreak_icn =Sprite.addr |
536 | 536 |
( draw ) #02 |
... | ... |
@@ -542,7 +542,7 @@ RTN |
542 | 542 |
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x |
543 | 543 |
,font =Sprite.addr |
544 | 544 |
#01 =Sprite.color |
545 |
- ,$fill-clear ~Sprite.x ~Screen.width #0008 SUB2 LTH2 JMP2? POP2 |
|
545 |
+ ,$fill-clear ~Sprite.x ~Screen.width #0008 SUB2 LTH2 JMP2? |
|
546 | 546 |
|
547 | 547 |
( draw line number ) |
548 | 548 |
|
... | ... |
@@ -562,7 +562,7 @@ RTN |
562 | 562 |
( incr ) ~i #0001 ADD2 =i |
563 | 563 |
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x |
564 | 564 |
|
565 |
- ,$loop ~i LDR #00 NEQ JMP2? POP2 |
|
565 |
+ ,$loop ~i LDR #00 NEQ JMP2? |
|
566 | 566 |
|
567 | 567 |
$end |
568 | 568 |
|
... | ... |
@@ -34,28 +34,28 @@ BRK |
34 | 34 |
|
35 | 35 |
( keyboard controls ) |
36 | 36 |
|
37 |
- ,no-key ~KEYS #00 EQU JMP2? POP2 |
|
37 |
+ ,no-key ~KEYS #00 EQU JMP2? |
|
38 | 38 |
|
39 |
- ,no-key ~KEYS #31 LTH JMP2? POP2 |
|
40 |
- ,no-key ~KEYS #33 GTH JMP2? POP2 |
|
39 |
+ ,no-key ~KEYS #31 LTH JMP2? |
|
40 |
+ ,no-key ~KEYS #33 GTH JMP2? |
|
41 | 41 |
( select ) ~KEYS #31 SUB =bankview.mode |
42 | 42 |
( release ) #00 =KEYS |
43 | 43 |
,redraw JSR2 |
44 | 44 |
|
45 | 45 |
@no-key |
46 | 46 |
|
47 |
- ,no-ctrl ~CTRL.buttons #00 EQU JMP2? POP2 |
|
47 |
+ ,no-ctrl ~CTRL.buttons #00 EQU JMP2? |
|
48 | 48 |
|
49 |
- ,no-ctrl-up ~CTRL.buttons #10 EQU JMP2? POP2 |
|
49 |
+ ,no-ctrl-up ~CTRL.buttons #10 EQU JMP2? |
|
50 | 50 |
~tileview.addr #0080 ADD2 =tileview.addr |
51 | 51 |
@no-ctrl-up |
52 |
- ,no-ctrl-down ~CTRL.buttons #20 EQU JMP2? POP2 |
|
52 |
+ ,no-ctrl-down ~CTRL.buttons #20 EQU JMP2? |
|
53 | 53 |
~tileview.addr #0080 SUB2 =tileview.addr |
54 | 54 |
@no-ctrl-down |
55 |
- ,no-ctrl-left ~CTRL.buttons #40 EQU JMP2? POP2 |
|
55 |
+ ,no-ctrl-left ~CTRL.buttons #40 EQU JMP2? |
|
56 | 56 |
~tileview.addr #0008 ADD2 =tileview.addr |
57 | 57 |
@no-ctrl-left |
58 |
- ,no-ctrl-right ~CTRL.buttons #80 EQU JMP2? POP2 |
|
58 |
+ ,no-ctrl-right ~CTRL.buttons #80 EQU JMP2? |
|
59 | 59 |
~tileview.addr #0008 SUB2 =tileview.addr |
60 | 60 |
@no-ctrl-right |
61 | 61 |
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr |
... | ... |
@@ -65,28 +65,28 @@ BRK |
65 | 65 |
|
66 | 66 |
( mouse controls ) |
67 | 67 |
|
68 |
- ,click-end ~MOUS.state #00 EQU JMP2? POP2 |
|
68 |
+ ,click-end ~MOUS.state #00 EQU JMP2? |
|
69 | 69 |
|
70 | 70 |
( toolbar ) |
71 | 71 |
|
72 |
- ,no-toolbar-click ~MOUS.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP2? POP2 |
|
72 |
+ ,no-toolbar-click ~MOUS.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP2? |
|
73 | 73 |
|
74 | 74 |
( brush ) |
75 | 75 |
|
76 |
- ,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP2? POP2 |
|
77 |
- ,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP2? POP2 |
|
76 |
+ ,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP2? |
|
77 |
+ ,no-brush-click ~MOUS.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP2? |
|
78 | 78 |
( select ) ~mouse.x ~bankview.x SUB2 #0008 DIV2 #000d SUB2 SWP POP =bankview.mode |
79 | 79 |
( release ) #00 =MOUS.state |
80 | 80 |
,redraw JSR2 ,click-end JMP2 |
81 | 81 |
@no-brush-click |
82 | 82 |
|
83 |
- ,no-load-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP2? POP2 |
|
83 |
+ ,no-load-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP2? |
|
84 | 84 |
( load ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.load |
85 | 85 |
( release ) #00 =MOUS.state |
86 | 86 |
,redraw JSR2 ,click-end JMP2 |
87 | 87 |
@no-load-click |
88 | 88 |
|
89 |
- ,no-save-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP2? POP2 |
|
89 |
+ ,no-save-click ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP2? |
|
90 | 90 |
( save ) ,filename =FILE.name #0800 =FILE.length ~bankview.addr =FILE.save |
91 | 91 |
( release ) #00 =MOUS.state |
92 | 92 |
,redraw JSR2 ,click-end JMP2 |
... | ... |
@@ -98,9 +98,9 @@ BRK |
98 | 98 |
|
99 | 99 |
~MOUS.x ~bankview.x GTH2 ~MOUS.x ~bankview.x #0080 ADD2 LTH2 #0101 EQU2 |
100 | 100 |
~MOUS.y ~bankview.y GTH2 ~MOUS.y ~bankview.y #0080 ADD2 LTH2 #0101 EQU2 |
101 |
- #0101 NEQ2 ,no-bank-click ROT JMP2? POP2 |
|
101 |
+ #0101 NEQ2 ,no-bank-click ROT JMP2? |
|
102 | 102 |
|
103 |
- ,not-copy-mode ~bankview.mode #01 NEQ JMP2? POP2 |
|
103 |
+ ,not-copy-mode ~bankview.mode #01 NEQ JMP2? |
|
104 | 104 |
#00 =i |
105 | 105 |
@copy-loop NOP |
106 | 106 |
( load ) ~tileview.addr ~i ADD LDR |
... | ... |
@@ -113,7 +113,7 @@ BRK |
113 | 113 |
,redraw JSR2 ,click-end JMP2 |
114 | 114 |
@not-copy-mode |
115 | 115 |
|
116 |
- ,not-erase-mode ~bankview.mode #02 NEQ JMP2? POP2 |
|
116 |
+ ,not-erase-mode ~bankview.mode #02 NEQ JMP2? |
|
117 | 117 |
#00 =i |
118 | 118 |
@erase-loop NOP |
119 | 119 |
#00 |
... | ... |
@@ -137,7 +137,7 @@ BRK |
137 | 137 |
|
138 | 138 |
~MOUS.x ~tileview.x GTH2 ~MOUS.x ~tileview.x #0080 ADD2 LTH2 #0101 EQU2 |
139 | 139 |
~MOUS.y ~tileview.y GTH2 ~MOUS.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2 |
140 |
- #0101 NEQ2 ,no-tile-click ROT JMP2? POP2 |
|
140 |
+ #0101 NEQ2 ,no-tile-click ROT JMP2? |
|
141 | 141 |
|
142 | 142 |
~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 |
143 | 143 |
~MOUS.y ~tileview.y SUB2 #0008 DIV2 #0008 MUL2 #0040 DIV2 #0002 MUL2 ADD2 |
... | ... |
@@ -145,11 +145,11 @@ BRK |
145 | 145 |
~tileview.addr ADD2 =addr ( addr offset ) |
146 | 146 |
~MOUS.x ~tileview.x SUB2 ~MOUS.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x |
147 | 147 |
~MOUS.y ~tileview.y SUB2 ~MOUS.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y |
148 |
- ,no-fill-mode ~bankview.mode #01 NEQ JMP2? POP2 |
|
148 |
+ ,no-fill-mode ~bankview.mode #01 NEQ JMP2? |
|
149 | 149 |
( fill row ) #ff ~addr ~pos.y #0008 DIV2 ADD2 STR |
150 | 150 |
,redraw JSR2 ,click-end JMP2 |
151 | 151 |
@no-fill-mode |
152 |
- ,no-erase-mode ~bankview.mode #02 NEQ JMP2? POP2 |
|
152 |
+ ,no-erase-mode ~bankview.mode #02 NEQ JMP2? |
|
153 | 153 |
( erase row ) #00 ~addr ~pos.y #0008 DIV2 ADD2 STR |
154 | 154 |
,redraw JSR2 ,click-end JMP2 |
155 | 155 |
@no-erase-mode |
... | ... |
@@ -163,15 +163,15 @@ BRK |
163 | 163 |
|
164 | 164 |
( operations ) |
165 | 165 |
|
166 |
- ,no-operations ~MOUS.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP2? POP2 |
|
166 |
+ ,no-operations ~MOUS.y ~tileview.y SUB2 #0008 DIV2 #000c NEQ2 JMP2? |
|
167 | 167 |
|
168 |
- ,no-move-up ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP2? POP2 |
|
168 |
+ ,no-move-up ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0011 NEQ2 JMP2? |
|
169 | 169 |
,op_shiftup JSR2 |
170 | 170 |
( release ) #00 =MOUS.state |
171 | 171 |
,redraw JSR2 ,click-end JMP2 |
172 | 172 |
@no-move-up |
173 | 173 |
|
174 |
- ,no-move-down ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP2? POP2 |
|
174 |
+ ,no-move-down ~MOUS.x ~tileview.x SUB2 #0008 DIV2 #0012 NEQ2 JMP2? |
|
175 | 175 |
,op_shiftdown JSR2 |
176 | 176 |
( release ) #00 =MOUS.state |
177 | 177 |
,redraw JSR2 ,click-end JMP2 |
... | ... |
@@ -265,7 +265,7 @@ RTN |
265 | 265 |
( draw ) #02 =SPRT.color |
266 | 266 |
~SPRT.addr #0008 ADD2 =SPRT.addr |
267 | 267 |
( incr ) ~i #01 ADD =i |
268 |
- ,$guides ~i #10 LTH JMP2? POP2 |
|
268 |
+ ,$guides ~i #10 LTH JMP2? |
|
269 | 269 |
|
270 | 270 |
( body ) |
271 | 271 |
|
... | ... |
@@ -276,17 +276,17 @@ RTN |
276 | 276 |
~bankview.x =SPRT.x |
277 | 277 |
$hor |
278 | 278 |
( draw ) #01 =SPRT.color |
279 |
- ,$no-highlight ~SPRT.addr ~tileview.addr LTH2 JMP2? POP2 |
|
280 |
- ,$no-highlight ~SPRT.addr ~tileview.addr #0018 ADD2 GTH2 JMP2? POP2 |
|
279 |
+ ,$no-highlight ~SPRT.addr ~tileview.addr LTH2 JMP2? |
|
280 |
+ ,$no-highlight ~SPRT.addr ~tileview.addr #0018 ADD2 GTH2 JMP2? |
|
281 | 281 |
( draw ) #0c =SPRT.color |
282 | 282 |
$no-highlight |
283 | 283 |
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x |
284 | 284 |
( incr ) ~SPRT.addr #0008 ADD2 =SPRT.addr |
285 | 285 |
( incr ) ~pt.x #01 ADD =pt.x |
286 |
- ,$hor ~pt.x #10 LTH JMP2? POP2 |
|
286 |
+ ,$hor ~pt.x #10 LTH JMP2? |
|
287 | 287 |
( incr ) ~pt.y #01 ADD =pt.y |
288 | 288 |
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y |
289 |
- ,$ver ~pt.y #10 LTH JMP2? POP2 |
|
289 |
+ ,$ver ~pt.y #10 LTH JMP2? |
|
290 | 290 |
|
291 | 291 |
RTN |
292 | 292 |
|
... | ... |
@@ -333,7 +333,7 @@ RTN |
333 | 333 |
$line-hor |
334 | 334 |
( draw ) #03 =SCRN.color |
335 | 335 |
( incr ) ~SCRN.x #0002 ADD2 =SCRN.x |
336 |
- ~SCRN.x ~tileview.x #0082 ADD2 LTH2 ,$line-hor ROT JMP2? POP2 |
|
336 |
+ ~SCRN.x ~tileview.x #0082 ADD2 LTH2 ,$line-hor ROT JMP2? |
|
337 | 337 |
|
338 | 338 |
( line ver ) |
339 | 339 |
~tileview.y =SCRN.y |
... | ... |
@@ -341,7 +341,7 @@ RTN |
341 | 341 |
$line-ver |
342 | 342 |
( draw ) #03 =SCRN.color |
343 | 343 |
( incr ) ~SCRN.y #0002 ADD2 =SCRN.y |
344 |
- ~SCRN.y ~tileview.y #0081 ADD2 LTH2 ,$line-ver ROT JMP2? POP2 |
|
344 |
+ ~SCRN.y ~tileview.y #0081 ADD2 LTH2 ,$line-ver ROT JMP2? |
|
345 | 345 |
|
346 | 346 |
( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr |
347 | 347 |
|
... | ... |
@@ -358,7 +358,7 @@ RTN |
358 | 358 |
( draw ) #02 =SPRT.color |
359 | 359 |
( incr ) ~i #01 ADD =i |
360 | 360 |
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y |
361 |
- ,$bytes ~i #08 LTH JMP2? POP2 |
|
361 |
+ ,$bytes ~i #08 LTH JMP2? |
|
362 | 362 |
|
363 | 363 |
( operations ) |
364 | 364 |
|
... | ... |
@@ -381,10 +381,10 @@ RTN |
381 | 381 |
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x |
382 | 382 |
( incr ) ~SPRT.addr #0008 ADD2 =SPRT.addr |
383 | 383 |
( incr ) ~pt.x #01 ADD =pt.x |
384 |
- ,$tiles-hor ~pt.x #02 LTH JMP2? POP2 |
|
384 |
+ ,$tiles-hor ~pt.x #02 LTH JMP2? |
|
385 | 385 |
( incr ) ~pt.y #01 ADD =pt.y |
386 | 386 |
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y |
387 |
- ,$tiles-ver ~pt.y #02 LTH JMP2? POP2 |
|
387 |
+ ,$tiles-ver ~pt.y #02 LTH JMP2? |
|
388 | 388 |
|
389 | 389 |
RTN |
390 | 390 |
|
... | ... |
@@ -401,11 +401,11 @@ RTN |
401 | 401 |
( draw ) #01 =SPRT.color |
402 | 402 |
( incr ) ~SPRT.x #0008 ADD2 =SPRT.x |
403 | 403 |
( incr ) ~pt.x #01 ADD =pt.x |
404 |
- ,$hor ~pt.x #08 LTH JMP2? POP2 |
|
404 |
+ ,$hor ~pt.x #08 LTH JMP2? |
|
405 | 405 |
( incr ) ~SPRT.y #0008 ADD2 =SPRT.y |
406 | 406 |
( incr ) ~pt.y #01 ADD =pt.y |
407 | 407 |
~SPRT.x #0040 SUB2 =SPRT.x |
408 |
- ,$ver ~pt.y #08 LTH JMP2? POP2 |
|
408 |
+ ,$ver ~pt.y #08 LTH JMP2? |
|
409 | 409 |
|
410 | 410 |
RTN |
411 | 411 |
|
412 | 412 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,24 @@ |
1 |
+( tests/cond ) |
|
2 |
+ |
|
3 |
+|0100 @RESET |
|
4 |
+ |
|
5 |
+ #00 #d0 |
|
6 |
+ $loop NOP |
|
7 |
+ ( incr ) SWP #01 ADD SWP |
|
8 |
+ DUP2 LTH ^$loop SWP JMPS? |
|
9 |
+ POP =Console.byte |
|
10 |
+ |
|
11 |
+BRK |
|
12 |
+ |
|
13 |
+@routine |
|
14 |
+ |
|
15 |
+ |
|
16 |
+RTN |
|
17 |
+ |
|
18 |
+|c000 @FRAME |
|
19 |
+|d000 @ERROR |
|
20 |
+ |
|
21 |
+|FF00 ;Console { pad 8 char 1 byte 1 short 2 } |
|
22 |
+ |
|
23 |
+|FFF0 .RESET .FRAME .ERROR ( vectors ) |
|
24 |
+|FFF8 [ 13fd 1ef3 1bf2 ] ( palette ) |
|
0 | 25 |
\ No newline at end of file |
... | ... |
@@ -25,7 +25,7 @@ RTN |
25 | 25 |
|
26 | 26 |
$loop |
27 | 27 |
~b #01 ADD =b |
28 |
- ,$loop ~b #d0 LTH JMP2? POP2 |
|
28 |
+ ,$loop ~b #d0 LTH JMP2? |
|
29 | 29 |
~b =Console.byte |
30 | 30 |
|
31 | 31 |
RTN |
... | ... |
@@ -34,7 +34,7 @@ RTN |
34 | 34 |
|
35 | 35 |
$loop NOP |
36 | 36 |
~c #01 ADD =c |
37 |
- ~c #d0 LTH ^$loop SWP JMPS? POP |
|
37 |
+ ~c #d0 LTH ^$loop SWP JMPS? |
|
38 | 38 |
~c =Console.byte |
39 | 39 |
|
40 | 40 |
RTN |
... | ... |
@@ -44,7 +44,7 @@ RTN |
44 | 44 |
#00 #d0 |
45 | 45 |
$loop NOP |
46 | 46 |
( incr ) SWP #01 ADD SWP |
47 |
- DUP2 LTH ^$loop SWP JMPS? POP |
|
47 |
+ DUP2 LTH ^$loop SWP JMPS? |
|
48 | 48 |
POP =Console.byte |
49 | 49 |
|
50 | 50 |
RTN |
... | ... |
@@ -54,7 +54,7 @@ RTN |
54 | 54 |
#0000 #0d00 |
55 | 55 |
$loop NOP |
56 | 56 |
( incr ) SWP2 #0001 ADD2 SWP2 |
57 |
- OVR2 OVR2 LTH2 ^$loop SWP JMPS? POP |
|
57 |
+ OVR2 OVR2 LTH2 ^$loop SWP JMPS? |
|
58 | 58 |
POP2 =Console.short |
59 | 59 |
|
60 | 60 |
RTN |
... | ... |
@@ -138,13 +138,14 @@ lituxn(Uxn *u, Uint8 instr) |
138 | 138 |
int |
139 | 139 |
opcuxn(Uxn *u, Uint8 instr) |
140 | 140 |
{ |
141 |
- Uint8 op = instr & 0x1f; |
|
141 |
+ Uint8 op = instr & 0x1f, fcond; |
|
142 | 142 |
setflag(&u->status, FLAG_SHORT, (instr >> 5) & 1); |
143 | 143 |
setflag(&u->status, FLAG_SIGN, (instr >> 6) & 1); |
144 | 144 |
setflag(&u->status, FLAG_COND, (instr >> 7) & 1); |
145 |
+ fcond = getflag(&u->status, FLAG_COND); |
|
145 | 146 |
if(getflag(&u->status, FLAG_SHORT)) |
146 | 147 |
op += 32; |
147 |
- if(u->wst.ptr < opr[op][0]) |
|
148 |
+ if(u->wst.ptr < opr[op][0] || (fcond && u->wst.ptr < 1)) |
|
148 | 149 |
return haltuxn(u, "Working-stack underflow", op); |
149 | 150 |
if(u->wst.ptr + opr[op][1] - opr[op][0] >= 255) |
150 | 151 |
return haltuxn(u, "Working-stack overflow", instr); |
... | ... |
@@ -152,8 +153,10 @@ opcuxn(Uxn *u, Uint8 instr) |
152 | 153 |
return haltuxn(u, "Return-stack underflow", op); |
153 | 154 |
if(u->rst.ptr + opr[op][3] - opr[op][2] >= 255) |
154 | 155 |
return haltuxn(u, "Return-stack overflow", instr); |
155 |
- if(!getflag(&u->status, FLAG_COND) || (getflag(&u->status, FLAG_COND) && pop8(&u->wst))) |
|
156 |
+ if(!fcond || (fcond && pop8(&u->wst))) |
|
156 | 157 |
(*ops[op])(u); |
158 |
+ else if(opr[op][0] >= opr[op][1]) |
|
159 |
+ u->wst.ptr -= opr[op][0] - opr[op][1]; |
|
157 | 160 |
return 1; |
158 | 161 |
} |
159 | 162 |
|