megadrive_test1
annotate src/vdp.h @ 4:e7138066c7ea
started the vdp.h header, and hastily rewrote the VDP test as C code
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 01 Feb 2017 13:40:50 +0200 |
parents | |
children | f99eab59e7dc |
rev | line source |
---|---|
nuclear@4 | 1 #ifndef VDP_H_ |
nuclear@4 | 2 #define VDP_H_ |
nuclear@4 | 3 |
nuclear@4 | 4 #include <stdint.h> |
nuclear@4 | 5 |
nuclear@4 | 6 #define VDP_PORT_DATA (*(volatile uint16_t*)0xc00000) |
nuclear@4 | 7 #define VDP_PORT_DATA32 (*(volatile uint32_t*)0xc00000) |
nuclear@4 | 8 #define VDP_PORT_CTL (*(volatile uint16_t*)0xc00004) |
nuclear@4 | 9 #define VDP_PORT_CTL32 (*(volatile uint32_t*)0xc00004) |
nuclear@4 | 10 #define VDP_PORT_HVCOUNT (*(volatile uint16_t*)0xc00008) |
nuclear@4 | 11 #define VDP_PORT_PSG (*(volatile uint16_t*)0xc00010) |
nuclear@4 | 12 |
nuclear@4 | 13 /* control register read flags */ |
nuclear@4 | 14 #define VDP_CTL_PAL_BIT 0x0001 |
nuclear@4 | 15 #define VDP_CTL_HBLANK_BIT 0x0002 |
nuclear@4 | 16 #define VDP_CTL_VBLANK_BIT 0x0004 |
nuclear@4 | 17 #define VDP_CTL_DT3_BIT 0x0008 |
nuclear@4 | 18 #define VDP_CTL_ODD_FRAME_BIT 0x0010 |
nuclear@4 | 19 #define VDP_CTL_COLIDE_BIT 0x0020 |
nuclear@4 | 20 #define VDP_CTL_SPRITE_OVF_BIT 0x0040 |
nuclear@4 | 21 #define VDP_CTL_FRAME_BIT 0x0080 |
nuclear@4 | 22 #define VDP_CTL_FIFO_FULL_BIT 0x0100 |
nuclear@4 | 23 #define VDP_CTL_FIFO_EMPTY_BIT 0x0200 |
nuclear@4 | 24 |
nuclear@4 | 25 /* control register write flags (RSET) */ |
nuclear@4 | 26 #define VDP_CTL_REGSEL_MASK 0x1f00 |
nuclear@4 | 27 #define VDP_CTL_DATA_MASK 0x00ff |
nuclear@4 | 28 |
nuclear@4 | 29 #define VDP_RSET(reg, val) \ |
nuclear@4 | 30 (0x8000 | (VDP_CTL_REGSEL_MASK & ((uint16_t)(reg) << 8)) | \ |
nuclear@4 | 31 (VDP_CTL_DATA_MASK & (uint16_t)(val))) |
nuclear@4 | 32 |
nuclear@4 | 33 #define VDP_MODE_WR_BIT 1 |
nuclear@4 | 34 |
nuclear@4 | 35 #define VDP_VRAM_WR 1 |
nuclear@4 | 36 #define VDP_CRAM_WR 3 |
nuclear@4 | 37 |
nuclear@4 | 38 #define VDP_ADDRSET(addr, mode) /* TODO */ |
nuclear@4 | 39 |
nuclear@4 | 40 |
nuclear@4 | 41 #endif /* VDP_H_ */ |