0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-11-01 12:02:39 +00:00
uxn/projects/software/nasu.usm

530 lines
13 KiB
Text
Raw Normal View History

2021-03-05 19:08:19 +00:00
(
app/nasu : spritesheet editor
2021-03-03 19:49:26 +00:00
2021-03-05 19:08:19 +00:00
arrows - move selection
2021-03-20 19:25:26 +00:00
left-click - add pixel
right-click - remove pixel
1 2 3 - select brush
2021-03-05 18:38:18 +00:00
)
2021-03-16 18:25:26 +00:00
%RTN { JMP2r }
2021-03-26 18:19:19 +00:00
%RTN? { #00 EQU #02 JNZ STH2r JMP2 }
2021-03-20 04:22:51 +00:00
%STEP8 { #0033 SFT2 }
2021-03-16 18:25:26 +00:00
%++ { #0001 ADD2 }
2021-03-20 04:13:09 +00:00
%2/ { #0001 SFT2 } %2* { #0010 SFT2 }
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
2021-03-16 18:25:26 +00:00
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
2021-03-20 04:00:41 +00:00
%SFL { #40 SFT SFT }
2021-03-16 04:29:44 +00:00
2021-03-21 20:58:32 +00:00
( variables )
2021-03-14 01:34:08 +00:00
;bankview { x 2 y 2 mode 1 addr 2 }
;tileview { x 2 y 2 addr 2 }
;rect { x1 2 y1 2 x2 2 y2 2 }
;mouse { x 2 y 2 }
;color { byte 1 }
;i { byte 1 }
;pt { x 1 y 1 }
;addr { short 2 }
;pos { x 2 y 2 }
2021-03-03 19:49:26 +00:00
2021-03-21 20:58:32 +00:00
( devices )
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|0130 ;Controller { buttons 1 }
|0140 ;Keys { key 1 }
|0150 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|01F0 ;System { pad 8 r 2 g 2 b 2 }
2021-03-21 20:58:32 +00:00
2021-03-28 17:19:06 +00:00
|0200 ,RESET JMP2
|0204 ,ERROR JMP2
|0208 ,FRAME JMP2
2021-03-21 20:58:32 +00:00
( program )
2021-03-28 17:19:06 +00:00
@RESET
( theme ) #e0fc =System.r #30cc =System.g #30ac =System.b
2021-03-20 19:25:26 +00:00
~Screen.width 2/ #008a SUB2 =bankview.x
~Screen.height 2/ #003f SUB2 =bankview.y
,bank =bankview.addr
2021-03-04 17:07:33 +00:00
2021-03-20 19:25:26 +00:00
~Screen.width 2/ #0002 ADD2 =tileview.x
~Screen.height 2/ #003f SUB2 =tileview.y
,bank #0448 ADD2 =tileview.addr
,filepath ,load-file JSR2
2021-03-03 19:49:26 +00:00
2021-03-11 03:41:46 +00:00
,redraw JSR2
2021-03-03 19:49:26 +00:00
BRK
2021-03-04 17:07:33 +00:00
@FRAME
2021-03-05 04:15:01 +00:00
2021-03-04 17:07:33 +00:00
( keyboard controls )
2021-03-27 01:18:16 +00:00
~Keys #00 EQU ^$no-key JNZ
2021-03-05 19:08:19 +00:00
2021-03-27 01:18:16 +00:00
~Keys #31 LTH ^$no-key JNZ
~Keys #33 GTH ^$no-key JNZ
2021-03-20 19:25:26 +00:00
( select ) ~Keys #31 SUB =bankview.mode
( release ) #00 =Keys
2021-03-11 03:41:46 +00:00
,redraw JSR2
2021-03-05 18:38:18 +00:00
2021-03-27 01:18:16 +00:00
$no-key
~Controller.buttons #00 EQU ^$no-ctrl JNZ
~Controller.buttons
DUP #10 EQU ^$no-ctrl-up JNZ
~tileview.addr #0080 ADD2 =tileview.addr $no-ctrl-up
DUP #20 EQU ^$no-ctrl-down JNZ
~tileview.addr #0080 SUB2 =tileview.addr $no-ctrl-down
DUP #40 EQU ^$no-ctrl-left JNZ
~tileview.addr 8+ =tileview.addr $no-ctrl-left
DUP #80 EQU ^$no-ctrl-right JNZ
~tileview.addr 8- =tileview.addr $no-ctrl-right
POP
2021-03-04 17:07:33 +00:00
~tileview.addr #0800 DIV2 #0800 MUL2 =bankview.addr
2021-03-11 03:41:46 +00:00
,redraw JSR2
2021-03-04 01:43:39 +00:00
2021-03-27 01:18:16 +00:00
$no-ctrl
2021-03-03 21:49:25 +00:00
2021-03-04 17:07:33 +00:00
( mouse controls )
2021-03-27 01:18:16 +00:00
~Mouse.state #00 EQU ,$click-end JNZ2
2021-03-03 21:49:25 +00:00
2021-03-04 17:46:14 +00:00
( toolbar )
2021-03-27 01:18:16 +00:00
~Mouse.y ~bankview.y #0010 SUB2 SUB2 8/ #0000 NEQ2 ,$no-toolbar-click JNZ2
2021-03-05 18:19:27 +00:00
( brush )
2021-03-27 01:18:16 +00:00
~Mouse.x ~bankview.x SUB2 8/ #000d LTH2 ^$no-brush-click JNZ
~Mouse.x ~bankview.x SUB2 8/ #000f GTH2 ^$no-brush-click JNZ
2021-03-16 18:25:26 +00:00
( select ) ~mouse.x ~bankview.x SUB2 8/ #000d SUB2 SWP POP =bankview.mode
2021-03-20 19:25:26 +00:00
( release ) #00 =Mouse.state
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-brush-click
2021-03-27 11:30:23 +00:00
~Mouse.x ~tileview.x SUB2 8/ #000e NEQ2 ^$no-load-click JNZ
2021-03-20 19:25:26 +00:00
( load ) ,filepath =File.name #0800 =File.length ~bankview.addr =File.load
( release ) #00 =Mouse.state
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-load-click
2021-03-27 11:30:23 +00:00
~Mouse.x ~tileview.x SUB2 8/ #000f NEQ2 ^$no-save-click JNZ
2021-03-20 19:25:26 +00:00
( save ) ,filepath =File.name #0800 =File.length ~bankview.addr =File.save
( release ) #00 =Mouse.state
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-save-click
$no-toolbar-click
2021-03-05 04:15:01 +00:00
2021-03-04 17:07:33 +00:00
( bankview )
2021-03-20 19:25:26 +00:00
~Mouse.x ~bankview.x GTH2 ~Mouse.x ~bankview.x #0080 ADD2 LTH2 #0101 EQU2
~Mouse.y ~bankview.y GTH2 ~Mouse.y ~bankview.y #0080 ADD2 LTH2 #0101 EQU2
2021-03-27 01:18:16 +00:00
#0101 NEQ2 ,$no-bank-click JNZ2
2021-03-03 21:49:25 +00:00
2021-03-27 01:18:16 +00:00
~bankview.mode #01 NEQ ^$not-copy-mode JNZ
2021-03-04 17:46:14 +00:00
#00 =i
2021-03-27 01:18:16 +00:00
$copy-loop
2021-03-24 16:39:19 +00:00
( load ) ~tileview.addr ~i ADD PEK2
2021-03-04 17:46:14 +00:00
( get touch addr )
2021-03-20 19:25:26 +00:00
~Mouse.x ~bankview.x SUB2 STEP8
~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
2021-03-24 16:39:19 +00:00
~bankview.addr ADD2 #00 ~i ADD2 POK2
2021-03-04 17:46:14 +00:00
( incr ) ~i #01 ADD =i
2021-03-27 01:18:16 +00:00
~i #08 LTH ^$copy-loop JNZ
,redraw JSR2 ,$click-end JMP2
$not-copy-mode
2021-03-04 17:46:14 +00:00
2021-03-27 01:18:16 +00:00
~bankview.mode #02 NEQ ^$not-erase-mode JNZ
2021-03-04 17:46:14 +00:00
#00 =i
2021-03-27 01:18:16 +00:00
$erase-loop
2021-03-04 17:46:14 +00:00
#00
( get touch addr )
2021-03-20 19:25:26 +00:00
~Mouse.x ~bankview.x SUB2 STEP8
~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
2021-03-24 16:39:19 +00:00
~bankview.addr ADD2 #00 ~i ADD2 POK2
2021-03-04 17:46:14 +00:00
( incr ) ~i #01 ADD =i
2021-03-27 01:18:16 +00:00
~i #08 LTH ^$erase-loop JNZ
,redraw JSR2 ,$click-end JMP2
$not-erase-mode
2021-03-04 17:46:14 +00:00
2021-03-20 19:25:26 +00:00
~Mouse.x ~bankview.x SUB2 STEP8
~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
2021-03-04 17:07:33 +00:00
~bankview.addr ADD2 =tileview.addr
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
2021-03-05 04:15:01 +00:00
2021-03-27 01:18:16 +00:00
$no-bank-click
2021-03-04 04:24:29 +00:00
2021-03-04 17:07:33 +00:00
( tileview )
2021-03-20 19:25:26 +00:00
~Mouse.x ~tileview.x GTH2 ~Mouse.x ~tileview.x #0080 ADD2 LTH2 #0101 EQU2
~Mouse.y ~tileview.y GTH2 ~Mouse.y ~tileview.y #0080 ADD2 LTH2 #0101 EQU2
2021-03-27 01:18:16 +00:00
#0101 NEQ2 ,$no-tile-click JNZ2
2021-03-05 04:15:01 +00:00
2021-03-20 19:25:26 +00:00
~Mouse.x ~tileview.x SUB2 STEP8 #0040 DIV2
~Mouse.y ~tileview.y SUB2 STEP8 #0040 DIV2 2* ADD2
2021-03-16 18:25:26 +00:00
8*
2021-03-04 17:07:33 +00:00
~tileview.addr ADD2 =addr ( addr offset )
2021-03-20 19:25:26 +00:00
~Mouse.x ~tileview.x SUB2 ~Mouse.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x
~Mouse.y ~tileview.y SUB2 ~Mouse.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y
2021-03-27 01:18:16 +00:00
~Mouse.state #10 NEQ ^$no-erase-mode JNZ
2021-03-24 16:39:19 +00:00
( load ) ~addr ~pos.y 8/ ADD2 PEK2
2021-03-20 04:00:41 +00:00
( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL
2021-03-20 04:13:09 +00:00
#ff EOR AND
2021-03-24 16:39:19 +00:00
( save ) ~addr ~pos.y 8/ ADD2 POK2
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-erase-mode
2021-03-24 16:39:19 +00:00
( load ) ~addr ~pos.y 8/ ADD2 PEK2
2021-03-20 04:00:41 +00:00
( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL
2021-03-19 03:53:47 +00:00
ORA
2021-03-24 16:39:19 +00:00
( save ) ~addr ~pos.y 8/ ADD2 POK2
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
2021-03-05 04:15:01 +00:00
2021-03-27 01:18:16 +00:00
$no-tile-click
2021-03-03 21:49:25 +00:00
2021-03-06 19:44:18 +00:00
( operations )
2021-03-27 01:18:16 +00:00
~Mouse.y ~tileview.y SUB2 8/ #000c NEQ2 ,$no-operations JNZ2
2021-03-06 19:44:18 +00:00
2021-03-27 01:18:16 +00:00
~Mouse.x ~tileview.x SUB2 8/ #0011 NEQ2 ^$no-move-up JNZ
2021-03-11 03:41:46 +00:00
,op_shiftup JSR2
2021-03-20 19:25:26 +00:00
( release ) #00 =Mouse.state
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-move-up
2021-03-06 19:44:18 +00:00
2021-03-27 01:18:16 +00:00
~Mouse.x ~tileview.x SUB2 8/ #0012 NEQ2 ^$no-move-down JNZ
2021-03-11 03:41:46 +00:00
,op_shiftdown JSR2
2021-03-20 19:25:26 +00:00
( release ) #00 =Mouse.state
2021-03-27 01:18:16 +00:00
,redraw JSR2 ,$click-end JMP2
$no-move-down
2021-03-06 19:44:18 +00:00
2021-03-27 01:18:16 +00:00
$no-operations
2021-03-06 19:44:18 +00:00
2021-03-27 01:18:16 +00:00
$click-end
2021-03-03 19:49:26 +00:00
2021-03-11 03:41:46 +00:00
,draw-cursor JSR2
2021-03-03 19:49:26 +00:00
2021-03-05 04:15:01 +00:00
BRK
2021-03-03 19:49:26 +00:00
2021-03-20 19:25:26 +00:00
@load-file ( path )
=File.name #0800 =File.length ,bank =File.load
RTN
2021-03-06 19:44:18 +00:00
@op_shiftup
2021-03-24 16:39:19 +00:00
~tileview.addr PEK2
~tileview.addr #0001 ADD2 PEK2 ~tileview.addr POK2
~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0001 ADD2 POK2
~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
~tileview.addr #0007 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
~tileview.addr #0007 ADD2 POK2
2021-03-06 19:44:18 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-06 19:44:18 +00:00
@op_shiftdown
2021-03-24 16:39:19 +00:00
~tileview.addr #0007 ADD2 PEK2
~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0007 ADD2 POK2
~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
~tileview.addr #0001 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
~tileview.addr PEK2 ~tileview.addr #0001 ADD2 POK2
~tileview.addr POK2
2021-03-06 19:44:18 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-06 19:44:18 +00:00
2021-03-03 21:49:25 +00:00
@redraw
2021-03-11 03:41:46 +00:00
,draw-bankview JSR2
,draw-tileview JSR2
2021-03-03 21:49:25 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 21:49:25 +00:00
2021-03-03 19:49:26 +00:00
@draw-bankview
2021-03-11 03:41:46 +00:00
~bankview.x #0002 SUB2 ~bankview.y #0002 SUB2 ~bankview.x #0081 ADD2 ~bankview.y #0081 ADD2 #03 ,line-rect JSR2
2021-03-03 19:49:26 +00:00
( position )
2021-03-20 19:25:26 +00:00
~bankview.x =Sprite.x
~bankview.y #0010 SUB2 =Sprite.y
2021-03-11 03:41:46 +00:00
~bankview.addr ,draw-short JSR2
2021-03-03 19:49:26 +00:00
2021-03-04 17:07:33 +00:00
( toolbar )
2021-03-20 19:25:26 +00:00
~bankview.x #0068 ADD2 =Sprite.x
~bankview.y #0010 SUB2 =Sprite.y
,tool_selector =Sprite.addr
#01 ~bankview.mode #00 EQU ADD =Sprite.color
2021-03-04 17:07:33 +00:00
2021-03-20 19:25:26 +00:00
~Sprite.x 8+ =Sprite.x
,tool_hand =Sprite.addr
#01 ~bankview.mode #01 EQU ADD =Sprite.color
2021-03-04 17:07:33 +00:00
2021-03-20 19:25:26 +00:00
~Sprite.x 8+ =Sprite.x
,tool_eraser =Sprite.addr
#01 ~bankview.mode #02 EQU ADD =Sprite.color
2021-03-04 17:07:33 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x #0070 ADD2 =Sprite.x
,load_icn =Sprite.addr
#01 =Sprite.color
2021-03-05 18:19:27 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x #0078 ADD2 =Sprite.x
,save_icn =Sprite.addr
#01 =Sprite.color
2021-03-05 04:15:01 +00:00
2021-03-03 19:49:26 +00:00
( guides )
2021-03-20 19:25:26 +00:00
#00 =i ,font_hex =Sprite.addr
2021-03-11 23:47:28 +00:00
$guides
2021-03-20 19:25:26 +00:00
~bankview.x #0010 SUB2 =Sprite.x
~bankview.y #00 ~i #08 MUL ADD2 =Sprite.y
( draw ) #02 =Sprite.color
~bankview.x #00 ~i #08 MUL ADD2 =Sprite.x
~bankview.y #0088 ADD2 =Sprite.y
( draw ) #02 =Sprite.color
~Sprite.addr 8+ =Sprite.addr
2021-03-03 19:49:26 +00:00
( incr ) ~i #01 ADD =i
2021-03-27 01:18:16 +00:00
~i #10 LTH ^$guides JNZ
2021-03-03 19:49:26 +00:00
( body )
2021-03-20 19:25:26 +00:00
~bankview.x =Sprite.x ~bankview.y =Sprite.y
#00 =pt.x #00 =pt.y ~bankview.addr =Sprite.addr
2021-03-11 23:47:28 +00:00
$ver
2021-03-03 19:49:26 +00:00
#00 =pt.x
2021-03-20 19:25:26 +00:00
~bankview.x =Sprite.x
2021-03-11 23:47:28 +00:00
$hor
2021-03-24 16:39:19 +00:00
( draw ) #01
~Sprite.addr ~tileview.addr LTH2
~Sprite.addr ~tileview.addr #0018 ADD2 GTH2
#0000 EQU2 #06 MUL ADD =Sprite.color
2021-03-20 19:25:26 +00:00
( incr ) ~Sprite.x 8+ =Sprite.x
( incr ) ~Sprite.addr 8+ =Sprite.addr
2021-03-03 19:49:26 +00:00
( incr ) ~pt.x #01 ADD =pt.x
2021-03-26 18:19:19 +00:00
~pt.x #10 LTH ,$hor JNZ2
2021-03-03 19:49:26 +00:00
( incr ) ~pt.y #01 ADD =pt.y
2021-03-20 19:25:26 +00:00
( incr ) ~Sprite.y 8+ =Sprite.y
2021-03-26 18:19:19 +00:00
~pt.y #10 LTH ,$ver JNZ2
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
@draw-tileview
2021-03-11 03:41:46 +00:00
~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR2
2021-03-04 01:43:39 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x #0028 ADD2 =Sprite.x
~tileview.y #0010 SUB2 =Sprite.y
~tileview.addr =Sprite.addr
#03 =Sprite.color
2021-03-03 19:49:26 +00:00
( position )
2021-03-20 19:25:26 +00:00
~tileview.x =Sprite.x
~tileview.y #0010 SUB2 =Sprite.y
2021-03-11 03:41:46 +00:00
~tileview.addr ,draw-short JSR2
2021-03-03 19:49:26 +00:00
( body )
2021-03-20 19:25:26 +00:00
~tileview.x =Sprite.x
~tileview.y =Sprite.y
2021-03-03 21:49:25 +00:00
~tileview.addr =tileview.addr
2021-03-11 03:41:46 +00:00
,draw-tileview-icn JSR2
2021-03-03 19:49:26 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x #0040 ADD2 =Sprite.x
~tileview.y =Sprite.y
2021-03-16 18:25:26 +00:00
~tileview.addr 8+ =tileview.addr
2021-03-11 03:41:46 +00:00
,draw-tileview-icn JSR2
2021-03-03 19:49:26 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x =Sprite.x
~tileview.y #0040 ADD2 =Sprite.y
2021-03-16 18:25:26 +00:00
~tileview.addr 8+ =tileview.addr
2021-03-11 03:41:46 +00:00
,draw-tileview-icn JSR2
2021-03-03 19:49:26 +00:00
2021-03-20 19:25:26 +00:00
~tileview.x #0040 ADD2 =Sprite.x
~tileview.y #0040 ADD2 =Sprite.y
2021-03-16 18:25:26 +00:00
~tileview.addr 8+ =tileview.addr
2021-03-11 03:41:46 +00:00
,draw-tileview-icn JSR2
2021-03-03 19:49:26 +00:00
2021-03-04 01:43:39 +00:00
( line hor )
2021-03-20 19:25:26 +00:00
~tileview.y #003f ADD2 =Screen.y
~tileview.x =Screen.x
2021-03-11 23:47:28 +00:00
$line-hor
2021-03-20 19:25:26 +00:00
( draw ) #03 =Screen.color
( incr ) ~Screen.x #0002 ADD2 =Screen.x
2021-03-27 01:18:16 +00:00
~Screen.x ~tileview.x #0082 ADD2 LTH2 ^$line-hor JNZ
2021-03-03 19:49:26 +00:00
2021-03-04 01:43:39 +00:00
( line ver )
2021-03-20 19:25:26 +00:00
~tileview.y =Screen.y
~tileview.x #003f ADD2 =Screen.x
2021-03-11 23:47:28 +00:00
$line-ver
2021-03-20 19:25:26 +00:00
( draw ) #03 =Screen.color
( incr ) ~Screen.y #0002 ADD2 =Screen.y
2021-03-27 01:18:16 +00:00
~Screen.y ~tileview.y #0081 ADD2 LTH2 ^$line-ver JNZ
2021-03-03 19:49:26 +00:00
2021-03-04 01:43:39 +00:00
( rewind ) ~tileview.addr #0018 SUB2 =tileview.addr
2021-03-03 21:49:25 +00:00
2021-03-04 01:43:39 +00:00
( bytes )
2021-03-03 21:49:25 +00:00
2021-03-20 19:25:26 +00:00
~tileview.y #0018 ADD2 =Sprite.y
2021-03-04 01:43:39 +00:00
#00 =i
2021-03-11 23:47:28 +00:00
$bytes
2021-03-20 19:25:26 +00:00
~tileview.x #0088 ADD2 =Sprite.x
2021-03-24 16:39:19 +00:00
,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x
2021-03-24 16:39:19 +00:00
,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
2021-03-04 01:43:39 +00:00
( incr ) ~i #01 ADD =i
2021-03-20 19:25:26 +00:00
( incr ) ~Sprite.y 8+ =Sprite.y
2021-03-26 18:19:19 +00:00
~i #08 LTH ,$bytes JNZ2
2021-03-03 21:49:25 +00:00
2021-03-06 19:44:18 +00:00
( operations )
2021-03-20 19:25:26 +00:00
~Sprite.y 8+ =Sprite.y
,movedown_icn =Sprite.addr
#01 =Sprite.color
~Sprite.x 8- =Sprite.x
,moveup_icn =Sprite.addr
#01 =Sprite.color
2021-03-06 19:44:18 +00:00
( draw tiles )
2021-03-20 19:25:26 +00:00
~tileview.y =Sprite.y
#00 =pt.x #00 =pt.y ~tileview.addr =Sprite.addr
2021-03-03 21:49:25 +00:00
2021-03-11 23:47:28 +00:00
$tiles-ver
2021-03-03 21:49:25 +00:00
#00 =pt.x
2021-03-20 19:25:26 +00:00
~tileview.x #0088 ADD2 =Sprite.x
2021-03-11 23:47:28 +00:00
$tiles-hor
2021-03-20 19:25:26 +00:00
( draw ) #03 =Sprite.color
( incr ) ~Sprite.x 8+ =Sprite.x
( incr ) ~Sprite.addr 8+ =Sprite.addr
2021-03-03 21:49:25 +00:00
( incr ) ~pt.x #01 ADD =pt.x
2021-03-26 18:19:19 +00:00
~pt.x #02 LTH ,$tiles-hor JNZ2
2021-03-03 21:49:25 +00:00
( incr ) ~pt.y #01 ADD =pt.y
2021-03-20 19:25:26 +00:00
( incr ) ~Sprite.y 8+ =Sprite.y
2021-03-26 18:19:19 +00:00
~pt.y #02 LTH ,$tiles-ver JNZ2
2021-03-04 01:43:39 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
@draw-tileview-icn
#00 =pt.x #00 =pt.y
2021-03-11 23:47:28 +00:00
$ver
2021-03-03 19:49:26 +00:00
#00 =pt.x
2021-03-11 23:47:28 +00:00
$hor
2021-03-03 19:49:26 +00:00
( get bit )
2021-03-04 01:43:39 +00:00
,blank_icn #00
2021-03-24 16:39:19 +00:00
~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit )
2021-03-20 19:25:26 +00:00
8* ADD2 =Sprite.addr ( add *8 )
( draw ) #01 =Sprite.color
( incr ) ~Sprite.x 8+ =Sprite.x
2021-03-03 19:49:26 +00:00
( incr ) ~pt.x #01 ADD =pt.x
2021-03-26 18:19:19 +00:00
~pt.x #08 LTH ,$hor JNZ2
2021-03-20 19:25:26 +00:00
( incr ) ~Sprite.y 8+ =Sprite.y
2021-03-03 19:49:26 +00:00
( incr ) ~pt.y #01 ADD =pt.y
2021-03-20 19:25:26 +00:00
~Sprite.x #0040 SUB2 =Sprite.x
2021-03-26 18:19:19 +00:00
~pt.y #08 LTH ,$ver JNZ2
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
@draw-cursor
2021-03-27 11:30:23 +00:00
~mouse.x ~Mouse.x NEQ2
~mouse.y ~Mouse.y NEQ2
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
#0000 EQU2 RTN? ( Return if unchanged )
2021-03-03 19:49:26 +00:00
( clear last cursor )
2021-03-20 19:25:26 +00:00
~mouse.x =Sprite.x
~mouse.y =Sprite.y
,blank_icn =Sprite.addr
#10 =Sprite.color
2021-03-04 17:07:33 +00:00
2021-03-03 19:49:26 +00:00
( record mouse positions )
2021-03-20 19:25:26 +00:00
~Mouse.x =mouse.x
~Mouse.y =mouse.y
2021-03-04 17:07:33 +00:00
( draw new cursor )
2021-03-20 19:25:26 +00:00
~mouse.x =Sprite.x
~mouse.y =Sprite.y
,tool_selector #00 ~bankview.mode #08 MUL ADD2 =Sprite.addr
#12 =Sprite.color
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
@draw-short ( short )
=addr
2021-03-24 16:39:19 +00:00
,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x
2021-03-24 16:39:19 +00:00
,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x
2021-03-24 16:39:19 +00:00
,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x
2021-03-24 16:39:19 +00:00
,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
2021-03-20 19:25:26 +00:00
( draw ) #02 =Sprite.color
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
( Utils )
@line-rect ( x1 y1 x2 y2 color )
2021-03-20 19:25:26 +00:00
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
2021-03-27 01:18:16 +00:00
$hor
2021-03-20 19:25:26 +00:00
( incr ) ~Screen.x ++ =Screen.x
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
2021-03-27 01:18:16 +00:00
~Screen.x ~rect.x2 LTH2 ^$hor JNZ
2021-03-20 19:25:26 +00:00
~rect.y1 =Screen.y
2021-03-27 01:18:16 +00:00
$ver
2021-03-20 19:25:26 +00:00
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
( incr ) ~Screen.y ++ =Screen.y
2021-03-27 01:18:16 +00:00
~Screen.y ~rect.y2 ++ LTH2 ^$ver JNZ
2021-03-03 19:49:26 +00:00
2021-03-14 21:26:17 +00:00
RTN
2021-03-03 19:49:26 +00:00
2021-03-04 01:43:39 +00:00
@tool_selector [ 80c0 e0f0 f8e0 1000 ]
@tool_hand [ 4040 4070 f8f8 f870 ]
2021-03-04 18:08:42 +00:00
@tool_eraser [ 2050 b87c 3e1c 0800 ]
2021-03-05 04:15:01 +00:00
@blank_icn [ 0000 0000 0000 0000 ]
@cell1_icn [ 7cfe fefe fefe 7c00 ]
2021-03-05 18:19:27 +00:00
@load_icn [ feaa d6aa d4aa f400 ]
@save_icn [ fe82 8282 848a f400 ]
2021-03-06 19:44:18 +00:00
@moveup_icn [ 0010 387c fe10 1000 ]
@movedown_icn [ 0010 1010 fe7c 3810 ]
2021-03-20 19:25:26 +00:00
@filepath [ projects/fonts/specter8.bit 00 ]
2021-03-03 19:49:26 +00:00
@font_hex ( 0-F )
[
2021-03-06 19:44:18 +00: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
007c 8280 f080 827c 007c 8280 f080 8080
2021-03-03 19:49:26 +00:00
]
2021-03-21 21:16:19 +00:00
@ERROR BRK
2021-03-03 19:49:26 +00:00
2021-03-24 16:39:19 +00:00
|2000 @bank [ ]