Progress on Nasu

This commit is contained in:
neauoire 2021-03-03 17:43:39 -08:00
parent fb8fac1a47
commit 227f54675d
1 changed files with 126 additions and 114 deletions

View File

@ -5,31 +5,26 @@
&Controller { buttons 1 } &Controller { buttons 1 }
&Mouse { x 2 y 2 state 1 chord 1 } &Mouse { x 2 y 2 state 1 chord 1 }
&Label2d { x 2 y 2 color 1 addr 2 }
&Rect2d { x1 2 y1 2 x2 2 y2 2 } &Rect2d { x1 2 y1 2 x2 2 y2 2 }
&Point2d { x 2 y 2 } &Point2d { x 2 y 2 }
&Point { x 1 y 1 } &Point { x 1 y 1 }
&BankView { x 2 y 2 addr 2 } &BankView { x 2 y 2 addr 2 }
&TileView { x 2 y 2 addr 2 } &TileView { x 2 y 2 addr 2 }
&OverView { x 2 y 2 addr 2 }
;label Label2d
;bankview BankView ;bankview BankView
;tileview TileView ;tileview TileView
;overview OverView
;rect Rect2d ;rect Rect2d
;mouse Point2d ;mouse Point2d
;color 1 ;color 1
;i 1 ;j 2 ;i 1
;pt Point ;pt Point
;addr 2 ;addr 2
|0100 @RESET |0100 @RESET
#0010 =bankview.x #0060 =bankview.y ,bank1 =bankview.addr ~dev/screen.width #0002 DIV2 #0098 SUB2 =bankview.x ~dev/screen.height #0002 DIV2 #0040 SUB2 =bankview.y ,bank1 =bankview.addr
#00b0 =tileview.x #0060 =tileview.y ,bank1 #0448 ADD2 =tileview.addr ~dev/screen.width #0002 DIV2 #0008 SUB2 =tileview.x ~dev/screen.height #0002 DIV2 #0040 SUB2 =tileview.y ,bank1 #0448 ADD2 =tileview.addr
#0010 =overview.x #0010 =overview.y
,redraw JSR ,redraw JSR
@ -40,15 +35,29 @@ BRK
,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2 ,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2
,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2 ,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr #0080 ADD2 =tileview.addr
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
,redraw JSR ,redraw JSR
@no-ctrl-up @no-ctrl-up
,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2 ,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2
~tileview.addr #0008 SUB2 =tileview.addr ~tileview.addr #0080 SUB2 =tileview.addr
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
,redraw JSR ,redraw JSR
@no-ctrl-down @no-ctrl-down
,no-ctrl-left ~dev/ctrl.buttons #40 EQU JMP? POP2
~tileview.addr #0008 ADD2 =tileview.addr
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
,redraw JSR
@no-ctrl-left
,no-ctrl-right ~dev/ctrl.buttons #80 EQU JMP? POP2
~tileview.addr #0008 SUB2 =tileview.addr
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
,redraw JSR
@no-ctrl-right
@no-ctrl @no-ctrl
,no-click ~dev/mouse.state #00 EQU JMP? POP2 ,no-click ~dev/mouse.state #00 EQU JMP? POP2
@ -63,8 +72,6 @@ BRK
~bankview.addr ADD2 =tileview.addr ~bankview.addr ADD2 =tileview.addr
,redraw JSR ,redraw JSR
@no-click @no-click
,draw-cursor JSR ,draw-cursor JSR
@ -75,7 +82,6 @@ BRK
,draw-bankview JSR ,draw-bankview JSR
,draw-tileview JSR ,draw-tileview JSR
,draw-overview JSR
RTS RTS
@ -128,7 +134,12 @@ RTS
@draw-tileview @draw-tileview
~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0081 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR ~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR
~tileview.x #0028 ADD2 =dev/sprite.x
~tileview.y #0010 SUB2 =dev/sprite.y
~tileview.addr =dev/sprite.addr
#03 =dev/sprite.color
( position ) ( position )
@ -158,45 +169,74 @@ RTS
~tileview.addr #0008 ADD2 =tileview.addr ~tileview.addr #0008 ADD2 =tileview.addr
,draw-tileview-icn JSR ,draw-tileview-icn JSR
~tileview.addr #0018 SUB2 =tileview.addr ( line hor )
~tileview.y #003f ADD2 =dev/screen.y
~tileview.x =dev/screen.x
@draw-hor
( draw ) #03 =dev/screen.color
( incr ) ~dev/screen.x #0002 ADD2 =dev/screen.x
~dev/screen.x ~tileview.x #0082 ADD2 LTH2 ,draw-hor ROT JMP? POP2
RTS ( line ver )
~tileview.y =dev/screen.y
~tileview.x #003f ADD2 =dev/screen.x
@draw-ver
( draw ) #03 =dev/screen.color
( incr ) ~dev/screen.y #0002 ADD2 =dev/screen.y
~dev/screen.y ~tileview.y #0081 ADD2 LTH2 ,draw-ver ROT JMP? POP2
@draw-overview ( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr
~overview.x =dev/sprite.x ~overview.y =dev/sprite.y ( bytes )
~tileview.y #0018 ADD2 =dev/sprite.y
#00 =i
@draw-tileview-bytes
~tileview.x #0090 ADD2 =dev/sprite.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 ROR #08 MUL ADD2 =dev/sprite.addr
( draw ) #02 =dev/sprite.color
~dev/sprite.x #0008 ADD2 =dev/sprite.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =dev/sprite.addr
( draw ) #02 =dev/sprite.color
( incr ) ~i #01 ADD =i
( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y
,draw-tileview-bytes ~i #08 LTH JMP? POP2
~tileview.y =dev/sprite.y
#00 =pt.x #00 =pt.y ~tileview.addr =dev/sprite.addr #00 =pt.x #00 =pt.y ~tileview.addr =dev/sprite.addr
( draw hor line ) @draw-tileview-tiles-ver
#0040 =dev/screen.y
#0000 =dev/screen.x
@draw-ver
( draw ) #02 =dev/screen.color
( incr ) ~dev/screen.x #0002 ADD2 =dev/screen.x
~dev/screen.x ~tileview.x ~dev/screen.width ADD2 LTH2 ,draw-ver ROT JMP? POP2
( draw ver line )
#0000 =dev/screen.y
#0040 =dev/screen.x
@draw-hor
( draw ) #02 =dev/screen.color
( incr ) ~dev/screen.y #0002 ADD2 =dev/screen.y
~dev/screen.y #0040 LTH2 ,draw-hor ROT JMP? POP2
( body )
@draw-overview-tiles-ver
#00 =pt.x #00 =pt.x
~overview.x =dev/sprite.x ~tileview.x #0090 ADD2 =dev/sprite.x
@draw-overview-tiles-hor @draw-tileview-tiles-hor
( draw ) #01 =dev/sprite.color ( draw ) #03 =dev/sprite.color
( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x ( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x
( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr ( incr ) ~dev/sprite.addr #0008 ADD2 =dev/sprite.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
,draw-overview-tiles-hor ~pt.x #04 LTH JMP? POP2 ,draw-tileview-tiles-hor ~pt.x #02 LTH JMP? POP2
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y ( incr ) ~dev/sprite.y #0008 ADD2 =dev/sprite.y
,draw-overview-tiles-ver ~pt.y #04 LTH JMP? POP2 ,draw-tileview-tiles-ver ~pt.y #02 LTH JMP? POP2
( toolbar )
~tileview.x =dev/sprite.x
~tileview.y #0083 ADD2 =dev/sprite.y
,tool_selector =dev/sprite.addr
#01 =dev/sprite.color
~dev/sprite.x #0008 ADD2 =dev/sprite.x
,tool_hand =dev/sprite.addr
#02 =dev/sprite.color
~dev/sprite.x #0008 ADD2 =dev/sprite.x
,tool_eraser =dev/sprite.addr
#02 =dev/sprite.color
~dev/sprite.x #0008 ADD2 =dev/sprite.x
,tool_copy =dev/sprite.addr
#02 =dev/sprite.color
RTS RTS
@ -207,7 +247,7 @@ RTS
#00 =pt.x #00 =pt.x
@redraw-hor @redraw-hor
( get bit ) ( get bit )
,cell0_icn #00 ,blank_icn #00
~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB ROR #01 AND ( get bit ) ~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB ROR #01 AND ( get bit )
#0008 MUL2 ADD2 =dev/sprite.addr ( add *8 ) #0008 MUL2 ADD2 =dev/sprite.addr ( add *8 )
( draw ) #01 =dev/sprite.color ( draw ) #01 =dev/sprite.color
@ -229,7 +269,7 @@ RTS
#0000 EQU2 RTS? ( Return if unchanged ) #0000 EQU2 RTS? ( Return if unchanged )
( clear last cursor ) ( clear last cursor )
#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR #10 ,blank_icn ~mouse.x ~mouse.y ,draw-sprite JSR
( record mouse positions ) ( record mouse positions )
~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y ~dev/mouse.x =mouse.x ~dev/mouse.y =mouse.y
#12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR #12 ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
@ -255,20 +295,6 @@ RTS
( Utils ) ( Utils )
@fill-rect ( x1 y1 x2 y2 color )
( load ) =color =rect.y2 =rect.x2 DUP2 =dev/screen.y =rect.y1 DUP2 =dev/screen.x =rect.x1
@fill-rect-ver
~rect.x1 =dev/screen.x
@fill-rect-hor
( draw ) ~color =dev/screen.color
( incr ) ~dev/screen.x #0001 ADD2 =dev/screen.x
,fill-rect-hor ~dev/screen.x ~rect.x2 LTH2 JMP? POP2
( incr ) ~dev/screen.y #0001 ADD2 =dev/screen.y
,fill-rect-ver ~dev/screen.y ~rect.y2 LTH2 JMP? POP2
RTS
@line-rect ( x1 y1 x2 y2 color ) @line-rect ( x1 y1 x2 y2 color )
( load ) =color =rect.y2 =rect.x2 DUP2 =dev/screen.y =rect.y1 DUP2 =dev/screen.x =rect.x1 ( load ) =color =rect.y2 =rect.x2 DUP2 =dev/screen.y =rect.y1 DUP2 =dev/screen.x =rect.x1
@ -286,19 +312,6 @@ RTS
RTS RTS
@draw-label-left ( x y color addr )
( load ) =label.addr =label.color =dev/sprite.y =dev/sprite.x
~label.addr
@draw-label-left-loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =dev/sprite.addr ~label.color =dev/sprite.color
( incr ) #0001 ADD2
( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x
DUP2 #0001 ADD2 LDR #00 NEQ ,draw-label-left-loop ROT JMP? POP2
POP2
RTS
@draw-sprite @draw-sprite
=dev/sprite.y =dev/sprite.y
@ -308,13 +321,13 @@ RTS
RTS RTS
@cell0_icn [ 0000 0000 0000 0000 ] @tool_selector [ 80c0 e0f0 f8e0 1000 ]
@cell1_icn [ 7cfe fefe fefe 7c00 ] @tool_hand [ 4040 4070 f8f8 f870 ]
@tool_eraser [ 0814 2244 a850 2d00 ]
@tool_copy [ 5824 5a42 4242 3c00 ]
@bank_txt [ BANKVIEW 00 ] @blank_icn [ 0000 0000 0000 0000 ]
@tile_txt [ TILEVIEW 00 ] @cell1_icn [ 7cfe fefe fefe 7c00 ]
@over_txt [ OVERVIEW 00 ]
@clear_icn [ 0000 0000 0000 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] @cursor_icn [ 80c0 e0f0 f8e0 1000 ]
@font_hex ( 0-F ) @font_hex ( 0-F )
@ -329,42 +342,6 @@ RTS
7c82 80f0 8082 7c00 7c82 80f0 8080 8000 7c82 80f0 8082 7c00 7c82 80f0 8080 8000
] ]
@font ( spectrum-zx font )
[
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
]
|E000 @bank1 |E000 @bank1
[ [
0103 070f 1f3f 7fff 0000 0000 0000 0000 0103 070f 1f3f 7fff 0000 0000 0000 0000
@ -497,7 +474,42 @@ RTS
bcb2 b2b2 bcb0 3000 0000 0000 0000 0000 bcb2 b2b2 bcb0 3000 0000 0000 0000 0000
] ]
|F300 @bank2 |E800 @bank2 [
0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
]
|F500 @bank3 |F500 @bank3
|F700 @bank4 |F700 @bank4