#include <md.h>
Classes | |
struct | sprite_info |
Public Member Functions | |
md_vdp (md &) | |
VDP constructor. | |
~md_vdp () | |
VDP destructor. | |
int | command (uint16_t cmd) |
VDP commands. | |
unsigned short | readword () |
Read a word from memory. | |
unsigned char | readbyte () |
Read a byte from memory. | |
int | writeword (unsigned short d) |
Write a word to the VDP. | |
int | writebyte (unsigned char d) |
Write a byte to the VDP. | |
void | reset () |
Reset the VDP. | |
void | sprite_masking_overflow (int line) |
void | sprite_mask_generate () |
void | draw_scanline (struct bmap *bits, int line) |
void | draw_pixel (struct bmap *bits, int x, int y, uint32_t rgb) |
void | write_reg (uint8_t addr, uint8_t data) |
Write away a VDP register. |
Public Attributes | |
uint8_t | mem [(0x10100+0x35)] |
uint8_t * | vram |
uint8_t * | cram |
uint8_t * | vsram |
uint8_t | reg [0x20] |
int | rw_mode |
int | rw_addr |
int | rw_dma |
bool | hint_pending |
bool | vint_pending |
bool | cmd_pending |
int | sprite_overflow_line |
unsigned char * | dirt |
uint32_t | highpal [64] |
Private Member Functions | |
int | poke_vram (int addr, unsigned char d) |
Set value in VRAM. | |
int | poke_cram (int addr, unsigned char d) |
Set value in CRAM. | |
int | poke_vsram (int addr, unsigned char d) |
Set value in VSRAM. | |
int | dma_len () |
Calculate the DMA length. | |
int | dma_addr () |
Calculate DMA start address. | |
unsigned char | dma_mem_read (int addr) |
Do a DMA read. | |
int | putword (unsigned short d) |
Write a word to memory and update dirty flags. | |
int | putbyte (unsigned char d) |
Write a byte to memory and update dirty flags. | |
void | draw_tile1 (int which, int line, unsigned char *where) |
void | draw_tile1_solid (int which, int line, unsigned char *where) |
void | draw_tile2 (int which, int line, unsigned char *where) |
void | draw_tile2_solid (int which, int line, unsigned char *where) |
void | draw_tile3 (int which, int line, unsigned char *where) |
void | draw_tile3_solid (int which, int line, unsigned char *where) |
void | draw_tile4 (int which, int line, unsigned char *where) |
void | draw_tile4_solid (int which, int line, unsigned char *where) |
void | draw_window (int line, int front) |
void | draw_sprites (int line, bool front) |
void | draw_plane_back0 (int line) |
void | draw_plane_back1 (int line) |
void | draw_plane_front0 (int line) |
void | draw_plane_front1 (int line) |
void | get_sprite_info (struct sprite_info &, int) |
void | sprite_mask_add (uint8_t *, int, struct sprite_info &, int) |
Private Attributes | |
unsigned char | sprite_order [0x101] |
unsigned char * | sprite_base |
uint8_t | sprite_mask [512][512] |
int | sprite_count |
int | masking_sprite_index_cache |
int | dots_cache |
unsigned int | Bpp |
unsigned int | Bpp_times8 |
struct bmap * | bmap |
unsigned char * | dest |
md & | belongs |
md_vdp::md_vdp | ( | md & | md | ) |
VDP constructor.
md | The md instance this VDP belongs to. |
md_vdp::~md_vdp | ( | ) |
VDP destructor.
int md_vdp::command | ( | uint16_t | cmd | ) |
VDP commands.
A VDP command is 32-bits in length written into the control port as two 16-bit words. The VDP maintains a pending flag so that it knows what to expect next.
CD1 CD0 A13 A12 A11 A10 A09 A08 (D31-D24) A07 A06 A05 A04 A03 A02 A01 A00 (D23-D16) ? ? ? ? ? ? ? ? (D15-D8) CD5 CD4 CD3 CD2 ? ? A15 A14 (D7-D0)
Where CD* indicates which ram is read or written in subsequent data port read/writes. A* is an address.
Note that the command is not cached, but rather, the lower 14 address bits are commited as soon as the first half of the command arrives. Then when the second word arrives, the remaining two address bits are commited.
It is possible to cancel (but not roll back) a pending command by:
In these cases the pending flag is cleared, and the first half of the command remains comitted.
|
private |
Calculate DMA start address.
|
private |
Calculate the DMA length.
|
private |
Do a DMA read.
DMA can read from anywhere.
addr | Address where to read from. |
void md_vdp::draw_pixel | ( | struct bmap * | bits, |
int | x, | ||
int | y, | ||
uint32_t | rgb | ||
) |
|
private |
|
private |
|
private |
|
private |
void md_vdp::draw_scanline | ( | struct bmap * | bits, |
int | line | ||
) |
|
private |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
private |
|
inlineprivate |
|
private |
Set value in CRAM.
addr | Address to write to. |
d | Byte to write. |
|
private |
Set value in VRAM.
Must go through these calls to update the dirty flags.
addr | Address to write to. |
d | Byte to write. |
|
private |
Set value in VSRAM.
addr | Address to write to. |
d | Byte to write. |
|
private |
Write a byte to memory and update dirty flags.
d | 8-bit data to write. |
|
private |
Write a word to memory and update dirty flags.
d | 16-bit data to write. |
unsigned char md_vdp::readbyte | ( | ) |
Read a byte from memory.
unsigned short md_vdp::readword | ( | ) |
Read a word from memory.
void md_vdp::reset | ( | ) |
Reset the VDP.
|
inlineprivate |
void md_vdp::sprite_mask_generate | ( | ) |
void md_vdp::sprite_masking_overflow | ( | int | line | ) |
void md_vdp::write_reg | ( | uint8_t | addr, |
uint8_t | data | ||
) |
Write away a VDP register.
addr | Address of register. |
data | 8-bit data to write. |
int md_vdp::writebyte | ( | unsigned char | d | ) |
Write a byte to the VDP.
d | 8-bit data to write. |
int md_vdp::writeword | ( | unsigned short | d | ) |
Write a word to the VDP.
d | 16-bit data to write. |
|
private |
|
private |
|
private |
|
private |
bool md_vdp::cmd_pending |
uint8_t * md_vdp::cram |
|
private |
unsigned char* md_vdp::dirt |
|
private |
uint32_t md_vdp::highpal[64] |
bool md_vdp::hint_pending |
|
private |
uint8_t md_vdp::mem[(0x10100+0x35)] |
uint8_t md_vdp::reg[0x20] |
int md_vdp::rw_addr |
int md_vdp::rw_dma |
int md_vdp::rw_mode |
|
private |
|
private |
|
private |
|
private |
int md_vdp::sprite_overflow_line |
bool md_vdp::vint_pending |
uint8_t* md_vdp::vram |
uint8_t * md_vdp::vsram |