You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

1486 lines
32 KiB

( Nasu : pixel editor )
|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
|10 @Console &vector $2 &read $1 &pad $5 &write $1
|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button $1 &key $1
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &chord $1
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
|0000
@state &timer $1 &changed $1
@settings &depth $1 &color $1 &blend $1 &ratio $1 &tool $1 &focus $2 &zoom $1 &brush $1
@cursor &x $2 &y $2 &last $1
@selection &x1 $1 &y1 $1 &x2 $1 &y2 $1 &zx $1 &zy $1 &a $1
@frame &x1 $2 &y1 $2 &x2 $2 &y2 $2 &width $2 &height $2
@filepath $40 ( ext ) $4
@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
@dataview &x1 $2 &y1 $2 &x2 $2 &y2 $2
@preview &x1 $2 &y1 $2 &x2 $2 &y2 $2
@zoomview &x1 $2 &y1 $2 &x2 $2 &y2 $2
@tileview &x1 $2 &y1 $2 &x2 $2 &y2 $2
@nametableview &x $2 &y $2 &x2 $2 &y2 $2
|0100 ( -> )
( theme )
#097f .System/r DEO2
#07df .System/g DEO2
#0dcf .System/b DEO2
( size )
#012e .Screen/width DEO2
#00f0 .Screen/height DEO2
( vectors )
;on-console .Console/vector DEO2
( set defaults )
#0108 .frame/width STZ2
#00c8 .frame/height STZ2
#01 .settings/depth STZ
#01 .settings/color STZ
#81 .settings/blend STZ
#32 .settings/ratio STZ
#01 .settings/tool STZ
#00 .settings/brush STZ
;set-focus JSR2
( place )
.Screen/width DEI2 #01 SFT2 .frame/width LDZ2 #01 SFT2 SUB2 #001b .frame/width LDZ2 .frame/height LDZ2 ;frame ;set-size JSR2
.frame/x1 LDZ2 #0001 SUB2 .frame/y1 LDZ2 #0038 ADD2 #007f DUP2 ;tileview ;set-size JSR2
.frame/x1 LDZ2 #0089 ADD2 .frame/y1 LDZ2 #0038 ADD2 #007f DUP2 ;nametableview ;set-size JSR2
.frame/x1 LDZ2 #0001 SUB2 .frame/y1 LDZ2 #001f #002f ;zoomview ;set-size JSR2
.frame/x1 LDZ2 #002f ADD2 .frame/y1 LDZ2 #001f #002f ;preview ;set-size JSR2
.frame/x1 LDZ2 #005f ADD2 .frame/y1 LDZ2 #0020 #002f ;colorview ;set-size JSR2
.frame/x1 LDZ2 #008f ADD2 .frame/y1 LDZ2 #001f #002f ;blendview ;set-size JSR2
.frame/x1 LDZ2 #00bf ADD2 .frame/y1 LDZ2 #0048 #002f ;dataview ;set-size JSR2
.tileview/x1 LDZ2 .tileview/y2 LDZ2 #0008 ADD2 .frame/width LDZ2 #0008 ;toolview ;set-size JSR2
( static drawings )
;load-theme JSR2
;draw-once JSR2
( begin )
;file-new JSR2
;draw-menu JSR2
;untrap JSR2
BRK
@manifest
09 "Nasu $1
00 00 :about/toggle "About $1
01 "n :file-new "New $1
01 "r :trap "Rename $1
01 "o :file-open "Open $1
00 00 :file-open-mono "OpenMono $1
01 "s :file-save "Save $1
00 00 :file-save-mono "SaveMono $1
01 "p :save-theme "SaveTheme $1
01 "q :exit "Exit $1
05 "Edit $1
01 "c :edit-copy "Copy $1
01 "f :edit-copy-font "CopyFont $1
01 "v :edit-paste "Paste $1
01 "x :edit-cut "Cut $1
00 08 :edit-erase "Erase $1
01 "View $1
02 00 :toggle-zoom "Zoom $1
09 "Move $1
10 00 :move-up "Up $1
20 00 :move-down "Down $1
40 00 :move-left "Left $1
80 00 :move-right "Right $1
14 00 :move-dech "Decr.H $1
24 00 :move-inch "Incr.H $1
44 00 :move-decw "Decr.W $1
84 00 :move-incw "Incr.W $1
00 1b :move-reset "Reset $1
07 "Tool $1
00 "q :tool-brush "Brush $1
00 "w :tool-selector "Selector $1
00 "e :tool-zoom "Zoom $1
00 "1 :pick-color1 "Background $1
00 "2 :pick-color2 "ColorA $1
00 "3 :pick-color3 "ColorB $1
00 "4 :pick-color4 "ColorC $1
$1
(
@|vectors )
@untrap ( -- )
;on-frame .Screen/vector DEO2
;on-button .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
#01 ;draw-filepath JSR2
( release mouse ) #00 .Mouse/state DEO
JMP2r
@trap ( -- )
;on-frame-trap .Screen/vector DEO2
;on-button-trap .Controller/vector DEO2
;on-mouse-trap .Mouse/vector DEO2
( clear cursor )
#40 ;draw-cursor JSR2
( release mouse ) #00 .Mouse/state DEO
JMP2r
@on-console ( -> )
#00 ;draw-filepath JSR2
( start )
[ LIT &listening $1 ] ,&no-start JCN
#01 ,&listening STR
;filepath #0040 ;mclr JSR2
&no-start
( end )
.Console/read DEI
DUPk #1f GTH SWP #7f LTH AND ,&no-end JCN
#00 ,&listening STR
&no-end
( capture )
,capture-trap JSR
#01 ;draw-filepath JSR2
BRK
@on-button-trap ( -> )
#00 ;draw-filepath JSR2
.Controller/key DEI DUP #0d EQU #03 MUL SUB ,capture-trap JSR
#01 ;draw-filepath JSR2
BRK
@capture-trap ( button -- )
DUP ,&no-null JCN POP JMP2r &no-null
[ #08 ] NEQk NIP ,&no-pop JCN ;filepath ;spop JSR2 POP JMP2r &no-pop
[ #0a ] NEQk NIP ,&no-load JCN ;file-open JSR2 &no-load
[ #7f ] NEQk NIP ,&no-delete JCN ;filepath #0040 ;mclr JSR2 POP JMP2r &no-delete
[ #20 ] GTHk NIP ,&no-special JCN ;untrap JSR2 POP JMP2r &no-special
;filepath ;slen JSR2 NIP #3f EQU ,&no-push JCN
DUP ;filepath ;sput JSR2
&no-push
POP
JMP2r
@on-mouse-trap ( -> )
( release trap on touch )
.Mouse/state DEI ,&release JCN BRK &release
;untrap JSR2
BRK
@on-frame ( -> )
( inactive )
BRK
@on-frame-trap ( -> )
.state/timer LDZ
DUP #07 AND ,&no-blink JCN
DUP #03 SFT #01 AND #30 SFT INC ;draw-filepath JSR2
&no-blink
INC .state/timer STZ
BRK
@on-button ( -> )
.Controller/button DEI2 ;find-modkey JSR2
ORAk #00 EQU ,&skip JCN
DUP2 JSR2
&skip
POP2
BRK
@on-mouse ( -> )
.Mouse/y DEI2 #000c LTH2 ;trap-menu JCN2
( color ) #42 .Mouse/state DEI #00 NEQ ADD
( addr* ) ;brush-icn #00 .settings/tool LDZ #30 SFT ADD2
;update-cursor JSR2
#01 .Screen/auto DEO
.Mouse/state DEI #00 EQU ,&no-touch JCN
.Mouse/x DEI2 .Mouse/y DEI2 .tileview ;within-rect JSR2 ;on-touch-tileview JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .nametableview ;within-rect JSR2 ;on-touch-nametable JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .toolview ;within-rect JSR2 ;on-touch-toolview JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .blendview ;within-rect JSR2 ;on-touch-blendview JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .colorview ;within-rect JSR2 ;on-touch-colorview JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .preview ;within-rect JSR2 ;on-touch-preview JCN2
.Mouse/x DEI2 .Mouse/y DEI2 .zoomview ;within-rect JSR2 ;on-touch-zoomview JCN2
&no-touch
( release-record )
#0000 .Mouse/state DEO .cursor/last STZ
BRK
@on-touch-tileview ( -> )
.Mouse/x DEI2 .tileview/x1 LDZ2 SUB2
.Mouse/y DEI2 .tileview/y1 LDZ2 SUB2
( test )
.settings/tool LDZ #02 EQU ;&zoom JCN2
.settings/zoom LDZ #01 EQU ;&zoomed JCN2
.settings/tool LDZ #01 EQU ;&select JCN2
( paint )
.settings/color LDZ .Mouse/state DEI #01 EQU MUL
;put-pixel JSR2
#01 .state/changed STZ ;draw-state JSR2
;redraw JSR2
BRK
&zoom ( x* y* -> )
#33 SFT2 NIP STH
#33 SFT2 NIP STHr
;set-selection-zoom JSR2
;toggle-zoom JSR2
;redraw JSR2
( release mouse ) #00 .Mouse/state DEO
BRK
&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 JSR2
#01 .state/changed STZ ;draw-state JSR2
;redraw JSR2
BRK
&select ( x* y* -> )
#03 SFT2 NIP STH
#03 SFT2 NIP STH SWPr
.Mouse/state DEI DUP .cursor/last LDZ
ORAk #00 EQU ,&end JCN
DUP2 #0100 NEQ2 ,&no-down JCN STH2kr ;set-selection-from JSR2 &no-down
DUP2 #0101 NEQ2 ,&no-up JCN STH2kr ;set-selection-to JSR2 &no-up
&end
POP2 POP2r
.cursor/last STZ
BRK
@on-touch-nametable ( -> )
( id )
.Mouse/y DEI2 .nametableview/y LDZ2 SUB2 #43 SFT2
.Mouse/x DEI2 .nametableview/x LDZ2 SUB2 #03 SFT2 ADD2
#0003 MUL2 ;nametable ADD2 STH2
.settings/focus LDZ2 ;spritesheet SUB2 STH2kr STA2
.settings/blend LDZ INC2r INC2r STH2r STA
;draw-nametable JSR2
#01 .state/changed STZ ;draw-state JSR2
BRK
@on-touch-toolview ( -> )
( release mouse ) #00 .Mouse/state DEO
.Mouse/x DEI2 .toolview/x1 LDZ2 SUB2 #03 SFT2 NIP
[ #20 ] NEQk NIP ,&no-save JCN ;file-save JSR2 POP BRK &no-save
[ #1e ] NEQk NIP ,&no-load JCN ;file-open JSR2 POP BRK &no-load
[ #1d ] NEQk NIP ,&no-name JCN ;file-new JSR2 POP BRK &no-name
[ #04 ] NEQk NIP ,&no-tool0 JCN #00 ;set-tool JSR2 POP BRK &no-tool0
[ #05 ] NEQk NIP ,&no-tool1 JCN #01 ;set-tool JSR2 POP BRK &no-tool1
[ #06 ] NEQk NIP ,&no-tool2 JCN #02 ;set-tool JSR2 &no-tool2
INCk .settings/color LDZ NEQ ,&no-eraser JCN #00 ;set-color JSR2 POP BRK &no-eraser
[ #02 ] GTHk NIP ,&no-color JCN INCk ;set-color JSR2 POP BRK &no-color
[ #08 ] LTHk NIP ,&no-rename JCN ;trap JSR2 POP BRK &no-rename
POP
BRK
@on-touch-zoomview ( -> )
.Mouse/y DEI2 .zoomview/y1 LDZ2 SUB2 #0020 LTH2 ;&no-mod JCN2
.Mouse/x DEI2 .zoomview/x1 LDZ2 SUB2 #03 SFT2 NIP
DUP #00 EQU .Mouse/state DEI #01 EQU #0101 NEQ2 ,&no-su JCN ;op-shiftu ;run JSR2 &no-su
DUP #00 EQU .Mouse/state DEI #01 GTH #0101 NEQ2 ,&no-sd JCN ;op-shiftd ;run JSR2 &no-sd
DUP #01 EQU .Mouse/state DEI #01 EQU #0101 NEQ2 ,&no-sr JCN ;op-shiftr ;run JSR2 &no-sr
DUP #01 EQU .Mouse/state DEI #01 GTH #0101 NEQ2 ,&no-shiftleft JCN ;op-shiftl ;run JSR2 &no-shiftleft
POP
( release mouse ) #00 .Mouse/state DEO
,&finish JMP
&no-mod
.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 JSR2
&finish
#01 .state/changed STZ ;draw-state JSR2
;redraw JSR2
BRK
@on-touch-preview ( -> )
( y ) .Mouse/y DEI2 .preview/y1 LDZ2 SUB2 #03 SFT2 NIP #03 AND
( x ) .Mouse/x DEI2 .preview/x1 LDZ2 SUB2 #03 SFT2 NIP
#40 SFT ADD #11 ADD .settings/ratio STZ
;draw-preview JSR2
( release mouse ) #00 .Mouse/state DEO
BRK
@on-touch-colorview ( -> )
.Mouse/y DEI2 .colorview/y1 LDZ2 SUB2 #03 SFT2 NIP
[ #00 ] NEQk NIP ,&no-r JCN .System/r STHk ,&set-color JSR STHr ,&set-nibble JSR &no-r
[ #01 ] NEQk NIP ,&no-g JCN .System/g STHk ,&set-color JSR STHr ,&set-nibble JSR &no-g
[ #02 ] NEQk NIP ,&no-b JCN .System/b STHk ,&set-color JSR STHr ,&set-nibble JSR &no-b
POP
;redraw JSR2
BRK
&set-nibble ( -- )
.settings/color LDZ #01 SFT ADD DEO
JMP2r
&set-color ( -- )
.settings/color LDZ STHk #01 SFT ADD DEI
STHr #01 AND STHk
#0f SWP [ #60 SFT SFT ] AND
STHr #00 EQU
.Mouse/x DEI2 .colorview/x1 LDZ2 SUB2 #01 SFT2 NIP
( clamp to #0f ) DUP #01 GTH SUB
SWP [ #60 SFT SFT ] ADD
JMP2r
@on-touch-blendview ( -> )
.Mouse/x DEI2 .blendview/x1 LDZ2 SUB2 #03 SFT2 NIP
.Mouse/y DEI2 .blendview/y1 LDZ2 SUB2 #03 SFT2 NIP #20 SFT ADD
[ #0f GTHk NIP ] ,&no-set JCN DUP .settings/blend STHk LDZ #b0 AND ADD STHr STZ ,&end JMP &no-set
( buttons )
#03 AND
[ #02 NEQk NIP ] ,&no-ver JCN .settings/blend STHk LDZ #20 EOR STHr STZ &no-ver
[ #03 NEQk NIP ] ,&no-hor JCN .settings/blend STHk LDZ #10 EOR STHr STZ &no-hor
&end
POP
;draw-blendview JSR2
;draw-preview JSR2
( release mouse ) #00 .Mouse/state DEO
BRK
(
@|helpers )
@toggle-zoom ( -- )
.settings/zoom LDZk #00 EQU SWP STZ
;draw-tileview JSR2
;draw-toolview ( .. )
JMP2
@set-color ( color -- )
.settings/color STZ
;draw-toolview JSR2
;draw-colorview ( .. )
JMP2
@set-tool ( tool -- )
.settings/tool STZ
;draw-toolview ( .. )
JMP2
@set-selection-zoom ( x y -- )
#7f AND .selection/zy STZ
#7f AND .selection/zx STZ
JMP2r
@set-selection-from ( x y -- )
#0f AND
DUP .selection/y1 STZ
.selection/y2 STZ
#0f AND
DUP .selection/x1 STZ
.selection/x2 STZ
;set-focus JSR2
;redraw ( .. )
JMP2
@set-selection-to ( x y -- )
.selection/y2 STZ
.selection/x2 STZ
;clamp-selection JSR2
;redraw ( .. )
JMP2
@set-focus ( -- )
.selection LDZ2 ;get-tile-addr JSR2 .settings/focus STZ2
JMP2r
@mod-selection ( x y -- )
.settings/zoom LDZ ;mod-selection-zoom JCN2
DUP
.selection/y2 LDZ ADD #0f AND .selection/y2 STZ
.selection/y1 LDZ ADD #0f AND .selection/y1 STZ
DUP
.selection/x2 LDZ ADD #0f AND .selection/x2 STZ
.selection/x1 LDZ ADD #0f AND .selection/x1 STZ
( clamp )
.selection/x2 LDZ .selection/x1 LDZ GTH ,&no-x JCN
.selection/x1 LDZ .selection/x2 STZ
&no-x
.selection/y2 LDZ .selection/y1 LDZ GTH ,&no-y JCN
.selection/y1 LDZ .selection/y2 STZ
&no-y
.selection/x1 LDZ #30 SFT .selection/y1 LDZ #30 SFT ;set-selection-zoom JSR2
( focus )
;set-focus JSR2
;redraw ( .. )
JMP2
@mod-selection-zoom ( x y -- )
( set zoom )
.selection/zy LDZ ADD SWP
.selection/zx LDZ ADD SWP
;set-selection-zoom JSR2
( set from )
.selection/zx LDZ #03 SFT
.selection/zy LDZ #03 SFT
;set-selection-from JSR2
;draw-tileview-zoom ( .. )
JMP2
@scale-selection ( x y -- )
.selection/y2 LDZ ADD #0f AND .selection/y2 STZ
.selection/x2 LDZ ADD #0f AND .selection/x2 STZ
( clamp )
.selection/x2 LDZ .selection/x1 LDZ GTH ,&no-x JCN
.selection/x1 LDZ .selection/x2 STZ
&no-x
.selection/y2 LDZ .selection/y1 LDZ GTH ,&no-y JCN
.selection/y1 LDZ .selection/y2 STZ
&no-y
( focus )
;set-focus JSR2
;redraw ( .. )
JMP2
@run ( op* -- )
STH2
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
( write char ) OVR2 NIP OVR SWP ;get-tile-addr JSR2 STH2kr JSR2
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
POP2r
JMP2r
@op-erase ( addr* -- )
#0010 ;mclr ( .. )
JMP2
@op-shiftu ( addr* -- )
DUP2k #0007 ADD2 SWP2 LDAk STH
&ch1
INC2k LDA STH
DUP2 STHr ROT ROT STA
INC2 GTH2k ,&ch1 JCN
POP2
( cap ) STHr ROT ROT STA
#0008 ADD2 DUP2 #0007 ADD2 SWP2 LDAk STH
&ch2
INC2k LDA STH
DUP2 STHr ROT ROT STA
INC2 GTH2k ,&ch2 JCN
POP2
( cap ) STHr ROT ROT STA
JMP2r
@op-shiftd ( addr* -- )
DUP2k #0007 ADD2 LDAk STH
&ch1
DUP2 #0001 SUB2 LDA STH
DUP2 STHr ROT ROT STA
#0001 SUB2 LTH2k ,&ch1 JCN
POP2
( cap ) STHr ROT ROT STA
#0008 ADD2 DUP2 #0007 ADD2 LDAk STH
&ch2
DUP2 #0001 SUB2 LDA STH
DUP2 STHr ROT ROT STA
#0001 SUB2 LTH2k ,&ch2 JCN
POP2
( cap ) STHr ROT ROT STA
JMP2r
@op-shiftl ( addr* -- )
STH2
#0800
&loop
( ch1 )
#00 OVR STH2kr ADD2 DUP2
LDA [ ;rol JSR2 ] ROT ROT STA
( ch2 )
#00 OVR STH2kr #0008 ADD2 ADD2 DUP2
LDA [ ;rol JSR2 ] ROT ROT STA
INC GTHk ,&loop JCN
POP2
POP2r
JMP2r
@op-shiftr ( addr* -- )
STH2
#0800
&loop
( ch1 )
#00 OVR STH2kr ADD2 DUP2
LDA [ ;ror JSR2 ] ROT ROT STA
( ch2 )
#00 OVR STH2kr #0008 ADD2 ADD2 DUP2
LDA [ ;ror JSR2 ] ROT ROT STA
INC GTHk ,&loop JCN
POP2
POP2r
JMP2r
@clamp-selection ( -- )
.selection/x1 LDZ #0f STHk LTH ,&ok-limitx1 JCN STHkr .selection/x1 STZ &ok-limitx1 POPr
.selection/y1 LDZ #0f STHk LTH ,&ok-limity1 JCN STHkr .selection/y1 STZ &ok-limity1 POPr
.selection/x2 LDZ #0f STHk LTH ,&ok-limitx2 JCN STHkr .selection/x2 STZ &ok-limitx2 POPr
.selection/y2 LDZ #0f STHk LTH ,&ok-limity2 JCN STHkr .selection/y2 STZ &ok-limity2 POPr
( invert )
.selection/x2 LDZ .selection/x1 LDZ STHk GTH ,&ok-flipx JCN STHkr .selection/x2 STZ &ok-flipx POPr
.selection/y2 LDZ .selection/y1 LDZ STHk GTH ,&ok-flipy JCN STHkr .selection/y2 STZ &ok-flipy POPr
JMP2r
(
@|drawing )
@redraw-all ( -- )
;draw-once JSR2
@redraw ( -- )
;draw-toolview JSR2
;draw-blendview JSR2
;draw-colorview JSR2
;draw-dataview JSR2
;draw-preview JSR2
;draw-tileview JSR2
;draw-nametable JSR2
;draw-zoomview ( .. )
JMP2
@draw-tileview ( -- )
.settings/zoom LDZ ;draw-tileview-zoom JCN2
.tileview/x1 LDZ2 .Screen/x DEO2
.tileview/y1 LDZ2 .Screen/y DEO2
( draw tiles )
;spritesheet .Screen/addr DEO2
#f6 .Screen/auto DEO
#1000
&loop
#81 .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
( draw selection )
#06 .selection/x2 LDZ .selection/x1 LDZ SUB #40 SFT ADD .Screen/auto DEO
.tileview/x1 LDZ2 #00 .selection/x1 LDZ #30 SFT2 ADD2 .Screen/x DEO2
.tileview/y1 LDZ2 #00 .selection/y1 LDZ #30 SFT2 ADD2 .Screen/y DEO2
.selection LDZ2 ;get-tile-addr JSR2 ,&sprite STR2
.selection/y2 LDZ .selection/y1 LDZ SUB INC #00
&loop-sel
#00 OVR #80 SFT2 [ LIT2 &sprite $2 ] ADD2 .Screen/addr DEO2
#84 .Screen/sprite DEO
INC GTHk ,&loop-sel JCN
POP2
#01 .Screen/auto DEO
JMP2r
@draw-tileview-zoom ( -- )
;pixel-icn .Screen/addr DEO2
#1000
&ver
#00 OVR #30 SFT .tileview/y1 LDZ2 ADD2 .Screen/y DEO2
.tileview/x1 LDZ2 .Screen/x DEO2
#1000
&hor
OVR2 NIP OVR SWP
( y ) .selection/zy LDZ ADD #00 SWP
( x ) ROT .selection/zx LDZ ADD #00 SWP SWP2
;get-pixel JSR2 .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
( guide hor )
#0007 .selection/zy LDZ SUB #0007 AND2 #30 SFT2 #0001 SUB2 #0008 ADD2 STH2
.tileview/x1 LDZ2 .tileview/y1 LDZ2 STH2kr ADD2 #0a ;line-hor-dashed JSR2
.selection/zy LDZ #07 AND #00 EQU ,&skip-hor JCN
.tileview/x1 LDZ2 .tileview/y1 LDZ2 STH2kr ADD2 #0040 ADD2 #0a ;line-hor-dashed JSR2
&skip-hor
POP2r
( guide ver )
#0007 .selection/zx LDZ SUB #0007 AND2 #30 SFT2 #0001 SUB2 #0008 ADD2 STH2
.tileview/x1 LDZ2 STH2kr ADD2 .tileview/y1 LDZ2 #0a ;line-ver-dashed JSR2
.selection/zx LDZ #07 AND #00 EQU ,&skip-ver JCN
.tileview/x1 LDZ2 STH2kr ADD2 #0040 ADD2 .tileview/y1 LDZ2 #0a ;line-ver-dashed JSR2
&skip-ver
POP2r
JMP2r
@draw-nametable ( -- )
.nametableview/y LDZ2 .Screen/y DEO2
#1000
&ver
STHk
.nametableview/x LDZ2 .Screen/x DEO2
#1000
&hor
( id ) #00 OVR STHkr #40 SFT ADD
( addr* ) #0003 MUL2 ;nametable ADD2
LDA2k ;spritesheet ADD2 .Screen/addr DEO2
( color ) INC2 INC2 LDA .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
POPr
.Screen/y DEI2k #0008 ADD2 ROT DEO2
INC GTHk ,&ver JCN
POP2
JMP2r
( tools )
@get-tile-addr ( x y -- addr* )
#40 SFT ADD #00 SWP #40 SFT2 ;spritesheet ADD2
JMP2r
@get-pixel ( x* y* -- color )
( channel 1 )
OVR2 SWP2 ,get-pixel-addr JSR [ STH2k ] LDA
ROT ROT NIP #07 AND [ STHk ]
#07 SWP SUB SFT #01 AND
( channel 2 )
[ STHr ] [ STH2r ] #0008 ADD2 LDA SWP
#07 SWP SUB SFT #01 AND
DUP ADD
ADD
JMP2r
@get-pixel-addr ( x* y* -- addr* )
( clamp )
#007f AND2 SWP2 #007f AND2 SWP2
( get row )
DUP2 #0007 AND2
( get tile )
SWP2 #83 SFT2 ADD2
SWP2 #43 SFT2 ADD2
;spritesheet ADD2
JMP2r
@put-pixel ( x* y* color -- )
STH
OVR2 SWP2 ,get-pixel-addr JSR
( ch1 ) OVR2 OVR2 STHkr #00 ,toggle-pixel JSR
( ch2 ) #0008 ADD2 STHr #01 ,toggle-pixel JSR
JMP2r
@toggle-pixel ( x* addr* color -- )
STH2
LDAk
STH SWP2 NIP
STHr SWP
STH2r SFT #01 AND ,&do-set JCN
( mask ) #0107 ROT #07 AND SUB #40 SFT SFT #ff EOR AND
( save ) ROT ROT STA
JMP2r
&do-set
( mask ) #0107 ROT #07 AND SUB #40 SFT SFT ORA
( save ) ROT ROT STA
JMP2r
@has-nametable ( -- bool )
;nametable STH2k #0300 ADD2 STH2r
&loop
LDAk #00 EQU ,&continue JCN
POP2 POP2 #01 JMP2r
&continue
INC2 GTH2k ,&loop JCN
POP2 POP2
#00
JMP2r
( panes )
@draw-zoomview ( -- )
;bigpixel-icn .Screen/addr DEO2
#0800
&ver
#00 OVRk
#00 .selection/y1 LDZ #30 SFT ADD2 ,&y STR2
#20 SFT .zoomview/y1 LDZ2 ADD2 .Screen/y DEO2
#0800
&hor
#00 OVRk
#00 .selection/x1 LDZ #30 SFT ADD2 ,&x STR2
#20 SFT .zoomview/x1 LDZ2 ADD2 .Screen/x DEO2
[ LIT2 &x $2 ] [ LIT2 &y $2 ] ;get-pixel JSR2 .Screen/sprite DEO
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
.zoomview/x1 LDZ2 #0008 SUB2 .zoomview/y1 LDZ2 #0008 SUB2 #0404 ;frame-icns ;draw-frame-icn JSR2
( label )
.zoomview/y2 LDZ2 #0008 SUB2 .Screen/y DEO2
.zoomview/x1 LDZ2 .Screen/x DEO2
;arrow-ver-icns .Screen/addr DEO2
#03 .Screen/sprite DEO
;arrow-hor-icns .Screen/addr DEO2
#03 .Screen/sprite DEO
JMP2r
@draw-preview ( -- )
( stash address )
.settings/focus LDZ2 STH2k .Screen/addr DEO2
#0400
&ver
#00 OVR #30 SFT .preview/y1 LDZ2 ADD2 .Screen/y DEO2
#0400
&hor
#00 OVR #30 SFT .preview/x1 LDZ2 ADD2 .Screen/x DEO2
( get x,y )
OVR2 NIP OVR SWP
( check if within ratio )
.settings/ratio LDZ #0f AND LTH STH
.settings/ratio LDZ #04 SFT LTH STHr
#0101 NEQ2 ,&outside JCN
( get tile ) STH2kr .Screen/addr DEO2
( get blending ) .settings/blend LDZ .Screen/sprite DEO
( incr ) STH2r #0008 [ .settings/depth LDZ #30 SFT #00 SWP ADD2 ] ADD2 STH2
,&resume JMP
&outside
;halftone-icn .Screen/addr DEO2
#03 .Screen/sprite DEO
&resume
INC GTHk ,&hor JCN
POP2
INC GTHk ;&ver JCN2
POP2
POP2r
( label )
.preview/x1 LDZ2 .Screen/x DEO2
.preview/y2 LDZ2 #0008 SUB2 .Screen/y DEO2
#03 ;draw-chr/color STA
.settings/ratio LDZ ;draw-byte ( .. )
JMP2
@draw-colorview ( -- )
.colorview/y2 LDZ2 #0008 SUB2 .Screen/y DEO2
.colorview/x1 LDZ2 .Screen/x DEO2
#03 ;draw-chr/color STA
.System/r ,&get-color JSR ;draw-hex JSR2
.System/g ,&get-color JSR ;draw-hex JSR2
.System/b ,&get-color JSR ;draw-hex JSR2
.colorview/x1 LDZ2 .colorview/y1 LDZ2
#00 .Screen/auto DEO
OVR2 OVR2 [ .System/r ,&get-color JSR ] ,&slider JSR
OVR2 OVR2 #0008 ADD2 [ .System/g ,&get-color JSR ] ,&slider JSR
#0010 ADD2 [ .System/b ,&get-color JSR ] ,&slider JSR
#01 .Screen/auto DEO
JMP2r
&slider ( x* y* value -- )
STH
.Screen/y DEO2
.Screen/x DEO2
#1000
&loop
DUP STHkr GTH #30 SFT #00 SWP ;slider-icns ADD2 .Screen/addr DEO2
#02 .Screen/sprite DEO
.Screen/x DEI2k INC2 INC2 ROT DEO2
INC GTHk ,&loop JCN
POP2
POPr
JMP2r
&get-color
.settings/color LDZ STHk #01 SFT ADD DEI #01 STHr #01 AND SUB #20 SFT SFT #0f AND
JMP2r
@draw-blendview ( -- )
#00 .Screen/auto DEO
.settings/focus LDZ2 .Screen/addr DEO2
#1000
&loop
#00 OVR #03 AND #30 SFT2 .blendview/x1 LDZ2 ADD2 .Screen/x DEO2
#00 OVR #32 SFT2 .blendview/y1 LDZ2 ADD2 .Screen/y DEO2
#00 .Screen/sprite DEO
DUP .settings/blend LDZ #b0 AND ADD .Screen/sprite DEO
INC GTHk ,&loop JCN
POP2
#01 .Screen/auto DEO
( label )
.blendview/x1 LDZ2 .Screen/x DEO2
.blendview/y2 LDZ2 #0008 SUB2 .Screen/y DEO2
#03 ;draw-chr/color STA
( get blending ) .settings/blend LDZ ;draw-byte JSR2
( y )
.blendview/x1 LDZ2 #0010 ADD2 .Screen/x DEO2
.settings/blend LDZ #20 AND #00 NEQ STH
;arrow-ver-icns #00 STHkr #30 SFT2 ADD2 .Screen/addr DEO2
#02 STHr SUB .Screen/sprite DEO
( x )
.blendview/x1 LDZ2 #0018 ADD2 .Screen/x DEO2
.settings/blend LDZ #10 AND #00 NEQ STH
;arrow-hor-icns #00 STHkr #30 SFT2 ADD2 .Screen/addr DEO2
#02 STHr SUB .Screen/sprite DEO
JMP2r
@draw-dataview ( -- )
( position )
.dataview/x1 LDZ2 .Screen/x DEO2
.dataview/y2 LDZ2 #0008 SUB2 .Screen/y DEO2
#03 ;draw-chr/color STA
.selection LDZ2 #40 SFT ADD ;draw-byte JSR2
.dataview/y1 LDZ2 .Screen/y DEO2
#0400
&loop
.dataview/x1 LDZ2 .Screen/x DEO2
#00 OVR DUP ADD .settings/focus LDZ2 ADD2
#01 ;draw-chr/color STA
( ch1 ) LDA2k ;draw-short JSR2
.Screen/x DEI2k #000c ADD2 ROT DEO2
#02 ;draw-chr/color STA
( ch2 ) #0008 ADD2 LDA2 ;draw-short JSR2
( skip line )
.Screen/y DEI2k #0008 ADD2 ROT DEO2
INC GTHk ,&loop JCN
POP2
JMP2r
@draw-toolview ( -- )
.toolview/y1 LDZ2 .Screen/y DEO2
( colors )
.toolview/x1 LDZ2 .Screen/x DEO2
;circle-icns #00 .settings/color LDZ #01 EQU #30 SFT2 ADD2 .Screen/addr DEO2
#01 .Screen/sprite DEO
;circle-icns #00 .settings/color LDZ #02 EQU #30 SFT2 ADD2 .Screen/addr DEO2
#02 .Screen/sprite DEO
;circle-icns #00 .settings/color LDZ #03 EQU #30 SFT2 ADD2 .Screen/addr DEO2
#03 .Screen/sprite DEO
( tools )
.Screen/x DEI2k #0008 ADD2 ROT DEO2
;brush-icn .Screen/addr DEO2
#01 [ .settings/tool LDZ #00 EQU ] ADD .Screen/sprite DEO
;select-icn .Screen/addr DEO2
#01 [ .settings/tool LDZ #01 EQU ] ADD .Screen/sprite DEO
;zoom-icns [ #00 .settings/zoom LDZ #30 SFT2 ADD2 ] .Screen/addr DEO2
#01 [ .settings/tool LDZ #02 EQU ] ADD .Screen/sprite DEO
( file i/o )
;draw-state JSR2
.toolview/x2 LDZ2 STH2k #0018 SUB2 .Screen/x DEO2
;load-icn .Screen/addr DEO2
#01 .Screen/sprite DEO
STH2r #0020 SUB2 .Screen/x DEO2
;make-icn .Screen/addr DEO2
#01 .Screen/sprite DEO
( filepath )
#01 ;draw-filepath ( .. )
JMP2
@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 -- )
.toolview/x1 LDZ2 #0040 ADD2 .Screen/x DEO2
.toolview/y1 LDZ2 INC2 .Screen/y DEO2
;draw-chr/color STA
;filepath
( scroll )
DUP2 ;slen JSR2 #0013 GTH2 #00 SWP
;filepath ;slen JSR2 #0013 SUB2 MUL2 ADD2
;draw-str JSR2 POP2
JMP2r
@draw-fill-fast ( width color auto addr* -- )
.Screen/addr DEO2
&blank
.Screen/auto DEO
STH
#00
&l2
STHkr .Screen/sprite DEO
INC GTHk ,&l2 JCN
POP2
POPr
JMP2r
@draw-lb ( -- )
.Screen/y DEI2k #0008 ADD2 ROT DEO2
JMP2r
@draw-once ( -- )
.tileview/x1 LDZ2 #0008 SUB2 .tileview/y1 LDZ2 #0008 SUB2 #1010 ;frame-icns ;draw-frame-icn JSR2
.nametableview/x LDZ2 #0008 SUB2 .nametableview/y LDZ2 #0008 SUB2 #1010 ;frame-icns ;draw-frame-icn JSR2
#01 .Screen/auto DEO
JMP2r
( drawing primitives )
@get-strw ( str* -- width* )
;slen JSR2 #30 SFT2
JMP2r
@draw-str-right ( text* -- )
DUP2 ,get-strw JSR STH2
.Screen/x DEI2k STH2r SUB2 ROT DEO2
@draw-str ( str* -- str* )
LDAk #00 EQU ,&skip JCN
#01 .Screen/auto DEO
&while
LDAk ;draw-chr JSR2
INC2 LDAk ,&while JCN
&skip
INC2
JMP2r
@draw-short ( short* -- )
SWP ,draw-byte JSR
@draw-byte ( byte -- )
DUP #04 SFT ,draw-hex JSR
@draw-hex ( char -- )
#0f AND DUP #09 GTH #27 MUL ADD #30 ADD
@draw-chr ( char -- )
#20 SUB #00 SWP #30 SFT2 ;font ADD2 .Screen/addr DEO2
[ LIT &color 03 ] .Screen/sprite DEO
JMP2r
(
@|options )
@file-new ( -- )
#00 ;draw-filepath JSR2
( clear )
;spritesheet #1300 ;mclr JSR2
( rename to untitled.txt )
;filepath #0040 ;mclr JSR2
;untitled-txt ;filepath ;scpy JSR2
#00 .state/changed STZ ;draw-state JSR2
;redraw ( .. )
JMP2
@file-open ( -- )
( clear )
;spritesheet #1300 ;mclr JSR2
( spritesheet )
;filepath .File/name DEO2
#1000 .File/length DEO2
;spritesheet .File/read DEO2
( nametable )
;nametable-ext ;filepath ;scap JSR2 #0004 ;mcpy JSR2
;filepath .File/name DEO2
#0300 .File/length DEO2
;nametable .File/read DEO2
;filepath ;scap JSR2 #0004 SUB2 #0004 ;mclr JSR2
#00 .state/changed STZ ;draw-state JSR2
;redraw ( .. )
JMP2
@file-open-mono ( -- )
( clear )
;spritesheet #1300 ;mclr JSR2
( spritesheet )
;filepath .File/name DEO2
#0008 .File/length DEO2
#0000
&loop
#00 OVR #40 SFT2 ;spritesheet ADD2 .File/read DEO2
INC NEQk ,&loop JCN
POP2
#00 .state/changed STZ ;draw-state JSR2
;redraw ( .. )
JMP2
@file-save ( -- )
( spritesheet )
;filepath .File/name DEO2
#1000 .File/length DEO2
;spritesheet .File/write DEO2
( nametable )
;has-nametable JSR2 #00 EQU ,&no-nametable JCN
;nametable-ext ;filepath ;scap JSR2 #0004 ;mcpy JSR2
;filepath .File/name DEO2
#0300 .File/length DEO2
;nametable .File/write DEO2
;filepath ;scap JSR2 #0004 SUB2 #0004 ;mclr JSR2
&no-nametable
#00 .state/changed STZ ;draw-state ( .. )
JMP2
@file-save-mono ( -- )
( spritesheet )
;filepath .File/name DEO2
#0008 .File/length DEO2
#0000
&loop
#00 OVR #40 SFT2 ;spritesheet ADD2 .File/write DEO2
INC NEQk ,&loop JCN
POP2
#00 .state/changed STZ ;draw-state ( .. )
JMP2
@save-theme ( -- )
.System/r DEI2 #fffa STA2
.System/g DEI2 #fffc STA2
.System/b DEI2 #fffe STA2
;load-theme/path .File/name DEO2
#0006 .File/length DEO2
#fffa .File/write DEO2
JMP2r
( edit )
@snarf-txt ".snarf $1
@edit-copy ( -- )
;snarf-txt .File/name DEO2
#0010 .File/length DEO2
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
OVR2 NIP OVR SWP ;get-tile-addr JSR2 ;&buf #0010 ;mcpy JSR2
;&buf .File/write DEO2
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
;redraw ( .. )
JMP2
&buf $10
@edit-copy-font ( -- )
;snarf-txt .File/name DEO2
#0008 .File/length DEO2
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
OVR2 NIP OVR ;get-tile-addr JSR2 ;&buf #0008 ;mcpy JSR2
;&buf .File/write DEO2
INC GTHk ,&ver JCN
POP2
INC GTHk ,&hor JCN
POP2
;redraw ( .. )
JMP2
&buf $8
@edit-paste ( -- )
;snarf-txt .File/name DEO2
#0010 .File/length DEO2
.selection/y2 LDZ INC .selection/y1 LDZ
&ver
.selection/x2 LDZ INC .selection/x1 LDZ
&hor
OVR2 NIP OVR SWP ;get-tile-addr JSR2 .File/read DEO2
INC GTHk ,&hor JCN
POP2
INC GTHk ,&ver JCN
POP2
;redraw ( .. )
JMP2
@edit-cut ( -- )
;edit-copy JSR2
;op-erase ;run JSR2
;redraw ( .. )
JMP2
( select )
@tool-brush ( -- ) #00 ;set-tool JMP2
@tool-selector ( -- ) #01 ;set-tool JMP2
@tool-zoom ( -- ) #02 ;set-tool JMP2
@move-up ( -- ) #00ff ;mod-selection JMP2
@move-down ( -- ) #0001 ;mod-selection JMP2
@move-left ( -- ) #ff00 ;mod-selection JMP2
@move-right ( -- ) #0100 ;mod-selection JMP2
@move-dech ( -- ) #00ff ;scale-selection JMP2
@move-inch ( -- ) #0001 ;scale-selection JMP2
@move-decw ( -- ) #ff00 ;scale-selection JMP2
@move-incw ( -- ) #0100 ;scale-selection JMP2
@move-reset ( -- )
.selection/x1 LDZ2 .selection/x2 STZ2
;redraw ( .. )
JMP2
( pick )
@pick-color1 ( -- ) #00 ;set-color JMP2
@pick-color2 ( -- ) #01 ;set-color JMP2
@pick-color3 ( -- ) #02 ;set-color JMP2
@pick-color4 ( -- ) #03 ;set-color JMP2
( option )
@edit-erase ( -- )
;op-erase ;run JSR2
#01 .state/changed STZ ;draw-state JSR2
;redraw ( .. )
JMP2
( generics )
@set-size ( x1 y1 w* h* rect* -- )
STH2
( size to rect )
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
STH2r
DUP2 ROT2 SWP2 #0006 ADD2 STA2
DUP2 ROT2 SWP2 #0004 ADD2 STA2
DUP2 ROT2 SWP2 INC2 INC2 STA2
DUP2 ROT2 SWP2 STA2
POP2
JMP2r
@within-rect ( x* y* rect -- flag )
STH
( y LTH rect.y1 ) DUP2 STHkr INC2 INC2 LDZ2 LTH2 ,&skip JCN
( y GTH rect.y2 ) DUP2 STHkr #06 ADD LDZ2 GTH2 ,&skip JCN
SWP2
( x LTH rect.x1 ) DUP2 STHkr LDZ2 LTH2 ,&skip JCN
( x GTH rect.x2 ) DUP2 STHkr #04 ADD LDZ2 GTH2 ,&skip JCN
POP2 POP2 POPr
#01
JMP2r
&skip
POP2 POP2 POPr
#00
JMP2r
@draw-frame-icn ( x* y* w h sprite* -- )
.Screen/addr DEO2
,&h STR ,&w STR
DUP2 .Screen/y DEO2 ,&y STR2
DUP2 .Screen/x DEO2 ,&x STR2
#01 .Screen/auto DEO
#05 .Screen/sprite DEO
,&next JSR [ LIT &w $1 ] ,&repeat JSR
#02 .Screen/auto DEO
,&next JSR #05 .Screen/sprite DEO
,&next JSR [ LIT &h $1 ] ,&repeat JSR
( left )
[ LIT2 &y $2 ] #0008 ADD2 .Screen/y DEO2
[ LIT2 &x $2 ] .Screen/x DEO2
,&next JSR ,&h LDR ,&repeat JSR
#01 .Screen/auto DEO
,&next JSR #05 .Screen/sprite DEO
,&next JSR ,&w LDR ,&repeat JSR
,&next JSR #05 .Screen/sprite DEO
( fill )
,&next JSR
,&x LDR2 #0008 ADD2 .Screen/x DEO2
,&y LDR2 #0008 ADD2 .Screen/y DEO2
JMP2r
&next
.Screen/addr DEI2k #0008 ADD2 ROT DEO2
JMP2r
&repeat
#00
&repeat-loop
#05 .Screen/sprite DEO
INC GTHk ,&repeat-loop JCN
POP2
JMP2r
@draw-frame ( w h chr* -- )
STH2 ,&h STR ,&w STR
.Screen/x DEI2 DUP2 #0008 SUB2 .Screen/x DEO2
.Screen/y DEI2 #0008 SUB2 DUP2 .Screen/y DEO2
( ul ) #00 STH2kr #05 ,&single JSR
( uu ) [ LIT &w $1 ] #00 STH2kr #0010 ADD2 #01 ,&repeat JSR
( ur ) #10 STH2kr #06 ,&single JSR
( rr ) [ LIT &h $1 ] #00 STH2kr #0020 ADD2 #02 ,&repeat JSR
#0008 ADD2 .Screen/y DEO2
#0008 SUB2 .Screen/x DEO2
( ll ) ,&h LDR #10 STH2kr #0020 ADD2 #02 ,&repeat JSR
( dl ) #20 STH2kr #01 ,&single JSR
( bb ) ,&w LDR #20 STH2kr #0010 ADD2 #01 ,&repeat JSR
( dr ) #30 STH2r #00 ,&single ( .. )
JMP
&repeat ( times color addr* auto -- )
.Screen/auto DEO
.Screen/addr DEO2
STH
#00 &l STHkr ,&paint JSR INC GTHk ,&l JCN POP2
POPr
JMP2r
&single ( color addr* auto -- )
.Screen/auto DEO
.Screen/addr DEO2
&paint ( mask -- )
[ LIT &color 8a ] SWP ORA .Screen/sprite DEO
JMP2r
@line-hor-dashed ( x* y* color -- )
STH .Screen/y DEO2 .Screen/x DEO2
;&sprite .Screen/addr DEO2
#f2 .Screen/auto DEO
STHr .Screen/sprite DEO
#01 .Screen/auto DEO
JMP2r
&sprite aa00 0000 0000 0000
@line-ver-dashed ( x* y* color -- )
STH .Screen/y DEO2 .Screen/x DEO2
;&sprite .Screen/addr DEO2
#f1 .Screen/auto DEO
STHr .Screen/sprite DEO
#01 .Screen/auto DEO
JMP2r
&sprite 8000 8000 8000 8000
(
@|stdlib )
@rol ( byte -- byte ) DUP #07 SFT SWP DUP ADD ADD JMP2r
@ror ( byte -- byte ) DUP #70 SFT SWP #01 SFT ADD JMP2r
@mcpy ( src* dst* len* -- ) SWP2 STH2 OVR2 ADD2 SWP2 &loop LDAk STH2kr STA INC2r INC2 GTH2k ,&loop JCN POP2 POP2 POP2r JMP2r
@|about )
@about
( name ) "Nasu $1
( license ) "Hundred 20 "Rabbits 20 7f 20 "2022 $1
( version ) "Version 20 "1.00 $2
&on-mouse ( -> )
.Mouse/state DEI ,&on-control JCN
BRK
&on-control ( -> )
,&hide JSR
BRK
&toggle ( -- )
[ LIT &active 00 ] ,&hide JCN
#01 ,&active STR
;draw-about JSR2
;&on-mouse .Mouse/vector DEO2
;&on-control .Controller/vector DEO2
JMP2r
&hide ( -- )
#00 ,&active STR
;clear-about JSR2
;untrap ( .. )
JMP2
@draw-about ( -- )
( frame )
.Screen/width DEI2 #01 SFT2 #0080 SUB2 STH2k .Screen/x DEO2
.Screen/height DEI2 #01 SFT2 #0020 SUB2 STH2k .Screen/y DEO2
#2008 ;frame1-chr ;draw-frame JSR2
( fill )
STH2kr .Screen/y DEO2
OVR2r STH2r .Screen/x DEO2
#20 #0171 ;fill-icn ;draw-fill-fast JSR2
( icon )
STH2kr .Screen/y DEO2
OVR2r STH2r .Screen/x DEO2
#08 #0476 ;appicon ;draw-fill-fast JSR2
( text )
STH2r #000c ADD2 .Screen/y DEO2
LIT2r 0048 ADD2r
#01 .Screen/auto DEO
#04 ;draw-chr/color STA
STH2kr .Screen/x DEO2
;about
&w
;draw-str JSR2
;draw-lb JSR2k JSR2
STH2kr .Screen/x DEO2
LDAk ,&w JCN
POP2
POP2r
JMP2r
@clear-about ( -- )
.Screen/width DEI2 #01 SFT2 #0088 SUB2 .Screen/x DEO2
.Screen/height DEI2 #01 SFT2 #0028 SUB2 .Screen/y DEO2
#22 #0091 ;draw-fill-fast/blank JSR2
;redraw-all JSR2
;draw-menu ( .. )
JMP2
(
@|assets )
@untitled-txt "untitled10x10.chr $1
@nametable-ext ".nmt $1
~src/manifest.tal