From 9f8ad1a65b3f2080ffa775de1e67630390c85133 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 21 Jul 2014 18:21:31 -0700 Subject: [PATCH 01/35] WIP show current disk track --- source/Disk.cpp | 12 ++++++++ source/Disk.h | 1 + source/Frame.cpp | 77 ++++++++++++++++++++++++++++++++++++++---------- source/Frame.h | 2 ++ 4 files changed, 77 insertions(+), 15 deletions(-) diff --git a/source/Disk.cpp b/source/Disk.cpp index 938bdc00..56e31b2c 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -64,6 +64,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA string strFilenameInZip; // 0x00 or HIMAGE imagehandle; // Init'd by DiskInsert() -> ImageOpen() int track; + int nLastTrack; LPBYTE trackimage; int phase; int byte; @@ -82,6 +83,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA strFilenameInZip = other.strFilenameInZip; imagehandle = other.imagehandle; track = other.track; + nLastTrack = other.nLastTrack; trackimage = other.trackimage; phase = other.phase; byte = other.byte; @@ -117,6 +119,7 @@ int DiskGetCurrentDrive(void) { return currdrive; } int DiskGetCurrentTrack(void) { return g_aFloppyDisk[currdrive].track; } int DiskGetCurrentPhase(void) { return g_aFloppyDisk[currdrive].phase; } int DiskGetCurrentOffset(void) { return g_aFloppyDisk[currdrive].byte; } +int DiskGetTrack( int drive ) { return g_aFloppyDisk[ drive ].track; } const string& DiskGetDiskPathFilename(const int iDrive) { @@ -784,6 +787,15 @@ static BYTE __stdcall DiskReadWrite (WORD programcounter, WORD, BYTE, BYTE, ULON if (!fptr->trackimagedata) return 0xFF; + // Bug # .. Show Track status + if( fptr->nLastTrack != fptr->track ) + { + fptr->nLastTrack = fptr->track; + + //FrameRefreshStatus(DRAW_LEDS); + DrawStatusAreaDisk( (HDC)0 ); + } + BYTE result = 0; if (!floppywritemode || !fptr->bWriteProtected) diff --git a/source/Disk.h b/source/Disk.h index 58a522ca..c38b346b 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -62,6 +62,7 @@ bool DiskGetProtect(const int iDrive); void DiskSetProtect(const int iDrive, const bool bWriteProtect); int DiskGetCurrentDrive(); int DiskGetCurrentTrack(); +int DiskGetTrack( int drive ); int DiskGetCurrentPhase(); int DiskGetCurrentOffset(); char* DiskGetCurrentState(); diff --git a/source/Frame.cpp b/source/Frame.cpp index 7ed59233..5e87c8b3 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -546,6 +546,62 @@ static void DrawFrameWindow () } +void DrawStatusAreaDisk( HDC passdc ) +{ + FrameReleaseDC(); + HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); +// HDC dc = g_hFrameDC; + + int x = buttonx; + int y = buttony+BUTTONS*BUTTONCY+1; + + Disk_Status_e eDrive1Status = DISK_STATUS_OFF; + Disk_Status_e eDrive2Status = DISK_STATUS_OFF; + DiskGetLightStatus(&eDrive1Status, &eDrive2Status); + + int Disk1Track = DiskGetTrack(0); + int Disk2Track = DiskGetTrack(1); + + if (g_bIsFullScreen) + { +/* + SelectObject(dc,smallfont); + SetBkMode(dc,OPAQUE); + SetBkColor(dc,RGB(0,0,0)); + SetTextAlign(dc,TA_LEFT | TA_TOP); +*/ + SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); + TextOut(dc,x+ 3,y+2,TEXT("1"),1); + + SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); + TextOut(dc,x+13,y+2,TEXT("2"),1); + } + else + { + RECT rDiskLed = {0,0,8,8}; + + DrawBitmapRect(dc,x+12,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive1Status]); + DrawBitmapRect(dc,x+31,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive2Status]); + + // Track/Sector + SelectObject(dc,smallfont); + SetTextAlign(dc,TA_CENTER | TA_TOP); + SetTextColor(dc,RGB(0,0,0)); + SetBkMode(dc,TRANSPARENT); +// SetBkMode(dc,OPAQUE); + + char buffer[16] = ""; + sprintf_s( buffer, sizeof(buffer), "%2d ", Disk1Track ); + TextOut(dc,x+16,y+5,buffer, strlen(buffer) ); // 1 + + sprintf_s( buffer, sizeof(buffer), "%2d ", Disk2Track ); + TextOut(dc,x+35,y+5,buffer, strlen(buffer) ); + } + +// if (!passdc) +// ReleaseDC(g_hFrameWindow,dc); +} + //=========================================================================== static void DrawStatusArea (HDC passdc, int drawflags) { @@ -556,10 +612,6 @@ static void DrawStatusArea (HDC passdc, int drawflags) const bool bCaps = KeybGetCapsStatus(); //const bool bP8Caps = KeybGetP8CapsStatus(); // TODO: FIXME: Not used ?! Should show the LED status ... - Disk_Status_e eDrive1Status = DISK_STATUS_OFF; - Disk_Status_e eDrive2Status = DISK_STATUS_OFF; - DiskGetLightStatus(&eDrive1Status, &eDrive2Status); - #if HD_LED // 1.19.0.0 Hard Disk Status/Indicator Light Disk_Status_e eHardDriveStatus = DISK_STATUS_OFF; @@ -573,11 +625,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) SetBkColor(dc,RGB(0,0,0)); SetTextAlign(dc,TA_LEFT | TA_TOP); - SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); - TextOut(dc,x+ 3,y+2,TEXT("1"),1); - - SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); - TextOut(dc,x+13,y+2,TEXT("2"),1); +// DrawStatusAreaDisk( passdc ); #if HD_LED SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] ); @@ -618,9 +666,8 @@ static void DrawStatusArea (HDC passdc, int drawflags) TextOut(dc,x+BUTTONCX/2,y+13,(g_nAppMode == MODE_PAUSED ? TITLE_PAUSED : TITLE_STEPPING) ,8); - } - else + else // g_bIsFullScreen { if (drawflags & DRAW_BACKGROUND) { @@ -638,12 +685,10 @@ static void DrawStatusArea (HDC passdc, int drawflags) // 1.19.0.0 Hard Disk Status/Indicator Light TextOut(dc,x+ 7,y+17,TEXT("H"),1); } + if (drawflags & DRAW_LEDS) { - RECT rDiskLed = {0,0,8,8}; - - DrawBitmapRect(dc,x+12,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive1Status]); - DrawBitmapRect(dc,x+31,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive2Status]); + DrawStatusAreaDisk( dc ); if (!IS_APPLE2) { @@ -662,6 +707,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) #if HD_LED // 1.19.0.0 Hard Disk Status/Indicator Light + RECT rDiskLed = {0,0,8,8}; DrawBitmapRect(dc,x+12,y+18,&rDiskLed,g_hDiskWindowedLED[eHardDriveStatus]); #endif } @@ -672,6 +718,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) GetAppleWindowTitle(); // SetWindowText() // WindowTitle SendMessage(g_hFrameWindow,WM_SETTEXT,0,(LPARAM)g_pAppTitle); } + if (drawflags & DRAW_BUTTON_DRIVES) { DrawButton(dc, BTN_DRIVE1); diff --git a/source/Frame.h b/source/Frame.h index 824ca907..8c882d56 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -48,6 +48,8 @@ bool GetFullScreen32Bit(void); void SetFullScreen32Bit(bool b32Bit); + void DrawStatusAreaDisk( HDC hdc ); + LRESULT CALLBACK FrameWndProc ( HWND window, UINT message, From e8fda39cae1a0ed7e11251ba3bb98a208a8d162e Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 21 Jul 2014 22:56:57 -0700 Subject: [PATCH 02/35] #201 Fix display of track status in full-screen and windowed mode ... http://imgur.com/KzKpwIv --- source/Disk.cpp | 3 ++- source/Frame.cpp | 70 +++++++++++++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/source/Disk.cpp b/source/Disk.cpp index 56e31b2c..bf692fbf 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -787,7 +787,8 @@ static BYTE __stdcall DiskReadWrite (WORD programcounter, WORD, BYTE, BYTE, ULON if (!fptr->trackimagedata) return 0xFF; - // Bug # .. Show Track status + // Feature Request #201 Show track status + // https://github.com/AppleWin/AppleWin/issues/201 if( fptr->nLastTrack != fptr->track ) { fptr->nLastTrack = fptr->track; diff --git a/source/Frame.cpp b/source/Frame.cpp index 5e87c8b3..25a70354 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -550,7 +550,6 @@ void DrawStatusAreaDisk( HDC passdc ) { FrameReleaseDC(); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); -// HDC dc = g_hFrameDC; int x = buttonx; int y = buttony+BUTTONS*BUTTONCY+1; @@ -562,19 +561,29 @@ void DrawStatusAreaDisk( HDC passdc ) int Disk1Track = DiskGetTrack(0); int Disk2Track = DiskGetTrack(1); + SelectObject(dc,smallfont); + SetBkMode(dc,OPAQUE); + SetBkColor(dc,RGB(0,0,0)); + SetTextAlign(dc,TA_LEFT | TA_TOP); + + char buffer[16] = ""; + if (g_bIsFullScreen) { -/* - SelectObject(dc,smallfont); - SetBkMode(dc,OPAQUE); - SetBkColor(dc,RGB(0,0,0)); - SetTextAlign(dc,TA_LEFT | TA_TOP); -*/ +#if _DEBUG && 0 + SetBkColor(dc,RGB(255,0,255)); +#endif + // NB.The 2 extra spaces are needed since we don't erase the background to black + SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); - TextOut(dc,x+ 3,y+2,TEXT("1"),1); +// TextOut(dc,x+ 3,y+2,TEXT("1"),1); + sprintf_s( buffer, sizeof(buffer), "T%2d ", Disk1Track ); + TextOut(dc,x+3,y-12,buffer, strlen(buffer) ); // original: y+2; y-12 puts status in the Joystick Button Icon SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); - TextOut(dc,x+13,y+2,TEXT("2"),1); +// TextOut(dc,x+13,y+2,TEXT("2"),1); + sprintf_s( buffer, sizeof(buffer), "T%2d ", Disk2Track ); + TextOut(dc,x+23,y-12,buffer, strlen(buffer) ); // original: y+2; y-12 puts status in the Joystick Button Icon } else { @@ -583,23 +592,26 @@ void DrawStatusAreaDisk( HDC passdc ) DrawBitmapRect(dc,x+12,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive1Status]); DrawBitmapRect(dc,x+31,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive2Status]); - // Track/Sector - SelectObject(dc,smallfont); - SetTextAlign(dc,TA_CENTER | TA_TOP); + // Erase background + SelectObject(dc,GetStockObject(NULL_PEN)); +#if _DEBUG && 0 + SelectObject( dc, CreateSolidBrush( RGB(255,0,255) ) ); +#else + SelectObject(dc,btnfacebrush); +#endif + Rectangle(dc,x+4,y+32,x+BUTTONCX+1,y+44); // y+35 + SetTextColor(dc,RGB(0,0,0)); - SetBkMode(dc,TRANSPARENT); -// SetBkMode(dc,OPAQUE); + SetBkMode(dc,TRANSPARENT); - char buffer[16] = ""; - sprintf_s( buffer, sizeof(buffer), "%2d ", Disk1Track ); - TextOut(dc,x+16,y+5,buffer, strlen(buffer) ); // 1 + // Feature Request #201 Show track status + // https://github.com/AppleWin/AppleWin/issues/201 + sprintf_s( buffer, sizeof(buffer), "T%2d", Disk1Track ); + TextOut(dc,x+6,y+32,buffer, strlen(buffer) ); - sprintf_s( buffer, sizeof(buffer), "%2d ", Disk2Track ); - TextOut(dc,x+35,y+5,buffer, strlen(buffer) ); + sprintf_s( buffer, sizeof(buffer), "T%2d", Disk2Track ); + TextOut(dc,x+26,y+32,buffer, strlen(buffer) ); } - -// if (!passdc) -// ReleaseDC(g_hFrameWindow,dc); } //=========================================================================== @@ -620,12 +632,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) if (g_bIsFullScreen) { - SelectObject(dc,smallfont); - SetBkMode(dc,OPAQUE); - SetBkColor(dc,RGB(0,0,0)); - SetTextAlign(dc,TA_LEFT | TA_TOP); - -// DrawStatusAreaDisk( passdc ); + DrawStatusAreaDisk( passdc ); #if HD_LED SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] ); @@ -657,7 +664,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) // const int nCapsLen = sizeof(sCapsStatus) / sizeof(TCHAR); // TextOut(dc,x+BUTTONCX,y+2,"Caps",4); // sCapsStatus,nCapsLen - 1); - TextOut(dc,x+BUTTONCX,y+2,TEXT("A"),1); + TextOut(dc,x+BUTTONCX,y+2,TEXT("A"),1); // NB. Caps Lock indicator is already flush right! } SetTextAlign(dc,TA_CENTER | TA_TOP); SetTextColor(dc,(g_nAppMode == MODE_PAUSED || g_nAppMode == MODE_STEPPING @@ -673,8 +680,9 @@ static void DrawStatusArea (HDC passdc, int drawflags) { SelectObject(dc,GetStockObject(NULL_PEN)); SelectObject(dc,btnfacebrush); - Rectangle(dc,x,y,x+BUTTONCX+2,y+35); - Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+31,0); + Rectangle(dc,x,y,x+BUTTONCX+2,y+48); // y+35 + Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+44,0); // y+31 + SelectObject(dc,smallfont); SetTextAlign(dc,TA_CENTER | TA_TOP); SetTextColor(dc,RGB(0,0,0)); From d914526c273a3732a801d2390bb0f583ea0ad662 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 21 Jul 2014 23:28:12 -0700 Subject: [PATCH 03/35] Updated "In Development" note about track display status --- bin/History.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/History.txt b/bin/History.txt index e12d4128..fbca8a84 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -31,6 +31,10 @@ Changes: (current memory address low byte) -memclear 7 Initialize memory to page address (current memory address high byte) +. [Feature #201] Added display of current track for the floppy drives. + Note: There are NO plans to display the sector number due to sectors being + a high level structure defined by the underlying OS -- it would take some + memory probing to display the accurate sector number. Fixed: . [Bug #206] Pooyan freezes due to RNDL/RNDH not initialized to non-zero values From f5be097177e4e5cc9d483b6febf932cbc0861c0a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Tue, 22 Jul 2014 00:08:18 -0700 Subject: [PATCH 04/35] #201 Show Track/Sector -- preliminary support for showing DOS3.3 --- source/Frame.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 25a70354..dc7d7b98 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -599,7 +599,7 @@ void DrawStatusAreaDisk( HDC passdc ) #else SelectObject(dc,btnfacebrush); #endif - Rectangle(dc,x+4,y+32,x+BUTTONCX+1,y+44); // y+35 + Rectangle(dc,x+4,y+32,x+BUTTONCX+1,y+56); // y+35 -> 44 -> 56 SetTextColor(dc,RGB(0,0,0)); SetBkMode(dc,TRANSPARENT); @@ -611,6 +611,30 @@ void DrawStatusAreaDisk( HDC passdc ) sprintf_s( buffer, sizeof(buffer), "T%2d", Disk2Track ); TextOut(dc,x+26,y+32,buffer, strlen(buffer) ); + + // Try DOS3.3 Sector + static char sectord1[ 8 ] = ""; + static char sectord2[ 8 ] = ""; + + int DOS33drive = mem[ 0xB7EA ]; + int DOS33track = mem[ 0xB7EC ]; + int DOS33sector = mem[ 0xB7ED ]; + if (DOS33sector >= 0 && DOS33sector < 16 ) + { + if (DOS33track == Disk1Track && DOS33drive == 1) + sprintf_s( sectord1, sizeof(sectord1), "S%2d", DOS33sector ); + + if (DOS33track == Disk2Track && DOS33drive == 2) + sprintf_s( sectord2, sizeof(sectord2), "S%2d", DOS33sector ); + } + else + { + sprintf_s( sectord1, sizeof(sectord1), "S??" ); + sprintf_s( sectord2, sizeof(sectord2), "S??" ); + } + + TextOut(dc,x+ 6,y+42, sectord1, strlen(sectord1) ); + TextOut(dc,x+26,y+42, sectord2, strlen(sectord2) ); } } @@ -680,8 +704,8 @@ static void DrawStatusArea (HDC passdc, int drawflags) { SelectObject(dc,GetStockObject(NULL_PEN)); SelectObject(dc,btnfacebrush); - Rectangle(dc,x,y,x+BUTTONCX+2,y+48); // y+35 - Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+44,0); // y+31 + Rectangle(dc,x,y,x+BUTTONCX+2,y+60); // y+35 --> 48 --> 60 + Draw3dRect(dc,x+1,y+3,x+BUTTONCX,y+56,0); // y+31 --> 44 --> 56 SelectObject(dc,smallfont); SetTextAlign(dc,TA_CENTER | TA_TOP); From 6ad02871c1e5c35f9a84fa1ef003a3a726c608f9 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Wed, 23 Jul 2014 18:08:52 -0700 Subject: [PATCH 05/35] #201 Fixed Track/Sector display to be responsive --- source/Disk.cpp | 43 ++++++---- source/Frame.cpp | 209 +++++++++++++++++++++++++++++++++++------------ source/Frame.h | 3 +- 3 files changed, 187 insertions(+), 68 deletions(-) diff --git a/source/Disk.cpp b/source/Disk.cpp index bf692fbf..377dd57b 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -64,7 +64,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA string strFilenameInZip; // 0x00 or HIMAGE imagehandle; // Init'd by DiskInsert() -> ImageOpen() int track; - int nLastTrack; LPBYTE trackimage; int phase; int byte; @@ -83,7 +82,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA strFilenameInZip = other.strFilenameInZip; imagehandle = other.imagehandle; track = other.track; - nLastTrack = other.nLastTrack; trackimage = other.trackimage; phase = other.phase; byte = other.byte; @@ -212,7 +210,8 @@ static void CheckSpinning(void) if (floppymotoron) g_aFloppyDisk[currdrive].spinning = 20000; if (modechange) - FrameRefreshStatus(DRAW_LEDS); + //FrameRefreshStatus(DRAW_LEDS); + FrameDrawDiskLEDS( (HDC)0 ); } //=========================================================================== @@ -464,6 +463,10 @@ static BYTE __stdcall DiskControlStepper(WORD, WORD address, BYTE, BYTE, ULONG) fptr->track = newtrack; fptr->trackimagedata = 0; } + + // Feature Request #201 Show track status + // https://github.com/AppleWin/AppleWin/issues/201 + FrameDrawDiskStatus( (HDC)0 ); } #else // Old 1.13.1 code for Chessmaster 2000 to work! (see bug#18109) const int nNumTracksInImage = ImageGetNumTracks(fptr->imagehandle); @@ -787,16 +790,6 @@ static BYTE __stdcall DiskReadWrite (WORD programcounter, WORD, BYTE, BYTE, ULON if (!fptr->trackimagedata) return 0xFF; - // Feature Request #201 Show track status - // https://github.com/AppleWin/AppleWin/issues/201 - if( fptr->nLastTrack != fptr->track ) - { - fptr->nLastTrack = fptr->track; - - //FrameRefreshStatus(DRAW_LEDS); - DrawStatusAreaDisk( (HDC)0 ); - } - BYTE result = 0; if (!floppywritemode || !fptr->bWriteProtected) @@ -825,6 +818,12 @@ static BYTE __stdcall DiskReadWrite (WORD programcounter, WORD, BYTE, BYTE, ULON if (++fptr->byte >= fptr->nibbles) fptr->byte = 0; + // Feature Request #201 Show track status + // https://github.com/AppleWin/AppleWin/issues/201 + // NB. Prevent flooding of forcing UI to redraw!!! + if( ((fptr->byte) & 0xFF) == 0 ) + FrameDrawDiskStatus( (HDC)0 ); + return result; } @@ -917,7 +916,10 @@ static BYTE __stdcall DiskSetWriteMode(WORD, WORD, BYTE, BYTE, ULONG) BOOL modechange = !g_aFloppyDisk[currdrive].writelight; g_aFloppyDisk[currdrive].writelight = 20000; if (modechange) - FrameRefreshStatus(DRAW_LEDS); + { + //FrameRefreshStatus(DRAW_LEDS); + FrameDrawDiskLEDS( (HDC)0 ); + } return MemReturnRandomData(1); } @@ -932,7 +934,11 @@ void DiskUpdatePosition(DWORD cycles) if (fptr->spinning && !floppymotoron) { if (!(fptr->spinning -= MIN(fptr->spinning, (cycles >> 6)))) - FrameRefreshStatus(DRAW_LEDS); + { + // FrameRefreshStatus(DRAW_LEDS); + FrameDrawDiskLEDS( (HDC)0 ); + FrameDrawDiskStatus( (HDC)0 ); + } } if (floppywritemode && (currdrive == loop) && fptr->spinning) @@ -942,7 +948,11 @@ void DiskUpdatePosition(DWORD cycles) else if (fptr->writelight) { if (!(fptr->writelight -= MIN(fptr->writelight, (cycles >> 6)))) - FrameRefreshStatus(DRAW_LEDS); + { + //FrameRefreshStatus(DRAW_LEDS); + FrameDrawDiskLEDS( (HDC)0 ); + FrameDrawDiskStatus( (HDC)0 ); + } } if ((!enhancedisk) && (!diskaccessed) && fptr->spinning) @@ -973,6 +983,7 @@ bool DiskDriveSwap(void) Disk_SaveLastDiskImage(DRIVE_2); FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); + FrameDrawDiskLEDS( (HDC)0 ); return true; } diff --git a/source/Frame.cpp b/source/Frame.cpp index dc7d7b98..7a0e2dd1 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -72,6 +72,16 @@ static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; static HBITMAP g_hDiskWindowedLED[ NUM_DISK_STATUS ]; //static HBITMAP g_hDiskFullScreenLED[ NUM_DISK_STATUS ]; +static int g_nTrackDrive1 = -1; +static int g_nTrackDrive2 = -1; +static int g_nSectorDrive1 = -1; +static int g_nSectorDrive2 = -1; +static TCHAR g_sTrackDrive1 [8] = TEXT("??"); +static TCHAR g_sTrackDrive2 [8] = TEXT("??"); +static TCHAR g_sSectorDrive1[8] = TEXT("??"); +static TCHAR g_sSectorDrive2[8] = TEXT("??"); +Disk_Status_e g_eStatusDrive1 = DISK_STATUS_OFF; +Disk_Status_e g_eStatusDrive2 = DISK_STATUS_OFF; // Must keep in sync with Disk_Status_e g_aDiskFullScreenColors static DWORD g_aDiskFullScreenColorsLED[ NUM_DISK_STATUS ] = @@ -546,51 +556,167 @@ static void DrawFrameWindow () } -void DrawStatusAreaDisk( HDC passdc ) +//=========================================================================== +void FrameDrawDiskLEDS( HDC passdc ) { + static Disk_Status_e eDrive1Status = DISK_STATUS_OFF; + static Disk_Status_e eDrive2Status = DISK_STATUS_OFF; + DiskGetLightStatus(&eDrive1Status, &eDrive2Status); + + g_eStatusDrive1 = eDrive1Status; + g_eStatusDrive2 = eDrive2Status; + + // Draw Track/Sector FrameReleaseDC(); HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); int x = buttonx; int y = buttony+BUTTONS*BUTTONCY+1; - Disk_Status_e eDrive1Status = DISK_STATUS_OFF; - Disk_Status_e eDrive2Status = DISK_STATUS_OFF; + if (g_bIsFullScreen) + { + SelectObject(dc,smallfont); + SetBkMode(dc,OPAQUE); + SetBkColor(dc,RGB(0,0,0)); + SetTextAlign(dc,TA_LEFT | TA_TOP); + + SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); + TextOut(dc,x+ 3,y+2,TEXT("1"),1); + + SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); + TextOut(dc,x+13,y+2,TEXT("2"),1); + } + else + { + RECT rDiskLed = {0,0,8,8}; + DrawBitmapRect(dc,x+12,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive1Status]); + DrawBitmapRect(dc,x+31,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive2Status]); + } +} + +// Feature Request #201 Show track status +// https://github.com/AppleWin/AppleWin/issues/201 +//=========================================================================== +void FrameDrawDiskStatus( HDC passdc ) +{ + int nActiveFloppy = DiskGetCurrentDrive(); + + static Disk_Status_e eDrive1Status = DISK_STATUS_OFF; + static Disk_Status_e eDrive2Status = DISK_STATUS_OFF; DiskGetLightStatus(&eDrive1Status, &eDrive2Status); - int Disk1Track = DiskGetTrack(0); - int Disk2Track = DiskGetTrack(1); + static int nDisk1Track = DiskGetTrack(0); + static int nDisk2Track = DiskGetTrack(1); + + static int nDisk1Sector = 0; + static int nDisk2Sector = 0; + + // Probe known OS's for Track/Sector + int DOS33sector = mem[ 0xB7ED ]; + int isProDOS = mem[ 0xBF00 ] == 0x4C; + + // Try DOS3.3 Sector + if (DOS33sector >= 0 && DOS33sector < 16 ) + { + int DOS33drive = mem[ 0xB7EA ]; + int DOS33track = mem[ 0xB7EC ]; + if( DOS33drive == 1 ) + { + #if _DEBUG && 0 + if(DOS33track != nDisk1Track) // POHO + { + char text[128]; + sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); + OutputDebugString( text ); + } + #endif // _DEBUG + + sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); + sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%2d", DOS33sector ); + nDisk1Track = g_nTrackDrive1 = DOS33track; + g_nSectorDrive1 = DOS33sector; + } + else +// if (DOS33track == nDisk2Track && DOS33drive == 2) + if( DOS33drive == 2 ) + { + sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive2 ), "%2d", g_nTrackDrive2 ); + sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%2d", DOS33sector ); + nDisk2Track = g_nTrackDrive2 = DOS33track; + g_nSectorDrive2 = DOS33sector; + } + } + else + if( isProDOS ) + { + int ProDOSdrive = mem[ 0xBE3D ]; + int ProDOStrack = mem[ 0xD356 ]; + int ProDOSsector = mem[ 0xD357 ]; + if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "B??" ); + if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "B??" ); + } + else + { +// nDisk1Sector = -1; +// nDisk2Sector = -1; + if( nActiveFloppy == 0 ) { g_nTrackDrive1 = 0; nDisk1Sector = -1; sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); } + else { g_nTrackDrive2 = 0; nDisk2Sector = -1; sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); } + } + + // NB.The 2 extra spaces are needed since we don't erase the background to black +// sprintf_s( g_sTrackDrive1, sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); +// sprintf_s( g_sTrackDrive2, sizeof(g_sTrackDrive2), "%2d", g_nTrackDrive2 ); + + g_nTrackDrive1 = nDisk1Track ; + g_nTrackDrive2 = nDisk2Track ; + g_nSectorDrive1 = nDisk1Sector ; + g_nSectorDrive2 = nDisk2Sector ; + + // Draw Track/Sector + FrameReleaseDC(); + HDC dc = (passdc ? passdc : GetDC(g_hFrameWindow)); + + int x = buttonx; + int y = buttony+BUTTONS*BUTTONCY+1; SelectObject(dc,smallfont); SetBkMode(dc,OPAQUE); SetBkColor(dc,RGB(0,0,0)); SetTextAlign(dc,TA_LEFT | TA_TOP); - char buffer[16] = ""; + char text[ 16 ]; if (g_bIsFullScreen) { #if _DEBUG && 0 SetBkColor(dc,RGB(255,0,255)); #endif - // NB.The 2 extra spaces are needed since we don't erase the background to black - SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); -// TextOut(dc,x+ 3,y+2,TEXT("1"),1); - sprintf_s( buffer, sizeof(buffer), "T%2d ", Disk1Track ); - TextOut(dc,x+3,y-12,buffer, strlen(buffer) ); // original: y+2; y-12 puts status in the Joystick Button Icon + TextOut(dc,x+ 3,y+2,TEXT("1"),1); SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); -// TextOut(dc,x+13,y+2,TEXT("2"),1); - sprintf_s( buffer, sizeof(buffer), "T%2d ", Disk2Track ); - TextOut(dc,x+23,y-12,buffer, strlen(buffer) ); // original: y+2; y-12 puts status in the Joystick Button Icon + TextOut(dc,x+13,y+2,TEXT("2"),1); + + int dx = 0; + if( nActiveFloppy == 0 ) + { + //dx = 3; + sprintf( text, "%s/%s ", g_sTrackDrive1, g_sSectorDrive1 ); + } + else + { + //dx = 23; + sprintf( text, "%s/%s ", g_sTrackDrive2, g_sSectorDrive2 ); + } + + SetTextColor(dc, g_aDiskFullScreenColorsLED[ DISK_STATUS_READ ] ); + TextOut(dc,x+dx,y-12,text, strlen(text) ); // original: y+2; y-12 puts status in the Configuration Button Icon } else { - RECT rDiskLed = {0,0,8,8}; - - DrawBitmapRect(dc,x+12,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive1Status]); - DrawBitmapRect(dc,x+31,y+6,&rDiskLed,g_hDiskWindowedLED[eDrive2Status]); + // NB. Only draw Track/Sector if 2x windowed + if (g_nOldViewportScale == 1) + return; // Erase background SelectObject(dc,GetStockObject(NULL_PEN)); @@ -604,37 +730,18 @@ void DrawStatusAreaDisk( HDC passdc ) SetTextColor(dc,RGB(0,0,0)); SetBkMode(dc,TRANSPARENT); - // Feature Request #201 Show track status - // https://github.com/AppleWin/AppleWin/issues/201 - sprintf_s( buffer, sizeof(buffer), "T%2d", Disk1Track ); - TextOut(dc,x+6,y+32,buffer, strlen(buffer) ); - - sprintf_s( buffer, sizeof(buffer), "T%2d", Disk2Track ); - TextOut(dc,x+26,y+32,buffer, strlen(buffer) ); - - // Try DOS3.3 Sector - static char sectord1[ 8 ] = ""; - static char sectord2[ 8 ] = ""; - - int DOS33drive = mem[ 0xB7EA ]; - int DOS33track = mem[ 0xB7EC ]; - int DOS33sector = mem[ 0xB7ED ]; - if (DOS33sector >= 0 && DOS33sector < 16 ) - { - if (DOS33track == Disk1Track && DOS33drive == 1) - sprintf_s( sectord1, sizeof(sectord1), "S%2d", DOS33sector ); - - if (DOS33track == Disk2Track && DOS33drive == 2) - sprintf_s( sectord2, sizeof(sectord2), "S%2d", DOS33sector ); - } - else - { - sprintf_s( sectord1, sizeof(sectord1), "S??" ); - sprintf_s( sectord2, sizeof(sectord2), "S??" ); - } - - TextOut(dc,x+ 6,y+42, sectord1, strlen(sectord1) ); - TextOut(dc,x+26,y+42, sectord2, strlen(sectord2) ); +// if( nActiveFloppy == 0 ) + { + sprintf( text, "T%s", g_sTrackDrive1 ); + TextOut(dc,x+6 ,y+32,text, strlen(text) ); + sprintf( text, "S%s", g_sSectorDrive1 ); + TextOut(dc,x+ 6,y+42, text, strlen(text) ); +// } else { + sprintf( text, "T%s", g_sTrackDrive2 ); + TextOut(dc,x+26,y+32,text, strlen(text) ); + sprintf( text, "S%s", g_sSectorDrive2 ); + TextOut(dc,x+26,y+42, text, strlen(text) ); + } } } @@ -656,7 +763,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) if (g_bIsFullScreen) { - DrawStatusAreaDisk( passdc ); + SelectObject(dc,smallfont); #if HD_LED SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] ); @@ -720,7 +827,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) if (drawflags & DRAW_LEDS) { - DrawStatusAreaDisk( dc ); + FrameDrawDiskLEDS( dc ); if (!IS_APPLE2) { diff --git a/source/Frame.h b/source/Frame.h index 8c882d56..af22106a 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -48,7 +48,8 @@ bool GetFullScreen32Bit(void); void SetFullScreen32Bit(bool b32Bit); - void DrawStatusAreaDisk( HDC hdc ); + void FrameDrawDiskLEDS( HDC hdc ); + void FrameDrawDiskStatus( HDC hdc ); LRESULT CALLBACK FrameWndProc ( HWND window, From 099bdbe5eec747856b5b9071f1685ece9c7ceb15 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Wed, 23 Jul 2014 22:40:35 -0700 Subject: [PATCH 06/35] Fix ProDOS track & sector display to be more accurate --- source/Frame.cpp | 75 ++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 7a0e2dd1..c3cb2c5a 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -612,38 +612,41 @@ void FrameDrawDiskStatus( HDC passdc ) static int nDisk2Sector = 0; // Probe known OS's for Track/Sector - int DOS33sector = mem[ 0xB7ED ]; int isProDOS = mem[ 0xBF00 ] == 0x4C; // Try DOS3.3 Sector - if (DOS33sector >= 0 && DOS33sector < 16 ) + if( !isProDOS ) { + int DOS33sector = mem[ 0xB7ED ]; int DOS33drive = mem[ 0xB7EA ]; int DOS33track = mem[ 0xB7EC ]; - if( DOS33drive == 1 ) - { - #if _DEBUG && 0 - if(DOS33track != nDisk1Track) // POHO - { - char text[128]; - sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); - OutputDebugString( text ); - } - #endif // _DEBUG - sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); - sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%2d", DOS33sector ); - nDisk1Track = g_nTrackDrive1 = DOS33track; - g_nSectorDrive1 = DOS33sector; - } - else -// if (DOS33track == nDisk2Track && DOS33drive == 2) - if( DOS33drive == 2 ) + if (DOS33sector >= 0 && DOS33sector < 16 ) { - sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive2 ), "%2d", g_nTrackDrive2 ); - sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%2d", DOS33sector ); - nDisk2Track = g_nTrackDrive2 = DOS33track; - g_nSectorDrive2 = DOS33sector; + if( DOS33drive == 1 ) + { + #if _DEBUG && 0 + if(DOS33track != nDisk1Track) + { + char text[128]; + sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); + OutputDebugString( text ); + } + #endif // _DEBUG + + sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); + sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%2d", DOS33sector ); + nDisk1Track = g_nTrackDrive1 = DOS33track; + g_nSectorDrive1 = DOS33sector; + } + else + if( DOS33drive == 2 ) + { + sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive2 ), "%2d", g_nTrackDrive2 ); + sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%2d", DOS33sector ); + nDisk2Track = g_nTrackDrive2 = DOS33track; + g_nSectorDrive2 = DOS33sector; + } } } else @@ -652,21 +655,23 @@ void FrameDrawDiskStatus( HDC passdc ) int ProDOSdrive = mem[ 0xBE3D ]; int ProDOStrack = mem[ 0xD356 ]; int ProDOSsector = mem[ 0xD357 ]; - if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "B??" ); - if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "B??" ); + if( ProDOSsector >= 0 && ProDOSsector <= 16) + { + if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%d", ProDOSsector ); + if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%d", ProDOSsector ); + } + else + { + if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); + if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); + } } else { -// nDisk1Sector = -1; -// nDisk2Sector = -1; if( nActiveFloppy == 0 ) { g_nTrackDrive1 = 0; nDisk1Sector = -1; sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); } else { g_nTrackDrive2 = 0; nDisk2Sector = -1; sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); } } - // NB.The 2 extra spaces are needed since we don't erase the background to black -// sprintf_s( g_sTrackDrive1, sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); -// sprintf_s( g_sTrackDrive2, sizeof(g_sTrackDrive2), "%2d", g_nTrackDrive2 ); - g_nTrackDrive1 = nDisk1Track ; g_nTrackDrive2 = nDisk2Track ; g_nSectorDrive1 = nDisk1Sector ; @@ -699,15 +704,9 @@ void FrameDrawDiskStatus( HDC passdc ) int dx = 0; if( nActiveFloppy == 0 ) - { - //dx = 3; sprintf( text, "%s/%s ", g_sTrackDrive1, g_sSectorDrive1 ); - } else - { - //dx = 23; sprintf( text, "%s/%s ", g_sTrackDrive2, g_sSectorDrive2 ); - } SetTextColor(dc, g_aDiskFullScreenColorsLED[ DISK_STATUS_READ ] ); TextOut(dc,x+dx,y-12,text, strlen(text) ); // original: y+2; y-12 puts status in the Configuration Button Icon From 825aba0fdae7cececa19436fe5136b716563cac6 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Wed, 23 Jul 2014 22:58:23 -0700 Subject: [PATCH 07/35] Use active track for ProDOS --- source/Frame.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index c3cb2c5a..1a0bea6c 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -617,7 +617,7 @@ void FrameDrawDiskStatus( HDC passdc ) // Try DOS3.3 Sector if( !isProDOS ) { - int DOS33sector = mem[ 0xB7ED ]; + int DOS33sector = mem[ 0xB7ED ]; int DOS33drive = mem[ 0xB7EA ]; int DOS33track = mem[ 0xB7EC ]; @@ -657,8 +657,8 @@ void FrameDrawDiskStatus( HDC passdc ) int ProDOSsector = mem[ 0xD357 ]; if( ProDOSsector >= 0 && ProDOSsector <= 16) { - if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%d", ProDOSsector ); - if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%d", ProDOSsector ); + if (ProDOSdrive == 1) { g_nTrackDrive1 = ProDOStrack; sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%d", ProDOSsector ); } + if (ProDOSdrive == 2) { g_nTrackDrive2 = ProDOStrack; sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%d", ProDOSsector ); } } else { @@ -668,8 +668,8 @@ void FrameDrawDiskStatus( HDC passdc ) } else { - if( nActiveFloppy == 0 ) { g_nTrackDrive1 = 0; nDisk1Sector = -1; sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); } - else { g_nTrackDrive2 = 0; nDisk2Sector = -1; sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); } + if( nActiveFloppy == 0 ) { g_nTrackDrive1 = nDisk1Track; nDisk1Sector = -1; sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); } + else { g_nTrackDrive2 = nDisk2Track; nDisk2Sector = -1; sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); } } g_nTrackDrive1 = nDisk1Track ; From f5617a396d756acde30567ce4c3f7581ea97c8c5 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Thu, 24 Jul 2014 21:58:19 -0700 Subject: [PATCH 08/35] Final cleanup on Track/Sector --- source/Frame.cpp | 114 ++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 61 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 1a0bea6c..164088bd 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -72,14 +72,14 @@ static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; static HBITMAP g_hDiskWindowedLED[ NUM_DISK_STATUS ]; //static HBITMAP g_hDiskFullScreenLED[ NUM_DISK_STATUS ]; -static int g_nTrackDrive1 = -1; -static int g_nTrackDrive2 = -1; -static int g_nSectorDrive1 = -1; -static int g_nSectorDrive2 = -1; -static TCHAR g_sTrackDrive1 [8] = TEXT("??"); -static TCHAR g_sTrackDrive2 [8] = TEXT("??"); -static TCHAR g_sSectorDrive1[8] = TEXT("??"); -static TCHAR g_sSectorDrive2[8] = TEXT("??"); +static int g_nTrackDrive1 = -1; +static int g_nTrackDrive2 = -1; +static int g_nSectorDrive1 = -1; +static int g_nSectorDrive2 = -1; +static TCHAR g_sTrackDrive1 [8] = TEXT("??"); +static TCHAR g_sTrackDrive2 [8] = TEXT("??"); +static TCHAR g_sSectorDrive1[8] = TEXT("??"); +static TCHAR g_sSectorDrive2[8] = TEXT("??"); Disk_Status_e g_eStatusDrive1 = DISK_STATUS_OFF; Disk_Status_e g_eStatusDrive2 = DISK_STATUS_OFF; @@ -601,53 +601,38 @@ void FrameDrawDiskStatus( HDC passdc ) { int nActiveFloppy = DiskGetCurrentDrive(); - static Disk_Status_e eDrive1Status = DISK_STATUS_OFF; - static Disk_Status_e eDrive2Status = DISK_STATUS_OFF; - DiskGetLightStatus(&eDrive1Status, &eDrive2Status); - - static int nDisk1Track = DiskGetTrack(0); - static int nDisk2Track = DiskGetTrack(1); + int nDisk1Track = DiskGetTrack(0); + int nDisk2Track = DiskGetTrack(1); - static int nDisk1Sector = 0; - static int nDisk2Sector = 0; - // Probe known OS's for Track/Sector - int isProDOS = mem[ 0xBF00 ] == 0x4C; + int isProDOS = mem[ 0xBF00 ] == 0x4C; + bool isValid = true; // Try DOS3.3 Sector if( !isProDOS ) { - int DOS33sector = mem[ 0xB7ED ]; int DOS33drive = mem[ 0xB7EA ]; + int DOS33sector = mem[ 0xB7ED ]; int DOS33track = mem[ 0xB7EC ]; - if (DOS33sector >= 0 && DOS33sector < 16 ) + if ((DOS33drive >= 0 && DOS33drive < 2) + && (DOS33track >= 0 && DOS33track < 40) + && (DOS33sector >= 0 && DOS33sector < 16)) { - if( DOS33drive == 1 ) - { - #if _DEBUG && 0 - if(DOS33track != nDisk1Track) - { - char text[128]; - sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); - OutputDebugString( text ); - } - #endif // _DEBUG + #if _DEBUG && 0 + if(DOS33track != nDisk1Track) + { + char text[128]; + sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); + OutputDebugString( text ); + } + #endif // _DEBUG - sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); - sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%2d", DOS33sector ); - nDisk1Track = g_nTrackDrive1 = DOS33track; - g_nSectorDrive1 = DOS33sector; - } - else - if( DOS33drive == 2 ) - { - sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive2 ), "%2d", g_nTrackDrive2 ); - sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%2d", DOS33sector ); - nDisk2Track = g_nTrackDrive2 = DOS33track; - g_nSectorDrive2 = DOS33sector; - } + /**/ if( DOS33drive == 1 ) g_nSectorDrive1 = DOS33sector; + else if( DOS33drive == 2 ) g_nSectorDrive2 = DOS33sector; } + else + isValid = false; } else if( isProDOS ) @@ -655,27 +640,34 @@ void FrameDrawDiskStatus( HDC passdc ) int ProDOSdrive = mem[ 0xBE3D ]; int ProDOStrack = mem[ 0xD356 ]; int ProDOSsector = mem[ 0xD357 ]; - if( ProDOSsector >= 0 && ProDOSsector <= 16) + + if ((ProDOSdrive >= 0 && ProDOSdrive < 2) + && (ProDOStrack >= 0 && ProDOStrack < 40) + && (ProDOSsector >= 0 && ProDOSsector < 16)) { - if (ProDOSdrive == 1) { g_nTrackDrive1 = ProDOStrack; sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%d", ProDOSsector ); } - if (ProDOSdrive == 2) { g_nTrackDrive2 = ProDOStrack; sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive1), "%2d", g_nTrackDrive1 ); sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%d", ProDOSsector ); } + /**/ if (ProDOSdrive == 1) g_nSectorDrive1 = ProDOSsector; + else if (ProDOSdrive == 2) g_nSectorDrive2 = ProDOSsector; } else - { - if (ProDOSdrive == 1) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); - if (ProDOSdrive == 2) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); - } - } - else - { - if( nActiveFloppy == 0 ) { g_nTrackDrive1 = nDisk1Track; nDisk1Sector = -1; sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" ); } - else { g_nTrackDrive2 = nDisk2Track; nDisk2Sector = -1; sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" ); } + isValid = false; } - g_nTrackDrive1 = nDisk1Track ; - g_nTrackDrive2 = nDisk2Track ; - g_nSectorDrive1 = nDisk1Sector ; - g_nSectorDrive2 = nDisk2Sector ; + g_nTrackDrive1 = nDisk1Track; + g_nTrackDrive2 = nDisk2Track; + + if( !isValid ) + { + if (nActiveFloppy == 0) g_nSectorDrive1 = -1; + else g_nSectorDrive2 = -1; + } + + sprintf_s( g_sTrackDrive1 , sizeof(g_sTrackDrive1 ), "%2d", g_nTrackDrive1 ); + if (g_nSectorDrive1 < 0) sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "??" , g_nSectorDrive1 ); + else sprintf_s( g_sSectorDrive1, sizeof(g_sSectorDrive1), "%2d", g_nSectorDrive1 ); + + sprintf_s( g_sTrackDrive2 , sizeof(g_sTrackDrive2), "%2d", g_nTrackDrive2 ); + if (g_nSectorDrive2 < 0) sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "??" , g_nSectorDrive2 ); + else sprintf_s( g_sSectorDrive2, sizeof(g_sSectorDrive2), "%2d", g_nSectorDrive2 ); // Draw Track/Sector FrameReleaseDC(); @@ -696,10 +688,10 @@ void FrameDrawDiskStatus( HDC passdc ) #if _DEBUG && 0 SetBkColor(dc,RGB(255,0,255)); #endif - SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive1Status ] ); + SetTextColor(dc, g_aDiskFullScreenColorsLED[ g_eStatusDrive1 ] ); TextOut(dc,x+ 3,y+2,TEXT("1"),1); - SetTextColor(dc, g_aDiskFullScreenColorsLED[ eDrive2Status ] ); + SetTextColor(dc, g_aDiskFullScreenColorsLED[ g_eStatusDrive2 ] ); TextOut(dc,x+13,y+2,TEXT("2"),1); int dx = 0; From f0ca2282ed6d6b434cef3d6a972aa1ec2ef60b88 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Thu, 24 Jul 2014 22:10:08 -0700 Subject: [PATCH 09/35] #201 Updated history "In Development" for Track/Sector and Pooyan fix description --- bin/History.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/bin/History.txt b/bin/History.txt index fbca8a84..59e460ee 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -31,12 +31,15 @@ Changes: (current memory address low byte) -memclear 7 Initialize memory to page address (current memory address high byte) -. [Feature #201] Added display of current track for the floppy drives. - Note: There are NO plans to display the sector number due to sectors being - a high level structure defined by the underlying OS -- it would take some - memory probing to display the accurate sector number. -Fixed: -. [Bug #206] Pooyan freezes due to RNDL/RNDH not initialized to non-zero values +. [Feature #201] Added display of current Track/Sector for the floppy drives. + - In 2x window mode the status is displayed below the drive LEDs. + - In full screen mode the status is displayed above the drive LEDS. The track/sector + is shown only for the last drive accessed. + Note: DOS3.3 Track/Sector status should be accurate. + ProDOS support is preliminary -- the track/sector may show zero after an operation. +Fixes: +. [Bug #206] Pooyan would freeze due to RNDL/RNDH not initialized to non-zero values on + a cold boot. Latest: From 9cb6626fc32a104dfbe56359f65499b62f6d8f04 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 09:36:29 -0700 Subject: [PATCH 10/35] #201 Fix ProDOS track/sector to be more accurate. Always use the actual floppy drive instead of probing ProDOS --- source/Frame.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 164088bd..4e320205 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -635,11 +635,15 @@ void FrameDrawDiskStatus( HDC passdc ) isValid = false; } else - if( isProDOS ) + if( isProDOS ) // & regs.pc > 0xD000 ) // RWTS @ $D300 { - int ProDOSdrive = mem[ 0xBE3D ]; - int ProDOStrack = mem[ 0xD356 ]; - int ProDOSsector = mem[ 0xD357 ]; + // we can't just read from mem[ 0xD357 ] since it might be bank-switched from ROM + // and we need the Language Card RAM + // memrom[ 0xD350 ] = " ERROR\x07\x00" + // T S + int ProDOSdrive = nActiveFloppy + 1; // mem[ 0xBE3D ]; + int ProDOStrack = *MemGetMainPtr( 0xC356 ); // LC1 $D356 + int ProDOSsector = *MemGetMainPtr( 0xC357 ); // LC1 $D357 if ((ProDOSdrive >= 0 && ProDOSdrive < 2) && (ProDOStrack >= 0 && ProDOStrack < 40) From f8d0430a391ecbfbb333f825e3e608aa3440c87a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 13:23:57 -0700 Subject: [PATCH 11/35] Cleanup: Bump copyright, and tabify --- source/Disk.cpp | 12 ++++++------ source/Frame.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/Disk.cpp b/source/Disk.cpp index 377dd57b..03ac43c6 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth -Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -207,8 +207,10 @@ void Disk_SaveLastDiskImage(const int iDrive) static void CheckSpinning(void) { DWORD modechange = (floppymotoron && !g_aFloppyDisk[currdrive].spinning); + if (floppymotoron) g_aFloppyDisk[currdrive].spinning = 20000; + if (modechange) //FrameRefreshStatus(DRAW_LEDS); FrameDrawDiskLEDS( (HDC)0 ); @@ -297,8 +299,8 @@ static bool IsDriveValid(const int iDrive) static void AllocTrack(const int iDrive) { - Disk_t * fptr = &g_aFloppyDisk[iDrive]; - fptr->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE); + Disk_t * fptr = &g_aFloppyDisk[iDrive]; + fptr->trackimage = (LPBYTE)VirtualAlloc(NULL, NIBBLES_PER_TRACK, MEM_COMMIT, PAGE_READWRITE); } //=========================================================================== @@ -557,11 +559,9 @@ LPCTSTR DiskGetBaseName(const int iDrive) void DiskGetLightStatus(Disk_Status_e *pDisk1Status_, Disk_Status_e *pDisk2Status_) { -// *drive1 = g_aFloppyDisk[0].spinning ? g_aFloppyDisk[0].writelight ? 2 : 1 : 0; -// *drive2 = g_aFloppyDisk[1].spinning ? g_aFloppyDisk[1].writelight ? 2 : 1 : 0; - if (pDisk1Status_) *pDisk1Status_ = GetDriveLightStatus( 0 ); + if (pDisk2Status_) *pDisk2Status_ = GetDriveLightStatus( 1 ); } diff --git a/source/Frame.cpp b/source/Frame.cpp index 4e320205..198ce670 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -4,7 +4,7 @@ AppleWin : An Apple //e emulator for Windows Copyright (C) 1994-1996, Michael O'Brien Copyright (C) 1999-2001, Oliver Schmidt Copyright (C) 2002-2005, Tom Charlesworth -Copyright (C) 2006-2007, Tom Charlesworth, Michael Pohoreski +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski AppleWin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From a8e75eb9d4badde25d2991f2f3020424bedcc5ce Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 13:32:28 -0700 Subject: [PATCH 12/35] Added linker directory ddraw_lib\x86 to Visual Studio 2010 project so SDK isn't needed. --- ApplewinExpress10.00.vcxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ApplewinExpress10.00.vcxproj b/ApplewinExpress10.00.vcxproj index e85249be..4b62d7fa 100644 --- a/ApplewinExpress10.00.vcxproj +++ b/ApplewinExpress10.00.vcxproj @@ -113,6 +113,7 @@ MachineX86 + $(MSBuildProjectDirectory)\ddraw_lib\x86; @@ -161,6 +162,7 @@ MachineX86 + $(MSBuildProjectDirectory)\ddraw_lib\x86; @@ -201,6 +203,7 @@ MachineX86 + $(MSBuildProjectDirectory)\ddraw_lib\x86; @@ -241,6 +244,7 @@ MachineX86 + $(MSBuildProjectDirectory)\ddraw_lib\x86; From b0928645a21c84b77618b9d76057237790465a94 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 13:44:27 -0700 Subject: [PATCH 13/35] Initial work for dialog to confirm reset --- resource/Applewin.rc | 1 + resource/resource.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/resource/Applewin.rc b/resource/Applewin.rc index fb8c771e..b9f381aa 100644 --- a/resource/Applewin.rc +++ b/resource/Applewin.rc @@ -90,6 +90,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Model:",IDC_STATIC,5,7,40,8 COMBOBOX IDC_COMPUTER,45,5,95,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "&Confirm Reset",IDC_CHECK_CONFIRM_RESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,8,62,10 GROUPBOX "Video",IDC_STATIC,5,22,200,43 LTEXT "Mo&de:",IDC_STATIC,12,33,33,8 COMBOBOX IDC_VIDEOTYPE,45,30,95,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP diff --git a/resource/resource.h b/resource/resource.h index 9009b167..6f46426a 100644 --- a/resource/resource.h +++ b/resource/resource.h @@ -46,6 +46,7 @@ #define IDR_MENU_DISK_POPUP 143 #define IDR_MENU_DISK_CFG_POPUP 144 #define IDD_ABOUT 145 +#define IDC_CHECK_CONFIRM_RESET 146 #define IDC_KEYB_BUFFER_ENABLE 1005 #define IDC_SAVESTATE 1006 #define IDC_SAVESTATE_ON_EXIT 1007 @@ -121,7 +122,7 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 146 +#define _APS_NEXT_RESOURCE_VALUE 147 #define _APS_NEXT_COMMAND_VALUE 40012 #define _APS_NEXT_CONTROL_VALUE 1069 #define _APS_NEXT_SYMED_VALUE 101 From 825b7cddcb565d338f6b888d79056d83fc7f559f Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 14:51:23 -0700 Subject: [PATCH 14/35] #199 Added option to skip reset --- bin/History.txt | 1 + source/Applewin.cpp | 3 +++ source/Common.h | 1 + source/Configuration/PageConfig.cpp | 7 +++++++ source/Frame.cpp | 5 +++-- source/Frame.h | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/History.txt b/bin/History.txt index 59e460ee..e1a1da76 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -31,6 +31,7 @@ Changes: (current memory address low byte) -memclear 7 Initialize memory to page address (current memory address high byte) +. [Feature #199] Added option to skip reset confirmation for reset to configuration. . [Feature #201] Added display of current Track/Sector for the floppy drives. - In 2x window mode the status is displayed below the drive LEDs. - In full screen mode the status is displayed above the drive LEDS. The track/sector diff --git a/source/Applewin.cpp b/source/Applewin.cpp index a46aa13a..567f7c33 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -594,6 +594,9 @@ void LoadConfiguration(void) if (REGLOAD(TEXT(REGVALUE_WINDOW_SCALE), &dwTmp)) SetViewportScale(dwTmp); + + if (REGLOAD(TEXT(REGVALUE_CONFIRM_RESET), &dwTmp)) + g_bConfirmReset = dwTmp; } //=========================================================================== diff --git a/source/Common.h b/source/Common.h index cd5a36f8..7deaf616 100644 --- a/source/Common.h +++ b/source/Common.h @@ -74,6 +74,7 @@ enum AppMode_e #define REG_CONFIG "Configuration" #define REGVALUE_APPLE2_TYPE "Apple2 Type" #define REGVALUE_OLD_APPLE2_TYPE "Computer Emulation" // Deprecated +#define REGVALUE_CONFIRM_RESET "Confirm Reset" // Added at 1.24.1 PageConfig #define REGVALUE_SPKR_VOLUME "Speaker Volume" #define REGVALUE_MB_VOLUME "Mockingboard Volume" #define REGVALUE_SAVESTATE_FILENAME "Save State Filename" diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index 0c4f0767..c2596067 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -88,6 +88,9 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM VideoChooseColor(); break; + case IDC_CHECK_CONFIRM_RESET: + g_bConfirmReset = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_RESET) ? 1 : 0; + case IDC_CHECK_HALF_SCAN_LINES: g_uHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0; @@ -140,6 +143,8 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMPUTER, m_ComputerChoices, nCurrentChoice); } + CheckDlgButton(hWnd, IDC_CHECK_CONFIRM_RESET, g_bConfirmReset ? BST_CHECKED : BST_UNCHECKED ); + m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE,g_aVideoChoices,g_eVideoType); CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, g_uHalfScanLines ? BST_CHECKED : BST_UNCHECKED); @@ -207,6 +212,8 @@ void CPageConfig::DlgOK(HWND hWnd) } } + REGSAVE(TEXT(REGVALUE_CONFIRM_RESET), g_bConfirmReset); + const DWORD newserialport = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0); sg_SSC.CommSetSerialPort(hWnd, newserialport); RegSaveString( TEXT(REG_CONFIG), diff --git a/source/Frame.cpp b/source/Frame.cpp index 198ce670..bcdb5fc4 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -46,7 +46,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA static const int kDEFAULT_VIEWPORT_SCALE = 2; static int g_nViewportCX = FRAMEBUFFER_W * kDEFAULT_VIEWPORT_SCALE; static int g_nViewportCY = FRAMEBUFFER_H * kDEFAULT_VIEWPORT_SCALE; -static int g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; +static int g_nViewportScale = kDEFAULT_VIEWPORT_SCALE; // saved REGSAVE static int g_nOldViewportScale = kDEFAULT_VIEWPORT_SCALE; static int g_nMaxViewportScale = kDEFAULT_VIEWPORT_SCALE; @@ -111,6 +111,7 @@ static RECT framerect = {0,0,0,0}; HWND g_hFrameWindow = (HWND)0; BOOL g_bIsFullScreen = 0; + BOOL g_bConfirmReset = 1; // saved PageConfig REGSAVE BOOL g_bMultiMon = 0; // OFF = load window position & clamp initial frame to screen, ON = use window position as is static BOOL helpquit = 0; @@ -1681,7 +1682,7 @@ static void ScreenWindowResize(const bool bCtrlKey) static bool ConfirmReboot(bool bFromButtonUI) { - if (!bFromButtonUI) + if (!bFromButtonUI || !g_bConfirmReset) return true; int res = MessageBox(g_hFrameWindow, "Are you sure you want to reboot?\n(All data will be lost!)", "Reboot", MB_ICONWARNING|MB_YESNO); diff --git a/source/Frame.h b/source/Frame.h index af22106a..1f47711f 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -23,6 +23,7 @@ // Win32 extern HWND g_hFrameWindow; extern BOOL g_bIsFullScreen; + extern BOOL g_bConfirmReset; // saved PageConfig REGSAVE extern BOOL g_bMultiMon; // Emulator From 9140d5bca08ac005ecc837d619dc3fca0d5b0082 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 15:42:55 -0700 Subject: [PATCH 15/35] #199 Update confirm reboot dialog box with instructions how to disable the message in the future. --- source/Frame.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index bcdb5fc4..43a3e00f 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -1685,7 +1685,14 @@ static bool ConfirmReboot(bool bFromButtonUI) if (!bFromButtonUI || !g_bConfirmReset) return true; - int res = MessageBox(g_hFrameWindow, "Are you sure you want to reboot?\n(All data will be lost!)", "Reboot", MB_ICONWARNING|MB_YESNO); + int res = MessageBox(g_hFrameWindow, + "Are you sure you want to reboot?\n" + "(All data will be lost!)\n" + "\n" + "You can skip this dialog from displaying by unchecking:\n" + " [ ] Confirm reset\n" + "in the Configuration dialog.\n" + , "Reboot", MB_ICONWARNING|MB_YESNO); return res == IDYES; } From 70504ebf9db4abecf5fa9158e032689222d1a92a Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 16:44:38 -0700 Subject: [PATCH 16/35] #198 Made branch #alt_enter_fullscreen --- source/Frame.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/Frame.cpp b/source/Frame.cpp index 198ce670..8a5e6b83 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -1549,6 +1549,10 @@ LRESULT CALLBACK FrameWndProc ( break; case WM_SYSKEYDOWN: + KeybUpdateCtrlShiftStatus(); + if (g_bAltKey && (wparam == VK_RETURN)) // NB. VK_RETURN = 0x0D; Normally WM_CHAR will be 0x0A but ALT key triggers as WM_SYSKEYDOWN + ScreenWindowResize(true); + else PostMessage(window,WM_KEYDOWN,wparam,lparam); if ((wparam == VK_F10) || (wparam == VK_MENU)) // VK_MENU == ALT Key return 0; From 9b3c5547437d9e661462d13fdd130335ea69978b Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sat, 26 Jul 2014 16:47:18 -0700 Subject: [PATCH 17/35] Updated History.txt In Development --- bin/History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/History.txt b/bin/History.txt index 59e460ee..978d59f2 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -31,6 +31,7 @@ Changes: (current memory address low byte) -memclear 7 Initialize memory to page address (current memory address high byte) +. [Feature #198] Alt-Return toggles full screen. . [Feature #201] Added display of current Track/Sector for the floppy drives. - In 2x window mode the status is displayed below the drive LEDs. - In full screen mode the status is displayed above the drive LEDS. The track/sector From 50ed260710b684532face99dbc14caa857a4878e Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sun, 27 Jul 2014 14:31:00 -0700 Subject: [PATCH 18/35] #199 #215 Cleanup: "Confirm Reset" to "Confirm reboot" --- bin/History.txt | 2 +- resource/Applewin.rc | 2 +- resource/resource.h | 2 +- source/Applewin.cpp | 4 ++-- source/Common.h | 4 ++-- source/Configuration/PageConfig.cpp | 8 ++++---- source/Frame.cpp | 17 ++++++++++------- source/Frame.h | 2 +- 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/bin/History.txt b/bin/History.txt index e1a1da76..d7843ae1 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -31,7 +31,7 @@ Changes: (current memory address low byte) -memclear 7 Initialize memory to page address (current memory address high byte) -. [Feature #199] Added option to skip reset confirmation for reset to configuration. +. [Feature #199] Added the option to skip the reboot confirmation in the configuration. . [Feature #201] Added display of current Track/Sector for the floppy drives. - In 2x window mode the status is displayed below the drive LEDs. - In full screen mode the status is displayed above the drive LEDS. The track/sector diff --git a/resource/Applewin.rc b/resource/Applewin.rc index b9f381aa..237bca68 100644 --- a/resource/Applewin.rc +++ b/resource/Applewin.rc @@ -90,7 +90,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Model:",IDC_STATIC,5,7,40,8 COMBOBOX IDC_COMPUTER,45,5,95,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "&Confirm Reset",IDC_CHECK_CONFIRM_RESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,8,62,10 + CONTROL "&Confirm reboot",IDC_CHECK_CONFIRM_REBOOT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,148,8,62,10 GROUPBOX "Video",IDC_STATIC,5,22,200,43 LTEXT "Mo&de:",IDC_STATIC,12,33,33,8 COMBOBOX IDC_VIDEOTYPE,45,30,95,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP diff --git a/resource/resource.h b/resource/resource.h index 6f46426a..07eb4b73 100644 --- a/resource/resource.h +++ b/resource/resource.h @@ -46,7 +46,7 @@ #define IDR_MENU_DISK_POPUP 143 #define IDR_MENU_DISK_CFG_POPUP 144 #define IDD_ABOUT 145 -#define IDC_CHECK_CONFIRM_RESET 146 +#define IDC_CHECK_CONFIRM_REBOOT 146 #define IDC_KEYB_BUFFER_ENABLE 1005 #define IDC_SAVESTATE 1006 #define IDC_SAVESTATE_ON_EXIT 1007 diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 567f7c33..9a8a74b3 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -595,8 +595,8 @@ void LoadConfiguration(void) if (REGLOAD(TEXT(REGVALUE_WINDOW_SCALE), &dwTmp)) SetViewportScale(dwTmp); - if (REGLOAD(TEXT(REGVALUE_CONFIRM_RESET), &dwTmp)) - g_bConfirmReset = dwTmp; + if (REGLOAD(TEXT(REGVALUE_CONFIRM_REBOOT), &dwTmp)) + g_bConfirmReboot = dwTmp; } //=========================================================================== diff --git a/source/Common.h b/source/Common.h index 7deaf616..1ee2c774 100644 --- a/source/Common.h +++ b/source/Common.h @@ -73,8 +73,8 @@ enum AppMode_e // Configuration #define REG_CONFIG "Configuration" #define REGVALUE_APPLE2_TYPE "Apple2 Type" -#define REGVALUE_OLD_APPLE2_TYPE "Computer Emulation" // Deprecated -#define REGVALUE_CONFIRM_RESET "Confirm Reset" // Added at 1.24.1 PageConfig +#define REGVALUE_OLD_APPLE2_TYPE "Computer Emulation" // Deprecated +#define REGVALUE_CONFIRM_REBOOT "Confirm Reboot" // Added at 1.24.1 PageConfig #define REGVALUE_SPKR_VOLUME "Speaker Volume" #define REGVALUE_MB_VOLUME "Mockingboard Volume" #define REGVALUE_SAVESTATE_FILENAME "Save State Filename" diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index c2596067..c2d58f2c 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -88,8 +88,8 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM VideoChooseColor(); break; - case IDC_CHECK_CONFIRM_RESET: - g_bConfirmReset = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_RESET) ? 1 : 0; + case IDC_CHECK_CONFIRM_REBOOT: + g_bConfirmReboot = IsDlgButtonChecked(hWnd, IDC_CHECK_CONFIRM_REBOOT) ? 1 : 0; case IDC_CHECK_HALF_SCAN_LINES: g_uHalfScanLines = IsDlgButtonChecked(hWnd, IDC_CHECK_HALF_SCAN_LINES) ? 1 : 0; @@ -143,7 +143,7 @@ BOOL CPageConfig::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM m_PropertySheetHelper.FillComboBox(hWnd, IDC_COMPUTER, m_ComputerChoices, nCurrentChoice); } - CheckDlgButton(hWnd, IDC_CHECK_CONFIRM_RESET, g_bConfirmReset ? BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hWnd, IDC_CHECK_CONFIRM_REBOOT, g_bConfirmReboot ? BST_CHECKED : BST_UNCHECKED ); m_PropertySheetHelper.FillComboBox(hWnd,IDC_VIDEOTYPE,g_aVideoChoices,g_eVideoType); CheckDlgButton(hWnd, IDC_CHECK_HALF_SCAN_LINES, g_uHalfScanLines ? BST_CHECKED : BST_UNCHECKED); @@ -212,7 +212,7 @@ void CPageConfig::DlgOK(HWND hWnd) } } - REGSAVE(TEXT(REGVALUE_CONFIRM_RESET), g_bConfirmReset); + REGSAVE(TEXT(REGVALUE_CONFIRM_REBOOT), g_bConfirmReboot); const DWORD newserialport = (DWORD) SendDlgItemMessage(hWnd, IDC_SERIALPORT, CB_GETCURSEL, 0, 0); sg_SSC.CommSetSerialPort(hWnd, newserialport); diff --git a/source/Frame.cpp b/source/Frame.cpp index 43a3e00f..8647f23d 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -109,10 +109,10 @@ static HRGN clipregion = (HRGN)0; static HDC g_hFrameDC = (HDC)0; static RECT framerect = {0,0,0,0}; - HWND g_hFrameWindow = (HWND)0; - BOOL g_bIsFullScreen = 0; - BOOL g_bConfirmReset = 1; // saved PageConfig REGSAVE - BOOL g_bMultiMon = 0; // OFF = load window position & clamp initial frame to screen, ON = use window position as is + HWND g_hFrameWindow = (HWND)0; + BOOL g_bIsFullScreen = 0; + BOOL g_bConfirmReboot = 1; // saved PageConfig REGSAVE + BOOL g_bMultiMon = 0; // OFF = load window position & clamp initial frame to screen, ON = use window position as is static BOOL helpquit = 0; static BOOL g_bPaintingWindow = 0; @@ -1682,15 +1682,18 @@ static void ScreenWindowResize(const bool bCtrlKey) static bool ConfirmReboot(bool bFromButtonUI) { - if (!bFromButtonUI || !g_bConfirmReset) + if (!bFromButtonUI || !g_bConfirmReboot) return true; int res = MessageBox(g_hFrameWindow, "Are you sure you want to reboot?\n" "(All data will be lost!)\n" "\n" - "You can skip this dialog from displaying by unchecking:\n" - " [ ] Confirm reset\n" + "You can skip this dialog from displaying\n" + "in the future by unchecking:\n" + "\n" + " [ ] Confirm reboot\n" + "\n" "in the Configuration dialog.\n" , "Reboot", MB_ICONWARNING|MB_YESNO); return res == IDYES; diff --git a/source/Frame.h b/source/Frame.h index 1f47711f..ac4d146a 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -23,7 +23,7 @@ // Win32 extern HWND g_hFrameWindow; extern BOOL g_bIsFullScreen; - extern BOOL g_bConfirmReset; // saved PageConfig REGSAVE + extern BOOL g_bConfirmReboot; // saved PageConfig REGSAVE extern BOOL g_bMultiMon; // Emulator From 2c8e65ae907d45b210925905870db0e15e8f83a0 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sun, 27 Jul 2014 23:29:24 +0100 Subject: [PATCH 19/35] [Issue#177] Updated History.txt --- bin/History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/History.txt b/bin/History.txt index d7843ae1..8249ce23 100644 --- a/bin/History.txt +++ b/bin/History.txt @@ -41,6 +41,7 @@ Changes: Fixes: . [Bug #206] Pooyan would freeze due to RNDL/RNDH not initialized to non-zero values on a cold boot. +. [Bug #177] Full-screen under Windows8/8.1 would show a corrupt, pastelle color palette. Latest: From b2e5770e51b0ee76183fdf7efd9b195643dc6e88 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sun, 27 Jul 2014 22:40:10 -0700 Subject: [PATCH 20/35] Fix #201 drive swap DOS3.3 disk status Sector drive 2 now displaying properly due to fence post error --- source/Frame.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index cee406d6..1241b4a3 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -612,11 +612,11 @@ void FrameDrawDiskStatus( HDC passdc ) // Try DOS3.3 Sector if( !isProDOS ) { - int DOS33drive = mem[ 0xB7EA ]; + int DOS33drive = mem[ 0xB7EA ]; // 1 or 2 int DOS33sector = mem[ 0xB7ED ]; int DOS33track = mem[ 0xB7EC ]; - if ((DOS33drive >= 0 && DOS33drive < 2) + if ((DOS33drive >= 1 && DOS33drive <= 2) && (DOS33track >= 0 && DOS33track < 40) && (DOS33sector >= 0 && DOS33sector < 16)) { From 21e5ebc619c3e95ae75e4f9fd5150c264f9cefb6 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 28 Jul 2014 08:36:39 -0700 Subject: [PATCH 21/35] #201 Always display Track/Sector in full screen mode. Also show at start-up. --- source/Frame.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/Frame.cpp b/source/Frame.cpp index 1241b4a3..6299dc97 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -761,6 +761,8 @@ static void DrawStatusArea (HDC passdc, int drawflags) { SelectObject(dc,smallfont); + FrameDrawDiskStatus( dc ); + #if HD_LED SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] ); TextOut(dc,x+23,y+2,TEXT("H"),1); @@ -824,6 +826,7 @@ static void DrawStatusArea (HDC passdc, int drawflags) if (drawflags & DRAW_LEDS) { FrameDrawDiskLEDS( dc ); + FrameDrawDiskStatus( dc ); if (!IS_APPLE2) { From f500d72143201b64b63924b9055cc95455c121b1 Mon Sep 17 00:00:00 2001 From: tomcw Date: Mon, 28 Jul 2014 21:08:55 +0100 Subject: [PATCH 22/35] Update History.txt with v1.24.0 changes. Update location of History.txt in all VS project files (docs -> bin). --- AppleWinExpress2012.vcxproj | 2 +- AppleWinExpress2012.vcxproj.filters | 2 +- ApplewinExpress10.00.vcxproj | 2 +- ApplewinExpress10.00.vcxproj.filters | 2 +- ApplewinExpress2005.vcproj | 2 +- ApplewinExpress9.00.vcproj | 2 +- bin/History.txt | 12 ++++-------- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/AppleWinExpress2012.vcxproj b/AppleWinExpress2012.vcxproj index d7ad4caa..93e52718 100644 --- a/AppleWinExpress2012.vcxproj +++ b/AppleWinExpress2012.vcxproj @@ -103,7 +103,7 @@ - + diff --git a/AppleWinExpress2012.vcxproj.filters b/AppleWinExpress2012.vcxproj.filters index 04dae33a..861c9f51 100644 --- a/AppleWinExpress2012.vcxproj.filters +++ b/AppleWinExpress2012.vcxproj.filters @@ -293,7 +293,7 @@ Docs - + Docs diff --git a/ApplewinExpress10.00.vcxproj b/ApplewinExpress10.00.vcxproj index 4b62d7fa..d9e333b7 100644 --- a/ApplewinExpress10.00.vcxproj +++ b/ApplewinExpress10.00.vcxproj @@ -465,7 +465,7 @@ - + diff --git a/ApplewinExpress10.00.vcxproj.filters b/ApplewinExpress10.00.vcxproj.filters index 27763b9b..a4702a7f 100644 --- a/ApplewinExpress10.00.vcxproj.filters +++ b/ApplewinExpress10.00.vcxproj.filters @@ -468,7 +468,7 @@ Docs - + Docs diff --git a/ApplewinExpress2005.vcproj b/ApplewinExpress2005.vcproj index a0f5e9ba..69edd675 100644 --- a/ApplewinExpress2005.vcproj +++ b/ApplewinExpress2005.vcproj @@ -777,7 +777,7 @@ > Input) . Debugger: Added "disk info" command -. [Feature #5668] Added confirmation message box for reboot (F2) +. Added confirmation message box for reboot (F2) . [Feature #5715] Added -no-printscreen-dlg to suppress the warning if AppleWin fails to capture the PrintScreen key . Changed save-state file persisted to Registry from filename to pathame Fixes: @@ -66,7 +62,7 @@ Fixes: 1.23.2 - 14 Sep 2013 -------------------- Changes: -. [Feature #5105] Added About dialog showing GPL (at startup, but only when AppleWin version changes). +. Added About dialog showing GPL (at startup, but only when AppleWin version changes). . [Bug #18940] Extend BSAVE and BLOAD Command To Memory Banks 0 and 1 Extended debugger BLOAD with bank support: . BLOAD [file],[bank:]address[,length] @@ -272,7 +268,7 @@ Fixes: . [Bug #14879] Double-Lo-Res Graphics colors not correct -1.16.1 - 20 Jun 2009 +1.16.1 - 21 Jun 2009 -------------------- Changes: . Ctrl-F2 now functions as CONTROL-RESET (same as Ctrl-Break) From 627620ef6e70210ef3ece007c53fe035d325147e Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 28 Jul 2014 13:57:54 -0700 Subject: [PATCH 23/35] #201 Fix fence post logic bug in ProDOS drive dection --- source/Frame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 6299dc97..3a145eb8 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -646,7 +646,7 @@ void FrameDrawDiskStatus( HDC passdc ) int ProDOStrack = *MemGetMainPtr( 0xC356 ); // LC1 $D356 int ProDOSsector = *MemGetMainPtr( 0xC357 ); // LC1 $D357 - if ((ProDOSdrive >= 0 && ProDOSdrive < 2) + if ((ProDOSdrive >= 1 && ProDOSdrive <= 2) && (ProDOStrack >= 0 && ProDOStrack < 40) && (ProDOSsector >= 0 && ProDOSsector < 16)) { From 598df5ce9b2f12eb4357ec8a99db0170a6742e58 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 28 Jul 2014 14:13:40 -0700 Subject: [PATCH 24/35] Code cleanup: #201 use actual floppy drive --- source/Frame.cpp | 49 ++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index 3a145eb8..e0b5cbe7 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -600,6 +600,11 @@ void FrameDrawDiskLEDS( HDC passdc ) //=========================================================================== void FrameDrawDiskStatus( HDC passdc ) { + // We use the actual drive since probing from memory doesn't tell us anything we don't already know. + // DOS3.3 ProDOS + // Drive $B7EA $BE3D + // Track $B7EC LC1 $D356 + // Sector $B7ED LC1 $D357 int nActiveFloppy = DiskGetCurrentDrive(); int nDisk1Track = DiskGetTrack(0); @@ -612,25 +617,23 @@ void FrameDrawDiskStatus( HDC passdc ) // Try DOS3.3 Sector if( !isProDOS ) { - int DOS33drive = mem[ 0xB7EA ]; // 1 or 2 - int DOS33sector = mem[ 0xB7ED ]; - int DOS33track = mem[ 0xB7EC ]; + int nDOS33track = mem[ 0xB7EC ]; + int nDOS33sector = mem[ 0xB7ED ]; - if ((DOS33drive >= 1 && DOS33drive <= 2) - && (DOS33track >= 0 && DOS33track < 40) - && (DOS33sector >= 0 && DOS33sector < 16)) + if ((nDOS33track >= 0 && nDOS33track < 40) + && (nDOS33sector >= 0 && nDOS33sector < 16)) { - #if _DEBUG && 0 - if(DOS33track != nDisk1Track) - { - char text[128]; - sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", DOS33track, DOS33track, nDisk1Track, nDisk1Track ); - OutputDebugString( text ); - } - #endif // _DEBUG +#if _DEBUG && 0 + if (nDOS33track != nDisk1Track) + { + char text[128]; + sprintf( text, "\n\n\nWARNING: DOS33Track: %d (%02X) != nDisk1Track: %d (%02X)\n\n\n", nDOS33track, nDOS33track, nDisk1Track, nDisk1Track ); + OutputDebugString( text ); + } +#endif // _DEBUG - /**/ if( DOS33drive == 1 ) g_nSectorDrive1 = DOS33sector; - else if( DOS33drive == 2 ) g_nSectorDrive2 = DOS33sector; + /**/ if (nActiveFloppy == 0) g_nSectorDrive1 = nDOS33sector; + else if (nActiveFloppy == 1) g_nSectorDrive2 = nDOS33sector; } else isValid = false; @@ -642,16 +645,14 @@ void FrameDrawDiskStatus( HDC passdc ) // and we need the Language Card RAM // memrom[ 0xD350 ] = " ERROR\x07\x00" // T S - int ProDOSdrive = nActiveFloppy + 1; // mem[ 0xBE3D ]; - int ProDOStrack = *MemGetMainPtr( 0xC356 ); // LC1 $D356 - int ProDOSsector = *MemGetMainPtr( 0xC357 ); // LC1 $D357 + int nProDOStrack = *MemGetMainPtr( 0xC356 ); // LC1 $D356 + int nProDOSsector = *MemGetMainPtr( 0xC357 ); // LC1 $D357 - if ((ProDOSdrive >= 1 && ProDOSdrive <= 2) - && (ProDOStrack >= 0 && ProDOStrack < 40) - && (ProDOSsector >= 0 && ProDOSsector < 16)) + if ((nProDOStrack >= 0 && nProDOStrack < 40) + && (nProDOSsector >= 0 && nProDOSsector < 16)) { - /**/ if (ProDOSdrive == 1) g_nSectorDrive1 = ProDOSsector; - else if (ProDOSdrive == 2) g_nSectorDrive2 = ProDOSsector; + /**/ if (nActiveFloppy == 0) g_nSectorDrive1 = nProDOSsector; + else if (nActiveFloppy == 1) g_nSectorDrive2 = nProDOSsector; } else isValid = false; From ae5d765b2cb426ef0f784d1bbe9fa2f13556bfd6 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Mon, 28 Jul 2014 14:18:32 -0700 Subject: [PATCH 25/35] #201 cleanup to match coding standards --- source/Frame.cpp | 51 +++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/source/Frame.cpp b/source/Frame.cpp index e0b5cbe7..96ae6493 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -605,6 +605,7 @@ void FrameDrawDiskStatus( HDC passdc ) // Drive $B7EA $BE3D // Track $B7EC LC1 $D356 // Sector $B7ED LC1 $D357 + // RWTS LC1 $D300 int nActiveFloppy = DiskGetCurrentDrive(); int nDisk1Track = DiskGetTrack(0); @@ -615,7 +616,7 @@ void FrameDrawDiskStatus( HDC passdc ) bool isValid = true; // Try DOS3.3 Sector - if( !isProDOS ) + if ( !isProDOS ) { int nDOS33track = mem[ 0xB7EC ]; int nDOS33sector = mem[ 0xB7ED ]; @@ -638,13 +639,12 @@ void FrameDrawDiskStatus( HDC passdc ) else isValid = false; } - else - if( isProDOS ) // & regs.pc > 0xD000 ) // RWTS @ $D300 + else // isProDOS { // we can't just read from mem[ 0xD357 ] since it might be bank-switched from ROM // and we need the Language Card RAM - // memrom[ 0xD350 ] = " ERROR\x07\x00" - // T S + // memrom[ 0xD350 ] = " ERROR\x07\x00" Applesoft error message + // T S int nProDOStrack = *MemGetMainPtr( 0xC356 ); // LC1 $D356 int nProDOSsector = *MemGetMainPtr( 0xC357 ); // LC1 $D357 @@ -711,34 +711,31 @@ void FrameDrawDiskStatus( HDC passdc ) } else { - // NB. Only draw Track/Sector if 2x windowed - if (g_nOldViewportScale == 1) - return; + // NB. Only draw Track/Sector if 2x windowed + if (g_nOldViewportScale == 1) + return; - // Erase background - SelectObject(dc,GetStockObject(NULL_PEN)); + // Erase background + SelectObject(dc,GetStockObject(NULL_PEN)); #if _DEBUG && 0 - SelectObject( dc, CreateSolidBrush( RGB(255,0,255) ) ); + SelectObject( dc, CreateSolidBrush( RGB(255,0,255) ) ); #else - SelectObject(dc,btnfacebrush); + SelectObject(dc,btnfacebrush); #endif - Rectangle(dc,x+4,y+32,x+BUTTONCX+1,y+56); // y+35 -> 44 -> 56 + Rectangle(dc,x+4,y+32,x+BUTTONCX+1,y+56); // y+35 -> 44 -> 56 - SetTextColor(dc,RGB(0,0,0)); - SetBkMode(dc,TRANSPARENT); + SetTextColor(dc,RGB(0,0,0)); + SetBkMode(dc,TRANSPARENT); -// if( nActiveFloppy == 0 ) - { - sprintf( text, "T%s", g_sTrackDrive1 ); - TextOut(dc,x+6 ,y+32,text, strlen(text) ); - sprintf( text, "S%s", g_sSectorDrive1 ); - TextOut(dc,x+ 6,y+42, text, strlen(text) ); -// } else { - sprintf( text, "T%s", g_sTrackDrive2 ); - TextOut(dc,x+26,y+32,text, strlen(text) ); - sprintf( text, "S%s", g_sSectorDrive2 ); - TextOut(dc,x+26,y+42, text, strlen(text) ); - } + sprintf( text, "T%s", g_sTrackDrive1 ); + TextOut(dc,x+6 ,y+32,text, strlen(text) ); + sprintf( text, "S%s", g_sSectorDrive1 ); + TextOut(dc,x+ 6,y+42, text, strlen(text) ); + + sprintf( text, "T%s", g_sTrackDrive2 ); + TextOut(dc,x+26,y+32,text, strlen(text) ); + sprintf( text, "S%s", g_sSectorDrive2 ); + TextOut(dc,x+26,y+42, text, strlen(text) ); } } From 391b89180746476d8f3cb1ba9fcf95246977d200 Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Tue, 29 Jul 2014 07:56:55 -0700 Subject: [PATCH 26/35] #201 Don't update track/sector on disk swap --- source/Common.h | 9 +++++---- source/Disk.cpp | 3 +-- source/Frame.cpp | 15 ++++++++++----- source/Frame.h | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/source/Common.h b/source/Common.h index 1ee2c774..19716f2b 100644 --- a/source/Common.h +++ b/source/Common.h @@ -39,10 +39,11 @@ enum AppMode_e #define SPEED_NORMAL 10 #define SPEED_MAX 40 -#define DRAW_BACKGROUND 1 -#define DRAW_LEDS 2 -#define DRAW_TITLE 4 -#define DRAW_BUTTON_DRIVES 8 +#define DRAW_BACKGROUND (1 << 0) +#define DRAW_LEDS (1 << 1) +#define DRAW_TITLE (1 << 2) +#define DRAW_BUTTON_DRIVES (1 << 3) +#define DRAW_DISK_STATUS (1 << 4) #define BTN_HELP 0 #define BTN_RUN 1 diff --git a/source/Disk.cpp b/source/Disk.cpp index 03ac43c6..2f660305 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -982,8 +982,7 @@ bool DiskDriveSwap(void) Disk_SaveLastDiskImage(DRIVE_1); Disk_SaveLastDiskImage(DRIVE_2); - FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES); - FrameDrawDiskLEDS( (HDC)0 ); + FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, false ); return true; } diff --git a/source/Frame.cpp b/source/Frame.cpp index 96ae6493..1a3af671 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -538,7 +538,7 @@ static void DrawFrameWindow () } // DRAW THE STATUS AREA - DrawStatusArea(dc,DRAW_BACKGROUND | DRAW_LEDS); + DrawStatusArea(dc,DRAW_BACKGROUND | DRAW_LEDS | DRAW_DISK_STATUS); // DRAW THE CONTENTS OF THE EMULATED SCREEN if (g_nAppMode == MODE_LOGO) @@ -759,7 +759,8 @@ static void DrawStatusArea (HDC passdc, int drawflags) { SelectObject(dc,smallfont); - FrameDrawDiskStatus( dc ); + if (drawflags & DRAW_DISK_STATUS) + FrameDrawDiskStatus( dc ); #if HD_LED SetTextColor(dc, g_aDiskFullScreenColorsLED[ eHardDriveStatus ] ); @@ -824,7 +825,9 @@ static void DrawStatusArea (HDC passdc, int drawflags) if (drawflags & DRAW_LEDS) { FrameDrawDiskLEDS( dc ); - FrameDrawDiskStatus( dc ); + + if (drawflags & DRAW_DISK_STATUS) + FrameDrawDiskStatus( dc ); if (!IS_APPLE2) { @@ -2346,8 +2349,10 @@ HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_) } //=========================================================================== -void FrameRefreshStatus (int drawflags) { - DrawStatusArea((HDC)0,drawflags); +void FrameRefreshStatus (int drawflags, bool bUpdateDiskStatus) { + // NB. 99% of the time we draw the disk status. On DiskDriveSwap() we don't. + drawflags |= bUpdateDiskStatus ? DRAW_DISK_STATUS : 0; + DrawStatusArea((HDC)0,drawflags); } //=========================================================================== diff --git a/source/Frame.h b/source/Frame.h index ac4d146a..d524a6ab 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -38,7 +38,7 @@ void FrameCreateWindow(void); HDC FrameGetDC (); HDC FrameGetVideoDC (LPBYTE *,LONG *); - void FrameRefreshStatus (int); + void FrameRefreshStatus (int, bool bUpdateDiskStatus = true ); void FrameRegisterClass (); void FrameReleaseDC (); void FrameReleaseVideoDC (); From 6a26a9548707b07535f0a33c37eef1a183561bfd Mon Sep 17 00:00:00 2001 From: tomcw Date: Wed, 13 Aug 2014 21:30:35 +0100 Subject: [PATCH 27/35] PCH refactor: remove non-system headers from stdafx.h --- source/Applewin.cpp | 21 ++++++++++-- source/Applewin.h | 2 ++ source/CPU.cpp | 15 ++++++-- source/Common.h | 2 -- source/Configuration/About.cpp | 26 ++++++++++++++ source/Configuration/Config.h | 1 + source/Configuration/PageAdvanced.cpp | 33 ++++++++++++++++-- source/Configuration/PageConfig.cpp | 32 ++++++++++++++++- source/Configuration/PageConfigTfe.cpp | 28 ++++++++++++++- source/Configuration/PageDisk.cpp | 34 +++++++++++++++++-- source/Configuration/PageInput.cpp | 30 +++++++++++++++- source/Configuration/PageSound.cpp | 31 ++++++++++++++++- source/Configuration/PropertySheet.cpp | 6 +++- source/Configuration/PropertySheetHelper.cpp | 11 ++++-- source/Configuration/PropertySheetHelper.h | 2 +- source/Debugger/Debug.cpp | 11 +++++- source/Debugger/Debug.h | 4 ++- source/Debugger/Debugger_Assembler.cpp | 6 ++++ source/Debugger/Debugger_Color.cpp | 3 ++ source/Debugger/Debugger_Commands.cpp | 4 +++ source/Debugger/Debugger_Console.cpp | 1 + source/Debugger/Debugger_DisassemblerData.cpp | 2 ++ source/Debugger/Debugger_Display.cpp | 11 +++++- source/Debugger/Debugger_Help.cpp | 4 +++ source/Debugger/Debugger_Parser.cpp | 4 +++ source/Debugger/Debugger_Range.cpp | 1 + source/Debugger/Debugger_Symbols.cpp | 3 ++ source/Disk.cpp | 18 +++++++--- source/Disk.h | 2 +- source/DiskImage.cpp | 3 +- source/DiskImageHelper.cpp | 11 +++++- source/DiskImageHelper.h | 2 ++ source/Frame.cpp | 22 ++++++++++-- source/Frame.h | 2 +- source/Harddisk.cpp | 10 ++++-- source/Joystick.cpp | 6 ++++ source/Keyboard.cpp | 4 +++ source/Memory.cpp | 19 +++++++++++ source/Mockingboard.cpp | 13 ++++--- source/MouseInterface.cpp | 13 ++++--- source/ParallelPrinter.cpp | 8 ++++- source/SaveState.cpp | 11 ++++++ source/SerialComms.cpp | 8 +++++ source/SerialComms.h | 4 +-- source/SoundCore.cpp | 4 +++ source/Speaker.cpp | 10 ++++++ source/StdAfx.h | 28 +-------------- source/Structs.h | 1 + source/Tape.cpp | 4 +++ source/Util_MemoryTextFile.cpp | 24 +++++++++++++ source/Video.cpp | 11 ++++++ source/Z80VICE/z80.cpp | 6 +++- source/z80emu.cpp | 3 ++ 53 files changed, 498 insertions(+), 77 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 9a8a74b3..ff266800 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -27,13 +27,30 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#include "DiskImage.h" -#include "Harddisk.h" +#include "AppleWin.h" +#include "CPU.h" +#include "Debug.h" +#include "Disk.h" +#include "DiskImage.h" +#include "Frame.h" +#include "Harddisk.h" +#include "Log.h" +#include "Memory.h" +#include "Mockingboard.h" #include "MouseInterface.h" +#include "ParallelPrinter.h" +#include "Registry.h" +#include "Riff.h" +#include "SaveState.h" +#include "SerialComms.h" +#include "SoundCore.h" +#include "Speaker.h" #ifdef USE_SPEECH_API #include "Speech.h" #endif +#include "Video.h" + #include "Configuration\About.h" #include "Configuration\PropertySheet.h" #include "Tfe\Tfe.h" diff --git a/source/Applewin.h b/source/Applewin.h index 2621d3ba..6fa6f896 100644 --- a/source/Applewin.h +++ b/source/Applewin.h @@ -1,5 +1,7 @@ #pragma once +#include "Structs.h" + void SetCurrentCLK6502(); void SetCurrentImageDir(const char* pszImageDir); diff --git a/source/CPU.cpp b/source/CPU.cpp index 02148503..f54cdb45 100644 --- a/source/CPU.cpp +++ b/source/CPU.cpp @@ -85,15 +85,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Frame.h" +#include "Memory.h" +#include "Mockingboard.h" #include "MouseInterface.h" +#ifdef USE_SPEECH_API +#include "Speech.h" +#endif +#include "Video.h" #include "z80emu.h" #include "Z80VICE\z80.h" #include "Z80VICE\z80mem.h" -#ifdef USE_SPEECH_API -#include "Speech.h" -#endif +#include "Debugger\Debug.h" + #define AF_SIGN 0x80 #define AF_OVERFLOW 0x40 diff --git a/source/Common.h b/source/Common.h index 19716f2b..05d339db 100644 --- a/source/Common.h +++ b/source/Common.h @@ -1,7 +1,5 @@ #pragma once -#define USE_SPEECH_API - const double _M14 = (157500000.0 / 11.0); // 14.3181818... * 10^6 const double CLK_6502 = ((_M14 * 65.0) / 912.0); // 65 cycles per 912 14M clocks //const double CLK_6502 = 23 * 44100; // 1014300 diff --git a/source/Configuration/About.cpp b/source/Configuration/About.cpp index eab60317..1d862b70 100644 --- a/source/Configuration/About.cpp +++ b/source/Configuration/About.cpp @@ -1,4 +1,30 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "stdafx.h" + +#include "..\AppleWin.h" +#include "..\Frame.h" #include "..\resource\resource.h" static const char g_szGPL[] = diff --git a/source/Configuration/Config.h b/source/Configuration/Config.h index 1cd4e3ed..626ba0a7 100644 --- a/source/Configuration/Config.h +++ b/source/Configuration/Config.h @@ -1,5 +1,6 @@ #pragma once +#include "..\AppleWin.h" #include "..\HardDisk.h" class CConfigNeedingRestart diff --git a/source/Configuration/PageAdvanced.cpp b/source/Configuration/PageAdvanced.cpp index ffd05ca2..27036958 100644 --- a/source/Configuration/PageAdvanced.cpp +++ b/source/Configuration/PageAdvanced.cpp @@ -1,7 +1,36 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" +#include "..\Structs.h" + +#include "..\Disk.h" +#include "..\ParallelPrinter.h" +#include "..\Registry.h" +#include "..\SaveState.h" +#include "..\resource\resource.h" #include "PageAdvanced.h" #include "PropertySheetHelper.h" -#include "..\resource\resource.h" CPageAdvanced* CPageAdvanced::ms_this = 0; // reinit'd in ctor @@ -61,7 +90,7 @@ BOOL CPageAdvanced::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPAR break; case IDC_PRINTER_DUMP_FILENAME_BROWSE: { - string strPrinterDumpLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select printer dump file"), REGVALUE_PRINTER_FILENAME, TEXT("Text files (*.txt)\0*.txt\0") TEXT("All Files\0*.*\0")); + std::string strPrinterDumpLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select printer dump file"), REGVALUE_PRINTER_FILENAME, TEXT("Text files (*.txt)\0*.txt\0") TEXT("All Files\0*.*\0")); SendDlgItemMessage(hWnd, IDC_PRINTER_DUMP_FILENAME, WM_SETTEXT, 0, (LPARAM)strPrinterDumpLoc.c_str()); } break; diff --git a/source/Configuration/PageConfig.cpp b/source/Configuration/PageConfig.cpp index c2d58f2c..0421b3c1 100644 --- a/source/Configuration/PageConfig.cpp +++ b/source/Configuration/PageConfig.cpp @@ -1,7 +1,37 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" + +#include "..\AppleWin.h" +#include "..\Disk.h" +#include "..\Frame.h" +#include "..\Registry.h" +#include "..\SerialComms.h" +#include "..\Video.h" +#include "..\resource\resource.h" #include "PageConfig.h" #include "PropertySheetHelper.h" -#include "..\resource\resource.h" CPageConfig* CPageConfig::ms_this = 0; // reinit'd in ctor diff --git a/source/Configuration/PageConfigTfe.cpp b/source/Configuration/PageConfigTfe.cpp index 37585c74..5c047897 100644 --- a/source/Configuration/PageConfigTfe.cpp +++ b/source/Configuration/PageConfigTfe.cpp @@ -1,8 +1,34 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" -#include "PageConfigTfe.h" + +#include "..\Common.h" +#include "..\Registry.h" #include "..\resource\resource.h" #include "..\Tfe\Tfe.h" #include "..\Tfe\Tfesupp.h" +#include "PageConfigTfe.h" CPageConfigTfe* CPageConfigTfe::ms_this = 0; // reinit'd in ctor diff --git a/source/Configuration/PageDisk.cpp b/source/Configuration/PageDisk.cpp index d9753130..2540ed13 100644 --- a/source/Configuration/PageDisk.cpp +++ b/source/Configuration/PageDisk.cpp @@ -1,8 +1,36 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" + +#include "..\AppleWin.h" +#include "..\Harddisk.h" +#include "..\Disk.h" +#include "..\Frame.h" +#include "..\Registry.h" +#include "..\resource\resource.h" #include "PageDisk.h" #include "PropertySheetHelper.h" -#include "..\Harddisk.h" -#include "..\resource\resource.h" CPageDisk* CPageDisk::ms_this = 0; // reinit'd in ctor @@ -86,7 +114,7 @@ BOOL CPageDisk::DlgProcInternal(HWND hWnd, UINT message, WPARAM wparam, LPARAM l case IDC_CIDERPRESS_BROWSE: { - string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") ); + std::string CiderPressLoc = m_PropertySheetHelper.BrowseToFile(hWnd, TEXT("Select path to CiderPress"), REGVALUE_CIDERPRESSLOC, TEXT("Applications (*.exe)\0*.exe\0") TEXT("All Files\0*.*\0") ); RegSaveString(TEXT(REG_CONFIG), REGVALUE_CIDERPRESSLOC, 1, CiderPressLoc.c_str()); SendDlgItemMessage(hWnd, IDC_CIDERPRESS_FILENAME, WM_SETTEXT, 0, (LPARAM) CiderPressLoc.c_str()); } diff --git a/source/Configuration/PageInput.cpp b/source/Configuration/PageInput.cpp index 7184ed98..e9cd7f01 100644 --- a/source/Configuration/PageInput.cpp +++ b/source/Configuration/PageInput.cpp @@ -1,7 +1,35 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" +#include "..\Structs.h" + +#include "..\Disk.h" +#include "..\Keyboard.h" +#include "..\Registry.h" +#include "..\resource\resource.h" #include "PageInput.h" #include "PropertySheetHelper.h" -#include "..\resource\resource.h" CPageInput* CPageInput::ms_this = 0; // reinit'd in ctor diff --git a/source/Configuration/PageSound.cpp b/source/Configuration/PageSound.cpp index 8fc36101..f8f1117e 100644 --- a/source/Configuration/PageSound.cpp +++ b/source/Configuration/PageSound.cpp @@ -1,7 +1,36 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski, Nick Westgate + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" +#include "..\Structs.h" + +#include "..\Disk.h" +#include "..\Mockingboard.h" +#include "..\Registry.h" +#include "..\Speaker.h" +#include "..\resource\resource.h" #include "PageSound.h" #include "PropertySheetHelper.h" -#include "..\resource\resource.h" CPageSound* CPageSound::ms_this = 0; // reinit'd in ctor diff --git a/source/Configuration/PropertySheet.cpp b/source/Configuration/PropertySheet.cpp index 8550bf3c..3c00c3f5 100644 --- a/source/Configuration/PropertySheet.cpp +++ b/source/Configuration/PropertySheet.cpp @@ -28,8 +28,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#include "PropertySheet.h" + +#include "..\AppleWin.h" +#include "..\Disk.h" +#include "..\Frame.h" #include "..\resource\resource.h" +#include "PropertySheet.h" void CPropertySheet::Init(void) { diff --git a/source/Configuration/PropertySheetHelper.cpp b/source/Configuration/PropertySheetHelper.cpp index 01c61c39..b135b059 100644 --- a/source/Configuration/PropertySheetHelper.cpp +++ b/source/Configuration/PropertySheetHelper.cpp @@ -22,9 +22,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdafx.h" -#include "PropertySheetHelper.h" + #include "..\AppleWin.h" // g_nAppMode, g_uScrollLockToggle, sg_PropertySheet +#include "..\Disk.h" +#include "..\Frame.h" +#include "..\Registry.h" +#include "..\SaveState.h" #include "IPropertySheet.h" +#include "PropertySheetHelper.h" /* Config causing AfterClose msgs: @@ -114,7 +119,7 @@ void CPropertySheetHelper::SetSlot5(SS_CARDTYPE NewCardType) // Used by: // . CPageDisk: IDC_CIDERPRESS_BROWSE // . CPageAdvanced: IDC_PRINTER_DUMP_FILENAME_BROWSE -string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS) +std::string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE, TCHAR* FILEMASKS) { static char PathToFile[MAX_PATH] = {0}; //This is a really awkward way to prevent mixing CiderPress and SaveStated values (RAPCS), but it seem the quickest. Here is its Line 1. strcpy(PathToFile, Snapshot_GetFilename()); //RAPCS, line 2. @@ -122,7 +127,7 @@ string CPropertySheetHelper::BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* TCHAR szFilename[MAX_PATH]; strcpy(szFilename, ""); RegLoadString(TEXT("Configuration"), REGVALUE, 1, szFilename ,MAX_PATH); - string PathName = szFilename; + std::string PathName = szFilename; OPENFILENAME ofn; ZeroMemory(&ofn,sizeof(OPENFILENAME)); diff --git a/source/Configuration/PropertySheetHelper.h b/source/Configuration/PropertySheetHelper.h index d600dcb4..74896cdb 100644 --- a/source/Configuration/PropertySheetHelper.h +++ b/source/Configuration/PropertySheetHelper.h @@ -16,7 +16,7 @@ public: void FillComboBox(HWND window, int controlid, LPCTSTR choices, int currentchoice); void SetSlot4(SS_CARDTYPE NewCardType); void SetSlot5(SS_CARDTYPE NewCardType); - string BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE,TCHAR* FILEMASKS); + std::string BrowseToFile(HWND hWindow, TCHAR* pszTitle, TCHAR* REGVALUE,TCHAR* FILEMASKS); void SaveStateUpdate(); void GetDiskBaseNameWithAWS(TCHAR* pszFilename); int SaveStateSelectImage(HWND hWindow, TCHAR* pszTitle, bool bSave); diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 53dbe436..2af6a2ca 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -30,7 +30,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //#pragma warning(disable: 4786) #include "StdAfx.h" -#include "debugger_display.h" // dup from stdafx.h, but CPP analysis isn't picking up APPLE_FONT_NEW + +#include "Debug.h" + +#include "..\AppleWin.h" +#include "..\CPU.h" +#include "..\Disk.h" +#include "..\Frame.h" +#include "..\Keyboard.h" +#include "..\Memory.h" +#include "..\Video.h" // #define DEBUG_COMMAND_HELP 1 // #define DEBUG_ASM_HASH 1 diff --git a/source/Debugger/Debug.h b/source/Debugger/Debug.h index 78f07f0b..b1808783 100644 --- a/source/Debugger/Debug.h +++ b/source/Debugger/Debug.h @@ -5,6 +5,8 @@ #include using namespace std; +#include "..\Structs.h" + #include "Debugger_Types.h" #include "Debugger_DisassemblerData.h" #include "Debugger_Range.h" @@ -14,7 +16,7 @@ using namespace std; #include "Debugger_Help.h" #include "Debugger_Display.h" #include "Debugger_Symbols.h" -#include "Util_MemoryTextFile.h" +#include "..\Util_MemoryTextFile.h" // Globals __________________________________________________________________ diff --git a/source/Debugger/Debugger_Assembler.cpp b/source/Debugger/Debugger_Assembler.cpp index 1670d45a..4a42076e 100644 --- a/source/Debugger/Debugger_Assembler.cpp +++ b/source/Debugger/Debugger_Assembler.cpp @@ -28,6 +28,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + +#include "..\CPU.h" +#include "..\Frame.h" +#include "..\Memory.h" + #define DEBUG_ASSEMBLER 0 // Globals __________________________________________________________________ diff --git a/source/Debugger/Debugger_Color.cpp b/source/Debugger/Debugger_Color.cpp index be1f6014..6a930c49 100644 --- a/source/Debugger/Debugger_Color.cpp +++ b/source/Debugger/Debugger_Color.cpp @@ -25,6 +25,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + + // Color ______________________________________________________________________ int g_iColorScheme = SCHEME_COLOR; diff --git a/source/Debugger/Debugger_Commands.cpp b/source/Debugger/Debugger_Commands.cpp index fc5fd10f..151f6543 100644 --- a/source/Debugger/Debugger_Commands.cpp +++ b/source/Debugger/Debugger_Commands.cpp @@ -25,6 +25,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + +#include "..\Frame.h" + // Commands _______________________________________________________________________________________ #define DEBUGGER__COMMANDS_VERIFY_TXT__ "\xDE\xAD\xC0\xDE" diff --git a/source/Debugger/Debugger_Console.cpp b/source/Debugger/Debugger_Console.cpp index e11e052b..91bc4b2f 100644 --- a/source/Debugger/Debugger_Console.cpp +++ b/source/Debugger/Debugger_Console.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" // Console ________________________________________________________________________________________ diff --git a/source/Debugger/Debugger_DisassemblerData.cpp b/source/Debugger/Debugger_DisassemblerData.cpp index b60cd38f..74f3b5e4 100644 --- a/source/Debugger/Debugger_DisassemblerData.cpp +++ b/source/Debugger/Debugger_DisassemblerData.cpp @@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + // Disassembler Data ______________________________________________________________________________ diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 745eeed3..db4420ab 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -27,7 +27,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#include "debugger_display.h" // dup from stdafx.h, but CPP analysis isn't picking up USE_APPLE_FONT + +#include "Debug.h" +#include "Debugger_Display.h" + +#include "..\AppleWin.h" +#include "..\CPU.h" +#include "..\Frame.h" +#include "..\Memory.h" +#include "..\Mockingboard.h" +#include "..\Video.h" // NEW UI debugging - force display ALL meta-info (regs, stack, bp, watches, zp) for debugging purposes #define DEBUG_FORCE_DISPLAY 0 diff --git a/source/Debugger/Debugger_Help.cpp b/source/Debugger/Debugger_Help.cpp index b9984ffd..f3c27ff8 100644 --- a/source/Debugger/Debugger_Help.cpp +++ b/source/Debugger/Debugger_Help.cpp @@ -28,6 +28,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + +#include "..\AppleWin.h" + #define DEBUG_COLOR_CONSOLE 0 diff --git a/source/Debugger/Debugger_Parser.cpp b/source/Debugger/Debugger_Parser.cpp index 4a925a30..76dc8d85 100644 --- a/source/Debugger/Debugger_Parser.cpp +++ b/source/Debugger/Debugger_Parser.cpp @@ -28,6 +28,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + +#include "..\CPU.h" +#include "..\Memory.h" // Args ___________________________________________________________________________________________ diff --git a/source/Debugger/Debugger_Range.cpp b/source/Debugger/Debugger_Range.cpp index e1dfe4d5..d60a7dc0 100644 --- a/source/Debugger/Debugger_Range.cpp +++ b/source/Debugger/Debugger_Range.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" // Util - Range _______________________________________________________________ diff --git a/source/Debugger/Debugger_Symbols.cpp b/source/Debugger/Debugger_Symbols.cpp index 0d7d2c91..288d0064 100644 --- a/source/Debugger/Debugger_Symbols.cpp +++ b/source/Debugger/Debugger_Symbols.cpp @@ -28,6 +28,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "Debug.h" + +#include "..\AppleWin.h" // 2.6.2.13 Added: Can now enable/disable selected symbol table(s) ! // Allow the user to disable/enable symbol tables diff --git a/source/Disk.cpp b/source/Disk.cpp index 2f660305..6fcff6ff 100644 --- a/source/Disk.cpp +++ b/source/Disk.cpp @@ -27,7 +27,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" + +#include "AppleWin.h" +#include "Disk.h" #include "DiskImage.h" +#include "Frame.h" +#include "Memory.h" +#include "Registry.h" +#include "Video.h" + #include "..\resource\resource.h" #define LOG_DISK_ENABLED 0 @@ -60,8 +68,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA { TCHAR imagename[ MAX_DISK_IMAGE_NAME + 1 ]; // (ie. no extension) TCHAR fullname [ MAX_DISK_FULL_NAME + 1 ]; // or : This is persisted to the snapshot file - string strDiskPathFilename; - string strFilenameInZip; // 0x00 or + std::string strDiskPathFilename; + std::string strFilenameInZip; // 0x00 or HIMAGE imagehandle; // Init'd by DiskInsert() -> ImageOpen() int track; LPBYTE trackimage; @@ -119,12 +127,12 @@ int DiskGetCurrentPhase(void) { return g_aFloppyDisk[currdrive].phase; } int DiskGetCurrentOffset(void) { return g_aFloppyDisk[currdrive].byte; } int DiskGetTrack( int drive ) { return g_aFloppyDisk[ drive ].track; } -const string& DiskGetDiskPathFilename(const int iDrive) +const std::string& DiskGetDiskPathFilename(const int iDrive) { return g_aFloppyDisk[iDrive].strDiskPathFilename; } -static void DiskSetDiskPathFilename(const int iDrive, const string strPathName) +static void DiskSetDiskPathFilename(const int iDrive, const std::string strPathName) { g_aFloppyDisk[iDrive].strDiskPathFilename = strPathName; } @@ -977,7 +985,7 @@ bool DiskDriveSwap(void) // Swap disks between drives // . NB. We swap trackimage ptrs (so don't need to swap the buffers' data) // . TODO: Consider array of Pointers: Disk_t* g_aDrive[] - swap(g_aFloppyDisk[0], g_aFloppyDisk[1]); + std::swap(g_aFloppyDisk[0], g_aFloppyDisk[1]); Disk_SaveLastDiskImage(DRIVE_1); Disk_SaveLastDiskImage(DRIVE_2); diff --git a/source/Disk.h b/source/Disk.h index c38b346b..5c7daa02 100644 --- a/source/Disk.h +++ b/source/Disk.h @@ -40,7 +40,7 @@ const bool IMAGE_DONT_CREATE = false; const bool IMAGE_CREATE = true; extern BOOL enhancedisk; -const string& DiskGetDiskPathFilename(const int iDrive); +const std::string& DiskGetDiskPathFilename(const int iDrive); void DiskInitialize(void); // DiskIIManagerStartup() void DiskDestroy(void); // no, doesn't "destroy" the disk image. DiskIIManagerShutdown() diff --git a/source/DiskImage.cpp b/source/DiskImage.cpp index 465b5821..f38ae244 100644 --- a/source/DiskImage.cpp +++ b/source/DiskImage.cpp @@ -26,13 +26,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Author: Various */ - #include "StdAfx.h" +#include "Structs.h" #include "DiskImage.h" #include "DiskImageHelper.h" - static CDiskImageHelper sg_DiskImageHelper; //=========================================================================== diff --git a/source/DiskImageHelper.cpp b/source/DiskImageHelper.cpp index ff53ab1a..d1f6d8c7 100644 --- a/source/DiskImageHelper.cpp +++ b/source/DiskImageHelper.cpp @@ -28,8 +28,17 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "stdafx.h" -#include "DiskImageHelper.h" +#include "Structs.h" + +#include "zlib.h" +#include "unzip.h" +#include "iowin32.h" + +#include "CPU.h" +#include "Disk.h" #include "DiskImage.h" +#include "DiskImageHelper.h" +#include "Memory.h" /* DO logical order 0 1 2 3 4 5 6 7 8 9 A B C D E F */ diff --git a/source/DiskImageHelper.h b/source/DiskImageHelper.h index 711d83d6..e80015bc 100644 --- a/source/DiskImageHelper.h +++ b/source/DiskImageHelper.h @@ -1,5 +1,7 @@ #pragma once +#include "zip.h" + #define GZ_SUFFIX ".gz" #define GZ_SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) diff --git a/source/Frame.cpp b/source/Frame.cpp index 1a3af671..150dcded 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -27,15 +27,33 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" +#include + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" #include "DiskImage.h" #include "Harddisk.h" +#include "Frame.h" +#include "Keyboard.h" +#include "Log.h" +#include "Memory.h" +#include "Mockingboard.h" #include "MouseInterface.h" -#include "..\resource\resource.h" -#include +#include "ParallelPrinter.h" +#include "Registry.h" +#include "SaveState.h" +#include "SerialComms.h" +#include "SoundCore.h" +#include "Speaker.h" #ifdef USE_SPEECH_API #include "Speech.h" #endif +#include "Video.h" + +#include "..\resource\resource.h" #include "Configuration\PropertySheet.h" +#include "Debugger\Debug.h" //#define ENABLE_MENU 0 diff --git a/source/Frame.h b/source/Frame.h index d524a6ab..322820b7 100644 --- a/source/Frame.h +++ b/source/Frame.h @@ -28,7 +28,7 @@ // Emulator extern bool g_bFreshReset; - extern string PathFilename[2]; + extern std::string PathFilename[2]; extern bool g_bScrollLock_FullSpeed; extern int g_nCharsetType; diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index fa43b753..0a9964ad 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -27,9 +27,15 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#include "HardDisk.h" + +#include "AppleWin.h" #include "DiskImage.h" // ImageError_e, Disk_Status_e #include "DiskImageHelper.h" +#include "Frame.h" +#include "HardDisk.h" +#include "Memory.h" +#include "Registry.h" + #include "..\resource\resource.h" /* @@ -229,7 +235,7 @@ static void NotifyInvalidImage(TCHAR* pszImageFilename) static BOOL HD_Load_Image(const int iDrive, LPCSTR pszImageFilename) { const bool bCreateIfNecessary = false; // NB. Don't allow creation of HDV files - string strFilenameInZip; // TODO: Use this + std::string strFilenameInZip; // TODO: Use this ImageError_e Error = ImageOpen(pszImageFilename, iDrive, bCreateIfNecessary, strFilenameInZip); g_HardDisk[iDrive].hd_imageloaded = (Error == eIMAGE_ERROR_NONE); diff --git a/source/Joystick.cpp b/source/Joystick.cpp index 1d4a2d1d..9bdf5491 100644 --- a/source/Joystick.cpp +++ b/source/Joystick.cpp @@ -38,7 +38,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // - This is because the 2-joystick version of Mario Bros expects the 2nd joystick to control Apple switch #2. #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" +#include "Memory.h" #include "MouseInterface.h" + #include "Configuration\PropertySheet.h" #define BUTTONTIME 5000 // TODO: Describe this magic number diff --git a/source/Keyboard.cpp b/source/Keyboard.cpp index eaa24f6c..2b1e1727 100644 --- a/source/Keyboard.cpp +++ b/source/Keyboard.cpp @@ -28,6 +28,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "AppleWin.h" +#include "Frame.h" +#include "Keyboard.h" +#include "Tape.h" static bool g_bKeybBufferEnable = false; diff --git a/source/Memory.cpp b/source/Memory.cpp index 3231f292..e9deb7af 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -27,15 +27,34 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" +#include "Frame.h" #include "Harddisk.h" +#include "Keyboard.h" +#include "Memory.h" +#include "Mockingboard.h" #include "MouseInterface.h" #include "NoSlotClock.h" +#include "ParallelPrinter.h" +#include "Registry.h" +#include "SerialComms.h" +#include "Speaker.h" +#include "Tape.h" +#include "Video.h" + #include "z80emu.h" #include "Z80VICE\z80.h" #include "Z80VICE\z80mem.h" #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" +#include +using namespace std; +#include "Debugger\Debugger_Types.h" // Needs and namespace std + // Memory Flag #define MF_80STORE 0x00000001 #define MF_ALTZP 0x00000002 diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 0626b8bf..22203bd3 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -76,15 +76,20 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" - - -#define LOG_SSI263 0 - #include +#include "AppleWin.h" +#include "CPU.h" +#include "Log.h" +#include "Memory.h" +#include "Mockingboard.h" +#include "SoundCore.h" + #include "AY8910.h" #include "SSI263Phonemes.h" +#define LOG_SSI263 0 + #define SY6522_DEVICE_A 0 #define SY6522_DEVICE_B 1 diff --git a/source/MouseInterface.cpp b/source/MouseInterface.cpp index 36d81962..b4bc5664 100644 --- a/source/MouseInterface.cpp +++ b/source/MouseInterface.cpp @@ -41,16 +41,21 @@ Etc. #include "stdafx.h" +#include "Structs.h" +#include "CPU.h" +#include "Frame.h" // FrameSetCursorPosByMousePos() +#include "Log.h" +#include "Memory.h" +#include "MouseInterface.h" +#include "SoundCore.h" // SAFE_RELEASE() + +#include "..\resource\resource.h" #ifdef _DEBUG #define _DEBUG_SPURIOUS_IRQ #endif -#include "..\resource\resource.h" -#include "MouseInterface.h" -#include "Frame.h" // FrameSetCursorPosByMousePos() - // Sets mouse mode #define MOUSE_SET 0x00 // Reads mouse position diff --git a/source/ParallelPrinter.cpp b/source/ParallelPrinter.cpp index b8c6ef16..2ef531a6 100644 --- a/source/ParallelPrinter.cpp +++ b/source/ParallelPrinter.cpp @@ -27,6 +27,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" + +#include "AppleWin.h" +#include "Memory.h" +#include "ParallelPrinter.h" +#include "Registry.h" + #include "..\resource\resource.h" static DWORD inactivity = 0; @@ -100,7 +106,7 @@ static void ClosePrint() { fclose(file); file = NULL; - string ExtendedFileName = "copy \""; + std::string ExtendedFileName = "copy \""; ExtendedFileName.append (Printer_GetFilename()); ExtendedFileName.append ("\" prn"); //if (g_bDumpToPrinter) ShellExecute(NULL, "print", Printer_GetFilename(), NULL, NULL, 0); //Print through Notepad diff --git a/source/SaveState.cpp b/source/SaveState.cpp index a037ffdf..b5566ba5 100644 --- a/source/SaveState.cpp +++ b/source/SaveState.cpp @@ -27,7 +27,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" +#include "Frame.h" #include "Joystick.h" +#include "Keyboard.h" +#include "Memory.h" +#include "Mockingboard.h" +#include "SerialComms.h" +#include "Speaker.h" +#include "Video.h" #define DEFAULT_SNAPSHOT_NAME "SaveState.aws" diff --git a/source/SerialComms.cpp b/source/SerialComms.cpp index 6373b25f..3342e80a 100644 --- a/source/SerialComms.cpp +++ b/source/SerialComms.cpp @@ -39,6 +39,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" +#include "Frame.h" +#include "Memory.h" +#include "SerialComms.h" + #include "..\resource\resource.h" //#define SUPPORT_MODEM diff --git a/source/SerialComms.h b/source/SerialComms.h index 5facb1af..d75d2ea9 100644 --- a/source/SerialComms.h +++ b/source/SerialComms.h @@ -112,9 +112,9 @@ private: // CRITICAL_SECTION m_CriticalSection; // To guard /g_vRecvBytes/ - deque m_qComSerialBuffer[2]; + std::deque m_qComSerialBuffer[2]; volatile UINT m_vuRxCurrBuffer; // Written to on COM recv. SSC reads from other one - deque m_qTcpSerialBuffer; + std::deque m_qTcpSerialBuffer; // diff --git a/source/SoundCore.cpp b/source/SoundCore.cpp index e28ed3fd..4733bc5e 100644 --- a/source/SoundCore.cpp +++ b/source/SoundCore.cpp @@ -28,6 +28,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "AppleWin.h" +#include "Frame.h" +#include "SoundCore.h" +#include "Speaker.h" //----------------------------------------------------------------------------- diff --git a/source/Speaker.cpp b/source/Speaker.cpp index 00d080a4..4b3c5fc7 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -29,6 +29,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include +#include "AppleWin.h" +#include "CPU.h" +#include "Frame.h" +#include "Memory.h" +#include "SoundCore.h" +#include "Speaker.h" +#include "Video.h" + +#include "Debugger\Debug.h" // For DWORD extbench + // Notes: // // [OLD: 23.191 Apple CLKs == 44100Hz (CLK_6502/44100)] diff --git a/source/StdAfx.h b/source/StdAfx.h index e4305592..f8140bc6 100644 --- a/source/StdAfx.h +++ b/source/StdAfx.h @@ -36,30 +36,4 @@ #include #include -#include "zlib.h" -#include "unzip.h" -#include "zip.h" -#include "iowin32.h" - -#include "Common.h" -#include "Structs.h" - -#include "AppleWin.h" -#include "AY8910.h" -#include "CPU.h" -#include "Video.h" // Debugger needs: VideoUpdateFuncPtr_t -#include "Debug.h" -#include "Disk.h" -#include "Frame.h" -#include "Keyboard.h" -#include "Log.h" -#include "Memory.h" -#include "Mockingboard.h" -#include "ParallelPrinter.h" -#include "Registry.h" -#include "Riff.h" -#include "SaveState.h" -#include "SerialComms.h" -#include "SoundCore.h" -#include "Speaker.h" -#include "Tape.h" +#define USE_SPEECH_API diff --git a/source/Structs.h b/source/Structs.h index 88bf6706..fde28edc 100644 --- a/source/Structs.h +++ b/source/Structs.h @@ -1,5 +1,6 @@ #pragma once +#include "Common.h" #include "DiskImage.h" // Structs used by save-state file diff --git a/source/Tape.cpp b/source/Tape.cpp index 1df06bc3..0aef7f03 100644 --- a/source/Tape.cpp +++ b/source/Tape.cpp @@ -30,6 +30,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" +#include "AppleWin.h" +#include "Keyboard.h" +#include "Memory.h" + static bool g_CapsLockAllowed = false; //--------------------------------------------------------------------------- diff --git a/source/Util_MemoryTextFile.cpp b/source/Util_MemoryTextFile.cpp index 817d64b5..041d1ca3 100644 --- a/source/Util_MemoryTextFile.cpp +++ b/source/Util_MemoryTextFile.cpp @@ -1,5 +1,29 @@ +/* +AppleWin : An Apple //e emulator for Windows + +Copyright (C) 1994-1996, Michael O'Brien +Copyright (C) 1999-2001, Oliver Schmidt +Copyright (C) 2002-2005, Tom Charlesworth +Copyright (C) 2006-2014, Tom Charlesworth, Michael Pohoreski + +AppleWin is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +AppleWin is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with AppleWin; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "StdAfx.h" +#include "Debugger\Debug.h" // Debugger_Parser.h: SkipUntilEOL(), EatEOL(), CHAR_CR, CHAR_LF // MemoryTextFile _________________________________________________________________________________ diff --git a/source/Video.cpp b/source/Video.cpp index 61a4a094..7e5cc496 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -27,8 +27,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" + +#include "AppleWin.h" +#include "CPU.h" +#include "Disk.h" +#include "Frame.h" +#include "Keyboard.h" +#include "Memory.h" +#include "Registry.h" +#include "Video.h" + #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" +#include "Debugger\Debugger_Color.h" // For NUM_DEBUG_COLORS #define HALF_PIXEL_SOLID 1 #define HALF_PIXEL_BLEED 0 diff --git a/source/Z80VICE/z80.cpp b/source/Z80VICE/z80.cpp index c7cae58c..fe8cdfe6 100644 --- a/source/Z80VICE/z80.cpp +++ b/source/Z80VICE/z80.cpp @@ -24,7 +24,11 @@ * */ -#include "..\stdafx.h" +#include "..\StdAfx.h" + +#include "..\AppleWin.h" +#include "..\CPU.h" +#include "..\Memory.h" #undef IN // Defined in windef.h diff --git a/source/z80emu.cpp b/source/z80emu.cpp index d55b52f7..932711e3 100644 --- a/source/z80emu.cpp +++ b/source/z80emu.cpp @@ -14,6 +14,9 @@ // Emula a CPU Z80 #include "StdAfx.h" + +#include "AppleWin.h" +#include "Memory.h" #include "z80emu.h" // Variaveis From 6ce0f6c77fd3ad9ea74f8af2a73809584c103fbb Mon Sep 17 00:00:00 2001 From: tomcw Date: Wed, 13 Aug 2014 22:03:33 +0100 Subject: [PATCH 28/35] Split some of Debugger_parser.h into Util_Text.h (now Util_MemoryTextFile.cpp isn't dependent on any Debugger headers --- ApplewinExpress9.00.vcproj | 4 + source/Debugger/Debugger_Parser.h | 222 +++--------------------------- source/Util_MemoryTextFile.cpp | 5 +- source/Util_Text.h | 166 ++++++++++++++++++++++ 4 files changed, 195 insertions(+), 202 deletions(-) create mode 100644 source/Util_Text.h diff --git a/ApplewinExpress9.00.vcproj b/ApplewinExpress9.00.vcproj index 7602586d..5a4dd4d8 100644 --- a/ApplewinExpress9.00.vcproj +++ b/ApplewinExpress9.00.vcproj @@ -354,6 +354,10 @@ RelativePath=".\source\Util_MemoryTextFile.h" > + + pStart)) - { - pSrc--; - } - return pSrc; - } - -inline const char* SkipUntilChar ( const char *pSrc, const char nDelim ) - { - while (pSrc && (*pSrc)) - { - if (*pSrc == nDelim) - break; - pSrc++; - } - return pSrc; - } - -inline const char* SkipUntilEOL ( const char *pSrc ) - { - // EOL delims: NULL, LF, CR - while (pSrc && (*pSrc)) - { - if ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR)) - { - break; - } - pSrc++; - } - return pSrc; - } - -inline const char* SkipUntilTab ( const char *pSrc) - { - while (pSrc && (*pSrc)) - { - if (*pSrc == CHAR_TAB) - { - break; - } - pSrc++; - } - return pSrc; - } - -inline const char* SkipUntilToken ( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e *pToken_ ) - { - if ( pToken_) - *pToken_ = NO_TOKEN; - - while (pSrc && (*pSrc)) - { - if (ParserFindToken( pSrc, aTokens, nTokens, pToken_ )) - return pSrc; - - pSrc++; - } - return pSrc; - } - -inline const char* SkipUntilWhiteSpace ( const char *pSrc ) - { - while (pSrc && (*pSrc)) - { - if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) - { - break; - } - pSrc++; - } - return pSrc; - } - -inline const char* SkipUntilWhiteSpaceReverse ( const char *pSrc, const char *pStart ) - { - while (pSrc && (pSrc > pStart)) - { - if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) - { - break; - } - pSrc--; - } - return pSrc; - } - - -/* - const TCHAR* SkipEOL ( const TCHAR *pSrc ); - const TCHAR* SkipWhiteSpace ( const TCHAR *pSrc ); - const TCHAR* SkipWhiteSpaceReverse ( const TCHAR *pSrc, const TCHAR *pStart ); - const TCHAR* SkipUntilChar ( const TCHAR *pSrc, const TCHAR nDelim ); - const TCHAR* SkipUntilEOL ( const TCHAR *pSrc ); - const TCHAR* SkipUntilToken ( const TCHAR *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e *pToken_ ); - const TCHAR* SkipUntilWhiteSpace ( const TCHAR *pSrc ); - const TCHAR* SkipUntilWhiteSpaceReverse ( const TCHAR *pSrc, const TCHAR *pStart ); - const TCHAR* SkipUntilTab ( const TCHAR *pSrc); -*/ - - const TCHAR * FindTokenOrAlphaNumeric ( const TCHAR *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ ); -// TextRemoveWhiteSpaceReverse - int RemoveWhiteSpaceReverse ( char *pSrc ); -// TextExpandTabsToSpaces - void TextConvertTabsToSpaces( TCHAR *pDeTabified_, LPCTSTR pText, const int nDstSize, int nTabStop = 0 ); - - -/** Assumes text are valid hex digits! -//=========================================================================== */ -inline BYTE TextConvert2CharsToByte ( char *pText ) - { - BYTE n = ((pText[0] <= '@') ? (pText[0] - '0') : (pText[0] - 'A' + 10)) << 4; - n += ((pText[1] <= '@') ? (pText[1] - '0') : (pText[1] - 'A' + 10)) << 0; - return n; - } - -//=========================================================================== -inline bool TextIsHexChar( char nChar ) - { - if ((nChar >= '0') && (nChar <= '9')) - return true; - - if ((nChar >= 'A') && (nChar <= 'F')) - return true; - - if ((nChar >= 'a') && (nChar <= 'f')) - return true; - - return false; - } - - -//=========================================================================== -inline bool TextIsHexByte( char *pText ) - { - if (TextIsHexChar( pText[0] ) && - TextIsHexChar( pText[1] )) - return true; - - return false; - } - -//=========================================================================== -inline bool TextIsHexString ( LPCSTR pText ) - { - while (*pText) - { - if (! TextIsHexChar( *pText )) - return false; - - pText++; - } - return true; - } - #endif diff --git a/source/Util_MemoryTextFile.cpp b/source/Util_MemoryTextFile.cpp index 041d1ca3..3b2b4f69 100644 --- a/source/Util_MemoryTextFile.cpp +++ b/source/Util_MemoryTextFile.cpp @@ -22,8 +22,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" +#include +using namespace std; -#include "Debugger\Debug.h" // Debugger_Parser.h: SkipUntilEOL(), EatEOL(), CHAR_CR, CHAR_LF +#include "Util_Text.h" +#include "Util_MemoryTextFile.h" // MemoryTextFile _________________________________________________________________________________ diff --git a/source/Util_Text.h b/source/Util_Text.h new file mode 100644 index 00000000..dab267d4 --- /dev/null +++ b/source/Util_Text.h @@ -0,0 +1,166 @@ + +#define CHAR_LF '\x0D' +#define CHAR_CR '\x0A' +#define CHAR_SPACE ' ' +#define CHAR_TAB '\t' +#define CHAR_QUOTE_DOUBLE '"' +#define CHAR_QUOTE_SINGLE '\'' +#define CHAR_ESCAPE '\x1B' + +// Text Util +/* +inline const char* SkipEOL ( const char *pSrc ) + { + while (pSrc && ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR))) + if (pSrc) + { + pSrc++; + } + return pSrc; + } +*/ + +inline const char* EatEOL ( const char *pSrc ) + { + if (pSrc) + { + if (*pSrc == CHAR_LF) + pSrc++; + + if (*pSrc == CHAR_CR) + pSrc++; + } + return pSrc; + } + +inline const char* SkipWhiteSpace ( const char *pSrc ) + { + while (pSrc && ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB))) + { + pSrc++; + } + return pSrc; + } + +inline const char* SkipWhiteSpaceReverse ( const char *pSrc, const char *pStart ) + { + while (pSrc && ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) && (pSrc > pStart)) + { + pSrc--; + } + return pSrc; + } + +inline const char* SkipUntilChar ( const char *pSrc, const char nDelim ) + { + while (pSrc && (*pSrc)) + { + if (*pSrc == nDelim) + break; + pSrc++; + } + return pSrc; + } + +inline const char* SkipUntilEOL ( const char *pSrc ) + { + // EOL delims: NULL, LF, CR + while (pSrc && (*pSrc)) + { + if ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR)) + { + break; + } + pSrc++; + } + return pSrc; + } + +inline const char* SkipUntilTab ( const char *pSrc) + { + while (pSrc && (*pSrc)) + { + if (*pSrc == CHAR_TAB) + { + break; + } + pSrc++; + } + return pSrc; + } + +inline const char* SkipUntilWhiteSpace ( const char *pSrc ) + { + while (pSrc && (*pSrc)) + { + if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) + { + break; + } + pSrc++; + } + return pSrc; + } + +inline const char* SkipUntilWhiteSpaceReverse ( const char *pSrc, const char *pStart ) + { + while (pSrc && (pSrc > pStart)) + { + if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) + { + break; + } + pSrc--; + } + return pSrc; + } + + + +/** Assumes text are valid hex digits! +//=========================================================================== */ +inline BYTE TextConvert2CharsToByte ( char *pText ) + { + BYTE n = ((pText[0] <= '@') ? (pText[0] - '0') : (pText[0] - 'A' + 10)) << 4; + n += ((pText[1] <= '@') ? (pText[1] - '0') : (pText[1] - 'A' + 10)) << 0; + return n; + } + +//=========================================================================== +inline bool TextIsHexChar( char nChar ) + { + if ((nChar >= '0') && (nChar <= '9')) + return true; + + if ((nChar >= 'A') && (nChar <= 'F')) + return true; + + if ((nChar >= 'a') && (nChar <= 'f')) + return true; + + return false; + } + + +//=========================================================================== +inline bool TextIsHexByte( char *pText ) + { + if (TextIsHexChar( pText[0] ) && + TextIsHexChar( pText[1] )) + return true; + + return false; + } + +//=========================================================================== +inline bool TextIsHexString ( LPCSTR pText ) + { + while (*pText) + { + if (! TextIsHexChar( *pText )) + return false; + + pText++; + } + return true; + } From d21bb2cc3b3524035af73da724e6c114adfaaae4 Mon Sep 17 00:00:00 2001 From: tomcw Date: Wed, 13 Aug 2014 22:25:22 +0100 Subject: [PATCH 29/35] Move Util_* files into Debugger subfolder & update all vcproj files --- AppleWinExpress2012.vcxproj | 4 +- AppleWinExpress2012.vcxproj.filters | 4 +- ApplewinExpress10.00.vcxproj | 4 +- ApplewinExpress10.00.vcxproj.filters | 4 +- ApplewinExpress2005.vcproj | 4 +- ApplewinExpress9.00.vcproj | 6 +- source/Debugger/Debug.h | 2 +- source/Debugger/Debugger_Parser.cpp | 152 ------------------ source/Debugger/Debugger_Parser.h | 4 +- source/{ => Debugger}/Util_MemoryTextFile.cpp | 0 source/{ => Debugger}/Util_MemoryTextFile.h | 1 - source/{ => Debugger}/Util_Text.h | 22 +-- 12 files changed, 22 insertions(+), 185 deletions(-) rename source/{ => Debugger}/Util_MemoryTextFile.cpp (100%) rename source/{ => Debugger}/Util_MemoryTextFile.h (99%) rename source/{ => Debugger}/Util_Text.h (93%) diff --git a/AppleWinExpress2012.vcxproj b/AppleWinExpress2012.vcxproj index 93e52718..31b90d45 100644 --- a/AppleWinExpress2012.vcxproj +++ b/AppleWinExpress2012.vcxproj @@ -91,7 +91,7 @@ - + @@ -184,7 +184,7 @@ NotUsing NotUsing - + diff --git a/AppleWinExpress2012.vcxproj.filters b/AppleWinExpress2012.vcxproj.filters index 861c9f51..4c2d46cc 100644 --- a/AppleWinExpress2012.vcxproj.filters +++ b/AppleWinExpress2012.vcxproj.filters @@ -162,7 +162,7 @@ Source Files\Debugger - + Source Files\Debugger @@ -376,7 +376,7 @@ Source Files\Debugger - + Source Files\Debugger diff --git a/ApplewinExpress10.00.vcxproj b/ApplewinExpress10.00.vcxproj index d9e333b7..e6fadecf 100644 --- a/ApplewinExpress10.00.vcxproj +++ b/ApplewinExpress10.00.vcxproj @@ -271,7 +271,7 @@ Create Create - + @@ -391,7 +391,7 @@ - + diff --git a/ApplewinExpress10.00.vcxproj.filters b/ApplewinExpress10.00.vcxproj.filters index a4702a7f..29487593 100644 --- a/ApplewinExpress10.00.vcxproj.filters +++ b/ApplewinExpress10.00.vcxproj.filters @@ -80,7 +80,7 @@ Source\Debugger - + Source\Debugger @@ -250,7 +250,7 @@ Source\Debugger - + Source\Debugger diff --git a/ApplewinExpress2005.vcproj b/ApplewinExpress2005.vcproj index 69edd675..10e6908f 100644 --- a/ApplewinExpress2005.vcproj +++ b/ApplewinExpress2005.vcproj @@ -401,11 +401,11 @@ > diff --git a/source/Debugger/Debug.h b/source/Debugger/Debug.h index b1808783..81ece75c 100644 --- a/source/Debugger/Debug.h +++ b/source/Debugger/Debug.h @@ -16,7 +16,7 @@ using namespace std; #include "Debugger_Help.h" #include "Debugger_Display.h" #include "Debugger_Symbols.h" -#include "..\Util_MemoryTextFile.h" +#include "Util_MemoryTextFile.h" // Globals __________________________________________________________________ diff --git a/source/Debugger/Debugger_Parser.cpp b/source/Debugger/Debugger_Parser.cpp index 76dc8d85..4fcd9d7a 100644 --- a/source/Debugger/Debugger_Parser.cpp +++ b/source/Debugger/Debugger_Parser.cpp @@ -958,155 +958,3 @@ int RemoveWhiteSpaceReverse ( TCHAR *pSrc ) } return nLen; } - - -//=========================================================================== -/* -inline -const TCHAR* SkipEOL ( const TCHAR *pSrc ) -{ - while (pSrc && ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR))) - { - pSrc++; - } - return pSrc; -} -*/ - -//=========================================================================== -/* -inline -const TCHAR* SkipUntilChar ( const TCHAR *pSrc, const TCHAR nDelim ) -{ - while (pSrc && (*pSrc)) - { - if (*pSrc == nDelim) - break; - pSrc++; - } - return pSrc; -} -*/ - - -//=========================================================================== -/* -inline -const TCHAR* SkipUntilEOL ( const TCHAR *pSrc ) -{ - while (pSrc && (*pSrc)) - { - if ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR)) - { - break; - } - pSrc++; - } - return pSrc; -} -*/ - - -//=========================================================================== -/* -inline -const TCHAR* SkipUntilTab ( const TCHAR *pSrc ) -{ - while (pSrc && (*pSrc)) - { - if (*pSrc == CHAR_TAB) - { - break; - } - pSrc++; - } - return pSrc; -} -*/ - - -//=========================================================================== -/* -const TCHAR* SkipUntilToken ( const TCHAR *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e *pToken_ ) -{ - if ( pToken_) - *pToken_ = NO_TOKEN; - - while (pSrc && (*pSrc)) - { - // Common case is TOKEN_ALPHANUMERIC, so continue until we don't have one - if (ParserFindToken( pSrc, aTokens, pToken_ )) - return pSrc; - - pSrc++; - } - return pSrc; -} -*/ - -//=========================================================================== -/* -inline -const TCHAR* SkipUntilWhiteSpace ( const TCHAR *pSrc ) -{ - while (pSrc && (*pSrc)) - { - if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) - { - break; - } - pSrc++; - } - return pSrc; -} -*/ - - -// @param pStart Start of line. -//=========================================================================== -/* -inline -const TCHAR *SkipUntilWhiteSpaceReverse ( const TCHAR *pSrc, const TCHAR *pStart ) -{ - while (pSrc && (pSrc > pStart)) - { - if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) - { - break; - } - pSrc--; - } - return pSrc; -} -*/ - - -//=========================================================================== -/* -inline -const TCHAR* SkipWhiteSpace ( const TCHAR *pSrc ) -{ - while (pSrc && ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB))) - { - pSrc++; - } - return pSrc; -} -*/ - - -// @param pStart Start of line. -//=========================================================================== -/* -inline -const TCHAR *SkipWhiteSpaceReverse ( const TCHAR *pSrc, const TCHAR *pStart ) -{ - while (pSrc && ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) && (pSrc > pStart)) - { - pSrc--; - } - return pSrc; -} -*/ - -// EOF diff --git a/source/Debugger/Debugger_Parser.h b/source/Debugger/Debugger_Parser.h index f1d10892..ba8a668e 100644 --- a/source/Debugger/Debugger_Parser.h +++ b/source/Debugger/Debugger_Parser.h @@ -1,14 +1,14 @@ #ifndef DEBUGGER_PARSER_H #define DEBUGGER_PARSER_H -#include "..\Util_Text.h" +#include "Util_Text.h" const char * ParserFindToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ ); const TCHAR * FindTokenOrAlphaNumeric ( const TCHAR *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e * pToken_ ); int RemoveWhiteSpaceReverse( char *pSrc ); void TextConvertTabsToSpaces( TCHAR *pDeTabified_, LPCTSTR pText, const int nDstSize, int nTabStop = 0 ); -inline const char* SkipUntilToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e *pToken_ ) +inline const char* SkipUntilToken( const char *pSrc, const TokenTable_t *aTokens, const int nTokens, ArgToken_e *pToken_ ) { if ( pToken_) *pToken_ = NO_TOKEN; diff --git a/source/Util_MemoryTextFile.cpp b/source/Debugger/Util_MemoryTextFile.cpp similarity index 100% rename from source/Util_MemoryTextFile.cpp rename to source/Debugger/Util_MemoryTextFile.cpp diff --git a/source/Util_MemoryTextFile.h b/source/Debugger/Util_MemoryTextFile.h similarity index 99% rename from source/Util_MemoryTextFile.h rename to source/Debugger/Util_MemoryTextFile.h index 118718ee..a5445d05 100644 --- a/source/Util_MemoryTextFile.h +++ b/source/Debugger/Util_MemoryTextFile.h @@ -1,6 +1,5 @@ #pragma once - // Memory Text File _________________________________________________________ class MemoryTextFile_t diff --git a/source/Util_Text.h b/source/Debugger/Util_Text.h similarity index 93% rename from source/Util_Text.h rename to source/Debugger/Util_Text.h index dab267d4..d925b995 100644 --- a/source/Util_Text.h +++ b/source/Debugger/Util_Text.h @@ -1,3 +1,4 @@ +#pragma once #define CHAR_LF '\x0D' #define CHAR_CR '\x0A' @@ -8,17 +9,6 @@ #define CHAR_ESCAPE '\x1B' // Text Util -/* -inline const char* SkipEOL ( const char *pSrc ) - { - while (pSrc && ((*pSrc == CHAR_LF) || (*pSrc == CHAR_CR))) - if (pSrc) - { - pSrc++; - } - return pSrc; - } -*/ inline const char* EatEOL ( const char *pSrc ) { @@ -26,7 +16,7 @@ inline const char* EatEOL ( const char *pSrc ) { if (*pSrc == CHAR_LF) pSrc++; - + if (*pSrc == CHAR_CR) pSrc++; } @@ -108,7 +98,7 @@ inline const char* SkipUntilWhiteSpaceReverse ( const char *pSrc, const char *pS { if ((*pSrc == CHAR_SPACE) || (*pSrc == CHAR_TAB)) { - break; + break; } pSrc--; } @@ -131,13 +121,13 @@ inline bool TextIsHexChar( char nChar ) { if ((nChar >= '0') && (nChar <= '9')) return true; - + if ((nChar >= 'A') && (nChar <= 'F')) return true; - + if ((nChar >= 'a') && (nChar <= 'f')) return true; - + return false; } From 77d4ac81a13ae13abc3acd23aad197323dcee99f Mon Sep 17 00:00:00 2001 From: tomcw Date: Thu, 14 Aug 2014 17:24:03 +0100 Subject: [PATCH 30/35] Added new DiskConsts.h so Structs.h doesn't need to include DiskImage.h --- ApplewinExpress9.00.vcproj | 4 ++++ docs/ToDo.txt | 17 +++++++++-------- source/Configuration/PageDisk.cpp | 1 - source/DiskConsts.h | 3 +++ source/DiskImage.h | 3 ++- source/Structs.h | 2 +- 6 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 source/DiskConsts.h diff --git a/ApplewinExpress9.00.vcproj b/ApplewinExpress9.00.vcproj index d75fefaf..af512f61 100644 --- a/ApplewinExpress9.00.vcproj +++ b/ApplewinExpress9.00.vcproj @@ -802,6 +802,10 @@ RelativePath=".\source\Disk.h" > + + diff --git a/docs/ToDo.txt b/docs/ToDo.txt index 6529a326..dc26be7c 100644 --- a/docs/ToDo.txt +++ b/docs/ToDo.txt @@ -3,6 +3,12 @@ To-do list (Tom) This is a (non-exhaustive) list of stuff that I personally would like to get done: +(14/8/2014) Having moved all non-system headers out of stdafx.h, it looks like + many headers are included just to call Init() or Reset() methods for Apple II sub-systems. +Cut down on the headers by: +- Using the Visitor pattern (for all Apple II sub-systems)? +- Or just a vector which contains all sub-system Reset() methods? + . Consolidate the Spkr_SubmitWaveBuffer() & Spkr_SubmitWaveBuffer_FullSpeed() funcs. This will make the code cleaner & simpler. @@ -20,21 +26,16 @@ So that the sound is continuous when dragging the window or starting other appli . Fix SSI263 so that phonemes are overlapped (like Votrax). -. Support for zipped disk images (r/w) & harddisk images (read-only, but maybe write too?) - . Save-state supporting Phasor, harddisk & Ramworks III -. [NICK] Floating-bus support (using Nick Westgate's code) -For Drol, Lock'n'Chase, TetrisII, etc - . Support for switching display modes mid-frame -To support Bob Bishop's intros +To support Bob Bishop's intros, tight-loop page-flipping, etc --- Plans for (1st pass) cleaning up are: -. Ditch the x86 code to access the PC speaker + ditch PC speaker support -. The arrays ioread[] & iowrite[] in Memory.cpp should be switched from units of 1 byte to 16 bytes. +. [DONE] Ditch the x86 code to access the PC speaker + ditch PC speaker support +. [DONE] The arrays ioread[] & iowrite[] in Memory.cpp should be switched from units of 1 byte to 16 bytes. This will yield 256 entries spanning [$C000…$CFFF] – currently it’s only [$C000…$C0FF]. This will mean that: a) cards with I/O mapped above $C0FF (eg Mockingboard, Mouse?) don’t have to be kludged as in the READ/WRITE macros in CPU.cpp b) $CFFF (ROMs out) can be emulated diff --git a/source/Configuration/PageDisk.cpp b/source/Configuration/PageDisk.cpp index 2540ed13..60a551de 100644 --- a/source/Configuration/PageDisk.cpp +++ b/source/Configuration/PageDisk.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "..\AppleWin.h" -#include "..\Harddisk.h" #include "..\Disk.h" #include "..\Frame.h" #include "..\Registry.h" diff --git a/source/DiskConsts.h b/source/DiskConsts.h new file mode 100644 index 00000000..cd89cbf1 --- /dev/null +++ b/source/DiskConsts.h @@ -0,0 +1,3 @@ +#pragma once + +#define NIBBLES_PER_TRACK 0x1A00 diff --git a/source/DiskImage.h b/source/DiskImage.h index fd09f4bb..8ae72fc3 100644 --- a/source/DiskImage.h +++ b/source/DiskImage.h @@ -23,7 +23,8 @@ along with AppleWin; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #define NIBBLES_PER_TRACK 0x1A00 +#include "DiskConsts.h" + #define TRACK_DENIBBLIZED_SIZE (16 * 256) // #Sectors x Sector-size #define TRACKS_STANDARD 35 diff --git a/source/Structs.h b/source/Structs.h index fde28edc..e8d5f66e 100644 --- a/source/Structs.h +++ b/source/Structs.h @@ -1,7 +1,7 @@ #pragma once #include "Common.h" -#include "DiskImage.h" +#include "DiskConsts.h" // Structs used by save-state file From 4d40590fbf34e0c199bf9b094845093d79c41023 Mon Sep 17 00:00:00 2001 From: tomcw Date: Thu, 14 Aug 2014 17:48:38 +0100 Subject: [PATCH 31/35] Renamed DiskConsts.h to DiskDefs.h + other header refactoring --- ApplewinExpress9.00.vcproj | 2 +- source/Applewin.h | 1 + source/Common.h | 3 --- source/Configuration/Config.h | 3 ++- source/Configuration/PageAdvanced.cpp | 2 +- source/Configuration/PageConfig.cpp | 1 - source/Configuration/PageDisk.cpp | 1 - source/Configuration/PageInput.cpp | 2 +- source/Configuration/PageSound.cpp | 2 +- source/Configuration/PropertySheet.cpp | 1 - source/Debugger/Debug.h | 1 + source/{DiskConsts.h => DiskDefs.h} | 0 source/DiskImage.cpp | 2 ++ source/DiskImage.h | 2 +- source/DiskImageHelper.cpp | 1 + source/MouseInterface.cpp | 1 + source/Registry.h | 3 +++ source/Structs.h | 3 +-- 18 files changed, 17 insertions(+), 14 deletions(-) rename source/{DiskConsts.h => DiskDefs.h} (100%) diff --git a/ApplewinExpress9.00.vcproj b/ApplewinExpress9.00.vcproj index af512f61..a33e5f14 100644 --- a/ApplewinExpress9.00.vcproj +++ b/ApplewinExpress9.00.vcproj @@ -803,7 +803,7 @@ > Date: Thu, 14 Aug 2014 18:03:12 +0100 Subject: [PATCH 32/35] More header refactoring --- source/6821.cpp | 1 - source/AY8910.cpp | 3 --- source/Joystick.cpp | 2 -- source/Memory.cpp | 2 +- source/Riff.cpp | 2 +- source/SerialComms.cpp | 2 +- source/Speaker.cpp | 2 +- source/Video.cpp | 1 - 8 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/6821.cpp b/source/6821.cpp index 7be93e3a..8841a783 100644 --- a/source/6821.cpp +++ b/source/6821.cpp @@ -28,7 +28,6 @@ #include "StdAfx.h" - #include "6821.h" #define PIA_W_CALLBACK(st, val) \ diff --git a/source/AY8910.cpp b/source/AY8910.cpp index f7027fcf..7600740e 100644 --- a/source/AY8910.cpp +++ b/source/AY8910.cpp @@ -26,14 +26,11 @@ #include "StdAfx.h" - #include #include #include #include "AY8910.h" -#include "Common.h" -#include "Structs.h" #include "Applewin.h" // For g_fh #include "Mockingboard.h" // For g_uTimer1IrqCount diff --git a/source/Joystick.cpp b/source/Joystick.cpp index 9bdf5491..3b232378 100644 --- a/source/Joystick.cpp +++ b/source/Joystick.cpp @@ -41,9 +41,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "AppleWin.h" #include "CPU.h" -#include "Disk.h" #include "Memory.h" -#include "MouseInterface.h" #include "Configuration\PropertySheet.h" diff --git a/source/Memory.cpp b/source/Memory.cpp index e9deb7af..d33b2f49 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Disk.h" #include "Frame.h" #include "Harddisk.h" +#include "Joystick.h" #include "Keyboard.h" #include "Memory.h" #include "Mockingboard.h" @@ -47,7 +48,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "z80emu.h" #include "Z80VICE\z80.h" -#include "Z80VICE\z80mem.h" #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" diff --git a/source/Riff.cpp b/source/Riff.cpp index 8b95bf5a..0f914e0a 100644 --- a/source/Riff.cpp +++ b/source/Riff.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Stdafx.h" -#include "riff.h" +#include "Riff.h" static HANDLE g_hRiffFile = INVALID_HANDLE_VALUE; static DWORD dwTotalOffset; diff --git a/source/SerialComms.cpp b/source/SerialComms.cpp index 3342e80a..77b55f91 100644 --- a/source/SerialComms.cpp +++ b/source/SerialComms.cpp @@ -42,7 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "AppleWin.h" #include "CPU.h" -#include "Disk.h" +#include "Disk.h" // DiskIsSpinning() #include "Frame.h" #include "Memory.h" #include "SerialComms.h" diff --git a/source/Speaker.cpp b/source/Speaker.cpp index 4b3c5fc7..4c4dfc94 100644 --- a/source/Speaker.cpp +++ b/source/Speaker.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Memory.h" #include "SoundCore.h" #include "Speaker.h" -#include "Video.h" +#include "Video.h" // VideoRedrawScreen() #include "Debugger\Debug.h" // For DWORD extbench diff --git a/source/Video.cpp b/source/Video.cpp index 7e5cc496..fef0df11 100644 --- a/source/Video.cpp +++ b/source/Video.cpp @@ -30,7 +30,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "AppleWin.h" #include "CPU.h" -#include "Disk.h" #include "Frame.h" #include "Keyboard.h" #include "Memory.h" From c1bfb8075cf2320fa9345eeb541f240f0b8a7f71 Mon Sep 17 00:00:00 2001 From: tomcw Date: Thu, 14 Aug 2014 18:14:39 +0100 Subject: [PATCH 33/35] Created new DebugDefs.h for memory defs --- ApplewinExpress9.00.vcproj | 4 ++++ source/Debugger/Debug.cpp | 10 +--------- source/Debugger/DebugDefs.h | 10 ++++++++++ source/Memory.cpp | 5 +---- 4 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 source/Debugger/DebugDefs.h diff --git a/ApplewinExpress9.00.vcproj b/ApplewinExpress9.00.vcproj index a33e5f14..55966eea 100644 --- a/ApplewinExpress9.00.vcproj +++ b/ApplewinExpress9.00.vcproj @@ -266,6 +266,10 @@ RelativePath=".\source\Debugger\Debug.h" > + + diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 2af6a2ca..604b70fc 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "StdAfx.h" #include "Debug.h" +#include "DebugDefs.h" #include "..\AppleWin.h" #include "..\CPU.h" @@ -211,15 +212,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Memory _____________________________________________________________________ - const int _6502_BRANCH_POS = +127; - const int _6502_BRANCH_NEG = -128; - const unsigned int _6502_ZEROPAGE_END = 0x00FF; - const unsigned int _6502_STACK_END = 0x01FF; - const unsigned int _6502_IO_BEGIN = 0xC000; - const unsigned int _6502_IO_END = 0xC0FF; - const unsigned int _6502_MEM_BEGIN = 0x0000; - const unsigned int _6502_MEM_END = 0xFFFF; - MemoryDump_t g_aMemDump[ NUM_MEM_DUMPS ]; // Made global so operator @# can be used with other commands. diff --git a/source/Debugger/DebugDefs.h b/source/Debugger/DebugDefs.h new file mode 100644 index 00000000..48edd7f9 --- /dev/null +++ b/source/Debugger/DebugDefs.h @@ -0,0 +1,10 @@ +#pragma once + + const int _6502_BRANCH_POS = +127; + const int _6502_BRANCH_NEG = -128; + const unsigned int _6502_ZEROPAGE_END = 0x00FF; + const unsigned int _6502_STACK_END = 0x01FF; + const unsigned int _6502_IO_BEGIN = 0xC000; + const unsigned int _6502_IO_END = 0xC0FF; + const unsigned int _6502_MEM_BEGIN = 0x0000; + const unsigned int _6502_MEM_END = 0xFFFF; diff --git a/source/Memory.cpp b/source/Memory.cpp index d33b2f49..e3ec453b 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -50,10 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Z80VICE\z80.h" #include "..\resource\resource.h" #include "Configuration\PropertySheet.h" - -#include -using namespace std; -#include "Debugger\Debugger_Types.h" // Needs and namespace std +#include "Debugger\DebugDefs.h" // Memory Flag #define MF_80STORE 0x00000001 From cbdad2a02febd9f26d5f8eea5f4c5305804a8cad Mon Sep 17 00:00:00 2001 From: tomcw Date: Thu, 14 Aug 2014 20:29:01 +0100 Subject: [PATCH 34/35] Qualified all STL refs with std:: to get rid of the 'using namespace std' mismatch between the main code & debugger code --- source/Applewin.cpp | 2 +- source/Debugger/Debug.cpp | 25 +++++++++------------ source/Debugger/Debug.h | 8 +------ source/Debugger/Debugger_Assembler.cpp | 12 +++++----- source/Debugger/Debugger_Assembler.h | 2 +- source/Debugger/Debugger_Console.cpp | 2 +- source/Debugger/Debugger_Console.h | 2 +- source/Debugger/Debugger_DisassemblerData.h | 2 +- source/Debugger/Debugger_Help.cpp | 2 +- source/Debugger/Debugger_Symbols.cpp | 4 +--- source/Debugger/Debugger_Types.h | 8 +++---- source/Debugger/Util_MemoryTextFile.cpp | 2 -- source/Debugger/Util_MemoryTextFile.h | 4 ++-- source/Frame.cpp | 8 +++---- source/Mockingboard.cpp | 2 +- source/Speaker.cpp | 2 +- source/StdAfx.h | 2 ++ 17 files changed, 39 insertions(+), 50 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index ff266800..1e4c6229 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -767,7 +767,7 @@ LPSTR GetNextArg(LPSTR lpCmdLine) static int DoDiskInsert(const int nDrive, LPCSTR szFileName) { - string strPathName; + std::string strPathName; if (szFileName[0] == '\\' || szFileName[1] == ':') { diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 604b70fc..51e4a2ad 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -56,7 +56,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA bool g_bDebuggerEatKey = false; // Bookmarks __________________________________________________________________ -// vector g_aBookmarks; int g_nBookmarks = 0; Bookmark_t g_aBookmarks[ MAX_BOOKMARKS ]; @@ -126,8 +125,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA int g_iCommand; // last command (enum) // used for consecutive commands - vector g_vPotentialCommands; // global, since TAB-completion also needs - vector g_vSortedCommands; + std::vector g_vPotentialCommands; // global, since TAB-completion also needs + std::vector g_vSortedCommands; // static const char g_aFlagNames[_6502_NUM_FLAGS+1] = TEXT("CZIDBRVN");// Reversed since arrays are from left-to-right @@ -1615,7 +1614,7 @@ void _BWZ_ListAll( const Breakpoint_t * aBreakWatchZero, const int nMax ) Update_t CmdBreakpointList (int nArgs) { // ConsoleBufferPush( ); -// vector vBreakpoints; +// std::vector vBreakpoints; // int iBreakpoint = MAX_BREAKPOINTS; // while (iBreakpoint--) // { @@ -1624,7 +1623,7 @@ Update_t CmdBreakpointList (int nArgs) // vBreakpoints.push_back( g_aBreakpoints[iBreakpoint].address ); // } // } -// sort( vBreakpoints.begin(), vBreakpoints.end() ); +// std::sort( vBreakpoints.begin(), vBreakpoints.end() ); // iBreakpoint = vBreakPoints.size(); if (! g_nBreakpoints) @@ -3194,7 +3193,7 @@ Update_t CmdCursorLineUp (int nArgs) const int MAX_LOOK_AHEAD = g_nDisasmWinHeight; - static vector aTopCandidates; + static std::vector aTopCandidates; LookAhead_t tCandidate; // if (! aBestTop.capacity() ) @@ -5256,9 +5255,7 @@ Update_t CmdOutputPrintf (int nArgs) TCHAR sText[ CONSOLE_WIDTH ] = TEXT(""); -// vector aValues; -// PrintFormat_t entry; - vector aValues; + std::vector aValues; Arg_t entry; int iValue = 0; int nValue = 0; @@ -6715,7 +6712,7 @@ int FindCommand( LPTSTR pName, CmdFuncPtr_t & pFunction_, int * iCommand_ ) g_iCommand = g_aCommands[iCommand].iCommand; // Don't push the same comamnd/alias if already on the list - if (find( g_vPotentialCommands.begin(), g_vPotentialCommands.end(), g_iCommand) == g_vPotentialCommands.end()) + if (std::find( g_vPotentialCommands.begin(), g_vPotentialCommands.end(), g_iCommand) == g_vPotentialCommands.end()) { nFound++; g_vPotentialCommands.push_back( g_iCommand ); @@ -7195,12 +7192,12 @@ void ProfileFormat( bool bExport, ProfileFormat_e eFormatMode ) bool bOpcodeGood = true; bool bOpmodeGood = true; - vector< ProfileOpcode_t > vProfileOpcode( &g_aProfileOpcodes[0], &g_aProfileOpcodes[ NUM_OPCODES ] ); - vector< ProfileOpmode_t > vProfileOpmode( &g_aProfileOpmodes[0], &g_aProfileOpmodes[ NUM_OPMODES ] ); + std::vector< ProfileOpcode_t > vProfileOpcode( &g_aProfileOpcodes[0], &g_aProfileOpcodes[ NUM_OPCODES ] ); + std::vector< ProfileOpmode_t > vProfileOpmode( &g_aProfileOpmodes[0], &g_aProfileOpmodes[ NUM_OPMODES ] ); // sort > - sort( vProfileOpcode.begin(), vProfileOpcode.end(), ProfileOpcode_t() ); - sort( vProfileOpmode.begin(), vProfileOpmode.end(), ProfileOpmode_t() ); + std::sort( vProfileOpcode.begin(), vProfileOpcode.end(), ProfileOpcode_t() ); + std::sort( vProfileOpmode.begin(), vProfileOpmode.end(), ProfileOpmode_t() ); Profile_t nOpcodeTotal = 0; Profile_t nOpmodeTotal = 0; diff --git a/source/Debugger/Debug.h b/source/Debugger/Debug.h index 24aec96e..084bbc0f 100644 --- a/source/Debugger/Debug.h +++ b/source/Debugger/Debug.h @@ -1,10 +1,5 @@ #pragma once -#include -#include // sort, find -#include -using namespace std; - #include "..\Structs.h" #include "..\Common.h" @@ -30,7 +25,6 @@ using namespace std; // Bookmarks extern int g_nBookmarks; extern Bookmark_t g_aBookmarks[ MAX_BOOKMARKS ]; -// extern vector g_aBookmarks; // Breakpoints enum BreakpointHit_t @@ -121,7 +115,7 @@ using namespace std; extern MemoryDump_t g_aMemDump[ NUM_MEM_DUMPS ]; // extern MemorySearchArray_t g_vMemSearchMatches; - extern vector g_vMemorySearchResults; + extern std::vector g_vMemorySearchResults; // Source Level Debugging extern TCHAR g_aSourceFileName[ MAX_PATH ]; diff --git a/source/Debugger/Debugger_Assembler.cpp b/source/Debugger/Debugger_Assembler.cpp index 4a42076e..ece67732 100644 --- a/source/Debugger/Debugger_Assembler.cpp +++ b/source/Debugger/Debugger_Assembler.cpp @@ -75,7 +75,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Disassembler Data _____________________________________________________________________________ - vector g_aDisassemblerData; + std::vector g_aDisassemblerData; // Instructions / Opcodes _________________________________________________________________________ @@ -401,7 +401,7 @@ Fx BEQ r SBC (d),Y sbc (d) --- --- SBC d,X INC d,X --- SED SBC a,Y }; int m_bAsmFlags; - vector m_vAsmOpcodes; + std::vector m_vAsmOpcodes; int m_iAsmAddressMode = AM_IMPLIED; struct DelayedTarget_t @@ -412,7 +412,7 @@ Fx BEQ r SBC (d),Y sbc (d) --- --- SBC d,X INC d,X --- SED SBC a,Y int m_iOpmode ; // AddressingMode_e }; - vector m_vDelayedTargets; + std::vector m_vDelayedTargets; bool m_bDelayedTargetsDirty = false; int m_nAsmBytes = 0; @@ -886,7 +886,7 @@ void AssemblerStartup() void _CmdAssembleHashDump () { // #if DEBUG_ASM_HASH - vector vHashes; + std::vector vHashes; HashOpcode_t tHash; TCHAR sText[ CONSOLE_WIDTH ]; @@ -898,7 +898,7 @@ void _CmdAssembleHashDump () vHashes.push_back( tHash ); } - sort( vHashes.begin(), vHashes.end(), HashOpcode_t() ); + std::sort( vHashes.begin(), vHashes.end(), HashOpcode_t() ); Hash_t nPrevHash = vHashes.at( 0 ).m_nValue; Hash_t nThisHash = 0; @@ -1349,7 +1349,7 @@ void AssemblerProcessDelayedSymols() { bModified = false; - vector::iterator iSymbol; + std::vector::iterator iSymbol; for( iSymbol = m_vDelayedTargets.begin(); iSymbol != m_vDelayedTargets.end(); ++iSymbol ) { DelayedTarget_t *pTarget = & (*iSymbol); // m_vDelayedTargets.at( iSymbol ); diff --git a/source/Debugger/Debugger_Assembler.h b/source/Debugger/Debugger_Assembler.h index 88ffddd5..21b8588d 100644 --- a/source/Debugger/Debugger_Assembler.h +++ b/source/Debugger/Debugger_Assembler.h @@ -201,7 +201,7 @@ extern int g_aAssemblerFirstDirective[ NUM_ASSEMBLERS ]; bool _6502_IsOpcodeValid( int nOpcode ); int AssemblerHashMnemonic ( const TCHAR * pMnemonic ); -// bool AssemblerGetAddressingMode ( int iArg, int nArgs, WORD nAddress, vector & vOpcodes ); +// bool AssemblerGetAddressingMode ( int iArg, int nArgs, WORD nAddress, std::vector & vOpcodes ); void _CmdAssembleHashDump (); int AssemblerDelayedTargetsSize(); diff --git a/source/Debugger/Debugger_Console.cpp b/source/Debugger/Debugger_Console.cpp index 91bc4b2f..b6de5bbb 100644 --- a/source/Debugger/Debugger_Console.cpp +++ b/source/Debugger/Debugger_Console.cpp @@ -50,7 +50,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Buffer bool g_bConsoleBufferPaused = false; // buffered output is waiting for user to continue int g_nConsoleBuffer = 0; - conchar_t g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: stl::vector< line_t > + conchar_t g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: std::vector< line_t > // Cursor char g_sConsoleCursor[] = "_"; diff --git a/source/Debugger/Debugger_Console.h b/source/Debugger/Debugger_Console.h index 9d6fa9f2..f1be9e6c 100644 --- a/source/Debugger/Debugger_Console.h +++ b/source/Debugger/Debugger_Console.h @@ -189,7 +189,7 @@ // Buffer extern bool g_bConsoleBufferPaused; extern int g_nConsoleBuffer; - extern conchar_t g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: stl::vector< line_t > + extern conchar_t g_aConsoleBuffer[ CONSOLE_BUFFER_HEIGHT ][ CONSOLE_WIDTH ]; // TODO: std::vector< line_t > // Cursor extern char g_sConsoleCursor[]; diff --git a/source/Debugger/Debugger_DisassemblerData.h b/source/Debugger/Debugger_DisassemblerData.h index 9eed3b6d..403c24f1 100644 --- a/source/Debugger/Debugger_DisassemblerData.h +++ b/source/Debugger/Debugger_DisassemblerData.h @@ -14,6 +14,6 @@ void Disassembly_DelData( DisasmData_t tData); DisasmData_t* Disassembly_Enumerate( DisasmData_t *pCurrent = NULL ); - extern vector g_aDisassemblerData; + extern std::vector g_aDisassemblerData; #endif diff --git a/source/Debugger/Debugger_Help.cpp b/source/Debugger/Debugger_Help.cpp index f3c27ff8..2dfcde8d 100644 --- a/source/Debugger/Debugger_Help.cpp +++ b/source/Debugger/Debugger_Help.cpp @@ -1439,7 +1439,7 @@ Update_t CmdHelpList (int nArgs) int nMaxWidth = g_nConsoleDisplayWidth - 1; int iCommand; - extern vector g_vSortedCommands; + extern std::vector g_vSortedCommands; if (! g_vSortedCommands.size()) { diff --git a/source/Debugger/Debugger_Symbols.cpp b/source/Debugger/Debugger_Symbols.cpp index 288d0064..dfeee236 100644 --- a/source/Debugger/Debugger_Symbols.cpp +++ b/source/Debugger/Debugger_Symbols.cpp @@ -106,7 +106,7 @@ const char* FindSymbolFromAddress (WORD nAddress, int * iTable_ ) if (! (g_bDisplaySymbolTables & (1 << iTable))) continue; - map::iterator iSymbols = g_aSymbols[iTable].find(nAddress); + std::map::iterator iSymbols = g_aSymbols[iTable].find(nAddress); if(g_aSymbols[iTable].find(nAddress) != g_aSymbols[iTable].end()) { if (iTable_) @@ -131,7 +131,6 @@ bool FindAddressFromSymbol ( const char* pSymbol, WORD * pAddress_, int * iTable if (! (g_bDisplaySymbolTables & (1 << iTable))) continue; -// map::iterator iSymbol = g_aSymbols[iTable].begin(); SymbolTable_t :: iterator iSymbol = g_aSymbols[iTable].begin(); while (iSymbol != g_aSymbols[iTable].end()) { @@ -455,7 +454,6 @@ Update_t _CmdSymbolsListTables (int nArgs, int bSymbolTables ) int nSymbols = g_aSymbols[iTable].size(); if (nSymbols) { - // map::iterator iSymbol = g_aSymbols[iTable].begin(); SymbolTable_t :: iterator iSymbol = g_aSymbols[iTable].begin(); while (iSymbol != g_aSymbols[iTable].end()) { diff --git a/source/Debugger/Debugger_Types.h b/source/Debugger/Debugger_Types.h index f0140e6a..1cb06f97 100644 --- a/source/Debugger/Debugger_Types.h +++ b/source/Debugger/Debugger_Types.h @@ -1161,8 +1161,8 @@ const DisasmData_t* pDisasmData; bool m_bFound ; // }; - typedef vector MemorySearchValues_t; - typedef vector MemorySearchResults_t; + typedef std::vector MemorySearchValues_t; + typedef std::vector MemorySearchResults_t; // Parameters _____________________________________________________________________________________ @@ -1419,7 +1419,7 @@ const DisasmData_t* pDisasmData; NO_SOURCE_LINE = -1 }; - typedef map SourceAssembly_t; // Address -> Line # & FileName + typedef std::map SourceAssembly_t; // Address -> Line # & FileName // Symbols ________________________________________________________________________________________ @@ -1459,7 +1459,7 @@ const DisasmData_t* pDisasmData; SYMBOL_TABLE_PRODOS = (1 << 8), }; - typedef map SymbolTable_t; + typedef std::map SymbolTable_t; // Watches ________________________________________________________________________________________ diff --git a/source/Debugger/Util_MemoryTextFile.cpp b/source/Debugger/Util_MemoryTextFile.cpp index 3b2b4f69..dfd54fe4 100644 --- a/source/Debugger/Util_MemoryTextFile.cpp +++ b/source/Debugger/Util_MemoryTextFile.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "StdAfx.h" -#include -using namespace std; #include "Util_Text.h" #include "Util_MemoryTextFile.h" diff --git a/source/Debugger/Util_MemoryTextFile.h b/source/Debugger/Util_MemoryTextFile.h index a5445d05..016a052e 100644 --- a/source/Debugger/Util_MemoryTextFile.h +++ b/source/Debugger/Util_MemoryTextFile.h @@ -4,8 +4,8 @@ class MemoryTextFile_t { - vector m_vBuffer; - vector m_vLines ; // array of pointers to start of lines + std::vector m_vBuffer; + std::vector m_vLines ; // array of pointers to start of lines bool m_bDirty ; // line pointers not up-to-date void GetLinePointers(); diff --git a/source/Frame.cpp b/source/Frame.cpp index 150dcded..ca248dfb 100644 --- a/source/Frame.cpp +++ b/source/Frame.cpp @@ -158,7 +158,7 @@ void ResetMachineState (); void SetFullScreenMode (); void SetNormalMode (); void SetUsingCursor (BOOL); -static bool FileExists(string strFilename); +static bool FileExists(std::string strFilename); bool g_bScrollLock_FullSpeed = false; bool g_bFreshReset = false; @@ -1854,10 +1854,10 @@ void ProcessDiskPopupMenu(HWND hwnd, POINT pt, const int iDrive) RegLoadString(TEXT("Configuration"), REGVALUE_CIDERPRESSLOC, 1, PathToCiderPress,MAX_PATH); //TODO: A directory is open if an empty path to CiderPress is set. This has to be fixed. - string filename1= "\""; + std::string filename1= "\""; filename1.append( DiskGetDiskPathFilename(iDrive) ); filename1.append("\""); - string sFileNameEmpty = "\""; + std::string sFileNameEmpty = "\""; sFileNameEmpty.append("\""); // Load the menu template containing the shortcut menu from the @@ -2423,7 +2423,7 @@ void FrameReleaseVideoDC () //=========================================================================== // TODO: FIXME: Util_TestFileExists() -static bool FileExists(string strFilename) +static bool FileExists(std::string strFilename) { struct stat stFileInfo; int intStat = stat(strFilename.c_str(),&stFileInfo); diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 22203bd3..d43d1e25 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" -#include +#include // Only needed for +#include // Only needed for #include +#include +#include #include #include From 73f0e405e5bae5e6cfb4cb858360a007dc7af8ef Mon Sep 17 00:00:00 2001 From: tomcw Date: Thu, 14 Aug 2014 22:27:41 +0100 Subject: [PATCH 35/35] Remove wchar.h & Update VS2012 proj with new headers --- AppleWinExpress2012.vcxproj | 3 +++ AppleWinExpress2012.vcxproj.filters | 9 +++++++++ source/Mockingboard.cpp | 1 - source/Speaker.cpp | 1 - 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/AppleWinExpress2012.vcxproj b/AppleWinExpress2012.vcxproj index 31b90d45..0a825506 100644 --- a/AppleWinExpress2012.vcxproj +++ b/AppleWinExpress2012.vcxproj @@ -48,6 +48,7 @@ + @@ -58,7 +59,9 @@ + + diff --git a/AppleWinExpress2012.vcxproj.filters b/AppleWinExpress2012.vcxproj.filters index 4c2d46cc..16d275cb 100644 --- a/AppleWinExpress2012.vcxproj.filters +++ b/AppleWinExpress2012.vcxproj.filters @@ -282,6 +282,15 @@ Resource Files + + Source Files\Disk + + + Source Files\Debugger + + + Source Files\Debugger + diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index d43d1e25..590c7870 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -76,7 +76,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // #include "StdAfx.h" -#include // Only needed for // Only needed for