Merge branch 'applewin'
This commit is contained in:
commit
1b40c217f4
10 changed files with 64 additions and 143 deletions
|
@ -64,15 +64,18 @@
|
|||
-load-state <savestate><br>
|
||||
Load a save-state file (and auto power-on the Apple II).<br>
|
||||
NB. This takes precedent over the -d1, -d2, -s#d#, -h1, -h2, s0-7, -model and -r switches.<br><br>
|
||||
-f<br>
|
||||
Start in full-screen mode<br><br>
|
||||
-f or -full-screen<br>
|
||||
Start in full-screen mode.<br><br>
|
||||
-no-full-screen<br>
|
||||
Start in Windowed mode (default).<br><br>
|
||||
-fs-height=<best|nnnn><br>
|
||||
Use to select a better resolution for full-screen mode.<br>
|
||||
Use to select a better resolution for full-screen or Windowed mode.<br>
|
||||
<ul>
|
||||
<li>best: picks the highest resolution where the height is an integer multiple of (192*2)</li>
|
||||
<li>nnnn: select a specific resolution with height=nnnn pixels</li>
|
||||
</ul>
|
||||
NB. This changes the display resolution (and restores on exit).<br><br>
|
||||
NB. This changes the display resolution (and restores on exit).<br>
|
||||
NB. Specify -no-full-screen after this switch for Windowed mode. Without this it'll just default to full-screen.<br><br>
|
||||
-rom <file><br>
|
||||
Use custom 12K ROM (at $D000) for Apple II machine, or 16K ROM (at $C000) for Apple //e machine.<br><br>
|
||||
-f8rom <file><br>
|
||||
|
|
|
@ -189,14 +189,18 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
|
|||
lpNextArg = GetNextArg(lpNextArg);
|
||||
g_cmdLine.szSnapshotName = lpCmdLine;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-f") == 0)
|
||||
else if (strcmp(lpCmdLine, "-f") == 0 || strcmp(lpCmdLine, "-full-screen") == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = true;
|
||||
}
|
||||
else if (strcmp(lpCmdLine, "-no-full-screen") == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = false;
|
||||
}
|
||||
#define CMD_FS_HEIGHT "-fs-height="
|
||||
else if (strncmp(lpCmdLine, CMD_FS_HEIGHT, sizeof(CMD_FS_HEIGHT)-1) == 0)
|
||||
{
|
||||
g_cmdLine.bSetFullScreen = true; // Implied
|
||||
g_cmdLine.bSetFullScreen = true; // Implied. Can be overridden by "-no-full-screen"
|
||||
|
||||
LPSTR lpTmp = lpCmdLine + sizeof(CMD_FS_HEIGHT)-1;
|
||||
bool bRes = false;
|
||||
|
|
|
@ -554,7 +554,7 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd
|
|||
*(imageptr++) = 0xD5;
|
||||
*(imageptr++) = 0xAA;
|
||||
*(imageptr++) = 0xAD;
|
||||
CopyMemory(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343);
|
||||
memcpy(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343);
|
||||
imageptr += 343;
|
||||
*(imageptr++) = 0xDE;
|
||||
*(imageptr++) = 0xAA;
|
||||
|
@ -575,9 +575,9 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd
|
|||
void CImageBase::SkewTrack(const int nTrack, const int nNumNibbles, const LPBYTE pTrackImageBuffer)
|
||||
{
|
||||
int nSkewBytes = (nTrack*768) % nNumNibbles;
|
||||
CopyMemory(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
|
||||
CopyMemory(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
|
||||
CopyMemory(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes);
|
||||
memcpy(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles);
|
||||
memcpy(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes);
|
||||
memcpy(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
|
|
@ -597,7 +597,7 @@ static BYTE __stdcall HD_IO_EMUL(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG
|
|||
}
|
||||
}
|
||||
|
||||
MoveMemory(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE);
|
||||
memmove(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE);
|
||||
|
||||
if (bRes)
|
||||
bRes = ImageWriteBlock(pHDD->imagehandle, pHDD->hd_diskblock, pHDD->hd_buf);
|
||||
|
|
|
@ -1132,7 +1132,7 @@ static void UpdatePaging(BOOL initialize)
|
|||
// SAVE THE CURRENT PAGING SHADOW TABLE
|
||||
LPBYTE oldshadow[256];
|
||||
if (!initialize)
|
||||
CopyMemory(oldshadow,memshadow,256*sizeof(LPBYTE));
|
||||
memcpy(oldshadow,memshadow,256*sizeof(LPBYTE));
|
||||
|
||||
// UPDATE THE PAGING TABLES BASED ON THE NEW PAGING SWITCH VALUES
|
||||
UINT loop;
|
||||
|
@ -1245,10 +1245,10 @@ static void UpdatePaging(BOOL initialize)
|
|||
((*(memdirty+loop) & 1) || (loop <= 1)))
|
||||
{
|
||||
*(memdirty+loop) &= ~1;
|
||||
CopyMemory(oldshadow[loop],mem+(loop << 8),256);
|
||||
memcpy(oldshadow[loop],mem+(loop << 8),256);
|
||||
}
|
||||
|
||||
CopyMemory(mem+(loop << 8),memshadow[loop],256);
|
||||
memcpy(mem+(loop << 8),memshadow[loop],256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1320,7 +1320,7 @@ static void BackMainImage(void)
|
|||
for (UINT loop = 0; loop < 256; loop++)
|
||||
{
|
||||
if (memshadow[loop] && ((*(memdirty+loop) & 1) || (loop <= 1)))
|
||||
CopyMemory(memshadow[loop], mem+(loop << 8), 256);
|
||||
memcpy(memshadow[loop], mem+(loop << 8), 256);
|
||||
|
||||
*(memdirty+loop) &= ~1;
|
||||
}
|
||||
|
|
|
@ -1649,6 +1649,9 @@ void MB_Destroy()
|
|||
|
||||
for (int id=0; id<kNumSyncEvents; id++)
|
||||
{
|
||||
if (g_syncEvent[id] && g_syncEvent[id]->m_active)
|
||||
g_SynchronousEventMgr.Remove(id);
|
||||
|
||||
delete g_syncEvent[id];
|
||||
g_syncEvent[id] = NULL;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot);
|
||||
// void Uninitialize();
|
||||
void Reset();
|
||||
UINT GetSlot(void) { return m_uSlot; }
|
||||
static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
|
||||
static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles);
|
||||
|
||||
|
|
100
source/NTSC.cpp
100
source/NTSC.cpp
|
@ -31,6 +31,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
|
||||
#include "NTSC_CharSet.h"
|
||||
|
||||
// Some reference material here from 2000:
|
||||
// http://www.kreativekorp.com/miscpages/a2info/munafo.shtml
|
||||
//
|
||||
|
||||
#define NTSC_REMOVE_WHITE_RINGING 1 // 0 = theoritical dimmed white has chroma, 1 = pure white without chroma tinting
|
||||
#define NTSC_REMOVE_BLACK_GHOSTING 1 // 1 = remove black smear/smudges carrying over
|
||||
|
@ -64,47 +67,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
//#define CYCLESTART (PI/4.f) // PI/4 = 45 degrees
|
||||
#define CYCLESTART (DEG_TO_RAD(45))
|
||||
|
||||
// Types
|
||||
|
||||
struct ColorSpace_PAL_t // Phase Amplitute Luma
|
||||
{
|
||||
float phase;
|
||||
float amp;
|
||||
float luma;
|
||||
};
|
||||
|
||||
struct ColorSpace_YIQ_t
|
||||
{
|
||||
float y, i, q;
|
||||
};
|
||||
|
||||
struct rgba_t
|
||||
{
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
uint8_t a;
|
||||
};
|
||||
|
||||
struct abgr_t
|
||||
{
|
||||
uint8_t a;
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
};
|
||||
|
||||
struct ColorSpace_BGRA_t
|
||||
{
|
||||
union
|
||||
{
|
||||
uint32_t n;
|
||||
bgra_t bgra;
|
||||
rgba_t rgba;
|
||||
abgr_t abgr;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Globals (Public) ___________________________________________________
|
||||
uint16_t g_nVideoClockVert = 0; // 9-bit: VC VB VA V5 V4 V3 V2 V1 V0 = 0 .. 262
|
||||
|
@ -345,62 +307,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
http://www.kreativekorp.com/miscpages/a2info/munafo.shtml
|
||||
|
||||
"Primary" lo-res colors
|
||||
Color GR Duty cycle Phase
|
||||
======================================
|
||||
Red COLOR=1 45 to 135 90
|
||||
Dark-blue COLOR=2 315 to 45 0
|
||||
Dark-green COLOR=4 225 to 315 270
|
||||
Brown COLOR=8 135 to 225 180
|
||||
*/
|
||||
ColorSpace_PAL_t aPaletteYIQ[ 16 ] =
|
||||
{ // Lo Hi Dh
|
||||
{ 0, 0, 0 } // 0 0 Black
|
||||
,{ 90, 60, 25 } // 1 1 Red
|
||||
,{ 0, 60, 25 } // 2 8 Dark Blue
|
||||
,{ 45,100, 50 } // 3 2 9 Purple
|
||||
,{270, 60, 25 } // 4 Dark Green
|
||||
,{ 0, 0, 50 } // 5 Grey
|
||||
,{315,100, 50 } // 6 Medium Blue
|
||||
,{ 0, 60, 75 } // 7 Light Blue
|
||||
,{180, 60, 25 } // 8 Brown
|
||||
,{135,100, 50 } // 9 Orange
|
||||
,{ 0, 0, 50 } // 10
|
||||
,{ 90, 60, 75 } // 11 Pink
|
||||
,{225,100, 50 } // 12 Light Green
|
||||
,{180, 60, 75 } // 13 Yellow
|
||||
,{270, 60, 75} // 14 Aqua
|
||||
,{ 0, 0,100 } // 15 White
|
||||
};
|
||||
|
||||
// purple HCOLOR=2 45 100 50 255 68 253
|
||||
// orange HCOLOR=5 135 100 50 255 106 60
|
||||
// green HCOLOR=1 225 100 50 20 245 60
|
||||
// blue HCOLOR=6 315 100 50 20 207 253
|
||||
|
||||
rgba_t aPaletteRGB[ 16 ] =
|
||||
{
|
||||
{ 0, 0, 0 } // 0
|
||||
,{ 227, 30, 96 } // 1
|
||||
,{ 96, 78, 189 } // 2
|
||||
,{ 255, 68, 253 } // 3
|
||||
,{ 0, 163, 96 } // 4
|
||||
,{ 156, 156, 156 } // 5
|
||||
,{ 20, 207, 253 } // 6
|
||||
,{ 208, 195, 255 } // 7
|
||||
,{ 96, 114, 3 } // 8
|
||||
,{ 255, 106, 60 } // 9
|
||||
,{ 156, 156, 156 } // 10
|
||||
,{ 255, 160, 208 } // 11
|
||||
,{ 20, 245, 60 } // 12
|
||||
,{ 208, 221, 141 } // 13
|
||||
,{ 114, 255, 208 } // 14
|
||||
,{ 255, 255, 255 } // 15
|
||||
};
|
||||
|
||||
static csbits_t csbits; // charset, optionally followed by alt charset
|
||||
|
||||
// Prototypes
|
||||
|
|
|
@ -653,19 +653,23 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
|
|||
MB_Reset();
|
||||
LogFileOutput("Main: MB_Reset()\n");
|
||||
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
if (pMouseCard)
|
||||
if (g_bRestart)
|
||||
{
|
||||
pMouseCard->Reset(); // Deassert any pending IRQs - GH#514
|
||||
LogFileOutput("Main: CMouseInterface::Uninitialize()\n");
|
||||
CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard();
|
||||
if (pMouseCard)
|
||||
{
|
||||
// dtor removes event from g_SynchronousEventMgr - do before g_SynchronousEventMgr.Reset()
|
||||
GetCardMgr().Remove( pMouseCard->GetSlot() );
|
||||
LogFileOutput("Main: CMouseInterface::dtor\n");
|
||||
}
|
||||
|
||||
_ASSERT(g_SynchronousEventMgr.GetHead() == NULL);
|
||||
g_SynchronousEventMgr.Reset();
|
||||
}
|
||||
|
||||
DSUninit();
|
||||
LogFileOutput("Main: DSUninit()\n");
|
||||
|
||||
if (g_bRestart)
|
||||
g_SynchronousEventMgr.Reset();
|
||||
|
||||
if (g_bHookSystemKey)
|
||||
{
|
||||
UninitHookThread();
|
||||
|
@ -985,23 +989,23 @@ static void RepeatInitialization(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (g_cmdLine.bestWidth && g_cmdLine.bestHeight)
|
||||
{
|
||||
DEVMODE devMode;
|
||||
memset(&devMode, 0, sizeof(devMode));
|
||||
devMode.dmSize = sizeof(devMode);
|
||||
devMode.dmPelsWidth = g_cmdLine.bestWidth;
|
||||
devMode.dmPelsHeight = g_cmdLine.bestHeight;
|
||||
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
DWORD dwFlags = 0;
|
||||
LONG res = ChangeDisplaySettings(&devMode, dwFlags);
|
||||
if (res == 0)
|
||||
g_cmdLine.bChangedDisplayResolution = true;
|
||||
}
|
||||
|
||||
if (g_cmdLine.bSetFullScreen)
|
||||
{
|
||||
if (g_cmdLine.bestWidth && g_cmdLine.bestHeight)
|
||||
{
|
||||
DEVMODE devMode;
|
||||
memset(&devMode, 0, sizeof(devMode));
|
||||
devMode.dmSize = sizeof(devMode);
|
||||
devMode.dmPelsWidth = g_cmdLine.bestWidth;
|
||||
devMode.dmPelsHeight = g_cmdLine.bestHeight;
|
||||
devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
|
||||
|
||||
DWORD dwFlags = 0;
|
||||
LONG res = ChangeDisplaySettings(&devMode, dwFlags);
|
||||
if (res == 0)
|
||||
g_cmdLine.bChangedDisplayResolution = true;
|
||||
}
|
||||
|
||||
PostMessage(g_hFrameWindow, WM_USER_FULLSCREEN, 0, 0);
|
||||
g_cmdLine.bSetFullScreen = false;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ void VideoBenchmark () {
|
|||
DWORD totaltextfps = 0;
|
||||
|
||||
g_uVideoMode = VF_TEXT;
|
||||
FillMemory(mem+0x400,0x400,0x14);
|
||||
memset(mem+0x400,0x14,0x400);
|
||||
VideoRedrawScreen();
|
||||
DWORD milliseconds = GetTickCount();
|
||||
while (GetTickCount() == milliseconds) ;
|
||||
|
@ -159,9 +159,9 @@ void VideoBenchmark () {
|
|||
DWORD cycle = 0;
|
||||
do {
|
||||
if (cycle & 1)
|
||||
FillMemory(mem+0x400,0x400,0x14);
|
||||
memset(mem+0x400,0x14,0x400);
|
||||
else
|
||||
CopyMemory(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400);
|
||||
memcpy(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400);
|
||||
VideoRefreshScreen();
|
||||
if (cycle++ >= 3)
|
||||
cycle = 0;
|
||||
|
@ -173,7 +173,7 @@ void VideoBenchmark () {
|
|||
// SIMULATE THE ACTIVITY OF AN AVERAGE GAME
|
||||
DWORD totalhiresfps = 0;
|
||||
g_uVideoMode = VF_HIRES;
|
||||
FillMemory(mem+0x2000,0x2000,0x14);
|
||||
memset(mem+0x2000,0x14,0x2000);
|
||||
VideoRedrawScreen();
|
||||
milliseconds = GetTickCount();
|
||||
while (GetTickCount() == milliseconds) ;
|
||||
|
@ -181,9 +181,9 @@ void VideoBenchmark () {
|
|||
cycle = 0;
|
||||
do {
|
||||
if (cycle & 1)
|
||||
FillMemory(mem+0x2000,0x2000,0x14);
|
||||
memset(mem+0x2000,0x14,0x2000);
|
||||
else
|
||||
CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
|
||||
memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
|
||||
VideoRefreshScreen();
|
||||
if (cycle++ >= 3)
|
||||
cycle = 0;
|
||||
|
@ -257,7 +257,7 @@ void VideoBenchmark () {
|
|||
// WITH FULL EMULATION OF THE CPU, JOYSTICK, AND DISK HAPPENING AT
|
||||
// THE SAME TIME
|
||||
DWORD realisticfps = 0;
|
||||
FillMemory(mem+0x2000,0x2000,0xAA);
|
||||
memset(mem+0x2000,0xAA,0x2000);
|
||||
VideoRedrawScreen();
|
||||
milliseconds = GetTickCount();
|
||||
while (GetTickCount() == milliseconds) ;
|
||||
|
@ -274,9 +274,9 @@ void VideoBenchmark () {
|
|||
}
|
||||
}
|
||||
if (cycle & 1)
|
||||
FillMemory(mem+0x2000,0x2000,0xAA);
|
||||
memset(mem+0x2000,0xAA,0x2000);
|
||||
else
|
||||
CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
|
||||
memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000);
|
||||
VideoRedrawScreen();
|
||||
if (cycle++ >= 3)
|
||||
cycle = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue