Browse Source

Trapped vectors instead of flags

main
neauoire 5 years ago
parent
commit
c9e0c80164
  1. 2
      build.sh
  2. 50
      src/main.tal

2
build.sh

@ -5,7 +5,7 @@ rm -rf bin
mkdir bin
echo "Assembling.."
uxnasm src/nasu.tal bin/nasu.rom
uxnasm src/main.tal bin/nasu.rom
echo "Installing.."
if [ -d "$HOME/roms" ] && [ -e ./bin/nasu.rom ]

50
src/nasu.tal → src/main.tal

@ -78,7 +78,6 @@
@state
&timer $1
&trap $1
&blink $1
&changed $1
@settings
@ -101,7 +100,7 @@
@color $1
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
( interface )
( interface )
@toolview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@colorview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@blendview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@ -138,7 +137,7 @@
.Screen/width DEI2 #01 SFT2 .frame/width LDZ2 #01 SFT2 --
.Screen/height DEI2 #01 SFT2 .frame/height LDZ2 #01 SFT2 --
.frame/width LDZ2 .frame/height LDZ2
SIZE-TO-RECT ;frame SET-RECT
SIZE-TO-RECT ;frame SET-RECT
.frame/x1 LDZ2 .frame/y1 LDZ2 #0030 ++ HOR TOS #0008 ** VER TOS #0008 ** SIZE-TO-RECT ;tileview SET-RECT
.tileview/x1 LDZ2 .tileview/y2 LDZ2 #0008 ++ HOR TOS #0008 ** #0008 SIZE-TO-RECT ;toolview SET-RECT
@ -155,16 +154,18 @@
BRK
@on-frame ( -> )
.state/trap LDZ #00 ! #01 JCN [ BRK ]
( inactive )
BRK
@on-frame-trap ( -> )
( incr ) .state/timer LDZ #01 + DUP .state/timer STZ
#08 ! ,&no-toggle JCN
.state/blink TOGGLE
#03 .state/blink LDZ #09 * + ;draw-filepath JSR2
#01 .state/blink LDZ #08 * + ;draw-filepath JSR2
#00 .state/timer STZ
&no-toggle
&no-toggle
BRK
@ -178,7 +179,6 @@ BRK
.Controller/key DEI .Controller/button DEI #0000 !! #01 JCN [ BRK ]
.Controller/key DEI #00 ! .state/trap LDZ #0101 == ;on-button-trap JCN2
.Controller/button DEI #01 AND ;on-control JCN2
.Controller/key DEI
@ -234,10 +234,21 @@ BRK
DUP ( ctrl+o ) #6f ! ,&no-open JCN
;load-file JSR2
;redraw JSR2 POP BRK &no-open
DUP ( ctrl+r ) #72 ! ,&no-name JCN
.state/trap TOGGLE
#00 .state/blink STZ
#03 ;draw-filepath JSR2 POP BRK &no-name
DUP [ LIT 'r ] ! ,&no-name JCN
#00 ;draw-filepath JSR2
;on-frame-trap .Screen/vector DEO2
;on-button-trap .Controller/vector DEO2
POP BRK
&no-name
DUP [ LIT 'R ] ! ,&no-rename JCN
#00 ;draw-filepath JSR2
#00 .Controller/key DEO
#00 .path/length STZ
#0000 .path/name STZ2
;on-frame-trap .Screen/vector DEO2
;on-button-trap .Controller/vector DEO2
POP BRK
&no-rename
DUP ( ctrl+s ) #73 ! ,&no-save JCN
;save-file JSR2
;draw-state JSR2 POP BRK &no-save
@ -250,7 +261,7 @@ BRK
BRK
@on-button-trap ( -> )
.Controller/key DEI
DUP ,&continue JCN
POP BRK
@ -263,14 +274,16 @@ BRK
#01 ;draw-filepath JSR2 POP BRK
&no-edit-backspace
DUP ( special ) #20 > ,&no-edit-enter JCN
#00 .state/trap STZ
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
#00 .state/blink STZ
#01 ;draw-filepath JSR2 POP BRK
&no-edit-enter
( clamp ) .path/length LDZ #1f = ,&edit-end JCN
DUP .path/name .path/length LDZ STHk + STZ
STHr #01 + STHk .path/length STZ
#00 .path/name STHr + STZ
#03 ;draw-filepath JSR2
#01 ;draw-filepath JSR2
&edit-end
POP
@ -376,9 +389,10 @@ BRK
;draw-toolview JSR2
&no-zoom
DUP #07 > OVR HOR SWP - #05 > #0101 !! ,&no-rename JCN
.state/trap TOGGLE
#00 .state/blink STZ
#03 ;draw-filepath JSR2
#00 ;draw-filepath JSR2
;on-frame-trap .Screen/vector DEO2
;on-button-trap .Controller/vector DEO2
BRK
&no-rename
DUP #01 + .settings/color LDZ ! ,&no-eraser JCN
#00 .settings/color STZ
Loading…
Cancel
Save