Add race-globals.cpp

This commit is contained in:
twinaphex 2020-10-04 11:26:01 +02:00
parent e0d4fd9cb6
commit 10fc356318
6 changed files with 88 additions and 49 deletions

View File

@ -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 \

View File

@ -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] = {

View File

@ -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

50
race-globals.cpp Normal file
View File

@ -0,0 +1,50 @@
#include <stdint.h>
#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);
}

View File

@ -46,7 +46,6 @@ int finscan;
int contador;
extern int gfx_hacks;
extern int fixsoundmahjong;
unsigned char *rasterY = get_address(0x00008035);
// ngpcdis.cpp
//

View File

@ -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