From ea6bfacb66a7a421bdc6933ca73a44ed6c0e9de1 Mon Sep 17 00:00:00 2001 From: Godzil Date: Wed, 4 Sep 2019 15:11:26 +0100 Subject: [PATCH] Don't use "pre made" EEPROM content, just fill it with 0, it works fine for now. Also set the "system" at a proper time And set the correct (?) size for EEPROM --- oswan/main.cpp | 2 +- oswan/source/io.cpp | 4 ++++ oswan/source/memory.cpp | 16 ++++++++++------ oswan/source/memory.h | 4 ++-- oswan/source/ws.cpp | 18 ++++++++++++------ 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/oswan/main.cpp b/oswan/main.cpp index 60e1c3a..a7e94ec 100644 --- a/oswan/main.cpp +++ b/oswan/main.cpp @@ -778,11 +778,11 @@ int main(int argc, char *argv[]) if (ws_rom_path) { + ws_set_system(ws_system); if (ws_init(ws_rom_path)) { app_rotated=ws_rotated(); app_gameRunning=1; - ws_set_system(ws_system); if (ws_system == WS_SYSTEM_COLOR) { diff --git a/oswan/source/io.cpp b/oswan/source/io.cpp index 2036254..06f5a83 100644 --- a/oswan/source/io.cpp +++ b/oswan/source/io.cpp @@ -932,6 +932,10 @@ void cpu_writeport(DWORD port,BYTE value) iee_Databuffer = internalEeprom[address]; printf(" Data : %04X\n", iee_Databuffer); } + else + { + printf(" Unknown value: %02X\n", value); + } fflush(stdout); } break; diff --git a/oswan/source/memory.cpp b/oswan/source/memory.cpp index a4b2725..b6b12af 100644 --- a/oswan/source/memory.cpp +++ b/oswan/source/memory.cpp @@ -27,7 +27,6 @@ #include "gpu.h" #include "audio.h" #include "memory.h" -#include "ieeprom.h" //////////////////////////////////////////////////////////////////////////////// // @@ -42,7 +41,6 @@ //////////////////////////////////////////////////////////////////////////////// #define IO_ROM_BANK_BASE_SELECTOR 0xC0 - uint8 *ws_rom; uint8 *ws_staticRam; uint8 *internalRam; @@ -264,10 +262,12 @@ char *load_file(char *filename) // // //////////////////////////////////////////////////////////////////////////////// -char *create_file(char *filename, uint32_t size, uint8_t *data) +char *create_file(char *filename, uint32_t size) { int fd; + uint32_t i; char *ret_ptr; + char buf[] = { 0 }; printf("Trying to create %s, size = %u...\n",filename, size); fd = open(filename, O_CREAT | S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH | O_TRUNC); @@ -277,7 +277,11 @@ char *create_file(char *filename, uint32_t size, uint8_t *data) fd = open(filename, O_RDWR); - write(fd, data, size); + for(i = 0; i < size; i++) + { + write(fd, buf, 1); + } + close(fd); sync(); @@ -324,13 +328,13 @@ void ws_memory_init(uint8 *rom, uint32 wsRomSize) internalBWEeprom = load_file("ws_ieeprom.bin"); if ( internalBWEeprom == NULL ) { - internalBWEeprom = create_file("ws_ieeprom.bin", BW_IEEPROM_SIZE, DefaultBWEEprom); + internalBWEeprom = create_file("ws_ieeprom.bin", BW_IEEPROM_SIZE); } internalColorEeprom = load_file("wsc_ieeprom.bin"); if ( internalColorEeprom == NULL ) { - internalColorEeprom = create_file("wsc_ieeprom.bin", COLOR_IEEPROM_SIZE, DefaultColorEEprom); + internalColorEeprom = create_file("wsc_ieeprom.bin", COLOR_IEEPROM_SIZE); } internalEeprom = (uint16_t *)internalBWEeprom; diff --git a/oswan/source/memory.h b/oswan/source/memory.h index f1b5e34..01accfe 100644 --- a/oswan/source/memory.h +++ b/oswan/source/memory.h @@ -30,8 +30,8 @@ void ws_sram_save(char *path); void dump_memory(); -#define BW_IEEPROM_SIZE (1024) -#define COLOR_IEEPROM_SIZE (1024) +#define BW_IEEPROM_SIZE (128) +#define COLOR_IEEPROM_SIZE (2048) #endif diff --git a/oswan/source/ws.cpp b/oswan/source/ws.cpp index ebe93ec..73e3c41 100644 --- a/oswan/source/ws.cpp +++ b/oswan/source/ws.cpp @@ -55,6 +55,8 @@ uint32 vblank_count=0; char *ws_sram_path = NULL; extern int ws_sram_dirty; +extern int ws_gpu_forceColorSystemBool; +extern int ws_gpu_forceMonoSystemBool; //////////////////////////////////////////////////////////////////////////////// // @@ -118,13 +120,17 @@ int ws_init(char *rompath) return(0); } - if (rompath[strlen(rompath)-1]=='c') + if ((ws_gpu_forceColorSystemBool == 0) && (ws_gpu_forceMonoSystemBool == 0)) { - ws_gpu_operatingInColor=1; - } - else - { - ws_gpu_operatingInColor=0; + /* Nothing forced try to "auto detect" */ + if (rompath[strlen(rompath)-1]=='c') + { + ws_gpu_operatingInColor=1; + } + else + { + ws_gpu_operatingInColor=0; + } } ws_memory_init(rom,romSize);