2021-04-02 00:53:41 -04:00
|
|
|
( GUI Shapes )
|
2021-02-20 20:14:36 -05:00
|
|
|
|
2021-03-16 00:29:44 -04:00
|
|
|
%RTN { JMP2r }
|
2021-03-16 14:25:26 -04:00
|
|
|
%++ { #0001 ADD2 }
|
2021-03-22 12:42:48 -04:00
|
|
|
%-- { #0001 SUB2 }
|
2021-03-16 14:25:26 -04:00
|
|
|
%8+ { #0008 ADD2 }
|
2021-03-26 14:19:19 -04:00
|
|
|
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
|
2021-03-16 00:29:44 -04:00
|
|
|
|
2021-03-13 20:34:08 -05:00
|
|
|
;pict { x 2 y 2 width 2 height 2 color 1 addr 2 }
|
|
|
|
;rect { x1 2 y1 2 x2 2 y2 2 }
|
2021-03-21 19:33:34 -04:00
|
|
|
;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
|
2021-03-13 20:34:08 -05:00
|
|
|
;color { byte 1 }
|
2021-02-20 20:14:36 -05:00
|
|
|
|
2021-03-22 12:42:48 -04:00
|
|
|
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|
|
|
|
|
2021-03-21 17:16:19 -04:00
|
|
|
|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 }
|
2021-03-28 14:20:36 -04:00
|
|
|
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
2021-03-21 17:16:19 -04:00
|
|
|
|
2021-04-05 16:00:55 -04:00
|
|
|
( program )
|
|
|
|
|
|
|
|
|0200 @RESET
|
2021-03-28 14:20:36 -04:00
|
|
|
|
|
|
|
( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b
|
2021-02-27 14:39:12 -05:00
|
|
|
|
2021-03-10 22:41:46 -05:00
|
|
|
#0010 #0020 #0040 #0060 #01 ,fill-rect JSR2
|
|
|
|
#0020 #0030 #0050 #0070 #02 ,fill-rect JSR2
|
|
|
|
#0030 #0040 #0060 #0080 #03 ,fill-rect JSR2
|
|
|
|
#0070 #0020 #00a0 #0060 #01 ,line-rect JSR2
|
|
|
|
#0080 #0030 #00b0 #0070 #02 ,line-rect JSR2
|
|
|
|
#0090 #0040 #00c0 #0080 #03 ,line-rect JSR2
|
|
|
|
|
|
|
|
#0000 #0080 #0020 #0020 #01 ,pict_small ,draw-picture JSR2
|
|
|
|
#0010 #0088 #0020 #0020 #02 ,pict_small ,draw-picture JSR2
|
|
|
|
#0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR2
|
|
|
|
#0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR2
|
|
|
|
|
2021-03-21 00:46:52 -04:00
|
|
|
#0020 #0020 #0070 #0080 #01 ,draw-line JSR2
|
|
|
|
#0020 #0080 #0070 #0030 #02 ,draw-line JSR2
|
|
|
|
#00a0 #0020 #0050 #00b0 #03 ,draw-line JSR2
|
|
|
|
#00b0 #0090 #0030 #0010 #01 ,draw-line JSR2
|
2021-03-22 12:42:48 -04:00
|
|
|
|
|
|
|
#0040 #0040 #0030 #01 ,draw-circle JSR2
|
|
|
|
#0070 #0030 #0040 #02 ,draw-circle JSR2
|
|
|
|
#0050 #0080 #0050 #03 ,draw-circle JSR2
|
2021-02-21 16:23:36 -05:00
|
|
|
|
2021-02-20 20:14:36 -05:00
|
|
|
BRK
|
|
|
|
|
2021-03-21 12:18:52 -04:00
|
|
|
@draw-line ( x1 y1 x2 y2 color )
|
|
|
|
|
2021-03-21 19:33:34 -04:00
|
|
|
( load ) =color =line.y0 =line.x0 =line.y =line.x
|
|
|
|
~line.x0 ~line.x SUB2 ABS2 =line.dx
|
|
|
|
~line.y0 ~line.y SUB2 ABS2 #0000 SWP2 SUB2 =line.dy
|
|
|
|
#ffff #00 ~line.x ~line.x0 LTS2 #0002 MUL2 ADD2 =line.sx
|
|
|
|
#ffff #00 ~line.y ~line.y0 LTS2 #0002 MUL2 ADD2 =line.sy
|
2021-03-21 12:18:52 -04:00
|
|
|
~line.dx ~line.dy ADD2 =line.e1
|
|
|
|
$loop
|
|
|
|
~line.x =Screen.x ~line.y =Screen.y ~color =Screen.color
|
2021-03-26 14:45:10 -04:00
|
|
|
~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 ^$end JNZ
|
2021-03-21 12:18:52 -04:00
|
|
|
~line.e1 #0002 MUL2 =line.e2
|
2021-03-26 14:45:10 -04:00
|
|
|
~line.e2 ~line.dy LTS2 ^$skipy JNZ
|
2021-03-21 12:18:52 -04:00
|
|
|
~line.e1 ~line.dy ADD2 =line.e1
|
|
|
|
~line.x ~line.sx ADD2 =line.x
|
|
|
|
$skipy
|
2021-03-26 14:45:10 -04:00
|
|
|
~line.e2 ~line.dx GTS2 ^$skipx JNZ
|
2021-03-21 12:18:52 -04:00
|
|
|
~line.e1 ~line.dx ADD2 =line.e1
|
|
|
|
~line.y ~line.sy ADD2 =line.y
|
|
|
|
$skipx
|
|
|
|
,$loop JMP2
|
|
|
|
|
|
|
|
$end
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
2021-02-27 14:39:12 -05:00
|
|
|
@line-rect ( x1 y1 x2 y2 color )
|
|
|
|
|
2021-03-13 20:34:08 -05:00
|
|
|
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
|
|
|
$hor
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Screen.x ++ =Screen.x
|
2021-03-13 20:34:08 -05:00
|
|
|
( draw ) ~rect.y1 =Screen.y ~color =Screen.color
|
|
|
|
( draw ) ~rect.y2 =Screen.y ~color =Screen.color
|
2021-03-26 14:45:10 -04:00
|
|
|
~Screen.x ~rect.x2 LTH2 ^$hor JNZ
|
2021-03-13 20:34:08 -05:00
|
|
|
~rect.y1 =Screen.y
|
|
|
|
$ver
|
|
|
|
( draw ) ~rect.x1 =Screen.x ~color =Screen.color
|
|
|
|
( draw ) ~rect.x2 =Screen.x ~color =Screen.color
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Screen.y ++ =Screen.y
|
2021-03-26 14:45:10 -04:00
|
|
|
~Screen.y ~rect.y2 ++ LTH2 ^$ver JNZ
|
2021-02-27 14:39:12 -05:00
|
|
|
|
2021-03-14 17:26:17 -04:00
|
|
|
RTN
|
2021-02-21 16:23:36 -05:00
|
|
|
|
2021-02-27 14:39:12 -05:00
|
|
|
@fill-rect ( x1 y1 x2 y2 color )
|
|
|
|
|
2021-03-13 20:34:08 -05:00
|
|
|
( load ) =color =rect.y2 =rect.x2 DUP2 =Screen.y =rect.y1 DUP2 =Screen.x =rect.x1
|
|
|
|
$ver
|
|
|
|
~rect.x1 =Screen.x
|
|
|
|
$hor
|
|
|
|
( draw ) ~color =Screen.color
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Screen.x ++ =Screen.x
|
2021-03-26 14:45:10 -04:00
|
|
|
~Screen.x ~rect.x2 LTH2 ^$hor JNZ
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Screen.y ++ =Screen.y
|
2021-03-26 14:45:10 -04:00
|
|
|
~Screen.y ~rect.y2 LTH2 ^$ver JNZ
|
2021-02-27 14:39:12 -05:00
|
|
|
|
2021-03-14 17:26:17 -04:00
|
|
|
RTN
|
2021-02-27 14:39:12 -05:00
|
|
|
|
|
|
|
@draw-picture ( x y width height color addr )
|
|
|
|
|
2021-03-13 20:34:08 -05:00
|
|
|
( load ) DUP2 =Sprite.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Sprite.y =pict.y =pict.x
|
|
|
|
$ver
|
|
|
|
~pict.x =Sprite.x
|
|
|
|
$hor
|
|
|
|
( draw ) ~pict.color =Sprite.color
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Sprite.x 8+ =Sprite.x
|
|
|
|
( incr ) ~Sprite.addr 8+ =Sprite.addr
|
2021-03-26 14:45:10 -04:00
|
|
|
~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
|
2021-03-16 14:25:26 -04:00
|
|
|
( incr ) ~Sprite.y 8+ =Sprite.y
|
2021-03-26 14:45:10 -04:00
|
|
|
~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
|
2021-02-27 14:39:12 -05:00
|
|
|
|
2021-03-14 17:26:17 -04:00
|
|
|
RTN
|
2021-02-20 20:14:36 -05:00
|
|
|
|
2021-03-22 12:42:48 -04:00
|
|
|
@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
|
2021-03-26 14:45:10 -04:00
|
|
|
~circle.d #0000 #0001 ADD2 LTS2 ^$else JNZ
|
2021-03-22 12:42:48 -04:00
|
|
|
( 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
|
2021-03-26 14:45:10 -04:00
|
|
|
~circle.y ~circle.x #0001 SUB2 GTS2 ^$loop JNZ
|
2021-03-22 12:42:48 -04:00
|
|
|
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
|
|
|
|
|
2021-02-27 14:39:12 -05:00
|
|
|
@pict_small [
|
|
|
|
|
|
|
|
ff80 8080 8080 8088 ffff fffc f8f9 f1f4
|
|
|
|
ffff 0010 c721 2120 ffff 3f0f 0717 c343
|
|
|
|
8888 8080 8080 8080 f0f1 f2f5 f2f1 f0f4
|
|
|
|
1208 804c 9212 4c00 7303 0343 1b1b fbfb
|
|
|
|
8080 8f83 8383 8393 f0f3 f1f0 e4c0 80ff
|
|
|
|
00c7 c7c6 4606 00ff c3d3 c307 870f 3fff
|
|
|
|
8f83 8383 8383 83ff fff7 fdff c0e2 f1ff
|
|
|
|
7fef bfff 07af 5fff ffff ffff ffff ffff
|
|
|
|
]
|