Added zoom toggle controls to emulator

This commit is contained in:
neauoire 2021-03-24 09:39:19 -07:00
parent fe5aa44816
commit 1f9155400d
13 changed files with 180 additions and 392 deletions

View File

@ -12,6 +12,11 @@ To build the Uxn emulator, you must have [SDL2](https://wiki.libsdl.org/).
--cli # Run rom without graphics --cli # Run rom without graphics
``` ```
## Emulator Controls
- `ctrl+h` toggle debugger
- `alt+h` toggle zoom
## Uxambly ## Uxambly
Read more in the [Uxambly Guide](https://wiki.xxiivv.com/site/uxambly.html). Read more in the [Uxambly Guide](https://wiki.xxiivv.com/site/uxambly.html).

View File

@ -28,7 +28,7 @@ else
fi fi
echo "Assembling.." echo "Assembling.."
./bin/assembler projects/examples/dev.screen.usm bin/boot.rom ./bin/assembler projects/software/noodle.usm bin/boot.rom
echo "Running.." echo "Running.."
if [ "${2}" = '--cli' ]; if [ "${2}" = '--cli' ];

View File

@ -22,9 +22,9 @@ BRK
@print-label ( text ) @print-label ( text )
$loop NOP $loop NOP
( send ) DUP2 LDR =Console.char ( send ) DUP2 PEK2 =Console.char
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( loop ) DUP2 LDR #00 NEQ ^$loop MUL JMP ( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP
POP2 POP2
RTN RTN

View File

@ -24,9 +24,9 @@ BRK
@print-label ( text ) @print-label ( text )
$loop NOP $loop NOP
( send ) DUP2 LDR =Console.char ( send ) DUP2 PEK2 =Console.char
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( loop ) DUP2 LDR #00 NEQ ^$loop MUL JMP ( loop ) DUP2 PEK2 #00 NEQ ^$loop MUL JMP
POP2 POP2
RTN RTN

View File

@ -1,69 +1,40 @@
( Mouse ) ( draw routines )
%RTN { JMP2r } %RTN { JMP2r }
%++ { #0001 ADD2 }
%-- { #0001 SUB2 }
%8+ { #0008 ADD2 }
%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? }
;label { x 2 y 2 color 1 addr 2 }
;cat { x 2 y 2 }
;pointer { x 2 y 2 }
;color { byte 1 } ;color { byte 1 }
;timer { byte 1 } ;pointer { x 2 y 2 }
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
( devices ) |0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|0110 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|0150 ;Mouse { x 2 y 2 state 1 chord 1 } |0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|01F0 .RESET .FRAME .ERROR ( vectors ) |01F0 .RESET .FRAME .ERROR ( vectors )
|01F8 [ 0f85 0fd5 0fb5 ] ( palette ) |01F8 [ 13fd 1ef3 1bf2 ] ( palette )
( program )
|0200 @RESET |0200 @RESET
( position cat )
~Screen.width #0002 DIV2 =cat.x
~Screen.height #0038 SUB2 =cat.y
#01 =color
( draw polycat )
,draw-polycat JSR2
BRK BRK
@FRAME @FRAME
( clear )
~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
,draw-cursor JSR2 ,draw-cursor JSR2
( reset timer -> move cat tail ) ,$no-touch ~Mouse.state #00 EQU JMP2?
,no-click ~Mouse.state #00 EQU JMP2? ~Mouse.x =circle.xc
#50 =timer ~Mouse.y =circle.yc
@no-click #0000 =circle.r
( detect click ) $no-touch
,no-click12 ~Mouse.state #11 NEQ JMP2?
#0058 #0040 #01 ,mouse12_text ,draw-label JSR2 ( draw )
#10 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2 ~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
~color ,mouse12_icn #0048 #0040 ,draw-sprite JSR2
,end-click JMP2
@no-click12
,no-click1 ~Mouse.state #01 NEQ JMP2?
#0058 #0040 #01 ,mouse1_text ,draw-label JSR2
#12 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2
~color ,mouse1_icn #0048 #0040 ,draw-sprite JSR2
,end-click JMP2
@no-click1
,no-click2 ~Mouse.state #10 NEQ JMP2?
#0058 #0040 #01 ,mouse2_text ,draw-label JSR2
#13 ,cursor_icn ~pointer.x ~pointer.y ,draw-sprite JSR2
~color ,mouse2_icn #0048 #0040 ,draw-sprite JSR2
,end-click JMP2
@no-click2
( default )
#0058 #0040 #01 ,mouse0_text ,draw-label JSR2
~color ,mouse0_icn #0048 #0040 ,draw-sprite JSR2
@end-click
( animate )
,animate-polycat JSR2
( update last pos )
~timer #01 ADD =timer
BRK BRK
@ -86,148 +57,37 @@ BRK
RTN RTN
@draw-polycat @draw-circle ( xc yc r color )
( ears ) ( load ) =color =circle.r =circle.yc =circle.xc
,polycat ~cat.x ~cat.y ,draw-sprite-chr JSR2 #0000 =circle.x ~circle.r =circle.y
,polycat #0010 ADD2 ~cat.x #0008 ADD2 ~cat.y ,draw-sprite-chr JSR2 ~circle.r #0002 MUL2 #0003 SUB2 =circle.d
( eye ) ( draw ) ,$seg JSR2
,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
( body )
,polycat #00a0 ADD2 ~cat.x ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
RTN
@animate-polycat
( tail )
~timer #50 NEQ ,animate-polycat-tail-next0 ROT JMP2?
,polycat #00c0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
@animate-polycat-tail-next0
~timer #58 NEQ ,animate-polycat-tail-next1 ROT JMP2?
,polycat #00d0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
@animate-polycat-tail-next1
~timer #60 NEQ ,animate-polycat-tail-next2 ROT JMP2?
,polycat #00b0 ADD2 ~cat.x #0008 ADD2 ~cat.y #0010 ADD2 ,draw-sprite-chr JSR2
@animate-polycat-tail-next2
( look-at )
~pointer.x ~cat.x #0008 ADD2 GTH2 ,animate-polycat-right ROT JMP2?
~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-left-down ROT JMP2?
,polycat #0040 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
,polycat #0050 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
RTN
@animate-polycat-left-down
,polycat #0020 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
,polycat #0030 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
RTN
@animate-polycat-right
~pointer.y ~cat.y #0008 ADD2 GTH2 ,animate-polycat-right-down ROT JMP2?
,polycat #0060 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
,polycat #0070 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
RTN
@animate-polycat-right-down
,polycat #0080 ADD2 ~cat.x ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
,polycat #0090 ADD2 ~cat.x #0008 ADD2 ~cat.y #0008 ADD2 ,draw-sprite-chr JSR2
RTN
RTN
@draw-label ( x y color addr )
( load ) =label.addr =label.color =Sprite.y =Sprite.x
~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( incr ) ~circle.x ++ =circle.x
( incr ) #0001 ADD2 ,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( decr ) ~circle.y -- =circle.y
DUP2 #0001 ADD2 LDR #00 NEQ ,$loop ROT JMP2? ~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
POP2 ,$end JMP2
$else
~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
$end
( draw ) ,$seg JSR2
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
RTN
$seg
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
RTN RTN
@draw-sprite @ERROR BRK
=Sprite.y
=Sprite.x
=Sprite.addr
=Sprite.color
RTN
@draw-sprite-chr
=Sprite.y
=Sprite.x
=Sprite.addr
#20 =Sprite.color
RTN
@clear_icn [ 0000 0000 0000 0000 ] @clear_icn [ 0000 0000 0000 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ] @cursor_icn [ 80c0 e0f0 f8e0 1000 ]
@mouse0_icn [ 7c82 92ee 8282 4438 ]
@mouse1_icn [ 7cf2 f2ee 8282 4438 ]
@mouse2_icn [ 7c9e 9eee 8282 4438 ]
@mouse12_icn [ 7cfe feee 8282 4438 ]
@polycat [
081c 3e3e 7f7f ffff 081c 3e3e 7f7f fffc
081c 3c3e 7e7e ffff 081c 3c3e 7e7e ff1f
ffff ffff ff7f 3f0f f0e7 cfef f77c 3f0f
ffff ffff fffe fcf0 0783 c1c3 871e fcf0
ffff ffff ff7f 3f0f f7ef cfe7 f07c 3f0f
ffff ffff fffe fcf0 87c3 c183 071e fcf0
ffff ffff ff7f 3f0f f0e1 c1e0 f07c 3f0f
ffff ffff fffe fcf0 f7fb f9f3 071e fcf0
ffff ffff ff7f 3f0f f0e0 c1e1 f07c 3f0f
ffff ffff fffe fcf0 07f3 f9fb f71e fcf0
0307 0707 0302 0200 0307 0707 0300 0000
c0f0 f0e0 e080 8000 c0f2 f9f9 fef8 b000
c0f0 f0e0 e080 8000 c0f2 faf9 fef8 b000
c0f0 f0e0 e080 8000 c0f1 faf9 fef8 b000
]
@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
]
@mouse0_text [ no 20 click 00 ]
@mouse1_text [ mouse 1_ 00 ]
@mouse2_text [ mouse _2 00 ]
@mouse12_text [ mouse 12 00 ]
@ERROR BRK

View File

@ -199,16 +199,16 @@ RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ~addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #04 =Sprite.color ( draw ) #04 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ~addr LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #04 =Sprite.color ( draw ) #04 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ~addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #04 =Sprite.color ( draw ) #04 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ~addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #04 =Sprite.color ( draw ) #04 =Sprite.color
RTN RTN
@ -275,10 +275,10 @@ RTN
( load ) =label.addr =color =Sprite.y =Sprite.x ~label.addr ( load ) =label.addr =color =Sprite.y =Sprite.x ~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color
( incr ) ++ ( incr ) ++
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
DUP2 LDR #00 NEQ ,$loop ROT JMP2? DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
POP2 POP2
RTN RTN

View File

@ -52,10 +52,10 @@ BRK
,no-click ~Mouse.state #00 EQU JMP2? ,no-click ~Mouse.state #00 EQU JMP2?
( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 LDR ( load ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 PEK2
( mask ) #01 #07 ~Mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB #40 SFT SFT ( mask ) #01 #07 ~Mouse.x ~editor.x1 SUB2 #0008 DIV2 SWP POP SUB #40 SFT SFT
ORA ORA
( save ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 STR ( save ) ~editor.addr ~Mouse.y ~editor.y1 SUB2 #0008 DIV2 ADD2 POK2
,draw-window JSR2 ,draw-window JSR2
,draw-editor JSR2 ,draw-editor JSR2
@ -88,7 +88,7 @@ RTN
$hor $hor
( get bit ) ( get bit )
,cell0_icn #00 ,cell0_icn #00
~editor.addr #00 ~pixel.y ADD2 LDR #07 ~pixel.x SUB SFT #01 AND ( get bit ) ~editor.addr #00 ~pixel.y ADD2 PEK2 #07 ~pixel.x SUB SFT #01 AND ( get bit )
#0008 MUL2 ADD2 =Sprite.addr ( add *8 ) #0008 MUL2 ADD2 =Sprite.addr ( add *8 )
( draw ) #08 =Sprite.color ( draw ) #08 =Sprite.color
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
@ -109,10 +109,10 @@ RTN
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Sprite.y =Sprite.x
~label.addr ~label.addr
$loop NOP $loop NOP
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x ( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
DUP2 LDR #00 NEQ ^$loop MUL JMP DUP2 PEK2 #00 NEQ ^$loop MUL JMP
POP2 POP2
RTN RTN

View File

@ -38,10 +38,10 @@ BRK
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Sprite.y =Sprite.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
DUP2 LDR #00 NEQ ,$loop ROT JMP2? DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
POP2 POP2
RTN RTN
@ -52,10 +52,10 @@ RTN
( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Sprite.x ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Sprite.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
DUP2 LDR #00 NEQ ,$loop ROT JMP2? DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
POP2 POP2
RTN RTN
@ -66,10 +66,10 @@ RTN
( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Sprite.x ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Sprite.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
DUP2 LDR #00 NEQ ,$loop ROT JMP2? DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
POP2 POP2
RTN RTN
@ -79,7 +79,7 @@ RTN
#0000 ( counter ) #0000 ( counter )
$loop $loop
( incr ) #0001 ADD2 OVR2 OVR2 ADD2 ( incr ) #0001 ADD2 OVR2 OVR2 ADD2
LDR #00 NEQ ,$loop ROT JMP2? PEK2 #00 NEQ ,$loop ROT JMP2?
SWP2 POP2 SWP2 POP2
RTN RTN

View File

@ -1,93 +0,0 @@
( draw routines )
%RTN { JMP2r }
%++ { #0001 ADD2 }
%-- { #0001 SUB2 }
%8+ { #0008 ADD2 }
%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? }
;color { byte 1 }
;pointer { x 2 y 2 }
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|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 }
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|01F0 .RESET .FRAME .ERROR ( vectors )
|01F8 [ 13fd 1ef3 1bf2 ] ( palette )
|0200 @RESET
BRK
@FRAME
( clear )
~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
,draw-cursor JSR2
,$no-touch ~Mouse.state #00 EQU JMP2?
~Mouse.x =circle.xc
~Mouse.y =circle.yc
#0000 =circle.r
$no-touch
( draw )
~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
BRK
@draw-cursor
( clear last cursor )
,clear_icn =Sprite.addr
~pointer.x =Sprite.x
~pointer.y =Sprite.y
#10 =Sprite.color
( record pointer positions )
~Mouse.x =pointer.x ~Mouse.y =pointer.y
( draw new cursor )
,cursor_icn =Sprite.addr
~pointer.x =Sprite.x
~pointer.y =Sprite.y
#11 =Sprite.color
RTN
@draw-circle ( xc yc r color )
( load ) =color =circle.r =circle.yc =circle.xc
#0000 =circle.x ~circle.r =circle.y
~circle.r #0002 MUL2 #0003 SUB2 =circle.d
( draw ) ,$seg JSR2
$loop
( incr ) ~circle.x ++ =circle.x
,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
( decr ) ~circle.y -- =circle.y
~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
,$end JMP2
$else
~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
$end
( draw ) ,$seg JSR2
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
RTN
$seg
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.x SUB2 =Screen.x ~circle.yc ~circle.y SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x ADD2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y ADD2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
~circle.xc ~circle.y SUB2 =Screen.x ~circle.yc ~circle.x SUB2 =Screen.y ~color =Screen.color
RTN
@ERROR BRK
@clear_icn [ 0000 0000 0000 0000 ]
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]

View File

@ -150,7 +150,7 @@ BRK
( insert ) ( insert )
~selection.to ~selection.from SUB2 ,shift-right JSR2 ~selection.to ~selection.from SUB2 ,shift-right JSR2
~Keys ~selection.from STR ~Keys ~selection.from POK2
~selection.from ++ =selection.from ~selection.from ++ =selection.from
$keys-end $keys-end
@ -254,7 +254,7 @@ RTN
,document.body =document.eof ,document.body =document.eof
$loop NOP $loop NOP
( incr ) ~document.eof ++ =document.eof ( incr ) ~document.eof ++ =document.eof
~document.eof LDR #00 NEQ ^$loop MUL JMP ~document.eof PEK2 #00 NEQ ^$loop MUL JMP
RTN RTN
@ -279,7 +279,7 @@ RTN
=i =i
~selection.from -- =j ( start -> end ) ~selection.from -- =j ( start -> end )
$loop NOP $loop NOP
( move ) ~j ~i ADD2 LDR ~j STR ( move ) ~j ~i ADD2 PEK2 ~j POK2
( incr ) ~j ++ =j ( incr ) ~j ++ =j
~j ~document.eof LTH2 ^$loop MUL JMP ~j ~document.eof LTH2 ^$loop MUL JMP
~document.eof ~i SUB2 =document.eof ~document.eof ~i SUB2 =document.eof
@ -291,7 +291,7 @@ RTN
=i =i
~document.eof =j ( end -> start ) ~document.eof =j ( end -> start )
$loop NOP $loop NOP
( move ) ~j ~i SUB2 LDR ~j STR ( move ) ~j ~i SUB2 PEK2 ~j POK2
( decr ) ~j -- =j ( decr ) ~j -- =j
~j ~selection.from GTH2 ^$loop MUL JMP ~j ~selection.from GTH2 ^$loop MUL JMP
~document.eof ~i ADD2 =document.eof ~document.eof ~i ADD2 =document.eof
@ -319,10 +319,10 @@ RTN
@goto-linestart @goto-linestart
$loop NOP $loop NOP
~selection.from -- LDR #0a EQU RTN? ~selection.from -- PEK2 #0a EQU RTN?
~selection.from -- LDR #0d EQU RTN? ~selection.from -- PEK2 #0d EQU RTN?
( decr ) ~selection.from DUP2 =selection.to -- =selection.from ( decr ) ~selection.from DUP2 =selection.to -- =selection.from
~selection.from LDR #00 NEQ ^$loop MUL JMP ~selection.from PEK2 #00 NEQ ^$loop MUL JMP
( clamp at document body ) ( clamp at document body )
~selection.from ,document.body GTH2 RTN? ~selection.from ,document.body GTH2 RTN?
,document.body DUP2 =selection.from ++ =selection.to ,document.body DUP2 =selection.from ++ =selection.to
@ -332,10 +332,10 @@ RTN
@goto-lineend @goto-lineend
$loop NOP $loop NOP
~selection.from LDR #0a EQU RTN? ~selection.from PEK2 #0a EQU RTN?
~selection.from LDR #0d EQU RTN? ~selection.from PEK2 #0d EQU RTN?
( incr ) ~selection.from ++ DUP2 ++ =selection.to =selection.from ( incr ) ~selection.from ++ DUP2 ++ =selection.to =selection.from
~selection.from LDR #00 NEQ ^$loop MUL JMP ~selection.from PEK2 #00 NEQ ^$loop MUL JMP
( clamp at document body ) ( clamp at document body )
~selection.from ,document.eof LTH2 RTN? ~selection.from ,document.eof LTH2 RTN?
,document.eof -- DUP2 =selection.from ++ =selection.to ,document.eof -- DUP2 =selection.from ++ =selection.to
@ -347,9 +347,9 @@ RTN
~selection.to =j ~selection.to =j
$loop NOP $loop NOP
( decr ) ~j -- =j ( decr ) ~j -- =j
,$end ~j LDR #20 EQU JMP2? ,$end ~j PEK2 #20 EQU JMP2?
,$end ~j LDR #0a EQU JMP2? ,$end ~j PEK2 #0a EQU JMP2?
,$end ~j LDR #0d EQU JMP2? ,$end ~j PEK2 #0d EQU JMP2?
~j ,document.body GTH2 ^$loop MUL JMP ~j ,document.body GTH2 ^$loop MUL JMP
$end $end
( return ) ~j -- ( return ) ~j --
@ -361,9 +361,9 @@ RTN
~selection.to =j ~selection.to =j
$loop NOP $loop NOP
( incr ) ~j ++ =j ( incr ) ~j ++ =j
,$end ~j LDR #20 EQU JMP2? ,$end ~j PEK2 #20 EQU JMP2?
,$end ~j LDR #0a EQU JMP2? ,$end ~j PEK2 #0a EQU JMP2?
,$end ~j LDR #0d EQU JMP2? ,$end ~j PEK2 #0d EQU JMP2?
~j ,document.body GTH2 ^$loop MUL JMP ~j ,document.body GTH2 ^$loop MUL JMP
$end $end
( return ) ~j ++ ( return ) ~j ++
@ -375,8 +375,8 @@ RTN
#0000 =j #0000 =j
$loop NOP $loop NOP
( incr ) ~j ++ =j ( incr ) ~j ++ =j
,$end ~selection.from ~j SUB2 LDR #0a EQU JMP2? ,$end ~selection.from ~j SUB2 PEK2 #0a EQU JMP2?
,$end ~selection.from ~j SUB2 LDR #0d EQU JMP2? ,$end ~selection.from ~j SUB2 PEK2 #0d EQU JMP2?
~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP ~selection.from ~j SUB2 ,document.body GTH2 ^$loop MUL JMP
$end $end
( return ) ~j ( return ) ~j
@ -388,11 +388,11 @@ RTN
,document.body =j #0000 =pt.y ,document.body =j #0000 =pt.y
$loop NOP $loop NOP
,$end ~pt.y ~position.y -- GTH2 JMP2? ,$end ~pt.y ~position.y -- GTH2 JMP2?
,$no-space ~j LDR #0a NEQ ~j LDR #0d NEQ #0101 EQU2 JMP2? ,$no-space ~j PEK2 #0a NEQ ~j PEK2 #0d NEQ #0101 EQU2 JMP2?
( incr ) ~pt.y ++ =pt.y ( incr ) ~pt.y ++ =pt.y
$no-space $no-space
( incr ) ~j ++ =j ( incr ) ~j ++ =j
~j LDR #00 NEQ ^$loop MUL JMP ~j PEK2 #00 NEQ ^$loop MUL JMP
$end $end
( return ) ~j ( return ) ~j
@ -403,8 +403,8 @@ RTN
,find-line JSR2 ( find line ) ,find-line JSR2 ( find line )
#0000 =pt.x #0000 =pt.x
$loop NOP $loop NOP
,$end ~j ~pt.x ADD2 LDR #0a EQU JMP2? ,$end ~j ~pt.x ADD2 PEK2 #0a EQU JMP2?
,$end ~j ~pt.x ADD2 LDR #0d EQU JMP2? ,$end ~j ~pt.x ADD2 PEK2 #0d EQU JMP2?
( incr ) ~pt.x ++ =pt.x ( incr ) ~pt.x ++ =pt.x
~pt.x ~position.x -- LTH2 ^$loop MUL JMP ~pt.x ~position.x -- LTH2 ^$loop MUL JMP
$end $end
@ -426,7 +426,7 @@ RTN
~selection.to ~selection.from SUB2 =j ( end ) ~selection.to ~selection.from SUB2 =j ( end )
~j =clip.len ~j =clip.len
$loop NOP $loop NOP
~selection.from ~i ADD2 LDR ,clip.body ~i ADD2 STR ~selection.from ~i ADD2 PEK2 ,clip.body ~i ADD2 POK2
( incr ) ~i ++ =i ( incr ) ~i ++ =i
~i ~j LTH2 ^$loop MUL JMP ~i ~j LTH2 ^$loop MUL JMP
@ -438,7 +438,7 @@ RTN
#0000 =i ( start ) #0000 =i ( start )
~clip.len =j ( end ) ~clip.len =j ( end )
$loop NOP $loop NOP
,clip.body ~i ADD2 LDR ~selection.from ~i ADD2 STR ,clip.body ~i ADD2 PEK2 ~selection.from ~i ADD2 POK2
( incr ) ~i ++ =i ( incr ) ~i ++ =i
~i ~j LTH2 ^$loop MUL JMP ~i ~j LTH2 ^$loop MUL JMP
@ -448,7 +448,7 @@ RTN
,document.body =selection.from #0000 =pt.x #0000 =pt.y ,document.body =selection.from #0000 =pt.x #0000 =pt.y
$loop $loop
,$no-space ~selection.from LDR #0a NEQ ~selection.from LDR #0d NEQ #0101 EQU2 JMP2? ,$no-space ~selection.from PEK2 #0a NEQ ~selection.from PEK2 #0d NEQ #0101 EQU2 JMP2?
( incr ) ~pt.y ++ =pt.y ( incr ) ~pt.y ++ =pt.y
#0000 =pt.x #0000 =pt.x
$no-space $no-space
@ -458,7 +458,7 @@ RTN
$no-reached $no-reached
( incr ) ~pt.x ++ =pt.x ( incr ) ~pt.x ++ =pt.x
( incr ) ~selection.from ++ =selection.from ( incr ) ~selection.from ++ =selection.from
,$loop ~selection.from LDR #00 NEQ JMP2? ,$loop ~selection.from PEK2 #00 NEQ JMP2?
RTN RTN
@ -484,16 +484,16 @@ RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #0e =Sprite.color ( draw ) #0e =Sprite.color
RTN RTN
@ -531,11 +531,11 @@ RTN
#0000 =j ( j is linebreaks ) #0000 =j ( j is linebreaks )
$find-offset NOP $find-offset NOP
,$find-offset-end ~scroll.y ~j EQU2 JMP2? ,$find-offset-end ~scroll.y ~j EQU2 JMP2?
,$no-break ~textarea.addr LDR #0a NEQ ~textarea.addr LDR #0d NEQ #0101 EQU2 JMP2? ,$no-break ~textarea.addr PEK2 #0a NEQ ~textarea.addr PEK2 #0d NEQ #0101 EQU2 JMP2?
( incr ) ~j ++ =j ( incr ) ~j ++ =j
$no-break $no-break
( incr ) ~textarea.addr ++ =textarea.addr ( incr ) ~textarea.addr ++ =textarea.addr
~textarea.addr LDR #00 NEQ ^$find-offset MUL JMP ~textarea.addr PEK2 #00 NEQ ^$find-offset MUL JMP
$find-offset-end $find-offset-end
#0018 =Sprite.x #0000 =Sprite.y #0018 =Sprite.x #0000 =Sprite.y
@ -546,14 +546,14 @@ RTN
,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2? ,$end ~Sprite.y ~Screen.height #0010 SUB2 GTH2 JMP2?
( get character ) ( get character )
,font #00 ~i LDR #20 SUB 8* ADD2 =Sprite.addr ,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr
( draw ) #01 ( draw ) #01
~i ~selection.from -- GTH2 ~i ~selection.from -- GTH2
~i ~selection.to LTH2 #0101 EQU2 ~i ~selection.to LTH2 #0101 EQU2
#05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color #05 MUL ADD ~i ~selection.from EQU2 ADD =Sprite.color
,$no-linebreak ~i LDR #0a NEQ ~i LDR #0d NEQ #0101 EQU2 JMP2? ,$no-linebreak ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 JMP2?
( draw linebreak ) ( draw linebreak )
,linebreak_icn =Sprite.addr ,linebreak_icn =Sprite.addr
( draw ) #02 ( draw ) #02
@ -585,7 +585,7 @@ RTN
( incr ) ~i ++ =i ( incr ) ~i ++ =i
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x ( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
,$loop ~i LDR #00 NEQ JMP2? ,$loop ~i PEK2 #00 NEQ JMP2?
$end $end
@ -623,10 +623,10 @@ RTN
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Sprite.y =Sprite.x
~label.addr ~label.addr
$loop NOP $loop NOP
( draw ) DUP2 LDR #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
( incr ) ++ ( incr ) ++
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
DUP2 LDR #00 NEQ ^$loop MUL JMP DUP2 PEK2 #00 NEQ ^$loop MUL JMP
POP2 POP2
( selection ) ( selection )
~selection.from ,document.body SUB2 ,draw-short JSR2 ~selection.from ,document.body SUB2 ,draw-short JSR2

View File

@ -130,11 +130,11 @@ BRK
,not-copy-mode ~bankview.mode #01 NEQ JMP2? ,not-copy-mode ~bankview.mode #01 NEQ JMP2?
#00 =i #00 =i
@copy-loop NOP @copy-loop NOP
( load ) ~tileview.addr ~i ADD LDR ( load ) ~tileview.addr ~i ADD PEK2
( get touch addr ) ( get touch addr )
~Mouse.x ~bankview.x SUB2 STEP8 ~Mouse.x ~bankview.x SUB2 STEP8
~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2 ~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
~bankview.addr ADD2 #00 ~i ADD2 STR ~bankview.addr ADD2 #00 ~i ADD2 POK2
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
~i #08 LTH ^copy-loop MUL JMP ~i #08 LTH ^copy-loop MUL JMP
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@ -147,7 +147,7 @@ BRK
( get touch addr ) ( get touch addr )
~Mouse.x ~bankview.x SUB2 STEP8 ~Mouse.x ~bankview.x SUB2 STEP8
~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2 ~Mouse.y ~bankview.y SUB2 STEP8 #0010 MUL2 ADD2
~bankview.addr ADD2 #00 ~i ADD2 STR ~bankview.addr ADD2 #00 ~i ADD2 POK2
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
~i #08 LTH ^erase-loop MUL JMP ~i #08 LTH ^erase-loop MUL JMP
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@ -173,16 +173,16 @@ BRK
~Mouse.x ~tileview.x SUB2 ~Mouse.x ~tileview.x SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.x ~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 ~Mouse.y ~tileview.y SUB2 ~Mouse.y ~tileview.y SUB2 #0040 DIV2 #0040 MUL2 SUB2 =pos.y
,no-erase-mode ~Mouse.state #10 NEQ JMP2? ,no-erase-mode ~Mouse.state #10 NEQ JMP2?
( load ) ~addr ~pos.y 8/ ADD2 LDR ( load ) ~addr ~pos.y 8/ ADD2 PEK2
( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL ( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL
#ff EOR AND #ff EOR AND
( save ) ~addr ~pos.y 8/ ADD2 STR ( save ) ~addr ~pos.y 8/ ADD2 POK2
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-erase-mode @no-erase-mode
( load ) ~addr ~pos.y 8/ ADD2 LDR ( load ) ~addr ~pos.y 8/ ADD2 PEK2
( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL ( mask ) #01 #07 ~pos.x 8/ SWP POP SUB SFL
ORA ORA
( save ) ~addr ~pos.y 8/ ADD2 STR ( save ) ~addr ~pos.y 8/ ADD2 POK2
,redraw JSR2 ,click-end JMP2 ,redraw JSR2 ,click-end JMP2
@no-tile-click @no-tile-click
@ -219,29 +219,29 @@ RTN
@op_shiftup @op_shiftup
~tileview.addr LDR ~tileview.addr PEK2
~tileview.addr #0001 ADD2 LDR ~tileview.addr STR ~tileview.addr #0001 ADD2 PEK2 ~tileview.addr POK2
~tileview.addr #0002 ADD2 LDR ~tileview.addr #0001 ADD2 STR ~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0001 ADD2 POK2
~tileview.addr #0003 ADD2 LDR ~tileview.addr #0002 ADD2 STR ~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
~tileview.addr #0004 ADD2 LDR ~tileview.addr #0003 ADD2 STR ~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
~tileview.addr #0005 ADD2 LDR ~tileview.addr #0004 ADD2 STR ~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
~tileview.addr #0006 ADD2 LDR ~tileview.addr #0005 ADD2 STR ~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
~tileview.addr #0007 ADD2 LDR ~tileview.addr #0006 ADD2 STR ~tileview.addr #0007 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
~tileview.addr #0007 ADD2 STR ~tileview.addr #0007 ADD2 POK2
RTN RTN
@op_shiftdown @op_shiftdown
~tileview.addr #0007 ADD2 LDR ~tileview.addr #0007 ADD2 PEK2
~tileview.addr #0006 ADD2 LDR ~tileview.addr #0007 ADD2 STR ~tileview.addr #0006 ADD2 PEK2 ~tileview.addr #0007 ADD2 POK2
~tileview.addr #0005 ADD2 LDR ~tileview.addr #0006 ADD2 STR ~tileview.addr #0005 ADD2 PEK2 ~tileview.addr #0006 ADD2 POK2
~tileview.addr #0004 ADD2 LDR ~tileview.addr #0005 ADD2 STR ~tileview.addr #0004 ADD2 PEK2 ~tileview.addr #0005 ADD2 POK2
~tileview.addr #0003 ADD2 LDR ~tileview.addr #0004 ADD2 STR ~tileview.addr #0003 ADD2 PEK2 ~tileview.addr #0004 ADD2 POK2
~tileview.addr #0002 ADD2 LDR ~tileview.addr #0003 ADD2 STR ~tileview.addr #0002 ADD2 PEK2 ~tileview.addr #0003 ADD2 POK2
~tileview.addr #0001 ADD2 LDR ~tileview.addr #0002 ADD2 STR ~tileview.addr #0001 ADD2 PEK2 ~tileview.addr #0002 ADD2 POK2
~tileview.addr LDR ~tileview.addr #0001 ADD2 STR ~tileview.addr PEK2 ~tileview.addr #0001 ADD2 POK2
~tileview.addr STR ~tileview.addr POK2
RTN RTN
@ -307,11 +307,10 @@ RTN
#00 =pt.x #00 =pt.x
~bankview.x =Sprite.x ~bankview.x =Sprite.x
$hor $hor
( draw ) #01 =Sprite.color ( draw ) #01
,$no-highlight ~Sprite.addr ~tileview.addr LTH2 JMP2? ~Sprite.addr ~tileview.addr LTH2
,$no-highlight ~Sprite.addr ~tileview.addr #0018 ADD2 GTH2 JMP2? ~Sprite.addr ~tileview.addr #0018 ADD2 GTH2
( draw ) #0c =Sprite.color #0000 EQU2 #06 MUL ADD =Sprite.color
$no-highlight
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Sprite.addr 8+ =Sprite.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
@ -383,10 +382,10 @@ RTN
#00 =i #00 =i
$bytes $bytes
~tileview.x #0088 ADD2 =Sprite.x ~tileview.x #0088 ADD2 =Sprite.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Sprite.y 8+ =Sprite.y
@ -428,7 +427,7 @@ RTN
$hor $hor
( get bit ) ( get bit )
,blank_icn #00 ,blank_icn #00
~tileview.addr #00 ~pt.y ADD2 LDR #07 ~pt.x SUB SFT #01 AND ( get bit ) ~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit )
8* ADD2 =Sprite.addr ( add *8 ) 8* ADD2 =Sprite.addr ( add *8 )
( draw ) #01 =Sprite.color ( draw ) #01 =Sprite.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Sprite.x 8+ =Sprite.x
@ -469,16 +468,16 @@ RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
~Sprite.x 8+ =Sprite.x ~Sprite.x 8+ =Sprite.x
,font_hex #00 ,addr ++ LDR #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
( draw ) #02 =Sprite.color ( draw ) #02 =Sprite.color
RTN RTN
@ -527,4 +526,4 @@ RTN
@ERROR BRK @ERROR BRK
@bank [ ] |2000 @bank [ ]

View File

@ -228,7 +228,7 @@ BRK
( from ) ,data ( from ) ,data
( to ) ~canvas.w ~canvas.h MUL2 #0008 MUL2 ,data ADD2 ( to ) ~canvas.w ~canvas.h MUL2 #0008 MUL2 ,data ADD2
$loop NOP $loop NOP
OVR2 #00 ROT ROT STR OVR2 #00 ROT ROT POK2
( incr ) SWP2 #0001 ADD2 SWP2 ( incr ) SWP2 #0001 ADD2 SWP2
OVR2 OVR2 LTH2 ^$loop SWP JMP? OVR2 OVR2 LTH2 ^$loop SWP JMP?
POP2 POP2 POP2 POP2
@ -278,7 +278,7 @@ RTN
#00 =px.x #00 =px.x
$hor $hor
( addr ) ,size_icn #00 ~cursor.size 8* ADD2 ( addr ) ,size_icn #00 ~cursor.size 8* ADD2
( byte ) #00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND ( byte ) #00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND
#00 EQU ,$no-pixel ROT JMP2? #00 EQU ,$no-pixel ROT JMP2?
,$no-pixel ,patternize JSR2 #00 EQU JMP2? ,$no-pixel ,patternize JSR2 #00 EQU JMP2?
~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~cursor.oper JSR2 ~pt0.x #00 ~px.x ADD2 ~pt0.y #00 ~px.y ADD2 ~cursor.oper JSR2
@ -348,7 +348,7 @@ RTN
SWP POP #07 AND =px.x SWP POP #07 AND =px.x
( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ( get tile ) ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8*
( add addr ) ,data ADD2 ( add addr ) ,data ADD2
#00 ~px.y ADD2 LDR #07 ~px.x SUB SFT #01 AND #00 ~px.y ADD2 PEK2 #07 ~px.x SUB SFT #01 AND
RTN RTN
@ -356,9 +356,9 @@ RTN
=pt1.y =pt1.x =pt1.y =pt1.x
( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 ( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2
( load ) DUP2 LDR ( load ) DUP2 PEK2
( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL ORA ( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL ORA
( save ) ROT ROT STR ( save ) ROT ROT POK2
RTN RTN
@ -366,9 +366,9 @@ RTN
=pt1.y =pt1.x =pt1.y =pt1.x
( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2 ( get tile addr ) ,data ~pt1.x 8/ ~pt1.y 8/ ~canvas.w MUL2 ADD2 8* ~pt1.y MOD8 ADD2 ADD2
( load ) DUP2 LDR ( load ) DUP2 PEK2
( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL #ff EOR AND ( mask ) #01 #07 ~pt1.x MOD8 SWP POP SUB SFL #ff EOR AND
( save ) ROT ROT STR ( save ) ROT ROT POK2
RTN RTN

View File

@ -197,6 +197,21 @@ redraw(Uint32 *dst, Uxn *u)
screen.reqdraw = 0; screen.reqdraw = 0;
} }
void
toggledebug(Uxn *u)
{
GUIDES = !GUIDES;
redraw(pixels, u);
}
void
togglezoom(Uxn *u)
{
ZOOM = ZOOM == 3 ? 1 : ZOOM + 1;
SDL_SetWindowSize(gWindow, WIDTH * ZOOM, HEIGHT * ZOOM);
redraw(pixels, u);
}
void void
quit(void) quit(void)
{ {
@ -287,9 +302,11 @@ doctrl(Uxn *u, SDL_Event *event, int z)
{ {
Uint8 flag = 0x00; Uint8 flag = 0x00;
Uint16 addr = devctrl->addr; Uint16 addr = devctrl->addr;
if(z && event->key.keysym.sym == SDLK_h && SDL_GetModState() & KMOD_LCTRL) { if(z && event->key.keysym.sym == SDLK_h) {
GUIDES = !GUIDES; if(SDL_GetModState() & KMOD_LCTRL)
redraw(pixels, u); toggledebug(u);
if(SDL_GetModState() & KMOD_LALT)
togglezoom(u);
} }
switch(event->key.keysym.sym) { switch(event->key.keysym.sym) {
case SDLK_LCTRL: flag = 0x01; break; case SDLK_LCTRL: flag = 0x01; break;