smaller button routines.

This commit is contained in:
Martin Preuss
2025-11-17 23:45:10 +01:00
parent 5dcb48d671
commit 059654b16f
3 changed files with 112 additions and 72 deletions

View File

@@ -271,7 +271,12 @@ dlgNetstats_lUpdate: .db "Update :", 0
dlgNetstats_lClose: .db "Close", 0
dlgNetstats_CloseBtn: .dw 128, (140+STYLE_WIN_TITLE_HEIGHT), 64, 32, (dlgNetstats_lClose*2)
dlgNetstats_CloseBtn:
.dw 128
.dw (140+STYLE_WIN_TITLE_HEIGHT)
.dw 64
.dw 24
.dw (dlgNetstats_lClose*2)

View File

@@ -35,7 +35,7 @@
.equ STACK_SIZE = 256
.equ NET_BUFFERS_NUM = 8
.equ NET_BUFFERS_NUM = 8
.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
@@ -170,8 +170,6 @@ irqNotSet:
; @routine onSystemStart
onSystemStart:
clr r16
sts statsUpdateTimer, r16
bigcall test
ret
; @end
@@ -207,20 +205,6 @@ onEveryDay:
onEverySecond:
#if 0
#ifdef MODULES_GUI
lds r16, statsUpdateTimer
inc r16
cpi r16, 5
brcc onEverySecond_updateStats
sts statsUpdateTimer, r16
ret
onEverySecond_updateStats:
bigcall WinNetStats_Update
clr r16
sts statsUpdateTimer, r16
#endif
#endif
ret
@@ -285,7 +269,6 @@ test:
.dseg
statsUpdateTimer: .byte 1
heapStart:

View File

@@ -64,78 +64,130 @@ buttonDraw:
lpm r9, Z+
lpm r10, Z+ ; H
lpm r11, Z+
lpm r12, Z+ ; text
lpm r13, Z+
; clear background
push zl
push zh
rcall buttonClearBackground
rcall buttonDrawText
rcall buttonDrawBorder
ret
; @end
; ---------------------------------------------------------------------------
; @routine buttonClearBackground
;
; @param Y pointer to window in SDRAM
; @param r5:r4 X
; @param r7:r6 Y
; @param r9:r8 W
; @param r11:r10 H
; @param r14 0 if normal, 1 if pressed state
; @clobbers any, !Y, !Z
buttonClearBackground:
tst r14
brne buttonDraw_bgDown
brne buttonClearBackground_bgDown
ldi r16, LOW(STYLE_BUTTON_COL_BG_NORM)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_NORM)
mov r3, r16
rjmp buttonDraw_bgFill
buttonDraw_bgDown:
rjmp buttonClearBackground_bgFill
buttonClearBackground_bgDown:
ldi r16, LOW(STYLE_BUTTON_COL_BG_PRESSED)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_PRESSED)
mov r3, r16
buttonDraw_bgFill:
buttonClearBackground_bgFill:
bigcall Display_FillRect
pop zh
pop zl
; draw border
push zl
push zh
ret
; @end
; ---------------------------------------------------------------------------
; @routine buttonDrawBorder
;
; @param Y pointer to window in SDRAM
; @param r5:r4 X
; @param r7:r6 Y
; @param r9:r8 W
; @param r11:r10 H
; @param r14 0 if normal, 1 if pressed state
; @clobbers any, !Y, !Z
buttonDrawBorder:
ldi r16, LOW(STYLE_BUTTON_COL_BORDER)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BORDER)
mov r3, r16
bigcall Display_DrawRect
pop zh
pop zl
ret
; @end
ldi r16, 2
clr r17
add r4, r16 ; x+=2
adc r5, r17
add r6, r16 ; y+=2
adc r7, r17
lpm r16, Z+ ; text
lpm r17, Z+
mov zl, r16
mov zh, r17
; set text colors
tst r14
brne buttonDraw_textDown
; set background color
ldi r16, LOW(STYLE_BUTTON_COL_BG_NORM)
mov r0, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_NORM)
mov r1, r16
; set foreground color
ldi r16, LOW(STYLE_BUTTON_COL_FG_NORM)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_FG_NORM)
mov r3, r16
rjmp buttonDraw_textDraw
buttonDraw_textDown:
; set background color
ldi r16, LOW(STYLE_BUTTON_COL_BG_PRESSED)
mov r0, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_PRESSED)
mov r1, r16
; set foreground color
ldi r16, LOW(STYLE_BUTTON_COL_FG_PRESSED)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_FG_PRESSED)
mov r3, r16
buttonDraw_textDraw:
bigcall Window_DrawColorTextFlash
; ---------------------------------------------------------------------------
; @routine buttonDrawText
;
; @param Y pointer to window in SDRAM
; @param r5:r4 X
; @param r7:r6 Y
; @param r9:r8 W
; @param r11:r10 H
; @param r13:r12 Text in FLASH
; @param r14 0 if normal, 1 if pressed state
; @clobbers any, !Y, !Z
buttonDrawText:
push r4
push r5
push r6
push r7
ldi r16, 2
clr r17
add r4, r16 ; x+=2
adc r5, r17
add r6, r16 ; y+=2
adc r7, r17
; set text colors
tst r14
brne buttonDrawText_down
; set background color
ldi r16, LOW(STYLE_BUTTON_COL_BG_NORM)
mov r0, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_NORM)
mov r1, r16
; set foreground color
ldi r16, LOW(STYLE_BUTTON_COL_FG_NORM)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_FG_NORM)
mov r3, r16
rjmp buttonDrawText_draw
buttonDrawText_down:
; set background color
ldi r16, LOW(STYLE_BUTTON_COL_BG_PRESSED)
mov r0, r16
ldi r16, HIGH(STYLE_BUTTON_COL_BG_PRESSED)
mov r1, r16
; set foreground color
ldi r16, LOW(STYLE_BUTTON_COL_FG_PRESSED)
mov r2, r16
ldi r16, HIGH(STYLE_BUTTON_COL_FG_PRESSED)
mov r3, r16
buttonDrawText_draw:
mov zl, r12
mov zh, r13
bigcall Window_DrawColorTextFlash
pop r7
pop r6
pop r5
pop r4
ret
; @end