From acf024611b4eb6120199d31df5e89771f4b6a1f6 Mon Sep 17 00:00:00 2001 From: ry755 Date: Thu, 27 Jan 2022 18:11:54 -0800 Subject: [PATCH] fox32+fox32rom: Change the IO port base to 0x80000000 --- mouse.asm | 12 ++++++------ overlay.asm | 20 ++++++++++---------- rom.asm | 16 ++++++++-------- submenu.asm | 10 +++++----- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/mouse.asm b/mouse.asm index d7589ea..a5532da 100644 --- a/mouse.asm +++ b/mouse.asm @@ -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 diff --git a/overlay.asm b/overlay.asm index a92061f..f430581 100644 --- a/overlay.asm +++ b/overlay.asm @@ -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 diff --git a/rom.asm b/rom.asm index eaafb3f..e9833a4 100644 --- a/rom.asm +++ b/rom.asm @@ -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 diff --git a/submenu.asm b/submenu.asm index 7790c18..624fd5a 100644 --- a/submenu.asm +++ b/submenu.asm @@ -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