uxn/projects/software/nasu.usm

949 lines
26 KiB
Plaintext
Raw Normal View History

(
2021-03-05 14:08:19 -05:00
app/nasu : spritesheet editor
2021-03-03 14:49:26 -05:00
2021-03-05 14:08:19 -05:00
arrows - move selection
2021-04-16 14:34:08 -04:00
ctrl+arrows - change page
2021-03-20 15:25:26 -04:00
left-click - add pixel
right-click - remove pixel
1 2 3 - select brush
2021-04-15 13:19:59 -04:00
TODO:
2021-04-25 00:18:15 -04:00
Copy in 2 bits mode, copies 2 tiles
Modify up to 4 pages
2021-04-17 01:42:00 -04:00
Save/load/rename
Select paint color for 2-bit mode
2021-03-05 13:38:18 -05:00
)
2021-05-09 23:43:33 -04:00
%+ { ADD } %- { SUB } %* { MUL } %/ { DIV }
%< { LTH } %> { GTH } %= { EQU } %! { NEQ }
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
%RTN { JMP2r }
2021-03-20 00:22:51 -04:00
%STEP8 { #0033 SFT2 }
2021-03-16 14:25:26 -04:00
2021-03-20 00:00:41 -04:00
%SFL { #40 SFT SFT }
%MOD { DUP2 DIV MUL SUB }
2021-05-09 14:22:21 -04:00
2021-05-09 17:10:07 -04:00
%TOB { SWP POP } %TOS { #00 SWP }
2021-05-09 14:22:21 -04:00
%DEBUG { .Console/byte DEO #0a .Console/char DEO }
%DEBUG2 { .Console/short DEO2 #0a .Console/char DEO }
2021-05-01 12:59:57 -04:00
%LTS2 { #8000 ADD2 SWP2 #8000 ADD2 GTH2 }
%GTS2 { #8000 ADD2 SWP2 #8000 ADD2 LTH2 }
2021-04-15 13:19:59 -04:00
%SIZE-TO-RECT {
STH2 STH2 OVR2 STH2r ADD2 OVR2 STH2r ADD2
2021-04-15 13:19:59 -04:00
} ( x y w h -- x1 y1 x2 y2 )
%SET-RECT {
2021-05-03 12:57:39 -04:00
DUP2 ROT2 SWP2 #0006 ADD2 STA2
DUP2 ROT2 SWP2 #0004 ADD2 STA2
DUP2 ROT2 SWP2 #0002 ADD2 STA2
DUP2 ROT2 SWP2 STA2
2021-04-15 13:19:59 -04:00
POP2
} ( x1 y1 x2 y2 addr -- )
%BANK { #2000 }
2021-03-16 00:29:44 -04:00
( devices )
2021-05-09 14:22:21 -04:00
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &vector $2 &pad $6 &char $1 &byte $1 &short $2 &string $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $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 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
2021-03-21 16:58:32 -04:00
( variables )
|0000
2021-03-03 14:49:26 -05:00
2021-05-09 17:10:07 -04:00
@settings [
&blending $1
&depth $1
&brush $1
&page $2
&tile $2
&ratio $1 ]
2021-03-21 16:58:32 -04:00
@frame [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 &width $2 &height $2 ]
2021-05-09 14:22:21 -04:00
( interface )
@bankview [ &x $2 &y $2 &mode $1 &selection $1 ]
@tileview [ &x $2 &y $2 ]
2021-05-09 23:43:33 -04:00
@editview [ &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 ]
2021-05-09 14:22:21 -04:00
@dataview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@preview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@mouse [ &x $2 &y $2 ]
@pt [ &x $1 &y $1 ]
@pos [ &x $2 &y $2 ]
2021-03-28 13:19:06 -04:00
2021-05-09 14:22:21 -04:00
@color $1
@i $1
2021-03-21 16:58:32 -04:00
( program )
2021-05-09 23:43:33 -04:00
|0100 ( -> )
2021-05-09 14:22:21 -04:00
( theme )
#0efc .System/r DEO2
#03cc .System/g DEO2
#03ac .System/b DEO2
( vectors )
;on-button .Controller/vector DEO2
;on-mouse .Mouse/vector DEO2
;on-transfer .File/vector DEO2
2021-04-05 14:39:08 -04:00
2021-05-09 14:22:21 -04:00
( set defaults )
#0130 .frame/width POK2
#00a8 .frame/height POK2
#01 .settings/brush POK
2021-05-09 23:43:33 -04:00
#32 .settings/ratio POK
2021-04-17 16:32:07 -04:00
2021-05-09 14:22:21 -04:00
.Screen/width DEI2 #0001 SFT2 .frame/width PEK2 #0001 SFT2 SUB2
.Screen/height DEI2 #0001 SFT2 .frame/height PEK2 #0001 SFT2 SUB2 #0010 ADD2
.frame/width PEK2 .frame/height PEK2
SIZE-TO-RECT ;frame SET-RECT
2021-04-17 16:32:07 -04:00
.frame/x1 PEK2 #0010 ADD2 .bankview/x POK2
.frame/y1 PEK2 .bankview/y POK2
BANK .settings/page POK2
2021-03-04 12:07:33 -05:00
.frame/x2 PEK2 #0098 SUB2 .tileview/x POK2
.frame/y1 PEK2 .tileview/y POK2
2021-04-25 00:18:15 -04:00
BANK #0448 ADD2 .settings/tile POK2
2021-03-20 15:25:26 -04:00
.frame/x2 PEK2 #0010 SUB2 .frame/y1 PEK2 #0010 #0080 SIZE-TO-RECT ;dataview SET-RECT
2021-05-09 23:43:33 -04:00
.frame/x1 PEK2 #0010 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;blendview SET-RECT
.frame/x1 PEK2 #0060 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;colorview SET-RECT
.frame/x1 PEK2 #0038 ADD2 .frame/y2 PEK2 #0020 SUB2 #0020 #0020 SIZE-TO-RECT ;preview SET-RECT
.frame/x2 PEK2 #0098 SUB2 .frame/y1 PEK2 #0080 #0080 SIZE-TO-RECT ;editview SET-RECT
2021-04-15 13:19:59 -04:00
#01 .settings/blending POK
2021-04-15 13:19:59 -04:00
;filepath1 .File/name DEO2 #0800 .File/length DEO2 BANK .File/load DEO2
;filepath2 .File/name DEO2 #0800 .File/length DEO2 BANK #0800 ADD2 .File/load DEO2
;filepath3 .File/name DEO2 #1000 .File/length DEO2 BANK #1000 ADD2 .File/load DEO2
;filepath4 .File/name DEO2 #1000 .File/length DEO2 BANK #2000 ADD2 .File/load DEO2
;filepath5 .File/name DEO2 #1000 .File/length DEO2 BANK #2800 ADD2 .File/load DEO2
;filepath6 .File/name DEO2 #1000 .File/length DEO2 BANK #3800 ADD2 .File/load DEO2
2021-03-03 14:49:26 -05:00
#40 DUP .bankview/selection POK ;select-tile JSR2
2021-03-03 14:49:26 -05:00
BRK
@on-transfer ( -> )
;redraw JSR2
BRK
@on-button ( -> )
2021-04-06 13:51:13 -04:00
2021-05-11 14:12:07 -04:00
( skip ) .Controller/button DEI #00 NEQ #01 JCN [ BRK ]
2021-05-09 14:22:21 -04:00
2021-05-11 14:12:07 -04:00
.Controller/button DEI #11 NEQ ,&no-pageup JCN .settings/page PEK2
2021-05-09 14:22:21 -04:00
#0800 SUB2 .settings/page POK2
;redraw JSR2
BRK &no-pageup
2021-05-11 14:12:07 -04:00
.Controller/button DEI #21 NEQ ,&no-pagedown JCN .settings/page PEK2
2021-05-09 14:22:21 -04:00
#0800 ADD2 .settings/page POK2
;redraw JSR2
BRK &no-pagedown
.Controller/button DEI #f0 AND
2021-05-11 14:12:07 -04:00
DUP #04 SFT #01 AND #01 NEQ ,&no-up JCN
( move ) .bankview/selection PEK #10 SUB .bankview/selection POK &no-up
2021-05-11 14:12:07 -04:00
DUP #05 SFT #01 AND #01 NEQ ,&no-down JCN
( move ) .bankview/selection PEK #10 ADD .bankview/selection POK &no-down
2021-05-11 14:12:07 -04:00
DUP #06 SFT #01 AND #01 NEQ ,&no-left JCN
( move ) .bankview/selection PEK #01 SUB .bankview/selection POK &no-left
2021-05-11 14:12:07 -04:00
DUP #07 SFT #01 AND #01 NEQ ,&no-right JCN
( move ) .bankview/selection PEK #01 ADD .bankview/selection POK &no-right
2021-04-16 14:34:08 -04:00
POP
2021-05-09 14:22:21 -04:00
.bankview/selection PEK ;select-tile JSR2
2021-03-03 16:49:25 -05:00
2021-04-06 13:51:13 -04:00
BRK
2021-03-04 12:07:33 -05:00
@on-mouse ( -> )
2021-04-06 13:51:13 -04:00
;draw-cursor JSR2
2021-04-16 14:34:08 -04:00
2021-05-11 14:12:07 -04:00
( skip ) .Mouse/state DEI #00 NEQ #01 JCN [ BRK ]
2021-04-17 20:27:24 -04:00
( toolbar )
2021-05-11 14:12:07 -04:00
.Mouse/y DEI2 .bankview/y PEK2 #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 ;&no-toolbar-click JCN2
2021-04-17 20:27:24 -04:00
( brush )
2021-05-11 14:12:07 -04:00
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d LTH2 ,&no-brush-click JCN
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #000f GTH2 ,&no-brush-click JCN
2021-05-09 14:22:21 -04:00
( select ) .mouse/x PEK2 .bankview/x PEK2 SUB2 #0008 DIV2 #000d SUB2 TOB .bankview/mode POK
&no-brush-click
2021-05-11 14:12:07 -04:00
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 #0005 NEQ2 ,&no-toggle-depth JCN
;toggle-depth JSR2
&no-toggle-depth
( release ) #00 .Mouse/state DEO
;redraw JSR2 BRK
&no-toolbar-click
2021-04-17 20:27:24 -04:00
( bankview )
.Mouse/x DEI2 .bankview/x PEK2 GTH2 .Mouse/x DEI2 .bankview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .bankview/y PEK2 GTH2 .Mouse/y DEI2 .bankview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-bankview JCN2
2021-04-17 20:27:24 -04:00
( tileview )
.Mouse/x DEI2 .tileview/x PEK2 GTH2 .Mouse/x DEI2 .tileview/x PEK2 #0080 ADD2 LTH2 #0101 EQU2
.Mouse/y DEI2 .tileview/y PEK2 GTH2 .Mouse/y DEI2 .tileview/y PEK2 #0080 ADD2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-tileview JCN2
2021-04-17 20:27:24 -04:00
2021-05-09 23:43:33 -04:00
( editview )
.Mouse/x DEI2 DUP2 .editview/x1 PEK2 GTH2 ROT ROT .editview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .editview/y1 PEK2 GTH2 ROT ROT .editview/y2 PEK2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-editview JCN2
2021-05-09 23:43:33 -04:00
2021-04-17 20:27:24 -04:00
( dataview )
.Mouse/x DEI2 DUP2 .dataview/x1 PEK2 GTH2 ROT ROT .dataview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .dataview/y1 PEK2 GTH2 ROT ROT .dataview/y2 PEK2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-dataview JCN2
2021-04-17 20:27:24 -04:00
( blendbiew )
.Mouse/x DEI2 DUP2 .blendview/x1 PEK2 GTH2 ROT ROT .blendview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .blendview/y1 PEK2 GTH2 ROT ROT .blendview/y2 PEK2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-blendview JCN2
2021-04-17 20:27:24 -04:00
( colorview )
.Mouse/x DEI2 DUP2 .colorview/x1 PEK2 GTH2 ROT ROT .colorview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .colorview/y1 PEK2 GTH2 ROT ROT .colorview/y2 PEK2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-colorview JCN2
2021-03-03 14:49:26 -05:00
2021-05-09 14:22:21 -04:00
( preview )
.Mouse/x DEI2 DUP2 .preview/x1 PEK2 GTH2 ROT ROT .preview/x2 PEK2 LTH2 #0101 EQU2
.Mouse/y DEI2 DUP2 .preview/y1 PEK2 GTH2 ROT ROT .preview/y2 PEK2 LTH2 #0101 EQU2
2021-05-11 14:12:07 -04:00
#0101 EQU2 ;on-touch-preview JCN2
2021-05-09 14:22:21 -04:00
2021-04-16 14:34:08 -04:00
BRK
@on-touch-bankview ( -> )
2021-05-11 14:12:07 -04:00
.bankview/mode PEK #01 NEQ ,&not-copy-mode JCN
#00 .i POK
&copy-loop
2021-05-03 12:57:39 -04:00
( load ) .settings/tile PEK2 .i PEK ADD LDA
2021-04-16 14:34:08 -04:00
( get touch addr )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8
.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
2021-05-03 12:57:39 -04:00
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
( incr ) .i PEK #01 ADD .i POK
2021-05-11 14:12:07 -04:00
.i PEK #08 LTH ,&copy-loop JCN
;redraw JSR2 BRK
&not-copy-mode
2021-05-11 14:12:07 -04:00
.bankview/mode PEK #02 NEQ ,&not-erase-mode JCN
#00 .i POK
&erase-loop
#00
2021-04-16 14:34:08 -04:00
( get touch addr )
.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8
.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
2021-05-03 12:57:39 -04:00
.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
( incr ) .i PEK #01 ADD .i POK
2021-05-11 14:12:07 -04:00
.i PEK #08 LTH ,&erase-loop JCN
;redraw JSR2 BRK
&not-erase-mode
2021-04-16 14:34:08 -04:00
( select )
2021-05-09 14:22:21 -04:00
.Mouse/x DEI2 .bankview/x PEK2 SUB2 #0008 DIV2 TOB
.Mouse/y DEI2 .bankview/y PEK2 SUB2 #0008 DIV2 TOB #40 SFT ADD
DUP .bankview/selection POK
;select-tile JSR2
2021-03-03 14:49:26 -05:00
2021-03-04 23:15:01 -05:00
BRK
2021-03-03 14:49:26 -05:00
2021-04-17 20:27:24 -04:00
@on-touch-tileview ( -> )
2021-05-09 23:43:33 -04:00
BRK
@on-touch-editview ( -> )
#aa DEBUG
2021-04-17 20:27:24 -04:00
BRK
@on-touch-dataview ( -> )
2021-05-11 14:12:07 -04:00
.Mouse/y DEI2 .dataview/y1 PEK2 SUB2 STEP8 TOB #60 EQU ,&skip JCN BRK &skip
2021-05-09 14:22:21 -04:00
.Mouse/x DEI2 .dataview/x1 PEK2 SUB2 #0008 DIV2 TOB
2021-05-11 14:12:07 -04:00
DUP #00 NEQ ,&no-move-up JCN
;op_shiftup JSR2
( release ) #00 .Mouse/state DEO
;redraw JSR2 POP BRK &no-move-up
2021-05-11 14:12:07 -04:00
DUP #01 NEQ ,&no-move-down JCN
;op_shiftdown JSR2
( release ) #00 .Mouse/state DEO
;redraw JSR2 POP BRK &no-move-down
2021-04-17 20:27:24 -04:00
POP
BRK
2021-04-15 13:19:59 -04:00
@on-touch-blendview ( -> )
2021-05-09 14:22:21 -04:00
.Mouse/x DEI2 .blendview/x1 PEK2 SUB2 #0008 DIV2 TOB
.Mouse/y DEI2 .blendview/y1 PEK2 SUB2 #0008 DIV2 TOB #04 MUL ADD
.settings/blending POK
( release ) #00 .Mouse/state DEO
;redraw JSR2
2021-04-15 13:19:59 -04:00
BRK
2021-04-15 13:19:59 -04:00
2021-04-17 01:42:00 -04:00
@on-touch-colorview ( -> )
2021-04-25 00:18:15 -04:00
2021-05-09 14:22:21 -04:00
( channel ) .Mouse/y DEI2 .colorview/y1 PEK2 SUB2 #0008 DIV2 TOB STH
( rgb ) .Mouse/x DEI2 .colorview/x1 PEK2 SUB2 #0008 DIV2 TOB
2021-05-11 14:12:07 -04:00
DUP #00 NEQ ,&no-brush JCN
DUPr STHr .settings/brush POK &no-brush
2021-05-11 14:12:07 -04:00
DUP #01 NEQ ,&no-red JCN
2021-04-25 00:18:15 -04:00
DUPr STHr .System/r ;set-color JSR2 &no-red
2021-05-11 14:12:07 -04:00
DUP #02 NEQ ,&no-green JCN
2021-04-25 00:18:15 -04:00
DUPr STHr .System/g ;set-color JSR2 &no-green
2021-05-11 14:12:07 -04:00
DUP #03 NEQ ,&no-blue JCN
2021-04-25 00:18:15 -04:00
DUPr STHr .System/b ;set-color JSR2 &no-blue
2021-04-17 01:42:00 -04:00
POP POPr
( release ) #00 .Mouse/state DEO
;redraw JSR2
2021-04-17 01:42:00 -04:00
BRK
2021-05-09 14:22:21 -04:00
@on-touch-preview ( -> )
( y ) .Mouse/y DEI2 .preview/y1 PEK2 SUB2 #0008 DIV2 TOB
( x ) .Mouse/x DEI2 .preview/x1 PEK2 SUB2 #0008 DIV2 TOB
#40 SFT ADD #11 ADD
2021-05-09 17:10:07 -04:00
.settings/ratio POK
2021-05-09 14:22:21 -04:00
2021-05-10 23:52:57 -04:00
( release ) #00 .Mouse/state DEO
2021-05-09 14:22:21 -04:00
;redraw JSR2
BRK
2021-04-17 01:42:00 -04:00
@set-color ( color rgb -- )
2021-04-25 00:18:15 -04:00
STH
2021-05-11 14:12:07 -04:00
DUP #00 NEQ ,&no-red0 JCN
2021-04-25 00:18:15 -04:00
DUPr STHr DEI DUP #04 SFT #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
2021-04-25 00:18:15 -04:00
( resume ) #40 SFT SWP #0f AND ADD DUPr STHr DEO
&no-red0
2021-05-11 14:12:07 -04:00
DUP #01 NEQ ,&no-red1 JCN
2021-04-25 00:18:15 -04:00
DUPr STHr DEI DUP #0f AND #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
2021-04-25 00:18:15 -04:00
( resume ) #0f AND SWP #f0 AND ADD DUPr STHr DEO
&no-red1
2021-05-11 14:12:07 -04:00
DUP #02 NEQ ,&no-red2 JCN
2021-04-25 00:18:15 -04:00
DUPr STHr #01 ADD DEI DUP #04 SFT #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
2021-04-25 00:18:15 -04:00
( resume ) #40 SFT SWP #0f AND ADD DUPr STHr #01 ADD DEO
&no-red2
2021-05-11 14:12:07 -04:00
DUP #03 NEQ ,&no-red3 JCN
2021-04-25 00:18:15 -04:00
DUPr STHr #01 ADD DEI DUP #0f AND #01 ADD
( add/sub ) .Mouse/state DEI #10 EQU #fe MUL ADD
2021-04-25 00:18:15 -04:00
( resume ) #0f AND SWP #f0 AND ADD DUPr STHr #01 ADD DEO
&no-red3
2021-04-17 01:42:00 -04:00
POP
2021-04-25 00:18:15 -04:00
POPr
2021-04-17 01:42:00 -04:00
RTN
2021-04-16 14:34:08 -04:00
@select-tile ( pos -- )
( x y ) DUP #0f AND SWP #04 SFT
2021-05-09 14:22:21 -04:00
( y ) #10 MOD #10 MUL #00 SWP #0008 MUL2
( x ) ROT #10 MOD #00 SWP #0008 MUL2 ADD2
( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
2021-04-25 00:18:15 -04:00
( offset ) .settings/page PEK2 ADD2 .settings/tile POK2
;redraw JSR2
2021-04-16 14:34:08 -04:00
RTN
2021-04-17 01:42:00 -04:00
@toggle-depth ( -- )
.bankview/selection PEK
.settings/depth PEK #00 EQU .settings/depth POK
;select-tile JSR2
2021-04-17 01:42:00 -04:00
RTN
2021-05-09 23:43:33 -04:00
@op_shiftup ( -- )
2021-03-06 14:44:18 -05:00
2021-05-03 12:57:39 -04:00
.settings/tile PEK2 LDA
.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 STA
.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0001 ADD2 STA
.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA
.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA
.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA
.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA
.settings/tile PEK2 #0007 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA
.settings/tile PEK2 #0007 ADD2 STA
2021-03-06 14:44:18 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-06 14:44:18 -05:00
2021-05-09 23:43:33 -04:00
@op_shiftdown ( -- )
2021-03-06 14:44:18 -05:00
2021-05-03 12:57:39 -04:00
.settings/tile PEK2 #0007 ADD2 LDA
.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0007 ADD2 STA
.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA
.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA
.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA
.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA
.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA
.settings/tile PEK2 LDA .settings/tile PEK2 #0001 ADD2 STA
.settings/tile PEK2 STA
2021-03-06 14:44:18 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-06 14:44:18 -05:00
2021-05-09 23:43:33 -04:00
@redraw ( -- )
2021-03-03 16:49:25 -05:00
;draw-bankview JSR2
2021-05-09 23:43:33 -04:00
;draw-editview JSR2
;draw-blendview JSR2
;draw-colorview JSR2
;draw-dataview JSR2
2021-05-09 14:22:21 -04:00
;draw-preview JSR2
2021-03-03 16:49:25 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 16:49:25 -05:00
2021-05-09 23:43:33 -04:00
@draw-bankview ( -- )
2021-03-03 14:49:26 -05:00
.bankview/x PEK2 #0002 SUB2 .bankview/y PEK2 #0002 SUB2 .bankview/x PEK2 #0081 ADD2 .bankview/y PEK2 #0081 ADD2 #03 ;line-rect JSR2
2021-03-03 14:49:26 -05:00
( position )
.bankview/x PEK2 .Screen/x DEO2
.bankview/y PEK2 #0010 SUB2 .Screen/y DEO2
2021-05-09 23:43:33 -04:00
.settings/page PEK2 #22 ;draw-short JSR2
2021-03-03 14:49:26 -05:00
2021-03-04 12:07:33 -05:00
( toolbar )
.bankview/y PEK2 #0010 SUB2 .Screen/y DEO2
.bankview/x PEK2 #0028 ADD2 .Screen/x DEO2
2021-05-09 14:22:21 -04:00
;depth_icns #00 .settings/depth PEK #0008 MUL2 ADD2 .Screen/addr DEO2
#23 .Screen/color DEO
.bankview/x PEK2 #0068 ADD2 .Screen/x DEO2
;tool_selector .Screen/addr DEO2
#21 .bankview/mode PEK #00 EQU ADD .Screen/color DEO
2021-03-04 12:07:33 -05:00
2021-05-09 14:22:21 -04:00
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
;tool_hand .Screen/addr DEO2
#21 .bankview/mode PEK #01 EQU ADD .Screen/color DEO
2021-03-04 12:07:33 -05:00
2021-05-09 14:22:21 -04:00
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
;tool_eraser .Screen/addr DEO2
#21 .bankview/mode PEK #02 EQU ADD .Screen/color DEO
2021-03-04 12:07:33 -05:00
2021-03-03 14:49:26 -05:00
( guides )
.bankview/x PEK2 #0010 SUB2 .Screen/x DEO2
.bankview/y PEK2 .Screen/y DEO2
2021-05-09 23:43:33 -04:00
;font-hex .Screen/addr DEO2
2021-04-17 20:27:24 -04:00
#00 #10
&guides
( draw ) OVR .bankview/selection PEK #04 SFT EQU #22 ADD .Screen/color DEO
2021-05-09 14:22:21 -04:00
.Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
2021-04-17 20:27:24 -04:00
SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&guides JCN
2021-04-17 20:27:24 -04:00
POP2
2021-03-03 14:49:26 -05:00
2021-04-16 14:34:08 -04:00
( draw page )
( load ) .settings/page PEK2 .Screen/addr DEO2
.bankview/y PEK2 DUP2 #0080 ADD2
&ver
( save ) OVR2 .Screen/y DEO2
.bankview/x PEK2 DUP2 #0080 ADD2
&hor
( save ) OVR2 .Screen/x DEO2
2021-04-25 00:18:15 -04:00
( get selected ) .Screen/addr DEI2 .settings/tile PEK2 EQU2
( get blending ) .settings/blending PEK
( get depth ) .settings/depth PEK #20 MUL
( draw ) #20 ADD ADD ADD .Screen/color DEO
2021-05-09 14:22:21 -04:00
( incr ) SWP2 #0008 ADD2 SWP2
( incr ) .Screen/addr DEI2 #0008 ADD2 #00 .settings/depth PEK #0008 MUL2 ADD2 .Screen/addr DEO2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 LTH2 ,&hor JCN
POP2 POP2
2021-05-09 14:22:21 -04:00
( incr ) SWP2 #0008 ADD2 SWP2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 LTH2 ,&ver JCN
POP2 POP2
2021-03-03 14:49:26 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
2021-05-09 23:43:33 -04:00
@draw-tileview ( -- )
2021-03-03 14:49:26 -05:00
.tileview/x PEK2 #0002 SUB2 .tileview/y PEK2 #0002 SUB2 .tileview/x PEK2 #0080 ADD2 .tileview/y PEK2 #0081 ADD2 #03 ;line-rect JSR2
2021-03-03 20:43:39 -05:00
.tileview/x PEK2 #0028 ADD2 .Screen/x DEO2
.tileview/y PEK2 #0010 SUB2 .Screen/y DEO2
2021-04-25 00:18:15 -04:00
.settings/tile PEK2 .Screen/addr DEO2
2021-04-17 16:32:07 -04:00
( get blending ) .settings/blending PEK
( get depth ) .settings/depth PEK #20 MUL
( draw ) #20 ADD ADD .Screen/color DEO
2021-03-03 14:49:26 -05:00
( position )
.tileview/x PEK2 .Screen/x DEO2
.tileview/y PEK2 #0010 SUB2 .Screen/y DEO2
2021-05-09 23:43:33 -04:00
.settings/tile PEK2 #22 ;draw-short JSR2
2021-03-03 14:49:26 -05:00
( body )
.tileview/x PEK2 .Screen/x DEO2
.tileview/y PEK2 .Screen/y DEO2
2021-04-25 00:18:15 -04:00
.settings/tile PEK2 .settings/tile POK2
;draw-tileview-icn JSR2
2021-03-03 14:49:26 -05:00
.tileview/x PEK2 #0040 ADD2 .Screen/x DEO2
.tileview/y PEK2 .Screen/y DEO2
2021-05-09 14:22:21 -04:00
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2
;draw-tileview-icn JSR2
2021-03-03 14:49:26 -05:00
.tileview/x PEK2 .Screen/x DEO2
.tileview/y PEK2 #0040 ADD2 .Screen/y DEO2
2021-05-09 14:22:21 -04:00
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2
;draw-tileview-icn JSR2
2021-03-03 14:49:26 -05:00
.tileview/x PEK2 #0040 ADD2 .Screen/x DEO2
.tileview/y PEK2 #0040 ADD2 .Screen/y DEO2
2021-05-09 14:22:21 -04:00
.settings/tile PEK2 #0008 ADD2 .settings/tile POK2
;draw-tileview-icn JSR2
2021-03-03 14:49:26 -05:00
2021-03-03 20:43:39 -05:00
( line hor )
.tileview/y PEK2 #003f ADD2 .Screen/y DEO2
.tileview/x PEK2 .Screen/x DEO2
&line-hor
( draw ) #03 .Screen/color DEO
( incr ) .Screen/x DEI2 #0002 ADD2 .Screen/x DEO2
2021-05-11 14:12:07 -04:00
.Screen/x DEI2 .tileview/x PEK2 #0082 ADD2 LTH2 ,&line-hor JCN
2021-03-03 14:49:26 -05:00
2021-03-03 20:43:39 -05:00
( line ver )
.tileview/y PEK2 .Screen/y DEO2
.tileview/x PEK2 #003f ADD2 .Screen/x DEO2
&line-ver
( draw ) #03 .Screen/color DEO
( incr ) .Screen/y DEI2 #0002 ADD2 .Screen/y DEO2
2021-05-11 14:12:07 -04:00
.Screen/y DEI2 .tileview/y PEK2 #0081 ADD2 LTH2 ,&line-ver JCN
2021-03-03 14:49:26 -05:00
2021-04-25 00:18:15 -04:00
( rewind ) .settings/tile PEK2 #0018 SUB2 .settings/tile POK2
2021-03-03 16:49:25 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
2021-05-09 23:43:33 -04:00
@draw-editview ( -- )
.editview/x1 PEK2 #0002 SUB2 .editview/y1 PEK2 #0002 SUB2 .editview/x2 PEK2 #0001 ADD2 .editview/y2 PEK2 #0001 ADD2 #03 ;line-rect JSR2
( position )
.editview/x1 PEK2 .Screen/x DEO2
.editview/y1 PEK2 #0010 SUB2 .Screen/y DEO2
.settings/tile PEK2 #22 ;draw-short JSR2
( tiles )
.settings/tile PEK2 DUP2 STH2 .Screen/addr DEO2
#00 #04
&ver
OVR #08 MUL TOS #0004 MUL2 .editview/y1 PEK2 ADD2 .Screen/y DEO2
#00 #04
&hor
OVR #08 MUL TOS #0004 MUL2 .editview/x1 PEK2 ADD2 .Screen/x DEO2
( get x,y )
SWP2 OVR STH SWP2 OVR STHr
( check if within ratio )
.settings/ratio PEK #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr
2021-05-11 14:12:07 -04:00
#0101 NEQ2 ,&outside JCN
2021-05-09 23:43:33 -04:00
2021-05-10 23:52:57 -04:00
( get tile ) DUP2r STH2r .Screen/addr DEO2
2021-05-09 23:43:33 -04:00
( draw zoomed tile )
#01 ;draw-tile JSR2
( incr ) STH2r #0008 ADD2 STH2
,&resume JMP
&outside
;halftone_icn .Screen/addr DEO2
#23 .Screen/color DEO
2021-05-10 23:52:57 -04:00
#00 ;draw-tile JSR2
2021-05-09 23:43:33 -04:00
&resume
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&hor JCN
2021-05-09 23:43:33 -04:00
POP2
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ;&ver JCN2
2021-05-09 23:43:33 -04:00
POP2
POP2r
2021-05-10 23:52:57 -04:00
( grid )
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0020 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0040 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 DUP2 #0080 ADD2 .editview/y1 PEK2 #0060 ADD2 #03 ;line-hor JSR2
.editview/x1 PEK2 #0020 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
.editview/x1 PEK2 #0040 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
.editview/x1 PEK2 #0060 ADD2 .editview/y1 PEK2 DUP2 #0080 ADD2 #03 ;line-ver JSR2
2021-05-09 23:43:33 -04:00
RTN
2021-05-10 23:52:57 -04:00
@draw-tile ( color -- )
2021-05-09 23:43:33 -04:00
( TODO: complete )
STH
#00 #20
&ver
#00 #20
&hor
2021-05-10 23:52:57 -04:00
( get x,y )
SWP2 OVR STH SWP2 OVR STHr
( get address )
.Screen/addr DEI2
( after this, ADDR XY )
SWP2 SWP STH
( got sprite line )
#04 DIV TOS ADD2 LDA
( get pixel )
STHr #04 DIV
#07 SWP SUB SFT #01 AND
.Screen/color DEO
2021-05-09 23:43:33 -04:00
#0001 .Screen/x DEI2 ADD2 .Screen/x DEO2
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&hor JCN
2021-05-09 23:43:33 -04:00
POP2
#0001 .Screen/y DEI2 ADD2 .Screen/y DEO2
.Screen/x DEI2 #0020 SUB2 .Screen/x DEO2
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&ver JCN
2021-05-09 23:43:33 -04:00
POP2
.Screen/y DEI2 #0020 SUB2 .Screen/y DEO2
POPr
RTN
@draw-tileview-icn ( -- )
2021-03-03 14:49:26 -05:00
#00 .pt/x POK #00 .pt/y POK
&ver
#00 .pt/x POK
&hor
2021-03-03 14:49:26 -05:00
( get bit )
;blank_icn #00
2021-05-03 12:57:39 -04:00
.settings/tile PEK2 #00 .pt/y PEK ADD2 LDA #07 .pt/x PEK SUB SFT #01 AND ( get bit )
2021-05-09 14:22:21 -04:00
#0008 MUL2 ADD2 .Screen/addr DEO2 ( add *8 )
( draw ) #21 .Screen/color DEO
2021-05-09 14:22:21 -04:00
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK
2021-05-11 14:12:07 -04:00
.pt/x PEK #08 LTH ;&hor JCN2
2021-05-09 14:22:21 -04:00
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
( incr ) .pt/y PEK #01 ADD .pt/y POK
.Screen/x DEI2 #0040 SUB2 .Screen/x DEO2
2021-05-11 14:12:07 -04:00
.pt/y PEK #08 LTH ;&ver JCN2
2021-03-03 14:49:26 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
2021-04-15 13:19:59 -04:00
@draw-blendview ( -- )
2021-04-17 16:32:07 -04:00
2021-05-09 23:43:33 -04:00
( .blendview/x1 PEK2 #0002 SUB2 .blendview/y1 PEK2 #0002 SUB2 .blendview/x2 PEK2 #0001 ADD2 .blendview/y2 PEK2 #0001 ADD2 #03 ;line-rect JSR2 )
2021-04-15 13:19:59 -04:00
2021-04-25 00:18:15 -04:00
.settings/tile PEK2 .Screen/addr DEO2
2021-04-15 13:19:59 -04:00
#00 #10
&loop
OVR #04 MOD #00 SWP #0008 MUL2 .blendview/x1 PEK2 ADD2 .Screen/x DEO2
OVR #04 DIV #00 SWP #0008 MUL2 .blendview/y1 PEK2 ADD2 .Screen/y DEO2
#20 .Screen/color DEO
OVR #20 ADD .settings/depth PEK #20 MUL ADD .Screen/color DEO
2021-04-15 13:19:59 -04:00
SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&loop JCN
2021-04-16 14:34:08 -04:00
POP2
2021-05-09 23:43:33 -04:00
.blendview/x1 PEK2 .Screen/x DEO2
.blendview/y2 PEK2 #0001 ADD2 .Screen/y DEO2
( get blending ) .settings/blending PEK
( get depth ) .settings/depth PEK #20 MUL
2021-05-09 23:43:33 -04:00
( draw ) #20 ADD ADD #21 ;draw-byte JSR2
2021-04-15 13:19:59 -04:00
RTN
2021-04-17 20:27:24 -04:00
@draw-dataview ( -- )
( bytes )
.tileview/y PEK2 #0018 ADD2 .Screen/y DEO2
#00 .i POK
&bytes
.tileview/x PEK2 #0088 ADD2 .Screen/x DEO2
2021-05-03 12:57:39 -04:00
.settings/tile PEK2 #00 .i PEK ADD2 LDA #22 ;draw-byte JSR2
( incr ) .i PEK #01 ADD .i POK
2021-05-09 14:22:21 -04:00
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
2021-05-11 14:12:07 -04:00
.i PEK #08 LTH ;&bytes JCN2
2021-04-17 20:27:24 -04:00
( operations )
2021-05-09 14:22:21 -04:00
.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
;movedown_icn .Screen/addr DEO2
#21 .Screen/color DEO
2021-05-09 14:22:21 -04:00
.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
;moveup_icn .Screen/addr DEO2
#21 .Screen/color DEO
2021-04-17 20:27:24 -04:00
( draw tiles 2x2 )
.tileview/y PEK2 .Screen/y DEO2
2021-04-25 00:18:15 -04:00
#00 .pt/x POK #00 .pt/y POK .settings/tile PEK2 .Screen/addr DEO2
&tiles-ver
#00 .pt/x POK
.tileview/x PEK2 #0088 ADD2 .Screen/x DEO2
&tiles-hor
( draw ) #23 .Screen/color DEO
2021-05-09 14:22:21 -04:00
( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
( incr ) .Screen/addr DEI2 #0008 ADD2 .Screen/addr DEO2
( incr ) .pt/x PEK #01 ADD .pt/x POK
2021-05-11 14:12:07 -04:00
.pt/x PEK #02 LTH ;&tiles-hor JCN2
( incr ) .pt/y PEK #01 ADD .pt/y POK
2021-05-09 14:22:21 -04:00
( incr ) .Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
2021-05-11 14:12:07 -04:00
.pt/y PEK #02 LTH ;&tiles-ver JCN2
2021-04-17 20:27:24 -04:00
RTN
2021-04-17 01:42:00 -04:00
@draw-colorview ( -- )
2021-05-09 17:10:07 -04:00
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #08 ADD .Screen/x DEO2
.System/r DEI2 ;draw-color-code JSR2
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #10 ADD .Screen/x DEO2
.System/g DEI2 ;draw-color-code JSR2
.colorview/y1 PEK2 #18 ADD .Screen/y DEO2
.colorview/x1 PEK2 #18 ADD .Screen/x DEO2
.System/b DEI2 ;draw-color-code JSR2
.colorview/x1 PEK2 .Screen/x DEO2
;circle_icns .Screen/addr DEO2
2021-04-17 01:42:00 -04:00
#00 #04
&loop
OVR .settings/brush PEK EQU #00 SWP #0008 MUL2 ;circle_icns ADD2 .Screen/addr DEO2
OVR .colorview/y1 PEK2 ROT #00 SWP #0008 MUL2 ADD2 .Screen/y DEO2
OVR #20 ADD .Screen/color DEO
2021-04-17 01:42:00 -04:00
SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&loop JCN
2021-04-17 01:42:00 -04:00
POP2
RTN
2021-05-09 14:22:21 -04:00
@draw-preview ( -- )
2021-05-09 17:10:07 -04:00
( stash address )
.settings/tile PEK2 DUP2 STH2 .Screen/addr DEO2
#00 #04
&ver
OVR #08 MUL TOS .preview/y1 PEK2 ADD2 .Screen/y DEO2
#00 #04
&hor
OVR #08 MUL TOS .preview/x1 PEK2 ADD2 .Screen/x DEO2
( get x,y )
SWP2 OVR STH SWP2 OVR STHr
( check if within ratio )
.settings/ratio PEK #0f AND LTH STH
.settings/ratio PEK #04 SFT LTH STHr
2021-05-11 14:12:07 -04:00
#0101 NEQ2 ,&outside JCN
2021-05-09 23:43:33 -04:00
( get tile ) DUP2r STH2r .Screen/addr DEO2
2021-05-09 17:10:07 -04:00
( get blending ) .settings/blending PEK
( get depth ) .settings/depth PEK #20 MUL
( draw ) #20 ADD ADD .Screen/color DEO
2021-05-10 23:52:57 -04:00
( incr ) STH2r #0008 [ .settings/depth PEK #08 MUL TOS ADD2 ] ADD2 STH2
2021-05-09 17:10:07 -04:00
,&resume JMP
&outside
;halftone_icn .Screen/addr DEO2
#23 .Screen/color DEO
&resume
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ,&hor JCN
2021-05-09 17:10:07 -04:00
POP2
( incr ) SWP #01 ADD SWP
2021-05-11 14:12:07 -04:00
DUP2 LTH ;&ver JCN2
2021-05-09 17:10:07 -04:00
POP2
POP2r
.preview/x1 PEK2 #0001 SUB2 .Screen/x DEO2
.preview/y2 PEK2 #0001 ADD2 .Screen/y DEO2
.settings/ratio PEK #23 ;draw-byte JSR2
2021-05-09 14:22:21 -04:00
RTN
2021-04-17 01:42:00 -04:00
@draw-color-code ( color* -- )
2021-05-09 23:43:33 -04:00
DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 #10 ADD .Screen/y DEO2
2021-05-09 23:43:33 -04:00
;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 #08 ADD .Screen/y DEO2
2021-05-09 23:43:33 -04:00
DUP ;font-hex ROT #0f AND #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO
.colorview/y1 PEK2 .Screen/y DEO2
2021-05-09 23:43:33 -04:00
;font-hex ROT #04 SFT #08 MUL #00 SWP ADD2 .Screen/addr DEO2
( draw ) #22 .Screen/color DEO
2021-04-17 01:42:00 -04:00
RTN
2021-05-09 23:43:33 -04:00
@draw-cursor ( -- )
2021-03-03 14:49:26 -05:00
( clear last cursor )
.mouse/x PEK2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2
#30 .Screen/color DEO
2021-03-04 12:07:33 -05:00
2021-03-03 14:49:26 -05:00
( record mouse positions )
.Mouse/x DEI2 .mouse/x POK2
.Mouse/y DEI2 .mouse/y POK2
2021-03-04 12:07:33 -05:00
( draw new cursor )
.mouse/x PEK2 .Screen/x DEO2
.mouse/y PEK2 .Screen/y DEO2
;tool_selector #00 .bankview/mode PEK #08 MUL ADD2 .Screen/addr DEO2
#32 .Mouse/state DEI #00 NEQ ADD .Screen/color DEO
2021-03-03 14:49:26 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
2021-04-17 16:32:07 -04:00
@draw-byte ( byte color -- )
2021-04-16 14:34:08 -04:00
.color POK STH
2021-05-09 23:43:33 -04:00
;font-hex #00 DUPr STHr #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
( draw ) .color PEK .Screen/color DEO
2021-05-09 14:22:21 -04:00
.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
2021-05-09 23:43:33 -04:00
;font-hex #00 STHr #0f AND #08 MUL ADD2 .Screen/addr DEO2
( draw ) .color PEK .Screen/color DEO
2021-04-16 14:34:08 -04:00
RTN
2021-05-09 23:43:33 -04:00
@draw-short ( short* color -- )
STH SWP
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
( draw ) DUPr STHr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
DUP #04 SFT TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
#0f AND TOS #0008 ** ;font-hex ++ .Screen/addr DEO2
.Screen/x DEI2 #0008 ++ .Screen/x DEO2
( draw ) STHr .Screen/color DEO
2021-03-03 14:49:26 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
( Utils )
2021-05-09 23:43:33 -04:00
@line-rect ( x1* y1* x2* y2* color -- )
2021-03-03 14:49:26 -05:00
( load ) .color POK DUP2 STH2 .rect/y2 POK2 .rect/x2 POK2 DUP2 STH2 .rect/y1 POK2 .rect/x1 POK2
STH2r STH2r
&ver
( save ) OVR2 .Screen/y DEO2
( draw ) .rect/x1 PEK2 .Screen/x DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/x2 PEK2 .Screen/x DEO2 .Screen/color DEO
2021-05-09 14:22:21 -04:00
( incr ) SWP2 #0001 ADD2 SWP2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 LTS2 ,&ver JCN
POP2 POP2
.rect/x1 PEK2 .rect/x2 PEK2
&hor
( save ) OVR2 .Screen/x DEO2
( draw ) .rect/y1 PEK2 .Screen/y DEO2 .color PEK DUP .Screen/color DEO
( draw ) .rect/y2 PEK2 .Screen/y DEO2 .Screen/color DEO
2021-05-09 14:22:21 -04:00
( incr ) SWP2 #0001 ADD2 SWP2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 #0001 ADD2 LTS2 ,&hor JCN
POP2 POP2
2021-03-03 14:49:26 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-03-03 14:49:26 -05:00
2021-05-09 23:43:33 -04:00
@line-hor ( x0* x1* y* color -- )
STH .Screen/y DEO2
&loop
( save ) OVR2 .Screen/x DEO2
( draw ) DUPr STHr .Screen/color DEO
( incr ) SWP2 #0002 ADD2 SWP2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 LTH2 ,&loop JCN
2021-05-09 23:43:33 -04:00
POP2 POP2 POPr
RTN
@line-ver ( x* y0* y1* color -- )
STH ROT2 .Screen/x DEO2
&loop
( save ) OVR2 .Screen/y DEO2
( draw ) DUPr STHr .Screen/color DEO
( incr ) SWP2 #0002 ADD2 SWP2
2021-05-11 14:12:07 -04:00
OVR2 OVR2 LTH2 ,&loop JCN
2021-05-09 23:43:33 -04:00
POP2 POP2 POPr
RTN
@tool_selector 80c0 e0f0 f8e0 1000
@tool_hand 2020 20b8 7c7c 3838
@tool_eraser 2050 b87c 3e1c 0800
@moveup_icn 0010 387c fe10 1000
@movedown_icn 0010 1010 fe7c 3810
@halftone_icn aa55 aa55 aa55 aa55
@circle_icns
2021-05-09 17:10:07 -04:00
0038 7cfe fefe 7c38 ( full )
0038 4482 8282 4438 ( line )
2021-04-17 20:27:24 -04:00
@eye_icns
2021-05-09 17:10:07 -04:00
0038 4492 2810 0000 ( open )
0000 0082 4438 0000 ( closed )
2021-05-09 23:43:33 -04:00
@blank_icn
0000 0000 0000 0000
7cfe fefe fefe 7c00
2021-05-09 23:43:33 -04:00
@depth_icns
00fe 8282 fe82 82fe
00fe 9292 fe92 92fe
2021-05-09 23:43:33 -04:00
@font-hex
2021-03-06 14:44:18 -05:00
007c 8282 8282 827c 0030 1010 1010 1010
007c 8202 7c80 80fe 007c 8202 1c02 827c
000c 1424 4484 fe04 00fe 8080 7c02 827c
007c 8280 fc82 827c 007c 8202 1e02 0202
007c 8282 7c82 827c 007c 8282 7e02 827c
007c 8202 7e82 827e 00fc 8282 fc82 82fc
007c 8280 8080 827c 00fc 8282 8282 82fc
2021-05-09 23:43:33 -04:00
007c 8280 f080 827c 007c 8280 f080 8080
@filepath1 [ "projects/fonts/specter8.bit 00 ]
@filepath2 [ "projects/pictures/cyr10x8.chr 00 ]
@filepath3 [ "projects/pictures/zerotwo10x10.chr 00 ]
@filepath4 [ "projects/fonts/katahira8.bit 00 ]
@filepath5 [ "projects/pictures/ako10x10.chr 00 ]
@filepath6 [ "projects/pictures/logo1x1.bit 00 ]