WonderWitch/FreyaBIOS/Bank: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
No edit summary
Line 99: Line 99:
* AH = $09
* AH = $09
* BX = Bank ID
* BX = Bank ID
Return:
* AX = zero on success (undocumented)

Revision as of 10:39, 20 October 2024

The Bank interrupt provides an abstraction layer for accessing the WonderWitch cartridge's flash and RAM.

Interrupts

INT $18/AH=$00 - bank_set_map

  • AH = $00
  • BL = Bank region
  • CX = Number of bank to map to region

Bank regions:

  • 0 = SRAM (1000:xxxx)
  • 1 = ROM0 (2000:xxxx)
  • 2 = ROM1 (3000:xxxx)

INT $18/AH=$01 - bank_get_map

  • AH = $01
  • BL = Bank region

Return:

  • AX = Number of bank mapped to region

INT $18/AH=$02 - bank_read_byte

  • AH = $02
  • BX = Bank ID
  • DX = Offset within bank

Return:

  • AL = Byte read

Bank ID format:

15  bit  8  7  bit  0
 ---- ----  ---- ----
 tiii iiii  iiii iiii
 |||| ||||  |||| ||||
 |+++-++++--++++-++++- Number of bank
 +-------------------- 0 = SRAM, 1 = Flash

INT $18/AH=$03 - bank_write_byte

  • AH = $03
  • BX = Bank ID
  • CL = Byte to write
  • DX = Offset within bank

INT $18/AH=$04 - bank_read_word

  • AH = $04
  • BX = Bank ID
  • DX = Offset within bank

Return:

  • AX = Word read

INT $18/AH=$05 - bank_write_word

  • AH = $05
  • BX = Bank ID
  • CX = Word to write
  • DX = Offset within bank

INT $18/AH=$06 - bank_read_block

  • AH = $06
  • BX = Bank ID
  • CX = Number of bytes to read
  • DX = Offset within bank
  • DS:SI = Output buffer, of size CX

INT $18/AH=$07 - bank_write_block

  • AH = $07
  • BX = Bank ID
  • CX = Number of bytes to write
  • DX = Offset within bank
  • DS:SI = Input buffer, of size CX

INT $18/AH=$08 - bank_fill_block

  • AH = $08
  • AL = Fill value
  • BX = Bank ID
  • CX = Number of bytes to write
  • DX = Offset within bank

Sets CX bytes in bank BX to value AL starting at offset DX.

INT $18/AH=$09 - bank_erase_flash

  • AH = $09
  • BX = Bank ID

Return:

  • AX = zero on success (undocumented)