... | ... |
@@ -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/software/nasu.usm bin/boot.rom |
|
23 |
+./bin/assembler projects/software/noodle.usm bin/boot.rom |
|
24 | 24 |
./bin/emulator bin/boot.rom |
... | ... |
@@ -2,8 +2,8 @@ |
2 | 2 |
app/noodle : illustration program |
3 | 3 |
|
4 | 4 |
TODO |
5 |
- - Only redraw when mouse has changed |
|
6 |
- - Only redraw target tile |
|
5 |
+ - Only draw-canvas when mouse has changed |
|
6 |
+ - Only draw-canvas target tile |
|
7 | 7 |
) |
8 | 8 |
|
9 | 9 |
%RTN { JMP2r } |
... | ... |
@@ -18,12 +18,14 @@ |
18 | 18 |
;cursor { x 2 y 2 } |
19 | 19 |
;rect { x1 2 y1 2 x2 2 y2 2 } |
20 | 20 |
;color { byte 1 } |
21 |
-;pt { x 2 y 2 } |
|
21 |
+;pos { x 2 y 2 } |
|
22 |
+;pix { x 2 y 2 } |
|
23 |
+;px { x 1 y 1 } |
|
22 | 24 |
;label { x 2 y 2 color 1 addr 2 } ( remove ) |
23 | 25 |
|
24 | 26 |
|0100 @RESET |
25 | 27 |
|
26 |
- #0008 =toolbar.x #0068 =toolbar.y |
|
28 |
+ #0038 =toolbar.x #0098 =toolbar.y |
|
27 | 29 |
|
28 | 30 |
#0010 =canvas.x1 #0020 =canvas.y1 |
29 | 31 |
#0026 =canvas.w #0010 =canvas.h ,fit JSR2 |
... | ... |
@@ -44,6 +46,8 @@ BRK |
44 | 46 |
|
45 | 47 |
~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint JSR2 |
46 | 48 |
|
49 |
+ ,draw-canvas JSR2 |
|
50 |
+ |
|
47 | 51 |
$no-paint |
48 | 52 |
|
49 | 53 |
$no-touch |
... | ... |
@@ -52,19 +56,40 @@ BRK |
52 | 56 |
|
53 | 57 |
@paint ( x y ) |
54 | 58 |
|
55 |
- =pt.y =pt.x |
|
59 |
+ #0004 SUB2 =pos.y #0004 SUB2 =pos.x |
|
60 |
+ |
|
61 |
+ #00 =px.x #00 =px.y |
|
62 |
+ $ver |
|
63 |
+ #00 =px.x |
|
64 |
+ $hor |
|
65 |
+ ( get bit ) |
|
66 |
+ ,size1_icn #00 ~px.y ADD2 LDR #07 ~px.x SUB SHR #01 AND ( get bit ) |
|
67 |
+ |
|
68 |
+ #00 EQU ,$no-pixel ROT JMP2? |
|
69 |
+ ~pos.x #00 ~px.x ADD2 ~pos.y #00 ~px.y ADD2 ,add-pixel JSR2 |
|
70 |
+ $no-pixel |
|
71 |
+ |
|
72 |
+ ( incr ) ~px.x #01 ADD =px.x |
|
73 |
+ ,$hor ~px.x #08 LTH JMP2? |
|
74 |
+ ( incr ) ~px.y #01 ADD =px.y |
|
75 |
+ ,$ver ~px.y #08 LTH JMP2? |
|
76 |
+ |
|
77 |
+RTN |
|
78 |
+ |
|
79 |
+ |
|
80 |
+@add-pixel ( x y ) |
|
56 | 81 |
|
57 |
- ( get tile addr ) ,data ~pt.x 8/ ~pt.y 8/ ~canvas.w MUL2 ADD2 8* ~pt.y MOD8 ADD2 ADD2 |
|
82 |
+ =pix.y =pix.x |
|
83 |
+ |
|
84 |
+ ( get tile addr ) ,data ~pix.x 8/ ~pix.y 8/ ~canvas.w MUL2 ADD2 8* ~pix.y MOD8 ADD2 ADD2 |
|
58 | 85 |
|
59 | 86 |
( load ) DUP2 LDR |
60 |
- ( mask ) #01 #07 ~pt.x MOD8 SWP POP SUB SHL XOR |
|
87 |
+ ( mask ) #01 #07 ~pix.x MOD8 SWP POP SUB SHL XOR |
|
61 | 88 |
( save ) ROT ROT STR |
62 | 89 |
|
63 |
- ,redraw JSR2 |
|
64 |
- |
|
65 | 90 |
RTN |
66 | 91 |
|
67 |
-@redraw |
|
92 |
+@draw-canvas |
|
68 | 93 |
|
69 | 94 |
~canvas.y1 =Sprite.y |
70 | 95 |
,data =Sprite.addr |
... | ... |
@@ -143,7 +168,7 @@ RTN |
143 | 168 |
~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2 |
144 | 169 |
~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2 |
145 | 170 |
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2 |
146 |
- ,redraw JSR2 |
|
171 |
+ ,draw-canvas JSR2 |
|
147 | 172 |
|
148 | 173 |
RTN |
149 | 174 |
|
... | ... |
@@ -200,7 +225,7 @@ RTN |
200 | 225 |
@mode_zoomin [ 3245 8284 4834 0200 ] |
201 | 226 |
|
202 | 227 |
@blank_icn [ 0000 0000 0000 0000 ] |
203 |
-@filepath [ projects/drawings/hello.chr 00 ] |
|
228 |
+@filepath [ projects/drawings/wtf.chr 00 ] |
|
204 | 229 |
|
205 | 230 |
@font ( specter8-frag font ) |
206 | 231 |
[ |