From 1216b58cc11eadfb282f33adb9a080839604cdf0 Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 1 Apr 2021 21:53:41 -0700 Subject: [PATCH] Cleanup --- projects/examples/dev.console.usm | 2 +- projects/examples/dev.controller.usm | 2 +- projects/examples/dev.file.usm | 2 +- projects/examples/dev.keys.usm | 2 +- projects/examples/dev.mouse.usm | 2 +- projects/examples/dev.screen.usm | 2 +- projects/examples/dev.time.usm | 73 ++++++++++++++++------------ projects/examples/gui.hover.usm | 2 +- projects/examples/gui.label.usm | 2 +- projects/examples/gui.picture.usm | 2 +- projects/examples/gui.shapes.usm | 2 +- 11 files changed, 52 insertions(+), 41 deletions(-) diff --git a/projects/examples/dev.console.usm b/projects/examples/dev.console.usm index bce1e79..f307a39 100644 --- a/projects/examples/dev.console.usm +++ b/projects/examples/dev.console.usm @@ -1,4 +1,4 @@ -( hello world ) +( Dev/Console ) %RTN { JMP2r } diff --git a/projects/examples/dev.controller.usm b/projects/examples/dev.controller.usm index 986fa57..7712a6c 100644 --- a/projects/examples/dev.controller.usm +++ b/projects/examples/dev.controller.usm @@ -1,4 +1,4 @@ -( Controller ) +( Dev/Controller ) %++ { #0001 ADD2 } %-- { #0001 SUB2 } diff --git a/projects/examples/dev.file.usm b/projects/examples/dev.file.usm index fa33498..0dec330 100644 --- a/projects/examples/dev.file.usm +++ b/projects/examples/dev.file.usm @@ -1,4 +1,4 @@ -( hello world ) +( Dev/File ) %RTN { JMP2r } diff --git a/projects/examples/dev.keys.usm b/projects/examples/dev.keys.usm index a31b237..b432c69 100644 --- a/projects/examples/dev.keys.usm +++ b/projects/examples/dev.keys.usm @@ -1,4 +1,4 @@ -( Keys ) +( Dev/Keys ) %8+ { #0008 ADD2 } %8* { #0030 SFT2 } diff --git a/projects/examples/dev.mouse.usm b/projects/examples/dev.mouse.usm index 50b8263..c714226 100644 --- a/projects/examples/dev.mouse.usm +++ b/projects/examples/dev.mouse.usm @@ -1,4 +1,4 @@ -( draw routines ) +( Dev/Mouse ) %RTN { JMP2r } %++ { #0001 ADD2 } diff --git a/projects/examples/dev.screen.usm b/projects/examples/dev.screen.usm index c98e16e..574163b 100644 --- a/projects/examples/dev.screen.usm +++ b/projects/examples/dev.screen.usm @@ -1,4 +1,4 @@ -( draw routines ) +( Dev/Screen ) %RTN { JMP2r } %++ { #0001 ADD2 } diff --git a/projects/examples/dev.time.usm b/projects/examples/dev.time.usm index 30052ef..b1d8be6 100644 --- a/projects/examples/dev.time.usm +++ b/projects/examples/dev.time.usm @@ -1,3 +1,5 @@ +( Dev/Time ) + %RTN { JMP2r } %ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 } %SCALEX { #0002 DIV2 ~Screen.width #0002 DIV2 ADD2 #0040 SUB2 } @@ -6,9 +8,9 @@ %MOD { DUP2 DIV MUL SUB } ;current { second 1 } +;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 } ;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 } ;color { byte 1 } -;needles { hx 2 hy 2 mx 2 my 2 sx 2 sy 2 } ( devices ) @@ -17,6 +19,9 @@ |0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 } |01F0 ;System { pad 8 r 2 g 2 b 2 } + +( vectors ) + |0200 ^RESET JMP |0204 ,ERROR JMP2 |0208 ,FRAME JMP2 @@ -27,13 +32,13 @@ ( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b - ,draw-circle JSR2 - BRK @FRAME #00 =Time.get + + ( only draw once per second ) ~Time.second ~current.second NEQ #01 JNZ BRK ~Time.second =current.second @@ -44,40 +49,21 @@ BRK ( place ) #00 ~Time.second #0002 MUL2 ,table ADD2 LDR2 - #00 SWP SCALEY =needles.sy #00 SWP SCALEX =needles.sx + #00 SWP SCALEY =needles.sy + #00 SWP SCALEX =needles.sx #00 ~Time.minute #0002 MUL2 ,table ADD2 LDR2 - #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY =needles.my - #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX =needles.mx + #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY =needles.my + #00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX =needles.mx #00 ~Time.hour 12HOURS #05 MUL #0002 MUL2 ,table ADD2 LDR2 - #00 SWP #0002 DIV2 #0040 ADD2 SCALEY =needles.hy - #00 SWP #0002 DIV2 #0040 ADD2 SCALEX =needles.hx + #00 SWP #0002 DIV2 #0040 ADD2 SCALEY =needles.hy + #00 SWP #0002 DIV2 #0040 ADD2 SCALEX =needles.hx - ( draw ) + ( needles ) #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 - ,draw-circle JSR2 - - ( 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 - -@ERROR - -BRK - -@draw-circle ( -- ) - + ( circle ) #00 #3c $loop ( load ) OVR #00 SWP #0002 MUL2 ,table ADD2 LDR2 @@ -88,7 +74,30 @@ BRK DUP2 LTH ^$loop JNZ POP2 -RTN + ( 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 @draw-line ( x1 y1 x2 y2 color -- ) @@ -116,6 +125,8 @@ RTN RTN +@ERROR BRK + @table ( 60 positions on a circle in bytes ) [ 8000 8d00 9a02 a706 b40b c011 cb18 d520 diff --git a/projects/examples/gui.hover.usm b/projects/examples/gui.hover.usm index 19a3dc8..b26eaaa 100644 --- a/projects/examples/gui.hover.usm +++ b/projects/examples/gui.hover.usm @@ -1,4 +1,4 @@ -( draw routines ) +( GUI Hover ) %RTN { JMP2r } %RTN? { #00 EQU #02 JNZ STH2r JMP2 } diff --git a/projects/examples/gui.label.usm b/projects/examples/gui.label.usm index 6e23ad3..2b78f77 100644 --- a/projects/examples/gui.label.usm +++ b/projects/examples/gui.label.usm @@ -1,4 +1,4 @@ -( draw routines ) +( GUI Labels ) %RTN { JMP2r } diff --git a/projects/examples/gui.picture.usm b/projects/examples/gui.picture.usm index f6b863d..d483b6d 100644 --- a/projects/examples/gui.picture.usm +++ b/projects/examples/gui.picture.usm @@ -1,4 +1,4 @@ -( gui/picture ) +( GUI Picture ) %RTN { JMP2r } diff --git a/projects/examples/gui.shapes.usm b/projects/examples/gui.shapes.usm index 1124ec7..817c6be 100644 --- a/projects/examples/gui.shapes.usm +++ b/projects/examples/gui.shapes.usm @@ -1,4 +1,4 @@ -( draw routines ) +( GUI Shapes ) %RTN { JMP2r } %++ { #0001 ADD2 }