Progress on 2-bit mode for nasu

This commit is contained in:
neauoire 2021-04-17 13:32:07 -07:00
parent 03e70c9b5c
commit db64f3d85a
2 changed files with 96 additions and 40 deletions

Binary file not shown.

View File

@ -38,12 +38,14 @@
( variables )
;settings { blending 1 depth 1 page 2 }
;settings { blending 1 depth 1 brush 1 page 2 }
;bankview { x 2 y 2 mode 1 addr 2 selection 1 }
;frame { x1 2 y1 2 x2 2 y2 2 width 2 height 2 }
;bankview { x 2 y 2 mode 1 selection 1 }
;tileview { x 2 y 2 addr 2 }
;colorview { x1 2 y1 2 x2 2 y2 2 }
;blendview { x1 2 y1 2 x2 2 y2 2 }
;fileview { x1 2 y1 2 x2 2 y2 2 }
;rect { x1 2 y1 2 x2 2 y2 2 }
;mouse { x 2 y 2 }
;color { byte 1 }
@ -70,16 +72,28 @@
( vectors ) ,on-mouse =Mouse.vector
( vectors ) ,on-transfer =File.vector
~Screen.width 2/ #008a SUB2 =bankview.x
~Screen.height 2/ #003f SUB2 =bankview.y
( set frame )
#0140 =frame.width
#0080 =frame.height
#01 =settings.brush
~Screen.width 2/ ~frame.width 2/ SUB2
~Screen.height 2/ ~frame.height 2/ SUB2
~frame.width ~frame.height
SIZE-TO-RECT ,frame SET-RECT
~frame.x1 #0018 ADD2 =bankview.x
~frame.y1 #0010 ADD2 =bankview.y
BANK =settings.page
~Screen.width 2/ #0002 ADD2 =tileview.x
~Screen.height 2/ #003f SUB2 =tileview.y
~frame.y1 #0010 ADD2 =tileview.y
BANK #0448 ADD2 =tileview.addr
~Screen.width 2/ #0002 ADD2 ~Screen.height 2/ #0048 ADD2 #0020 #0020 SIZE-TO-RECT ,colorview SET-RECT
~Screen.width 2/ #0061 ADD2 ~Screen.height 2/ #0048 ADD2 #0020 #0020 SIZE-TO-RECT ,blendview SET-RECT
~frame.x1 #0068 ADD2 ~Screen.height 2/ #0070 SUB2 #0020 #0020 SIZE-TO-RECT ,colorview SET-RECT
~frame.x1 #0018 ADD2 ~Screen.height 2/ #0070 SUB2 #0020 #0020 SIZE-TO-RECT ,blendview SET-RECT
~frame.x1 ~Screen.height #0018 SUB2 ~frame.x2 ~Screen.height #0008 SUB2 ,fileview SET-RECT
#01 =settings.blending
@ -88,9 +102,12 @@
,filepath3 =File.name #1000 =File.length BANK #1000 ADD2 =File.load
,filepath4 =File.name #1000 =File.length BANK #2000 ADD2 =File.load
,filepath5 =File.name #1000 =File.length BANK #2800 ADD2 =File.load
,filepath6 =File.name #1000 =File.length BANK #3800 ADD2 =File.load
,redraw JSR2
( ~frame.x1 ~frame.y1 ~frame.x2 ~frame.y2 #01 ,line-rect JSR2 )
BRK
@on-transfer ( -> )
@ -151,12 +168,6 @@ BRK
~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 ^$no-brush-click JNZ
( select ) ~mouse.x ~bankview.x SUB2 8/ #000d SUB2 SWP POP =bankview.mode
$no-brush-click
~Mouse.x ~tileview.x SUB2 8/ #000e NEQ2 ^$no-load-click JNZ
( load ) ,filepath1 =File.name #0800 =File.length ~settings.page =File.load
$no-load-click
~Mouse.x ~tileview.x SUB2 8/ #000f NEQ2 ^$no-save-click JNZ
( save ) ,filepath1 =File.name #0800 =File.length ~settings.page =File.save
$no-save-click
~Mouse.x ~bankview.x SUB2 8/ #0005 NEQ2 ^$no-toggle-depth JNZ
,toggle-depth JSR2
$no-toggle-depth
@ -281,6 +292,8 @@ BRK
( channel ) ~Mouse.y ~colorview.y1 SUB2 8/ SWP POP STH
( rgb ) ~Mouse.x ~colorview.x1 SUB2 8/ SWP POP
DUP #00 NEQ ^$no-brush JNZ
DUPr STHr =settings.brush $no-brush
DUP #01 NEQ ^$no-red JNZ
DUPr STHr ,System.r ,set-color JSR2 $no-red
DUP #02 NEQ ^$no-green JNZ
@ -297,16 +310,24 @@ BRK
STH2
DUP #00 NEQ ^$no-red0 JNZ
DUP2r STH2r PEK2 DUP #04 SFT #01 ADD ~Mouse.state #10 EQU #fe MUL ADD #40 SFT SWP #0f AND ADD DUP2r STH2r POK2
DUP2r STH2r PEK2 DUP #04 SFT #01 ADD
( add/sub ) ~Mouse.state #10 EQU #fe MUL ADD
( resume ) #40 SFT SWP #0f AND ADD DUP2r STH2r POK2
$no-red0
DUP #01 NEQ ^$no-red1 JNZ
DUP2r STH2r PEK2 DUP #0f AND #01 ADD ~Mouse.state #10 EQU #fe MUL ADD #0f AND SWP #f0 AND ADD DUP2r STH2r POK2
DUP2r STH2r PEK2 DUP #0f AND #01 ADD
( add/sub ) ~Mouse.state #10 EQU #fe MUL ADD
( resume ) #0f AND SWP #f0 AND ADD DUP2r STH2r POK2
$no-red1
DUP #02 NEQ ^$no-red2 JNZ
DUP2r STH2r #0001 ADD2 PEK2 DUP #04 SFT #01 ADD ~Mouse.state #10 EQU #fe MUL ADD #40 SFT SWP #0f AND ADD DUP2r STH2r #0001 ADD2 POK2
DUP2r STH2r #0001 ADD2 PEK2 DUP #04 SFT #01 ADD
( add/sub ) ~Mouse.state #10 EQU #fe MUL ADD
( resume ) #40 SFT SWP #0f AND ADD DUP2r STH2r #0001 ADD2 POK2
$no-red2
DUP #03 NEQ ^$no-red3 JNZ
DUP2r STH2r #0001 ADD2 PEK2 DUP #0f AND #01 ADD ~Mouse.state #10 EQU #fe MUL ADD #0f AND SWP #f0 AND ADD DUP2r STH2r #0001 ADD2 POK2
DUP2r STH2r #0001 ADD2 PEK2 DUP #0f AND #01 ADD
( add/sub ) ~Mouse.state #10 EQU #fe MUL ADD
( resume ) #0f AND SWP #f0 AND ADD DUP2r STH2r #0001 ADD2 POK2
$no-red3
POP
POP2r
@ -366,6 +387,7 @@ RTN
,draw-tileview JSR2
,draw-blendview JSR2
,draw-colorview JSR2
,draw-fileview JSR2
RTN
@ -399,14 +421,6 @@ RTN
,tool_eraser =Screen.addr
#21 ~bankview.mode #02 EQU ADD =Screen.color
~tileview.x #0070 ADD2 =Screen.x
,load_icn =Screen.addr
#21 =Screen.color
~tileview.x #0078 ADD2 =Screen.x
,save_icn =Screen.addr
#21 =Screen.color
( guides )
#00 =i ,font_hex =Screen.addr
@ -451,7 +465,10 @@ RTN
~tileview.x #0028 ADD2 =Screen.x
~tileview.y #0010 SUB2 =Screen.y
~tileview.addr =Screen.addr
#23 =Screen.color
( get blending ) ~settings.blending
( get depth ) ~settings.depth #20 MUL
( draw ) #20 ADD ADD =Screen.color
( position )
@ -505,7 +522,7 @@ RTN
#00 =i
$bytes
~tileview.x #0088 ADD2 =Screen.x
~tileview.addr #00 ~i ADD2 PEK2 ,draw-byte JSR2
~tileview.addr #00 ~i ADD2 PEK2 #22 ,draw-byte JSR2
( incr ) ~i #01 ADD =i
( incr ) ~Screen.y 8+ =Screen.y
~i #08 LTH ,$bytes JNZ2
@ -519,7 +536,7 @@ RTN
,moveup_icn =Screen.addr
#21 =Screen.color
( draw tiles )
( draw tiles 2x2 )
~tileview.y =Screen.y
#00 =pt.x #00 =pt.y ~tileview.addr =Screen.addr
@ -560,6 +577,8 @@ RTN
RTN
@draw-blendview ( -- )
~blendview.x1 #0002 SUB2 ~blendview.y1 #0002 SUB2 ~blendview.x2 #0001 ADD2 ~blendview.y2 #0001 ADD2 #03 ,line-rect JSR2
~tileview.addr =Screen.addr
#00 #10
@ -572,12 +591,13 @@ RTN
DUP2 LTH ^$loop JNZ
POP2
~blendview.x1 #0019 SUB2 =Screen.x
~blendview.y1 #0018 ADD2 =Screen.y
~blendview.x1 #0002 SUB2 ~blendview.y2 #0001 ADD2 ~blendview.x1 #000e ADD2 ~blendview.y2 #0009 ADD2 #03 ,line-rect JSR2
~blendview.x1 #0001 SUB2 =Screen.x
~blendview.y2 #0001 ADD2 =Screen.y
( get blending ) ~settings.blending
( get depth ) ~settings.depth #20 MUL
( draw ) #20 ADD ADD ,draw-byte JSR2
( draw ) #20 ADD ADD #2c ,draw-byte JSR2
RTN
@ -594,10 +614,11 @@ RTN
~System.b ,draw-color-code JSR2
~colorview.x1 =Screen.x
,full_icn =Screen.addr
,circle_icns =Screen.addr
#00 #04
$loop
OVR ~settings.brush EQU #00 SWP #0008 MUL2 ,circle_icns ADD2 =Screen.addr
OVR ~colorview.y1 ROT #00 SWP #0008 MUL2 ADD2 =Screen.y
OVR #20 ADD =Screen.color
SWP #01 ADD SWP
@ -606,6 +627,31 @@ RTN
RTN
@draw-fileview ( -- )
( line hor )
~fileview.y1 =Screen.y
~fileview.x1 ~fileview.x2
$line-hor
OVR2 =Screen.x
( draw ) #03 =Screen.color
( incr ) SWP2 #0002 ADD2 SWP2
OVR2 OVR2 LTH2 ^$line-hor JNZ
POP2 POP2
~fileview.y1 #0008 ADD2 =Screen.y
~fileview.x1 #0008 ADD2 =Screen.x
,rename_icn =Screen.addr
#21 =Screen.color
~fileview.x2 #0018 SUB2 =Screen.x
,load_icn =Screen.addr
#21 =Screen.color
~fileview.x2 #0010 SUB2 =Screen.x
,save_icn =Screen.addr
#21 =Screen.color
RTN
@draw-color-code ( color* -- )
DUP ,font_hex ROT #0f AND #08 MUL #00 SWP ADD2 =Screen.addr
@ -642,14 +688,14 @@ RTN
RTN
@draw-byte ( byte -- )
@draw-byte ( byte color -- )
STH
=color STH
,font_hex #00 DUPr STHr #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #22 =Screen.color
( draw ) ~color =Screen.color
~Screen.x 8+ =Screen.x
,font_hex #00 STHr #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #22 =Screen.color
( draw ) ~color =Screen.color
RTN
@ -694,7 +740,10 @@ RTN
RTN
@full_icn [ 0038 7cfe fefe 7c38 ]
@circle_icns
[ 0038 7cfe fefe 7c38 ] ( full )
[ 0038 4482 8282 4438 ] ( line )
@tool_selector [ 80c0 e0f0 f8e0 1000 ]
@tool_hand [ 4040 4070 f8f8 f870 ]
@tool_eraser [ 2050 b87c 3e1c 0800 ]
@ -708,15 +757,22 @@ RTN
00fe 9292 fe92 92fe
]
@load_icn [ feaa d6aa d4aa f400 ]
@save_icn [ fe82 8282 848a f400 ]
@eye_icns
[ 0038 4492 2810 0000 ] ( open )
[ 0000 0082 4438 0000 ] ( closed )
@rename_icn [ 1054 28c6 2854 1000 ]
@load_icn [ feaa d6aa d4aa f400 ]
@save_icn [ fe82 8282 848a f400 ]
@moveup_icn [ 0010 387c fe10 1000 ]
@movedown_icn [ 0010 1010 fe7c 3810 ]
@filepath1 [ projects/fonts/specter8.bit 00 ]
@filepath2 [ projects/pictures/cibo.bit 00 ]
@filepath3 [ projects/pictures/zerotwo10x10.chr 00 ]
@filepath4 [ projects/fonts/katahira8.bit 00 ]
@filepath5 [ projects/pictures/daria10x10.chr 00 ]
@filepath5 [ projects/pictures/ako10x10.chr 00 ]
@filepath6 [ projects/pictures/cyr4x4.chr 00 ]
@font_hex ( 0-F )
[