Implemented save/load to noodle
This commit is contained in:
parent
7543b0453d
commit
d5a18c6cd1
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- Pixel cleanup brush
|
- Pixel cleanup brush
|
||||||
- Rename filename
|
|
||||||
)
|
)
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
|
@ -23,14 +22,13 @@
|
||||||
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
%++ { #0001 ADD2 } %-- { #0001 SUB2 }
|
||||||
%2/ { #0001 SFT2 }
|
%2/ { #0001 SFT2 }
|
||||||
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
|
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
|
||||||
%8+ { #0008 ADD2 }
|
%8+ { #0008 ADD2 } %8- { #0008 SUB2 }
|
||||||
|
|
||||||
( variables )
|
( variables )
|
||||||
|
|
||||||
;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 }
|
;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 }
|
||||||
;brush { tool 1 size 1 patt 1 drag 1 last 1 oper 2 }
|
;brush { tool 1 size 1 patt 1 drag 1 last 1 oper 2 }
|
||||||
;zoom { active 1 x 2 y 2 }
|
;zoom { active 1 x 2 y 2 }
|
||||||
;document { state 1 edit 1 }
|
|
||||||
( interface )
|
( interface )
|
||||||
;toolpane { x1 2 y1 2 x2 2 y2 2 }
|
;toolpane { x1 2 y1 2 x2 2 y2 2 }
|
||||||
;pattpane { x1 2 y1 2 x2 2 y2 2 }
|
;pattpane { x1 2 y1 2 x2 2 y2 2 }
|
||||||
|
@ -46,10 +44,12 @@
|
||||||
;pt1 { x 2 y 2 }
|
;pt1 { x 2 y 2 }
|
||||||
;pt2 { x 2 y 2 } ( paint-rect )
|
;pt2 { x 2 y 2 } ( paint-rect )
|
||||||
;px { x 1 y 1 }
|
;px { x 1 y 1 }
|
||||||
|
;document { state 1 edit 1 namelength 1 name 48 }
|
||||||
|
;timer { byte 1 }
|
||||||
|
|
||||||
( devices )
|
( devices )
|
||||||
|
|
||||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
|0100 ;Console { pad 8 char 1 byte 1 short 2 string 2 }
|
||||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||||
|0130 ;Controller { buttons 1 }
|
|0130 ;Controller { buttons 1 }
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
#00 =brush.tool
|
#00 =brush.tool
|
||||||
|
|
||||||
( load file )
|
( load file )
|
||||||
,filepath ,load-file JSR2
|
,document.name ,load-file JSR2
|
||||||
|
|
||||||
( setup panes )
|
( setup panes )
|
||||||
#0010 =toolpane.x1 #0010 =toolpane.y1
|
#0010 =toolpane.x1 #0010 =toolpane.y1
|
||||||
|
@ -92,11 +92,14 @@
|
||||||
|
|
||||||
( center canvas )
|
( center canvas )
|
||||||
,center JSR2
|
,center JSR2
|
||||||
|
,clear JSR2
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
@FRAME
|
@FRAME
|
||||||
|
|
||||||
|
~document.edit #01 EQU ,on-document-edit JNZ2
|
||||||
|
|
||||||
,draw-cursor JSR2
|
,draw-cursor JSR2
|
||||||
|
|
||||||
( release drag )
|
( release drag )
|
||||||
|
@ -242,15 +245,16 @@ BRK
|
||||||
DUP2 #0000 NEQ2 ^$no-clear-button JNZ
|
DUP2 #0000 NEQ2 ^$no-clear-button JNZ
|
||||||
,center JSR2
|
,center JSR2
|
||||||
,clear JSR2
|
,clear JSR2
|
||||||
|
#01 =document.edit
|
||||||
( release ) #00 =Mouse.state
|
( release ) #00 =Mouse.state
|
||||||
$no-clear-button
|
$no-clear-button
|
||||||
DUP2 #0001 NEQ2 ^$no-load-button JNZ
|
DUP2 #0001 NEQ2 ^$no-load-button JNZ
|
||||||
,filepath ,load-file JSR2
|
,document.name ,load-file JSR2
|
||||||
,draw-canvas JSR2
|
,draw-canvas JSR2
|
||||||
( release ) #00 =Mouse.state
|
( release ) #00 =Mouse.state
|
||||||
$no-load-button
|
$no-load-button
|
||||||
DUP2 #0002 NEQ2 ^$no-save-button JNZ
|
DUP2 #0002 NEQ2 ^$no-save-button JNZ
|
||||||
,filepath ,save-file JSR2
|
,document.name ,save-file JSR2
|
||||||
( release ) #00 =Mouse.state
|
( release ) #00 =Mouse.state
|
||||||
$no-save-button
|
$no-save-button
|
||||||
POP2
|
POP2
|
||||||
|
@ -301,6 +305,44 @@ BRK
|
||||||
|
|
||||||
BRK
|
BRK
|
||||||
|
|
||||||
|
@on-document-edit
|
||||||
|
|
||||||
|
~Keys #00 EQU ,$no-keys JNZ2
|
||||||
|
|
||||||
|
~Keys #0d NEQ ,$no-enter JNZ2
|
||||||
|
#00 =document.edit
|
||||||
|
,redraw JSR2
|
||||||
|
BRK
|
||||||
|
$no-enter
|
||||||
|
|
||||||
|
~Keys #08 NEQ ,$no-backspace JNZ2
|
||||||
|
( incr ) ~document.namelength #01 SUB =document.namelength
|
||||||
|
,$end JSR2
|
||||||
|
BRK
|
||||||
|
$no-backspace
|
||||||
|
|
||||||
|
( store key ) ~Keys ,document.name #00 ~document.namelength ADD2 POK2
|
||||||
|
( incr ) ~document.namelength #01 ADD =document.namelength
|
||||||
|
|
||||||
|
$end
|
||||||
|
( store end ) #00 ,document.name #00 ~document.namelength ADD2 POK2
|
||||||
|
( release ) #00 =Keys.key
|
||||||
|
|
||||||
|
$no-keys
|
||||||
|
|
||||||
|
( move ) #0008 =Sprite.x ~Screen.height #0010 SUB2 =Sprite.y
|
||||||
|
( draw ) ,document.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2
|
||||||
|
|
||||||
|
~Sprite.x 8- =Sprite.x
|
||||||
|
$clear
|
||||||
|
~Sprite.x 8+ =Sprite.x
|
||||||
|
#00 =Sprite.color
|
||||||
|
~Sprite.x ~Screen.width LTH2 ^$clear JNZ
|
||||||
|
|
||||||
|
~timer #01 ADD =timer
|
||||||
|
|
||||||
|
BRK
|
||||||
|
|
||||||
@center
|
@center
|
||||||
|
|
||||||
( clear ) ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2
|
( clear ) ~canvas.x1 #0002 SUB2 ~canvas.y1 #0002 SUB2 ~canvas.x2 #0002 ADD2 ~canvas.y2 #0002 ADD2 #00 ,fill-rect JSR2
|
||||||
|
@ -320,12 +362,15 @@ BRK
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
@clear
|
@clear
|
||||||
|
|
||||||
,untitled_txt ,filepath
|
#00 =document.namelength
|
||||||
|
|
||||||
|
,untitled_txt ,document.name
|
||||||
$rename
|
$rename
|
||||||
( copy src->dst ) OVR2 OVR2 SWP2 PEK2 ROT ROT POK2
|
( copy src->dst ) OVR2 OVR2 SWP2 PEK2 ROT ROT POK2
|
||||||
( incr dst ) ++
|
( incr dst ) ++
|
||||||
( incr src ) SWP2 ++ SWP2
|
( incr src ) SWP2 ++ SWP2
|
||||||
|
( incr len ) ~document.namelength #01 ADD =document.namelength
|
||||||
OVR2 PEK2 #00 NEQ ^$rename JNZ
|
OVR2 PEK2 #00 NEQ ^$rename JNZ
|
||||||
#00 ROT ROT POK2 POP2
|
#00 ROT ROT POK2 POP2
|
||||||
|
|
||||||
|
@ -753,14 +798,14 @@ RTN
|
||||||
#0010 =Sprite.y
|
#0010 =Sprite.y
|
||||||
( draw width )
|
( draw width )
|
||||||
~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
||||||
( draw ) #03 =Sprite.color
|
( draw ) #01 =Sprite.color
|
||||||
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
|
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
|
||||||
( draw ) #03 =Sprite.color
|
( draw ) #01 =Sprite.color
|
||||||
( draw height )
|
( draw height )
|
||||||
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
|
||||||
( draw ) #03 =Sprite.color
|
( draw ) #01 =Sprite.color
|
||||||
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
|
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
|
||||||
( draw ) #03 =Sprite.color
|
( draw ) #01 =Sprite.color
|
||||||
|
|
||||||
( draw save/load/guides icons )
|
( draw save/load/guides icons )
|
||||||
~Screen.height #0010 SUB2 =Sprite.y
|
~Screen.height #0010 SUB2 =Sprite.y
|
||||||
|
@ -777,10 +822,10 @@ RTN
|
||||||
,save_icn =Sprite.addr
|
,save_icn =Sprite.addr
|
||||||
#01 =Sprite.color
|
#01 =Sprite.color
|
||||||
|
|
||||||
( draw filename )
|
( draw )
|
||||||
|
|
||||||
#0008 =Sprite.x
|
#0008 =Sprite.x
|
||||||
,filepath #01 ,draw-label JSR2
|
,document.name #01 ,draw-label JSR2
|
||||||
|
|
||||||
RTN
|
RTN
|
||||||
|
|
||||||
|
@ -939,6 +984,4 @@ RTN
|
||||||
|
|
||||||
@ERROR BRK
|
@ERROR BRK
|
||||||
|
|
||||||
|2000 @filepath [ projects/pictures/tima2a1a.bit 00 ]
|
|
||||||
|
|
||||||
|2100 @data
|
|2100 @data
|
||||||
|
|
|
@ -337,6 +337,7 @@ console_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
|
||||||
case 0x08: printf("%c", b1); break;
|
case 0x08: printf("%c", b1); break;
|
||||||
case 0x09: printf("0x%02x\n", b1); break;
|
case 0x09: printf("0x%02x\n", b1); break;
|
||||||
case 0x0b: printf("0x%04x\n", (m[ptr + 0x0a] << 8) + b1); break;
|
case 0x0b: printf("0x%04x\n", (m[ptr + 0x0a] << 8) + b1); break;
|
||||||
|
case 0x0d: printf("%s\n", &m[(m[ptr + 0x0c] << 8) + b1]); break;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
(void)m;
|
(void)m;
|
||||||
|
|
Loading…
Reference in New Issue