diff --git a/build.sh b/build.sh index 04f3de2..563420d 100755 --- a/build.sh +++ b/build.sh @@ -8,6 +8,7 @@ if [ -e "$HOME/roms/uxnlin.rom" ] then echo "Linting.." uxncli $HOME/roms/uxnlin.rom src/nasu.tal + uxncli $HOME/roms/uxnlin.rom src/manifest.tal fi echo "Assembling.." @@ -26,4 +27,4 @@ then fi echo "Running.." -uxnemu bin/nasu.rom ako10x10.chr +uxn11 bin/nasu.rom ako10x10.chr diff --git a/src/manifest.tal b/src/manifest.tal index 3b4ea27..022f843 100644 --- a/src/manifest.tal +++ b/src/manifest.tal @@ -3,30 +3,30 @@ &size &w 0130 &h 00e0 &theme &r 0a6f &g 05cf &b 0caf - &name "Nasu $1 + &name "Nasu $1 &date "2022-06-27 $1 &menu 04 "File $1 - 10 'n :file-new "New $1 - 10 'r :file-rename "Rename $1 - 10 'o :file-open "Open $1 - 10 's :file-save "Save $1 + 01 'n :file-new "New $1 + 01 'r :file-rename "Rename $1 + 01 'o :file-open "Open $1 + 01 's :file-save "Save $1 03 "Edit $1 - 10 'c :edit-copy "Copy $1 - 10 'v :edit-paste "Paste $1 - 10 'x :edit-cut "Cut $1 + 01 'c :edit-copy "Copy $1 + 01 'v :edit-paste "Paste $1 + 01 'x :edit-cut "Cut $1 0b "Select $1 00 'q :select-brush "Brush $1 00 'w :select-selector "Selector $1 00 'e :select-zoom "Zoom $1 - 01 00 :select-up "Up $1 - 02 00 :select-down "Down $1 - 04 00 :select-left "Left $1 - 08 00 :select-right "Right $1 - 41 00 :select-dech "Decr.Height $1 - 42 00 :select-inch "Incr.Height $1 + 10 00 :select-up "Up $1 + 20 00 :select-down "Down $1 + 40 00 :select-left "Left $1 + 80 00 :select-right "Right $1 + 14 00 :select-dech "Decr.Height $1 + 24 00 :select-inch "Incr.Height $1 44 00 :select-decw "Decr.Width $1 - 48 00 :select-incw "Incr.Width $1 + 84 00 :select-incw "Incr.Width $1 04 "Pick $1 00 '1 :pick-color1 "Color1 $1 00 '2 :pick-color2 "Color2 $1 @@ -107,3 +107,29 @@ JMP2r JMP2r +@find-modkey ( mod key -- fn* ) + + ,&mk STR2 + ;manifest/menu + &cat + LDAk STH INC2 ,skip-str JSR + STHr #00 + &subcat + OVR2 LDA2 [ LIT2 &mk $2 ] NEQ2 ,&continue JCN + POP2 INC2 INC2 LDA2 JMP2r + &continue + SWP2 #0004 ADD2 ,skip-str JSR SWP2 + INC GTHk ,&subcat JCN + POP2 + LDAk ,&cat JCN + POP2 + #0000 + +JMP2r + +@skip-str ( str* -- str* ) + + &skip INC2 LDAk ,&skip JCN INC2 + +JMP2r + diff --git a/src/nasu.tal b/src/nasu.tal index 2e60933..15e6b58 100644 --- a/src/nasu.tal +++ b/src/nasu.tal @@ -181,55 +181,8 @@ BRK @on-button ( -> ) - .Controller/button DEI2 [ #0000 NEQ2 JMP BRK ] - .Controller/button DEI #01 AND ;on-button-ctrl JCN2 - .Controller/button DEI #f0 AND ;on-button-arrow JCN2 - - .Controller/key DEI - [ LIT '1 ] NEQk NIP ,&no-1 JCN #00 ;set-color JSR2 &no-1 - [ LIT '2 ] NEQk NIP ,&no-2 JCN #01 ;set-color JSR2 &no-2 - [ LIT '3 ] NEQk NIP ,&no-3 JCN #02 ;set-color JSR2 &no-3 - [ LIT '4 ] NEQk NIP ,&no-4 JCN #03 ;set-color JSR2 &no-4 - [ LIT 'q ] NEQk NIP ,&no-tool0 JCN #00 ;set-tool JSR2 &no-tool0 - [ LIT 'w ] NEQk NIP ,&no-tool1 JCN #01 ;set-tool JSR2 &no-tool1 - [ LIT 'e ] NEQk NIP ,&no-tool2 JCN #02 ;set-tool JSR2 &no-tool2 - [ #08 ] NEQk NIP ,&no-delete JCN ;op-erase ;run JSR2 #01 .state/changed STZ ;draw-state JSR2 ;redraw JSR2 &no-delete - [ #20 ] NEQk NIP ,&no-zoom JCN ;toggle-zoom JSR2 &no-zoom - [ #1b ] NEQk NIP ,&no-escape JCN .selection/x1 LDZ2 .selection/x2 STZ2 ;redraw JSR2 &no-escape - POP - -BRK - -@on-button-arrow ( -> ) - - .Controller/button DEI - ( default ) - [ #10 ] NEQk NIP ,&no-u JCN #00 #ff ;mod-selection JSR2 POP BRK &no-u - [ #20 ] NEQk NIP ,&no-d JCN #00 #01 ;mod-selection JSR2 POP BRK &no-d - [ #40 ] NEQk NIP ,&no-l JCN #ff #00 ;mod-selection JSR2 POP BRK &no-l - [ #80 ] NEQk NIP ,&no-r JCN #01 #00 ;mod-selection JSR2 POP BRK &no-r - ( shift ) - [ #14 ] NEQk NIP ,&no-su JCN #00 #ff ;scale-selection JSR2 POP BRK &no-su - [ #24 ] NEQk NIP ,&no-sd JCN #00 #01 ;scale-selection JSR2 POP BRK &no-sd - [ #44 ] NEQk NIP ,&no-sl JCN #ff #00 ;scale-selection JSR2 POP BRK &no-sl - [ #84 ] NEQk NIP ,&no-sr JCN #01 #00 ;scale-selection JSR2 POP BRK &no-sr - POP - -BRK - -@on-button-ctrl ( -> ) - - .Controller/key DEI - ( copy/paste/cut ) - [ LIT 'c ] NEQk NIP ,&no-copy JCN ;edit-copy JSR2 &no-copy - [ LIT 'v ] NEQk NIP ,&no-paste JCN ;edit-paste JSR2 &no-paste - [ LIT 'x ] NEQk NIP ,&no-cut JCN ;edit-cut JSR2 &no-cut - ( new/rename/open/save ) - [ LIT 'n ] NEQk NIP ,&no-new JCN ;file-new JSR2 &no-new - [ LIT 'r ] NEQk NIP ,&no-name JCN ;trap JSR2 &no-name - [ LIT 'o ] NEQk NIP ,&no-open JCN ;file-open JSR2 &no-open - [ LIT 's ] NEQk NIP ,&no-save JCN ;file-save JSR2 &no-save - POP + .Controller/button DEI2 ;find-modkey JSR2 + DUP2 #0000 EQU2 ,&skip JCN DUP2 JSR2 &skip POP2 BRK @@ -1096,6 +1049,8 @@ JMP2r @file-rename ( -- ) + ;trap JSR2 + JMP2r @file-open ( -- ) @@ -1217,30 +1172,47 @@ JMP2r ( select ) -@select-brush ( -- ) JMP2r -@select-selector ( -- ) JMP2r -@select-zoom ( -- ) JMP2r -@select-up ( -- ) JMP2r -@select-down ( -- ) JMP2r -@select-left ( -- ) JMP2r -@select-right ( -- ) JMP2r -@select-dech ( -- ) JMP2r -@select-inch ( -- ) JMP2r -@select-decw ( -- ) JMP2r -@select-incw ( -- ) JMP2r +@select-brush ( -- ) #00 ;set-tool JSR2 JMP2r +@select-selector ( -- ) #01 ;set-tool JSR2 JMP2r +@select-zoom ( -- ) #02 ;set-tool JSR2 JMP2r +@select-up ( -- ) #00ff ;mod-selection JSR2 JMP2r +@select-down ( -- ) #0001 ;mod-selection JSR2 JMP2r +@select-left ( -- ) #ff00 ;mod-selection JSR2 JMP2r +@select-right ( -- ) #0100 ;mod-selection JSR2 JMP2r +@select-dech ( -- ) #00ff ;scale-selection JSR2 JMP2r +@select-inch ( -- ) #0001 ;scale-selection JSR2 JMP2r +@select-decw ( -- ) #ff00 ;scale-selection JSR2 JMP2r +@select-incw ( -- ) #0100 ;scale-selection JSR2 JMP2r ( pick ) -@pick-color1 ( -- ) JMP2r -@pick-color2 ( -- ) JMP2r -@pick-color3 ( -- ) JMP2r -@pick-color4 ( -- ) JMP2r +@pick-color1 ( -- ) #00 ;set-color JSR2 JMP2r +@pick-color2 ( -- ) #01 ;set-color JSR2 JMP2r +@pick-color3 ( -- ) #02 ;set-color JSR2 JMP2r +@pick-color4 ( -- ) #03 ;set-color JSR2 JMP2r ( option ) -@option-erase ( -- ) JMP2r -@option-zoom ( -- ) JMP2r -@option-deselect ( -- ) JMP2r +@option-erase ( -- ) + + ;op-erase ;run JSR2 + #01 .state/changed STZ ;draw-state JSR2 + ;redraw JSR2 + +JMP2r + +@option-zoom ( -- ) + + ;toggle-zoom JSR2 + +JMP2r + +@option-deselect ( -- ) + + .selection/x1 LDZ2 .selection/x2 STZ2 + ;redraw JSR2 + +JMP2r ( generics ) @@ -1387,6 +1359,14 @@ JMP2r JMP2r +@print ( short* -- ) + + SWP ,&byte JSR + &byte ( byte -- ) DUP #04 SFT ,&char JSR + &char ( char -- ) #0f AND DUP #09 GTH #27 MUL ADD #30 ADD #18 DEO + +JMP2r + @rol ( byte -- byte ) DUP #07 SFT SWP #10 SFT ADD JMP2r @ror ( byte -- byte ) DUP #70 SFT SWP #01 SFT ADD JMP2r