Improved pattern editor
This commit is contained in:
parent
d8fdf3840b
commit
7da892ee1f
|
@ -1,14 +1,17 @@
|
|||
( app/hex )
|
||||
|
||||
&Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|
||||
&Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
&Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
&Controller { buttons 1 }
|
||||
&Mouse { x 2 y 2 state 1 chord 1 }
|
||||
|
||||
&Label2d { x 2 y 2 color 1 addr 2 }
|
||||
&Point2d { x 2 y 2 }
|
||||
&Rect2d { x1 2 y1 2 x2 2 y2 2 }
|
||||
&Point { x 1 y 1 }
|
||||
&Editor { x1 2 y1 2 }
|
||||
&Editor { x1 2 y1 2 addr 2 }
|
||||
|
||||
;label Label2d
|
||||
;pixel Point
|
||||
;window Rect2d
|
||||
;mouse Point2d
|
||||
|
@ -16,26 +19,47 @@
|
|||
;rect Rect2d
|
||||
|
||||
;color 1
|
||||
;addr 2
|
||||
|
||||
|0100 @RESET
|
||||
|
||||
#0030 =window.x1 #0030 =window.y1 #0090 =window.x2 #00a0 =window.y2
|
||||
,pattern =editor.addr
|
||||
#0030 =window.x1 #0030 =window.y1 #00b0 =window.x2 #0090 =window.y2
|
||||
|
||||
#0040 =editor.x1 #0040 =editor.y
|
||||
|
||||
,draw-window JSR
|
||||
|
||||
#0040 #0040 #01 ,draw-editor JSR
|
||||
|
||||
BRK
|
||||
|
||||
|0200 @FRAME
|
||||
|
||||
,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2
|
||||
|
||||
,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2
|
||||
~editor.addr #0001 SUB2 =editor.addr
|
||||
,draw-window JSR
|
||||
,redraw JSR
|
||||
@no-ctrl-up
|
||||
|
||||
,no-ctrl-down ~dev/ctrl.buttons #20 EQU JMP? POP2
|
||||
~editor.addr #0001 ADD2 =editor.addr
|
||||
,draw-window JSR
|
||||
,redraw JSR
|
||||
@no-ctrl-down
|
||||
|
||||
@no-ctrl
|
||||
|
||||
,no-click ~dev/mouse.state #00 EQU JMP? POP2
|
||||
|
||||
( load ) ,pattern ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR
|
||||
( load ) ~editor.addr ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR
|
||||
( mask ) #01 #07 ~dev/mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB ROL
|
||||
XOR
|
||||
( save ) ,pattern ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR
|
||||
( save ) ~editor.addr ~dev/mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR
|
||||
|
||||
,draw-window JSR
|
||||
,redraw JSR
|
||||
|
||||
@no-click
|
||||
|
@ -44,19 +68,51 @@ BRK
|
|||
|
||||
BRK
|
||||
|
||||
@redraw
|
||||
|
||||
#0000 #0000 ~dev/screen.width ~dev/screen.height #03 ,pattern ,tile-rect JSR
|
||||
@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
|
||||
|
||||
~window.x1 #0001 ADD2 ~window.y1 ~window.x2 #0004 ADD2 ~window.y2 #0004 ADD2 #00 ,fill-rect JSR
|
||||
~window.x1 ~window.y1 #0001 ADD2 ~window.x2 #0001 ADD2 ~window.y2 #0004 ADD2 #00 ,fill-rect JSR
|
||||
~window.x1 #0001 SUB2 ~window.y1 #0001 SUB2 ~window.x2 ~window.y2 #00 ,line-rect JSR
|
||||
~window.x1 #0002 SUB2 ~window.y1 #0002 SUB2 ~window.x2 #0001 ADD2 ~window.y2 #0001 ADD2 #02 ,line-rect JSR
|
||||
~window.x1 ~window.y1 ~window.x2 ~window.y2 #00 ,fill-rect JSR
|
||||
RTS
|
||||
|
||||
@draw-window
|
||||
|
||||
#0000 #0000 ~dev/screen.width ~dev/screen.height #03 ~editor.addr ,tile-rect JSR
|
||||
|
||||
~window.x1 #0001 SUB2 ~window.y1 #0001 SUB2 ~window.x2 ~window.y2 #01 ,line-rect JSR
|
||||
~window.x1 ~window.y1 ~window.x2 ~window.y2 #02 ,fill-rect JSR
|
||||
~window.x1 ~window.y1 #04 ,window_name ,draw-label-left JSR
|
||||
|
||||
RTS
|
||||
|
||||
@draw-editor
|
||||
|
||||
=color DUP2 =dev/sprite.y =editor.y1 DUP2 =dev/sprite.x =editor.x1
|
||||
|
||||
,redraw JSR
|
||||
|
||||
RTS
|
||||
|
||||
@draw-byte ( x y color addr )
|
||||
|
||||
( load ) =addr =color =dev/sprite.y =dev/sprite.x
|
||||
,font_hex #00 ~addr LDR #f0 AND #04 ROR #08 MUL ADD2 =dev/sprite.addr ~color =dev/sprite.color
|
||||
~dev/sprite.x #0008 ADD2 =dev/sprite.x
|
||||
,font_hex #00 ~addr LDR #0f AND #08 MUL ADD2 =dev/sprite.addr ~color =dev/sprite.color
|
||||
|
||||
RTS
|
||||
|
||||
@redraw
|
||||
|
||||
~editor.x1 =dev/sprite.x
|
||||
~editor.y1 =dev/sprite.y
|
||||
,pattern =dev/sprite.addr
|
||||
~editor.addr =dev/sprite.addr
|
||||
|
||||
#02 =color
|
||||
|
||||
|
@ -68,10 +124,10 @@ BRK
|
|||
|
||||
( get bit )
|
||||
,cell0_icn #00
|
||||
,pattern #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB ROR #01 AND ( get bit )
|
||||
~editor.addr #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB ROR #01 AND ( get bit )
|
||||
#0008 MUL2 ADD2 =dev/sprite.addr ( add *8 )
|
||||
|
||||
( draw ) ~color =dev/sprite.color
|
||||
( draw ) #08 =dev/sprite.color
|
||||
( incr ) ~dev/sprite.x #0008 ADD2 =dev/sprite.x
|
||||
( incr ) ~pixel.x #01 ADD =pixel.x
|
||||
,redraw-hor ~dev/sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP? POP2
|
||||
|
@ -79,11 +135,20 @@ BRK
|
|||
( incr ) ~pixel.y #01 ADD =pixel.y
|
||||
,redraw-ver ~dev/sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP? POP2
|
||||
|
||||
,pattern =dev/sprite.addr
|
||||
~dev/sprite.y #0040 SUB2 =dev/sprite.y
|
||||
~dev/sprite.x #0008 ADD2 =dev/sprite.x
|
||||
~editor.addr =dev/sprite.addr
|
||||
~window.y1 =dev/sprite.y
|
||||
~window.x2 #0008 SUB2 =dev/sprite.x
|
||||
( draw ) #01 =dev/sprite.color
|
||||
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0010 ADD2 #08 ~editor.addr ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0018 ADD2 #08 ~editor.addr #0001 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0020 ADD2 #08 ~editor.addr #0002 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0028 ADD2 #08 ~editor.addr #0003 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0030 ADD2 #08 ~editor.addr #0004 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0038 ADD2 #08 ~editor.addr #0005 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0040 ADD2 #08 ~editor.addr #0006 ADD2 ,draw-byte JSR
|
||||
~window.x1 #0058 ADD2 ~window.y1 #0048 ADD2 #08 ~editor.addr #0007 ADD2 ,draw-byte JSR
|
||||
|
||||
RTS
|
||||
|
||||
@fill-rect ( x1 y1 x2 y2 color )
|
||||
|
@ -132,15 +197,6 @@ RTS
|
|||
|
||||
RTS
|
||||
|
||||
@draw-editor
|
||||
|
||||
=color DUP2 =dev/sprite.y =editor.y1 DUP2 =dev/sprite.x =editor.x1
|
||||
|
||||
,redraw JSR
|
||||
|
||||
|
||||
RTS
|
||||
|
||||
@draw-cursor
|
||||
|
||||
~mouse.x ~dev/mouse.x NEQU2
|
||||
|
@ -171,11 +227,62 @@ RTS
|
|||
@cell0_icn [ 7c82 8282 8282 7c00 ]
|
||||
@cell1_icn [ 7cfe fefe fefe 7c00 ]
|
||||
|
||||
@window_name [ pixel-editor 00 ]
|
||||
|
||||
@font_hex ( 0-F )
|
||||
[
|
||||
7c82 8282 8282 7c00 3010 1010 1010 1000
|
||||
7c82 027c 8080 fe00 7c82 027c 0282 7c00
|
||||
4282 82fe 0202 0200 fc82 807c 0282 7c00
|
||||
7c82 80fc 8282 7c00 7c82 021e 0202 0200
|
||||
7c82 827c 8282 7c00 7c82 827e 0202 0400
|
||||
7c82 027e 8282 7e00 fc82 82fc 8282 fc00
|
||||
7c82 8080 8082 7c00 fc82 8282 8282 fc00
|
||||
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
|
||||
]
|
||||
|
||||
|d000 @ERROR BRK
|
||||
|
||||
|FF10 ;dev/screen Screen
|
||||
|FF20 ;dev/sprite Sprite
|
||||
|FF30 ;dev/ctrl Controller
|
||||
|FF50 ;dev/mouse Mouse
|
||||
|
||||
|FFF0 .RESET .FRAME .ERROR ( vectors )
|
||||
|FFF8 [ 13fd 1ef3 1bf2 ] ( palette )
|
||||
|FFF8 [ 0ff4 0f04 0ff4 ] ( palette )
|
Loading…
Reference in New Issue