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,