Ported the examples
This commit is contained in:
parent
7761c3ee94
commit
47a57952e8
2
build.sh
2
build.sh
|
@ -28,7 +28,7 @@ else
|
|||
fi
|
||||
|
||||
echo "Assembling.."
|
||||
./bin/assembler projects/software/noodle.usm bin/boot.rom
|
||||
./bin/assembler projects/examples/gui.shapes.usm bin/boot.rom
|
||||
|
||||
echo "Running.."
|
||||
if [ "${2}" = '--cli' ];
|
||||
|
|
|
@ -10,9 +10,10 @@
|
|||
|
||||
( devices )
|
||||
|
||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||
|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 }
|
||||
|0130 ;Controller { buttons 1 }
|
||||
|0130 ;Controller { p1 1 }
|
||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
||||
|01F8 [ 0daf 02ff 035f ] ( palette )
|
||||
|
||||
|
@ -29,28 +30,33 @@ BRK
|
|||
|
||||
@FRAME
|
||||
|
||||
~Controller.buttons #f0 AND #00 EQU BRK?
|
||||
,on-ctrl-arrows ~Controller.p1 JNZ2
|
||||
|
||||
BRK
|
||||
|
||||
@on-ctrl-arrows
|
||||
|
||||
#0a =slime
|
||||
,default_icn =Sprite.addr
|
||||
|
||||
( hold ctrl key to change slime color )
|
||||
|
||||
~Controller.buttons #0f AND
|
||||
DUP #01 NEQ ,$no-ctrl ROT JMP2? #05 =slime $no-ctrl
|
||||
DUP #02 NEQ ,$no-alt ROT JMP2? #0f =slime $no-alt
|
||||
~Controller.p1 #0f AND
|
||||
DUP #01 NEQ ,$no-ctrl ROT JNZ2 #05 =slime $no-ctrl
|
||||
DUP #02 NEQ ,$no-alt ROT JNZ2 #0f =slime $no-alt
|
||||
POP
|
||||
|
||||
( clear ) #10 =Sprite.color
|
||||
|
||||
( detect movement )
|
||||
~Controller.buttons #f0 AND
|
||||
DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JMP2?
|
||||
~Controller.p1 #f0 AND
|
||||
DUP #04 SFT #01 AND #01 NEQ ,$no-up ROT JNZ2
|
||||
( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up
|
||||
DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JMP2?
|
||||
DUP #05 SFT #01 AND #01 NEQ ,$no-down ROT JNZ2
|
||||
( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down
|
||||
DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JMP2?
|
||||
DUP #06 SFT #01 AND #01 NEQ ,$no-left ROT JNZ2
|
||||
( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left
|
||||
DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JMP2?
|
||||
DUP #07 SFT #01 AND #01 NEQ ,$no-right ROT JNZ2
|
||||
( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right
|
||||
POP
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
$loop
|
||||
,text1 ,print-label JSR2
|
||||
,scramble JSR2
|
||||
#01 SUB DUP ,$loop ROT JMP2?
|
||||
#01 SUB DUP ,$loop ROT JNZ2
|
||||
|
||||
BRK
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
~Keys #00 EQU BRK?
|
||||
|
||||
,$no-return ~Keys #0d NEQ JMP2?
|
||||
,$no-return ~Keys #0d NEQ JNZ2
|
||||
#0000 =Sprite.x
|
||||
( incr ) ~Sprite.y 8+ =Sprite.y
|
||||
( release ) #00 =Keys
|
||||
|
|
|
@ -27,10 +27,11 @@ BRK
|
|||
|
||||
,draw-cursor JSR2
|
||||
|
||||
,$no-touch ~Mouse.state #00 EQU JMP2?
|
||||
,$no-touch ~Mouse.state #00 EQU JNZ2
|
||||
~Mouse.x =circle.xc
|
||||
~Mouse.y =circle.yc
|
||||
#0000 =circle.r
|
||||
|
||||
$no-touch
|
||||
|
||||
( draw )
|
||||
|
@ -53,7 +54,7 @@ BRK
|
|||
,cursor_icn =Sprite.addr
|
||||
~pointer.x =Sprite.x
|
||||
~pointer.y =Sprite.y
|
||||
#11 =Sprite.color
|
||||
#11 ~Mouse.state #00 NEQ ADD =Sprite.color
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -65,7 +66,7 @@ RTN
|
|||
( draw ) ,$seg JSR2
|
||||
$loop
|
||||
( incr ) ~circle.x ++ =circle.x
|
||||
,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
|
||||
,$else ~circle.d #0000 #0001 ADD2 LTS2 JNZ2
|
||||
( decr ) ~circle.y -- =circle.y
|
||||
~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
|
||||
,$end JMP2
|
||||
|
@ -73,7 +74,7 @@ RTN
|
|||
~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
|
||||
$end
|
||||
( draw ) ,$seg JSR2
|
||||
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
|
||||
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JNZ2
|
||||
RTN
|
||||
$seg
|
||||
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
$draw-hor NOP
|
||||
( draw ) #01 =Screen.color
|
||||
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2
|
||||
OVR2 OVR2 LTH2 ^$draw-hor SWP JMP?
|
||||
OVR2 OVR2 LTH2 ^$draw-hor SWP JNZ
|
||||
POP2 POP2
|
||||
|
||||
( draw ver line )
|
||||
|
@ -62,7 +62,7 @@
|
|||
$draw-ver NOP
|
||||
( draw ) #02 =Screen.color
|
||||
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2
|
||||
OVR2 OVR2 LTH2 ^$draw-ver SWP JMP?
|
||||
OVR2 OVR2 LTH2 ^$draw-ver SWP JNZ
|
||||
POP2 POP2
|
||||
|
||||
( draw blending modes )
|
||||
|
@ -72,7 +72,7 @@
|
|||
( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x
|
||||
( draw ) OVR =Sprite.color
|
||||
( incr ) SWP #01 ADD SWP
|
||||
DUP2 LTH ^$draw-blends SWP JMP?
|
||||
DUP2 LTH ^$draw-blends SWP JNZ
|
||||
POP POP
|
||||
|
||||
,update-theme JSR2
|
||||
|
@ -82,28 +82,28 @@ BRK
|
|||
|
||||
@FRAME
|
||||
|
||||
,$no-touch ~Mouse.state #00 EQU JMP2?
|
||||
,$no-touch ~Mouse.state #00 EQU JNZ2
|
||||
|
||||
~Mouse.y ~window.y1 SUB2 STEP8
|
||||
|
||||
DUP2 #0010 NEQ2 ,$no-touch-red ROT JMP2?
|
||||
,$no-touch-red ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JMP2?
|
||||
,$no-touch-red ~Mouse.x ~window.x1 #008c ADD2 GTH2 JMP2?
|
||||
DUP2 #0010 NEQ2 ,$no-touch-red ROT JNZ2
|
||||
,$no-touch-red ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2
|
||||
,$no-touch-red ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2
|
||||
( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.r1 #00 ~selection ADD2 POK2
|
||||
$no-touch-red
|
||||
DUP2 #0020 NEQ2 ,$no-touch-green ROT JMP2?
|
||||
,$no-touch-green ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JMP2?
|
||||
,$no-touch-green ~Mouse.x ~window.x1 #008c ADD2 GTH2 JMP2?
|
||||
DUP2 #0020 NEQ2 ,$no-touch-green ROT JNZ2
|
||||
,$no-touch-green ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2
|
||||
,$no-touch-green ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2
|
||||
( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.g1 #00 ~selection ADD2 POK2
|
||||
$no-touch-green
|
||||
DUP2 #0030 NEQ2 ,$no-touch-blue ROT JMP2?
|
||||
,$no-touch-blue ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JMP2?
|
||||
,$no-touch-blue ~Mouse.x ~window.x1 #008c ADD2 GTH2 JMP2?
|
||||
DUP2 #0030 NEQ2 ,$no-touch-blue ROT JNZ2
|
||||
,$no-touch-blue ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2
|
||||
,$no-touch-blue ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2
|
||||
( get new value ) ~Mouse.x ~window.x1 SUB2 #0050 SUB2 #0004 DIV2 S2B ,theme.b1 #00 ~selection ADD2 POK2
|
||||
$no-touch-blue
|
||||
DUP2 #0040 NEQ2 ,$no-touch-radio ROT JMP2?
|
||||
,$no-touch-radio ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JMP2?
|
||||
,$no-touch-radio ~Mouse.x ~window.x1 #008c ADD2 GTH2 JMP2?
|
||||
DUP2 #0040 NEQ2 ,$no-touch-radio ROT JNZ2
|
||||
,$no-touch-radio ~Mouse.x ~window.x1 #0050 ADD2 LTH2 JNZ2
|
||||
,$no-touch-radio ~Mouse.x ~window.x1 #008c ADD2 GTH2 JNZ2
|
||||
~Mouse.x ~window.x1 SUB2 #0050 SUB2 STEP8 2/ #0008 DIV2 S2B =selection
|
||||
$no-touch-radio
|
||||
|
||||
|
@ -228,7 +228,7 @@ RTN
|
|||
$loop
|
||||
( incr ) ~Sprite.x 8+ =Sprite.x
|
||||
( draw ) #05 =Sprite.color
|
||||
,$loop ~Sprite.x ~slider.x2 #0008 ADD2 LTH2 JMP2?
|
||||
,$loop ~Sprite.x ~slider.x2 #0008 ADD2 LTH2 JNZ2
|
||||
|
||||
( incr ) ~Sprite.x #0004 ADD2 =Sprite.x
|
||||
,sliderc_icn =Sprite.addr
|
||||
|
@ -248,9 +248,9 @@ RTN
|
|||
$hor
|
||||
( draw ) ~color =Screen.color
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JNZ2
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 LTH2 JMP2?
|
||||
,$ver ~Screen.y ~rect.y2 LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -261,13 +261,13 @@ RTN
|
|||
( incr ) ~Screen.x ++ =Screen.x
|
||||
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
||||
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JNZ2
|
||||
~rect.y1 =Screen.y
|
||||
$ver
|
||||
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
||||
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 ++ LTH2 JMP2?
|
||||
,$ver ~Screen.y ~rect.y2 ++ LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -278,7 +278,7 @@ RTN
|
|||
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color
|
||||
( incr ) ++
|
||||
( incr ) ~Sprite.x 8+ =Sprite.x
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JNZ2
|
||||
POP2
|
||||
|
||||
RTN
|
||||
|
|
|
@ -34,15 +34,15 @@ BRK
|
|||
|
||||
@FRAME
|
||||
|
||||
,no-ctrl ~Controller.buttons #00 EQU JMP2?
|
||||
,no-ctrl ~Controller.buttons #00 EQU JNZ2
|
||||
|
||||
,no-ctrl-up ~Controller.buttons #10 EQU JMP2?
|
||||
,no-ctrl-up ~Controller.buttons #10 EQU JNZ2
|
||||
~editor.addr #0001 ADD2 =editor.addr
|
||||
,draw-window JSR2
|
||||
,draw-editor JSR2
|
||||
@no-ctrl-up
|
||||
|
||||
,no-ctrl-down ~Controller.buttons #20 EQU JMP2?
|
||||
,no-ctrl-down ~Controller.buttons #20 EQU JNZ2
|
||||
~editor.addr #0001 SUB2 =editor.addr
|
||||
,draw-window JSR2
|
||||
,draw-editor JSR2
|
||||
|
@ -50,7 +50,7 @@ BRK
|
|||
|
||||
@no-ctrl
|
||||
|
||||
,no-click ~Mouse.state #00 EQU JMP2?
|
||||
,no-click ~Mouse.state #00 EQU JNZ2
|
||||
|
||||
( 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
|
||||
|
@ -93,10 +93,10 @@ RTN
|
|||
( draw ) #08 =Sprite.color
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
( incr ) ~pixel.x #01 ADD =pixel.x
|
||||
,$hor ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 JMP2?
|
||||
,$hor ~Sprite.x ~editor.x1 #0040 ADD2 LTH2 JNZ2
|
||||
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y
|
||||
( incr ) ~pixel.y #01 ADD =pixel.y
|
||||
,$ver ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 JMP2?
|
||||
,$ver ~Sprite.y ~editor.y1 #0040 ADD2 LTH2 JNZ2
|
||||
~editor.addr =Sprite.addr
|
||||
~window.y1 =Sprite.y
|
||||
~window.x2 #0008 SUB2 =Sprite.x
|
||||
|
@ -164,11 +164,6 @@ RTN
|
|||
|
||||
@draw-cursor
|
||||
|
||||
~pointer.x ~Mouse.x NEQU2
|
||||
~pointer.y ~Mouse.y NEQU2
|
||||
|
||||
#0000 EQU2 BRK? ( Return if unchanged )
|
||||
|
||||
( clear last cursor )
|
||||
,clear_icn =Sprite.addr
|
||||
~pointer.x =Sprite.x
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
( draw routines )
|
||||
|
||||
%RTN { JMP2r }
|
||||
%RTN? { #00 EQU #02 SWP JNZ STH2r JMP2 }
|
||||
|
||||
;color { byte 1 }
|
||||
;pointer { x 2 y 2 sprite 2 }
|
||||
|
@ -26,33 +27,28 @@ BRK
|
|||
|
||||
@FRAME
|
||||
|
||||
~pointer.x ~Mouse.x NEQU2
|
||||
~pointer.y ~Mouse.y NEQU2
|
||||
|
||||
#0000 EQU2 BRK? ( Return if unchanged )
|
||||
|
||||
,pointer_icn =pointer.sprite
|
||||
|
||||
#01 =color
|
||||
( matrix comparison )
|
||||
~Mouse.x ~r1.x1 GTH2 ~Mouse.x ~r1.x2 LTH2 #0101 EQU2
|
||||
~Mouse.y ~r1.y1 GTH2 ~Mouse.y ~r1.y2 LTH2 #0101 EQU2
|
||||
#0101 NEQ2 ,$draw1 ROT JMP2? #02 =color ,hand_icn =pointer.sprite
|
||||
#0101 NEQ2 ,$draw1 ROT JNZ2 #02 =color ,hand_icn =pointer.sprite
|
||||
$draw1 ~r1.x1 ~r1.y1 ~r1.x2 ~r1.y2 ~color ,line-rect JSR2
|
||||
|
||||
#01 =color
|
||||
( 2-step comparison )
|
||||
,$draw2 ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 JMP2?
|
||||
,$draw2 ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 JMP2?
|
||||
,$draw2 ~Mouse.x ~r2.x1 GTH2 ~Mouse.x ~r2.x2 LTH2 #0101 NEQ2 JNZ2
|
||||
,$draw2 ~Mouse.y ~r2.y1 GTH2 ~Mouse.y ~r2.y2 LTH2 #0101 NEQ2 JNZ2
|
||||
#03 =color ,hand_icn =pointer.sprite
|
||||
$draw2 ~r2.x1 ~r2.y1 ~r2.x2 ~r2.y2 ~color ,line-rect JSR2
|
||||
|
||||
#01 =color
|
||||
( 4-step comparison )
|
||||
,$draw3 ~Mouse.x ~r3.x1 LTH2 JMP2?
|
||||
,$draw3 ~Mouse.x ~r3.x2 GTH2 JMP2?
|
||||
,$draw3 ~Mouse.y ~r3.y1 LTH2 JMP2?
|
||||
,$draw3 ~Mouse.y ~r3.y2 GTH2 JMP2?
|
||||
,$draw3 ~Mouse.x ~r3.x1 LTH2 JNZ2
|
||||
,$draw3 ~Mouse.x ~r3.x2 GTH2 JNZ2
|
||||
,$draw3 ~Mouse.y ~r3.y1 LTH2 JNZ2
|
||||
,$draw3 ~Mouse.y ~r3.y2 GTH2 JNZ2
|
||||
#02 =color ,hand_icn =pointer.sprite
|
||||
$draw3 ~r3.x1 ~r3.y1 ~r3.x2 ~r3.y2 ~color ,line-rect JSR2
|
||||
|
||||
|
@ -86,13 +82,13 @@ RTN
|
|||
( incr ) ~Screen.x #0001 ADD2 =Screen.x
|
||||
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
||||
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JNZ2
|
||||
~rect.y1 =Screen.y
|
||||
$ver
|
||||
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
||||
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
||||
( incr ) ~Screen.y #0001 ADD2 =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JMP2?
|
||||
,$ver ~Screen.y ~rect.y2 #0001 ADD2 LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
$draw-ver
|
||||
( draw ) #02 =Screen.color
|
||||
( incr ) ~Screen.y #0002 ADD2 =Screen.y
|
||||
,$draw-ver ~Screen.y ~Screen.height LTH2 JMP2?
|
||||
,$draw-ver ~Screen.y ~Screen.height LTH2 JNZ2
|
||||
|
||||
~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR2
|
||||
~center.x ~center.y #0c ,text2 ,draw-label-middle JSR2
|
||||
|
@ -41,7 +41,7 @@ BRK
|
|||
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
||||
( incr ) #0001 ADD2
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JNZ2
|
||||
POP2
|
||||
|
||||
RTN
|
||||
|
@ -55,7 +55,7 @@ RTN
|
|||
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
||||
( incr ) #0001 ADD2
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JNZ2
|
||||
POP2
|
||||
|
||||
RTN
|
||||
|
@ -69,7 +69,7 @@ RTN
|
|||
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
||||
( incr ) #0001 ADD2
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JMP2?
|
||||
DUP2 PEK2 #00 NEQ ,$loop ROT JNZ2
|
||||
POP2
|
||||
|
||||
RTN
|
||||
|
@ -79,7 +79,7 @@ RTN
|
|||
#0000 ( counter )
|
||||
$loop
|
||||
( incr ) #0001 ADD2 OVR2 OVR2 ADD2
|
||||
PEK2 #00 NEQ ,$loop ROT JMP2?
|
||||
PEK2 #00 NEQ ,$loop ROT JNZ2
|
||||
SWP2 POP2
|
||||
|
||||
RTN
|
||||
|
|
|
@ -25,9 +25,9 @@ BRK
|
|||
( draw ) ~pict.color =Sprite.color
|
||||
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
|
||||
( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr
|
||||
,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2?
|
||||
,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JNZ2
|
||||
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y
|
||||
,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2?
|
||||
,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
%++ { #0001 ADD2 }
|
||||
%-- { #0001 SUB2 }
|
||||
%8+ { #0008 ADD2 }
|
||||
%ABS2 { DUP2 #000f SFT2 #ffff SWP2 SWP POP MUL2? }
|
||||
%ABS2 { DUP2 #000f SFT2 EQU #04 SWP JNZ #ffff MUL2 }
|
||||
|
||||
;label { x 2 y 2 color 1 addr 2 }
|
||||
;pict { x 2 y 2 width 2 height 2 color 1 addr 2 }
|
||||
;rect { x1 2 y1 2 x2 2 y2 2 }
|
||||
;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
|
||||
|
@ -33,11 +32,6 @@
|
|||
#0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR2
|
||||
#0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR2
|
||||
|
||||
#0028 #0068 #01 ,text ,draw-label JSR2
|
||||
#0038 #0078 #02 ,text ,draw-label JSR2
|
||||
#0048 #0088 #03 ,text ,draw-label JSR2
|
||||
#0058 #0098 #04 ,text ,draw-label JSR2
|
||||
|
||||
#0020 #0020 #0070 #0080 #01 ,draw-line JSR2
|
||||
#0020 #0080 #0070 #0030 #02 ,draw-line JSR2
|
||||
#00a0 #0020 #0050 #00b0 #03 ,draw-line JSR2
|
||||
|
@ -59,13 +53,13 @@ BRK
|
|||
~line.dx ~line.dy ADD2 =line.e1
|
||||
$loop
|
||||
~line.x =Screen.x ~line.y =Screen.y ~color =Screen.color
|
||||
,$end ~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 JMP2?
|
||||
,$end ~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 JNZ2
|
||||
~line.e1 #0002 MUL2 =line.e2
|
||||
,$skipy ~line.e2 ~line.dy LTS2 JMP2?
|
||||
,$skipy ~line.e2 ~line.dy LTS2 JNZ2
|
||||
~line.e1 ~line.dy ADD2 =line.e1
|
||||
~line.x ~line.sx ADD2 =line.x
|
||||
$skipy
|
||||
,$skipx ~line.e2 ~line.dx GTS2 JMP2?
|
||||
,$skipx ~line.e2 ~line.dx GTS2 JNZ2
|
||||
~line.e1 ~line.dx ADD2 =line.e1
|
||||
~line.y ~line.sy ADD2 =line.y
|
||||
$skipx
|
||||
|
@ -82,13 +76,13 @@ RTN
|
|||
( incr ) ~Screen.x ++ =Screen.x
|
||||
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
||||
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JNZ2
|
||||
~rect.y1 =Screen.y
|
||||
$ver
|
||||
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
||||
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 ++ LTH2 JMP2?
|
||||
,$ver ~Screen.y ~rect.y2 ++ LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -100,9 +94,9 @@ RTN
|
|||
$hor
|
||||
( draw ) ~color =Screen.color
|
||||
( incr ) ~Screen.x ++ =Screen.x
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JMP2?
|
||||
,$hor ~Screen.x ~rect.x2 LTH2 JNZ2
|
||||
( incr ) ~Screen.y ++ =Screen.y
|
||||
,$ver ~Screen.y ~rect.y2 LTH2 JMP2?
|
||||
,$ver ~Screen.y ~rect.y2 LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -115,21 +109,9 @@ RTN
|
|||
( draw ) ~pict.color =Sprite.color
|
||||
( incr ) ~Sprite.x 8+ =Sprite.x
|
||||
( incr ) ~Sprite.addr 8+ =Sprite.addr
|
||||
,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JMP2?
|
||||
,$hor ~Sprite.x ~pict.width ~pict.x ADD2 LTH2 JNZ2
|
||||
( incr ) ~Sprite.y 8+ =Sprite.y
|
||||
,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JMP2?
|
||||
|
||||
RTN
|
||||
|
||||
@draw-label ( x y color addr )
|
||||
|
||||
( load ) =label.addr =label.color =Sprite.y =Sprite.x ~label.addr
|
||||
$loop
|
||||
( draw ) DUP2 LDR #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
|
||||
( incr ) ++
|
||||
( incr ) ~Sprite.x 8+ =Sprite.x
|
||||
DUP2 LDR #00 NEQ ,$loop ROT JMP2?
|
||||
POP2
|
||||
,$ver ~Sprite.y ~pict.height ~pict.y ADD2 LTH2 JNZ2
|
||||
|
||||
RTN
|
||||
|
||||
|
@ -141,7 +123,7 @@ RTN
|
|||
( draw ) ,$seg JSR2
|
||||
$loop
|
||||
( incr ) ~circle.x ++ =circle.x
|
||||
,$else ~circle.d #0000 #0001 ADD2 LTS2 JMP2?
|
||||
,$else ~circle.d #0000 #0001 ADD2 LTS2 JNZ2
|
||||
( decr ) ~circle.y -- =circle.y
|
||||
~circle.x ~circle.y SUB2 #0004 MUL2 ~circle.d ADD2 #000a ADD2 =circle.d
|
||||
,$end JMP2
|
||||
|
@ -149,7 +131,7 @@ RTN
|
|||
~circle.x #0004 MUL2 ~circle.d ADD2 #0006 ADD2 =circle.d
|
||||
$end
|
||||
( draw ) ,$seg JSR2
|
||||
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JMP2?
|
||||
,$loop ~circle.y ~circle.x #0001 SUB2 GTS2 JNZ2
|
||||
RTN
|
||||
$seg
|
||||
~circle.xc ~circle.x ADD2 =Screen.x ~circle.yc ~circle.y ADD2 =Screen.y ~color =Screen.color
|
||||
|
@ -175,43 +157,5 @@ RTN
|
|||
7fef bfff 07af 5fff ffff ffff ffff ffff
|
||||
]
|
||||
|
||||
@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
|
||||
]
|
||||
|
||||
@text [ Label 20 Text 00 ] ( add characters to memory )
|
||||
|
||||
@FRAME BRK
|
||||
@ERROR BRK
|
||||
|
|
|
@ -25,7 +25,7 @@ RTN
|
|||
|
||||
$loop
|
||||
~b #01 ADD =b
|
||||
,$loop ~b #d0 LTH JMP2?
|
||||
,$loop ~b #d0 LTH JNZ2
|
||||
~b =Console.byte
|
||||
|
||||
RTN
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
@ERROR BRK
|
||||
|
||||
@FRAME
|
||||
,recover ~test.status JMP2?
|
||||
,recover ~test.status JNZ2
|
||||
#01 =test.status
|
||||
~test.code
|
||||
DUP2 ,find-label JSR2
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
@find-code ( label-ptr₂ -- following-code-ptr₂ )
|
||||
DUP2 PEK2
|
||||
,$not-end ROT JMP2?
|
||||
,$not-end ROT JNZ2
|
||||
|
||||
$end
|
||||
#0001 ADD2
|
||||
|
@ -67,7 +67,7 @@
|
|||
|
||||
@recover
|
||||
( would it have been a PASS or FAIL? )
|
||||
,$clear ~test.label #000a SUB2 PEK2 LIT LIT EQU JMP2?
|
||||
,$clear ~test.label #000a SUB2 PEK2 LIT LIT EQU JNZ2
|
||||
#02 ^result JMP
|
||||
|
||||
$clear
|
||||
|
@ -101,13 +101,13 @@
|
|||
|
||||
@print-string ( string₂ -- )
|
||||
DUP2 PEK2 DUP
|
||||
,$not-end ROT JMP2?
|
||||
,$not-end ROT JNZ2
|
||||
|
||||
$end
|
||||
POP POP2 JMP2r
|
||||
|
||||
$not-end
|
||||
DUP LIT BRK2?r EQU ,$end ROT JMP2?
|
||||
DUP LIT BRK2?r EQU ,$end ROT JNZ2
|
||||
=Console.char
|
||||
#0001 ADD2 ^print-string JMP
|
||||
|
||||
|
|
Loading…
Reference in New Issue