VDC I/ | |
Ports. | |
videoport | VDC port |
video_reg | VDC register latch |
video_data | VDC data |
VDC status flags. | Description of the status flags returned by reading video_reg. |
VDC_STATUS_SPR_COLLISION | Set when the sprite #0 collision detection interrupt occurs. |
VDC_STATUS_SPR_OVERFLOW | Set when the sprite overflow interrupt occurs. |
VDC_STATUS_HBLANK | Set when the horizontal blank interrupt occurs. |
VDC_STATUS_SATB_DMA_END | Set when the VRAM to SATB DMA transfer completion interrupt occurs. |
VDC_STATUS_VRAM_DMA_END | Set when the VRAM to VRAM DMA transfer completion interrupt occurs. |
VDC_STATUS_VBLANK | Set when the vertical blank interrupt occurs. |
VDC_STATUS_BUSY | Set when the VDC is waiting for a CPU access slot during the active display area. |
VDC registers. | |
Registers. | |
VDC_MAWR | Memory Address Write Register |
VDC_MARR | Memory Address Read Register |
VDC_DATA | VRAM Data register |
VDC_CR | Control Register |
VDC_RCR | Raster Compare Register |
VDC_BXR | Background X Scroll Register |
VDC_BYR | Background Y Scroll Register |
VDC_MWR | Memory Width Register (MWR) |
VDC_HSR | Horizontal Synchro Register |
VDC_HDR | Horizontal Display Register |
VDC_VSR | Vertical Synchro Register |
VDC_VDR | Vertical Display Register |
VDC_VCR | Vertical Display End Position Register |
VDC_DMA_CR | DMA Control Register |
VDC_DMA_SRC | DMA Source Address Register |
VDC_DMA_DST | DMA Destination Address Register |
VDC_DMA_LEN | DMA Transfer Length Register |
VDC_SAT_SRC | VRAM-SAT Source Address Register |
Control Register Flags. | |
VDC_CR_SPR_COLLISION_ENABLE | Enables sprite collision interrupt. |
VDC_CR_SPR_OVERFLOW_ENABLE | Enables sprite overflow interrupt. |
VDC_CR_HBLANK_ENABLE | Enables horizontal blank interrupt. |
VDC_CR_VBLANK_ENABLE | Enables vertical blank interrupt. |
VDC_CR_SPR_ENABLE | Enables sprites layer. |
VDC_CR_BG_ENABLE | Enables background layer. |
VDC_CR_RW_INC_1 | Read/write address auto-increment by 1 word. |
VDC_CR_RW_INC_32 | Read/write address auto-increment by 32 words. |
VDC_CR_RW_INC_64 | Read/write address auto-increment by 64 words. |
VDC_CR_RW_INC_128 | Read/write address auto-increment by 128 words. |
Background Map Virtual Size. | |
VDC_BG_32x32 | 32x32 virtual background map. |
VDC_BG_64x32 | 64x32 virtual background map. |
VDC_BG_128x32 | 128x32 virtual background map. |
VDC_BG_32x64 | 32x64 virtual background map. |
VDC_BG_64x64 | 64x64 virtual background map. |
VDC_BG_128x64 | 128x64 virtual background map. |
DMA Control Register Flags. | |
VDC_DMA_SATB_ENABLE | Enables VRAM to SATB end of transfer interrupt. |
VDC_DMA_VRAM_ENABLE | Enables VRAM to VRAM end of transfer interrupt. |
VDC_DMA_SRC_INC | Source address direction (increment). |
VDC_DMA_SRC_DEC | Source address direction (decrement). |
VDC_DMA_DST_INC | Destination address direction (increment). |
VDC_DMA_DST_DEC | Destination address direction (decrement). |
VDC_DMA_SAT_AUTO | Enable SAT DMA auto-transfer. |
VDC resgister copy in zero-page. | |
vdc_disp | VDC display flag. |
vdc_crl | Copy of the VDC control register LSB. |
vdc_crh | Copy of the VDC control register MSB. |
vdc_sr | Copy of the VDC status register. |
vdc_ri | Copy of the VDC register index. |
VDC Helper Macros. | |
VDC_HSR_db | Compute the value of the VDC_HSR register for a given horizontal screen resolution. |
VDC_HDR_db | Compute the value of the VDC_HDR register for a given horizontal screen resolution. |
vdc_reg | Initialize VDC register. |
vdc_setreg | Set VDC register from value in A. |
vdc_data | Set VDC data. |
vdc_enable_display | Enable background tiles and sprites display. |
vdc_disable_display | Disable background tiles and sprites display. |
vdc_set_cr | Set VDC control registers |
vdc_wait_vsync | Wait for VSYNC. |
Default VDC values. | |
VDC_DEFAULT_BG_SIZE | Default virtual background map size. |
VDC_DEFAULT_TILE_ADDR | Default tile address. |
VDC_DEFAULT_XRES | Default horizontal resolution. |
VDC_DEFAULT_SAT_ADDR | Default SAT VRAM offset. |
video_reg = videoport
VDC register latch
Description of the status flags returned by reading video_reg.
bit 15-07 | unused |
bit 6 | busy flag (VDC_STATUS_BUSY) |
bit 5 | vertical blanking flag (VDC_STATUS_VBLANK) |
bit 4 | VRAM to VRAM DMA end of transfer flag (VDC_STATUS_VRAM_DMA_END) |
bit 3 | VRAM to SATB DMA end of transfer flag (VDC_STATUS_SATB_DMA_END) |
bit 2 | scanline interrupt flag (VDC_STATUS_HBLANK) |
bit 1 | sprite overflow flag (VDC_STATUS_SPR_OVERFLOW) |
bit 0 | sprite collision flag (VDC_STATUS_SPR_COLLISION) |
Registers. | |
VDC_MAWR | Memory Address Write Register |
VDC_MARR | Memory Address Read Register |
VDC_DATA | VRAM Data register |
VDC_CR | Control Register |
VDC_RCR | Raster Compare Register |
VDC_BXR | Background X Scroll Register |
VDC_BYR | Background Y Scroll Register |
VDC_MWR | Memory Width Register (MWR) |
VDC_HSR | Horizontal Synchro Register |
VDC_HDR | Horizontal Display Register |
VDC_VSR | Vertical Synchro Register |
VDC_VDR | Vertical Display Register |
VDC_VCR | Vertical Display End Position Register |
VDC_DMA_CR | DMA Control Register |
VDC_DMA_SRC | DMA Source Address Register |
VDC_DMA_DST | DMA Destination Address Register |
VDC_DMA_LEN | DMA Transfer Length Register |
VDC_SAT_SRC | VRAM-SAT Source Address Register |
Control Register Flags. | |
VDC_CR_SPR_COLLISION_ENABLE | Enables sprite collision interrupt. |
VDC_CR_SPR_OVERFLOW_ENABLE | Enables sprite overflow interrupt. |
VDC_CR_HBLANK_ENABLE | Enables horizontal blank interrupt. |
VDC_CR_VBLANK_ENABLE | Enables vertical blank interrupt. |
VDC_CR_SPR_ENABLE | Enables sprites layer. |
VDC_CR_BG_ENABLE | Enables background layer. |
VDC_CR_RW_INC_1 | Read/write address auto-increment by 1 word. |
VDC_CR_RW_INC_32 | Read/write address auto-increment by 32 words. |
VDC_CR_RW_INC_64 | Read/write address auto-increment by 64 words. |
VDC_CR_RW_INC_128 | Read/write address auto-increment by 128 words. |
Background Map Virtual Size. | |
VDC_BG_32x32 | 32x32 virtual background map. |
VDC_BG_64x32 | 64x32 virtual background map. |
VDC_BG_128x32 | 128x32 virtual background map. |
VDC_BG_32x64 | 32x64 virtual background map. |
VDC_BG_64x64 | 64x64 virtual background map. |
VDC_BG_128x64 | 128x64 virtual background map. |
DMA Control Register Flags. | |
VDC_DMA_SATB_ENABLE | Enables VRAM to SATB end of transfer interrupt. |
VDC_DMA_VRAM_ENABLE | Enables VRAM to VRAM end of transfer interrupt. |
VDC_DMA_SRC_INC | Source address direction (increment). |
VDC_DMA_SRC_DEC | Source address direction (decrement). |
VDC_DMA_DST_INC | Destination address direction (increment). |
VDC_DMA_DST_DEC | Destination address direction (decrement). |
VDC_DMA_SAT_AUTO | Enable SAT DMA auto-transfer. |
VDC resgister copy in zero-page. | |
vdc_disp | VDC display flag. |
vdc_crl | Copy of the VDC control register LSB. |
vdc_crh | Copy of the VDC control register MSB. |
vdc_sr | Copy of the VDC status register. |
vdc_ri | Copy of the VDC register index. |
VDC Helper Macros. | |
VDC_HSR_db | Compute the value of the VDC_HSR register for a given horizontal screen resolution. |
VDC_HDR_db | Compute the value of the VDC_HDR register for a given horizontal screen resolution. |
vdc_reg | Initialize VDC register. |
vdc_setreg | Set VDC register from value in A. |
vdc_data | Set VDC data. |
vdc_enable_display | Enable background tiles and sprites display. |
vdc_disable_display | Disable background tiles and sprites display. |
vdc_set_cr | Set VDC control registers |
vdc_wait_vsync | Wait for VSYNC. |
Default VDC values. | |
VDC_DEFAULT_BG_SIZE | Default virtual background map size. |
VDC_DEFAULT_TILE_ADDR | Default tile address. |
VDC_DEFAULT_XRES | Default horizontal resolution. |
VDC_DEFAULT_SAT_ADDR | Default SAT VRAM offset. |
VDC_DATA = $02
VRAM Data register
VDC_CR = $05
Control Register
Enables or disables VDC interrupts, background or sprite display, and set the read and write auto-increment. See Control Register Flags for a complete description.
bit 15-13 | Unused |
bit 12-11 | Read/Write auto-increment value VDC_CR_RW_INC_1, VDC_CR_RW_INC_32, VDC_CR_RW_INC_64, VDC_CR_RW_INC_128 |
bit 10 | DRAM refresh enable (unused) |
bit 9-8 | DISP terminal output mode (unused) |
bit 7 | Background enable VDC_CR_BG_ENABLE |
bit 6 | Sprite enable VDC_CR_SPR_ENABLE |
bit 5-4 | External sync (unused) |
bit 3 | Enable interrupt for vertical blanking VDC_CR_VBLANK_ENABLE |
bit 2 | Enable interrupt for raster compare VDC_CR_HBLANK_ENABLE |
bit 1 | Enable interrupt for sprite overflow VDC_CR_SPR_OVERFLOW_ENABLE |
bit 0 | Enable interrupt for sprite #0 collision VDC_CR_SPR_COLLISION_ENABLE |
VDC_MWR = $09
Memory Width Register (MWR)
Set virtual background map size.
bit 15-8 | Unused |
bit 7 | CG Mode |
bit 4-6 | Background Map Virtual Size |
bit 3-2 | Sprite Dot Period |
bit 0-1 | VRAM Dot Width |
VDC_DMA_CR = $0F
DMA Control Register
Enables or disables VRAM to VRAM or VRAM to SATB end of transfer interrupts. Set source and destination direction (increment or decrement), and enable or disable SATB DMA automatic transfer (see DMA Control Register Flags).
bit 15-5 | Unused |
bit 4 | SATB DMA auto-transfer enable flag <VDC_DMA_SATB_AUTO> |
bit 3 | Destination address increment direction VDC_DMA_DST_INC, VDC_DMA_DST_DEC |
bit 3 | Source address increment direction VDC_DMA_SRC_INC, VDC_DMA_SRC_DEC |
bit 1 | VRAM to VRAM end of transfer interrupt enable flag VDC_DMA_VRAM_ENABLE |
bit 0 | VRAM to SATB end of transfer interrupt enable flag VDC_DMA_SATB_ENABLE |
Compute the value of the VDC_HSR register for a given horizontal screen resolution. This macro outputs the result as 2 .db directives.
VDC_HSR_db xres
xres | Horizontal screen resolution. |
Compute the value of the VDC_HDR register for a given horizontal screen resolution. This macro outputs the result as 2 .db directives.
VDC_HDR_db xres
xres | Horizontal screen resolution. |
VDC port
videoport = $0000
VDC register latch
video_reg = videoport
VDC data
video_data = videoport+2
Set when the sprite #0 collision detection interrupt occurs.
VDC_STATUS_SPR_COLLISION = %00000001
Set when the sprite overflow interrupt occurs.
VDC_STATUS_SPR_OVERFLOW = %00000010
Set when the horizontal blank interrupt occurs.
VDC_STATUS_HBLANK = %00000100
Set when the VRAM to SATB DMA transfer completion interrupt occurs.
VDC_STATUS_SATB_DMA_END = %00001000
Set when the VRAM to VRAM DMA transfer completion interrupt occurs.
VDC_STATUS_VRAM_DMA_END = %00010000
Set when the vertical blank interrupt occurs.
VDC_STATUS_VBLANK = %00100000
Set when the VDC is waiting for a CPU access slot during the active display area.
VDC_STATUS_BUSY = %01000000
Memory Address Write Register
VDC_MAWR = $00
Memory Address Read Register
VDC_MARR = $01
VRAM Data register
VDC_DATA = $02
Control Register
VDC_CR = $05
Raster Compare Register
VDC_RCR = $06
Background X Scroll Register
VDC_BXR = $07
Background Y Scroll Register
VDC_BYR = $08
Memory Width Register (MWR)
VDC_MWR = $09
Horizontal Synchro Register
VDC_HSR = $0A
Horizontal Display Register
VDC_HDR = $0B
Vertical Synchro Register
VDC_VSR = $0C
Vertical Display Register
VDC_VDR = $0D
Vertical Display End Position Register
VDC_VCR = $0E
DMA Control Register
VDC_DMA_CR = $0F
DMA Source Address Register
VDC_DMA_SRC = $10
DMA Destination Address Register
VDC_DMA_DST = $11
DMA Transfer Length Register
VDC_DMA_LEN = $12
VRAM-SAT Source Address Register
VDC_SAT_SRC = $13
Enables sprite collision interrupt.
VDC_CR_SPR_COLLISION_ENABLE = $0001
Enables sprite overflow interrupt.
VDC_CR_SPR_OVERFLOW_ENABLE = $0002
Enables horizontal blank interrupt.
VDC_CR_HBLANK_ENABLE = $0004
Enables vertical blank interrupt.
VDC_CR_VBLANK_ENABLE = $0008
Enables sprites layer.
VDC_CR_SPR_ENABLE = $0040
Enables background layer.
VDC_CR_BG_ENABLE = $0080
Read/write address auto-increment by 1 word.
VDC_CR_RW_INC_1 = $0000
Read/write address auto-increment by 32 words.
VDC_CR_RW_INC_32 = $0800
Read/write address auto-increment by 64 words.
VDC_CR_RW_INC_64 = $1000
Read/write address auto-increment by 128 words.
VDC_CR_RW_INC_128 = $1800
32x32 virtual background map.
VDC_BG_32x32 = %00000000
64x32 virtual background map.
VDC_BG_64x32 = %00010000
128x32 virtual background map.
VDC_BG_128x32 = %00100000
32x64 virtual background map.
VDC_BG_32x64 = %01000000
64x64 virtual background map.
VDC_BG_64x64 = %01010000
128x64 virtual background map.
VDC_BG_128x64 = %01100000
Enables VRAM to SATB end of transfer interrupt.
VDC_DMA_SATB_ENABLE = %00000001
Enables VRAM to VRAM end of transfer interrupt.
VDC_DMA_VRAM_ENABLE = %00000010
Source address direction (increment).
VDC_DMA_SRC_INC = %00000000
Source address direction (decrement).
VDC_DMA_SRC_DEC = %00000100
Destination address direction (increment).
VDC_DMA_DST_INC = %00000000
Destination address direction (decrement).
VDC_DMA_DST_DEC = %00001000
Enable SAT DMA auto-transfer.
VDC_DMA_SAT_AUTO = %00010000
VDC display flag.
vdc_disp = $20f2
Copy of the VDC control register LSB.
vdc_crl = $20f3
Copy of the VDC control register MSB.
vdc_crh = $20f4
Copy of the VDC status register.
vdc_sr = $20f6
Copy of the VDC register index.
vdc_ri = $20f7
Default virtual background map size.
VDC_DEFAULT_BG_SIZE = VDC_BG_64x64
Default horizontal resolution.
VDC_DEFAULT_XRES = 256
Default SAT VRAM offset.
VDC_DEFAULT_SAT_ADDR = $7F00