Browse Source

Faster state drawing

main
Devine Lu Linvega 5 days ago
parent
commit
ab9ada307b
  1. 66
      src/nasu.tal

66
src/nasu.tal

@ -9,7 +9,7 @@
|000 |000
@state/timer $1 &changed $1 @state/timer $1
@settings/depth $1 &color $1 &blend $1 &ratio $1 &tool $1 &focus $2 &zoom $1 &brush $1 &dir $1 @settings/depth $1 &color $1 &blend $1 &ratio $1 &tool $1 &focus $2 &zoom $1 &brush $1 &dir $1
@cursor/x $2 &y $2 &last $1 @cursor/x $2 &y $2 &last $1
@selection &x1 $1 &y1 $1 &x2 $1 &y2 $1 &zx $1 &zy $1 &a $1 @selection &x1 $1 &y1 $1 &x2 $1 &y2 $1 &zx $1 &zy $1 &a $1
@ -204,8 +204,7 @@
#01 .settings/tool LDZ EQU ?&select #01 .settings/tool LDZ EQU ?&select
( | paint ) ( | paint )
.settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel> .settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel>
[ LIT2 01 -state/changed ] STZ state/<change>
<draw-state>
<redraw> <redraw>
BRK BRK
@ -218,8 +217,7 @@
&zoomed ( x* y* -> ) &zoomed ( x* y* -> )
SWP2 #03 SFT2 #00 .selection/zx LDZ ADD2 SWP2 #03 SFT2 #00 .selection/zy LDZ ADD2 .settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel> SWP2 #03 SFT2 #00 .selection/zx LDZ ADD2 SWP2 #03 SFT2 #00 .selection/zy LDZ ADD2 .settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel>
[ LIT2 01 -state/changed ] STZ state/<change>
<draw-state>
<redraw> <redraw>
BRK BRK
@ -239,8 +237,7 @@
.settings/focus LDZ2 ;spritesheet SUB2 STH2kr STA2 .settings/focus LDZ2 ;spritesheet SUB2 STH2kr STA2
.settings/blend LDZ INC2r INC2r STH2r STA .settings/blend LDZ INC2r INC2r STH2r STA
<draw-nametable> <draw-nametable>
[ LIT2 01 -state/changed ] STZ state/<change>
<draw-state>
BRK BRK
@on-touch-toolview ( -> ) @on-touch-toolview ( -> )
@ -271,9 +268,7 @@
POP POP
( release mouse ) [ LIT2 00 -Mouse/state ] DEO !&finish } ( release mouse ) [ LIT2 00 -Mouse/state ] DEO !&finish }
.Mouse/x DEI2 .zoomview/x1 LDZ2 SUB2 #02 SFT2 #00 .selection/x1 LDZ #30 SFT2 ADD2 .Mouse/x DEI2 .zoomview/x1 LDZ2 SUB2 #02 SFT2 #00 .selection/x1 LDZ #30 SFT2 ADD2
( ) .Mouse/y DEI2 .zoomview/y1 LDZ2 SUB2 #02 SFT2 #00 .selection/y1 LDZ #30 SFT2 ADD2 .settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel> ( ) .Mouse/y DEI2 .zoomview/y1 LDZ2 SUB2 #02 SFT2 #00 .selection/y1 LDZ #30 SFT2 ADD2 .settings/color LDZ .Mouse/state DEI #01 EQU MUL <put-pixel> &finish state/<change>
&finish [ LIT2 01 -state/changed ] STZ
<draw-state>
<redraw> <redraw>
BRK BRK
@ -456,6 +451,20 @@
@get-strw ( str* -- width* ) @get-strw ( str* -- width* )
slen #30 SFT2 JMP2r slen #30 SFT2 JMP2r
@state/<unchange> ( -- )
[ LIT2 01 _&changed ] STR !/<draw>
@state/<change> ( -- )
[ LIT2 03 _&changed ] STR
( >> )
@state/<draw> ( -- )
.toolview/x2 LDZ2 #0008 SUB2 .Screen/x DEO2
.toolview/y1 LDZ2 .Screen/y DEO2
;save-icn .Screen/addr DEO2
[ LIT2 &changed $1 -Screen/sprite ] DEO
JMP2r
( (
@|filter ) @|filter )
@ -864,7 +873,7 @@
;zoom-icns [ #00 .settings/zoom LDZ #30 SFT2 ADD2 ] .Screen/addr DEO2 ;zoom-icns [ #00 .settings/zoom LDZ #30 SFT2 ADD2 ] .Screen/addr DEO2
#01 .settings/tool LDZ #02 EQU ADD .Screen/sprite DEO #01 .settings/tool LDZ #02 EQU ADD .Screen/sprite DEO
( | file i/o ) ( | file i/o )
<draw-state> state/<draw>
.toolview/x2 LDZ2 STH2k #0018 SUB2 .Screen/x DEO2 .toolview/x2 LDZ2 STH2k #0018 SUB2 .Screen/x DEO2
;load-icn .Screen/addr DEO2 ;load-icn .Screen/addr DEO2
[ LIT2 01 -Screen/sprite ] DEO [ LIT2 01 -Screen/sprite ] DEO
@ -874,13 +883,6 @@
( | filepath ) ( | filepath )
#01 !<draw-filepath> #01 !<draw-filepath>
@<draw-state> ( -- )
.toolview/x2 LDZ2 #0008 SUB2 .Screen/x DEO2
.toolview/y1 LDZ2 .Screen/y DEO2
;save-icn .Screen/addr DEO2
#05 .state/changed LDZ #0a MUL ADD .Screen/sprite DEO
JMP2r
@<draw-filepath> ( color -- ) @<draw-filepath> ( color -- )
.toolview/x1 LDZ2 #0040 ADD2 .Screen/x DEO2 .toolview/x1 LDZ2 #0040 ADD2 .Screen/x DEO2
.toolview/y1 LDZ2 INC2 .Screen/y DEO2 .toolview/y1 LDZ2 INC2 .Screen/y DEO2
@ -1012,8 +1014,7 @@
( | rename to untitled.txt ) ( | rename to untitled.txt )
;filepath #0040 <mclr> ;filepath #0040 <mclr>
;untitled-txt ;filepath <scpy> ;untitled-txt ;filepath <scpy>
#00 .state/changed STZ state/<unchange> !<redraw>
<draw-state> !<redraw>
@file-open ( -- ) @file-open ( -- )
;filepath is-mono ?file-open-mono ;filepath is-mono ?file-open-mono
@ -1030,8 +1031,7 @@
#0300 .File/length DEO2 #0300 .File/length DEO2
;nametable .File/read DEO2 ;nametable .File/read DEO2
;filepath scap #0004 SUB2 #0004 <mclr> ;filepath scap #0004 SUB2 #0004 <mclr>
#00 .state/changed STZ state/<unchange> !<redraw>
<draw-state> !<redraw>
@file-open-mono ( -- ) @file-open-mono ( -- )
;spritesheet #1300 <mclr> ;spritesheet #1300 <mclr>
@ -1042,8 +1042,7 @@
&>loop &>loop
#00 OVR #40 SFT2 ;spritesheet ADD2 .File/read DEO2 #00 OVR #40 SFT2 ;spritesheet ADD2 .File/read DEO2
INC NEQk ?&>loop INC NEQk ?&>loop
POP2 #00 .state/changed STZ POP2 state/<unchange> !<redraw>
<draw-state> !<redraw>
@file-save ( -- ) @file-save ( -- )
;filepath is-mono ?file-save-mono ;filepath is-mono ?file-save-mono
@ -1058,7 +1057,7 @@
#0300 .File/length DEO2 #0300 .File/length DEO2
;nametable .File/write DEO2 ;nametable .File/write DEO2
;filepath scap #0004 SUB2 #0004 <mclr> } ;filepath scap #0004 SUB2 #0004 <mclr> }
#00 .state/changed STZ !<draw-state> !state/<unchange>
@file-save-mono ( -- ) @file-save-mono ( -- )
;filepath .File/name DEO2 ;filepath .File/name DEO2
@ -1067,7 +1066,7 @@
&>loop &>loop
#00 OVR #40 SFT2 ;spritesheet ADD2 .File/write DEO2 #00 OVR #40 SFT2 ;spritesheet ADD2 .File/write DEO2
INC NEQk ?&>loop INC NEQk ?&>loop
POP2 #00 .state/changed STZ !<draw-state> POP2 !state/<unchange>
@save-theme ( -- ) @save-theme ( -- )
.System/r DEI2 #fffa STA2 .System/r DEI2 #fffa STA2
@ -1105,28 +1104,23 @@
@edit-erase ( -- ) @edit-erase ( -- )
;op-erase <run> ;op-erase <run>
[ LIT2 01 -state/changed ] STZ state/<change> !<redraw>
<draw-state> !<redraw>
@edit-invert ( -- ) @edit-invert ( -- )
;op-invert <run> ;op-invert <run>
[ LIT2 01 -state/changed ] STZ state/<change> !<redraw>
<draw-state> !<redraw>
@edit-colorize ( -- ) @edit-colorize ( -- )
;filter-colorize <filter> ;filter-colorize <filter>
[ LIT2 01 -state/changed ] STZ state/<change> !<redraw>
<draw-state> !<redraw>
@edit-flipx ( -- ) @edit-flipx ( -- )
;filter-flipx <filter> ;filter-flipx <filter>
[ LIT2 01 -state/changed ] STZ state/<change> !<redraw>
<draw-state> !<redraw>
@edit-flipy ( -- ) @edit-flipy ( -- )
;filter-flipy <filter> ;filter-flipy <filter>
[ LIT2 01 -state/changed ] STZ state/<change> !<redraw>
<draw-state> !<redraw>
@tool-brush ( -- ) @tool-brush ( -- )
#00 !<set-tool> #00 !<set-tool>

Loading…
Cancel
Save