From 10fc356318d9db4c04b1c5515789076882e80387 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 4 Oct 2020 11:26:01 +0200 Subject: [PATCH] Add race-globals.cpp --- Makefile.common | 3 ++- graphics.cpp | 47 --------------------------------------------- graphics.h | 35 +++++++++++++++++++++++++++++++++ race-globals.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ tlcs900h.cpp | 1 - tlcs900h.h | 1 + 6 files changed, 88 insertions(+), 49 deletions(-) create mode 100644 race-globals.cpp diff --git a/Makefile.common b/Makefile.common index 142f918..05b43a0 100644 --- a/Makefile.common +++ b/Makefile.common @@ -35,7 +35,8 @@ endif SOURCES_CXX := \ $(CORE_DIR)/tlcs900h.cpp \ - $(CORE_DIR)/graphics.cpp + $(CORE_DIR)/graphics.cpp \ + $(CORE_DIR)/race-globals.cpp SOURCES_C += \ $(CORE_DIR)/main.c \ diff --git a/graphics.cpp b/graphics.cpp index 12057f5..aa70137 100644 --- a/graphics.cpp +++ b/graphics.cpp @@ -84,53 +84,6 @@ const unsigned char mypatterns[256*4] = 3,3,2,0, 3,3,2,1, 3,3,2,2, 3,3,2,3, 3,3,3,0, 3,3,3,1, 3,3,3,2, 3,3,3,3, }; -/* standard VRAM table adresses */ -unsigned char *sprite_table = get_address(0x00008800); -unsigned char *pattern_table = get_address(0x0000A000); -unsigned short*patterns = (unsigned short*)pattern_table; -unsigned short *tile_table_front = (unsigned short *)get_address(0x00009000); -unsigned short *tile_table_back = (unsigned short *)get_address(0x00009800); -unsigned short *palette_table = (unsigned short *)get_address(0x00008200); -unsigned char *bw_palette_table = get_address(0x00008100); -unsigned char *sprite_palette_numbers = get_address(0x00008C00); - -/* VDP registers - * - * where is the vdp rendering now on the lcd display? - */ - -#if 0 -unsigned char *scanlineX = get_address(0x00008008); -#endif -unsigned char *scanlineY = get_address(0x00008009); -/* frame 0/1 priority registers */ -unsigned char *frame0Pri = get_address(0x00008000); -unsigned char *frame1Pri = get_address(0x00008030); -/* windowing registers */ -unsigned char *wndTopLeftX = get_address(0x00008002); -unsigned char *wndTopLeftY = get_address(0x00008003); -unsigned char *wndSizeX = get_address(0x00008004); -unsigned char *wndSizeY = get_address(0x00008005); -/* scrolling registers */ -unsigned char *scrollSpriteX = get_address(0x00008020); -unsigned char *scrollSpriteY = get_address(0x00008021); -unsigned char *scrollFrontX = get_address(0x00008032); -unsigned char *scrollFrontY = get_address(0x00008033); -unsigned char *scrollBackX = get_address(0x00008034); -unsigned char *scrollBackY = get_address(0x00008035); -/* background color selection register and table */ -unsigned char *bgSelect = get_address(0x00008118); -unsigned short *bgTable = (unsigned short *)get_address(0x000083E0); -unsigned char *oowSelect = get_address(0x00008012); -unsigned short *oowTable = (unsigned short *)get_address(0x000083F0); -/* machine constants */ -unsigned char *color_switch = get_address(0x00006F91); - -/* Defines */ -#define ZeroStruct(x) ZeroMemory(&x, sizeof(x)); x.dwSize = sizeof(x); -#define SafeRelease(x) if(x) { x->Release(); x = NULL; } - - /* target window */ /* unsigned short p2[16] = { diff --git a/graphics.h b/graphics.h index 7799038..eb4111e 100644 --- a/graphics.h +++ b/graphics.h @@ -29,9 +29,44 @@ #ifdef __cplusplus extern "C" { #endif + +extern unsigned char *sprite_table; +extern unsigned char *pattern_table; +extern unsigned short*patterns; +extern unsigned short *tile_table_front; +extern unsigned short *tile_table_back; +extern unsigned short *palette_table; +extern unsigned char *bw_palette_table; +extern unsigned char *sprite_palette_numbers; + +extern unsigned char *scanlineY; +/* frame 0/1 priority registers */ +extern unsigned char *frame0Pri; +extern unsigned char *frame1Pri; +/* windowing registers */ +extern unsigned char *wndTopLeftX; +extern unsigned char *wndTopLeftY; +extern unsigned char *wndSizeX; +extern unsigned char *wndSizeY; +/* scrolling registers */ +extern unsigned char *scrollSpriteX; +extern unsigned char *scrollSpriteY; +extern unsigned char *scrollFrontX; +extern unsigned char *scrollFrontY; +extern unsigned char *scrollBackX; +extern unsigned char *scrollBackY; +/* background color selection register and table */ +extern unsigned char *bgSelect; +extern unsigned short *bgTable; +extern unsigned char *oowSelect; +extern unsigned short *oowTable; +/* machine constants */ +extern unsigned char *color_switch; + BOOL graphics_init(void); void graphics_paint(void); void graphicsSetDarkFilterLevel(unsigned filterLevel); + #ifdef __cplusplus } #endif diff --git a/race-globals.cpp b/race-globals.cpp new file mode 100644 index 0000000..4dab2db --- /dev/null +++ b/race-globals.cpp @@ -0,0 +1,50 @@ +#include +#include "race-memory.h" + +extern "C" { + +/* standard VRAM table adresses */ +unsigned char *sprite_table = get_address(0x00008800); +unsigned char *pattern_table = get_address(0x0000A000); +unsigned short*patterns = (unsigned short*)pattern_table; +unsigned short *tile_table_front = (unsigned short *)get_address(0x00009000); +unsigned short *tile_table_back = (unsigned short *)get_address(0x00009800); +unsigned short *palette_table = (unsigned short *)get_address(0x00008200); +unsigned char *bw_palette_table = get_address(0x00008100); +unsigned char *sprite_palette_numbers = get_address(0x00008C00); + +/* VDP registers + * + * where is the vdp rendering now on the lcd display? + */ + +#if 0 +unsigned char *scanlineX = get_address(0x00008008); +#endif +unsigned char *scanlineY = get_address(0x00008009); +/* frame 0/1 priority registers */ +unsigned char *frame0Pri = get_address(0x00008000); +unsigned char *frame1Pri = get_address(0x00008030); +/* windowing registers */ +unsigned char *wndTopLeftX = get_address(0x00008002); +unsigned char *wndTopLeftY = get_address(0x00008003); +unsigned char *wndSizeX = get_address(0x00008004); +unsigned char *wndSizeY = get_address(0x00008005); +/* scrolling registers */ +unsigned char *scrollSpriteX = get_address(0x00008020); +unsigned char *scrollSpriteY = get_address(0x00008021); +unsigned char *scrollFrontX = get_address(0x00008032); +unsigned char *scrollFrontY = get_address(0x00008033); +unsigned char *scrollBackX = get_address(0x00008034); +unsigned char *scrollBackY = get_address(0x00008035); +/* background color selection register and table */ +unsigned char *bgSelect = get_address(0x00008118); +unsigned short *bgTable = (unsigned short *)get_address(0x000083E0); +unsigned char *oowSelect = get_address(0x00008012); +unsigned short *oowTable = (unsigned short *)get_address(0x000083F0); +/* machine constants */ +unsigned char *color_switch = get_address(0x00006F91); + +unsigned char *rasterY = get_address(0x00008035); + +} diff --git a/tlcs900h.cpp b/tlcs900h.cpp index f40df11..5a0ba83 100644 --- a/tlcs900h.cpp +++ b/tlcs900h.cpp @@ -46,7 +46,6 @@ int finscan; int contador; extern int gfx_hacks; extern int fixsoundmahjong; -unsigned char *rasterY = get_address(0x00008035); // ngpcdis.cpp // diff --git a/tlcs900h.h b/tlcs900h.h index 0c9b938..75b164d 100644 --- a/tlcs900h.h +++ b/tlcs900h.h @@ -16,6 +16,7 @@ extern "C" { #endif +extern unsigned char *rasterY; extern unsigned int gen_regsPC, gen_regsSR; extern unsigned char F2; extern unsigned int