Minor cleanup
This commit is contained in:
parent
781eb5866c
commit
8ce9a998a2
|
@ -35,7 +35,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
Uint8 data[256 * 256], llen, mlen;
|
||||
Uint16 ptr;
|
||||
Uint16 ptr, count;
|
||||
Label labels[256];
|
||||
Macro macros[256];
|
||||
} Program;
|
||||
|
@ -69,6 +69,7 @@ pushbyte(Uint8 b, int lit)
|
|||
{
|
||||
if(lit) pushbyte(0x02, 0);
|
||||
p.data[p.ptr++] = b;
|
||||
p.count++;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -418,7 +419,7 @@ void
|
|||
cleanup(char *filename)
|
||||
{
|
||||
int i;
|
||||
printf("Assembled %s, %d labels, %d macros.\n\n", filename, p.llen, p.mlen);
|
||||
printf("Assembled %s(%0.2fkb), %d labels, %d macros.\n\n", filename, p.count / 1000.0, p.llen, p.mlen);
|
||||
for(i = 0; i < p.llen; ++i)
|
||||
if(!p.labels[i].refs)
|
||||
printf("--- Unused label: %s\n", p.labels[i].name);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
- Toggle guides
|
||||
- Set eye option
|
||||
- Complete save/load
|
||||
- Limit size
|
||||
- Draw point inbetween
|
||||
)
|
||||
|
||||
%RTN { JMP2r }
|
||||
|
@ -24,13 +26,12 @@
|
|||
|
||||
;center { x 2 y 2 }
|
||||
;toolbar { x1 2 y1 2 x2 2 y2 2 }
|
||||
;cursor { x 2 y 2 x0 2 y0 2 size 1 patt 1 drag 1 view 1 }
|
||||
;cursor { x 2 y 2 x0 2 y0 2 size 1 patt 1 drag 1 zoom 1 }
|
||||
;rect { x1 2 y1 2 x2 2 y2 2 }
|
||||
;color { byte 1 }
|
||||
;pos { x 2 y 2 }
|
||||
;pix { x 2 y 2 }
|
||||
;px { x 1 y 1 }
|
||||
;label { x 2 y 2 color 1 addr 2 } ( remove )
|
||||
|
||||
|0100 @RESET
|
||||
|
||||
|
@ -53,8 +54,11 @@
|
|||
|
||||
,draw-background JSR2
|
||||
,fit-canvas JSR2
|
||||
,draw-titlebar JSR2
|
||||
,fit-toolbar JSR2
|
||||
|
||||
( fit toolbar )
|
||||
~toolbar.x1 #0010 ADD2 =toolbar.x2
|
||||
~toolbar.y1 #0040 ADD2 =toolbar.y2
|
||||
,draw-toolbar JSR2
|
||||
|
||||
BRK
|
||||
|
||||
|
@ -68,8 +72,7 @@ BRK
|
|||
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #10 ,line-rect JSR2
|
||||
,draw-background JSR2
|
||||
,fit-canvas JSR2
|
||||
,draw-titlebar JSR2
|
||||
,fit-toolbar JSR2
|
||||
,draw-toolbar JSR2
|
||||
#00 =cursor.drag
|
||||
$no-release
|
||||
|
||||
|
@ -112,15 +115,12 @@ BRK
|
|||
( background interface )
|
||||
~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/
|
||||
DUP2
|
||||
#0000 NEQ2 ,$no-toggle-guides ROT JMP2?
|
||||
~cursor.view #00 EQU =cursor.view
|
||||
#0000 NEQ2 ,$no-toggle-zoom ROT JMP2?
|
||||
~cursor.zoom #00 EQU =cursor.zoom
|
||||
( release ) #00 =Mouse.state
|
||||
~cursor.view =Console.byte
|
||||
~Screen.width #0020 SUB2 =Sprite.x
|
||||
~Screen.height #0010 SUB2 =Sprite.y
|
||||
,mode_guidesoff #00 ~cursor.view #0008 MUL2 ADD2 =Sprite.addr
|
||||
#01 =Sprite.color
|
||||
$no-toggle-guides
|
||||
~cursor.zoom =Console.byte
|
||||
,redraw JSR2
|
||||
$no-toggle-zoom
|
||||
DUP2
|
||||
#0001 NEQ2 ,$no-load-button ROT JMP2?
|
||||
( release ) #00 =Mouse.state
|
||||
|
@ -266,6 +266,16 @@ RTN
|
|||
|
||||
RTN
|
||||
|
||||
( Drawing )
|
||||
|
||||
@redraw
|
||||
|
||||
,draw-background JSR2
|
||||
,draw-canvas JSR2
|
||||
,draw-toolbar JSR2
|
||||
|
||||
RTN
|
||||
|
||||
@draw-canvas
|
||||
|
||||
~canvas.y1 =Sprite.y
|
||||
|
@ -282,44 +292,18 @@ RTN
|
|||
|
||||
RTN
|
||||
|
||||
@line-rect ( x1 y1 x2 y2 color )
|
||||
|
||||
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
||||
$hor
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
||||
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
||||
,$hor ~Screen.x ~rect.x2 NEQ2 JMP2?
|
||||
~rect.y1 =Screen.y
|
||||
$ver
|
||||
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
||||
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 ++ NEQ2 JMP2?
|
||||
|
||||
RTN
|
||||
|
||||
@fill-rect ( x1 y1 x2 y2 color )
|
||||
|
||||
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
||||
$ver
|
||||
~rect.x1 =Screen.x
|
||||
$hor
|
||||
( draw ) ~color =Screen.color
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
,$hor ~Screen.x ~rect.x2 NEQ2 JMP2?
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 NEQ2 JMP2?
|
||||
|
||||
RTN
|
||||
|
||||
@draw-cursor
|
||||
|
||||
~cursor.x ~Mouse.x NEQU2
|
||||
~cursor.y ~Mouse.y NEQU2
|
||||
#0000 EQU2
|
||||
~Mouse.state
|
||||
#00 NEQ
|
||||
#0101 EQU2 RTN? ( Return if unchanged )
|
||||
|
||||
#0000 EQU2 ~Mouse.state #00 NEQ #0101 EQU2 RTN? ( Return if unchanged )
|
||||
,blank_icn =Sprite.addr
|
||||
|
||||
( clear brush size )
|
||||
~cursor.x #0003 SUB2 =Sprite.x
|
||||
~cursor.y #0003 SUB2 =Sprite.y
|
||||
#10 =Sprite.color
|
||||
|
@ -327,7 +311,6 @@ RTN
|
|||
( clear last cursor )
|
||||
~cursor.x =Sprite.x
|
||||
~cursor.y =Sprite.y
|
||||
,blank_icn =Sprite.addr
|
||||
#10 =Sprite.color
|
||||
|
||||
( record cursor positions )
|
||||
|
@ -335,54 +318,23 @@ RTN
|
|||
~Mouse.y =cursor.y
|
||||
|
||||
( draw new cursor )
|
||||
|
||||
,$outside-canvas ~Mouse.x CLN2r ~canvas.x1 GTH2 STH2r ~canvas.x2 LTH2 #0101 NEQ2 JMP2?
|
||||
,$outside-canvas ~Mouse.y CLN2r ~canvas.y1 GTH2 STH2r ~canvas.y2 LTH2 #0101 NEQ2 JMP2?
|
||||
~cursor.x #0003 SUB2 =Sprite.x
|
||||
~cursor.y #0003 SUB2 =Sprite.y
|
||||
,brush_view #00 ~cursor.size #0008 MUL2 ADD2 =Sprite.addr
|
||||
#11 ~Mouse.state ADD =Sprite.color
|
||||
,brush_view #00 ~cursor.size 8* ADD2 =Sprite.addr
|
||||
#11 ~Mouse.state #02 MUL ADD =Sprite.color
|
||||
,$outside-canvas ~Mouse.state #00 EQU JMP2?
|
||||
RTN
|
||||
$outside-canvas
|
||||
|
||||
~cursor.x =Sprite.x
|
||||
~cursor.y =Sprite.y
|
||||
|
||||
,brush_pointer #00 ~Controller #02 EQU #0008 MUL2 ADD2 =Sprite.addr
|
||||
,brush_pointer #00 ~Controller #02 EQU 8* ADD2 =Sprite.addr
|
||||
#1f =Sprite.color
|
||||
|
||||
RTN
|
||||
|
||||
@draw-titlebar
|
||||
|
||||
~canvas.x1 #0001 SUB2 ~canvas.y2 #06 ,filepath
|
||||
( load ) =label.addr =label.color =Sprite.y =Sprite.x
|
||||
~label.addr
|
||||
$loop NOP
|
||||
( draw ) DUP2 LDR #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
||||
( incr ) ++
|
||||
( incr ) ~Sprite.x 8+ =Sprite.x
|
||||
DUP2 LDR #00 NEQ ^$loop MUL JMP
|
||||
POP2
|
||||
|
||||
RTN
|
||||
|
||||
@fit-canvas
|
||||
|
||||
~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2
|
||||
~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2
|
||||
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2
|
||||
,draw-canvas JSR2
|
||||
|
||||
RTN
|
||||
|
||||
@fit-toolbar
|
||||
|
||||
~toolbar.x1 #0010 ADD2 =toolbar.x2
|
||||
~toolbar.y1 #0040 ADD2 =toolbar.y2
|
||||
,draw-toolbar JSR2
|
||||
|
||||
RTN
|
||||
|
||||
@draw-toolbar
|
||||
|
||||
~toolbar.x1 -- ~toolbar.y1 -- ~toolbar.x2 ~toolbar.y2 #02 ,line-rect JSR2
|
||||
|
@ -443,7 +395,7 @@ RTN
|
|||
,save_icn =Sprite.addr
|
||||
#01 =Sprite.color
|
||||
~Screen.width #0020 SUB2 =Sprite.x
|
||||
,mode_guidesoff =Sprite.addr
|
||||
,zoom_icn #00 ~cursor.zoom 8* ADD2 =Sprite.addr
|
||||
#01 =Sprite.color
|
||||
|
||||
( draw width )
|
||||
|
@ -463,6 +415,46 @@ RTN
|
|||
|
||||
RTN
|
||||
|
||||
@line-rect ( x1 y1 x2 y2 color )
|
||||
|
||||
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
||||
$hor
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
||||
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
||||
,$hor ~Screen.x ~rect.x2 NEQ2 JMP2?
|
||||
~rect.y1 =Screen.y
|
||||
$ver
|
||||
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
||||
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 ++ NEQ2 JMP2?
|
||||
|
||||
RTN
|
||||
|
||||
@fill-rect ( x1 y1 x2 y2 color )
|
||||
|
||||
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
||||
$ver
|
||||
~rect.x1 =Screen.x
|
||||
$hor
|
||||
( draw ) ~color =Screen.color
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
,$hor ~Screen.x ~rect.x2 NEQ2 JMP2?
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 NEQ2 JMP2?
|
||||
|
||||
RTN
|
||||
|
||||
@fit-canvas
|
||||
|
||||
~canvas.w 8* ~canvas.x1 ADD2 =canvas.x2
|
||||
~canvas.h 8* ~canvas.y1 ADD2 =canvas.y2
|
||||
~canvas.x1 -- ~canvas.y1 -- ~canvas.x2 ~canvas.y2 #01 ,line-rect JSR2
|
||||
,draw-canvas JSR2
|
||||
|
||||
RTN
|
||||
|
||||
@size_icn
|
||||
[ 0000 0010 0000 0000 ]
|
||||
[ 0000 1038 1000 0000 ]
|
||||
|
@ -494,26 +486,23 @@ RTN
|
|||
[ 7c82 8282 8282 7c00 ]
|
||||
[ 7cfe fefe fefe 7c00 ]
|
||||
|
||||
@zoom_icn
|
||||
[ 3048 8484 4834 0200 ]
|
||||
[ 3245 8284 4834 0200 ]
|
||||
|
||||
@brush_pointer [ 80c0 e0f0 f8e0 1000 ]
|
||||
@brush_hand [ 4040 4070 f8f8 f870 ]
|
||||
@brush_eraser [ 2050 b87c 3e1c 0800 ]
|
||||
|
||||
@mode_guidesoff [ 0038 4492 2810 0000 ]
|
||||
@mode_guideson [ 0000 0082 4438 0000 ]
|
||||
@mode_zoomout [ 3048 8484 4834 0200 ]
|
||||
|
||||
[ 0000 0000 0000 0000 ]
|
||||
[ 0000 0000 0000 0000 ]
|
||||
[ 0000 0000 0000 0000 ]
|
||||
|
||||
@mode_zoomin [ 3245 8284 4834 0200 ]
|
||||
@load_icn [ feaa d6aa d4aa f400 ]
|
||||
@save_icn [ fe82 8282 848a f400 ]
|
||||
|
||||
@blank_icn [ 0000 0000 0000 0000 ]
|
||||
@filepath [ noodle-io.bit 00 ]
|
||||
|
||||
@font_hex ( 0-F TODO: should pull from @font instead.. )
|
||||
@font_hex
|
||||
[
|
||||
003c 464a 5262 3c00 0018 0808 0808 1c00
|
||||
003c 4202 3c40 7e00 003c 421c 0242 3c00
|
||||
|
@ -525,59 +514,6 @@ RTN
|
|||
007e 4078 4040 7e00 007e 4078 4040 4000
|
||||
]
|
||||
|
||||
@font ( specter8-frag font )
|
||||
[
|
||||
0000 0000 0000 0000 0008 0808 0800 0800
|
||||
0014 1400 0000 0000 0024 7e24 247e 2400
|
||||
0008 1e28 1c0a 3c08 0000 2204 0810 2200
|
||||
0030 4832 4c44 3a00 0008 1000 0000 0000
|
||||
0004 0808 0808 0400 0020 1010 1010 2000
|
||||
0000 2214 0814 2200 0000 0808 3e08 0800
|
||||
0000 0000 0000 0810 0000 0000 3e00 0000
|
||||
0000 0000 0000 0800 0000 0204 0810 2000
|
||||
003c 464a 5262 3c00 0018 0808 0808 1c00
|
||||
003c 4202 3c40 7e00 003c 421c 0242 3c00
|
||||
000c 1424 447e 0400 007e 407c 0242 3c00
|
||||
003c 407c 4242 3c00 007e 0204 0810 1000
|
||||
003c 423c 4242 3c00 003c 4242 3e02 3c00
|
||||
0000 0010 0000 1000 0000 1000 0010 1020
|
||||
0000 0810 2010 0800 0000 003e 003e 0000
|
||||
0000 1008 0408 1000 003c 420c 1000 1000
|
||||
003c 4232 4a42 3c00 003c 4242 7e42 4200
|
||||
007c 427c 4242 7c00 003c 4240 4042 3c00
|
||||
007c 4242 4242 7c00 007e 4078 4040 7e00
|
||||
007e 4078 4040 4000 003c 4240 4642 3c00
|
||||
0042 427e 4242 4200 001c 0808 0808 1c00
|
||||
007e 0202 0242 3c00 0042 4478 4442 4200
|
||||
0040 4040 4040 7e00 0042 665a 4242 4200
|
||||
0042 6252 4a46 4200 003c 4242 4242 3c00
|
||||
007c 4242 7c40 4000 003c 4242 4244 3a00
|
||||
007c 4242 7c44 4200 003e 403c 0242 3c00
|
||||
007e 0808 0808 1000 0042 4242 4244 3a00
|
||||
0042 4242 4224 1800 0042 4242 5a66 4200
|
||||
0042 423c 4242 4200 0042 423e 0242 3c00
|
||||
007e 020c 3040 7e00 000c 0808 0808 0c00
|
||||
0040 2010 0804 0200 0030 1010 1010 3000
|
||||
0008 1400 0000 0000 0000 0000 0000 7e00
|
||||
0008 0400 0000 0000 0000 3c02 3e42 3a00
|
||||
0040 407c 4242 7c00 0000 3c42 4042 3c00
|
||||
0002 023e 4242 3e00 0000 3c42 7e40 3e00
|
||||
0000 3e40 7840 4000 0000 3c42 3e02 3c00
|
||||
0040 405c 6242 4200 0008 0018 0808 0400
|
||||
0008 0018 0808 4830 0040 4244 7844 4200
|
||||
0010 1010 1010 0c00 0000 6c52 5252 5200
|
||||
0000 5c62 4242 4200 0000 3c42 4242 3c00
|
||||
0000 7c42 427c 4040 0000 3e42 423e 0202
|
||||
0000 5c62 4040 4000 0000 3e40 3c02 7c00
|
||||
0008 7e08 0808 1000 0000 4242 4244 3a00
|
||||
0000 4242 4224 1800 0000 5252 5252 2e00
|
||||
0000 4224 1824 4200 0000 4242 3e02 7c00
|
||||
0000 7e02 3c40 7e00 000c 0810 1008 0c00
|
||||
0008 0808 0808 0800 0030 1008 0810 3000
|
||||
0000 0032 4c00 0000 3c42 99a1 a199 423c
|
||||
|
||||
]
|
||||
|
||||
|2000 ;canvas { w 2 h 2 x1 2 y1 2 x2 2 y2 2 }
|
||||
|3000 @data [ ]
|
||||
|
||||
|
|
Loading…
Reference in New Issue