2022-01-27 07:21:21 +01:00
|
|
|
; background routines
|
|
|
|
|
2022-03-12 02:13:18 +01:00
|
|
|
const BACKGROUND_FRAMEBUFFER: 0x02000000 ; pointer to background framebuffer
|
2022-01-27 07:21:21 +01:00
|
|
|
|
|
|
|
; fill the whole background with a color
|
|
|
|
; inputs:
|
|
|
|
; r0: color
|
|
|
|
; outputs:
|
|
|
|
; none
|
|
|
|
fill_background:
|
|
|
|
push r1
|
|
|
|
push r31
|
|
|
|
|
2022-02-12 05:44:11 +01:00
|
|
|
mov r1, BACKGROUND_FRAMEBUFFER
|
2022-01-27 07:21:21 +01:00
|
|
|
mov r31, 0x0004B000 ; 640*480
|
|
|
|
fill_background_loop:
|
|
|
|
mov [r1], r0
|
|
|
|
add r1, 4
|
|
|
|
loop fill_background_loop
|
|
|
|
|
|
|
|
pop r31
|
|
|
|
pop r1
|
|
|
|
ret
|
|
|
|
|
2022-04-17 01:13:16 +02:00
|
|
|
; draw a pixel to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: X coordinate
|
|
|
|
; r1: Y coordinate
|
|
|
|
; r2: color
|
|
|
|
; outputs:
|
|
|
|
; none
|
|
|
|
draw_pixel_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
|
|
|
|
|
|
|
mov r3, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r4, 640
|
|
|
|
call draw_pixel_generic
|
|
|
|
|
|
|
|
pop r6
|
|
|
|
pop r5
|
|
|
|
ret
|
|
|
|
|
2022-01-27 07:21:21 +01:00
|
|
|
; draw a filled rectangle to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: X coordinate of top-left
|
|
|
|
; r1: Y coordinate of top-left
|
|
|
|
; r2: X size
|
|
|
|
; r3: Y size
|
|
|
|
; r4: color
|
|
|
|
; outputs:
|
|
|
|
; none
|
|
|
|
draw_filled_rectangle_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
|
|
|
|
2022-02-22 06:15:16 +01:00
|
|
|
mov r5, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r6, 640
|
|
|
|
call draw_filled_rectangle_generic
|
2022-01-27 07:21:21 +01:00
|
|
|
|
|
|
|
pop r6
|
|
|
|
pop r5
|
|
|
|
ret
|
|
|
|
|
2022-06-22 03:08:16 +02:00
|
|
|
; draw a single tile to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: tile number
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; outputs:
|
|
|
|
; none
|
|
|
|
draw_tile_to_background:
|
|
|
|
push r8
|
|
|
|
push r9
|
|
|
|
|
|
|
|
mov r8, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r9, 640
|
|
|
|
call draw_tile_generic
|
|
|
|
|
|
|
|
pop r9
|
|
|
|
pop r8
|
|
|
|
ret
|
|
|
|
|
2022-01-27 07:21:21 +01:00
|
|
|
; draw a single font tile to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: tile number
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; r3: foreground color
|
|
|
|
; r4: background color
|
|
|
|
; outputs:
|
|
|
|
; none
|
|
|
|
draw_font_tile_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
2022-02-13 05:42:37 +01:00
|
|
|
push r7
|
|
|
|
push r8
|
|
|
|
push r9
|
|
|
|
|
|
|
|
mov r5, standard_font_data
|
|
|
|
movz.16 r6, [standard_font_width]
|
|
|
|
movz.16 r7, [standard_font_height]
|
|
|
|
mov r8, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r9, 640
|
|
|
|
call draw_font_tile_generic
|
|
|
|
|
|
|
|
pop r9
|
|
|
|
pop r8
|
|
|
|
pop r7
|
2022-01-27 07:21:21 +01:00
|
|
|
pop r6
|
|
|
|
pop r5
|
2022-02-22 22:45:54 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
; draw text to the background, using printf-style formatting
|
|
|
|
; inputs:
|
|
|
|
; r0: pointer to null-terminated string
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; r3: foreground color
|
|
|
|
; r4: background color
|
|
|
|
; r10-r15: optional format values
|
|
|
|
; outputs:
|
|
|
|
; r1: X coordinate of end of text
|
|
|
|
draw_format_str_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
|
|
|
push r7
|
|
|
|
push r8
|
|
|
|
push r9
|
|
|
|
|
|
|
|
mov r5, standard_font_data
|
|
|
|
movz.16 r6, [standard_font_width]
|
|
|
|
movz.16 r7, [standard_font_height]
|
|
|
|
mov r8, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r9, 640
|
|
|
|
call draw_format_str_generic
|
|
|
|
|
|
|
|
pop r9
|
|
|
|
pop r8
|
|
|
|
pop r7
|
|
|
|
pop r6
|
|
|
|
pop r5
|
2022-01-27 07:21:21 +01:00
|
|
|
ret
|
|
|
|
|
2022-02-13 05:42:37 +01:00
|
|
|
; draw text to the background
|
2022-01-27 07:21:21 +01:00
|
|
|
; inputs:
|
|
|
|
; r0: pointer to null-terminated string
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; r3: foreground color
|
|
|
|
; r4: background color
|
|
|
|
; outputs:
|
|
|
|
; r1: X coordinate of end of text
|
|
|
|
draw_str_to_background:
|
|
|
|
push r0
|
|
|
|
push r5
|
|
|
|
mov r5, r0
|
|
|
|
draw_str_to_background_loop:
|
|
|
|
movz.8 r0, [r5]
|
|
|
|
call draw_font_tile_to_background
|
|
|
|
inc r5
|
|
|
|
add r1, 8
|
|
|
|
cmp.8 [r5], 0x00
|
|
|
|
ifnz jmp draw_str_to_background_loop
|
|
|
|
pop r5
|
|
|
|
pop r0
|
|
|
|
ret
|
2022-02-22 07:07:02 +01:00
|
|
|
|
|
|
|
; draw a decimal value to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: value
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; r3: foreground color
|
|
|
|
; r4: background color
|
|
|
|
; outputs:
|
|
|
|
; r1: X coordinate of end of text
|
|
|
|
draw_decimal_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
|
|
|
push r7
|
|
|
|
push r8
|
|
|
|
push r9
|
|
|
|
|
|
|
|
mov r5, standard_font_data
|
|
|
|
movz.16 r6, [standard_font_width]
|
|
|
|
movz.16 r7, [standard_font_height]
|
|
|
|
mov r8, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r9, 640
|
|
|
|
call draw_decimal_generic
|
|
|
|
|
|
|
|
pop r9
|
|
|
|
pop r8
|
|
|
|
pop r7
|
|
|
|
pop r6
|
|
|
|
pop r5
|
2022-04-02 01:05:59 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
; draw a hex value to the background
|
|
|
|
; inputs:
|
|
|
|
; r0: value
|
|
|
|
; r1: X coordinate
|
|
|
|
; r2: Y coordinate
|
|
|
|
; r3: foreground color
|
|
|
|
; r4: background color
|
|
|
|
; outputs:
|
|
|
|
; r1: X coordinate of end of text
|
|
|
|
draw_hex_to_background:
|
|
|
|
push r5
|
|
|
|
push r6
|
|
|
|
push r7
|
|
|
|
push r8
|
|
|
|
push r9
|
|
|
|
|
|
|
|
mov r5, standard_font_data
|
|
|
|
movz.16 r6, [standard_font_width]
|
|
|
|
movz.16 r7, [standard_font_height]
|
|
|
|
mov r8, BACKGROUND_FRAMEBUFFER
|
|
|
|
mov r9, 640
|
|
|
|
call draw_hex_generic
|
|
|
|
|
|
|
|
pop r9
|
|
|
|
pop r8
|
|
|
|
pop r7
|
|
|
|
pop r6
|
|
|
|
pop r5
|
|
|
|
ret
|