fox32rom: Add read_sector and write_sector
This commit is contained in:
parent
33408802eb
commit
6dde85a921
43
disk.asm
Normal file
43
disk.asm
Normal file
|
@ -0,0 +1,43 @@
|
|||
; disk routines
|
||||
|
||||
; read a sector into the specified memory buffer
|
||||
; inputs:
|
||||
; r0: sector number
|
||||
; r1: disk ID
|
||||
; r2: sector buffer (512 bytes)
|
||||
; outputs:
|
||||
; none
|
||||
read_sector:
|
||||
push r3
|
||||
push r4
|
||||
|
||||
mov r3, 0x80002000 ; command to set the location of the buffer
|
||||
mov r4, 0x80003000 ; command to read a sector from a disk into the buffer
|
||||
or.8 r4, r1 ; set the disk ID
|
||||
out r3, r2 ; set the memory buffer location
|
||||
out r4, r0 ; read the sector into memory
|
||||
|
||||
pop r4
|
||||
pop r3
|
||||
ret
|
||||
|
||||
; wrtie a sector from the specified memory buffer
|
||||
; inputs:
|
||||
; r0: sector number
|
||||
; r1: disk ID
|
||||
; r2: sector buffer (512 bytes)
|
||||
; outputs:
|
||||
; none
|
||||
write_sector:
|
||||
push r3
|
||||
push r4
|
||||
|
||||
mov r3, 0x80002000 ; command to set the location of the buffer
|
||||
mov r4, 0x80004000 ; command to write a sector to a disk from the buffer
|
||||
or.8 r4, r1 ; set the disk ID
|
||||
out r3, r2 ; set the memory buffer location
|
||||
out r4, r0 ; write the sector from memory
|
||||
|
||||
pop r4
|
||||
pop r3
|
||||
ret
|
|
@ -45,6 +45,10 @@ draw_menu_items: jmp [0xF0044014]
|
|||
close_menu: jmp [0xF0044018]
|
||||
menu_update_event: jmp [0xF004401C]
|
||||
|
||||
; disk jump table
|
||||
read_sector: jmp [0xF0045000]
|
||||
write_sector: jmp [0xF0045004]
|
||||
|
||||
; event types
|
||||
const MOUSE_CLICK_EVENT_TYPE: 0x00000000
|
||||
const MENU_BAR_CLICK_EVENT_TYPE: 0x00000001
|
||||
|
|
6
main.asm
6
main.asm
|
@ -127,6 +127,7 @@ get_rom_version:
|
|||
#include "background.asm"
|
||||
#include "boot.asm"
|
||||
#include "debug.asm"
|
||||
#include "disk.asm"
|
||||
#include "draw_rectangle.asm"
|
||||
#include "draw_text.asm"
|
||||
#include "event.asm"
|
||||
|
@ -194,6 +195,11 @@ get_rom_version:
|
|||
data.32 close_menu
|
||||
data.32 menu_update_event
|
||||
|
||||
; disk jump table
|
||||
org.pad 0xF0045000
|
||||
data.32 read_sector
|
||||
data.32 write_sector
|
||||
|
||||
org.pad 0xF004F000
|
||||
standard_font_width:
|
||||
data.16 8
|
||||
|
|
Loading…
Reference in New Issue
Block a user