fox32+fox32rom: Change the IO port base to 0x80000000

This commit is contained in:
ry755 2022-01-27 18:11:54 -08:00 committed by Ry
parent f964815203
commit acf024611b
4 changed files with 29 additions and 29 deletions

View File

@ -8,7 +8,7 @@
; r0: X coordinate
; r1: Y coordinate
get_mouse_position:
in r0, 0x0200001F ; overlay 31: position
in r0, 0x8000001F ; overlay 31: position
mov r1, r0
and r0, 0x0000FFFF ; r0: overlay X position
sra r1, 16 ; r1: overlay Y position
@ -21,7 +21,7 @@ get_mouse_position:
; outputs:
; r0: button state
get_mouse_button:
in r0, 0x02000400 ; mouse button states
in r0, 0x80000400 ; mouse button states
ret
@ -35,15 +35,15 @@ mouse_update:
push r4
push r5
mov r0, 0x0200001F ; overlay 31: position
in r2, 0x02000401 ; mouse position
mov r0, 0x8000001F ; overlay 31: position
in r2, 0x80000401 ; mouse position
out r0, r2
movz.16 r0, r2 ; r0: X position
mov r1, r2
sra r1, 16 ; r1: Y position
mov r2, 0x02000400 ; mouse button states
mov r2, 0x80000400 ; mouse button states
in r3, r2
; check click bit
@ -64,7 +64,7 @@ mouse_update:
; if a submenu is open, don't push a click event
; this is hacky as fuck
in r3, 0x0200031D ; overlay 29: enable status
in r3, 0x8000031D ; overlay 29: enable status
cmp r3, 0
ifnz jmp mouse_update_end

View File

@ -13,8 +13,8 @@ fill_overlay:
push r31
mov r2, r1
or r2, 0x02000100 ; bitwise or the overlay number with the command to get the overlay size
or r1, 0x02000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
or r2, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
or r1, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r1, r1 ; r1: overlay framebuffer poiner
in r2, r2
mov r3, r2
@ -55,14 +55,14 @@ draw_filled_rectangle_to_overlay:
; calculate pointer to the framebuffer
mov r6, r5 ; r6: overlay number
or r6, 0x02000100 ; bitwise or the overlay number with the command to get the overlay size
or r6, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
in r7, r6
and r7, 0x0000FFFF ; mask off the height, we only need the width
mul r7, 4 ; r7: overlay width in bytes (width * 4)
mul r1, r7 ; y * width * 4
mul r0, 4 ; x * 4
add r0, r1 ; y * width * 4 + (x * 4)
or r5, 0x02000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r5, r5
add r0, r5 ; r0: pointer to framebuffer
@ -126,7 +126,7 @@ draw_font_tile_to_overlay:
; calculate pointer to the framebuffer
mov r7, r5 ; r7: overlay number
or r7, 0x02000100 ; bitwise or the overlay number with the command to get the overlay size
or r7, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
in r6, r7
and r6, 0x0000FFFF ; mask off the height, we only need the width
mul r6, 4 ; 4 bytes per pixel
@ -134,7 +134,7 @@ draw_font_tile_to_overlay:
mul r2, r7 ; y * width * 4
mul r1, 4 ; x * 4
add r1, r2 ; y * width * 4 + (x * 4)
or r5, 0x02000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
or r5, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
in r6, r5
add r1, r6 ; r1: pointer to framebuffer
@ -233,14 +233,14 @@ check_if_overlay_covers_position:
push r7
mov r3, r2
or r3, 0x02000000 ; bitwise or the overlay number with the command to get the overlay position
or r3, 0x80000000 ; bitwise or the overlay number with the command to get the overlay position
in r4, r3
mov r5, r4
and r4, 0x0000FFFF ; r4: X position
sra r5, 16 ; r5: Y position
mov r3, r2
or r3, 0x02000100 ; bitwise or the overlay number with the command to get the overlay size
or r3, 0x80000100 ; bitwise or the overlay number with the command to get the overlay size
in r6, r3
mov r7, r6
and r6, 0x0000FFFF ; r6: width
@ -313,7 +313,7 @@ check_if_enabled_overlay_covers_position:
push r4
mov r3, r2
or r3, 0x02000300 ; bitwise or the overlay number with the command to get the overlay enable status
or r3, 0x80000300 ; bitwise or the overlay number with the command to get the overlay enable status
in r4, r3
cmp r4, 0
@ -343,7 +343,7 @@ make_coordinates_relative_to_overlay:
push r2
push r3
or r2, 0x02000000 ; bitwise or the overlay number with the command to get the overlay position
or r2, 0x80000000 ; bitwise or the overlay number with the command to get the overlay position
in r2, r2
mov r3, r2
and r2, 0x0000FFFF ; r2: overlay X position

16
rom.asm
View File

@ -14,7 +14,7 @@ entry:
; disable all overlays
mov r31, 0x1F
mov r0, 0x02000300
mov r0, 0x80000300
disable_all_overlays_loop:
out r0, 0
inc r0
@ -32,17 +32,17 @@ cursor_overlay_loop:
cursor_enable:
; set properties of overlay 31
mov r0, 0x0200011F ; overlay 31: size
mov r0, 0x8000011F ; overlay 31: size
mov.16 r1, [overlay_31_height]
sla r1, 16
mov.16 r1, [overlay_31_width]
out r0, r1
mov r0, 0x0200021F ; overlay 31: framebuffer pointer
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
mov r1, [overlay_31_framebuffer_ptr]
out r0, r1
; enable overlay 31 (cursor)
mov r0, 0x0200031F
mov r0, 0x8000031F
out r0, 1
mov r0, background_color
@ -50,22 +50,22 @@ cursor_enable:
menu_bar_enable:
; set properties of overlay 30
mov r0, 0x0200001E ; overlay 30: position
mov r0, 0x8000001E ; overlay 30: position
mov.16 r1, [overlay_30_position_y]
sla r1, 16
mov.16 r1, [overlay_30_position_x]
out r0, r1
mov r0, 0x0200011E ; overlay 30: size
mov r0, 0x8000011E ; overlay 30: size
mov.16 r1, [overlay_30_height]
sla r1, 16
mov.16 r1, [overlay_30_width]
out r0, r1
mov r0, 0x0200021E ; overlay 30: framebuffer pointer
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
mov r1, [overlay_30_framebuffer_ptr]
out r0, r1
; enable overlay 30 (menu bar)
mov r0, 0x0200031E
mov r0, 0x8000031E
out r0, 1
call clear_menu_bar

View File

@ -69,20 +69,20 @@ draw_submenu_items_calculate_x_skip:
; set properties of overlay 29
mov.16 [overlay_29_position_y], 16
mov [overlay_29_framebuffer_ptr], overlay_29_framebuffer
mov r0, 0x0200001D ; overlay 29: position
mov r0, 0x8000001D ; overlay 29: position
mov.16 r1, [overlay_29_position_y]
sla r1, 16
mov.16 r1, [overlay_29_position_x]
out r0, r1
mov r0, 0x0200011D ; overlay 29: size
mov r0, 0x8000011D ; overlay 29: size
mov.16 r1, [overlay_29_height]
sla r1, 16
mov.16 r1, [overlay_29_width]
out r0, r1
mov r0, 0x0200021D ; overlay 29: framebuffer pointer
mov r0, 0x8000021D ; overlay 29: framebuffer pointer
mov r1, [overlay_29_framebuffer_ptr]
out r0, r1
mov r0, 0x0200031D
mov r0, 0x8000031D
out r0, 1
; draw empty submenu
@ -159,7 +159,7 @@ close_submenu:
push r1
; disable overlay 29
mov r1, 0x0200031D
mov r1, 0x8000031D
out r1, 0
mov r1, 0xFFFFFFFF