megadrive_test1

view 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
line source
1 #ifndef VDP_H_
2 #define VDP_H_
4 #include <stdint.h>
6 #define VDP_PORT_DATA (*(volatile uint16_t*)0xc00000)
7 #define VDP_PORT_DATA32 (*(volatile uint32_t*)0xc00000)
8 #define VDP_PORT_CTL (*(volatile uint16_t*)0xc00004)
9 #define VDP_PORT_CTL32 (*(volatile uint32_t*)0xc00004)
10 #define VDP_PORT_HVCOUNT (*(volatile uint16_t*)0xc00008)
11 #define VDP_PORT_PSG (*(volatile uint16_t*)0xc00010)
13 /* control register read flags */
14 #define VDP_CTL_PAL_BIT 0x0001
15 #define VDP_CTL_HBLANK_BIT 0x0002
16 #define VDP_CTL_VBLANK_BIT 0x0004
17 #define VDP_CTL_DT3_BIT 0x0008
18 #define VDP_CTL_ODD_FRAME_BIT 0x0010
19 #define VDP_CTL_COLIDE_BIT 0x0020
20 #define VDP_CTL_SPRITE_OVF_BIT 0x0040
21 #define VDP_CTL_FRAME_BIT 0x0080
22 #define VDP_CTL_FIFO_FULL_BIT 0x0100
23 #define VDP_CTL_FIFO_EMPTY_BIT 0x0200
25 /* control register write flags (RSET) */
26 #define VDP_CTL_REGSEL_MASK 0x1f00
27 #define VDP_CTL_DATA_MASK 0x00ff
29 #define VDP_RSET(reg, val) \
30 (0x8000 | (VDP_CTL_REGSEL_MASK & ((uint16_t)(reg) << 8)) | \
31 (VDP_CTL_DATA_MASK & (uint16_t)(val)))
33 #define VDP_MODE_WR_BIT 1
35 #define VDP_VRAM_WR 1
36 #define VDP_CRAM_WR 3
38 #define VDP_ADDRSET(addr, mode) /* TODO */
41 #endif /* VDP_H_ */