WonderWitch/FreyaBIOS/Display: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
(Created page with "The Display interrupt provides an abstraction layer and helpers for the WonderSwan's display hardware. Note that features specific to the WonderSwan Color are implemented using libwwc, which is linked statically with the user program and thus not part of the BIOS call surface. == Interrupts == === INT $12/AH=$00 - display_control === * AH = $00 * BX = Display Control value === INT $12/AH=$01 - display_st...")
 
(fix AH values)
 
(One intermediate revision by the same user not shown)
Line 50: Line 50:
* BX = Color
* BX = Color


<code>
<pre>
15  bit  8  7  bit  0
15  bit  8  7  bit  0
  ---- ----  ---- ----
  ---- ----  ---- ----
Line 57: Line 57:
                 ||++- Foreground color (0-3)
                 ||++- Foreground color (0-3)
                 ++--- Background color (0-3)
                 ++--- Background color (0-3)
</code>
</pre>


Used by <code>font_set_monodata</code>.
Used by <code>font_set_monodata</code>.
Line 63: Line 63:
=== INT $12/AH=$06 - font_get_color ===
=== INT $12/AH=$06 - font_get_color ===


* AH = $05
* AH = $06


Return:
Return:
Line 83: Line 83:
=== INT $12/AH=$08 - screen_get_char ===
=== INT $12/AH=$08 - screen_get_char ===


* AH = $07
* AH = $08
* AL = Screen (0, 1)
* AL = Screen (0, 1)
* BL = Top-left tile X coordinate
* BL = Top-left tile X coordinate
Line 97: Line 97:
=== INT $12/AH=$09 - screen_fill_char ===
=== INT $12/AH=$09 - screen_fill_char ===


* AH = $07
* AH = $09
* AL = Screen (0, 1)
* AL = Screen (0, 1)
* BL = Top-left tile X coordinate
* BL = Top-left tile X coordinate
Line 109: Line 109:
=== INT $12/AH=$0A - screen_fill_attr ===
=== INT $12/AH=$0A - screen_fill_attr ===


* AH = $07
* AH = $0A
* AL = Screen (0, 1)
* AL = Screen (0, 1)
* BL = Top-left tile X coordinate
* BL = Top-left tile X coordinate
Line 213: Line 213:
=== INT $12/AH=$16 - screen2_get_window ===
=== INT $12/AH=$16 - screen2_get_window ===


* AH = $15
* AH = $16


Return:
Return:
Line 296: Line 296:
=== INT $12/AH=$22 - sprite_set_vram ===
=== INT $12/AH=$22 - sprite_set_vram ===


* AH = $21
* AH = $22
* BL = Internal RAM address, shifted right by 9
* BL = Internal RAM address, shifted right by 9


Note: This function is undocumented.
Note: This function is undocumented.

Latest revision as of 13:39, 27 July 2024

The Display interrupt provides an abstraction layer and helpers for the WonderSwan's display hardware.

Note that features specific to the WonderSwan Color are implemented using libwwc, which is linked statically with the user program and thus not part of the BIOS call surface.

Interrupts

INT $12/AH=$00 - display_control

INT $12/AH=$01 - display_status

  • AH = $01

Return:

INT $12/AH=$02 - font_set_monodata

  • AH = $02
  • BX = Starting tile
  • CX = Tile count
  • DS:DX = Input data buffer (8 x Tile count bytes)

Stores 1 bit-per-pixel tile data, which is expanded to 2 bits-per-pixel using the configured color.

INT $12/AH=$03 - font_set_colordata

  • AH = $03
  • BX = Starting tile
  • CX = Tile count
  • DS:DX = Input data buffer (16 x Tile count bytes)

Stores 2 bit-per-pixel tile data.

INT $12/AH=$04 - font_get_data

  • AH = $04
  • BX = Starting tile
  • CX = Tile count
  • DS:DX = Output data buffer (16 x Tile count bytes)

Retrieves 2 bit-per-pixel tile data.

INT $12/AH=$05 - font_set_color

  • AH = $05
  • BX = Color
15  bit  8  7  bit  0
 ---- ----  ---- ----
 .... ....  .... bbff
                 ||||
                 ||++- Foreground color (0-3)
                 ++--- Background color (0-3)

Used by font_set_monodata.

INT $12/AH=$06 - font_get_color

  • AH = $06

Return:

  • AX = Color

INT $12/AH=$07 - screen_set_char

  • AH = $07
  • AL = Screen (0, 1)
  • BL = Top-left tile X coordinate
  • BH = Top-left tile Y coordinate
  • CL = Width, in tiles
  • CH = Height, in tiles
  • DS:DX = Input tilemap buffer (2 x Width x Height bytes)

Places a rectangular tilemap on the specified screen.

INT $12/AH=$08 - screen_get_char

  • AH = $08
  • AL = Screen (0, 1)
  • BL = Top-left tile X coordinate
  • BH = Top-left tile Y coordinate
  • CL = Width, in tiles
  • CH = Height, in tiles
  • DS:DX = Output tilemap buffer (2 x Width x Height bytes)

Retrieves a rectangular tilemap from the specified screen.

Special case: If CL/CH are equal to 0, DS:DX is ignored and instead AX is set to the tile at coordinates (BL, BH).

INT $12/AH=$09 - screen_fill_char

  • AH = $09
  • AL = Screen (0, 1)
  • BL = Top-left tile X coordinate
  • BH = Top-left tile Y coordinate
  • CL = Width, in tiles
  • CH = Height, in tiles
  • DX = Tile attribute

Fills a rectangular area with the specified tile attribute.

INT $12/AH=$0A - screen_fill_attr

  • AH = $0A
  • AL = Screen (0, 1)
  • BL = Top-left tile X coordinate
  • BH = Top-left tile Y coordinate
  • CL = Width, in tiles
  • CH = Height, in tiles
  • DX = Tile data
  • SI = Tile mask

Modifies each tile in the specified rectangular area as follows: tile = ((tile & SI) | DX).

INT $12/AH=$0B - sprite_set_range

INT $12/AH=$0C - sprite_set_char

  • AH = $0C
  • BX = Sprite ID in table (0 - 127)
  • CX = Sprite attribute

INT $12/AH=$0D - sprite_get_char

  • AH = $0D
  • BX = Sprite ID in table (0 - 127)

Return:

  • AX = Sprite attribute

INT $12/AH=$0E - sprite_set_location

  • AH = $0E
  • BX = Sprite ID in table (0 - 127)
  • DL = X coordinate
  • DH = Y coordinate

Note that DL/DH are swapped relative to the order in which the sprite coordinate bytes are stored in memory.

INT $12/AH=$0F - sprite_get_location

  • AH = $0F
  • BX = Sprite ID in table (0 - 127)

Return:

  • AL = X coordinate
  • AH = Y coordinate

INT $12/AH=$10 - sprite_set_char_location

  • AH = $10
  • BX = Sprite ID in table (0 - 127)
  • CX = Sprite attribute
  • DL = X coordinate
  • DH = Y coordinate

INT $12/AH=$11 - sprite_get_char_location

  • AH = $11
  • BX = Sprite ID in table (0 - 127)

Return:

  • AX = Sprite attribute
  • DL = X coordinate
  • DH = Y coordinate

INT $12/AH=$12 - sprite_set_data

  • AH = $12
  • BX = Initial sprite ID in table (0 - 127)
  • CX = Sprite count
  • DS:DX = Input data buffer (4 x Sprite count bytes)

INT $12/AH=$13 - screen_set_scroll

INT $12/AH=$14 - screen_get_scroll

  • AH = $14
  • AL = Screen (0, 1)

Return:

INT $12/AH=$15 - screen2_set_window

INT $12/AH=$16 - screen2_get_window

  • AH = $16

Return:

INT $12/AH=$17 - sprite_set_window

INT $12/AH=$18 - sprite_get_window

  • AH = $18

Return:

INT $12/AH=$19 - palette_set_color

INT $12/AH=$1A - palette_get_color

  • AH = $1A
  • BX = Palette index (0 - 15)

Return:

INT $12/AH=$1B - lcd_set_color

INT $12/AH=$1C - lcd_get_color

  • AH = $1C

Return:

INT $12/AH=$1D - lcd_set_segments

INT $12/AH=$1E - lcd_get_segments

  • AH = $1E

Return:

INT $12/AH=$1F - lcd_set_sleep

INT $12/AH=$20 - lcd_get_sleep

INT $12/AH=$21 - screen_set_vram

  • AH = $21
  • AL = Screen (0, 1)
  • BL = Internal RAM address, shifted right by 11

Note: This function is undocumented.

INT $12/AH=$22 - sprite_set_vram

  • AH = $22
  • BL = Internal RAM address, shifted right by 9

Note: This function is undocumented.