experiment with aliasing

This commit is contained in:
Zack Buhman 2023-01-05 22:22:25 -08:00
parent e59d6da0a4
commit 286f116d15
4 changed files with 18 additions and 7 deletions

3
main.c
View File

@ -6,8 +6,7 @@ void start(void) {
vdp2.reg.BGON = 0;
vdp2.reg.BKTAU = BKTAU__BKCLMD_SINGLE_COLOR | 0;
vdp2.reg.BKTAL = 0x4000;
vdp2.reg.BKTA = REG32_VAL(BKTAU__BKCLMD_SINGLE_COLOR, 0x4000);
*((reg16 *)&vdp2.vram[0x8000]) = 31; // red

View File

@ -7,7 +7,7 @@ MEMORY
}
SECTIONS
{
. = 0x06000000;
. = 0x06003000;
.text ALIGN(2) : SUBALIGN(2)
{

11
type.h
View File

@ -1,5 +1,12 @@
#define static_assert _Static_assert
#define offsetof __builtin_offsetof
typedef volatile unsigned char reg8;
typedef volatile unsigned short reg16;
typedef volatile unsigned long reg32;
#define static_assert _Static_assert
#define offsetof __builtin_offsetof
static_assert((sizeof (reg8)) == 1);
static_assert((sizeof (reg16)) == 2);
static_assert((sizeof (reg32)) == 4);
#define REG32_VAL(U, L) (((U) << 16) | (L))

9
vdp2.h
View File

@ -94,8 +94,13 @@ typedef struct vdp2_reg {
reg16 LSTA1L; /* LINE SCROLL TABLE ADDRESS (NBG1) */
reg16 LCTAU; /* LINE COLOR SCREEN TABLE ADDRESS */
reg16 LCTAL; /* LINE COLOR SCREEN TABLE ADDRESS */
reg16 BKTAU; /* BACK SCREEN TABLE ADDRESS */
reg16 BKTAL; /* BACK SCREEN TABLE ADDRESS */
union {
struct {
reg16 BKTAU; /* BACK SCREEN TABLE ADDRESS */
reg16 BKTAL; /* BACK SCREEN TABLE ADDRESS */
};
reg32 BKTA;
};
reg16 RPMD; /* ROTATION PARAMETER MODE */
reg16 RPRCTL; /* ROTATION PARAMETER READ CONTROL */
reg16 KTCTL; /* COEFFICIENT TABLE CONTROL */