2021-04-02 04:53:41 +00:00
|
|
|
( Dev/Mouse )
|
2021-02-20 22:07:20 +00:00
|
|
|
|
2021-03-16 04:29:44 +00:00
|
|
|
%RTN { JMP2r }
|
2021-03-24 16:39:19 +00:00
|
|
|
%++ { #0001 ADD2 }
|
|
|
|
%-- { #0001 SUB2 }
|
2021-03-16 04:29:44 +00:00
|
|
|
|
2021-03-14 01:34:08 +00:00
|
|
|
;color { byte 1 }
|
2021-03-24 16:39:19 +00:00
|
|
|
;pointer { x 2 y 2 }
|
|
|
|
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|
2021-03-21 21:16:19 +00:00
|
|
|
|
2021-04-05 20:14:37 +00:00
|
|
|
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|
2021-04-09 17:01:53 +00:00
|
|
|
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|
2021-04-05 20:14:37 +00:00
|
|
|
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
|
2021-02-20 22:07:20 +00:00
|
|
|
|
2021-04-05 20:00:55 +00:00
|
|
|
( program )
|
|
|
|
|
2021-04-05 20:27:43 +00:00
|
|
|
|0200
|
2021-03-28 18:20:36 +00:00
|
|
|
|
2021-04-04 03:58:42 +00:00
|
|
|
( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b
|
2021-04-06 17:45:53 +00:00
|
|
|
( vectors ) ,on-screen =Screen.vector
|
2021-04-05 20:14:37 +00:00
|
|
|
( vectors ) ,on-mouse =Mouse.vector
|
2021-04-04 03:58:42 +00:00
|
|
|
|
2021-02-20 22:07:20 +00:00
|
|
|
BRK
|
|
|
|
|
2021-04-06 17:45:53 +00:00
|
|
|
@on-screen
|
|
|
|
|
|
|
|
( clear ) ~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
|
|
|
|
( draw ) ~circle.xc ~circle.yc ~circle.r #0001 ADD2 #03 ,draw-circle JSR2
|
|
|
|
|
|
|
|
BRK
|
|
|
|
|
2021-04-05 20:14:37 +00:00
|
|
|
@on-mouse
|
2021-03-24 16:39:19 +00:00
|
|
|
|
2021-03-11 03:41:46 +00:00
|
|
|
,draw-cursor JSR2
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-04-06 17:45:53 +00:00
|
|
|
( clear ) ~circle.xc ~circle.yc ~circle.r #00 ,draw-circle JSR2
|
|
|
|
|
2021-03-26 18:45:10 +00:00
|
|
|
~Mouse.state #00 EQU ^$no-touch JNZ
|
2021-04-04 03:58:42 +00:00
|
|
|
~Mouse.x DUP2 =circle.xc
|
|
|
|
~Mouse.y DUP2 =circle.yc
|
2021-03-24 16:39:19 +00:00
|
|
|
#0000 =circle.r
|
2021-04-04 03:58:42 +00:00
|
|
|
( release ) #00 =Mouse.state
|
2021-03-24 16:39:19 +00:00
|
|
|
$no-touch
|
2021-02-20 22:07:20 +00:00
|
|
|
|
2021-03-24 16:39:19 +00:00
|
|
|
BRK
|
2021-02-20 22:07:20 +00:00
|
|
|
|
2021-04-02 18:50:37 +00:00
|
|
|
@draw-cursor ( -- )
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-03-14 01:34:08 +00:00
|
|
|
( clear last cursor )
|
2021-04-09 17:01:53 +00:00
|
|
|
,clear_icn =Screen.addr
|
|
|
|
~pointer.x =Screen.x
|
|
|
|
~pointer.y =Screen.y
|
|
|
|
#30 =Screen.color
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-03-14 01:34:08 +00:00
|
|
|
( record pointer positions )
|
|
|
|
~Mouse.x =pointer.x ~Mouse.y =pointer.y
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-03-14 01:34:08 +00:00
|
|
|
( draw new cursor )
|
2021-04-09 17:01:53 +00:00
|
|
|
,cursor_icn =Screen.addr
|
|
|
|
~pointer.x =Screen.x
|
|
|
|
~pointer.y =Screen.y
|
|
|
|
#31 ~Mouse.state #00 NEQ ADD =Screen.color
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-03-14 21:26:17 +00:00
|
|
|
RTN
|
2021-02-28 19:17:32 +00:00
|
|
|
|
2021-03-24 16:39:19 +00:00
|
|
|
@draw-circle ( xc yc r color )
|
2021-02-20 22:07:20 +00:00
|
|
|
|
2021-03-24 16:39:19 +00:00
|
|
|
( 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
|
2021-03-11 23:47:28 +00:00
|
|
|
$loop
|
2021-03-24 16:39:19 +00:00
|
|
|
( incr ) ~circle.x ++ =circle.x
|
2021-03-26 18:45:10 +00:00
|
|
|
~circle.d #0000 #0001 ADD2 LTS2 ^$else JNZ
|
2021-03-24 16:39:19 +00: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 18:45:10 +00:00
|
|
|
~circle.y ~circle.x #0001 SUB2 GTS2 ^$loop JNZ
|
2021-03-24 16:39:19 +00: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
|
2021-03-02 18:14:55 +00:00
|
|
|
|
2021-03-14 21:26:17 +00:00
|
|
|
RTN
|
2021-02-20 22:07:20 +00:00
|
|
|
|
|
|
|
@clear_icn [ 0000 0000 0000 0000 ]
|
2021-03-24 16:39:19 +00:00
|
|
|
@cursor_icn [ 80c0 e0f0 f8e0 1000 ]
|