2022-09-10 01:39:08 +02:00
|
|
|
; menu bar clock
|
|
|
|
|
2023-07-25 06:17:56 +02:00
|
|
|
opton
|
|
|
|
|
2022-09-10 01:39:08 +02:00
|
|
|
loop:
|
2023-01-25 02:11:14 +01:00
|
|
|
; redraw the window title if the active window has changed
|
|
|
|
call get_active_window_struct
|
|
|
|
cmp r0, [active_window_struct_ptr]
|
|
|
|
ifnz call draw_window_title
|
|
|
|
|
2022-09-10 01:39:08 +02:00
|
|
|
; 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
|
2022-10-06 01:20:50 +02:00
|
|
|
cmp r0, 10
|
|
|
|
iflt call minute_less_than_10
|
2022-09-10 01:39:08 +02:00
|
|
|
call draw_decimal_to_overlay
|
|
|
|
|
|
|
|
loop_end:
|
|
|
|
call yield_task
|
|
|
|
rjmp loop
|
|
|
|
|
2023-01-25 02:11:14 +01:00
|
|
|
draw_window_title:
|
|
|
|
mov [active_window_struct_ptr], r0
|
|
|
|
|
2023-01-25 02:19:17 +01:00
|
|
|
; if there is no active window, clear the menu bar and return
|
|
|
|
cmp r0, 0
|
|
|
|
ifz call clear_menu_bar
|
|
|
|
cmp r0, 0
|
|
|
|
ifz ret
|
|
|
|
|
2023-01-25 02:11:14 +01:00
|
|
|
; get the title string pointer
|
|
|
|
add r0, 12
|
|
|
|
mov r0, [r0]
|
|
|
|
|
|
|
|
; get the length of the string
|
|
|
|
mov r1, r0
|
|
|
|
call string_length
|
|
|
|
|
|
|
|
; calculate the position of the text
|
|
|
|
mov r2, 574
|
|
|
|
mul r0, 8
|
|
|
|
sub r2, r0
|
|
|
|
mov r0, r1
|
|
|
|
mov r1, r2
|
|
|
|
|
|
|
|
; draw the text
|
|
|
|
mov r2, 0
|
|
|
|
mov r3, 0xFFFFFFFF
|
|
|
|
mov r4, 0xFF3F3F3F
|
|
|
|
mov r5, 30
|
|
|
|
call draw_str_to_overlay
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
2022-09-10 01:39:08 +02:00
|
|
|
afternoon:
|
|
|
|
sub r0, 12
|
|
|
|
add r1, 8
|
|
|
|
ret
|
|
|
|
|
2022-10-06 01:20:50 +02:00
|
|
|
minute_less_than_10:
|
|
|
|
mov r0, 0
|
|
|
|
call draw_decimal_to_overlay
|
|
|
|
in r0, 0x80000704
|
|
|
|
ret
|
|
|
|
|
2022-09-10 01:39:08 +02:00
|
|
|
second_counter: data.8 0
|
2023-01-25 02:11:14 +01:00
|
|
|
active_window_struct_ptr: data.32 0
|
2022-09-10 01:39:08 +02:00
|
|
|
|
2022-12-27 04:05:27 +01:00
|
|
|
#include "../../../fox32rom/fox32rom.def"
|
|
|
|
#include "../../fox32os.def"
|