From 7b113056f7b925836c5a5f23a00fb62acfd7da56 Mon Sep 17 00:00:00 2001 From: Ry Date: Fri, 9 Sep 2022 16:39:08 -0700 Subject: [PATCH] barclock: Initial commit --- barclock/main.asm | 46 ++++++++++++++++++++++++++++++++++++++++++ base_image/startup.cfg | 1 + build.sh | 3 +++ 3 files changed, 50 insertions(+) create mode 100644 barclock/main.asm diff --git a/barclock/main.asm b/barclock/main.asm new file mode 100644 index 0000000..d5f8313 --- /dev/null +++ b/barclock/main.asm @@ -0,0 +1,46 @@ +; menu bar clock + +loop: + ; if no time has passed, don't bother redrawing the clock + in r0, 0x80000705 + cmp.8 r0, [second_counter] + ifz jmp loop_end + mov.8 [second_counter], r0 + + ; hour + in r0, 0x80000703 + mov r1, 584 + cmp r0, 12 + ifgt call afternoon + mov r2, 0 + mov r3, 0xFFFFFFFF + mov r4, 0xFF3F3F3F + mov r5, 30 + call draw_decimal_to_overlay + + ; separator + movz.8 r0, [second_counter] + rem.8 r0, 2 + cmp r0, 0 + ifz mov r0, ':' + ifnz mov r0, ' ' + call draw_font_tile_to_overlay + add r1, 8 + + ; minute + in r0, 0x80000704 + call draw_decimal_to_overlay + +loop_end: + call yield_task + rjmp loop + +afternoon: + sub r0, 12 + add r1, 8 + ret + +second_counter: data.8 0 + + #include "../../fox32rom/fox32rom.def" + #include "../fox32os.def" diff --git a/base_image/startup.cfg b/base_image/startup.cfg index eb3ef56..b3374fc 100644 --- a/base_image/startup.cfg +++ b/base_image/startup.cfg @@ -1 +1,2 @@ launcherfxf +barclockfxf diff --git a/build.sh b/build.sh index 76232a5..9c8a8c3 100755 --- a/build.sh +++ b/build.sh @@ -16,6 +16,9 @@ echo "assembling kernel" echo "assembling launcher" ../fox32asm/target/release/fox32asm launcher/main.asm base_image/launcher.fxf +echo "assembling barclock" +../fox32asm/target/release/fox32asm barclock/main.asm base_image/barclock.fxf + echo "creating wallpapr.raw" ../tools/gfx2inc/target/release/gfx2inc 640 480 launcher/wallpaper.png launcher/wallpaper.inc ../fox32asm/target/release/fox32asm launcher/wallpaper.inc base_image/wallpapr.raw