Now build on x64 platform, still need lots of rework...

This commit is contained in:
Godzil 2019-09-02 16:02:03 +01:00
parent 56b69d2281
commit 0219258ee9
31 changed files with 310 additions and 1771 deletions

2
.gitignore vendored
View File

@ -1,9 +1,11 @@
.DS_Store
*.bak
*.a
*.o
*.bin
*.wsc
*~
seal-hack/src/mp
testserial
wonderswan
*.orig

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
all:
make -C seal-hack
make -C oswan
clean:
make -C seal-hack clean
make -C oswan clean

View File

@ -16,12 +16,14 @@ OBJS = $(wonderswan_CXX_SRCS:.cpp=.o)
all: wonderswan
CXX = clang++
CXXFLAGS = -g -O2 `sdl-config --cflags` -arch i386
OPTIONS = -D_REENTRANT -I. -I../seal-hack/include
CXX = g++
CXXFLAGS = -g -O2 `sdl-config --cflags` -Wall -Werror -std=c++98 -Wno-write-strings
#-arch i386
OPTIONS = -D_REENTRANT -I. -I../seal-hack/src/
LIBRARY_PATH = -L../seal-hack/lib/SDL
LIBS = -g $(LIBRARY_PATH) `sdl-config --libs` -arch i386
LIBS = -g $(LIBRARY_PATH) `sdl-config --libs`
#-arch i386
ALLCFLAGS = $(CFLAGS) $(CEXTRA) $(OPTIONS) $(ALLFLAGS)
ALLCXXFLAGS=$(CXXFLAGS) $(CXXEXTRA) $(OPTIONS) $(ALLFLAGS)

View File

@ -299,7 +299,7 @@ void SuperEagle (u8 *srcPtr, u32 srcPitch, u8 *deltaPtr,
{
u8 *dP;
u16 *bP;
u16 *xP;
//u16 *xP;
u32 inc_bP;
{

View File

@ -102,7 +102,7 @@ public:
nupdates = 0;
is_console = 1;
}
~Surface() {
virtual ~Surface() {
if ( ! is_console ) {
SDL_FreeSurface(surface);
}

View File

@ -12,8 +12,8 @@
////////////////////////////////////////////////////////////////////////////////
// alternate the commenting of the following defines to get audio port tracing
#define dbgprintf //
//#define dbgprintf printf
#define dbgprintf(...)
//#define dbgprintf(...) printf(...)
#include <stdio.h>
#include <stdlib.h>
@ -234,11 +234,13 @@ void ws_audio_port_write(Uint32 port, Uint8 value)
ws_audio_set_channel_frequency(3,i);
break;
case 0x88:
dbgprintf("0x88 <- 0x%2x\n", value); fflush(stdout);
dbgprintf("0x88 <- 0x%2x\n", value);
// fflush(stdout);
ws_audio_set_channel_pan(0,(value&0xF0)>>4,value&0x0F);
break;
case 0x89:
dbgprintf("0x89 <- 0x%2x\n", value); fflush(stdout);
dbgprintf("0x89 <- 0x%2x\n", value);
// fflush(stdout);
ws_audio_set_channel_pan(1,(value&0xF0)>>4,value&0x0F);
break;
case 0x8A:
@ -256,7 +258,8 @@ void ws_audio_port_write(Uint32 port, Uint8 value)
SwpTime=(((unsigned int)value)+1)<<5;
break;
case 0x8E:
dbgprintf("0x8E <- 0x%2x = %d %d %d %d %d %d %d %d \n", value, value & 0x80 ? 1 : 0, value & 0x40 ? 1 : 0, value & 0x20 ? 1 : 0, value & 0x10 ? 1 : 0, value & 8 ? 1 : 0, value & 4 ? 1 : 0, value & 2 ? 1 : 0, value & 1), fflush(stdout); /* ctl */
dbgprintf("0x8E <- 0x%2x = %d %d %d %d %d %d %d %d \n", value, value & 0x80 ? 1 : 0, value & 0x40 ? 1 : 0, value & 0x20 ? 1 : 0, value & 0x10 ? 1 : 0, value & 8 ? 1 : 0, value & 4 ? 1 : 0, value & 2 ? 1 : 0, value & 1);
//fflush(stdout); /* ctl */
if (value & 0x10)
{
ws_audio_set_channel_pdata(5,value&0x07);
@ -269,7 +272,8 @@ void ws_audio_port_write(Uint32 port, Uint8 value)
WaveMap=((unsigned int)value)<<6;
break;
case 0x90:
dbgprintf("0x90 <- 0x%2x = %d %d %d %d %d %d %d %d \n", value, value & 0x80 ? 1 : 0, value & 0x40 ? 1 : 0, value & 0x20 ? 1 : 0, value & 0x10 ? 1 : 0, value & 8 ? 1 : 0, value & 4 ? 1 : 0, value & 2 ? 1 : 0, value & 1), fflush(stdout); /* ctl */
dbgprintf("0x90 <- 0x%2x = %d %d %d %d %d %d %d %d \n", value, value & 0x80 ? 1 : 0, value & 0x40 ? 1 : 0, value & 0x20 ? 1 : 0, value & 0x10 ? 1 : 0, value & 8 ? 1 : 0, value & 4 ? 1 : 0, value & 2 ? 1 : 0, value & 1);
//fflush(stdout); /* ctl */
if (value&0x01)
{
@ -515,9 +519,10 @@ int ws_audio_seal_init(void)
AGetAudioDevCaps(nDevId, &caps);
fprintf(log_get(),"audio: %2d. %s\n", nDevId, caps.szProductName);
}
/* open audio device */
//info.nDeviceId = AUDIO_DEVICE_MAPPER;
info.nDeviceId = 1;
info.nDeviceId = 0;
info.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO; // | AUDIO_MIXER_BASS;
info.nSampleRate = 44100;
if ((rc = AOpenAudio(&info)) != AUDIO_ERROR_NONE)
@ -664,7 +669,7 @@ void ws_audio_seal_done(void)
ADestroyAudioData(&ws_audio_sweep_wave);
// release pcm channels
for (i=0;i<6;i++)
for (i=0;i<4;i++)
ADestroyAudioVoice(ws_audio_pcm_voice[i]);
// release noise channel
@ -1091,9 +1096,9 @@ void ws_audio_set_pcm(int Data)
////////////////////////////////////////////////////////////////////////////////
void ws_audio_flash_pcm(void)
{
int result;
void *ptr1,*ptr2;
DWORD len1,len2;
//int result;
//void *ptr1,*ptr2;
DWORD len1; //,len2;
const DWORD WrPos[16]=
{
@ -1104,6 +1109,10 @@ void ws_audio_flash_pcm(void)
};
len1=BUFSIZEP;
if (ws_audio_noise_wave.lpData == NULL)
return;
memcpy(&ws_audio_noise_wave.lpData[WrPos[PcmWrPos]], PDataP, len1);
AWriteAudioData(&ws_audio_noise_wave, 0, ws_audio_noise_wave.dwLength);
@ -1317,11 +1326,11 @@ void ws_audio_readState(int fp)
////////////////////////////////////////////////////////////////////////////////
void ws_audio_writeState(int fp)
{
long lpdwPosition;
long lpdwFrequency;
unsigned int lpnVolume;
unsigned int lpnPanning;
int lpnStatus;
int32_t lpdwPosition;
int32_t lpdwFrequency;
uint16_t lpnVolume;
uint16_t lpnPanning;
int8_t lpnStatus;
write(fp,&PCMPos,sizeof(DWORD));
write(fp,&TickZ,sizeof(DWORD));

View File

@ -1,8 +1,9 @@
Sint32 startTime, endTime, totalFrames;
Uint32 nNormalLast=0;
Sint32 nNormalFrac=0;
Sint32 nTime=0,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;

View File

@ -8,10 +8,10 @@
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
//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();

View File

@ -47,7 +47,7 @@
strcpy(old_rom_path,ws_rom_path);
//gui_open();
#ifndef GUI_OPEN_WARNED
#warning XXX something ought to take place here...
//#warning XXX something ought to take place here...
#define GUI_OPEN_WARNED
#endif
app_terminate = 1;

View File

@ -6,5 +6,5 @@
while (!ws_executeLine(backbuffer,0));
while (!ws_executeLine(backbuffer,1));
totalFrames++;
//totalFrames++;

View File

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

View File

@ -759,14 +759,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
uint8 *ws_tileRow=ws_tileCache_getTileRow( tileInfo&0x1ff, lineInTile, tileInfo&0x8000, tileInfo&0x4000, tileInfo&0x2000);
int16 *wsc_paletteAlias=&wsc_palette[((tileInfo>>9)&0x0f)<<4];
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
}
// render the last clipped tile
@ -835,25 +843,41 @@ void ws_gpu_renderScanline(int16 *framebuffer)
if ((tileInfo>>9)&0x04)
{
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
}
else
{
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
}
}
@ -937,9 +961,9 @@ void ws_gpu_renderScanline(int16 *framebuffer)
if (ws_ioRam[0x00]&0x02)
{
int ws_fgWindow_x0=ws_ioRam[0x08];
int ws_fgWindow_y0=ws_ioRam[0x09];
//int ws_fgWindow_y0=ws_ioRam[0x09];
int ws_fgWindow_x1=ws_ioRam[0x0a];
int ws_fgWindow_y1=ws_ioRam[0x0b];
//int ws_fgWindow_y1=ws_ioRam[0x0b];
int ws_fgScroll_x=ws_ioRam[0x12];
int ws_fgScroll_y=ws_ioRam[0x13];
@ -998,14 +1022,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
int16 *wsc_paletteAlias=&wsc_palette[((tileInfo>>9)&0x0f)<<4];
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++;
}
// render the last clipped tile
@ -1073,25 +1105,41 @@ void ws_gpu_renderScanline(int16 *framebuffer)
if ((tileInfo>>9)&0x04)
{
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
if (*ws_tileRow) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
}
else
{
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
*scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++;
}
}
@ -1170,14 +1218,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
}
// render the last clipped tile
@ -1235,14 +1291,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
int16 *ws_paletteAlias=&ws_palette[((tileInfo>>9)&0x0f)<<2];
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&(column>=ws_fgWindow_x0)&&(column<=ws_fgWindow_x1)) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
}
// render the last clipped tile
@ -1309,14 +1373,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=wsc_paletteAlias[*ws_tileRow];
scanlinePtr++; ws_tileRow++; column++;
}
// render the last clipped tile
@ -1372,14 +1444,22 @@ void ws_gpu_renderScanline(int16 *framebuffer)
uint8 *ws_tileRow=ws_tileCache_getTileRow( tileInfo&0x1ff, lineInTile, tileInfo&0x8000, tileInfo&0x4000, tileInfo&0x2000);
int16 *ws_paletteAlias=&ws_palette[((tileInfo>>9)&0x0f)<<2];
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]]; scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
if ((*ws_tileRow)&&((column<ws_fgWindow_x0)||(column>ws_fgWindow_x1))) *scanlinePtr=ws_shades[ws_paletteColors[ws_paletteAlias[*ws_tileRow]]];
scanlinePtr++; ws_tileRow++; column++;
}
// render the last clipped tile

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,7 @@ void ws_io_reset(void)
ws_key_button_2=0;
int i;
for (i=0;i<0x100;i++)
ws_ioRam[i]=initialIoValue[i];
ws_ioRam[i]= initialIoValue[i];
for (i=0;i<0xc9;i++)
cpu_writeport(i,initialIoValue[i]);
@ -162,8 +162,11 @@ void set_baudrate(int speed)
{
cfsetospeed(&options, B38400);
}
#if 0
options.c_cflag &= ~CNEW_RTSCTS;
#else
options.c_cflag &= ~CRTSCTS;
#endif
options.c_cflag |= (CLOCAL | CREAD);
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
@ -254,9 +257,9 @@ void write_serial(unsigned char value)
BYTE cpu_readport(BYTE port)
{
int w1,w2;
BYTE retVal;
BYTE retVal = 0;
if (port >= 0xBA) && (port <= 0xBE)
if ((port >= 0xBA) && (port <= 0xBE))
{
printf("Reading IEEP %02X\n", port);
}
@ -453,7 +456,8 @@ BYTE cpu_readport(BYTE port)
goto exit;
default:
if (port > 0xD0) printf("ReadIO %02X <= %02X\n", port, retVal);
if (port > 0xD0)
printf("ReadIO %02X <= %02X\n", port, retVal);
break;
}
@ -475,11 +479,11 @@ exit:
////////////////////////////////////////////////////////////////////////////////
void cpu_writeport(DWORD port,BYTE value)
{
unsigned short F0dbg = 0;
int w1,w2;
//unsigned short F0dbg = 0;
int w1; //,w2;
int unknown_io_port=0;
if (port >= 0xBA) && (port <= 0xBE)
if ((port >= 0xBA) && (port <= 0xBE))
{
printf("Writing IEEP %02X <= %02X\n", port, value);
}
@ -696,6 +700,8 @@ void cpu_writeport(DWORD port,BYTE value)
case 0xF1: printf("%d\n", (signed short)((value << 8) | ws_ioRam[0xF0])); break;
case 0xF2: printf("%c", value); fflush(stdout); break;
case 0xB7: break; /* Somwthing to write there, but what? */
default:
unknown_io_port=1;
}

View File

@ -74,9 +74,9 @@ void dump_memory()
fp = fopen("memorydump.bin", "wb");
fwrite(internalRam, 1, 0x10000, fp);
/* page 1 */
fwrite(&(ws_staticRam[sramAddressMask]), 1, 0x10000, fp);
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);
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)));
@ -274,7 +274,7 @@ uint16 memory_getRomCrc(void)
void ws_sram_load(char *path)
{
FILE *f;
size_t read;
//size_t read;
f = fopen(path, "r");
if (NULL == f)
@ -283,7 +283,7 @@ void ws_sram_load(char *path)
return;
}
read = fread(ws_staticRam, 1, 0x8000, f);
/*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);
}
@ -291,7 +291,7 @@ void ws_sram_load(char *path)
void ws_sram_save(char *path)
{
FILE *f;
size_t wrote;
//size_t wrote;
f = fopen(path, "wb");
if (NULL == f)
@ -300,7 +300,7 @@ void ws_sram_save(char *path)
return;
}
wrote = fwrite(ws_staticRam, 1, 0x8000, f);
/*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

@ -132,11 +132,11 @@ void nec_int(DWORD wektor)
}
}
static void nec_interrupt(unsigned int_num, /*BOOLEAN*/ int md_flag)
static void nec_interrupt(uint32_t int_num, /*BOOLEAN*/ int md_flag)
{
UINT32 dest_seg, dest_off;
if (int_num == -1)
if (int_num == UINT32_MAX)
return;
i_pushf();
@ -303,7 +303,7 @@ OP( 0x5e, i_pop_si ) { POP(I.regs.w[IX]); CLK(1); }
OP( 0x5f, i_pop_di ) { POP(I.regs.w[IY]); CLK(1); }
OP( 0x60, i_pusha ) {
unsigned tmp=I.regs.w[SP];
uint32_t tmp=I.regs.w[SP];
PUSH(I.regs.w[AW]);
PUSH(I.regs.w[CW]);
PUSH(I.regs.w[DW]);
@ -315,7 +315,7 @@ OP( 0x60, i_pusha ) {
CLK(9);
}
OP( 0x61, i_popa ) {
unsigned tmp;
uint32_t tmp;
POP(I.regs.w[IY]);
POP(I.regs.w[IX]);
POP(I.regs.w[BP]);
@ -324,6 +324,7 @@ OP( 0x61, i_popa ) {
POP(I.regs.w[DW]);
POP(I.regs.w[CW]);
POP(I.regs.w[AW]);
(void)tmp; // We need to uppop something and need tmp
CLK(8);
}
OP( 0x62, i_chkind ) {
@ -560,7 +561,7 @@ OP( 0xbf, i_mov_did16 ) { I.regs.b[IYL] = FETCH; I.regs.b[IYH] = FETCH; CLK(1);
OP( 0xc0, i_rotshft_bd8 ) {
UINT32 src, dst; UINT8 c;
GetModRM; src = (unsigned)GetRMByte(ModRM); dst=src;
GetModRM; src = (uint32_t)GetRMByte(ModRM); dst=src;
c=FETCH;
c&=0x1f;
CLKM(5,3);
@ -578,7 +579,7 @@ OP( 0xc0, i_rotshft_bd8 ) {
OP( 0xc1, i_rotshft_wd8 ) {
UINT32 src, dst; UINT8 c;
GetModRM; src = (unsigned)GetRMWord(ModRM); dst=src;
GetModRM; src = (uint32_t)GetRMWord(ModRM); dst=src;
c=FETCH;
c&=0x1f;
CLKM(5,3);
@ -693,11 +694,11 @@ OP( 0xd3, i_rotshft_wcl ) {
}
}
OP( 0xd4, i_aam ) { UINT32 mult=FETCH; mult=0; I.regs.b[AH] = I.regs.b[AL] / 10; I.regs.b[AL] %= 10; SetSZPF_Word(I.regs.w[AW]); CLK(17); }
OP( 0xd5, i_aad ) { UINT32 mult=FETCH; mult=0; I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL]; I.regs.b[AH] = 0; SetSZPF_Byte(I.regs.b[AL]); CLK(6); }
OP( 0xd4, i_aam ) { /*UINT32 mult=FETCH; mult=0;*/ I.regs.b[AH] = I.regs.b[AL] / 10; I.regs.b[AL] %= 10; SetSZPF_Word(I.regs.w[AW]); CLK(17); }
OP( 0xd5, i_aad ) { /*UINT32 mult=FETCH; mult=0;*/ I.regs.b[AL] = I.regs.b[AH] * 10 + I.regs.b[AL]; I.regs.b[AH] = 0; SetSZPF_Byte(I.regs.b[AL]); CLK(6); }
OP( 0xd6, i_setalc ) { I.regs.b[AL] = (CF)?0xff:0x00; CLK(3); } /* nop at V30MZ? */
OP( 0xd7, i_trans ) { UINT32 dest = (I.regs.w[BW]+I.regs.b[AL])&0xffff; I.regs.b[AL] = GetMemB(DS, dest); CLK(5); }
OP( 0xd8, i_fpo ) { GetModRM; CLK(3); } /* nop at V30MZ? */
OP( 0xd8, i_fpo ) { /*GetModRM;*/ CLK(3); } /* nop at V30MZ? */
OP( 0xe0, i_loopne ) { INT8 disp = (INT8)FETCH; I.regs.w[CW]--; if (!ZF && I.regs.w[CW]) { I.ip = (WORD)(I.ip+disp); CLK(6); } else CLK(3); }
OP( 0xe1, i_loope ) { INT8 disp = (INT8)FETCH; I.regs.w[CW]--; if ( ZF && I.regs.w[CW]) { I.ip = (WORD)(I.ip+disp); CLK(6); } else CLK(3); }
@ -852,7 +853,7 @@ static void i_invalid(void)
/*****************************************************************************/
unsigned nec_get_reg(int regnum)
uint32_t nec_get_reg(int regnum)
{
switch( regnum )
{
@ -880,7 +881,7 @@ unsigned nec_get_reg(int regnum)
void nec_set_irq_line(int irqline, int state);
void nec_set_reg(int regnum, unsigned val)
void nec_set_reg(int regnum, uint32_t val)
{
switch( regnum )
{

View File

@ -23,7 +23,7 @@ typedef struct
UINT16 ip;
INT32 SignVal;
UINT32 AuxVal, OverVal, ZeroVal, CarryVal, ParityVal; /* 0 or non-0 valued flags */
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;
@ -172,8 +172,8 @@ typedef struct
#define IncWordReg(Reg) \
unsigned tmp = (unsigned)I.regs.w[Reg]; \
unsigned tmp1 = tmp+1; \
uint16_t tmp = (uint16_t)I.regs.w[Reg]; \
uint16_t tmp1 = tmp+1; \
I.OverVal = (tmp == 0x7fff); \
SetAF(tmp1,tmp,1); \
SetSZPF_Word(tmp1); \
@ -182,8 +182,8 @@ typedef struct
#define DecWordReg(Reg) \
unsigned tmp = (unsigned)I.regs.w[Reg]; \
unsigned tmp1 = tmp-1; \
uint16_t tmp = (uint16_t)I.regs.w[Reg]; \
uint16_t tmp1 = tmp-1; \
I.OverVal = (tmp == 0x8000); \
SetAF(tmp1,tmp,1); \
SetSZPF_Word(tmp1); \
@ -317,8 +317,8 @@ typedef struct
#define ADD4S { \
int i,v1,v2,result; \
int count = (I.regs.b[CL]+1)/2; \
unsigned di = I.regs.w[IY]; \
unsigned si = I.regs.w[IX]; \
uint16_t di = I.regs.w[IY]; \
uint16_t si = I.regs.w[IX]; \
I.ZeroVal = I.CarryVal = 0; \
for (i=0;i<count;i++) { \
tmp = GetMemB(DS, si); \
@ -339,8 +339,8 @@ typedef struct
#define SUB4S { \
int count = (I.regs.b[CL]+1)/2; \
int i,v1,v2,result; \
unsigned di = I.regs.w[IY]; \
unsigned si = I.regs.w[IX]; \
uint16_t di = I.regs.w[IY]; \
uint16_t si = I.regs.w[IX]; \
I.ZeroVal = I.CarryVal = 0; \
for (i=0;i<count;i++) { \
tmp = GetMemB(ES, di); \
@ -366,8 +366,8 @@ typedef struct
#define CMP4S { \
int count = (I.regs.b[CL]+1)/2; \
int i,v1,v2,result; \
unsigned di = I.regs.w[IY]; \
unsigned si = I.regs.w[IX]; \
uint16_t di = I.regs.w[IY]; \
uint16_t si = I.regs.w[IX]; \
I.ZeroVal = I.CarryVal = 0; \
for (i=0;i<count;i++) { \
tmp = GetMemB(ES, di); \

View File

@ -75,6 +75,7 @@ void ws_patchRom(void)
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
@ -87,7 +88,7 @@ void ws_patchRom(void)
rom[0xfffeb]=0x00;
rom[0xfffec]=0x20;
}
}*/
if (!ws_cyclesByLine) ws_cyclesByLine=256;
}

View File

@ -29,7 +29,7 @@ extern "C" {
#ifndef WINAPI
/* atomic data types definitions */
#if 0
typedef void VOID;
typedef char CHAR;
typedef int INT;
@ -40,7 +40,18 @@ extern "C" {
typedef unsigned short WORD;
typedef unsigned int UINT;
typedef unsigned long DWORD;
#else
typedef void VOID;
typedef int8_t CHAR;
typedef int32_t INT;
typedef int32_t LONG;
typedef int8_t BOOL;
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t UINT;
typedef uint32_t DWORD;
#endif
typedef VOID* LPVOID;
typedef CHAR* LPCHAR;
typedef INT* LPINT;
@ -50,8 +61,8 @@ extern "C" {
typedef WORD* LPWORD;
typedef UINT* LPUINT;
typedef DWORD* LPDWORD;
typedef CHAR* LPSTR;
typedef DWORD HANDLE;
typedef char* LPSTR;
typedef uint64_t HANDLE;
/* helper macros */
#define LOBYTE(s) ((BYTE)(s))

Binary file not shown.

View File

@ -1,11 +1,11 @@
# Makefile for Linux and SDL wrapper driver...
CC = clang
CC = gcc
AR = ar
RANLIB = ranlib
STRIP = strip
CFLAGS = -g -c -Wall -O2 -D__SDL__ `sdl-config --cflags` -arch i386
LFLAGS = -L../lib/SDL -laudio `sdl-config --libs` -arch i386
CFLAGS = -g -c -Wall -O2 -D__SDL__ `sdl-config --cflags` -Wall -Werror
LFLAGS = -L../lib/SDL -laudio `sdl-config --libs`
OBJS = audio.o wavfile.o xmfile.o s3mfile.o modfile.o mtmfile.o \
iofile.o modeng.o nondrv.o mixdrv.o sdldrv.o

View File

@ -45,14 +45,14 @@ extern "C" {
typedef unsigned long DWORD;
#else
typedef void VOID;
typedef int8_t CHAR;
typedef char CHAR;
typedef int32_t INT;
typedef int32_t LONG;
typedef int8_t BOOL;
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t UINT;
typedef uint16_t UINT;
typedef uint32_t DWORD;
#endif
typedef VOID* LPVOID;
@ -64,8 +64,8 @@ extern "C" {
typedef WORD* LPWORD;
typedef UINT* LPUINT;
typedef DWORD* LPDWORD;
typedef CHAR* LPSTR;
typedef DWORD HANDLE;
typedef char* LPSTR;
typedef uintptr_t HANDLE;
/* helper macros */
#define LOBYTE(s) ((BYTE)(s))
@ -215,7 +215,7 @@ extern "C" {
/* audio waveform structure */
typedef struct {
LPBYTE lpData; /* data pointer */
DWORD dwHandle; /* waveform handle */
uintptr_t dwHandle; /* waveform handle */
DWORD dwLength; /* waveform length */
DWORD dwLoopStart; /* loop start point */
DWORD dwLoopEnd; /* loop end point */
@ -277,7 +277,7 @@ extern "C" {
/* audio module structure */
typedef struct {
CHAR szModuleName[32]; /* module name */
char szModuleName[32]; /* module name */
WORD wFlags; /* module flags */
WORD nOrders; /* number of orders */
WORD nRestart; /* restart position */

View File

@ -557,11 +557,14 @@ static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
Synth.lpMemory = malloc(sizeof(LONG) * 65 * 256 +
sizeof(BYTE) * 32 * 256 + 1023);
if (Synth.lpMemory != NULL) {
lpVolumeTable = (LPLONG) (((DWORD) Synth.lpMemory + 1023) & ~1023);
lpFilterTable = (LPBYTE) (lpVolumeTable + 65 * 256);
ASetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME, 96);
ASetAudioCallback(UpdateVoices);
return AUDIO_ERROR_NONE;
uint64_t tmp;
tmp = ((uint64_t)(Synth.lpMemory) + 1023) & ~1023;
lpVolumeTable = (LPLONG)(tmp);
lpFilterTable = (LPBYTE) (lpVolumeTable + 65 * 256);
ASetAudioMixerValue(AUDIO_MIXER_MASTER_VOLUME, 96);
ASetAudioCallback(UpdateVoices);
return AUDIO_ERROR_NONE;
}
return AUDIO_ERROR_NOMEMORY;
}
@ -659,7 +662,7 @@ static LONG AIAPI GetAudioDataAvail(VOID)
static UINT AIAPI CreateAudioData(LPAUDIOWAVE lpWave)
{
if (lpWave != NULL) {
lpWave->dwHandle = (DWORD) lpWave->lpData;
lpWave->dwHandle = (uintptr_t) lpWave->lpData;
return AUDIO_ERROR_NONE;
}
return AUDIO_ERROR_INVALHANDLE;

View File

@ -14,6 +14,7 @@
#ifdef __GNUC__
#include <memory.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "audio.h"

View File

@ -217,8 +217,7 @@ UINT AIAPI ALoadModuleMOD(LPSTR lpszFileName,
}
/* initialize the module structure */
strncpy(lpModule->szModuleName, Header.aModuleName,
sizeof(Header.aModuleName));
strncpy(lpModule->szModuleName, Header.aModuleName, sizeof(lpModule->szModuleName));
lpModule->wFlags = AUDIO_MODULE_AMIGA | AUDIO_MODULE_PANNING;
lpModule->nOrders = Header.nSongLength;
lpModule->nRestart = Header.nRestart;
@ -262,8 +261,7 @@ UINT AIAPI ALoadModuleMOD(LPSTR lpszFileName,
lpPatch = lpModule->aPatchTable;
for (n = 0; n < lpModule->nPatches; n++, lpPatch++) {
memcpy(&Sample, &Header.aSampleTable[n], sizeof(MODSAMPLEHEADER));
strncpy(lpPatch->szPatchName, Sample.aSampleName,
sizeof(Sample.aSampleName));
strncpy(lpPatch->szPatchName, Sample.aSampleName, sizeof(lpPatch->szPatchName));
if (Sample.wLength != 0) {
if ((lpSample = (LPAUDIOSAMPLE)
calloc(1, sizeof(AUDIOSAMPLE))) == NULL) {

Binary file not shown.

View File

@ -36,7 +36,7 @@ struct {
void Assert(UINT nErrorCode)
{
static CHAR szText[80];
static char szText[80];
if (nErrorCode != AUDIO_ERROR_NONE) {
AGetErrorText(nErrorCode, szText, sizeof(szText) - 1);
@ -194,7 +194,8 @@ int main(int argc, char *argv[])
State.nVolume = 96;
/* parse command line options */
for (n = 1; n < argc && (lpszOption = argv[n])[0] == '-'; n++) {
for (n = 1; n < argc && argv[n][0] == '-'; n++) {
lpszOption = argv[n];
lpszOptArg = &lpszOption[2];
if (strchr("crv", lpszOption[1]) && !lpszOptArg[0] && n < argc - 1)
lpszOptArg = argv[++n];

View File

@ -126,8 +126,7 @@ static UINT MTMMakeSample(LPAUDIOPATCH lpPatch, LPMTMSAMPLE lpMTMSample)
DWORD dwCount;
UINT rc;
strncpy(lpPatch->szPatchName, lpMTMSample->szSampleName,
sizeof(lpMTMSample->szSampleName));
strncpy(lpPatch->szPatchName, lpMTMSample->szSampleName, sizeof(lpPatch->szPatchName) - 1);
if (lpMTMSample->dwLength) {
if ((lpSample = (LPAUDIOSAMPLE) calloc(1, sizeof(AUDIOSAMPLE))) == NULL)
return AUDIO_ERROR_NOMEMORY;
@ -203,8 +202,7 @@ UINT AIAPI ALoadModuleMTM(LPSTR lpszFileName,
}
/* build the local module header structure */
strncpy(lpModule->szModuleName, Header.szModuleName,
sizeof(Header.szModuleName));
strncpy(lpModule->szModuleName, Header.szModuleName, sizeof(lpModule->szModuleName));
lpModule->wFlags = AUDIO_MODULE_AMIGA | AUDIO_MODULE_PANNING;
lpModule->nOrders = Header.nOrders + 1;
lpModule->nRestart = AUDIO_MAX_ORDERS;

View File

@ -585,7 +585,7 @@ UINT AIAPI ALoadModuleS3M(LPSTR lpszFileName,
AIOReadFile(Header.aReserved, sizeof(Header.aReserved));
AIOReadShort(&Header.wSpecial);
AIOReadFile(Header.aChannelTable, sizeof(Header.aChannelTable));
printf("[%lX] vs [%lX]\n", Header.dwSCRM, S3M_SCRM_MAGIC);
printf("[%X] vs [%lX]\n", Header.dwSCRM, S3M_SCRM_MAGIC);
if (Header.dwSCRM != S3M_SCRM_MAGIC ||
Header.nSongLength > S3M_MAX_ORDERS ||
Header.nPatterns > S3M_MAX_PATTERNS ||

View File

@ -74,8 +74,9 @@ static void updatecallback(void *userdata, Uint8 *stream, int len);
static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
{
int nBitsPerSample, nStereoOn, nSampleRate, nFrags;
//int nBitsPerSample, nStereoOn, nSampleRate, nFrags;
int nStereoOn;
memset(&Audio, 0, sizeof(Audio));
if (!SDL_WasInit(SDL_INIT_EVERYTHING))
@ -90,7 +91,7 @@ static UINT AIAPI OpenAudio(LPAUDIOINFO lpInfo)
return AUDIO_ERROR_NODEVICE;
nBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
//nBitsPerSample = lpInfo->wFormat & AUDIO_FORMAT_16BITS ? 16 : 8;
nStereoOn = lpInfo->wFormat & AUDIO_FORMAT_STEREO ? 1 : 0;
/*nSampleRate = lpInfo->nSampleRate;*/

View File

@ -184,8 +184,7 @@ UINT AIAPI ALoadModuleXM(LPSTR lpszFileName,
}
/* initialize module structure */
strncpy(lpModule->szModuleName, Header.aModuleName,
sizeof(Header.aModuleName));
strncpy(lpModule->szModuleName, Header.aModuleName, sizeof(lpModule->szModuleName));
if (Header.wFlags & XM_MODULE_LINEAR)
lpModule->wFlags |= AUDIO_MODULE_LINEAR;
lpModule->nOrders = Header.nSongLength;
@ -296,8 +295,7 @@ UINT AIAPI ALoadModuleXM(LPSTR lpszFileName,
}
/* initialize patch structure */
strncpy(lpPatch->szPatchName, Patch.aPatchName,
sizeof(Patch.aPatchName));
strncpy(lpPatch->szPatchName, Patch.aPatchName, sizeof(lpPatch->szPatchName));
for (m = 0; m < AUDIO_MAX_NOTES; m++) {
lpPatch->aSampleNumber[m] = Patch.aSampleNumber[m];
if (lpPatch->aSampleNumber[m] >= Patch.nSamples)
@ -365,8 +363,7 @@ UINT AIAPI ALoadModuleXM(LPSTR lpszFileName,
AIOReadFile(Sample.aSampleName, sizeof(Sample.aSampleName));
AIOSeekFile(Patch.dwSampleHeaderSize -
XM_SAMPLE_HEADER_SIZE, SEEK_CUR);
strncpy(lpSample->szSampleName, Sample.aSampleName,
sizeof(Sample.aSampleName));
strncpy(lpSample->szSampleName, Sample.aSampleName, sizeof(lpSample->szSampleName));
lpSample->Wave.dwLength = Sample.dwLength;
lpSample->Wave.dwLoopStart = Sample.dwLoopStart;
lpSample->Wave.dwLoopEnd = Sample.dwLoopStart + Sample.dwLoopLength;