fox32rom: Make overlay structs const
This commit is contained in:
parent
5df841f061
commit
b908d98bb6
38
main.asm
38
main.asm
|
@ -35,7 +35,7 @@ disable_all_overlays_loop:
|
||||||
out r0, 0
|
out r0, 0
|
||||||
|
|
||||||
; write the cursor bitmap to the overlay framebuffer
|
; write the cursor bitmap to the overlay framebuffer
|
||||||
mov r0, [overlay_31_framebuffer_ptr]
|
mov r0, CURSOR_FRAMEBUFFER_PTR
|
||||||
mov r1, mouse_cursor
|
mov r1, mouse_cursor
|
||||||
mov r31, 96 ; 8x12
|
mov r31, 96 ; 8x12
|
||||||
cursor_overlay_loop:
|
cursor_overlay_loop:
|
||||||
|
@ -47,12 +47,12 @@ cursor_overlay_loop:
|
||||||
cursor_enable:
|
cursor_enable:
|
||||||
; set properties of overlay 31
|
; set properties of overlay 31
|
||||||
mov r0, 0x8000011F ; overlay 31: size
|
mov r0, 0x8000011F ; overlay 31: size
|
||||||
mov.16 r1, [overlay_31_height]
|
mov.16 r1, CURSOR_HEIGHT
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_31_width]
|
mov.16 r1, CURSOR_WIDTH
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
|
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
|
||||||
mov r1, [overlay_31_framebuffer_ptr]
|
mov r1, CURSOR_FRAMEBUFFER_PTR
|
||||||
out r0, r1
|
out r0, r1
|
||||||
|
|
||||||
; enable overlay 31 (cursor)
|
; enable overlay 31 (cursor)
|
||||||
|
@ -240,27 +240,25 @@ mouse_cursor:
|
||||||
#include_bin "font/cursor2.raw"
|
#include_bin "font/cursor2.raw"
|
||||||
|
|
||||||
; cursor overlay struct:
|
; cursor overlay struct:
|
||||||
overlay_31_width: data.16 8
|
const CURSOR_WIDTH: 8
|
||||||
overlay_31_height: data.16 12
|
const CURSOR_HEIGHT: 12
|
||||||
overlay_31_position_x: data.16 0
|
const CURSOR_FRAMEBUFFER_PTR: 0x0212D000
|
||||||
overlay_31_position_y: data.16 0
|
|
||||||
overlay_31_framebuffer_ptr: data.32 0x0212D000
|
|
||||||
|
|
||||||
; menu bar overlay struct:
|
; menu bar overlay struct:
|
||||||
overlay_30_width: data.16 640
|
const MENU_BAR_WIDTH: 640
|
||||||
overlay_30_height: data.16 16
|
const MENU_BAR_HEIGHT: 16
|
||||||
overlay_30_position_x: data.16 0
|
const MENU_BAR_POSITION_X: 0
|
||||||
overlay_30_position_y: data.16 0
|
const MENU_BAR_POSITION_Y: 0
|
||||||
overlay_30_framebuffer_ptr: data.32 0x0212D180
|
const MENU_BAR_FRAMEBUFFER_PTR: 0x0212D180
|
||||||
|
|
||||||
; menu overlay struct:
|
; menu overlay struct:
|
||||||
; this struct must be writable, so these are hard-coded addresses in ram
|
; this struct must be writable, so these are hard-coded addresses in ram
|
||||||
const OVERLAY_29_WIDTH: 0x02137180 ; 2 bytes
|
const MENU_WIDTH: 0x02137180 ; 2 bytes
|
||||||
const OVERLAY_29_HEIGHT: 0x02137182 ; 2 bytes
|
const MENU_HEIGHT: 0x02137182 ; 2 bytes
|
||||||
const OVERLAY_29_POSITION_X: 0x02137184 ; 2 bytes
|
const MENU_POSITION_X: 0x02137184 ; 2 bytes
|
||||||
const OVERLAY_29_POSITION_Y: 0x02137186 ; 2 bytes
|
const MENU_POSITION_Y: 0x02137186 ; 2 bytes
|
||||||
const OVERLAY_29_FRAMEBUFFER_PTR: 0x0213718A ; 4 bytes
|
const MENU_FRAMEBUFFER_PTR: 0x0213718A ; 4 bytes
|
||||||
const OVERLAY_29_FRAMEBUFFER: 0x0213718E
|
const MENU_FRAMEBUFFER: 0x0213718E
|
||||||
|
|
||||||
startup_str: data.str "fox32 - ROM version %u.%u.%u - insert boot disk" data.8 0
|
startup_str: data.str "fox32 - ROM version %u.%u.%u - insert boot disk" data.8 0
|
||||||
|
|
||||||
|
|
20
menu.asm
20
menu.asm
|
@ -43,7 +43,7 @@ draw_menu_items_calculate_x_loop:
|
||||||
loop draw_menu_items_calculate_x_loop
|
loop draw_menu_items_calculate_x_loop
|
||||||
draw_menu_items_calculate_x_skip:
|
draw_menu_items_calculate_x_skip:
|
||||||
sub r30, 8 ; move the menu to the left by 8 pixels
|
sub r30, 8 ; move the menu to the left by 8 pixels
|
||||||
mov.16 [OVERLAY_29_POSITION_X], r30
|
mov.16 [MENU_POSITION_X], r30
|
||||||
|
|
||||||
mov r31, r0
|
mov r31, r0
|
||||||
inc r31 ; point to menu list pointer
|
inc r31 ; point to menu list pointer
|
||||||
|
@ -58,7 +58,7 @@ draw_menu_items_calculate_x_skip:
|
||||||
; multiply the number of menu items by 16 (the font is 16 pixels tall)
|
; multiply the number of menu items by 16 (the font is 16 pixels tall)
|
||||||
mov r1, r31
|
mov r1, r31
|
||||||
mul r1, 16
|
mul r1, 16
|
||||||
mov.16 [OVERLAY_29_HEIGHT], r1
|
mov.16 [MENU_HEIGHT], r1
|
||||||
|
|
||||||
; calculate the required width for the menu overlay
|
; calculate the required width for the menu overlay
|
||||||
; multiply the width by 8 (the font is 8 pixels wide)
|
; multiply the width by 8 (the font is 8 pixels wide)
|
||||||
|
@ -67,25 +67,25 @@ draw_menu_items_calculate_x_skip:
|
||||||
movz.8 r1, [r1] ; load width of menu
|
movz.8 r1, [r1] ; load width of menu
|
||||||
mov r8, r1 ; save the width in characters in r8 for later
|
mov r8, r1 ; save the width in characters in r8 for later
|
||||||
mul r1, 8
|
mul r1, 8
|
||||||
mov.16 [OVERLAY_29_WIDTH], r1
|
mov.16 [MENU_WIDTH], r1
|
||||||
|
|
||||||
push r0
|
push r0
|
||||||
|
|
||||||
; set properties of overlay 29
|
; set properties of overlay 29
|
||||||
mov.16 [OVERLAY_29_POSITION_Y], 16
|
mov.16 [MENU_POSITION_Y], 16
|
||||||
mov [OVERLAY_29_FRAMEBUFFER_PTR], OVERLAY_29_FRAMEBUFFER
|
mov [MENU_FRAMEBUFFER_PTR], MENU_FRAMEBUFFER
|
||||||
mov r0, 0x8000001D ; overlay 29: position
|
mov r0, 0x8000001D ; overlay 29: position
|
||||||
mov.16 r1, [OVERLAY_29_POSITION_Y]
|
mov.16 r1, [MENU_POSITION_Y]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [OVERLAY_29_POSITION_X]
|
mov.16 r1, [MENU_POSITION_X]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000011D ; overlay 29: size
|
mov r0, 0x8000011D ; overlay 29: size
|
||||||
mov.16 r1, [OVERLAY_29_HEIGHT]
|
mov.16 r1, [MENU_HEIGHT]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [OVERLAY_29_WIDTH]
|
mov.16 r1, [MENU_WIDTH]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000021D ; overlay 29: framebuffer pointer
|
mov r0, 0x8000021D ; overlay 29: framebuffer pointer
|
||||||
mov r1, [OVERLAY_29_FRAMEBUFFER_PTR]
|
mov r1, [MENU_FRAMEBUFFER_PTR]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000031D
|
mov r0, 0x8000031D
|
||||||
out r0, 1
|
out r0, 1
|
||||||
|
|
10
menu_bar.asm
10
menu_bar.asm
|
@ -15,17 +15,17 @@ enable_menu_bar:
|
||||||
|
|
||||||
; set properties of overlay 30
|
; set properties of overlay 30
|
||||||
mov r0, 0x8000001E ; overlay 30: position
|
mov r0, 0x8000001E ; overlay 30: position
|
||||||
mov.16 r1, [overlay_30_position_y]
|
mov.16 r1, MENU_BAR_POSITION_Y
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_30_position_x]
|
mov.16 r1, MENU_BAR_POSITION_X
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000011E ; overlay 30: size
|
mov r0, 0x8000011E ; overlay 30: size
|
||||||
mov.16 r1, [overlay_30_height]
|
mov.16 r1, MENU_BAR_HEIGHT
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_30_width]
|
mov.16 r1, MENU_BAR_WIDTH
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
|
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
|
||||||
mov r1, [overlay_30_framebuffer_ptr]
|
mov r1, MENU_BAR_FRAMEBUFFER_PTR
|
||||||
out r0, r1
|
out r0, r1
|
||||||
|
|
||||||
; enable overlay 30 (menu bar)
|
; enable overlay 30 (menu bar)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user