WonderWitch/FreyaBIOS/Display
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_status
- AH = $01
Return:
- AX = Display Control value
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
- AH = $0B
- BX = Sprite Table First
- CX = Sprite Table Count
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
- AH = $13
- AL = Screen (0, 1)
- BL = Screen Scroll X value
- BH = Screen Scroll Y value
INT $12/AH=$14 - screen_get_scroll
- AH = $14
- AL = Screen (0, 1)
Return:
- AL = Screen Scroll X value
- AH = Screen Scroll Y value
INT $12/AH=$15 - screen2_set_window
- AH = $15
- BL = Screen 2 Window Left value
- BH = Screen 2 Window Top value
- CL = Window width
- CH = Window height
INT $12/AH=$16 - screen2_get_window
- AH = $16
Return:
- AL = Screen 2 Window Left value
- AH = Screen 2 Window Top value
- DL = Window width
- DH = Window height
INT $12/AH=$17 - sprite_set_window
- AH = $17
- BL = Sprite Window Left value
- BH = Sprite Window Top value
- CL = Window width
- CH = Window height
INT $12/AH=$18 - sprite_get_window
- AH = $18
Return:
- AL = Sprite Window Left value
- AH = Sprite Window Top value
- DL = Window width
- DH = Window height
INT $12/AH=$19 - palette_set_color
- AH = $19
- BX = Palette index (0 - 15)
- CX = LCD Mono Palette value
INT $12/AH=$1A - palette_get_color
- AH = $1A
- BX = Palette index (0 - 15)
Return:
- AX = LCD Mono Palette value
INT $12/AH=$1B - lcd_set_color
- AH = $1B
- CX:BX = LCD Mono Shade LUT value
INT $12/AH=$1C - lcd_get_color
- AH = $1C
Return:
- DX:AX = LCD Mono Shade LUT value
INT $12/AH=$1D - lcd_set_segments
- AH = $1D
- BX = LCD Icon Control value
INT $12/AH=$1E - lcd_get_segments
- AH = $1E
Return:
- AX = LCD Icon Control value
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.