new "example" directory
This is a reshuffling of filenames, extensions, paths, make rules, just because I felt like it.
This commit is contained in:
parent
855cbba403
commit
25e299feba
19
Makefile
19
Makefile
@ -1,12 +1,10 @@
|
||||
all: main.elf
|
||||
|
||||
include common.mk
|
||||
include example/example.mk
|
||||
|
||||
MAIN_OBJ = \
|
||||
start.o \
|
||||
main.o \
|
||||
load.o \
|
||||
cache.o \
|
||||
vga.o \
|
||||
rgb.o \
|
||||
holly/background.o \
|
||||
@ -16,14 +14,13 @@ MAIN_OBJ = \
|
||||
maple/maple.o \
|
||||
scene.o \
|
||||
macaw.data.o \
|
||||
wink.data.o \
|
||||
$(LIBGCC)
|
||||
wink.data.o
|
||||
|
||||
serial.elf: start.o serial_main.o load.o cache.o
|
||||
$(LD) $(LDFLAGS) -T $(LIB)/alt.lds $^ -o $@
|
||||
serial.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
serial.elf: $(START_OBJ) serial_main.o load.o
|
||||
|
||||
main.elf: $(MAIN_OBJ)
|
||||
$(LD) $(LDFLAGS) -T $(LIB)/main.lds $^ -o $@
|
||||
main.elf: LDSCRIPT = $(LIB)/main.lds
|
||||
main.elf: $(START_OBJ) $(MAIN_OBJ)
|
||||
|
||||
test.elf: $(MAIN_OBJ)
|
||||
$(LD) $(LDFLAGS) -T $(LIB)/alt.lds $^ -o $@
|
||||
test.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
test.elf: $(START_OBJ) $(MAIN_OBJ)
|
||||
|
9
align.hpp
Normal file
9
align.hpp
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
template <typename T>
|
||||
inline T * align_32byte(T * mem)
|
||||
{
|
||||
return reinterpret_cast<T *>((((reinterpret_cast<uint32_t>(mem) + 31) & ~31)));
|
||||
}
|
14
cache.cpp
14
cache.cpp
@ -1,13 +1,15 @@
|
||||
#include "type.h"
|
||||
#include "sh7091.h"
|
||||
#include "sh7091_bits.h"
|
||||
#include "type.hpp"
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
|
||||
#include "cache.h"
|
||||
#include "cache.hpp"
|
||||
|
||||
extern volatile reg32 sh7091_ic_a[256][(1 << 5) / 4] __asm("sh7091_ic_a");
|
||||
extern volatile reg32 sh7091_oc_a[512][(1 << 5) / 4] __asm("sh7091_oc_a");
|
||||
|
||||
void cache_init()
|
||||
namespace cache {
|
||||
|
||||
void init()
|
||||
{
|
||||
for (int i = 0; i < 256; i++) {
|
||||
sh7091_ic_a[i][0] = 0;
|
||||
@ -28,3 +30,5 @@ void cache_init()
|
||||
|
||||
asm volatile ("nop;nop;nop;nop;nop;nop;nop;nop;");
|
||||
}
|
||||
|
||||
}
|
||||
|
3
cache.h
3
cache.h
@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
void cache_init() __attribute__ ((section (".p2ram.cache_init")));
|
7
cache.hpp
Normal file
7
cache.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace cache {
|
||||
|
||||
void init() __attribute__ ((section (".p2ram.cache_init")));
|
||||
|
||||
}
|
14
common.mk
14
common.mk
@ -1,5 +1,8 @@
|
||||
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
||||
DIR := $(dir $(MAKEFILE_PATH))
|
||||
|
||||
LIB ?= .
|
||||
OPT ?= -Og
|
||||
OPT ?= -Os
|
||||
DEBUG ?= -g -gdwarf-4
|
||||
GENERATED ?=
|
||||
|
||||
@ -11,6 +14,7 @@ CFLAGS += -falign-functions=4 -ffunction-sections -fdata-sections -fshort-enums
|
||||
CFLAGS += -Wall -Werror -Wfatal-errors
|
||||
CFLAGS += -Wno-error=narrowing -Wno-error=unused-variable
|
||||
CFLAGS += -mfsca -funsafe-math-optimizations
|
||||
CFLAGS += -I$(dir $(MAKEFILE_PATH))
|
||||
DEPFLAGS = -MMD -E
|
||||
# --print-gc-sections
|
||||
LDFLAGS = --gc-sections --no-warn-rwx-segment --print-memory-usage --entry=_start --orphan-handling=error
|
||||
@ -48,6 +52,11 @@ IP_OBJ = \
|
||||
sg/sg_ini.o \
|
||||
sg/aip.o
|
||||
|
||||
START_OBJ = \
|
||||
start.o \
|
||||
runtime.o \
|
||||
cache.o
|
||||
|
||||
%.bin.o: %.bin
|
||||
$(BUILD_BINARY_O)
|
||||
|
||||
@ -71,6 +80,9 @@ IP_OBJ = \
|
||||
%.o: %.cpp %.cpp.d
|
||||
$(CXX) $(CARCH) $(CFLAGS) $(CXXFLAGS) $(OPT) $(DEBUG) -c $< -o $@
|
||||
|
||||
%.elf:
|
||||
$(LD) $(LDFLAGS) -T $(LDSCRIPT) $^ -o $@
|
||||
|
||||
%.bin: %.elf
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
|
||||
|
12
example/cube.cpp
Normal file
12
example/cube.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "vga.hpp"
|
||||
#include "memorymap.hpp"
|
||||
#include "rgb.hpp"
|
||||
|
||||
void main()
|
||||
{
|
||||
vga();
|
||||
|
||||
while (1);
|
||||
}
|
17
example/example.mk
Normal file
17
example/example.mk
Normal file
@ -0,0 +1,17 @@
|
||||
CUBE_OBJ = \
|
||||
example/cube.o \
|
||||
vga.o
|
||||
|
||||
example/cube.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
example/cube.elf: $(START_OBJ) $(CUBE_OBJ)
|
||||
|
||||
MAPLE_WINK_OBJ = \
|
||||
example/maple_wink.o \
|
||||
vga.o \
|
||||
rgb.o \
|
||||
serial.o \
|
||||
maple/maple.o \
|
||||
wink.data.o
|
||||
|
||||
example/maple_wink.elf: LDSCRIPT = $(LIB)/alt.lds
|
||||
example/maple_wink.elf: $(START_OBJ) $(MAPLE_WINK_OBJ)
|
52
example/maple_wink.cpp
Normal file
52
example/maple_wink.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "maple/maple.hpp"
|
||||
#include "vga.hpp"
|
||||
#include "align.hpp"
|
||||
#include "serial.hpp"
|
||||
|
||||
extern uint32_t _binary_wink_data_start __asm("_binary_wink_data_start");
|
||||
|
||||
void make_wink(uint32_t * buf)
|
||||
{
|
||||
const uint8_t * src = reinterpret_cast<const uint8_t *>(&_binary_wink_data_start);
|
||||
uint8_t * dst = reinterpret_cast<uint8_t *>(buf);
|
||||
|
||||
uint32_t ix = 0;
|
||||
dst[ix] = 0;
|
||||
for (int i = 0; i < 48 * 32; i++) {
|
||||
dst[ix] |= ((src[i] & 1) << (7 - (i % 8)));
|
||||
|
||||
if (i % 8 == 7) {
|
||||
ix++;
|
||||
dst[ix] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
constexpr int width = 48;
|
||||
constexpr int height = 32;
|
||||
constexpr int pixels_per_byte = 8;
|
||||
|
||||
uint32_t wink_buf[width * height / pixels_per_byte];
|
||||
make_wink(wink_buf);
|
||||
|
||||
uint32_t _command_buf[128 / 4];
|
||||
uint32_t _receive_buf[128 / 4];
|
||||
uint32_t * command_buf = align_32byte(_command_buf);
|
||||
uint32_t * receive_buf = align_32byte(_receive_buf);
|
||||
|
||||
maple::init_block_write(command_buf, receive_buf, wink_buf);
|
||||
maple::dma_start(command_buf);
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
serial::integer<uint32_t>(receive_buf[i]);
|
||||
}
|
||||
|
||||
vga();
|
||||
v_sync_in();
|
||||
vga_fill_framebuffer();
|
||||
while(1);
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
#include "sh7091.h"
|
||||
#include "sh7091_bits.h"
|
||||
#include <cstdint>
|
||||
|
||||
#include "cache.h"
|
||||
#include "load.h"
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
|
||||
#include "cache.hpp"
|
||||
#include "load.hpp"
|
||||
|
||||
extern uint32_t __bss_link_start __asm("__bss_link_start");
|
||||
extern uint32_t __bss_link_end __asm("__bss_link_end");
|
@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "type.h"
|
||||
#include "type.hpp"
|
||||
|
||||
struct holly_reg {
|
||||
reg32 ID; /* Device ID */
|
@ -1,6 +1,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "isp_tsp.h"
|
||||
#include "isp_tsp.hpp"
|
||||
|
||||
struct vertex_parameter {
|
||||
float x;
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "../float_uint32.h"
|
||||
#include "core_bits.h"
|
||||
#include "../holly.h"
|
||||
#include "../memorymap.h"
|
||||
#include "../float_uint32.hpp"
|
||||
#include "core_bits.hpp"
|
||||
#include "../holly.hpp"
|
||||
#include "../memorymap.hpp"
|
||||
|
||||
#include "texture_memory_alloc.h"
|
||||
#include "texture_memory_alloc.hpp"
|
||||
|
||||
#include "core.h"
|
||||
#include "background.h"
|
||||
#include "region_array.h"
|
||||
#include "core.hpp"
|
||||
#include "background.hpp"
|
||||
#include "region_array.hpp"
|
||||
|
||||
void core_init()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "../float_uint32.h"
|
||||
#include "../float_uint32.hpp"
|
||||
|
||||
namespace id {
|
||||
constexpr uint32_t device_id(uint32_t reg) { return (reg >> 16) & 0xffff; }
|
@ -1,4 +1,6 @@
|
||||
#include "region_array.h"
|
||||
#include <cstdint>
|
||||
|
||||
#include "region_array.hpp"
|
||||
|
||||
#define REGION_ARRAY__LAST_REGION (1 << 31)
|
||||
#define REGION_ARRAY__Z_CLEAR (1 << 30)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "../float_uint32.h"
|
||||
#include "../float_uint32.hpp"
|
||||
|
||||
namespace ta_ol_base {
|
||||
constexpr uint32_t base_address(uint32_t num) { return (num & 0xffffe0) << 0; }
|
@ -1,16 +1,16 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "core_bits.h"
|
||||
#include "ta_bits.h"
|
||||
#include "../holly.h"
|
||||
#include "../systembus.h"
|
||||
#include "../systembus_bits.h"
|
||||
#include "../sh7091.h"
|
||||
#include "../sh7091_bits.h"
|
||||
#include "core_bits.hpp"
|
||||
#include "ta_bits.hpp"
|
||||
#include "../holly.hpp"
|
||||
#include "../systembus.hpp"
|
||||
#include "../systembus_bits.hpp"
|
||||
#include "../sh7091.hpp"
|
||||
#include "../sh7091_bits.hpp"
|
||||
|
||||
#include "texture_memory_alloc.h"
|
||||
#include "texture_memory_alloc.hpp"
|
||||
|
||||
#include "ta_fifo_polygon_converter.h"
|
||||
#include "ta_fifo_polygon_converter.hpp"
|
||||
|
||||
void ta_polygon_converter_init()
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "../float_uint32.h"
|
||||
#include "isp_tsp.h"
|
||||
#include "../float_uint32.hpp"
|
||||
#include "isp_tsp.hpp"
|
||||
|
||||
namespace para_control {
|
||||
namespace para_type {
|
8
load.cpp
8
load.cpp
@ -1,8 +1,8 @@
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include "sh7091.h"
|
||||
#include "sh7091_bits.h"
|
||||
#include "holly.h"
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
#include "holly.hpp"
|
||||
|
||||
enum load_command {
|
||||
CMD_NONE,
|
||||
|
138
main.cpp
138
main.cpp
@ -1,67 +1,29 @@
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include "memorymap.h"
|
||||
#include "memorymap.hpp"
|
||||
|
||||
#include "sh7091.h"
|
||||
#include "sh7091_bits.h"
|
||||
#include "holly.h"
|
||||
#include "holly/core.h"
|
||||
#include "holly/core_bits.h"
|
||||
#include "holly/ta_fifo_polygon_converter.h"
|
||||
#include "systembus.h"
|
||||
#include "maple/maple.h"
|
||||
#include "maple/maple_bits.h"
|
||||
#include "maple/maple_bus_commands.h"
|
||||
#include "maple/maple_bus_ft0.h"
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
#include "holly.hpp"
|
||||
#include "holly/core.hpp"
|
||||
#include "holly/core_bits.hpp"
|
||||
#include "holly/ta_fifo_polygon_converter.hpp"
|
||||
#include "systembus.hpp"
|
||||
#include "maple/maple.hpp"
|
||||
#include "maple/maple_bits.hpp"
|
||||
#include "maple/maple_bus_commands.hpp"
|
||||
#include "maple/maple_bus_ft0.hpp"
|
||||
|
||||
#include "holly/texture_memory_alloc.h"
|
||||
#include "holly/texture_memory_alloc.hpp"
|
||||
|
||||
#include "cache.h"
|
||||
#include "load.h"
|
||||
#include "vga.h"
|
||||
#include "rgb.h"
|
||||
#include "string.h"
|
||||
#include "scene.h"
|
||||
#include "cache.hpp"
|
||||
#include "load.hpp"
|
||||
#include "vga.hpp"
|
||||
#include "rgb.hpp"
|
||||
#include "string.hpp"
|
||||
#include "scene.hpp"
|
||||
|
||||
#include "macaw.h"
|
||||
|
||||
extern uint32_t __bss_link_start __asm("__bss_link_start");
|
||||
extern uint32_t __bss_link_end __asm("__bss_link_end");
|
||||
|
||||
void serial()
|
||||
{
|
||||
sh7091.SCIF.SCSCR2 = 0;
|
||||
sh7091.SCIF.SCSMR2 = 0;
|
||||
sh7091.SCIF.SCBRR2 = 1; // 520833.3
|
||||
|
||||
sh7091.SCIF.SCFCR2 = SCFCR2__TFRST | SCFCR2__RFRST;
|
||||
// tx/rx trigger on 1 byte
|
||||
sh7091.SCIF.SCFCR2 = 0;
|
||||
|
||||
sh7091.SCIF.SCSPTR2 = 0;
|
||||
sh7091.SCIF.SCLSR2 = 0;
|
||||
|
||||
sh7091.SCIF.SCSCR2 = SCSCR2__TE | SCSCR2__RE;
|
||||
}
|
||||
|
||||
inline void serial_char(const char c)
|
||||
{
|
||||
// wait for transmit fifo to become empty
|
||||
while ((sh7091.SCIF.SCFSR2 & SCFSR2__TDFE) == 0);
|
||||
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
asm volatile ("nop;");
|
||||
}
|
||||
|
||||
sh7091.SCIF.SCFTDR2 = static_cast<uint8_t>(c);
|
||||
}
|
||||
|
||||
void serial_string(const char * s)
|
||||
{
|
||||
while (*s != '\0') {
|
||||
serial_char(*s++);
|
||||
}
|
||||
}
|
||||
#include "macaw.hpp"
|
||||
|
||||
/* must be aligned to 32-bytes for DMA transfer */
|
||||
// the aligned(32) attribute does not actually align to 32 bytes; gcc is the best compiler.
|
||||
@ -69,54 +31,9 @@ void serial_string(const char * s)
|
||||
// __attribute__((aligned(32)))
|
||||
uint32_t _scene[((32 * 6) + 32) / 4];
|
||||
|
||||
template <typename T>
|
||||
T * align_32byte(T * mem)
|
||||
{
|
||||
return reinterpret_cast<T *>((((reinterpret_cast<uint32_t>(mem) + 31) & ~31)));
|
||||
}
|
||||
|
||||
void serial_int32(const uint32_t n)
|
||||
{
|
||||
char num_buf[9];
|
||||
string::hex<char>(num_buf, 8, n);
|
||||
num_buf[8] = 0;
|
||||
serial_string("0x");
|
||||
serial_string(num_buf);
|
||||
serial_string("\n");
|
||||
}
|
||||
|
||||
void serial_int8(const uint8_t n)
|
||||
{
|
||||
char num_buf[3];
|
||||
string::hex<char>(num_buf, 2, n);
|
||||
num_buf[2] = 0;
|
||||
serial_string("0x");
|
||||
serial_string(num_buf);
|
||||
serial_string("\n");
|
||||
}
|
||||
|
||||
uint32_t _receive_address[(256 + 32) / 4] = {0};
|
||||
uint32_t _command_buf[(256 + 32) / 4] = {0};
|
||||
|
||||
extern uint32_t _binary_wink_data_start __asm("_binary_wink_data_start");
|
||||
|
||||
void make_wink(uint32_t * buf)
|
||||
{
|
||||
const uint8_t * src = reinterpret_cast<const uint8_t *>(&_binary_wink_data_start);
|
||||
uint8_t * dst = reinterpret_cast<uint8_t *>(buf);
|
||||
|
||||
uint32_t ix = 0;
|
||||
dst[ix] = 0;
|
||||
for (int i = 0; i < 48 * 32; i++) {
|
||||
dst[ix] |= ((src[i] & 1) << (7 - (i % 8)));
|
||||
|
||||
if (i % 8 == 7) {
|
||||
ix++;
|
||||
dst[ix] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool maple_test()
|
||||
{
|
||||
v_sync_out();
|
||||
@ -128,9 +45,6 @@ bool maple_test()
|
||||
|
||||
//maple_init_device_request(command_buf, receive_address);
|
||||
//maple_init_get_condition(command_buf, receive_address);
|
||||
uint32_t wink_buf[192];
|
||||
make_wink(wink_buf);
|
||||
maple_init_block_write(command_buf, receive_address, wink_buf);
|
||||
|
||||
serial_int32(command_buf[0]);
|
||||
serial_char('\n');
|
||||
@ -154,18 +68,8 @@ bool maple_test()
|
||||
return !(data_format->data.digital_button & ft0::data_transfer::digital_button::a);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void main()
|
||||
{
|
||||
cache_init();
|
||||
|
||||
// clear BSS
|
||||
uint32_t * start = &__bss_link_start;
|
||||
uint32_t * end = &__bss_link_end;
|
||||
while (start < end) {
|
||||
*start++ = 0;
|
||||
}
|
||||
|
||||
//serial();
|
||||
|
||||
vga();
|
||||
|
@ -1,27 +1,29 @@
|
||||
#include <cstdint>
|
||||
#include <bit>
|
||||
|
||||
#include "../sh7091.h"
|
||||
#include "../sh7091_bits.h"
|
||||
#include "../systembus.h"
|
||||
#include "../systembus_bits.h"
|
||||
#include "../sh7091.hpp"
|
||||
#include "../sh7091_bits.hpp"
|
||||
#include "../systembus.hpp"
|
||||
#include "../systembus_bits.hpp"
|
||||
|
||||
#include "maple_bits.h"
|
||||
#include "maple_host_bits.h"
|
||||
#include "maple_bus_commands.h"
|
||||
#include "maple.h"
|
||||
#include "maple_bits.hpp"
|
||||
#include "maple_bus_bits.hpp"
|
||||
#include "maple_bus_commands.hpp"
|
||||
#include "maple.hpp"
|
||||
|
||||
void maple_init_host_command(uint32_t * buf, uint32_t * receive_address, uint8_t command_code, uint8_t data_size)
|
||||
namespace maple {
|
||||
|
||||
void init_host_command(uint32_t * buf, uint32_t * receive_buf, uint8_t command_code, uint8_t data_size)
|
||||
{
|
||||
// this function does not care about the template instantiation of
|
||||
// maple_host_command--data_fields is not manipulated here.
|
||||
auto host_command = reinterpret_cast<maple_host_command<uint32_t> *>(buf);
|
||||
// host_command--data_fields is not manipulated here.
|
||||
auto host_command = reinterpret_cast<struct host_command<uint32_t> *>(buf);
|
||||
|
||||
host_command->host_instruction = host_instruction::end_flag
|
||||
| host_instruction::port_select::a
|
||||
| host_instruction::transfer_length((data_size / 4));
|
||||
| host_instruction::port_select::a
|
||||
| host_instruction::transfer_length((data_size / 4));
|
||||
|
||||
host_command->receive_data_storage_address = reinterpret_cast<uint32_t>(receive_address) & 0x1fff'ffff;
|
||||
host_command->receive_data_storage_address = reinterpret_cast<uint32_t>(receive_buf) & 0x1fff'ffff;
|
||||
|
||||
host_command->bus_data.command_code = command_code;
|
||||
host_command->bus_data.destination_ap = ap::de::expansion_device | ap::port_select::a | ap::lm_bus::_0;
|
||||
@ -29,54 +31,47 @@ void maple_init_host_command(uint32_t * buf, uint32_t * receive_address, uint8_t
|
||||
host_command->bus_data.data_size = data_size / 4;
|
||||
}
|
||||
|
||||
void maple_init_device_request(uint32_t * buf, uint32_t * receive_address)
|
||||
void init_device_request(uint32_t * buf, uint32_t * receive_buf)
|
||||
{
|
||||
maple_init_host_command(buf, receive_address, device_request::command_code, (sizeof (struct device_request::data_fields)));
|
||||
init_host_command(buf, receive_buf, device_request::command_code, (sizeof (struct device_request::data_fields)));
|
||||
}
|
||||
|
||||
void maple_init_get_condition(uint32_t * buf, uint32_t * receive_address)
|
||||
void init_get_condition(uint32_t * buf, uint32_t * receive_buf)
|
||||
{
|
||||
maple_init_host_command(buf, receive_address, get_condition::command_code, (sizeof (struct get_condition::data_fields)));
|
||||
init_host_command(buf, receive_buf, get_condition::command_code, (sizeof (struct get_condition::data_fields)));
|
||||
|
||||
auto host_command = reinterpret_cast<maple_host_command<get_condition::data_fields> *>(buf);
|
||||
auto host_command = reinterpret_cast<struct host_command<get_condition::data_fields> *>(buf);
|
||||
|
||||
auto& function_type = host_command->bus_data.data_fields.function_type;
|
||||
auto& fields = host_command->bus_data.data_fields;
|
||||
// controller function type
|
||||
function_type[0] = 0x00;
|
||||
function_type[1] = 0x00;
|
||||
function_type[2] = 0x00;
|
||||
function_type[3] = 0x01;
|
||||
fields.function_type = std::byteswap(function_type::controller);
|
||||
}
|
||||
|
||||
void maple_init_block_write(uint32_t * buf, uint32_t * receive_address, uint32_t * data)
|
||||
void init_block_write(uint32_t * buf, uint32_t * receive_buf, uint32_t * data)
|
||||
{
|
||||
maple_init_host_command(buf, receive_address, block_write::command_code, (sizeof (struct block_write::data_fields<uint32_t[192 / 4]>)));
|
||||
init_host_command(buf, receive_buf, block_write::command_code, (sizeof (struct block_write::data_fields<uint32_t[192 / 4]>)));
|
||||
|
||||
auto host_command = reinterpret_cast<maple_host_command<block_write::data_fields<uint32_t[192 / 4]>> *>(buf);
|
||||
auto host_command = reinterpret_cast<struct host_command<block_write::data_fields<uint32_t[192 / 4]>> *>(buf);
|
||||
|
||||
auto& fields = host_command->bus_data.data_fields;
|
||||
// BW LCD function type
|
||||
fields.function_type[0] = 0x00;
|
||||
fields.function_type[1] = 0x00;
|
||||
fields.function_type[2] = 0x00;
|
||||
fields.function_type[3] = 0x04;
|
||||
fields.function_type = std::byteswap(function_type::bw_lcd);
|
||||
|
||||
// lcd number 0 (1 total lcd)
|
||||
fields.pt[0] = 0;
|
||||
fields.pt = 0;
|
||||
|
||||
// phase 0 (from 0 to 3)
|
||||
fields.phase[0] = 0;
|
||||
fields.phase = 0;
|
||||
|
||||
// plane 0 (2 total levels of gradation)
|
||||
fields.block_no[0] = 0x00;
|
||||
fields.block_no[1] = 0x00;
|
||||
fields.block_no = std::byteswap(0x0000);
|
||||
|
||||
for (uint32_t i = 0; i < (192 / 4); i++) {
|
||||
fields.written_data[i] = data[i];
|
||||
}
|
||||
}
|
||||
|
||||
void maple_dma_start(uint32_t * command_buf)
|
||||
void dma_start(uint32_t * command_buf)
|
||||
{
|
||||
sh7091.DMAC.DMAOR = DMAOR__DDT /* on-demand data transfer mode */
|
||||
| DMAOR__PR__CH2_CH0_CH1_CH3 /* priority mode; CH2 > CH0 > CH1 > CH3 */
|
||||
@ -113,3 +108,5 @@ void maple_dma_start(uint32_t * command_buf)
|
||||
while ((system.ISTNRM & ISTNRM__END_OF_DMA_MAPLE_DMA) == 0);
|
||||
system.ISTNRM = ISTNRM__END_OF_DMA_MAPLE_DMA;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
template <typename T>
|
||||
struct maple_host_command {
|
||||
uint32_t host_instruction;
|
||||
uint32_t receive_data_storage_address;
|
||||
struct bus_data {
|
||||
uint8_t command_code;
|
||||
uint8_t destination_ap;
|
||||
uint8_t source_ap;
|
||||
uint8_t data_size;
|
||||
T data_fields;
|
||||
} bus_data;
|
||||
};
|
||||
|
||||
void maple_init_host_command(uint32_t * buf, uint32_t * receive_address);
|
||||
void maple_init_device_request(uint32_t * buf, uint32_t * receive_address);
|
||||
void maple_init_get_condition(uint32_t * buf, uint32_t * receive_address);
|
||||
void maple_init_block_write(uint32_t * buf, uint32_t * receive_address, uint32_t * data);
|
||||
void maple_dma_start(uint32_t * command_buf);
|
27
maple/maple.hpp
Normal file
27
maple/maple.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace maple {
|
||||
|
||||
template <typename T>
|
||||
struct host_command {
|
||||
uint32_t host_instruction;
|
||||
uint32_t receive_data_storage_address;
|
||||
struct bus_data {
|
||||
uint8_t command_code;
|
||||
uint8_t destination_ap;
|
||||
uint8_t source_ap;
|
||||
uint8_t data_size;
|
||||
T data_fields;
|
||||
} bus_data;
|
||||
};
|
||||
|
||||
void init_host_command(uint32_t * command_buf, uint32_t * receive_buf);
|
||||
void init_device_request(uint32_t * command_buf, uint32_t * receive_buf);
|
||||
void init_get_condition(uint32_t * command_buf, uint32_t * receive_buf);
|
||||
void init_block_write(uint32_t * command_buf, uint32_t * receive_buf, uint32_t * data);
|
||||
void dma_start(uint32_t * command_buf);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "../float_uint32.h"
|
||||
#include "../float_uint32.hpp"
|
||||
|
||||
namespace mdstar {
|
||||
constexpr uint32_t table_address(uint32_t num) { return (num & 0xfffffe0) << 0; }
|
@ -1,6 +1,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "../float_uint32.h"
|
||||
#include "../float_uint32.hpp"
|
||||
|
||||
namespace host_instruction {
|
||||
constexpr uint32_t end_flag = 1 << 31;
|
||||
@ -46,3 +46,18 @@ namespace ap {
|
||||
}
|
||||
}
|
||||
|
||||
namespace function_type {
|
||||
constexpr uint32_t camera = 1 << 11;
|
||||
constexpr uint32_t exchange_media = 1 << 10;
|
||||
constexpr uint32_t pointing = 1 << 9;
|
||||
constexpr uint32_t vibration = 1 << 8;
|
||||
constexpr uint32_t light_gun = 1 << 7;
|
||||
constexpr uint32_t keyboard = 1 << 6;
|
||||
constexpr uint32_t ar_gun = 1 << 5;
|
||||
constexpr uint32_t audio_input = 1 << 4;
|
||||
constexpr uint32_t timer = 1 << 3;
|
||||
constexpr uint32_t bw_lcd = 1 << 2;
|
||||
constexpr uint32_t storage = 1 << 1;
|
||||
constexpr uint32_t controller = 1 << 0;
|
||||
}
|
||||
|
@ -33,12 +33,12 @@ namespace device_status {
|
||||
|
||||
struct data_fields {
|
||||
uint8_t device_id[16];
|
||||
uint8_t destination_code[1];
|
||||
uint8_t connection_direction[1];
|
||||
uint8_t destination_code;
|
||||
uint8_t connection_direction;
|
||||
uint8_t product_name[30];
|
||||
uint8_t license[60];
|
||||
uint8_t low_consumption_standby_current[2];
|
||||
uint8_t maximum_current_consumption[2];
|
||||
uint16_t low_consumption_standby_current;
|
||||
uint16_t maximum_current_consumption;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 112);
|
||||
@ -50,12 +50,12 @@ namespace device_all_status {
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t device_id[16];
|
||||
uint8_t destination_code[1];
|
||||
uint8_t connection_direction[1];
|
||||
uint8_t destination_code;
|
||||
uint8_t connection_direction;
|
||||
uint8_t product_name[30];
|
||||
uint8_t license[60];
|
||||
uint8_t low_consumption_standby_current[2];
|
||||
uint8_t maximum_current_consumption[2];
|
||||
uint16_t low_consumption_standby_current;
|
||||
uint16_t maximum_current_consumption;
|
||||
T free_device_status;
|
||||
};
|
||||
|
||||
@ -74,7 +74,7 @@ namespace data_transfer {
|
||||
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint32_t function_type;
|
||||
T data;
|
||||
};
|
||||
|
||||
@ -85,7 +85,7 @@ namespace get_condition {
|
||||
constexpr uint32_t command_code = 0x9;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint32_t function_type;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 4);
|
||||
@ -95,8 +95,8 @@ namespace get_media_info {
|
||||
constexpr uint32_t command_code = 0xa;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint8_t pt[4];
|
||||
uint32_t function_type;
|
||||
uint32_t pt;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 8);
|
||||
@ -106,10 +106,10 @@ namespace block_read {
|
||||
constexpr uint32_t command_code = 0xb;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint8_t pt[1];
|
||||
uint8_t phase[1];
|
||||
uint8_t block_no[2];
|
||||
uint32_t function_type;
|
||||
uint8_t pt;
|
||||
uint8_t phase;
|
||||
uint16_t block_no;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 8);
|
||||
@ -120,10 +120,10 @@ namespace block_write {
|
||||
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint8_t pt[1];
|
||||
uint8_t phase[1];
|
||||
uint8_t block_no[2];
|
||||
uint32_t function_type;
|
||||
uint8_t pt;
|
||||
uint8_t phase;
|
||||
uint16_t block_no;
|
||||
T written_data;
|
||||
};
|
||||
|
||||
@ -134,10 +134,10 @@ namespace get_last_error {
|
||||
constexpr uint32_t command_code = 0xd;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint8_t pt[1];
|
||||
uint8_t phase[1];
|
||||
uint8_t block_no[2];
|
||||
uint32_t function_type;
|
||||
uint8_t pt;
|
||||
uint8_t phase;
|
||||
uint16_t block_no;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 8);
|
||||
@ -148,7 +148,7 @@ namespace set_condition {
|
||||
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint32_t function_type;
|
||||
T write_in_data;
|
||||
};
|
||||
|
||||
@ -160,7 +160,7 @@ namespace ft4_control {
|
||||
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint32_t function_type;
|
||||
T ft4_data;
|
||||
};
|
||||
|
||||
@ -172,7 +172,7 @@ namespace ar_control {
|
||||
|
||||
template <typename T>
|
||||
struct data_fields {
|
||||
uint8_t function_type[4];
|
||||
uint32_t function_type;
|
||||
T data;
|
||||
};
|
||||
|
||||
@ -204,7 +204,7 @@ namespace file_error {
|
||||
constexpr uint32_t command_code = 0xfb;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_error_code[4];
|
||||
uint32_t function_error_code;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 4);
|
||||
@ -214,7 +214,7 @@ namespace lcd_error {
|
||||
constexpr uint32_t command_code = 0xfa;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_error_code[4];
|
||||
uint32_t function_error_code;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 4);
|
||||
@ -224,7 +224,7 @@ namespace ar_error {
|
||||
constexpr uint32_t command_code = 0xf9;
|
||||
|
||||
struct data_fields {
|
||||
uint8_t function_error_code[4];
|
||||
uint32_t function_error_code;
|
||||
};
|
||||
|
||||
static_assert((sizeof (struct data_fields)) == 4);
|
@ -1,4 +1,4 @@
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
extern volatile uint32_t system_boot_rom[0x200000] __asm("system_boot_rom");
|
||||
extern volatile uint32_t aica_wave_memory[0x200000] __asm("aica_wave_memory");
|
@ -36,7 +36,7 @@ def aggregate_enums(aggregated_rows):
|
||||
def assert_unique_ordered(bits):
|
||||
nonlocal all_bits
|
||||
assert all(bit not in all_bits for bit in bits), bits
|
||||
assert max(all_bits, default=32) > max(bits)
|
||||
assert max(all_bits, default=32) > max(bits), (all_bits, bits)
|
||||
all_bits |= bits
|
||||
|
||||
for row in aggregated_rows:
|
||||
@ -206,7 +206,7 @@ def render_registers(registers):
|
||||
def header():
|
||||
yield "#include <cstdint>"
|
||||
yield ""
|
||||
yield '#include "../float_uint32.h"'
|
||||
yield '#include "../float_uint32.hpp"'
|
||||
yield ""
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -34,7 +34,11 @@ def command_namespace(namespace: CommandNamespace,
|
||||
for field_name, field_size in data_fields:
|
||||
const, var = field_size
|
||||
if var is None:
|
||||
yield f"uint8_t {field_name}[{const}];"
|
||||
if const in {1, 2, 4}:
|
||||
bits = const * 8
|
||||
yield f"uint{bits}_t {field_name};"
|
||||
else:
|
||||
yield f"uint8_t {field_name}[{const}];"
|
||||
elif const == 0:
|
||||
assert var == "n"
|
||||
yield f"T {field_name};"
|
||||
|
@ -5,7 +5,7 @@ from sh7091 import read_input
|
||||
from generate import renderer
|
||||
|
||||
def includes():
|
||||
yield "#include <stdint.h>"
|
||||
yield "#include <cstdint>"
|
||||
yield ""
|
||||
|
||||
def process_rows(rows):
|
||||
|
@ -145,10 +145,10 @@ def blocks(rows):
|
||||
yield 'extern struct sh7091_reg sh7091 __asm("sh7091");'
|
||||
|
||||
def headers():
|
||||
yield "#include <stdint.h>"
|
||||
yield "#include <stddef.h>"
|
||||
yield "#include <cstdint>"
|
||||
yield "#include <cstddef>"
|
||||
yield ""
|
||||
yield '#include "type.h"'
|
||||
yield '#include "type.hpp"'
|
||||
yield ""
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
43
regs/maple_bus_bits.csv
Normal file
43
regs/maple_bus_bits.csv
Normal file
@ -0,0 +1,43 @@
|
||||
"register_name","enum_name","bits","bit_name","value","mask","description"
|
||||
"host_instruction",,31,"end_flag",1,,
|
||||
,,,,,,
|
||||
"host_instruction","port_select","17-16","a",0,,
|
||||
"host_instruction","port_select","17-16","b",1,,
|
||||
"host_instruction","port_select","17-16","c",2,,
|
||||
"host_instruction","port_select","17-16","d",3,,
|
||||
,,,,,,
|
||||
"host_instruction","pattern","10-8","normal","0b000",,
|
||||
"host_instruction","pattern","10-8","light_gun_mode","0b010",,
|
||||
"host_instruction","pattern","10-8","reset","0b011",,
|
||||
"host_instruction","pattern","10-8","return_from_light_gun_mode","0b100",,
|
||||
"host_instruction","pattern","10-8","nop","0b111",,
|
||||
,,,,,,
|
||||
"host_instruction",,"7-0","transfer_length",,"0xff",
|
||||
,,,,,,
|
||||
"ap","port_select","7-6","a","0b00",,
|
||||
"ap","port_select","7-6","b","0b01",,
|
||||
"ap","port_select","7-6","c","0b10",,
|
||||
"ap","port_select","7-6","d","0b11",,
|
||||
,,,,,,
|
||||
"ap","de",5,"device",1,,
|
||||
"ap","de",5,"expansion_device",0,,
|
||||
"ap","de",5,"port",0,,
|
||||
,,,,,,
|
||||
"ap","lm_bus","4-0","_4","0b10000",,
|
||||
"ap","lm_bus","4-0","_3","0b01000",,
|
||||
"ap","lm_bus","4-0","_2","0b00100",,
|
||||
"ap","lm_bus","4-0","_1","0b00010",,
|
||||
"ap","lm_bus","4-0","_0","0b00001",,
|
||||
,,,,,,
|
||||
"function_type",,11,"camera",1,,
|
||||
"function_type",,10,"exchange_media",1,,
|
||||
"function_type",,9,"pointing",1,,
|
||||
"function_type",,8,"vibration",1,,
|
||||
"function_type",,7,"light_gun",1,,
|
||||
"function_type",,6,"keyboard",1,,
|
||||
"function_type",,5,"ar_gun",1,,
|
||||
"function_type",,4,"audio_input",1,,
|
||||
"function_type",,3,"timer",1,,
|
||||
"function_type",,2,"bw_lcd",1,,
|
||||
"function_type",,1,"storage",1,,
|
||||
"function_type",,0,"controller",1,,
|
|
BIN
regs/maple_bus_bits.ods
Normal file
BIN
regs/maple_bus_bits.ods
Normal file
Binary file not shown.
2
rgb.cpp
2
rgb.cpp
@ -1,4 +1,4 @@
|
||||
#include "rgb.h"
|
||||
#include "rgb.hpp"
|
||||
|
||||
struct rgb hsv_to_rgb(struct hsv hsv)
|
||||
{
|
||||
|
27
runtime.cpp
Normal file
27
runtime.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "cache.hpp"
|
||||
|
||||
extern uint32_t __bss_link_start __asm("__bss_link_start");
|
||||
extern uint32_t __bss_link_end __asm("__bss_link_end");
|
||||
|
||||
extern void main();
|
||||
|
||||
extern "C"
|
||||
void runtime_init()
|
||||
__attribute__((section(".text.startup.runtime_init")));
|
||||
|
||||
extern "C"
|
||||
void runtime_init()
|
||||
{
|
||||
// clear BSS
|
||||
uint32_t * start = &__bss_link_start;
|
||||
uint32_t * end = &__bss_link_end;
|
||||
while (start < end) {
|
||||
*start++ = 0;
|
||||
}
|
||||
|
||||
cache::init();
|
||||
|
||||
main();
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "holly/ta_parameter.h"
|
||||
#include "holly/ta_parameter.hpp"
|
||||
|
||||
#include "holly/texture_memory_alloc.h"
|
||||
#include "holly/texture_memory_alloc.hpp"
|
||||
|
||||
/*
|
||||
-0.5,-0.5 0.5,-0.5
|
||||
@ -80,8 +80,6 @@ union ta_parameter {
|
||||
struct global_end_of_list global_end_of_list;
|
||||
};
|
||||
|
||||
extern void serial_string(const char * s);
|
||||
|
||||
uint32_t scene_transform(uint32_t * _scene)
|
||||
{
|
||||
ta_parameter * scene = reinterpret_cast<ta_parameter *>(&_scene[0]);
|
||||
|
61
serial.cpp
Normal file
61
serial.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
|
||||
#include "string.hpp"
|
||||
|
||||
namespace serial {
|
||||
|
||||
void init()
|
||||
{
|
||||
sh7091.SCIF.SCSCR2 = 0;
|
||||
sh7091.SCIF.SCSMR2 = 0;
|
||||
sh7091.SCIF.SCBRR2 = 1; // 520833.3
|
||||
|
||||
sh7091.SCIF.SCFCR2 = SCFCR2__TFRST | SCFCR2__RFRST;
|
||||
// tx/rx trigger on 1 byte
|
||||
sh7091.SCIF.SCFCR2 = 0;
|
||||
|
||||
sh7091.SCIF.SCSPTR2 = 0;
|
||||
sh7091.SCIF.SCLSR2 = 0;
|
||||
|
||||
sh7091.SCIF.SCSCR2 = SCSCR2__TE | SCSCR2__RE;
|
||||
}
|
||||
|
||||
void character(const char c)
|
||||
{
|
||||
// wait for transmit fifo to become empty
|
||||
while ((sh7091.SCIF.SCFSR2 & SCFSR2__TDFE) == 0);
|
||||
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
asm volatile ("nop;");
|
||||
}
|
||||
|
||||
sh7091.SCIF.SCFTDR2 = static_cast<uint8_t>(c);
|
||||
}
|
||||
|
||||
void string(const char * s)
|
||||
{
|
||||
while (*s != '\0') {
|
||||
character(*s++);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void integer(const T n)
|
||||
{
|
||||
constexpr uint32_t length = (sizeof (T)) * 2;
|
||||
char num_buf[length + 1];
|
||||
string::hex<char>(num_buf, length, n);
|
||||
num_buf[length] = 0;
|
||||
string("0x");
|
||||
string(num_buf);
|
||||
string("\n");
|
||||
}
|
||||
|
||||
template void integer<uint32_t>(uint32_t param);
|
||||
template void integer<uint16_t>(uint16_t param);
|
||||
template void integer<uint8_t>(uint8_t param);
|
||||
|
||||
}
|
12
serial.hpp
Normal file
12
serial.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
namespace serial {
|
||||
|
||||
void init();
|
||||
|
||||
void character(const char c);
|
||||
|
||||
void string(const char * s);
|
||||
|
||||
template <typename T>
|
||||
void integer(const T n);
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "type.h"
|
||||
#include "type.hpp"
|
||||
|
||||
struct ccn_reg {
|
||||
reg32 PTEH; /* Page table entry high register */
|
8
start.s
8
start.s
@ -10,8 +10,8 @@ _start:
|
||||
or r1,r0
|
||||
ldc r0,sr
|
||||
|
||||
/* jump to main */
|
||||
mov.l main_ptr,r0
|
||||
/* jump to runtime_init */
|
||||
mov.l runtime_init_ptr,r0
|
||||
jmp @r0
|
||||
nop
|
||||
|
||||
@ -20,5 +20,5 @@ p1ram_end_ptr:
|
||||
.long __p1ram_end
|
||||
imask_all:
|
||||
.long 0xf0
|
||||
main_ptr:
|
||||
.long _main
|
||||
runtime_init_ptr:
|
||||
.long _runtime_init
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "sh7091.h"
|
||||
#include "memorymap.h"
|
||||
#include "sh7091.hpp"
|
||||
#include "memorymap.hpp"
|
||||
|
||||
void sq_transfer_32byte(volatile void * dst)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
#include "type.h"
|
||||
#include "type.hpp"
|
||||
|
||||
struct system_reg {
|
||||
reg32 C2DSTAT; /* CH2-DMA destination address */
|
10
test.c
10
test.c
@ -1,9 +1,9 @@
|
||||
#include "type.h"
|
||||
#include "type.hpp"
|
||||
|
||||
#include "rgb.h"
|
||||
#include "vga.h"
|
||||
#include "systembus.h"
|
||||
#include "holly.h"
|
||||
#include "rgb.hpp"
|
||||
#include "vga.hpp"
|
||||
#include "systembus.hpp"
|
||||
#include "holly.hpp"
|
||||
|
||||
void *memcpy(void *restrict dest, const void *restrict src, size_t n)
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef static_assert
|
22
vga.cpp
22
vga.cpp
@ -1,14 +1,14 @@
|
||||
#include <stdint.h>
|
||||
#include <cstdint>
|
||||
|
||||
#include "sh7091.h"
|
||||
#include "sh7091_bits.h"
|
||||
#include "holly.h"
|
||||
#include "holly/core_bits.h"
|
||||
#include "aica.h"
|
||||
#include "memorymap.h"
|
||||
#include "sh7091.hpp"
|
||||
#include "sh7091_bits.hpp"
|
||||
#include "holly.hpp"
|
||||
#include "holly/core_bits.hpp"
|
||||
#include "aica.hpp"
|
||||
#include "memorymap.hpp"
|
||||
|
||||
#include "vga.h"
|
||||
#include "rgb.h"
|
||||
#include "vga.hpp"
|
||||
#include "rgb.hpp"
|
||||
|
||||
uint32_t get_cable_type()
|
||||
{
|
||||
@ -144,7 +144,7 @@ void vga()
|
||||
holly.SOFTRESET = 0;
|
||||
}
|
||||
|
||||
void fill_framebuffer()
|
||||
void vga_fill_framebuffer()
|
||||
{
|
||||
volatile uint16_t * vram = reinterpret_cast<volatile uint16_t *>(texture_memory);
|
||||
for (int y = 0; y < 480; y++) {
|
||||
@ -154,6 +154,4 @@ void fill_framebuffer()
|
||||
vram[y * 640 + x] = ((rgb.r >> 3) << 11) | ((rgb.g >> 2) << 5) | ((rgb.b >> 3) << 0);
|
||||
}
|
||||
}
|
||||
vram[0] = 0xf0ff;
|
||||
vram[10] = 0xf0ff;
|
||||
}
|
||||
|
@ -3,3 +3,4 @@
|
||||
void vga();
|
||||
void v_sync_in();
|
||||
void v_sync_out();
|
||||
void vga_fill_framebuffer();
|
Loading…
x
Reference in New Issue
Block a user