2021-04-02 04:53:41 +00:00
|
|
|
( Dev/Time )
|
|
|
|
|
2021-04-01 18:46:41 +00:00
|
|
|
%RTN { JMP2r }
|
|
|
|
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
|
2021-04-02 04:44:23 +00:00
|
|
|
%SCALEX { #0002 DIV2 ~Screen.width #0002 DIV2 ADD2 #0040 SUB2 }
|
|
|
|
%SCALEY { #0002 DIV2 ~Screen.height #0002 DIV2 ADD2 #0040 SUB2 }
|
2021-04-02 00:21:13 +00:00
|
|
|
%12HOURS { DUP #0c GTH #0c MUL SUB }
|
2021-04-02 04:44:23 +00:00
|
|
|
%MOD { DUP2 DIV MUL SUB }
|
2021-04-01 18:46:41 +00:00
|
|
|
|
2021-03-26 21:01:51 +00:00
|
|
|
;current { second 1 }
|
2021-04-02 04:53:41 +00:00
|
|
|
;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 }
|
2021-04-01 18:46:41 +00:00
|
|
|
;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 }
|
|
|
|
;color { byte 1 }
|
2021-03-26 21:01:51 +00:00
|
|
|
|
|
|
|
( devices )
|
|
|
|
|
2021-04-05 20:27:43 +00:00
|
|
|
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|
|
|
|
|0110 ;Console { pad 8 char 1 byte 1 short 2 }
|
|
|
|
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
|
|
|
|
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|
|
|
|
|0140 ;Controller { vector 2 button 1 }
|
|
|
|
|0150 ;Keys { vector 2 key 1 }
|
|
|
|
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
|
|
|
|
|0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
|
|
|
|
|01a0 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
|
2021-04-02 04:53:41 +00:00
|
|
|
|
2021-03-26 21:01:51 +00:00
|
|
|
( program )
|
|
|
|
|
2021-04-05 20:27:43 +00:00
|
|
|
|0200
|
2021-04-01 18:46:41 +00:00
|
|
|
|
|
|
|
( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b
|
2021-04-05 20:00:55 +00:00
|
|
|
( vectors ) ,FRAME =Screen.vector
|
2021-04-01 18:46:41 +00:00
|
|
|
|
2021-04-04 03:58:42 +00:00
|
|
|
#1000 =Audio.ch1adsr
|
|
|
|
#66 =Audio.ch1vol
|
|
|
|
|
|
|
|
#0003 =Audio.ch2adsr
|
|
|
|
#66 =Audio.ch2vol
|
|
|
|
|
2021-04-01 18:46:41 +00:00
|
|
|
BRK
|
2021-03-26 21:01:51 +00:00
|
|
|
|
|
|
|
@FRAME
|
2021-04-01 18:46:41 +00:00
|
|
|
|
2021-03-26 21:01:51 +00:00
|
|
|
#00 =Time.get
|
2021-04-02 04:53:41 +00:00
|
|
|
|
|
|
|
( only draw once per second )
|
2021-03-26 21:01:51 +00:00
|
|
|
~Time.second ~current.second NEQ #01 JNZ BRK
|
2021-04-02 00:21:13 +00:00
|
|
|
~Time.second =current.second
|
2021-03-26 21:01:51 +00:00
|
|
|
|
2021-04-04 03:58:42 +00:00
|
|
|
( play sounds )
|
|
|
|
#0d =Audio.ch1pitch
|
|
|
|
|
|
|
|
~Time.second #0f MOD #00 NEQ ^$no-tone JNZ
|
|
|
|
#0d #02 MUL =Audio.ch2pitch
|
|
|
|
$no-tone
|
2021-04-02 15:05:29 +00:00
|
|
|
|
2021-04-01 18:46:41 +00:00
|
|
|
( clear )
|
2021-04-02 04:44:23 +00:00
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #00 ,draw-line JSR2
|
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.mx ~needles.my #00 ,draw-line JSR2
|
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.hx ~needles.hy #00 ,draw-line JSR2
|
2021-04-01 18:46:41 +00:00
|
|
|
|
|
|
|
( place )
|
|
|
|
#00 ~Time.second #0002 MUL2 ,table ADD2 LDR2
|
2021-04-02 04:53:41 +00:00
|
|
|
#00 SWP SCALEY =needles.sy
|
|
|
|
#00 SWP SCALEX =needles.sx
|
2021-04-01 18:46:41 +00:00
|
|
|
#00 ~Time.minute #0002 MUL2 ,table ADD2 LDR2
|
2021-04-02 04:53:41 +00:00
|
|
|
#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY =needles.my
|
|
|
|
#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX =needles.mx
|
2021-04-02 00:21:13 +00:00
|
|
|
#00 ~Time.hour 12HOURS #05 MUL #0002 MUL2 ,table ADD2 LDR2
|
2021-04-02 04:53:41 +00:00
|
|
|
#00 SWP #0002 DIV2 #0040 ADD2 SCALEY =needles.hy
|
|
|
|
#00 SWP #0002 DIV2 #0040 ADD2 SCALEX =needles.hx
|
2021-04-01 18:46:41 +00:00
|
|
|
|
2021-04-02 04:53:41 +00:00
|
|
|
( needles )
|
2021-04-02 04:44:23 +00:00
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.sx ~needles.sy #02 ,draw-line JSR2
|
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.mx ~needles.my #01 ,draw-line JSR2
|
|
|
|
#0080 SCALEX #0080 SCALEY ~needles.hx ~needles.hy #03 ,draw-line JSR2
|
2021-04-01 18:46:41 +00:00
|
|
|
|
2021-04-02 04:53:41 +00:00
|
|
|
( circle )
|
2021-04-01 18:46:41 +00:00
|
|
|
#00 #3c
|
|
|
|
$loop
|
|
|
|
( load ) OVR #00 SWP #0002 MUL2 ,table ADD2 LDR2
|
2021-04-02 04:44:23 +00:00
|
|
|
#00 SWP SCALEY =Screen.y
|
|
|
|
#00 SWP SCALEX =Screen.x
|
|
|
|
OVR #0f MOD #00 EQU #01 ADD =Screen.color
|
2021-04-01 18:46:41 +00:00
|
|
|
( incr ) SWP #01 ADD SWP
|
|
|
|
DUP2 LTH ^$loop JNZ
|
|
|
|
POP2
|
|
|
|
|
2021-04-02 04:53:41 +00:00
|
|
|
( display )
|
|
|
|
~Screen.height #0002 DIV2 #0048 ADD2 =Sprite.y
|
|
|
|
~Screen.width #0002 DIV2
|
|
|
|
DUP2 #0020 SUB2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.hour #0a DIV #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
DUP2 #0018 SUB2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.hour #0a MOD #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
DUP2 #0008 SUB2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.minute #0a DIV #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
DUP2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.minute #0a MOD #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
DUP2 #0010 ADD2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.second #0a DIV #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
DUP2 #0018 ADD2 =Sprite.x
|
|
|
|
,font_hex #00 ~Time.second #0a MOD #08 MUL ADD2 =Sprite.addr
|
|
|
|
#02 =Sprite.color
|
|
|
|
POP2
|
|
|
|
|
|
|
|
BRK
|
2021-04-01 18:46:41 +00:00
|
|
|
|
|
|
|
@draw-line ( x1 y1 x2 y2 color -- )
|
|
|
|
|
|
|
|
( 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
|
|
|
|
~line.dx ~line.dy ADD2 =line.e1
|
|
|
|
$loop
|
|
|
|
~line.x =Screen.x ~line.y =Screen.y ~color =Screen.color
|
|
|
|
~line.x ~line.x0 EQU2 ~line.y ~line.y0 EQU2 #0101 EQU2 ^$end JNZ
|
|
|
|
~line.e1 #0002 MUL2 =line.e2
|
|
|
|
~line.e2 ~line.dy LTS2 ^$skipy JNZ
|
|
|
|
~line.e1 ~line.dy ADD2 =line.e1
|
|
|
|
~line.x ~line.sx ADD2 =line.x
|
|
|
|
$skipy
|
|
|
|
~line.e2 ~line.dx GTS2 ^$skipx JNZ
|
|
|
|
~line.e1 ~line.dx ADD2 =line.e1
|
|
|
|
~line.y ~line.sy ADD2 =line.y
|
|
|
|
$skipx
|
|
|
|
,$loop JMP2
|
|
|
|
|
|
|
|
$end
|
|
|
|
|
|
|
|
RTN
|
|
|
|
|
|
|
|
@table ( 60 positions on a circle in bytes )
|
|
|
|
[
|
2021-04-02 04:44:23 +00:00
|
|
|
8000 8d00 9a02 a706 b40b c011 cb18 d520
|
|
|
|
df2a e734 ee40 f44b f958 fd65 ff72 ff80
|
|
|
|
ff8d fd9a f9a7 f4b4 eec0 e7cb dfd5 d5df
|
|
|
|
cbe7 c0ee b4f4 a7f9 9afd 8dff 80ff 72ff
|
|
|
|
65fd 58f9 4bf4 40ee 34e7 2adf 20d5 18cb
|
|
|
|
11c0 0bb4 06a7 029a 008d 0080 0072 0265
|
|
|
|
0658 0b4b 113f 1834 202a 2a20 3418 3f11
|
|
|
|
4b0b 5806 6502 7200
|
2021-04-01 18:46:41 +00:00
|
|
|
]
|
2021-03-26 21:01:51 +00:00
|
|
|
|
2021-04-01 18:46:41 +00:00
|
|
|
@font_hex ( 0-F )
|
|
|
|
[
|
|
|
|
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
|
|
|
|
]
|