fox32rom: Move enable_cursor to a separate subroutine

This commit is contained in:
Ry 2022-04-25 21:43:19 -07:00
parent 92d4de1016
commit e5c98ddd69
2 changed files with 37 additions and 24 deletions

35
cursor.asm Normal file
View File

@ -0,0 +1,35 @@
; mouse cursor routines
enable_cursor:
push r0
push r1
push r31
; write the cursor bitmap to the overlay framebuffer
mov r0, CURSOR_FRAMEBUFFER_PTR
mov r1, mouse_cursor
mov r31, 96 ; 8x12
enable_cursor_loop:
mov [r0], [r1]
add r0, 4
add r1, 4
loop enable_cursor_loop
; set properties of overlay 31
mov r0, 0x8000011F ; overlay 31: size
mov.16 r1, CURSOR_HEIGHT
sla r1, 16
mov.16 r1, CURSOR_WIDTH
out r0, r1
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
mov r1, CURSOR_FRAMEBUFFER_PTR
out r0, r1
; enable overlay 31 (cursor)
mov r0, 0x8000031F
out r0, 1
pop r31
pop r1
pop r0
ret

View File

@ -34,30 +34,7 @@ disable_all_overlays_loop:
inc r0
out r0, 0
; write the cursor bitmap to the overlay framebuffer
mov r0, CURSOR_FRAMEBUFFER_PTR
mov r1, mouse_cursor
mov r31, 96 ; 8x12
cursor_overlay_loop:
mov [r0], [r1]
add r0, 4
add r1, 4
loop cursor_overlay_loop
cursor_enable:
; set properties of overlay 31
mov r0, 0x8000011F ; overlay 31: size
mov.16 r1, CURSOR_HEIGHT
sla r1, 16
mov.16 r1, CURSOR_WIDTH
out r0, r1
mov r0, 0x8000021F ; overlay 31: framebuffer pointer
mov r1, CURSOR_FRAMEBUFFER_PTR
out r0, r1
; enable overlay 31 (cursor)
mov r0, 0x8000031F
out r0, 1
call enable_cursor
mov r0, BACKGROUND_COLOR
call fill_background
@ -140,6 +117,7 @@ get_rom_version:
; code
#include "background.asm"
#include "boot.asm"
#include "cursor.asm"
#include "debug.asm"
#include "disk.asm"
#include "draw_pixel.asm"