fox32+fox32rom: Change the IO port base to 0x80000000
This commit is contained in:
parent
f964815203
commit
acf024611b
12
mouse.asm
12
mouse.asm
|
@ -8,7 +8,7 @@
|
||||||
; r0: X coordinate
|
; r0: X coordinate
|
||||||
; r1: Y coordinate
|
; r1: Y coordinate
|
||||||
get_mouse_position:
|
get_mouse_position:
|
||||||
in r0, 0x0200001F ; overlay 31: position
|
in r0, 0x8000001F ; overlay 31: position
|
||||||
mov r1, r0
|
mov r1, r0
|
||||||
and r0, 0x0000FFFF ; r0: overlay X position
|
and r0, 0x0000FFFF ; r0: overlay X position
|
||||||
sra r1, 16 ; r1: overlay Y position
|
sra r1, 16 ; r1: overlay Y position
|
||||||
|
@ -21,7 +21,7 @@ get_mouse_position:
|
||||||
; outputs:
|
; outputs:
|
||||||
; r0: button state
|
; r0: button state
|
||||||
get_mouse_button:
|
get_mouse_button:
|
||||||
in r0, 0x02000400 ; mouse button states
|
in r0, 0x80000400 ; mouse button states
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -35,15 +35,15 @@ mouse_update:
|
||||||
push r4
|
push r4
|
||||||
push r5
|
push r5
|
||||||
|
|
||||||
mov r0, 0x0200001F ; overlay 31: position
|
mov r0, 0x8000001F ; overlay 31: position
|
||||||
in r2, 0x02000401 ; mouse position
|
in r2, 0x80000401 ; mouse position
|
||||||
out r0, r2
|
out r0, r2
|
||||||
|
|
||||||
movz.16 r0, r2 ; r0: X position
|
movz.16 r0, r2 ; r0: X position
|
||||||
mov r1, r2
|
mov r1, r2
|
||||||
sra r1, 16 ; r1: Y position
|
sra r1, 16 ; r1: Y position
|
||||||
|
|
||||||
mov r2, 0x02000400 ; mouse button states
|
mov r2, 0x80000400 ; mouse button states
|
||||||
in r3, r2
|
in r3, r2
|
||||||
|
|
||||||
; check click bit
|
; check click bit
|
||||||
|
@ -64,7 +64,7 @@ mouse_update:
|
||||||
|
|
||||||
; if a submenu is open, don't push a click event
|
; if a submenu is open, don't push a click event
|
||||||
; this is hacky as fuck
|
; this is hacky as fuck
|
||||||
in r3, 0x0200031D ; overlay 29: enable status
|
in r3, 0x8000031D ; overlay 29: enable status
|
||||||
cmp r3, 0
|
cmp r3, 0
|
||||||
ifnz jmp mouse_update_end
|
ifnz jmp mouse_update_end
|
||||||
|
|
||||||
|
|
20
overlay.asm
20
overlay.asm
|
@ -13,8 +13,8 @@ fill_overlay:
|
||||||
push r31
|
push r31
|
||||||
|
|
||||||
mov r2, r1
|
mov r2, r1
|
||||||
or r2, 0x02000100 ; bitwise or the overlay number with the command to get the overlay size
|
or r2, 0x80000100 ; 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 r1, 0x80000200 ; bitwise or the overlay number with the command to get the framebuffer pointer
|
||||||
in r1, r1 ; r1: overlay framebuffer poiner
|
in r1, r1 ; r1: overlay framebuffer poiner
|
||||||
in r2, r2
|
in r2, r2
|
||||||
mov r3, r2
|
mov r3, r2
|
||||||
|
@ -55,14 +55,14 @@ draw_filled_rectangle_to_overlay:
|
||||||
|
|
||||||
; calculate pointer to the framebuffer
|
; calculate pointer to the framebuffer
|
||||||
mov r6, r5 ; r6: overlay number
|
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
|
in r7, r6
|
||||||
and r7, 0x0000FFFF ; mask off the height, we only need the width
|
and r7, 0x0000FFFF ; mask off the height, we only need the width
|
||||||
mul r7, 4 ; r7: overlay width in bytes (width * 4)
|
mul r7, 4 ; r7: overlay width in bytes (width * 4)
|
||||||
mul r1, r7 ; y * width * 4
|
mul r1, r7 ; y * width * 4
|
||||||
mul r0, 4 ; x * 4
|
mul r0, 4 ; x * 4
|
||||||
add r0, r1 ; y * width * 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
|
in r5, r5
|
||||||
add r0, r5 ; r0: pointer to framebuffer
|
add r0, r5 ; r0: pointer to framebuffer
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ draw_font_tile_to_overlay:
|
||||||
|
|
||||||
; calculate pointer to the framebuffer
|
; calculate pointer to the framebuffer
|
||||||
mov r7, r5 ; r7: overlay number
|
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
|
in r6, r7
|
||||||
and r6, 0x0000FFFF ; mask off the height, we only need the width
|
and r6, 0x0000FFFF ; mask off the height, we only need the width
|
||||||
mul r6, 4 ; 4 bytes per pixel
|
mul r6, 4 ; 4 bytes per pixel
|
||||||
|
@ -134,7 +134,7 @@ draw_font_tile_to_overlay:
|
||||||
mul r2, r7 ; y * width * 4
|
mul r2, r7 ; y * width * 4
|
||||||
mul r1, 4 ; x * 4
|
mul r1, 4 ; x * 4
|
||||||
add r1, r2 ; y * width * 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
|
in r6, r5
|
||||||
add r1, r6 ; r1: pointer to framebuffer
|
add r1, r6 ; r1: pointer to framebuffer
|
||||||
|
|
||||||
|
@ -233,14 +233,14 @@ check_if_overlay_covers_position:
|
||||||
push r7
|
push r7
|
||||||
|
|
||||||
mov r3, r2
|
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
|
in r4, r3
|
||||||
mov r5, r4
|
mov r5, r4
|
||||||
and r4, 0x0000FFFF ; r4: X position
|
and r4, 0x0000FFFF ; r4: X position
|
||||||
sra r5, 16 ; r5: Y position
|
sra r5, 16 ; r5: Y position
|
||||||
|
|
||||||
mov r3, r2
|
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
|
in r6, r3
|
||||||
mov r7, r6
|
mov r7, r6
|
||||||
and r6, 0x0000FFFF ; r6: width
|
and r6, 0x0000FFFF ; r6: width
|
||||||
|
@ -313,7 +313,7 @@ check_if_enabled_overlay_covers_position:
|
||||||
push r4
|
push r4
|
||||||
|
|
||||||
mov r3, r2
|
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
|
in r4, r3
|
||||||
|
|
||||||
cmp r4, 0
|
cmp r4, 0
|
||||||
|
@ -343,7 +343,7 @@ make_coordinates_relative_to_overlay:
|
||||||
push r2
|
push r2
|
||||||
push r3
|
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
|
in r2, r2
|
||||||
mov r3, r2
|
mov r3, r2
|
||||||
and r2, 0x0000FFFF ; r2: overlay X position
|
and r2, 0x0000FFFF ; r2: overlay X position
|
||||||
|
|
16
rom.asm
16
rom.asm
|
@ -14,7 +14,7 @@ entry:
|
||||||
|
|
||||||
; disable all overlays
|
; disable all overlays
|
||||||
mov r31, 0x1F
|
mov r31, 0x1F
|
||||||
mov r0, 0x02000300
|
mov r0, 0x80000300
|
||||||
disable_all_overlays_loop:
|
disable_all_overlays_loop:
|
||||||
out r0, 0
|
out r0, 0
|
||||||
inc r0
|
inc r0
|
||||||
|
@ -32,17 +32,17 @@ cursor_overlay_loop:
|
||||||
|
|
||||||
cursor_enable:
|
cursor_enable:
|
||||||
; set properties of overlay 31
|
; set properties of overlay 31
|
||||||
mov r0, 0x0200011F ; overlay 31: size
|
mov r0, 0x8000011F ; overlay 31: size
|
||||||
mov.16 r1, [overlay_31_height]
|
mov.16 r1, [overlay_31_height]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_31_width]
|
mov.16 r1, [overlay_31_width]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200021F ; overlay 31: framebuffer pointer
|
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
|
||||||
mov r1, [overlay_31_framebuffer_ptr]
|
mov r1, [overlay_31_framebuffer_ptr]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
|
|
||||||
; enable overlay 31 (cursor)
|
; enable overlay 31 (cursor)
|
||||||
mov r0, 0x0200031F
|
mov r0, 0x8000031F
|
||||||
out r0, 1
|
out r0, 1
|
||||||
|
|
||||||
mov r0, background_color
|
mov r0, background_color
|
||||||
|
@ -50,22 +50,22 @@ cursor_enable:
|
||||||
|
|
||||||
menu_bar_enable:
|
menu_bar_enable:
|
||||||
; set properties of overlay 30
|
; set properties of overlay 30
|
||||||
mov r0, 0x0200001E ; overlay 30: position
|
mov r0, 0x8000001E ; overlay 30: position
|
||||||
mov.16 r1, [overlay_30_position_y]
|
mov.16 r1, [overlay_30_position_y]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_30_position_x]
|
mov.16 r1, [overlay_30_position_x]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200011E ; overlay 30: size
|
mov r0, 0x8000011E ; overlay 30: size
|
||||||
mov.16 r1, [overlay_30_height]
|
mov.16 r1, [overlay_30_height]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_30_width]
|
mov.16 r1, [overlay_30_width]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200021E ; overlay 30: framebuffer pointer
|
mov r0, 0x8000021E ; overlay 30: framebuffer pointer
|
||||||
mov r1, [overlay_30_framebuffer_ptr]
|
mov r1, [overlay_30_framebuffer_ptr]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
|
|
||||||
; enable overlay 30 (menu bar)
|
; enable overlay 30 (menu bar)
|
||||||
mov r0, 0x0200031E
|
mov r0, 0x8000031E
|
||||||
out r0, 1
|
out r0, 1
|
||||||
|
|
||||||
call clear_menu_bar
|
call clear_menu_bar
|
||||||
|
|
10
submenu.asm
10
submenu.asm
|
@ -69,20 +69,20 @@ draw_submenu_items_calculate_x_skip:
|
||||||
; set properties of overlay 29
|
; set properties of overlay 29
|
||||||
mov.16 [overlay_29_position_y], 16
|
mov.16 [overlay_29_position_y], 16
|
||||||
mov [overlay_29_framebuffer_ptr], overlay_29_framebuffer
|
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]
|
mov.16 r1, [overlay_29_position_y]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_29_position_x]
|
mov.16 r1, [overlay_29_position_x]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200011D ; overlay 29: size
|
mov r0, 0x8000011D ; overlay 29: size
|
||||||
mov.16 r1, [overlay_29_height]
|
mov.16 r1, [overlay_29_height]
|
||||||
sla r1, 16
|
sla r1, 16
|
||||||
mov.16 r1, [overlay_29_width]
|
mov.16 r1, [overlay_29_width]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200021D ; overlay 29: framebuffer pointer
|
mov r0, 0x8000021D ; overlay 29: framebuffer pointer
|
||||||
mov r1, [overlay_29_framebuffer_ptr]
|
mov r1, [overlay_29_framebuffer_ptr]
|
||||||
out r0, r1
|
out r0, r1
|
||||||
mov r0, 0x0200031D
|
mov r0, 0x8000031D
|
||||||
out r0, 1
|
out r0, 1
|
||||||
|
|
||||||
; draw empty submenu
|
; draw empty submenu
|
||||||
|
@ -159,7 +159,7 @@ close_submenu:
|
||||||
push r1
|
push r1
|
||||||
|
|
||||||
; disable overlay 29
|
; disable overlay 29
|
||||||
mov r1, 0x0200031D
|
mov r1, 0x8000031D
|
||||||
out r1, 0
|
out r1, 0
|
||||||
|
|
||||||
mov r1, 0xFFFFFFFF
|
mov r1, 0xFFFFFFFF
|
||||||
|
|
Loading…
Reference in New Issue
Block a user