Reindented most of the files (still work to be done there)

Now support the BW and Color IROM
Internal EEPROM support is now nearly correct (still some odd thing
happening)
This commit is contained in:
Godzil 2019-09-03 17:33:29 +01:00
parent 84804c8d0a
commit b1abbf6bfe
39 changed files with 11857 additions and 6440 deletions

65
oswan/col.txt Normal file
View File

@ -0,0 +1,65 @@
00000000 ff ff ff ff ff ff c0 ff 00 00 00 00 00 00 00 00 |................|
00000010 00 00 00 00 00 00 00 00 00 00 7f 00 ff ff ff ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff |................|
00000050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000060 00 fc ff 01 ff fd ff fd ff fd ff fd ff fd ff fd |................|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000120 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000130 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000140 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000150 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000160 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000170 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000180 00 00 03 03 00 00 00 40 80 00 00 00 00 00 00 00 |.......@........|
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001b0 87 05 8c 09 05 0c 8b 0c 90 00 00 02 00 4c a5 00 |.............L..|
000001c0 80 00 00 00 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001d0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001e0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001f0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
00000200 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000210 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000220 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000230 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000240 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000250 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000260 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000270 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000280 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000290 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000300 00 00 06 06 06 06 06 00 00 00 00 00 01 80 0f 00 |................|
00000310 01 01 01 0f 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000360 21 19 18 0e 0f 1c 1d 21 0b 18 00 00 00 00 00 00 |!......!........|
00000370 20 01 01 21 01 04 00 01 00 98 3c 7f 4a 01 35 01 | ..!......<.J.5.|
00000380 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000390 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000400

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@
#define IDC_RADIO_SUPEREAGLE 1022
// Next default values for new objects
//
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108

File diff suppressed because it is too large Load Diff

View File

@ -16,230 +16,301 @@ typedef Sint32 int32;
#define stricmp strcasecmp
#endif
class Error {
class Error
{
public:
Error(const char *message) {
strcpy(_message, message);
}
Error(const char *message)
{
strcpy(_message, message);
}
void report(void) {
printf("Error: %s\n", _message);
}
void report(void)
{
printf("Error: %s\n", _message);
}
private:
char _message[1024];
char _message[1024];
};
class Area {
class Area
{
public:
Area(int left, int top, int right, int bottom) {
_left = left;
_top = top;
_right = right;
_bottom = bottom;
}
Area(int left, int top, int right, int bottom)
{
_left = left;
_top = top;
_right = right;
_bottom = bottom;
}
int left(void) const {
return(_left);
}
int right(void) const {
return(_right);
}
int top(void) const {
return(_top);
}
int bottom(void) const {
return(_bottom);
}
int width(void) const {
return(_right-_left);
}
int height(void) const {
return(_bottom-_top);
}
int left(void) const
{
return(_left);
}
int right(void) const
{
return(_right);
}
int top(void) const
{
return(_top);
}
int bottom(void) const
{
return(_bottom);
}
int width(void) const
{
return(_right-_left);
}
int height(void) const
{
return(_bottom-_top);
}
private:
int _left, _top, _right, _bottom;
int _left, _top, _right, _bottom;
};
class Format {
class Format
{
public:
Format(int bpp, int maskR = 0, int maskG = 0, int maskB = 0) {
_bpp = bpp;
_maskR = maskR;
_maskG = maskG;
_maskB = maskB;
}
Format(int bpp, int maskR = 0, int maskG = 0, int maskB = 0)
{
_bpp = bpp;
_maskR = maskR;
_maskG = maskG;
_maskB = maskB;
}
Uint8 BPP(void) const { return(_bpp); }
Uint32 MaskR(void) const { return(_maskR); }
Uint32 MaskG(void) const { return(_maskG); }
Uint32 MaskB(void) const { return(_maskB); }
Uint8 BPP(void) const
{
return(_bpp);
}
Uint32 MaskR(void) const
{
return(_maskR);
}
Uint32 MaskG(void) const
{
return(_maskG);
}
Uint32 MaskB(void) const
{
return(_maskB);
}
private:
Uint8 _bpp;
Uint32 _maskR, _maskG, _maskB;
Uint8 _bpp;
Uint32 _maskR, _maskG, _maskB;
};
class Surface {
class Surface
{
public:
Surface(int w, int h, const Format &format) {
surface = SDL_AllocSurface(SDL_SWSURFACE, w, h, format.BPP(),
format.MaskR(),format.MaskG(),format.MaskB(),0);
if ( surface == NULL ) {
throw Error(SDL_GetError());
}
nupdates = 0;
is_console = 0;
}
Surface(void) {
nupdates = 0;
is_console = 1;
}
virtual ~Surface() {
if ( ! is_console ) {
SDL_FreeSurface(surface);
}
}
Surface(int w, int h, const Format &format)
{
surface = SDL_AllocSurface(SDL_SWSURFACE, w, h, format.BPP(),
format.MaskR(),format.MaskG(),format.MaskB(),0);
virtual int width(void) {
return surface->w;
}
virtual int height(void) {
return surface->h;
}
virtual int pitch(void) {
return surface->pitch;
}
if ( surface == NULL )
{
throw Error(SDL_GetError());
}
virtual void palette(int32 *pcolors) {
SDL_Color colors[256];
nupdates = 0;
is_console = 0;
}
Surface(void)
{
nupdates = 0;
is_console = 1;
}
virtual ~Surface()
{
if ( ! is_console )
{
SDL_FreeSurface(surface);
}
}
for ( int i=0; i<256; ++i ) {
colors[i].r = (pcolors[i]>>16)&0xFF;
colors[i].g = (pcolors[i]>>8)&0xFF;
colors[i].b = (pcolors[i]>>0)&0xFF;
}
SDL_SetColors(surface, colors, 0, 256);
}
virtual int width(void)
{
return surface->w;
}
virtual int height(void)
{
return surface->h;
}
virtual int pitch(void)
{
return surface->pitch;
}
virtual void *lock(void) {
if ( SDL_MUSTLOCK(surface) ) {
while ( SDL_LockSurface(surface) < 0 ) {
SDL_Delay(10);
}
}
return (Uint8 *)surface->pixels;
}
virtual void palette(int32 *pcolors)
{
SDL_Color colors[256];
virtual void unlock(void) {
if ( SDL_MUSTLOCK(surface) ) {
SDL_UnlockSurface(surface);
}
}
for ( int i=0; i<256; ++i )
{
colors[i].r = (pcolors[i]>>16)&0xFF;
colors[i].g = (pcolors[i]>>8)&0xFF;
colors[i].b = (pcolors[i]>>0)&0xFF;
}
virtual void copy(Surface &dst,
const Area &srcarea, const Area &dstarea) {
SDL_Rect srcrect, dstrect;
srcrect.x = srcarea.left();
srcrect.y = srcarea.top();
srcrect.w = srcarea.width();
srcrect.h = srcarea.height();
dstrect.x = dstarea.left();
dstrect.y = dstarea.top();
dstrect.w = dstarea.width();
dstrect.h = dstarea.height();
SDL_BlitSurface(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
virtual void copy(Surface &dst) {
SDL_Rect srcrect, dstrect;
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = surface->w;
srcrect.h = surface->h;
dstrect.x = 0;
dstrect.y = 0;
dstrect.w = surface->w;
dstrect.h = surface->h;
SDL_LowerBlit(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
SDL_SetColors(surface, colors, 0, 256);
}
virtual void update(void) {
SDL_UpdateRects(surface, nupdates, updates);
nupdates = 0;
}
virtual void *lock(void)
{
if ( SDL_MUSTLOCK(surface) )
{
while ( SDL_LockSurface(surface) < 0 )
{
SDL_Delay(10);
}
}
return (Uint8 *)surface->pixels;
}
virtual void unlock(void)
{
if ( SDL_MUSTLOCK(surface) )
{
SDL_UnlockSurface(surface);
}
}
virtual void copy(Surface &dst,
const Area &srcarea, const Area &dstarea)
{
SDL_Rect srcrect, dstrect;
srcrect.x = srcarea.left();
srcrect.y = srcarea.top();
srcrect.w = srcarea.width();
srcrect.h = srcarea.height();
dstrect.x = dstarea.left();
dstrect.y = dstarea.top();
dstrect.w = dstarea.width();
dstrect.h = dstarea.height();
SDL_BlitSurface(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
virtual void copy(Surface &dst)
{
SDL_Rect srcrect, dstrect;
srcrect.x = 0;
srcrect.y = 0;
srcrect.w = surface->w;
srcrect.h = surface->h;
dstrect.x = 0;
dstrect.y = 0;
dstrect.w = surface->w;
dstrect.h = surface->h;
SDL_LowerBlit(surface, &srcrect, dst.surface, &dstrect);
dst.updates[dst.nupdates++] = dstrect;
}
virtual void update(void)
{
SDL_UpdateRects(surface, nupdates, updates);
nupdates = 0;
}
protected:
SDL_Surface *surface;
int nupdates;
SDL_Rect updates[1]; /* Definitely increase this.. */
int is_console;
SDL_Surface *surface;
int nupdates;
SDL_Rect updates[1]; /* Definitely increase this.. */
int is_console;
};
class Console : public Surface {
int fullscreen;
class Console : public Surface
{
int fullscreen;
public:
Console() : Surface() {
fullscreen=0;
}
~Console() {
SDL_Quit();
}
void close(void)
{
SDL_Quit();
}
void option(char *option)
{
if (!stricmp(option,"fullscreen output"))
fullscreen=1;
else
if (!stricmp(option,"windowed output"))
fullscreen=0;
}
void open(const char *title, int width, int height, const Format &format) {
Uint32 flags;
Console() : Surface()
{
fullscreen=0;
}
~Console()
{
if ( SDL_InitSubSystem(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 ) {
throw Error(SDL_GetError());
}
//flags = (SDL_HWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN);
flags = (SDL_HWSURFACE|SDL_HWPALETTE);
if (fullscreen)
flags|=SDL_FULLSCREEN;
surface = SDL_SetVideoMode(width, height, 0, flags);
if ( surface == NULL ) {
throw Error(SDL_GetError());
}
SDL_WM_SetCaption(title, title);
}
SDL_Quit();
}
void close(void)
{
SDL_Quit();
}
void option(char *option)
{
if (!stricmp(option,"fullscreen output"))
{
fullscreen=1;
}
else if (!stricmp(option,"windowed output"))
{
fullscreen=0;
}
}
void open(const char *title, int width, int height, const Format &format)
{
Uint32 flags;
int key(void) {
SDL_Event event;
int keyevent;
if ( SDL_InitSubSystem(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) < 0 )
{
throw Error(SDL_GetError());
}
keyevent = 0;
while ( SDL_PollEvent(&event) ) {
/* Real key events trigger this function */
if ( event.type == SDL_KEYDOWN ) {
keyevent = 1;
}
/* So do quit events -- let the app know about it */
if ( event.type == SDL_QUIT ) {
keyevent = 1;
}
}
return(keyevent);
}
//flags = (SDL_HWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN);
flags = (SDL_HWSURFACE|SDL_HWPALETTE);
if (fullscreen)
{
flags|=SDL_FULLSCREEN;
}
surface = SDL_SetVideoMode(width, height, 0, flags);
if ( surface == NULL )
{
throw Error(SDL_GetError());
}
SDL_WM_SetCaption(title, title);
}
int key(void)
{
SDL_Event event;
int keyevent;
keyevent = 0;
while ( SDL_PollEvent(&event) )
{
/* Real key events trigger this function */
if ( event.type == SDL_KEYDOWN )
{
keyevent = 1;
}
/* So do quit events -- let the app know about it */
if ( event.type == SDL_QUIT )
{
keyevent = 1;
}
}
return(keyevent);
}
private:

File diff suppressed because it is too large Load Diff

View File

@ -11,46 +11,49 @@
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_2xSaI(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partA.h"
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
_2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -11,20 +11,36 @@
////////////////////////////////////////////////////////////////////////////////
__inline void ws_drawDoubledScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<224;pixel+=8)
{
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
}
for (int pixel=0; pixel<224; pixel+=8)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -39,20 +55,36 @@ __inline void ws_drawDoubledScanline(int16 *vs, int16 *backbuffer_alias)
////////////////////////////////////////////////////////////////////////////////
__inline void ws_drawDoubledRotatedScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<144;pixel+=8)
{
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
}
for (int pixel=0; pixel<144; pixel+=8)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -70,83 +102,147 @@ uint16 ws_halfBrightnessTable[32];
__inline void ws_drawDoubledHalfBrightnessScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<224;pixel+=4)
{
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessScanlineSpecialEven(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<224;pixel+=4)
{
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessScanlineSpecialOdd(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<224;pixel+=4)
{
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<224; pixel+=4)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanline(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<144;pixel+=4)
{
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanlineSpecialEven(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<144;pixel+=4)
{
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
}
}
__inline void ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(int16 *vs, int16 *backbuffer_alias)
{
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0;pixel<144;pixel+=4)
{
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data|=(data<<16); *vs_alias++=data;
data=*backbuffer_alias++; data=M_HALFBRIGHTNESS(data); data|=(data<<16); *vs_alias++=data;
}
register int32 *vs_alias=(int32*)vs;
register int32 data;
for (int pixel=0; pixel<144; pixel+=4)
{
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data|=(data<<16);
*vs_alias++=data;
data=*backbuffer_alias++;
data=M_HALFBRIGHTNESS(data);
data|=(data<<16);
*vs_alias++=data;
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -161,60 +257,69 @@ __inline void ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(int16 *vs, i
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_doubled(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<224;line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<144;line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -1,14 +1,15 @@
//Sint32 startTime, endTime, totalFrames;
//Uint32 nNormalLast=0;
//Sint32 nNormalFrac=0;
//Sint32 nTime=0,
Sint32 nCount=0; int i=0;
//Sint32 startTime, endTime, totalFrames;
//Uint32 nNormalLast=0;
//Sint32 nNormalFrac=0;
//Sint32 nTime=0,
Sint32 nCount=0;
int i=0;
double dTime = 0.0, dNormalLast = 0.0, dTemp;
Sint32 surfacePitch;
double dTime = 0.0, dNormalLast = 0.0, dTemp;
Sint32 surfacePitch;
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;

View File

@ -1,23 +1,29 @@
int16 *backbuffer=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer,0x00,224*144*sizeof(int16));
surfacePitch=(surface->pitch()>>1);
console.option("DirectX");
if (app_fullscreen)
console.option("fullscreen output");
else
console.option("windowed output");
console.option("fixed window");
console.option("center window");
//totalFrames=0;
//startTime=clock();
//nNormalLast=0;// Last value of timeGetTime()
//nNormalFrac=0; // Extra fraction we did
//nNormalLast=timeGetTime();
// hopefully, we only care about time delta, not time of day...
//nNormalLast = SDL_GetTicks();
dNormalLast = (double) SDL_GetTicks();
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}
int16 *backbuffer=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer,0x00,224*144*sizeof(int16));
surfacePitch=(surface->pitch()>>1);
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");
//totalFrames=0;
//startTime=clock();
//nNormalLast=0;// Last value of timeGetTime()
//nNormalFrac=0; // Extra fraction we did
//nNormalLast=timeGetTime();
// hopefully, we only care about time delta, not time of day...
//nNormalLast = SDL_GetTicks();
dNormalLast = (double) SDL_GetTicks();
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}

View File

@ -1,77 +1,100 @@
//nTime=SDL_GetTicks()-nNormalLast; // calcule le temps écoulé depuis le dernier affichage
dTemp = (double) SDL_GetTicks();
dTime = dTemp - dNormalLast;
//nTime=SDL_GetTicks()-nNormalLast; // calcule le temps écoulé depuis le dernier affichage
dTemp = (double) SDL_GetTicks();
dTime = dTemp - dNormalLast;
// nTime est en mili-secondes.
// détermine le nombre de trames à passer + 1
//nCount = (Sint32) ((((double)nTime)*600.0 - (double)nNormalFrac) / 10000.0);
nCount = (Sint32) (dTime * 0.07547); // does this calculation make sense?
// 75.47Hz vblank is according to wstech22.txt
//printf("%d ", nCount);
// nTime est en mili-secondes.
// détermine le nombre de trames à passer + 1
//nCount = (Sint32) ((((double)nTime)*600.0 - (double)nNormalFrac) / 10000.0);
nCount = (Sint32) (dTime * 0.07547); // does this calculation make sense?
// 75.47Hz vblank is according to wstech22.txt
//printf("%d ", nCount);
// si le nombre de trames à passer + 1 est nul ou négatif,
// ne rien faire pendant 2 ms
//AUpdateAudio();
if (nCount<=0)
{
SDL_Delay(2);
} // No need to do anything for a bit
else
{
//nNormalFrac+=nCount*10000; //
//nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
//nNormalFrac%=600; //
//dNormalLast = dTemp;
dNormalLast += nCount * (1/0.07547);
// si le nombre de trames à passer + 1 est nul ou négatif,
// ne rien faire pendant 2 ms
//AUpdateAudio();
if (nCount<=0)
{
SDL_Delay(2);
} // No need to do anything for a bit
else
{
//nNormalFrac+=nCount*10000; //
//nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
//nNormalFrac%=600; //
//dNormalLast = dTemp;
dNormalLast += nCount * (1/0.07547);
// Pas plus de 9 (10-1) trames non affichées
if (nCount>10)
nCount=10;
// Pas plus de 9 (10-1) trames non affichées
if (nCount>10)
{
nCount=10;
}
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/
int ws_key_esc=0;
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/
int ws_key_esc=0;
#include "source/temp/key.h"
if (ws_key_esc)
{
console.close();
if (ws_rom_path)
strcpy(old_rom_path,ws_rom_path);
//gui_open();
#include "source/temp/key.h"
if (ws_key_esc)
{
console.close();
if (ws_rom_path)
{
strcpy(old_rom_path,ws_rom_path);
}
//gui_open();
#ifndef GUI_OPEN_WARNED
//#warning XXX something ought to take place here...
#define GUI_OPEN_WARNED
#endif
app_terminate = 1;
app_terminate = 1;
if ((ws_rom_path!=NULL)||(app_terminate))
break;
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
ws_reset();
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
ws_set_colour_scheme(ws_colourScheme);
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
console.option("fullscreen output");
else
console.option("windowed output");
console.option("fixed window");
console.option("center window");
if ((ws_rom_path!=NULL)||(app_terminate))
{
break;
}
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
{
ws_reset();
}
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
{
ws_set_colour_scheme(ws_colourScheme);
}
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");

View File

@ -1,10 +1,11 @@
}
}
for (i=0;i<nCount-1;i++)
while (!ws_executeLine(backbuffer,0));
for (i=0; i<nCount-1; i++)
while (!ws_executeLine(backbuffer,0));
while (!ws_executeLine(backbuffer,1));
//totalFrames++;
while (!ws_executeLine(backbuffer,1));
//totalFrames++;

View File

@ -1,4 +1,4 @@
//endTime=clock();
//float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
console.close();
delete surface;
//endTime=clock();
//float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
console.close();
delete surface;

View File

@ -11,8 +11,10 @@
////////////////////////////////////////////////////////////////////////////////
void ws_buildHalfBrightnessTable(void)
{
for (int i=0;i<32;i++)
ws_halfBrightnessTable[i]=0.65*i;
for (int i=0; i<32; i++)
{
ws_halfBrightnessTable[i]=0.65*i;
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -27,60 +29,69 @@ void ws_buildHalfBrightnessTable(void)
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_halfBrightnessScanlines(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<224;line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<144;line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanline(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -16,26 +16,28 @@
#define NB_BUFFERS_DIV 3
void ws_mergeBackbuffers(int16 **buffers)
{
int16 *buffersAlias[NB_BUFFERS+1];
int16 *buffersAlias[NB_BUFFERS+1];
memcpy(buffersAlias,buffers,sizeof(int16*)*(NB_BUFFERS+1));
memcpy(buffersAlias,buffers,sizeof(int16*)*(NB_BUFFERS+1));
for (int i=0;i<224*144;i++)
{
int r,g,b;
r=g=b=0;
for (int j=0;j<NB_BUFFERS;j++)
{
r+=M_R(*buffersAlias[j]);
g+=M_G(*buffersAlias[j]);
b+=M_B(*buffersAlias[j]);
buffersAlias[j]++;
}
r>>=NB_BUFFERS_DIV;
g>>=NB_BUFFERS_DIV;
b>>=NB_BUFFERS_DIV;
*buffersAlias[NB_BUFFERS]++=(r<<10)|(g<<5)|b;
}
for (int i=0; i<224*144; i++)
{
int r,g,b;
r=g=b=0;
for (int j=0; j<NB_BUFFERS; j++)
{
r+=M_R(*buffersAlias[j]);
g+=M_G(*buffersAlias[j]);
b+=M_B(*buffersAlias[j]);
buffersAlias[j]++;
}
r>>=NB_BUFFERS_DIV;
g>>=NB_BUFFERS_DIV;
b>>=NB_BUFFERS_DIV;
*buffersAlias[NB_BUFFERS]++=(r<<10)|(g<<5)|b;
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -50,139 +52,180 @@ void ws_mergeBackbuffers(int16 **buffers)
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_standard_interpolate(void)
{
#define KEY_ENTER 0x0D
#define KEY_ESC 0x1b
#define KEY_UP 0x26
#define KEY_DOWN 0x28
#define KEY_LEFT 0x25
#define KEY_RIGHT 0x27
#define KEY_BUTTON1 0x57
#define KEY_BUTTON2 0x58
#define KEY_ENTER 0x0D
#define KEY_ESC 0x1b
#define KEY_UP 0x26
#define KEY_DOWN 0x28
#define KEY_LEFT 0x25
#define KEY_RIGHT 0x27
#define KEY_BUTTON1 0x57
#define KEY_BUTTON2 0x58
uint32 startTime, endTime, totalFrames;
unsigned int nNormalLast=0;
int nNormalFrac=0;
int nTime=0,nCount=0; int i=0;
uint32 startTime, endTime, totalFrames;
unsigned int nNormalLast=0;
int nNormalFrac=0;
int nTime=0,nCount=0;
int i=0;
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;
if (app_rotated)
surface=new Surface(144,224,format);
else
surface=new Surface(224,144,format);
// 15 bits RGB555
Format format(16,0x007c00,0x00003e0,0x0000001f);
Console console;
Surface *surface;
console.option("DirectX");
if (app_fullscreen)
console.option("fullscreen output");
else
console.option("windowed output");
console.option("fixed window");
console.option("center window");
if (app_rotated)
{
surface=new Surface(144,224,format);
}
else
{
surface=new Surface(224,144,format);
}
console.open("Oswan",224,144,format);
int16 *backbuffer[NB_BUFFERS+1];
for (int fr=0;fr<NB_BUFFERS+1;fr++)
{
backbuffer[fr]=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer[fr],0x00,224*144*sizeof(int16));
}
totalFrames=0;
startTime=clock();
nNormalLast=0;// Last value of timeGetTime()
nNormalFrac=0; // Extra fraction we did
nNormalLast=timeGetTime();
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}
while (1)
{
nTime=timeGetTime()-nNormalLast; // calcule le temps écoulé depuis le dernier affichage
// nTime est en mili-secondes.
// détermine le nombre de trames à passer + 1
nCount=(nTime*600 - nNormalFrac) /10000;
console.option("DirectX");
// si le nombre de trames à passer + 1 est nul ou négatif,
// ne rien faire pendant 2 ms
if (nCount<=0)
{
Sleep(2);
} // No need to do anything for a bit
else
{
nNormalFrac+=nCount*10000; //
nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
nNormalFrac%=600; //
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
// Pas plus de 9 (10-1) trames non affichées
if (nCount>10)
nCount=10;
console.option("fixed window");
console.option("center window");
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/ int ws_key_esc=0;
console.open("Oswan",224,144,format);
int16 *backbuffer[NB_BUFFERS+1];
#include "./source/temp/key.h"
if (ws_key_esc)
{
console.close();
strcpy(old_rom_path,ws_rom_path);
gui_open();
for (int fr=0; fr<NB_BUFFERS+1; fr++)
{
backbuffer[fr]=(int16*)malloc(224*144*sizeof(int16));
memset(backbuffer[fr],0x00,224*144*sizeof(int16));
}
if ((ws_rom_path!=NULL)||(app_terminate))
break;
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
ws_reset();
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
ws_set_colour_scheme(ws_colourScheme);
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
console.option("fullscreen output");
else
console.option("windowed output");
console.option("fixed window");
console.option("center window");
console.open("Oswan",224,144,format);
}
totalFrames=0;
startTime=clock();
nNormalLast=0;// Last value of timeGetTime()
nNormalFrac=0; // Extra fraction we did
nNormalLast=timeGetTime();
for (i=0;i<nCount-1;i++)
while (!ws_executeLine(backbuffer[0],0));
while (!ws_executeLine(backbuffer[totalFrames&(NB_BUFFERS-1)],1));
// filter change
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_loadState("oswan.wss");
}
ws_mergeBackbuffers(backbuffer);
if (app_rotated)
ws_rotate_backbuffer(backbuffer[NB_BUFFERS]);
totalFrames++;
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer[NB_BUFFERS],224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
endTime=clock();
float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
printf("%f fps (%i %% the original speed)\n",fps, (int)((fps*100)/60));
console.close();
delete surface;
while (1)
{
nTime=timeGetTime()-nNormalLast; // calcule le temps écoulé depuis le dernier affichage
// nTime est en mili-secondes.
// détermine le nombre de trames à passer + 1
nCount=(nTime*600 - nNormalFrac) /10000;
// si le nombre de trames à passer + 1 est nul ou négatif,
// ne rien faire pendant 2 ms
if (nCount<=0)
{
Sleep(2);
} // No need to do anything for a bit
else
{
nNormalFrac+=nCount*10000; //
nNormalLast+=nNormalFrac/600; // add the duration of nNormalFrac frames
nNormalFrac%=600; //
// Pas plus de 9 (10-1) trames non affichées
if (nCount>10)
{
nCount=10;
}
/*
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
*/ int ws_key_esc=0;
#include "./source/temp/key.h"
if (ws_key_esc)
{
console.close();
strcpy(old_rom_path,ws_rom_path);
gui_open();
if ((ws_rom_path!=NULL)||(app_terminate))
{
break;
}
if (gui_command)
{
if (gui_command==GUI_COMMAND_RESET)
{
ws_reset();
}
if (gui_command==GUI_COMMAND_SCHEME_CHANGE)
{
ws_set_colour_scheme(ws_colourScheme);
}
if (gui_command==GUI_COMMAND_FILTER_CHANGE)
{
ws_saveState("oswan.wss");
ws_rom_path=old_rom_path;
delete surface;
return;
}
}
console.option("DirectX");
if (app_fullscreen)
{
console.option("fullscreen output");
}
else
{
console.option("windowed output");
}
console.option("fixed window");
console.option("center window");
console.open("Oswan",224,144,format);
}
for (i=0; i<nCount-1; i++)
while (!ws_executeLine(backbuffer[0],0));
while (!ws_executeLine(backbuffer[totalFrames&(NB_BUFFERS-1)],1));
ws_mergeBackbuffers(backbuffer);
if (app_rotated)
{
ws_rotate_backbuffer(backbuffer[NB_BUFFERS]);
}
totalFrames++;
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer[NB_BUFFERS],224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
endTime=clock();
float fps=totalFrames/(((float)(endTime-startTime))/(float)CLOCKS_PER_SEC);
printf("%f fps (%i %% the original speed)\n",fps, (int)((fps*100)/60));
console.close();
delete surface;
}

View File

@ -11,58 +11,67 @@
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_scanlines(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<224;line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<144;line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledRotatedScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledScanline(vs,backbuffer_alias);
vs+=surfacePitch;
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -11,61 +11,72 @@
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_special(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<224;line++)
{
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
while (!ws_executeLine(backbuffer,1));
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0;line<144;line++)
{
ws_drawDoubledHalfBrightnessScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<224; line++)
{
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessRotatedScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=144;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
while (!ws_executeLine(backbuffer,1));
int16 *vs = (int16 *)surface->lock();
int16 *backbuffer_alias=backbuffer;
for (int line=0; line<144; line++)
{
ws_drawDoubledHalfBrightnessScanlineSpecialEven(vs,backbuffer_alias);
vs+=surfacePitch;
ws_drawDoubledHalfBrightnessScanlineSpecialOdd(vs,backbuffer_alias);
vs+=surfacePitch;
backbuffer_alias+=224;
}
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -11,12 +11,14 @@
////////////////////////////////////////////////////////////////////////////////
void ws_rotate_backbuffer(int16 *backbuffer)
{
static int16 temp[224*144];
memcpy(temp,backbuffer,224*144*2);
static int16 temp[224*144];
memcpy(temp,backbuffer,224*144*2);
for (int line=0;line<144;line++)
for (int column=0;column<224;column++)
backbuffer[line+((223-column)<<7)+((223-column)<<4)]=temp[column+(line<<7)+(line<<6)+(line<<5)];
for (int line=0; line<144; line++)
for (int column=0; column<224; column++)
{
backbuffer[line+((223-column)<<7)+((223-column)<<4)]=temp[column+(line<<7)+(line<<6)+(line<<5)];
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -31,45 +33,50 @@ void ws_rotate_backbuffer(int16 *backbuffer)
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_standard(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144,224,format);
#include "filter_partB.h"
surfacePitch>>=1;
console.open(app_window_title,144,224,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144,224,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224,144,format);
#include "filter_partB.h"
console.open(app_window_title,224,144,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224,144,format);
#include "filter_partD.h"
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144,224,format);
#include "filter_partB.h"
surfacePitch>>=1;
console.open(app_window_title,144,224,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144,224,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224,144,format);
#include "filter_partB.h"
console.open(app_window_title,224,144,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224,144,format);
#include "filter_partD.h"
int32 *vs = (int32 *)surface->lock();
memcpy(vs,backbuffer,224*144*2);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -11,44 +11,49 @@
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_Super2xSaI(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
Super2xSaI ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

View File

@ -11,44 +11,49 @@
////////////////////////////////////////////////////////////////////////////////
void ws_emulate_SuperEagle(void)
{
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
#include "filter_partA.h"
if (app_rotated)
{
surface=new Surface(144*2,224*2,format);
#include "filter_partB.h"
console.open(app_window_title,144*2,224*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,144*2,224*2,format);
#include "filter_partD.h"
ws_rotate_backbuffer(backbuffer);
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,144*2, NULL,(u8*)vs, surfacePitch<<1,144,224);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
else
{
surface=new Surface(224*2,144*2,format);
#include "filter_partB.h"
console.open(app_window_title,224*2,144*2,format);
while (1)
{
#include "filter_partC.h"
console.open(app_window_title,224*2,144*2,format);
#include "filter_partD.h"
int16 *vs = (int16 *)surface->lock();
SuperEagle ((u8*)backbuffer,224*2, NULL,(u8*)vs, surfacePitch<<1,224,144);
surface->unlock();
surface->copy(console);
console.update();
}
}
#include "filter_partE.h"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,92 +9,183 @@
//
//////////////////////////////////////////////////////////////////////////////
uint8 internalEeprom[]=
uint8_t DefaultBWEEprom[]=
{
0xff,0xff,0xff,0xff,0xff,0xff,192,0xff,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,127,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,252,0xff,1,0xff,253,0xff,253,0xff,253,0xff,253,
0xff,253,0xff,253,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,3,3,0x00,0x00,0x00,64,128,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135,5,140,9,5,12,139,12,144,0x00,0x00,2,
0x00,76,165,0x00,128,0x00,0x00,0x00,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,6,6,6,6,6,0x00,0x00,0x00,0x00,0x00,
1,128,15,0x00,1,1,1,15,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
'D'-54,'A'-54,'V'-54,'I'-54,'D'-54,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,32,1,1,33,1,4,0x00,1,
0x00,152,60,127,74,1,53,1,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
0xff,0xff,0xff,0xff,0xff,0xff,192,0xff,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,127,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,252,0xff,1,0xff,253,0xff,253,0xff,253,0xff,253,
0xff,253,0xff,253,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,3,3,0x00,0x00,0x00,64,128,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135,5,140,9,5,12,139,12,144,0x00,0x00,2,
0x00,76,165,0x00,128,0x00,0x00,0x00,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,6,6,6,6,6,0x00,0x00,0x00,0x00,0x00,
1,128,15,0x00,1,1,1,15,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
'W'-54,'O'-54,'N'-54,'D'-54,'E'-54,'R'-54,'S'-54,'W'-54,'A'-54,'N'-54,0x00,0x00,0x00,0x00,0x00,
0x00,32,1,1,33,1,4,0x00,1,
0x00,152,60,127,74,1,53,1,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
};
uint8_t DefaultColorEEprom[]=
{
0xff,0xff,0xff,0xff,0xff,0xff,192,0xff,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,127,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,252,0xff,1,0xff,253,0xff,253,0xff,253,0xff,253,
0xff,253,0xff,253,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,3,3,0x00,0x00,0x00,64,128,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
135,5,140,9,5,12,139,12,144,0x00,0x00,2,
0x00,76,165,0x00,128,0x00,0x00,0x00,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,0xff,127,
0xff,127,0xff,127,0xff,127,0xff,127,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x00,0x00,6,6,6,6,6,0x00,0x00,0x00,0x00,0x00,
1,128,15,0x00,1,1,1,15,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
'W'-54,'O'-54,'N'-54,'D'-54,'E'-54,'R'-54,'S'-54,'W'-54,'A'-54,'N'-54,0x00,0x00,0x00,0x00,0x00,
0x00,32,1,1,33,1,4,0x00,1,
0x00,152,60,127,74,1,53,1,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff
};

View File

@ -11,261 +11,261 @@
uint8 initialIoValue[256]=
{
0x00,//0
0x00,//1
0x9d,//2
0xbb,//3
0x00,//4
0x00,//5
0x00,//6
0x26,//7
0xfe,//8
0xde,//9
0xf9,//a
0xfb,//b
0xdb,//c
0xd7,//d
0x7f,//e
0xf5,//f
0x00,//10
0x00,//11
0x00,//12
0x00,//13
0x01,//14
0x00,//15
0x9e,//16
0x9b,//17
0x00,//18
0x00,//19
0x00,//1a
0x00,//1b
0x99,//1c
0xfd,//1d
0xb7,//1e
0xdf,//1f
0x30,//20
0x57,//21
0x75,//22
0x76,//23
0x15,//24
0x73,//25
0x77,//26
0x77,//27
0x20,//28
0x75,//29
0x50,//2a
0x36,//2b
0x70,//2c
0x67,//2d
0x50,//2e
0x77,//2f
0x57,//30
0x54,//31
0x75,//32
0x77,//33
0x75,//34
0x17,//35
0x37,//36
0x73,//37
0x50,//38
0x57,//39
0x60,//3a
0x77,//3b
0x70,//3c
0x77,//3d
0x10,//3e
0x73,//3f
0x00,//40
0x00,//41
0x00,//42
0x00,//43
0x00,//44
0x00,//45
0x00,//46
0x00,//47
0x00,//48
0x00,//49
0x00,//4a
0x00,//4b
0x00,//4c
0x00,//4d
0x00,//4e
0x00,//4f
0x00,//50
0x00,//51
0x00,//52
0x00,//53
0x00,//54
0x00,//55
0x00,//56
0x00,//57
0x00,//58
0x00,//59
0x00,//5a
0x00,//5b
0x00,//5c
0x00,//5d
0x00,//5e
0x00,//5f
0x0a,//60
0x00,//61
0x00,//62
0x00,//63
0x00,//64
0x00,//65
0x00,//66
0x00,//67
0x00,//68
0x00,//69
0x00,//6a
0x0f,//6b
0x00,//6c
0x00,//6d
0x00,//6e
0x00,//6f
0x00,//70
0x00,//71
0x00,//72
0x00,//73
0x00,//74
0x00,//75
0x00,//76
0x00,//77
0x00,//78
0x00,//79
0x00,//7a
0x00,//7b
0x00,//7c
0x00,//7d
0x00,//7e
0x00,//7f
0x00,//80
0x00,//81
0x00,//82
0x00,//83
0x00,//84
0x00,//85
0x00,//86
0x00,//87
0x00,//88
0x00,//89
0x00,//8a
0x00,//8b
0x00,//8c
0x1f,//8d 1d ?
0x00,//8e
0x00,//8f
0x00,//90
0x00,//91
0x00,//92
0x00,//93
0x00,//94
0x00,//95
0x00,//96
0x00,//97
0x00,//98
0x00,//99
0x00,//9a
0x00,//9b
0x00,//9c
0x00,//9d
0x03,//9e
0x00,//9f
0x87-2,//a0
0x00,//a1
0x00,//a2
0x00,//a3
0x0,//a4 2b
0x0,//a5 7f
0x4f,//a6
0xff,//a7 cf ?
0x00,//a8
0x00,//a9
0x00,//aa
0x00,//ab
0x00,//ac
0x00,//ad
0x00,//ae
0x00,//af
0x00,//b0
0xdb,//b1
0x00,//b2
0x00,//b3
0x00,//b4
0x40,//b5
0x00,//b6
0x00,//b7
0x00,//b8
0x00,//b9
0x01,//ba
0x00,//bb
0x42,//bc
0x00,//bd
0x83,//be
0x00,//bf
0x2f,//c0
0x3f,//c1
0xff,//c2
0xff,//c3
0x00,//c4
0x00,//c5
0x00,//c6
0x00,//c7
0x00,//0
0x00,//1
0x9d,//2
0xbb,//3
0x00,//4
0x00,//5
0x00,//6
0x26,//7
0xfe,//8
0xde,//9
0xf9,//a
0xfb,//b
0xdb,//c
0xd7,//d
0x7f,//e
0xf5,//f
0x00,//10
0x00,//11
0x00,//12
0x00,//13
0x01,//14
0x00,//15
0x9e,//16
0x9b,//17
0x00,//18
0x00,//19
0x00,//1a
0x00,//1b
0x99,//1c
0xfd,//1d
0xb7,//1e
0xdf,//1f
0x30,//20
0x57,//21
0x75,//22
0x76,//23
0x15,//24
0x73,//25
0x77,//26
0x77,//27
0x20,//28
0x75,//29
0x50,//2a
0x36,//2b
0x70,//2c
0x67,//2d
0x50,//2e
0x77,//2f
0x57,//30
0x54,//31
0x75,//32
0x77,//33
0x75,//34
0x17,//35
0x37,//36
0x73,//37
0x50,//38
0x57,//39
0x60,//3a
0x77,//3b
0x70,//3c
0x77,//3d
0x10,//3e
0x73,//3f
0x00,//40
0x00,//41
0x00,//42
0x00,//43
0x00,//44
0x00,//45
0x00,//46
0x00,//47
0x00,//48
0x00,//49
0x00,//4a
0x00,//4b
0x00,//4c
0x00,//4d
0x00,//4e
0x00,//4f
0x00,//50
0x00,//51
0x00,//52
0x00,//53
0x00,//54
0x00,//55
0x00,//56
0x00,//57
0x00,//58
0x00,//59
0x00,//5a
0x00,//5b
0x00,//5c
0x00,//5d
0x00,//5e
0x00,//5f
0x0a,//60
0x00,//61
0x00,//62
0x00,//63
0x00,//64
0x00,//65
0x00,//66
0x00,//67
0x00,//68
0x00,//69
0x00,//6a
0x0f,//6b
0x00,//6c
0x00,//6d
0x00,//6e
0x00,//6f
0x00,//70
0x00,//71
0x00,//72
0x00,//73
0x00,//74
0x00,//75
0x00,//76
0x00,//77
0x00,//78
0x00,//79
0x00,//7a
0x00,//7b
0x00,//7c
0x00,//7d
0x00,//7e
0x00,//7f
0x00,//80
0x00,//81
0x00,//82
0x00,//83
0x00,//84
0x00,//85
0x00,//86
0x00,//87
0x00,//88
0x00,//89
0x00,//8a
0x00,//8b
0x00,//8c
0x1f,//8d 1d ?
0x00,//8e
0x00,//8f
0x00,//90
0x00,//91
0x00,//92
0x00,//93
0x00,//94
0x00,//95
0x00,//96
0x00,//97
0x00,//98
0x00,//99
0x00,//9a
0x00,//9b
0x00,//9c
0x00,//9d
0x03,//9e
0x00,//9f
0x80,//a0
0x00,//a1
0x00,//a2
0x00,//a3
0x0,//a4 2b
0x0,//a5 7f
0x4f,//a6
0xff,//a7 cf ?
0x00,//a8
0x00,//a9
0x00,//aa
0x00,//ab
0x00,//ac
0x00,//ad
0x00,//ae
0x00,//af
0x00,//b0
0xdb,//b1
0x00,//b2
0x00,//b3
0x00,//b4
0x40,//b5
0x00,//b6
0x00,//b7
0x00,//b8
0x00,//b9
0x01,//ba
0x00,//bb
0x42,//bc
0x00,//bd
0x83,//be
0x00,//bf
0x2f,//c0
0x3f,//c1
0xff,//c2
0xff,//c3
0x00,//c4
0x00,//c5
0x00,//c6
0x00,//c7
0xd1,//c8?
0xd1,//c9
0xd1,//ca
0xd1,//cb
0xd1,//cc
0xd1,//cd
0xd1,//ce
0xd1,//cf
0xd1,//d0
0xd1,//d1
0xd1,//d2
0xd1,//d3
0xd1,//d4
0xd1,//d5
0xd1,//d6
0xd1,//d7
0xd1,//d8
0xd1,//d9
0xd1,//da
0xd1,//db
0xd1,//dc
0xd1,//dd
0xd1,//de
0xd1,//df
0xd1,//e0
0xd1,//e1
0xd1,//e2
0xd1,//e3
0xd1,//e4
0xd1,//e5
0xd1,//e6
0xd1,//e7
0xd1,//e8
0xd1,//e9
0xd1,//ea
0xd1,//eb
0xd1,//ec
0xd1,//ed
0xd1,//ee
0xd1,//ef
0xd1,//f0
0xd1,//f1
0xd1,//f2
0xd1,//f3
0xd1,//f4
0xd1,//f5
0xd1,//f6
0xd1,//f7
0xd1,//f8
0xd1,//f9
0xd1,//fa
0xd1,//fb
0xd1,//fc
0xd1,//fd
0xd1,//fe
0xd1 //ff
0xd1,//c8?
0xd1,//c9
0xd1,//ca
0xd1,//cb
0xd1,//cc
0xd1,//cd
0xd1,//ce
0xd1,//cf
0xd1,//d0
0xd1,//d1
0xd1,//d2
0xd1,//d3
0xd1,//d4
0xd1,//d5
0xd1,//d6
0xd1,//d7
0xd1,//d8
0xd1,//d9
0xd1,//da
0xd1,//db
0xd1,//dc
0xd1,//dd
0xd1,//de
0xd1,//df
0xd1,//e0
0xd1,//e1
0xd1,//e2
0xd1,//e3
0xd1,//e4
0xd1,//e5
0xd1,//e6
0xd1,//e7
0xd1,//e8
0xd1,//e9
0xd1,//ea
0xd1,//eb
0xd1,//ec
0xd1,//ed
0xd1,//ee
0xd1,//ef
0xd1,//f0
0xd1,//f1
0xd1,//f2
0xd1,//f3
0xd1,//f4
0xd1,//f5
0xd1,//f6
0xd1,//f7
0xd1,//f8
0xd1,//f9
0xd1,//fa
0xd1,//fb
0xd1,//fc
0xd1,//fd
0xd1,//fe
0xd1 //ff
};

File diff suppressed because it is too large Load Diff

View File

@ -27,11 +27,15 @@ FILE *log_stream=NULL;
//////////////////////////////////////////////////////////////////////////////
int log_init(char *path)
{
//log_stream=fopen(path,"wrt");
log_stream = stdout;
if (log_stream==NULL)
return(0);
return(1);
//log_stream=fopen(path,"wrt");
log_stream = stdout;
if (log_stream==NULL)
{
return(0);
}
return(1);
}
//////////////////////////////////////////////////////////////////////////////
//
@ -45,7 +49,7 @@ int log_init(char *path)
//////////////////////////////////////////////////////////////////////////////
FILE *log_get(void)
{
return(log_stream);
return(log_stream);
}
//////////////////////////////////////////////////////////////////////////////
//
@ -59,5 +63,5 @@ FILE *log_get(void)
//////////////////////////////////////////////////////////////////////////////
void log_done(void)
{
fclose(log_stream);
fclose(log_stream);
}

View File

@ -15,12 +15,19 @@
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include "log.h"
#include "rom.h"
#include "./nec/nec.h"
#include "io.h"
#include "gpu.h"
#include "audio.h"
#include "memory.h"
#include "ieeprom.h"
////////////////////////////////////////////////////////////////////////////////
//
@ -33,21 +40,31 @@
//
//
////////////////////////////////////////////////////////////////////////////////
#define IO_ROM_BANK_BASE_SELECTOR 0xC0
#define IO_ROM_BANK_BASE_SELECTOR 0xC0
uint8 *ws_rom;
uint8 *ws_staticRam;
uint8 *internalRam;
uint8 *externalEeprom;
uint8 *ws_rom;
uint8 *ws_staticRam;
uint8 *internalRam;
uint8 *externalEeprom;
char *internalBWIRom;
char *internalColorIRom;
char *internalBWEeprom;
char *internalColorEeprom;
char *internalEeprom;
extern uint8 *ws_ioRam;
uint16 ws_rom_checksum;
uint16 ws_rom_checksum;
uint32 sramAddressMask;
uint32 externalEepromAddressMask;
uint32 romAddressMask;
uint8 ws_haveColorIRom;
uint8 ws_haveBWIRom;
uint32 sramAddressMask;
uint32 externalEepromAddressMask;
uint32 romAddressMask;
uint32 romSize;
int ws_sram_dirty = 0;
@ -66,24 +83,26 @@ void dump_memory()
fp = fopen("sram.bin", "wb");
fwrite(ws_staticRam, 1, 0x10000, fp);
fclose(fp);
fp = fopen("rom.bin", "wb");
fwrite(ws_rom, 1, romSize, fp);
fclose(fp);
fp = fopen("memorydump.bin", "wb");
fwrite(internalRam, 1, 0x10000, fp);
/* page 1 */
fwrite(&(ws_staticRam[0 & sramAddressMask]), 1, 0x10000, fp);
fwrite(&(ws_rom[((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR+2]&((romSize>>16)-1))<<16)]), 1, 0x10000, fp);
fwrite(&(ws_rom[((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR+3]&((romSize>>16)-1))<<16)]), 1, 0x10000, fp);
for(i = 4; i < 0x10; i++)
{
int romBank=(256-(((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR]&0xf)<<4)|(i&0xf)));
fwrite(&(ws_rom[(unsigned)(romSize-(romBank<<16))]), 1, 0x10000, fp);
}
}
fclose(fp);
fp = fopen("registers.bin", "wb");
fwrite(ws_ioRam, 1, 256, fp);
fclose(fp);
@ -109,24 +128,25 @@ void dump_memory()
////////////////////////////////////////////////////////////////////////////////
void cpu_writemem20(DWORD addr,BYTE value)
{
uint32 offset=addr&0xffff;
uint32 bank=addr>>16;
uint32 offset=addr&0xffff;
uint32 bank=addr>>16;
// 0 - RAM - 16 KB (WS) / 64 KB (WSC) internal RAM
if (!bank)
{
ws_gpu_write_byte(offset,value);
ws_audio_write_byte(offset,value);
}
else
// 1 - SRAM (cart)
if (bank==1)
{
ws_staticRam[offset&sramAddressMask]=value;
ws_sram_dirty = 1;
}
// 0 - RAM - 16 KB (WS) / 64 KB (WSC) internal RAM
if (!bank)
{
ws_gpu_write_byte(offset,value);
ws_audio_write_byte(offset,value);
}
else
// other banks are read-only
// 1 - SRAM (cart)
if (bank==1)
{
ws_staticRam[offset&sramAddressMask]=value;
ws_sram_dirty = 1;
}
// other banks are read-only
}
////////////////////////////////////////////////////////////////////////////////
//
@ -141,28 +161,137 @@ void cpu_writemem20(DWORD addr,BYTE value)
////////////////////////////////////////////////////////////////////////////////
BYTE cpu_readmem20(DWORD addr)
{
uint32 offset=addr&0xffff;
uint32 bank=addr>>16;
switch (bank)
{
case 0: // 0 - RAM - 16 KB (WS) / 64 KB (WSC) internal RAM
if (ws_gpu_operatingInColor)
return(internalRam[offset]);
else
if (offset<0x4000)
return(internalRam[offset]);
return(0x90);
uint32 offset=addr&0xffff;
uint32 bank=addr>>16;
uint16 romBank;
uint8_t hwReg;
BYTE ret;
case 1: // 1 - SRAM (cart)
return ws_staticRam[offset&sramAddressMask];
case 2:
case 3: return ws_rom[offset+((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR+bank]&((romSize>>16)-1))<<16)];
default:
int romBank=(256-(((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR]&0xf)<<4)|(bank&0xf)));
return ws_rom[(unsigned)(offset+romSize-(romBank<<16))];
}
return(0xff);
switch (bank)
{
case 0: // 0 - RAM - 16 KB (WS) / 64 KB (WSC) internal RAM
if (ws_gpu_operatingInColor)
{
return(internalRam[offset]);
}
else if (offset<0x4000)
{
return(internalRam[offset]);
}
return(0x90);
case 1: // 1 - SRAM (cart)
return ws_staticRam[offset&sramAddressMask];
case 2:
case 3:
return ws_rom[offset+((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR+bank]&((romSize>>16)-1))<<16)];
case 0xF:
hwReg = ws_ioRam[0xA0];
if (!(hwReg & 1))
{
if (ws_gpu_operatingInColor && ws_haveColorIRom)
{
if (addr >= 0xFE000)
{
ret = internalColorIRom[addr & ~0xFE000];
return ret;
}
}
else if (!ws_gpu_operatingInColor && ws_haveBWIRom)
{
if (addr >= 0xFF000)
{
ret = internalBWIRom[addr & ~0xFF000];
return ret;
}
}
}
// fall through
default:
romBank = (256-(((ws_ioRam[IO_ROM_BANK_BASE_SELECTOR]&0xf)<<4)|(bank&0xf)));
return ws_rom[(unsigned)(offset+romSize-(romBank<<16))];
}
return(0xff);
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
char *load_file(char *filename)
{
int fd;
char *ret_ptr;
struct stat FileStat;
fd = open(filename, O_RDWR);
fstat(fd, &FileStat);
printf("Trying to load %s, size = %lu...\n",filename, FileStat.st_size);
ret_ptr = (char *)mmap(NULL, FileStat.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (ret_ptr == MAP_FAILED)
{
ret_ptr = NULL;
}
return ret_ptr;
}
////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////
char *create_file(char *filename, uint32_t size, uint8_t *data)
{
int fd;
char *ret_ptr;
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);
fchmod(fd, 0644);
close(fd);
sync();
fd = open(filename, O_RDWR);
write(fd, data, size);
close(fd);
sync();
fd = open(filename, O_RDWR);
ret_ptr = (char *)mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (ret_ptr == MAP_FAILED)
{
ret_ptr = NULL;
}
return ret_ptr;
}
////////////////////////////////////////////////////////////////////////////////
//
@ -177,18 +306,54 @@ BYTE cpu_readmem20(DWORD addr)
////////////////////////////////////////////////////////////////////////////////
void ws_memory_init(uint8 *rom, uint32 wsRomSize)
{
ws_romHeaderStruct *ws_romHeader;
ws_rom=rom;
romSize=wsRomSize;
ws_romHeader=ws_rom_getHeader(ws_rom,romSize);
ws_rom_checksum=ws_romHeader->checksum;
internalRam=(uint8*)malloc(0x10000);
ws_staticRam=(uint8*)malloc(0x10000);
externalEeprom=(uint8*)malloc(131072);//ws_rom_eepromSize(ws_rom,romSize));
sramAddressMask=ws_rom_sramSize(ws_rom,romSize)-1;
externalEepromAddressMask=ws_rom_eepromSize(ws_rom,romSize)-1;
romAddressMask=romSize-1;
ws_romHeaderStruct *ws_romHeader;
ws_rom=rom;
romSize=wsRomSize;
ws_romHeader=ws_rom_getHeader(ws_rom,romSize);
ws_rom_checksum=ws_romHeader->checksum;
internalRam=(uint8*)malloc(0x10000);
ws_staticRam=(uint8*)malloc(0x10000);
externalEeprom=(uint8*)malloc(131072);//ws_rom_eepromSize(ws_rom,romSize));
sramAddressMask=ws_rom_sramSize(ws_rom,romSize)-1;
externalEepromAddressMask=ws_rom_eepromSize(ws_rom,romSize)-1;
internalBWIRom = load_file("ws_irom.bin");
internalColorIRom = load_file("wsc_irom.bin");
internalBWEeprom = load_file("ws_ieeprom.bin");
if ( internalBWEeprom == NULL )
{
internalBWEeprom = create_file("ws_ieeprom.bin", BW_IEEPROM_SIZE, DefaultBWEEprom);
}
internalColorEeprom = load_file("wsc_ieeprom.bin");
if ( internalColorEeprom == NULL )
{
internalColorEeprom = create_file("wsc_ieeprom.bin", COLOR_IEEPROM_SIZE, DefaultColorEEprom);
}
internalEeprom = internalBWEeprom;
if (ws_gpu_operatingInColor)
{
internalEeprom = internalColorEeprom;
}
ws_haveBWIRom = false;
ws_haveColorIRom = false;
if (internalBWIRom != NULL)
{
printf("Color IROM Found!\n");
ws_haveBWIRom = true;
}
if (internalColorIRom != NULL)
{
printf("B&W IROM Found!\n");
ws_haveColorIRom = true;
}
romAddressMask=romSize-1;
}
////////////////////////////////////////////////////////////////////////////////
//
@ -203,8 +368,8 @@ void ws_memory_init(uint8 *rom, uint32 wsRomSize)
////////////////////////////////////////////////////////////////////////////////
void ws_memory_reset(void)
{
memset(internalRam,0,0x10000);
//memset(ws_staticRam,0,0x10000); // should the sram really be cleared? ...
memset(internalRam,0,0x10000);
//memset(ws_staticRam,0,0x10000); // should the sram really be cleared? ...
}
////////////////////////////////////////////////////////////////////////////////
//
@ -219,10 +384,10 @@ void ws_memory_reset(void)
////////////////////////////////////////////////////////////////////////////////
void ws_memory_done(void)
{
free(ws_rom);
free(ws_staticRam);
free(internalRam);
free(externalEeprom);
free(ws_rom);
free(ws_staticRam);
free(internalRam);
free(externalEeprom);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -235,9 +400,9 @@ void ws_memory_done(void)
//
//
////////////////////////////////////////////////////////////////////////////////
uint8 *memory_getRom(void)
uint8 *memory_getRom(void)
{
return(ws_rom);
return(ws_rom);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -250,9 +415,9 @@ uint8 *memory_getRom(void)
//
//
////////////////////////////////////////////////////////////////////////////////
uint32 memory_getRomSize(void)
uint32 memory_getRomSize(void)
{
return(romSize);
return(romSize);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -265,44 +430,46 @@ uint32 memory_getRomSize(void)
//
//
////////////////////////////////////////////////////////////////////////////////
uint16 memory_getRomCrc(void)
uint16 memory_getRomCrc(void)
{
return(ws_rom_checksum);
return(ws_rom_checksum);
}
void ws_sram_load(char *path)
{
FILE *f;
//size_t read;
FILE *f;
//size_t read;
f = fopen(path, "r");
if (NULL == f)
{
memset(ws_staticRam, 0, 0x10000);
return;
}
f = fopen(path, "r");
/*read = */fread(ws_staticRam, 1, 0x8000, f);
//fprintf(log_get(), "read 0x%x (of 0x%x?) bytes of save ram from %s\n", read, ws_rom_sramSize(ws_rom, romSize), path);
fclose(f);
if (NULL == f)
{
memset(ws_staticRam, 0, 0x10000);
return;
}
/*read = */fread(ws_staticRam, 1, 0x8000, f);
//fprintf(log_get(), "read 0x%x (of 0x%x?) bytes of save ram from %s\n", read, ws_rom_sramSize(ws_rom, romSize), path);
fclose(f);
}
void ws_sram_save(char *path)
{
FILE *f;
//size_t wrote;
FILE *f;
//size_t wrote;
f = fopen(path, "wb");
if (NULL == f)
{
fprintf(log_get(), "error opening %s for writing save ram. (%s)\n", path, strerror(errno));
return;
}
f = fopen(path, "wb");
/*wrote = */fwrite(ws_staticRam, 1, 0x8000, f);
fflush(f);
//fprintf(log_get(), "wrote 0x%x bytes of save ram to %s\n", wrote, path);
fclose(f);
if (NULL == f)
{
fprintf(log_get(), "error opening %s for writing save ram. (%s)\n", path, strerror(errno));
return;
}
/*wrote = */fwrite(ws_staticRam, 1, 0x8000, f);
fflush(f);
//fprintf(log_get(), "wrote 0x%x bytes of save ram to %s\n", wrote, path);
fclose(f);
}

View File

@ -30,5 +30,8 @@ void ws_sram_save(char *path);
void dump_memory();
#define BW_IEEPROM_SIZE (1024)
#define COLOR_IEEPROM_SIZE (1024)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
BYTE cpu_readport(BYTE);
void cpu_writeport(DWORD,BYTE);
#define cpu_readop cpu_readmem20
#define cpu_readop_arg cpu_readmem20
#define cpu_readop cpu_readmem20
#define cpu_readop_arg cpu_readmem20
void cpu_writemem20(DWORD,BYTE);
BYTE cpu_readmem20(DWORD);
BYTE cpu_readmem20(DWORD);
typedef enum { ES, CS, SS, DS } SREGS;
typedef enum { AW, CW, DW, BW, SP, BP, IX, IY } WREGS;
@ -11,25 +11,26 @@ typedef enum { AL,AH,CL,CH,DL,DH,BL,BH,SPL,SPH,BPL,BPH,IXL,IXH,IYL,IYH } BREGS;
#pragma pack(1)
typedef union
{ /* eight general registers */
UINT16 w[8]; /* viewed as 16 bits registers */
UINT8 b[16]; /* or as 8 bit registers */
{
/* eight general registers */
UINT16 w[8]; /* viewed as 16 bits registers */
UINT8 b[16]; /* or as 8 bit registers */
} necbasicregs;
typedef struct
{
necbasicregs regs;
UINT16 sregs[4];
necbasicregs regs;
UINT16 sregs[4];
UINT16 ip;
UINT16 ip;
INT32 SignVal;
INT32 AuxVal, OverVal, ZeroVal, CarryVal, ParityVal; /* 0 or non-0 valued flags */
UINT8 TF, IF, DF, MF; /* 0 or 1 valued flags */ /* OB[19.07.99] added Mode Flag V30 */
UINT32 int_vector;
UINT32 pending_irq;
UINT32 nmi_state;
UINT32 irq_state;
int (*irq_callback)(int irqline);
INT32 SignVal;
INT32 AuxVal, OverVal, ZeroVal, CarryVal, ParityVal; /* 0 or non-0 valued flags */
UINT8 TF, IF, DF, MF; /* 0 or 1 valued flags */ /* OB[19.07.99] added Mode Flag V30 */
UINT32 int_vector;
UINT32 pending_irq;
UINT32 nmi_state;
UINT32 irq_state;
int (*irq_callback)(int irqline);
} nec_Regs;
#pragma pack()

View File

@ -3,58 +3,196 @@ static UINT32 EA;
static UINT16 EO;
static UINT16 E16;
static unsigned EA_000(void) { EO=I.regs.w[BW]+I.regs.w[IX]; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_001(void) { EO=I.regs.w[BW]+I.regs.w[IY]; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_002(void) { EO=I.regs.w[BP]+I.regs.w[IX]; EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_003(void) { EO=I.regs.w[BP]+I.regs.w[IY]; EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_004(void) { EO=I.regs.w[IX]; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_005(void) { EO=I.regs.w[IY]; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_006(void) { EO=FETCH; EO+=FETCH<<8; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_007(void) { EO=I.regs.w[BW]; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_000(void)
{
EO=I.regs.w[BW]+I.regs.w[IX];
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_001(void)
{
EO=I.regs.w[BW]+I.regs.w[IY];
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_002(void)
{
EO=I.regs.w[BP]+I.regs.w[IX];
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_003(void)
{
EO=I.regs.w[BP]+I.regs.w[IY];
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_004(void)
{
EO=I.regs.w[IX];
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_005(void)
{
EO=I.regs.w[IY];
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_006(void)
{
EO=FETCH;
EO+=FETCH<<8;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_007(void)
{
EO=I.regs.w[BW];
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_100(void) { EO=(I.regs.w[BW]+I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_101(void) { EO=(I.regs.w[BW]+I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_102(void) { EO=(I.regs.w[BP]+I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_103(void) { EO=(I.regs.w[BP]+I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_104(void) { EO=(I.regs.w[IX]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_105(void) { EO=(I.regs.w[IY]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_106(void) { EO=(I.regs.w[BP]+(INT8)FETCH); EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_107(void) { EO=(I.regs.w[BW]+(INT8)FETCH); EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_100(void)
{
EO=(I.regs.w[BW]+I.regs.w[IX]+(INT8)FETCH);
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_101(void)
{
EO=(I.regs.w[BW]+I.regs.w[IY]+(INT8)FETCH);
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_102(void)
{
EO=(I.regs.w[BP]+I.regs.w[IX]+(INT8)FETCH);
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_103(void)
{
EO=(I.regs.w[BP]+I.regs.w[IY]+(INT8)FETCH);
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_104(void)
{
EO=(I.regs.w[IX]+(INT8)FETCH);
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_105(void)
{
EO=(I.regs.w[IY]+(INT8)FETCH);
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_106(void)
{
EO=(I.regs.w[BP]+(INT8)FETCH);
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_107(void)
{
EO=(I.regs.w[BW]+(INT8)FETCH);
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_200(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_201(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_202(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+I.regs.w[IX]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_203(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+I.regs.w[IY]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_204(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IX]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_205(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[IY]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_206(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BP]+(INT16)E16; EA=DefaultBase(SS)+EO; return EA; }
static unsigned EA_207(void) { E16=FETCH; E16+=FETCH<<8; EO=I.regs.w[BW]+(INT16)E16; EA=DefaultBase(DS)+EO; return EA; }
static unsigned EA_200(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BW]+I.regs.w[IX]+(INT16)E16;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_201(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BW]+I.regs.w[IY]+(INT16)E16;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_202(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BP]+I.regs.w[IX]+(INT16)E16;
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_203(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BP]+I.regs.w[IY]+(INT16)E16;
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_204(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[IX]+(INT16)E16;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_205(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[IY]+(INT16)E16;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned EA_206(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BP]+(INT16)E16;
EA=DefaultBase(SS)+EO;
return EA;
}
static unsigned EA_207(void)
{
E16=FETCH;
E16+=FETCH<<8;
EO=I.regs.w[BW]+(INT16)E16;
EA=DefaultBase(DS)+EO;
return EA;
}
static unsigned (*GetEA[192])(void)={
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
static unsigned (*GetEA[192])(void)=
{
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207
};

View File

@ -248,260 +248,260 @@ static void i_wait(void);
void (*nec_instruction[256])(void) =
{
i_add_br8, /* 0x00 */
i_add_wr16, /* 0x01 */
i_add_r8b, /* 0x02 */
i_add_r16w, /* 0x03 */
i_add_ald8, /* 0x04 */
i_add_axd16, /* 0x05 */
i_push_es, /* 0x06 */
i_pop_es, /* 0x07 */
i_or_br8, /* 0x08 */
i_or_wr16, /* 0x09 */
i_or_r8b, /* 0x0a */
i_or_r16w, /* 0x0b */
i_or_ald8, /* 0x0c */
i_or_axd16, /* 0x0d */
i_push_cs, /* 0x0e */
i_pre_nec /* 0x0f */,
i_adc_br8, /* 0x10 */
i_adc_wr16, /* 0x11 */
i_adc_r8b, /* 0x12 */
i_adc_r16w, /* 0x13 */
i_adc_ald8, /* 0x14 */
i_adc_axd16, /* 0x15 */
i_push_ss, /* 0x16 */
i_pop_ss, /* 0x17 */
i_sbb_br8, /* 0x18 */
i_sbb_wr16, /* 0x19 */
i_sbb_r8b, /* 0x1a */
i_sbb_r16w, /* 0x1b */
i_sbb_ald8, /* 0x1c */
i_sbb_axd16, /* 0x1d */
i_push_ds, /* 0x1e */
i_pop_ds, /* 0x1f */
i_and_br8, /* 0x20 */
i_and_wr16, /* 0x21 */
i_and_r8b, /* 0x22 */
i_and_r16w, /* 0x23 */
i_and_ald8, /* 0x24 */
i_and_axd16, /* 0x25 */
i_es, /* 0x26 */
i_daa, /* 0x27 */
i_sub_br8, /* 0x28 */
i_sub_wr16, /* 0x29 */
i_sub_r8b, /* 0x2a */
i_sub_r16w, /* 0x2b */
i_sub_ald8, /* 0x2c */
i_sub_axd16, /* 0x2d */
i_cs, /* 0x2e */
i_das, /* 0x2f */
i_xor_br8, /* 0x30 */
i_xor_wr16, /* 0x31 */
i_xor_r8b, /* 0x32 */
i_xor_r16w, /* 0x33 */
i_xor_ald8, /* 0x34 */
i_xor_axd16, /* 0x35 */
i_ss, /* 0x36 */
i_aaa, /* 0x37 */
i_cmp_br8, /* 0x38 */
i_cmp_wr16, /* 0x39 */
i_cmp_r8b, /* 0x3a */
i_cmp_r16w, /* 0x3b */
i_cmp_ald8, /* 0x3c */
i_cmp_axd16, /* 0x3d */
i_ds, /* 0x3e */
i_aas, /* 0x3f */
i_inc_ax, /* 0x40 */
i_inc_cx, /* 0x41 */
i_inc_dx, /* 0x42 */
i_inc_bx, /* 0x43 */
i_inc_sp, /* 0x44 */
i_inc_bp, /* 0x45 */
i_inc_si, /* 0x46 */
i_inc_di, /* 0x47 */
i_dec_ax, /* 0x48 */
i_dec_cx, /* 0x49 */
i_dec_dx, /* 0x4a */
i_dec_bx, /* 0x4b */
i_dec_sp, /* 0x4c */
i_dec_bp, /* 0x4d */
i_dec_si, /* 0x4e */
i_dec_di, /* 0x4f */
i_push_ax, /* 0x50 */
i_push_cx, /* 0x51 */
i_push_dx, /* 0x52 */
i_push_bx, /* 0x53 */
i_push_sp, /* 0x54 */
i_push_bp, /* 0x55 */
i_push_si, /* 0x56 */
i_push_di, /* 0x57 */
i_pop_ax, /* 0x58 */
i_pop_cx, /* 0x59 */
i_pop_dx, /* 0x5a */
i_pop_bx, /* 0x5b */
i_pop_sp, /* 0x5c */
i_pop_bp, /* 0x5d */
i_pop_si, /* 0x5e */
i_pop_di, /* 0x5f */
i_pusha, /* 0x60 */
i_popa, /* 0x61 */
i_chkind, /* 0x62 */
i_invalid, /* 0x63 */
i_repnc, /* 0x64 */
i_repc, /* 0x65 */
i_invalid, /* 0x66 */
i_invalid, /* 0x67 */
i_push_d16, /* 0x68 */
i_imul_d16, /* 0x69 */
i_push_d8, /* 0x6a */
i_imul_d8, /* 0x6b */
i_insb, /* 0x6c */
i_insw, /* 0x6d */
i_outsb, /* 0x6e */
i_outsw, /* 0x6f */
i_jo, /* 0x70 */
i_jno, /* 0x71 */
i_jc, /* 0x72 */
i_jnc, /* 0x73 */
i_jz, /* 0x74 */
i_jnz, /* 0x75 */
i_jce, /* 0x76 */
i_jnce, /* 0x77 */
i_js, /* 0x78 */
i_jns, /* 0x79 */
i_jp, /* 0x7a */
i_jnp, /* 0x7b */
i_jl, /* 0x7c */
i_jnl, /* 0x7d */
i_jle, /* 0x7e */
i_jnle, /* 0x7f */
i_80pre, /* 0x80 */
i_81pre, /* 0x81 */
i_82pre, /* 0x82 */
i_83pre, /* 0x83 */
i_test_br8, /* 0x84 */
i_test_wr16, /* 0x85 */
i_xchg_br8, /* 0x86 */
i_xchg_wr16, /* 0x87 */
i_mov_br8, /* 0x88 */
i_mov_wr16, /* 0x89 */
i_mov_r8b, /* 0x8a */
i_mov_r16w, /* 0x8b */
i_mov_wsreg, /* 0x8c */
i_lea, /* 0x8d */
i_mov_sregw, /* 0x8e */
i_popw, /* 0x8f */
i_nop, /* 0x90 */
i_xchg_axcx, /* 0x91 */
i_xchg_axdx, /* 0x92 */
i_xchg_axbx, /* 0x93 */
i_xchg_axsp, /* 0x94 */
i_xchg_axbp, /* 0x95 */
i_xchg_axsi, /* 0x97 */
i_xchg_axdi, /* 0x97 */
i_cbw, /* 0x98 */
i_cwd, /* 0x99 */
i_call_far, /* 0x9a */
i_wait, /* 0x9b */
i_pushf, /* 0x9c */
i_popf, /* 0x9d */
i_sahf, /* 0x9e */
i_lahf, /* 0x9f */
i_mov_aldisp, /* 0xa0 */
i_mov_axdisp, /* 0xa1 */
i_mov_dispal, /* 0xa2 */
i_mov_dispax, /* 0xa3 */
i_movsb, /* 0xa4 */
i_movsw, /* 0xa5 */
i_cmpsb, /* 0xa6 */
i_cmpsw, /* 0xa7 */
i_test_ald8, /* 0xa8 */
i_test_axd16, /* 0xa9 */
i_stosb, /* 0xaa */
i_stosw, /* 0xab */
i_lodsb, /* 0xac */
i_lodsw, /* 0xad */
i_scasb, /* 0xae */
i_scasw, /* 0xaf */
i_mov_ald8, /* 0xb0 */
i_mov_cld8, /* 0xb1 */
i_mov_dld8, /* 0xb2 */
i_mov_bld8, /* 0xb3 */
i_mov_ahd8, /* 0xb4 */
i_mov_chd8, /* 0xb5 */
i_mov_dhd8, /* 0xb6 */
i_mov_bhd8, /* 0xb7 */
i_mov_axd16, /* 0xb8 */
i_mov_cxd16, /* 0xb9 */
i_mov_dxd16, /* 0xba */
i_mov_bxd16, /* 0xbb */
i_mov_spd16, /* 0xbc */
i_mov_bpd16, /* 0xbd */
i_mov_sid16, /* 0xbe */
i_mov_did16, /* 0xbf */
i_rotshft_bd8, /* 0xc0 */
i_rotshft_wd8, /* 0xc1 */
i_ret_d16, /* 0xc2 */
i_ret, /* 0xc3 */
i_les_dw, /* 0xc4 */
i_lds_dw, /* 0xc5 */
i_mov_bd8, /* 0xc6 */
i_mov_wd16, /* 0xc7 */
i_enter, /* 0xc8 */
i_leave, /* 0xc9 */
i_retf_d16, /* 0xca */
i_retf, /* 0xcb */
i_int3, /* 0xcc */
i_int, /* 0xcd */
i_into, /* 0xce */
i_iret, /* 0xcf */
i_rotshft_b, /* 0xd0 */
i_rotshft_w, /* 0xd1 */
i_rotshft_bcl, /* 0xd2 */
i_rotshft_wcl, /* 0xd3 */
i_aam, /* 0xd4 */
i_aad, /* 0xd5 */
i_setalc,
i_trans, /* 0xd7 */
i_fpo, /* 0xd8 */
i_fpo, /* 0xd9 */
i_fpo, /* 0xda */
i_fpo, /* 0xdb */
i_fpo, /* 0xdc */
i_fpo, /* 0xdd */
i_fpo, /* 0xde */
i_fpo, /* 0xdf */
i_loopne, /* 0xe0 */
i_loope, /* 0xe1 */
i_loop, /* 0xe2 */
i_jcxz, /* 0xe3 */
i_inal, /* 0xe4 */
i_inax, /* 0xe5 */
i_outal, /* 0xe6 */
i_outax, /* 0xe7 */
i_call_d16, /* 0xe8 */
i_jmp_d16, /* 0xe9 */
i_jmp_far, /* 0xea */
i_jmp_d8, /* 0xeb */
i_inaldx, /* 0xec */
i_inaxdx, /* 0xed */
i_outdxal, /* 0xee */
i_outdxax, /* 0xef */
i_lock, /* 0xf0 */
i_invalid, /* 0xf1 */
i_repne, /* 0xf2 */
i_repe, /* 0xf3 */
i_hlt, /* 0xf4 */
i_cmc, /* 0xf5 */
i_f6pre, /* 0xf6 */
i_f7pre, /* 0xf7 */
i_clc, /* 0xf8 */
i_stc, /* 0xf9 */
i_di, /* 0xfa */
i_ei, /* 0xfb */
i_cld, /* 0xfc */
i_std, /* 0xfd */
i_fepre, /* 0xfe */
i_ffpre /* 0xff */
i_add_br8, /* 0x00 */
i_add_wr16, /* 0x01 */
i_add_r8b, /* 0x02 */
i_add_r16w, /* 0x03 */
i_add_ald8, /* 0x04 */
i_add_axd16, /* 0x05 */
i_push_es, /* 0x06 */
i_pop_es, /* 0x07 */
i_or_br8, /* 0x08 */
i_or_wr16, /* 0x09 */
i_or_r8b, /* 0x0a */
i_or_r16w, /* 0x0b */
i_or_ald8, /* 0x0c */
i_or_axd16, /* 0x0d */
i_push_cs, /* 0x0e */
i_pre_nec /* 0x0f */,
i_adc_br8, /* 0x10 */
i_adc_wr16, /* 0x11 */
i_adc_r8b, /* 0x12 */
i_adc_r16w, /* 0x13 */
i_adc_ald8, /* 0x14 */
i_adc_axd16, /* 0x15 */
i_push_ss, /* 0x16 */
i_pop_ss, /* 0x17 */
i_sbb_br8, /* 0x18 */
i_sbb_wr16, /* 0x19 */
i_sbb_r8b, /* 0x1a */
i_sbb_r16w, /* 0x1b */
i_sbb_ald8, /* 0x1c */
i_sbb_axd16, /* 0x1d */
i_push_ds, /* 0x1e */
i_pop_ds, /* 0x1f */
i_and_br8, /* 0x20 */
i_and_wr16, /* 0x21 */
i_and_r8b, /* 0x22 */
i_and_r16w, /* 0x23 */
i_and_ald8, /* 0x24 */
i_and_axd16, /* 0x25 */
i_es, /* 0x26 */
i_daa, /* 0x27 */
i_sub_br8, /* 0x28 */
i_sub_wr16, /* 0x29 */
i_sub_r8b, /* 0x2a */
i_sub_r16w, /* 0x2b */
i_sub_ald8, /* 0x2c */
i_sub_axd16, /* 0x2d */
i_cs, /* 0x2e */
i_das, /* 0x2f */
i_xor_br8, /* 0x30 */
i_xor_wr16, /* 0x31 */
i_xor_r8b, /* 0x32 */
i_xor_r16w, /* 0x33 */
i_xor_ald8, /* 0x34 */
i_xor_axd16, /* 0x35 */
i_ss, /* 0x36 */
i_aaa, /* 0x37 */
i_cmp_br8, /* 0x38 */
i_cmp_wr16, /* 0x39 */
i_cmp_r8b, /* 0x3a */
i_cmp_r16w, /* 0x3b */
i_cmp_ald8, /* 0x3c */
i_cmp_axd16, /* 0x3d */
i_ds, /* 0x3e */
i_aas, /* 0x3f */
i_inc_ax, /* 0x40 */
i_inc_cx, /* 0x41 */
i_inc_dx, /* 0x42 */
i_inc_bx, /* 0x43 */
i_inc_sp, /* 0x44 */
i_inc_bp, /* 0x45 */
i_inc_si, /* 0x46 */
i_inc_di, /* 0x47 */
i_dec_ax, /* 0x48 */
i_dec_cx, /* 0x49 */
i_dec_dx, /* 0x4a */
i_dec_bx, /* 0x4b */
i_dec_sp, /* 0x4c */
i_dec_bp, /* 0x4d */
i_dec_si, /* 0x4e */
i_dec_di, /* 0x4f */
i_push_ax, /* 0x50 */
i_push_cx, /* 0x51 */
i_push_dx, /* 0x52 */
i_push_bx, /* 0x53 */
i_push_sp, /* 0x54 */
i_push_bp, /* 0x55 */
i_push_si, /* 0x56 */
i_push_di, /* 0x57 */
i_pop_ax, /* 0x58 */
i_pop_cx, /* 0x59 */
i_pop_dx, /* 0x5a */
i_pop_bx, /* 0x5b */
i_pop_sp, /* 0x5c */
i_pop_bp, /* 0x5d */
i_pop_si, /* 0x5e */
i_pop_di, /* 0x5f */
i_pusha, /* 0x60 */
i_popa, /* 0x61 */
i_chkind, /* 0x62 */
i_invalid, /* 0x63 */
i_repnc, /* 0x64 */
i_repc, /* 0x65 */
i_invalid, /* 0x66 */
i_invalid, /* 0x67 */
i_push_d16, /* 0x68 */
i_imul_d16, /* 0x69 */
i_push_d8, /* 0x6a */
i_imul_d8, /* 0x6b */
i_insb, /* 0x6c */
i_insw, /* 0x6d */
i_outsb, /* 0x6e */
i_outsw, /* 0x6f */
i_jo, /* 0x70 */
i_jno, /* 0x71 */
i_jc, /* 0x72 */
i_jnc, /* 0x73 */
i_jz, /* 0x74 */
i_jnz, /* 0x75 */
i_jce, /* 0x76 */
i_jnce, /* 0x77 */
i_js, /* 0x78 */
i_jns, /* 0x79 */
i_jp, /* 0x7a */
i_jnp, /* 0x7b */
i_jl, /* 0x7c */
i_jnl, /* 0x7d */
i_jle, /* 0x7e */
i_jnle, /* 0x7f */
i_80pre, /* 0x80 */
i_81pre, /* 0x81 */
i_82pre, /* 0x82 */
i_83pre, /* 0x83 */
i_test_br8, /* 0x84 */
i_test_wr16, /* 0x85 */
i_xchg_br8, /* 0x86 */
i_xchg_wr16, /* 0x87 */
i_mov_br8, /* 0x88 */
i_mov_wr16, /* 0x89 */
i_mov_r8b, /* 0x8a */
i_mov_r16w, /* 0x8b */
i_mov_wsreg, /* 0x8c */
i_lea, /* 0x8d */
i_mov_sregw, /* 0x8e */
i_popw, /* 0x8f */
i_nop, /* 0x90 */
i_xchg_axcx, /* 0x91 */
i_xchg_axdx, /* 0x92 */
i_xchg_axbx, /* 0x93 */
i_xchg_axsp, /* 0x94 */
i_xchg_axbp, /* 0x95 */
i_xchg_axsi, /* 0x97 */
i_xchg_axdi, /* 0x97 */
i_cbw, /* 0x98 */
i_cwd, /* 0x99 */
i_call_far, /* 0x9a */
i_wait, /* 0x9b */
i_pushf, /* 0x9c */
i_popf, /* 0x9d */
i_sahf, /* 0x9e */
i_lahf, /* 0x9f */
i_mov_aldisp, /* 0xa0 */
i_mov_axdisp, /* 0xa1 */
i_mov_dispal, /* 0xa2 */
i_mov_dispax, /* 0xa3 */
i_movsb, /* 0xa4 */
i_movsw, /* 0xa5 */
i_cmpsb, /* 0xa6 */
i_cmpsw, /* 0xa7 */
i_test_ald8, /* 0xa8 */
i_test_axd16, /* 0xa9 */
i_stosb, /* 0xaa */
i_stosw, /* 0xab */
i_lodsb, /* 0xac */
i_lodsw, /* 0xad */
i_scasb, /* 0xae */
i_scasw, /* 0xaf */
i_mov_ald8, /* 0xb0 */
i_mov_cld8, /* 0xb1 */
i_mov_dld8, /* 0xb2 */
i_mov_bld8, /* 0xb3 */
i_mov_ahd8, /* 0xb4 */
i_mov_chd8, /* 0xb5 */
i_mov_dhd8, /* 0xb6 */
i_mov_bhd8, /* 0xb7 */
i_mov_axd16, /* 0xb8 */
i_mov_cxd16, /* 0xb9 */
i_mov_dxd16, /* 0xba */
i_mov_bxd16, /* 0xbb */
i_mov_spd16, /* 0xbc */
i_mov_bpd16, /* 0xbd */
i_mov_sid16, /* 0xbe */
i_mov_did16, /* 0xbf */
i_rotshft_bd8, /* 0xc0 */
i_rotshft_wd8, /* 0xc1 */
i_ret_d16, /* 0xc2 */
i_ret, /* 0xc3 */
i_les_dw, /* 0xc4 */
i_lds_dw, /* 0xc5 */
i_mov_bd8, /* 0xc6 */
i_mov_wd16, /* 0xc7 */
i_enter, /* 0xc8 */
i_leave, /* 0xc9 */
i_retf_d16, /* 0xca */
i_retf, /* 0xcb */
i_int3, /* 0xcc */
i_int, /* 0xcd */
i_into, /* 0xce */
i_iret, /* 0xcf */
i_rotshft_b, /* 0xd0 */
i_rotshft_w, /* 0xd1 */
i_rotshft_bcl, /* 0xd2 */
i_rotshft_wcl, /* 0xd3 */
i_aam, /* 0xd4 */
i_aad, /* 0xd5 */
i_setalc,
i_trans, /* 0xd7 */
i_fpo, /* 0xd8 */
i_fpo, /* 0xd9 */
i_fpo, /* 0xda */
i_fpo, /* 0xdb */
i_fpo, /* 0xdc */
i_fpo, /* 0xdd */
i_fpo, /* 0xde */
i_fpo, /* 0xdf */
i_loopne, /* 0xe0 */
i_loope, /* 0xe1 */
i_loop, /* 0xe2 */
i_jcxz, /* 0xe3 */
i_inal, /* 0xe4 */
i_inax, /* 0xe5 */
i_outal, /* 0xe6 */
i_outax, /* 0xe7 */
i_call_d16, /* 0xe8 */
i_jmp_d16, /* 0xe9 */
i_jmp_far, /* 0xea */
i_jmp_d8, /* 0xeb */
i_inaldx, /* 0xec */
i_inaxdx, /* 0xed */
i_outdxal, /* 0xee */
i_outdxax, /* 0xef */
i_lock, /* 0xf0 */
i_invalid, /* 0xf1 */
i_repne, /* 0xf2 */
i_repe, /* 0xf3 */
i_hlt, /* 0xf4 */
i_cmc, /* 0xf5 */
i_f6pre, /* 0xf6 */
i_f7pre, /* 0xf7 */
i_clc, /* 0xf8 */
i_stc, /* 0xf9 */
i_di, /* 0xfa */
i_ei, /* 0xfb */
i_cld, /* 0xfc */
i_std, /* 0xfd */
i_fepre, /* 0xfe */
i_ffpre /* 0xff */
};

View File

@ -4,10 +4,12 @@
enum {
NEC_IP=1, NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
NEC_FLAGS, NEC_ES, NEC_CS, NEC_SS, NEC_DS,
NEC_VECTOR, NEC_PENDING, NEC_NMI_STATE, NEC_IRQ_STATE };
enum
{
NEC_IP=1, NEC_AW, NEC_CW, NEC_DW, NEC_BW, NEC_SP, NEC_BP, NEC_IX, NEC_IY,
NEC_FLAGS, NEC_ES, NEC_CS, NEC_SS, NEC_DS,
NEC_VECTOR, NEC_PENDING, NEC_NMI_STATE, NEC_IRQ_STATE
};
/* Public variables */
extern int nec_ICount;
@ -59,7 +61,7 @@ extern unsigned v33_dasm(char *buffer, unsigned pc);
*/
void nec_set_reg(int,unsigned);
int nec_execute(int cycles);
int nec_execute(int cycles);
unsigned nec_get_reg(int regnum);
void nec_reset (void *param);
void nec_int(DWORD wektor);

View File

@ -1,12 +1,15 @@
static struct {
struct {
WREGS w[256];
BREGS b[256];
} reg;
struct {
WREGS w[256];
BREGS b[256];
} RM;
static struct
{
struct
{
WREGS w[256];
BREGS b[256];
} reg;
struct
{
WREGS w[256];
BREGS b[256];
} RM;
} Mod_RM;
#define RegWord(ModRM) I.regs.w[Mod_RM.reg.w[ModRM]]
@ -44,10 +47,10 @@ static struct {
WriteWord( EA , val); \
} \
}
#define GetRMByte(ModRM) \
((ModRM) >= 0xc0 ? I.regs.b[Mod_RM.RM.b[ModRM]] : ReadByte( (*GetEA[ModRM])() ))
#define PutRMByte(ModRM,val) \
{ \
if (ModRM >= 0xc0) \
@ -65,7 +68,7 @@ static struct {
WriteByte( EA , FETCH ); \
} \
}
#define PutbackRMByte(ModRM,val) \
{ \
if (ModRM >= 0xc0) \
@ -78,7 +81,7 @@ static struct {
UINT32 ModRM = FETCH,src,dst; \
src = RegByte(ModRM); \
dst = GetRMByte(ModRM)
#define DEF_wr16 \
UINT32 ModRM = FETCH,src,dst; \
src = RegWord(ModRM); \

View File

@ -31,21 +31,24 @@
////////////////////////////////////////////////////////////////////////////////
uint8 *ws_rom_load(char *path, uint32 *romSize)
{
uint8 *rom=NULL;
Uint32 filepos;
FILE *fp=fopen(path,"rb");
if (fp==NULL)
return(NULL);
uint8 *rom=NULL;
Uint32 filepos;
FILE *fp=fopen(path,"rb");
fseek(fp,0,SEEK_END);
//fgetpos(fp,&filepos);
filepos = ftell(fp);
*romSize=(uint32)filepos;
fseek(fp,0,SEEK_SET);
rom=(uint8*)malloc(*romSize);
fread(rom,1,*romSize,fp);
fclose(fp);
return(rom);
if (fp==NULL)
{
return(NULL);
}
fseek(fp,0,SEEK_END);
//fgetpos(fp,&filepos);
filepos = ftell(fp);
*romSize=(uint32)filepos;
fseek(fp,0,SEEK_SET);
rom=(uint8*)malloc(*romSize);
fread(rom,1,*romSize,fp);
fclose(fp);
return(rom);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -60,30 +63,66 @@ uint8 *ws_rom_load(char *path, uint32 *romSize)
////////////////////////////////////////////////////////////////////////////////
void ws_rom_dumpInfo(uint8 *wsrom, uint32 romSize)
{
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,romSize);
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,romSize);
fprintf(log_get(),"rom: developper Id 0x%.2x\n",romHeader->developperId);
fprintf(log_get(),"rom: cart Id 0x%.2x\n",romHeader->cartId);
fprintf(log_get(),"rom: minimum system %s\n",(romHeader->minimumSupportSystem==WS_SYSTEM_MONO)?"Wonderswan mono":"Wonderswan color");
fprintf(log_get(),"rom: size %i Mbits\n",(romSize>>20)<<3);
fprintf(log_get(),"rom: eeprom ");
switch (romHeader->eepromSize&0xf)
{
case WS_EEPROM_SIZE_NONE: { fprintf(log_get(),"none\n"); break; }
case WS_EEPROM_SIZE_64k: { fprintf(log_get(),"64 kb\n"); break; }
case WS_EEPROM_SIZE_256k: { fprintf(log_get(),"256 kb\n"); break; }
}
fprintf(log_get(),"rom: sram ");
switch (romHeader->eepromSize&0xf0)
{
case WS_SRAM_SIZE_NONE: { fprintf(log_get(),"none\n"); break; }
case WS_SRAM_SIZE_1k: { fprintf(log_get(),"1 kb\n"); break; }
case WS_SRAM_SIZE_16k: { fprintf(log_get(),"16 kb\n"); break; }
case WS_SRAM_SIZE_8k: { fprintf(log_get(),"8 kn\n"); break; }
}
fprintf(log_get(),"rom: rtc %s\n",(romHeader->realtimeClock)?"Yes":"None");
fprintf(log_get(),"checksum 0x%.4x\n",romHeader->checksum);
fprintf(log_get(),"rom: developper Id 0x%.2x\n",romHeader->developperId);
fprintf(log_get(),"rom: cart Id 0x%.2x\n",romHeader->cartId);
fprintf(log_get(),"rom: minimum system %s\n",(romHeader->minimumSupportSystem==WS_SYSTEM_MONO)?"Wonderswan mono":"Wonderswan color");
fprintf(log_get(),"rom: size %i Mbits\n",(romSize>>20)<<3);
fprintf(log_get(),"rom: eeprom ");
switch (romHeader->eepromSize&0xf)
{
case WS_EEPROM_SIZE_NONE:
{
fprintf(log_get(),"none\n");
break;
}
case WS_EEPROM_SIZE_64k:
{
fprintf(log_get(),"64 kb\n");
break;
}
case WS_EEPROM_SIZE_256k:
{
fprintf(log_get(),"256 kb\n");
break;
}
}
fprintf(log_get(),"rom: sram ");
switch (romHeader->eepromSize&0xf0)
{
case WS_SRAM_SIZE_NONE:
{
fprintf(log_get(),"none\n");
break;
}
case WS_SRAM_SIZE_1k:
{
fprintf(log_get(),"1 kb\n");
break;
}
case WS_SRAM_SIZE_16k:
{
fprintf(log_get(),"16 kb\n");
break;
}
case WS_SRAM_SIZE_8k:
{
fprintf(log_get(),"8 kn\n");
break;
}
}
fprintf(log_get(),"rom: rtc %s\n",(romHeader->realtimeClock)?"Yes":"None");
fprintf(log_get(),"checksum 0x%.4x\n",romHeader->checksum);
}
@ -100,10 +139,10 @@ void ws_rom_dumpInfo(uint8 *wsrom, uint32 romSize)
////////////////////////////////////////////////////////////////////////////////
ws_romHeaderStruct *ws_rom_getHeader(uint8 *wsrom, uint32 wsromSize)
{
ws_romHeaderStruct *wsromHeader=(ws_romHeaderStruct *)malloc(sizeof(ws_romHeaderStruct));
ws_romHeaderStruct *wsromHeader=(ws_romHeaderStruct *)malloc(sizeof(ws_romHeaderStruct));
memcpy(wsromHeader,wsrom+(wsromSize-10),10);
return(wsromHeader);
memcpy(wsromHeader,wsrom+(wsromSize-10),10);
return(wsromHeader);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -118,15 +157,24 @@ ws_romHeaderStruct *ws_rom_getHeader(uint8 *wsrom, uint32 wsromSize)
////////////////////////////////////////////////////////////////////////////////
uint32 ws_rom_sramSize(uint8 *wsrom, uint32 wsromSize)
{
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,wsromSize);
switch (romHeader->eepromSize&0xf0)
{
case WS_SRAM_SIZE_NONE: return(0);
case WS_SRAM_SIZE_1k: return(0x400);
case WS_SRAM_SIZE_16k: return(0x4000);
case WS_SRAM_SIZE_8k: return(0x2000);
}
return(0);
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,wsromSize);
switch (romHeader->eepromSize&0xf0)
{
case WS_SRAM_SIZE_NONE:
return(0);
case WS_SRAM_SIZE_1k:
return(0x400);
case WS_SRAM_SIZE_16k:
return(0x4000);
case WS_SRAM_SIZE_8k:
return(0x2000);
}
return(0);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -141,13 +189,20 @@ uint32 ws_rom_sramSize(uint8 *wsrom, uint32 wsromSize)
////////////////////////////////////////////////////////////////////////////////
uint32 ws_rom_eepromSize(uint8 *wsrom, uint32 wsromSize)
{
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,wsromSize);
switch (romHeader->eepromSize&0xf)
{
case WS_EEPROM_SIZE_NONE: return(0);
case WS_EEPROM_SIZE_64k: return(0x10000);
case WS_EEPROM_SIZE_256k: return(0x40000);
}
return(0);
ws_romHeaderStruct *romHeader=ws_rom_getHeader(wsrom,wsromSize);
switch (romHeader->eepromSize&0xf)
{
case WS_EEPROM_SIZE_NONE:
return(0);
case WS_EEPROM_SIZE_64k:
return(0x10000);
case WS_EEPROM_SIZE_256k:
return(0x40000);
}
return(0);
}

View File

@ -38,14 +38,14 @@
typedef struct ws_romHeaderStruct
{
uint8 developperId;
uint8 minimumSupportSystem;
uint8 cartId;
uint8 romSize;
uint8 eepromSize;
uint8 additionnalCapabilities;
uint8 realtimeClock;
uint16 checksum;
uint8 developperId;
uint8 minimumSupportSystem;
uint8 cartId;
uint8 romSize;
uint8 eepromSize;
uint8 additionnalCapabilities;
uint8 realtimeClock;
uint16 checksum;
} ws_romHeaderStruct;

View File

@ -1,98 +1,174 @@
static int testJoystick=1;
if (testJoystick==1)
{
testJoystick=0;
fprintf(log_get(),"%i joysticks were found.\n\n", SDL_NumJoysticks() );
fprintf(log_get(),"The names of the joysticks are:\n");
for(int tti=0; tti < SDL_NumJoysticks(); tti++ )
fprintf(log_get()," %s\n", SDL_JoystickName(tti));
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
else
{
if (joystick!=NULL)
{
SDL_JoystickClose(0);
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
}
while ( SDL_PollEvent(&app_input_event) )
{
if ( app_input_event.type == SDL_QUIT )
{
ws_key_esc = 1;
}
}
if (joystick)
{
if (SDL_JoystickGetButton(joystick,0))
ws_key_start=1;
else
ws_key_start=0;
if (SDL_JoystickGetButton(joystick,1))
ws_key_button_1=1;
else
ws_key_button_1=0;
if (SDL_JoystickGetButton(joystick,2))
ws_key_button_2=1;
else
ws_key_button_2=0;
static int testJoystick=1;
if (testJoystick==1)
{
testJoystick=0;
fprintf(log_get(),"%i joysticks were found.\n\n", SDL_NumJoysticks() );
fprintf(log_get(),"The names of the joysticks are:\n");
for(int tti=0; tti < SDL_NumJoysticks(); tti++ )
{
fprintf(log_get()," %s\n", SDL_JoystickName(tti));
}
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
else
{
if (joystick!=NULL)
{
SDL_JoystickClose(0);
SDL_JoystickEventState(SDL_ENABLE);
joystick = SDL_JoystickOpen(0);
}
}
while ( SDL_PollEvent(&app_input_event) )
{
if ( app_input_event.type == SDL_QUIT )
{
ws_key_esc = 1;
}
}
if (joystick)
{
if (SDL_JoystickGetButton(joystick,0))
{
ws_key_start=1;
}
else
{
ws_key_start=0;
}
if (SDL_JoystickGetButton(joystick,1))
{
ws_key_button_1=1;
}
else
{
ws_key_button_1=0;
}
if (SDL_JoystickGetButton(joystick,2))
{
ws_key_button_2=1;
}
else
{
ws_key_button_2=0;
}
if (SDL_JoystickGetAxis(joystick,0)<-7000)
ws_key_left=1;
else
ws_key_left=0;
if (SDL_JoystickGetAxis(joystick,0)>7000)
ws_key_right=1;
else
ws_key_right=0;
if (SDL_JoystickGetAxis(joystick,0)<-7000)
{
ws_key_left=1;
}
else
{
ws_key_left=0;
}
if (SDL_JoystickGetAxis(joystick,1)<-7000)
ws_key_up=1;
else
ws_key_up=0;
if (SDL_JoystickGetAxis(joystick,1)>7000)
ws_key_down=1;
else
ws_key_down=0;
}
else
{
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
}
uint8 *keystate = SDL_GetKeyState(NULL);
if ( keystate[SDLK_d])
{
dump_memory();
}
if ( keystate[SDLK_ESCAPE] )
ws_key_esc = 1;
if ( keystate[SDLK_UP] )
ws_key_up=1;
if ( keystate[SDLK_DOWN] )
ws_key_down=1;
if ( keystate[SDLK_RIGHT] )
ws_key_right=1;
if ( keystate[SDLK_LEFT] )
ws_key_left=1;
if (keystate[SDLK_RETURN])
ws_key_start=1;
if (keystate[SDLK_c])
ws_key_button_1=1;
if (keystate[SDLK_x])
ws_key_button_2=1;
if (keystate[SDLK_p])
ws_cyclesByLine+=10;
if (keystate[SDLK_o])
ws_cyclesByLine-=10;
if (SDL_JoystickGetAxis(joystick,0)>7000)
{
ws_key_right=1;
}
else
{
ws_key_right=0;
}
if (SDL_JoystickGetAxis(joystick,1)<-7000)
{
ws_key_up=1;
}
else
{
ws_key_up=0;
}
if (SDL_JoystickGetAxis(joystick,1)>7000)
{
ws_key_down=1;
}
else
{
ws_key_down=0;
}
}
else
{
ws_key_start=0;
ws_key_left=0;
ws_key_right=0;
ws_key_up=0;
ws_key_down=0;
ws_key_button_1=0;
ws_key_button_2=0;
}
uint8 *keystate = SDL_GetKeyState(NULL);
if ( keystate[SDLK_d])
{
dump_memory();
}
if ( keystate[SDLK_r])
{
printf("Boop\n");
ws_reset();
}
if ( keystate[SDLK_ESCAPE] )
{
ws_key_esc = 1;
}
if ( keystate[SDLK_UP] )
{
ws_key_up=1;
}
if ( keystate[SDLK_DOWN] )
{
ws_key_down=1;
}
if ( keystate[SDLK_RIGHT] )
{
ws_key_right=1;
}
if ( keystate[SDLK_LEFT] )
{
ws_key_left=1;
}
if (keystate[SDLK_RETURN])
{
ws_key_start=1;
}
if (keystate[SDLK_c])
{
ws_key_button_1=1;
}
if (keystate[SDLK_x])
{
ws_key_button_2=1;
}
if (keystate[SDLK_p])
{
ws_cyclesByLine+=10;
}
if (keystate[SDLK_o])
{
ws_cyclesByLine-=10;
}

View File

@ -1,5 +1,5 @@
extern "C"
{
long ticker();
long ticker();
};

View File

@ -70,27 +70,30 @@ extern int ws_sram_dirty;
void ws_patchRom(void)
{
uint8 *rom=memory_getRom();
uint32 romSize=memory_getRomSize();
uint8 *rom=memory_getRom();
uint32 romSize=memory_getRomSize();
fprintf(log_get(),"developper Id: 0x%.2x\nGame Id: 0x%.2x\n",rom[romSize-10],rom[romSize-8]);
fprintf(log_get(),"developper Id: 0x%.2x\nGame Id: 0x%.2x\n",rom[romSize-10],rom[romSize-8]);
/*
if((rom[romSize-10]==0x01)&&(rom[romSize-8]==0x27)) // Detective Conan
{
// WS cpu is using cache/pipeline or
// there's protected ROM bank where
// pointing CS
rom[0xfffe8]=0xea;
rom[0xfffe9]=0x00;
rom[0xfffea]=0x00;
rom[0xfffeb]=0x00;
rom[0xfffec]=0x20;
}*/
/*
if((rom[romSize-10]==0x01)&&(rom[romSize-8]==0x27)) // Detective Conan
{
// WS cpu is using cache/pipeline or
// there's protected ROM bank where
// pointing CS
if (!ws_cyclesByLine) ws_cyclesByLine=256;
rom[0xfffe8]=0xea;
rom[0xfffe9]=0x00;
rom[0xfffea]=0x00;
rom[0xfffeb]=0x00;
rom[0xfffec]=0x20;
}*/
if (!ws_cyclesByLine)
{
ws_cyclesByLine=256;
}
}
////////////////////////////////////////////////////////////////////////////////
@ -106,29 +109,37 @@ void ws_patchRom(void)
////////////////////////////////////////////////////////////////////////////////
int ws_init(char *rompath)
{
uint8 *rom;
uint32 romSize;
uint8 *rom;
uint32 romSize;
if ((rom=ws_rom_load(rompath,&romSize))==NULL)
{
printf("Error: cannot load %s\n",rompath);
return(0);
}
if (rompath[strlen(rompath)-1]=='c')
ws_gpu_operatingInColor=1;
else
ws_gpu_operatingInColor=0;
if ((rom=ws_rom_load(rompath,&romSize))==NULL)
{
printf("Error: cannot load %s\n",rompath);
return(0);
}
ws_memory_init(rom,romSize);
ws_patchRom();
ws_sram_load(ws_sram_path);
ws_io_init();
ws_audio_init();
ws_gpu_init();
if (ws_rotated())
ws_io_flipControls();
return(1);
if (rompath[strlen(rompath)-1]=='c')
{
ws_gpu_operatingInColor=1;
}
else
{
ws_gpu_operatingInColor=0;
}
ws_memory_init(rom,romSize);
ws_patchRom();
ws_sram_load(ws_sram_path);
ws_io_init();
ws_audio_init();
ws_gpu_init();
if (ws_rotated())
{
ws_io_flipControls();
}
return(1);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -143,12 +154,12 @@ int ws_init(char *rompath)
////////////////////////////////////////////////////////////////////////////////
void ws_reset(void)
{
ws_memory_reset();
ws_io_reset();
ws_audio_reset();
ws_gpu_reset();
nec_reset(NULL);
nec_set_reg(NEC_SP,0x2000);
ws_memory_reset();
ws_io_reset();
ws_audio_reset();
ws_gpu_reset();
nec_reset(NULL);
nec_set_reg(NEC_SP,0x2000);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -163,84 +174,107 @@ void ws_reset(void)
////////////////////////////////////////////////////////////////////////////////
int ws_executeLine(int16 *framebuffer, int renderLine)
{
int drawWholeScreen=0;
ws_audio_process();
int drawWholeScreen=0;
// update scanline register
ws_ioRam[2]=ws_gpu_scanline;
ws_audio_process();
ws_cycles=nec_execute((ws_cyclesByLine>>1)+(rand()&7));
ws_cycles+=nec_execute((ws_cyclesByLine>>1)+(rand()&7));
// update scanline register
ws_ioRam[2]=ws_gpu_scanline;
if(ws_cycles>=ws_cyclesByLine+ws_cyclesByLine)
ws_skip=ws_cycles/ws_cyclesByLine;
else
ws_skip=1;
ws_cycles%=ws_cyclesByLine;
ws_cycles=nec_execute((ws_cyclesByLine>>1)+(rand()&7));
ws_cycles+=nec_execute((ws_cyclesByLine>>1)+(rand()&7));
for(uint32 uI=0;uI<ws_skip;uI++)
{
if (renderLine)
ws_gpu_renderScanline(framebuffer);
if(ws_cycles>=ws_cyclesByLine+ws_cyclesByLine)
{
ws_skip=ws_cycles/ws_cyclesByLine;
}
else
{
ws_skip=1;
}
ws_gpu_scanline++;
if(ws_gpu_scanline==144)
drawWholeScreen=1;
ws_cycles%=ws_cyclesByLine;
for(uint32 uI=0; uI<ws_skip; uI++)
{
if (renderLine)
{
ws_gpu_renderScanline(framebuffer);
}
ws_gpu_scanline++;
if(ws_gpu_scanline==144)
{
drawWholeScreen=1;
}
}
if(ws_gpu_scanline>158)
{
ws_gpu_scanline=0;
{
if((ws_ioRam[0xb2]&32))/*VBLANK END INT*/
{
if(ws_ioRam[0xa7]!=0x35)/*Beatmania Fix*/
{
ws_ioRam[0xb6]&=~32;
nec_int((ws_ioRam[0xb0]+5)*4);
}
}
}
}
ws_ioRam[2]=ws_gpu_scanline;
if(drawWholeScreen)
{
if(ws_ioRam[0xb2]&64) /*VBLANK INT*/
{
ws_ioRam[0xb6]&=~64;
nec_int((ws_ioRam[0xb0]+6)*4);
}
vblank_count++;
}
}
if(ws_gpu_scanline>158)
{
ws_gpu_scanline=0;
{
if((ws_ioRam[0xb2]&32))/*VBLANK END INT*/
{
if(ws_ioRam[0xa7]!=0x35)/*Beatmania Fix*/
{
ws_ioRam[0xb6]&=~32;
nec_int((ws_ioRam[0xb0]+5)*4);
}
}
}
}
ws_ioRam[2]=ws_gpu_scanline;
if(drawWholeScreen)
{
if(ws_ioRam[0xb2]&64) /*VBLANK INT*/
{
ws_ioRam[0xb6]&=~64;
nec_int((ws_ioRam[0xb0]+6)*4);
}
vblank_count++;
}
if(ws_ioRam[0xa4]&&(ws_ioRam[0xb2]&128)) /*HBLANK INT*/
{
if(!ws_ioRam[0xa5])
ws_ioRam[0xa5]=ws_ioRam[0xa4];
if(ws_ioRam[0xa5])
ws_ioRam[0xa5]--;
if((!ws_ioRam[0xa5])&&(ws_ioRam[0xb2]&128))
{
ws_ioRam[0xb6]&=~128;
nec_int((ws_ioRam[0xb0]+7)*4);
}
}
if((ws_ioRam[0x2]==ws_ioRam[0x3])&&(ws_ioRam[0xb2]&16)) /*SCANLINE INT*/
{
ws_ioRam[0xb6]&=~16;
nec_int((ws_ioRam[0xb0]+4)*4);
}
if(!ws_ioRam[0xa5])
{
ws_ioRam[0xa5]=ws_ioRam[0xa4];
}
if (drawWholeScreen && ws_sram_dirty)
{
ws_sram_save(ws_sram_path);
ws_sram_dirty = 0;
}
return(drawWholeScreen);
if(ws_ioRam[0xa5])
{
ws_ioRam[0xa5]--;
}
if((!ws_ioRam[0xa5])&&(ws_ioRam[0xb2]&128))
{
ws_ioRam[0xb6]&=~128;
nec_int((ws_ioRam[0xb0]+7)*4);
}
}
if((ws_ioRam[0x2]==ws_ioRam[0x3])&&(ws_ioRam[0xb2]&16)) /*SCANLINE INT*/
{
ws_ioRam[0xb6]&=~16;
nec_int((ws_ioRam[0xb0]+4)*4);
}
if (drawWholeScreen && ws_sram_dirty)
{
ws_sram_save(ws_sram_path);
ws_sram_dirty = 0;
}
return(drawWholeScreen);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -255,10 +289,10 @@ int ws_executeLine(int16 *framebuffer, int renderLine)
////////////////////////////////////////////////////////////////////////////////
void ws_done(void)
{
ws_memory_done();
ws_io_done();
ws_audio_done();
ws_gpu_done();
ws_memory_done();
ws_io_done();
ws_audio_done();
ws_gpu_done();
}
////////////////////////////////////////////////////////////////////////////////
//
@ -273,7 +307,7 @@ void ws_done(void)
////////////////////////////////////////////////////////////////////////////////
void ws_set_colour_scheme(int scheme)
{
ws_gpu_set_colour_scheme(scheme);
ws_gpu_set_colour_scheme(scheme);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -288,11 +322,14 @@ void ws_set_colour_scheme(int scheme)
////////////////////////////////////////////////////////////////////////////////
void ws_set_system(int system)
{
if (system==WS_SYSTEM_COLOR)
ws_gpu_forceColorSystem();
else
if (system==WS_SYSTEM_MONO)
ws_gpu_forceMonoSystem();
if (system==WS_SYSTEM_COLOR)
{
ws_gpu_forceColorSystem();
}
else if (system==WS_SYSTEM_MONO)
{
ws_gpu_forceMonoSystem();
}
}
////////////////////////////////////////////////////////////////////////////////
//
@ -307,59 +344,65 @@ void ws_set_system(int system)
////////////////////////////////////////////////////////////////////////////////
#define MacroLoadNecRegisterFromFile(F,R) \
read(fp,&value,sizeof(value)); \
nec_set_reg(R,value);
nec_set_reg(R,value);
int ws_loadState(char *statepath)
{
fprintf(log_get(),"loading %s\n",statepath);
uint16 crc=memory_getRomCrc();
uint16 newCrc;
unsigned value;
uint8 ws_newVideoMode;
fprintf(log_get(),"loading %s\n",statepath);
uint16 crc=memory_getRomCrc();
uint16 newCrc;
unsigned value;
uint8 ws_newVideoMode;
int fp = open(statepath,O_BINARY|O_RDONLY);
if (fp == -1)
return(0);
read(fp, &newCrc, 2);
if (newCrc!=crc)
{
return(-1);
}
MacroLoadNecRegisterFromFile(fp,NEC_IP);
MacroLoadNecRegisterFromFile(fp,NEC_AW);
MacroLoadNecRegisterFromFile(fp,NEC_BW);
MacroLoadNecRegisterFromFile(fp,NEC_CW);
MacroLoadNecRegisterFromFile(fp,NEC_DW);
MacroLoadNecRegisterFromFile(fp,NEC_CS);
MacroLoadNecRegisterFromFile(fp,NEC_DS);
MacroLoadNecRegisterFromFile(fp,NEC_ES);
MacroLoadNecRegisterFromFile(fp,NEC_SS);
MacroLoadNecRegisterFromFile(fp,NEC_IX);
MacroLoadNecRegisterFromFile(fp,NEC_IY);
MacroLoadNecRegisterFromFile(fp,NEC_BP);
MacroLoadNecRegisterFromFile(fp,NEC_SP);
MacroLoadNecRegisterFromFile(fp,NEC_FLAGS);
MacroLoadNecRegisterFromFile(fp,NEC_VECTOR);
MacroLoadNecRegisterFromFile(fp,NEC_PENDING);
MacroLoadNecRegisterFromFile(fp,NEC_NMI_STATE);
MacroLoadNecRegisterFromFile(fp,NEC_IRQ_STATE);
read(fp,internalRam,65536);
read(fp,ws_staticRam,65536);
read(fp,ws_ioRam,256);
read(fp,ws_paletteColors,8);
read(fp,ws_palette,16*4*2);
read(fp,wsc_palette,16*16*2);
read(fp,&ws_newVideoMode,1);
read(fp,&ws_gpu_scanline,1);
read(fp,externalEeprom,131072);
int fp = open(statepath,O_BINARY|O_RDONLY);
ws_audio_readState(fp);
close(fp);
// force a video mode change to make all tiles dirty
ws_gpu_clearCache();
return(1);
if (fp == -1)
{
return(0);
}
read(fp, &newCrc, 2);
if (newCrc!=crc)
{
return(-1);
}
MacroLoadNecRegisterFromFile(fp,NEC_IP);
MacroLoadNecRegisterFromFile(fp,NEC_AW);
MacroLoadNecRegisterFromFile(fp,NEC_BW);
MacroLoadNecRegisterFromFile(fp,NEC_CW);
MacroLoadNecRegisterFromFile(fp,NEC_DW);
MacroLoadNecRegisterFromFile(fp,NEC_CS);
MacroLoadNecRegisterFromFile(fp,NEC_DS);
MacroLoadNecRegisterFromFile(fp,NEC_ES);
MacroLoadNecRegisterFromFile(fp,NEC_SS);
MacroLoadNecRegisterFromFile(fp,NEC_IX);
MacroLoadNecRegisterFromFile(fp,NEC_IY);
MacroLoadNecRegisterFromFile(fp,NEC_BP);
MacroLoadNecRegisterFromFile(fp,NEC_SP);
MacroLoadNecRegisterFromFile(fp,NEC_FLAGS);
MacroLoadNecRegisterFromFile(fp,NEC_VECTOR);
MacroLoadNecRegisterFromFile(fp,NEC_PENDING);
MacroLoadNecRegisterFromFile(fp,NEC_NMI_STATE);
MacroLoadNecRegisterFromFile(fp,NEC_IRQ_STATE);
read(fp,internalRam,65536);
read(fp,ws_staticRam,65536);
read(fp,ws_ioRam,256);
read(fp,ws_paletteColors,8);
read(fp,ws_palette,16*4*2);
read(fp,wsc_palette,16*16*2);
read(fp,&ws_newVideoMode,1);
read(fp,&ws_gpu_scanline,1);
read(fp,externalEeprom,131072);
ws_audio_readState(fp);
close(fp);
// force a video mode change to make all tiles dirty
ws_gpu_clearCache();
return(1);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -378,69 +421,85 @@ int ws_loadState(char *statepath)
int ws_saveState(char *statepath)
{
uint16 crc=memory_getRomCrc();
unsigned value;
char *newPath;
fprintf(log_get(),"saving %s\n",statepath);
newPath=new char[1024];
if (strlen(statepath)<4)
sprintf(newPath,"%s.wss",statepath);
else
{
int len=strlen(statepath);
if ((statepath[len-1]!='s')&&(statepath[len-1]!='S'))
sprintf(newPath,"%s.wss",statepath);
else
if ((statepath[len-2]!='s')&&(statepath[len-2]!='S'))
sprintf(newPath,"%s.wss",statepath);
else
if ((statepath[len-3]!='w')&&(statepath[len-3]!='w'))
sprintf(newPath,"%s.wss",statepath);
else
if (statepath[len-4]!='.')
sprintf(newPath,"%s.wss",statepath);
else
sprintf(newPath,"%s",statepath);
}
int fp=open(newPath,O_BINARY|O_RDWR|O_CREAT);
delete newPath;
if (fp==-1)
return(0);
write(fp,&crc,2);
MacroStoreNecRegisterToFile(fp,NEC_IP);
MacroStoreNecRegisterToFile(fp,NEC_AW);
MacroStoreNecRegisterToFile(fp,NEC_BW);
MacroStoreNecRegisterToFile(fp,NEC_CW);
MacroStoreNecRegisterToFile(fp,NEC_DW);
MacroStoreNecRegisterToFile(fp,NEC_CS);
MacroStoreNecRegisterToFile(fp,NEC_DS);
MacroStoreNecRegisterToFile(fp,NEC_ES);
MacroStoreNecRegisterToFile(fp,NEC_SS);
MacroStoreNecRegisterToFile(fp,NEC_IX);
MacroStoreNecRegisterToFile(fp,NEC_IY);
MacroStoreNecRegisterToFile(fp,NEC_BP);
MacroStoreNecRegisterToFile(fp,NEC_SP);
MacroStoreNecRegisterToFile(fp,NEC_FLAGS);
MacroStoreNecRegisterToFile(fp,NEC_VECTOR);
MacroStoreNecRegisterToFile(fp,NEC_PENDING);
MacroStoreNecRegisterToFile(fp,NEC_NMI_STATE);
MacroStoreNecRegisterToFile(fp,NEC_IRQ_STATE);
uint16 crc=memory_getRomCrc();
unsigned value;
char *newPath;
fprintf(log_get(),"saving %s\n",statepath);
write(fp,internalRam,65536);
write(fp,ws_staticRam,65536);
write(fp,ws_ioRam,256);
write(fp,ws_paletteColors,8);
write(fp,ws_palette,16*4*2);
write(fp,wsc_palette,16*16*2);
write(fp,&ws_videoMode,1);
write(fp,&ws_gpu_scanline,1);
write(fp,externalEeprom,131072);
ws_audio_writeState(fp);
close(fp);
newPath=new char[1024];
return(1);
if (strlen(statepath)<4)
{
sprintf(newPath,"%s.wss",statepath);
}
else
{
int len=strlen(statepath);
if ((statepath[len-1]!='s')&&(statepath[len-1]!='S'))
{
sprintf(newPath,"%s.wss",statepath);
}
else if ((statepath[len-2]!='s')&&(statepath[len-2]!='S'))
{
sprintf(newPath,"%s.wss",statepath);
}
else if ((statepath[len-3]!='w')&&(statepath[len-3]!='w'))
{
sprintf(newPath,"%s.wss",statepath);
}
else if (statepath[len-4]!='.')
{
sprintf(newPath,"%s.wss",statepath);
}
else
{
sprintf(newPath,"%s",statepath);
}
}
int fp=open(newPath,O_BINARY|O_RDWR|O_CREAT);
delete newPath;
if (fp==-1)
{
return(0);
}
write(fp,&crc,2);
MacroStoreNecRegisterToFile(fp,NEC_IP);
MacroStoreNecRegisterToFile(fp,NEC_AW);
MacroStoreNecRegisterToFile(fp,NEC_BW);
MacroStoreNecRegisterToFile(fp,NEC_CW);
MacroStoreNecRegisterToFile(fp,NEC_DW);
MacroStoreNecRegisterToFile(fp,NEC_CS);
MacroStoreNecRegisterToFile(fp,NEC_DS);
MacroStoreNecRegisterToFile(fp,NEC_ES);
MacroStoreNecRegisterToFile(fp,NEC_SS);
MacroStoreNecRegisterToFile(fp,NEC_IX);
MacroStoreNecRegisterToFile(fp,NEC_IY);
MacroStoreNecRegisterToFile(fp,NEC_BP);
MacroStoreNecRegisterToFile(fp,NEC_SP);
MacroStoreNecRegisterToFile(fp,NEC_FLAGS);
MacroStoreNecRegisterToFile(fp,NEC_VECTOR);
MacroStoreNecRegisterToFile(fp,NEC_PENDING);
MacroStoreNecRegisterToFile(fp,NEC_NMI_STATE);
MacroStoreNecRegisterToFile(fp,NEC_IRQ_STATE);
write(fp,internalRam,65536);
write(fp,ws_staticRam,65536);
write(fp,ws_ioRam,256);
write(fp,ws_paletteColors,8);
write(fp,ws_palette,16*4*2);
write(fp,wsc_palette,16*16*2);
write(fp,&ws_videoMode,1);
write(fp,&ws_gpu_scanline,1);
write(fp,externalEeprom,131072);
ws_audio_writeState(fp);
close(fp);
return(1);
}
////////////////////////////////////////////////////////////////////////////////
//
@ -455,8 +514,8 @@ int ws_saveState(char *statepath)
////////////////////////////////////////////////////////////////////////////////
int ws_rotated(void)
{
uint8 *rom=memory_getRom();
uint32 romSize=memory_getRomSize();
return(rom[romSize-4]&1);
uint8 *rom=memory_getRom();
uint32 romSize=memory_getRomSize();
return(rom[romSize-4]&1);
}

65
oswan/ws.txt Normal file
View File

@ -0,0 +1,65 @@
00000000 ff ff ff ff ff ff c0 ff 00 00 00 00 00 00 00 00 |................|
00000010 00 00 00 00 00 00 00 00 00 00 7f 00 ff ff ff ff |................|
00000020 ff ff ff ff ff ff ff ff ff ff 00 00 00 00 00 00 |................|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff |................|
00000050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000060 00 fc ff 01 ff fd ff fd ff fd ff fd ff fd ff fd |................|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000080 ff ff ff ff 01 00 ff ff ff ff ff ff ff ff ff ff |................|
00000090 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000000f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000100 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000110 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000120 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000130 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000140 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000150 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000160 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000170 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000180 00 00 03 03 00 00 00 40 80 00 00 00 00 00 00 00 |.......@........|
00000190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001b0 87 05 8c 09 05 0c 8b 0c 90 00 00 02 00 4c a5 00 |.............L..|
000001c0 80 00 00 00 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001d0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001e0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
000001f0 ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f ff 7f |................|
00000200 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000210 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000220 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000230 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000240 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000250 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000260 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000270 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000280 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000290 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000002e0 21 19 18 0e 0f 1c 1d 21 0b 18 00 25 00 00 00 00 |!......!...%....|
000002f0 20 01 01 21 01 04 21 00 01 98 3c 7f 4b 02 36 01 | ..!..!...<.K.6.|
00000300 00 00 06 06 06 06 06 00 00 00 00 00 01 80 0f 00 |................|
00000310 01 01 01 0f 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000340 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000350 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000360 21 19 18 0e 0f 1c 1d 21 0b 18 00 00 00 00 00 00 |!......!........|
00000370 20 01 01 21 01 04 00 01 00 98 3c 7f 4a 01 35 01 | ..!......<.J.5.|
00000380 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000390 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003a0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003b0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003e0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000003f0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
00000400