zeroize nbg planes
This commit is contained in:
parent
e8ce4eeb4e
commit
0d04c00782
4
Makefile
4
Makefile
@ -1,6 +1,6 @@
|
|||||||
AFLAGS = -g -gdwarf-4 --isa=sh2 --big
|
AFLAGS = -g -gdwarf-4 --isa=sh2 --big
|
||||||
CFLAGS += -ffunction-sections -fshort-enums -ffreestanding -nostdlib
|
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
|
CARCH = -m2 -mb
|
||||||
|
|
||||||
TARGET = sh2-none-elf-
|
TARGET = sh2-none-elf-
|
||||||
@ -56,7 +56,7 @@ main.iso: main.bin sys_ip.bin
|
|||||||
main.bin
|
main.bin
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.iso *.o *.bin *.elf dts/smpsys.o
|
rm -f *.iso *.o *.bin *.elf
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.INTERMEDIATE:
|
.INTERMEDIATE:
|
||||||
|
14
main.c
14
main.c
@ -1,6 +1,15 @@
|
|||||||
#include "vdp2.h"
|
#include "vdp2.h"
|
||||||
#include "vdp1.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) {
|
void start(void) {
|
||||||
//
|
//
|
||||||
// vdp2: enable and set Back Screen color
|
// 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.MPABN0 = MPABN0__N0MPB(0) | MPABN0__N0MPA(1); // bits 5~0
|
||||||
vdp2.reg.MPCDN0 = 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
|
// Table 4.8 Address value of map designated register by setting
|
||||||
// (bit 5~0) * 0x4000
|
// (bit 5~0) * 0x4000
|
||||||
vdp2.vram.u32[(0x4000 / 4)] = PATTERN_NAME_TABLE_2WORD__CHARACTER(1);
|
vdp2.vram.u32[(0x4000 / 4)] = PATTERN_NAME_TABLE_2WORD__CHARACTER(1);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// vdp1:
|
// vdp1:
|
||||||
//
|
//
|
||||||
|
2
sh2.lds
2
sh2.lds
@ -7,7 +7,7 @@ MEMORY
|
|||||||
}
|
}
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
. = 0x06003000;
|
. = 0x06010000;
|
||||||
|
|
||||||
.text ALIGN(2) : SUBALIGN(2)
|
.text ALIGN(2) : SUBALIGN(2)
|
||||||
{
|
{
|
||||||
|
6
type.h
6
type.h
@ -9,10 +9,16 @@ static_assert((sizeof (reg8)) == 1);
|
|||||||
static_assert((sizeof (reg16)) == 2);
|
static_assert((sizeof (reg16)) == 2);
|
||||||
static_assert((sizeof (reg32)) == 4);
|
static_assert((sizeof (reg32)) == 4);
|
||||||
|
|
||||||
|
typedef volatile unsigned short u8;
|
||||||
|
typedef volatile short s8;
|
||||||
typedef volatile unsigned short u16;
|
typedef volatile unsigned short u16;
|
||||||
typedef volatile short s16;
|
typedef volatile short s16;
|
||||||
|
typedef volatile unsigned long u32;
|
||||||
|
typedef volatile long s32;
|
||||||
|
|
||||||
static_assert((sizeof (u16)) == 2);
|
static_assert((sizeof (u16)) == 2);
|
||||||
static_assert((sizeof (s16)) == 2);
|
static_assert((sizeof (s16)) == 2);
|
||||||
|
static_assert((sizeof (u32)) == 4);
|
||||||
|
static_assert((sizeof (s32)) == 4);
|
||||||
|
|
||||||
#define REG_UL(U, L) (((U) << 16) | (L))
|
#define REG_UL(U, L) (((U) << 16) | (L))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user