zeroize nbg planes

This commit is contained in:
Zack Buhman 2023-01-07 18:14:59 -08:00
parent e8ce4eeb4e
commit 0d04c00782
4 changed files with 22 additions and 4 deletions

View File

@ -1,6 +1,6 @@
AFLAGS = -g -gdwarf-4 --isa=sh2 --big
CFLAGS += -ffunction-sections -fshort-enums -ffreestanding -nostdlib
CFLAGS += -Wall -Werror -Wno-error=unused-but-set-variable -g -gdwarf-4 -Og
CFLAGS += -Wall -Werror -g -gdwarf-4 -Og
CARCH = -m2 -mb
TARGET = sh2-none-elf-
@ -56,7 +56,7 @@ main.iso: main.bin sys_ip.bin
main.bin
clean:
rm -f *.iso *.o *.bin *.elf dts/smpsys.o
rm -f *.iso *.o *.bin *.elf
.SUFFIXES:
.INTERMEDIATE:

14
main.c
View File

@ -1,6 +1,15 @@
#include "vdp2.h"
#include "vdp1.h"
void fill_32(u32 * buf, u32 v, s32 n)
{
while (n > 0) {
*buf = v;
buf += 1;
n -= (sizeof (u32));
}
}
void start(void) {
//
// vdp2: enable and set Back Screen color
@ -48,11 +57,14 @@ void start(void) {
vdp2.reg.MPABN0 = MPABN0__N0MPB(0) | MPABN0__N0MPA(1); // bits 5~0
vdp2.reg.MPCDN0 = MPABN0__N0MPB(0) | MPABN0__N0MPA(1); // bits 5~0
// zeroize NBG0 plane; this should be less than 0x8000 above
s32 plane_size = 64 * 64 * 4; // is this correct ?
fill_32(&vdp2.vram.u32[(0x4000 / 4)], 0, plane_size);
// Table 4.8 Address value of map designated register by setting
// (bit 5~0) * 0x4000
vdp2.vram.u32[(0x4000 / 4)] = PATTERN_NAME_TABLE_2WORD__CHARACTER(1);
//
// vdp1:
//

View File

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

6
type.h
View File

@ -9,10 +9,16 @@ static_assert((sizeof (reg8)) == 1);
static_assert((sizeof (reg16)) == 2);
static_assert((sizeof (reg32)) == 4);
typedef volatile unsigned short u8;
typedef volatile short s8;
typedef volatile unsigned short u16;
typedef volatile short s16;
typedef volatile unsigned long u32;
typedef volatile long s32;
static_assert((sizeof (u16)) == 2);
static_assert((sizeof (s16)) == 2);
static_assert((sizeof (u32)) == 4);
static_assert((sizeof (s32)) == 4);
#define REG_UL(U, L) (((U) << 16) | (L))