Added: Ctrl-PrintScreen will copy the text screen (auto detect 40/80 columns) to the clipboard.

This commit is contained in:
michaelangel007 2014-08-25 08:35:43 -07:00
parent 7cef5d5031
commit 24e581ba2c
6 changed files with 147 additions and 89 deletions

View File

@ -9,10 +9,20 @@ https://github.com/AppleWin/AppleWin/issues/new
Tom Charlesworth Tom Charlesworth
In Development: In Development: 1.25.0
--------------- ---------------
Changes: Changes:
. Changed the AppleWin project host from BerliOS to GitHub. . Changed the AppleWin project host from BerliOS to GitHub.
. Ctrl-PrintScreen will copy the text screen (auto detect 40/80) to the clipboard.
. [Feature #198] Alt-Return toggles full screen.
. [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
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.
. Memory initialization defaults to a randomly selected memory initialization pattern.
. Added command line switch to specify the type of memory initialization pattern. . Added command line switch to specify the type of memory initialization pattern.
-memclear # -memclear #
Where # ranges from 0 to 7. Where # ranges from 0 to 7.
@ -23,23 +33,24 @@ Changes:
-memclear 3 Initialize memory to even pages FF, odd pages 00 -memclear 3 Initialize memory to even pages FF, odd pages 00
-memclear 4 Initialize memory to first half page 00, last half page FF -memclear 4 Initialize memory to first half page 00, last half page FF
-memclear 5 Initialize memory to first half page FF, last half page 00 -memclear 5 Initialize memory to first half page FF, last half page 00
-memclear 6 Initialize memory to byte offset of page -memclear 6 Initialize memory to byte offset of that page
(current memory address low byte) (current memory address low byte)
i.e. 00:00 01 02 03 ... for page $20
-memclear 7 Initialize memory to page address -memclear 7 Initialize memory to page address
(current memory address high byte) (current memory address high byte)
. [Feature #198] Alt-Return toggles full screen. i.e. 00:20 20 20 20 ... for page $20
. [Feature #199] Added the option to skip the reboot confirmation in the configuration. NOTE: -memclear 6 can cause a few programs to NOT function correctly
. [Feature #201] Added display of current Track/Sector for the floppy drives. due to hidden bugs of programmers not correctly initializing memory or
- In 2x window mode the status is displayed below the drive LEDs. using uninitialized memory. RNDL/RHND and $620B are initialized to
- In full screen mode the status is displayed above the drive LEDS. The track/sector allow Pooyan, and the Beautiful Boot game launcher to run.
is shown only for the last drive accessed. . Debugger
Note: DOS3.3 Track/Sector status should be accurate. - Added: TSAVE "filename" to save the text screen to a file.
ProDOS support is preliminary -- the track/sector may show zero after an operation. Default filename for 40 columns is: AppleWin_Text40.txt
Default filename for 80 columns is: AppleWin_Text80.txt
Fixes: Fixes:
. [Bug #206] Pooyan would freeze due to RNDL/RNDH not initialized to non-zero values on . [Bug #206] Pooyan would freeze due to RNDL/RNDH not initialized to non-zero values on
a cold boot. a cold boot.
. [Bug #177] Full-screen under Windows8/8.1 would show a corrupt, pastelle color palette. . [Bug #177] Full-screen under Windows8/8.1 would show a corrupt, pastelle color palette.
. Debugger (v2.7.0.23): . Debugger (v2.7.0.23):
- Hang with Memory Fill when memory ends at FFFF, i.e. F D000:FFFF 0 - Hang with Memory Fill when memory ends at FFFF, i.e. F D000:FFFF 0
- Hang with Memory Move when memory ends at FFFF, i.e. 2000<FFFE.FFFFM - Hang with Memory Move when memory ends at FFFF, i.e. 2000<FFFE.FFFFM
@ -47,7 +58,6 @@ Fixes:
Latest: Latest:
------- -------
1.24.0 - 11 Jan 2014 1.24.0 - 11 Jan 2014
-------------------- --------------------
Changes: Changes:

View File

@ -719,6 +719,13 @@ void AppleWin_RegisterHotKeys(void)
VK_SNAPSHOT // UINT vk = PrintScreen VK_SNAPSHOT // UINT vk = PrintScreen
); );
bStatus &= RegisterHotKey(
g_hFrameWindow , // HWND hWnd
VK_SNAPSHOT_TEXT, // int id (user/custom id)
MOD_CONTROL , // UINT fsModifiers
VK_SNAPSHOT // UINT vk = PrintScreen
);
if (!bStatus && g_bShowPrintScreenWarningDialog) if (!bStatus && g_bShowPrintScreenWarningDialog)
{ {
MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK ); MessageBox( g_hFrameWindow, "Unable to capture PrintScreen key", "Warning", MB_OK );

View File

@ -130,11 +130,12 @@ enum AppMode_e
#define WM_USER_RESTART WM_USER+2 #define WM_USER_RESTART WM_USER+2
#define WM_USER_SAVESTATE WM_USER+3 #define WM_USER_SAVESTATE WM_USER+3
#define WM_USER_LOADSTATE WM_USER+4 #define WM_USER_LOADSTATE WM_USER+4
#define VK_SNAPSHOT_560 WM_USER+5 #define VK_SNAPSHOT_560 WM_USER+5 // PrintScreen
#define VK_SNAPSHOT_280 WM_USER+6 #define VK_SNAPSHOT_280 WM_USER+6 // PrintScreen+Shift
#define WM_USER_TCP_SERIAL WM_USER+7 #define WM_USER_TCP_SERIAL WM_USER+7
#define WM_USER_BOOT WM_USER+8 #define WM_USER_BOOT WM_USER+8
#define WM_USER_FULLSCREEN WM_USER+9 #define WM_USER_FULLSCREEN WM_USER+9
#define VK_SNAPSHOT_TEXT WM_USER+10 // PrintScreen+Ctrl
// TODO-TC: Refactor codebase by renaming /nCyclesLeft/ to /uExecutedCycles/ // TODO-TC: Refactor codebase by renaming /nCyclesLeft/ to /uExecutedCycles/
typedef BYTE (__stdcall *iofunction)(WORD nPC, WORD nAddr, BYTE nWriteFlag, BYTE nWriteValue, ULONG nCyclesLeft); typedef BYTE (__stdcall *iofunction)(WORD nPC, WORD nAddr, BYTE nWriteFlag, BYTE nWriteValue, ULONG nCyclesLeft);

View File

@ -4640,45 +4640,25 @@ Update_t CmdMemorySave (int nArgs)
#endif #endif
//=========================================================================== char g_aTextScreen[ 24*82 + 1 ]; // (80 column + CR + LF) * 24 rows + NULL
int CmdTextSave (int nArgs) int g_nTextScreen = 0;
{
// Save the TEXT1 40-colomn to text file (Default: AppleWin_Text40.txt"
// TSAVE ["Filename"]
// TSAVE ["Filename"]
// 1
static WORD nAddressStart = 0;
if (nArgs > 1)
return Help_Arg_1( CMD_TEXT_SAVE );
bool bHaveFileName = false;
if (g_aArgs[1].bType & TYPE_QUOTED_2)
bHaveFileName = true;
char text[24][82]; // 80 column + CR + LF
memset( text, 0, sizeof( text ) );
char *pDst = &text[0][0];
size_t size = 0;
/* /*
$FBC1 BASCALC IN: A=row, OUT: $29=hi, $28=lo $FBC1 BASCALC IN: A=row, OUT: $28=low, $29=hi
PHA temp = 00ab cdef BASCALC PHA ; 000abcde -> temp
LSR y /= 2 0000 abcd LSR ; 0000abcd CARRY=e y /= 2
AND #3 y & 3 0000 00cd AND #3 ; 000000cd y & 3
ORA #4 y | 4 0000 01cd ORA #4 ; 000001cd y | 4
STA $29 STA $29
PLA PLA ; 000abcde <- temp
AND #$18 24 y & 0z00011000 = 000b c000 AND #$18 ; 000ab000
BCC BASCLC2 y=23, C=1 BCC BASCLC2 ; e=0?
ADC #7F y + 0x80 ADC #7F ; 100ab000 yes CARRY=e=1 -> #$+80
STA $28 = 000b c000 BASCLC2 STA $28 ; e00ab000 no CARRY=e=0
ASL 0abc def0 ASL ; 00ab0000
ASL abcd ef00 ASL ; 0ab00000
ORA $28 | 000b c000 ORA $28 ; 0abab000
STA $28 STA $28 ; eabab000
300:A9 00 20 C1 FB A5 29 A6 28 4C 41 F9 300:A9 00 20 C1 FB A5 29 A6 28 4C 41 F9
@ -4711,6 +4691,16 @@ int CmdTextSave (int nArgs)
23 17 0001_0111 -> $7D0 0111 1101 0000 23 17 0001_0111 -> $7D0 0111 1101 0000
*/ */
size_t Util_GetTextScreen ( char* &pText_ )
{
WORD nAddressStart = 0;
char *pBeg = &g_aTextScreen[0];
char *pEnd = &g_aTextScreen[0];
g_nTextScreen = 0;
memset( pBeg, 0, sizeof( g_aTextScreen ) );
int bBank2 = g_bVideoDisplayPage2; int bBank2 = g_bVideoDisplayPage2;
LPBYTE g_pTextBank1 = MemGetAuxPtr (0x400 << (int)bBank2); LPBYTE g_pTextBank1 = MemGetAuxPtr (0x400 << (int)bBank2);
LPBYTE g_pTextBank0 = MemGetMainPtr(0x400 << (int)bBank2); LPBYTE g_pTextBank0 = MemGetMainPtr(0x400 << (int)bBank2);
@ -4723,19 +4713,60 @@ int CmdTextSave (int nArgs)
for( int x = 0; x < 40; x++ ) // always 40 columns for( int x = 0; x < 40; x++ ) // always 40 columns
{ {
if( g_bVideoMode & VF_80COL ) if( g_bVideoMode & VF_80COL )
// AUX { // AUX
*pDst++ = g_pTextBank1[ nAddressStart ] & 0x7F; *pEnd++ = g_pTextBank1[ nAddressStart ] & 0x7F;
// MAIN } // MAIN -- NOTE: intentional indent & outside if() !
*pDst++ = g_pTextBank0[ nAddressStart ] & 0x7F; // mem[ nAddressStart++ ] & 0x7F; *pEnd++ = g_pTextBank0[ nAddressStart ] & 0x7F; // mem[ nAddressStart++ ] & 0x7F;
nAddressStart++; nAddressStart++;
} }
// MSDOS Newline // http://en.wikipedia.org/wiki/Newline // Newline // http://en.wikipedia.org/wiki/Newline
*pDst++ = 0x0D; #ifdef _WIN32
*pDst++ = 0x0A; *pEnd++ = 0x0D; // CR // Windows inserts extra char
#endif
*pEnd++ = 0x0A; // LF // OSX, Linux
} }
size = pDst - &text[0][0]; *pEnd = 0;
g_nTextScreen = pEnd - pBeg;
pText_ = pBeg;
return g_nTextScreen;
}
void Util_CopyTextToClipboard ( const size_t nSize, const char *pText )
{
HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, nSize + 1 );
memcpy( GlobalLock(hMem), pText, nSize + 1 );
GlobalUnlock( hMem );
OpenClipboard(0);
EmptyClipboard();
SetClipboardData( CF_TEXT, hMem );
CloseClipboard();
// GlobalFree() ??
}
//===========================================================================
int CmdTextSave (int nArgs)
{
// Save the TEXT1 40-colomn to text file (Default: AppleWin_Text40.txt"
// TSAVE ["Filename"]
// TSAVE ["Filename"]
// 1
if (nArgs > 1)
return Help_Arg_1( CMD_TEXT_SAVE );
bool bHaveFileName = false;
if (g_aArgs[1].bType & TYPE_QUOTED_2)
bHaveFileName = true;
char *pText;
size_t nSize = Util_GetTextScreen( pText );
TCHAR sLoadSaveFilePath[ MAX_PATH ]; TCHAR sLoadSaveFilePath[ MAX_PATH ];
_tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // g_sProgramDir _tcscpy( sLoadSaveFilePath, g_sCurrentDir ); // g_sProgramDir
@ -4762,7 +4793,7 @@ int CmdTextSave (int nArgs)
hFile = fopen( sLoadSaveFilePath, "wb" ); hFile = fopen( sLoadSaveFilePath, "wb" );
if (hFile) if (hFile)
{ {
size_t nWrote = fwrite( text, size, 1, hFile ); size_t nWrote = fwrite( pText, nSize, 1, hFile );
if (nWrote == 1) if (nWrote == 1)
{ {
TCHAR text[ CONSOLE_WIDTH ] = TEXT(""); TCHAR text[ CONSOLE_WIDTH ] = TEXT("");

View File

@ -223,6 +223,11 @@
const char* FindSymbolFromAddress( WORD nAdress, int * iTable_ = NULL ); const char* FindSymbolFromAddress( WORD nAdress, int * iTable_ = NULL );
const char* GetSymbol( WORD nAddress, int nBytes); const char* GetSymbol( WORD nAddress, int nBytes);
// Memory
size_t Util_GetTextScreen( char* &pText_ );
void Util_CopyTextToClipboard( const size_t nSize, const char *pText );
// Main
Update_t DebuggerProcessCommand( const bool bEchoConsoleInput ); Update_t DebuggerProcessCommand( const bool bEchoConsoleInput );
// Prototypes _______________________________________________________________ // Prototypes _______________________________________________________________

View File

@ -1092,16 +1092,20 @@ LRESULT CALLBACK FrameWndProc (
Video_TakeScreenShot( SCREENSHOT_560x384 ); Video_TakeScreenShot( SCREENSHOT_560x384 );
} }
else else
if (wparam == VK_SNAPSHOT_280) if (wparam == VK_SNAPSHOT_280) // ( lparam & MOD_SHIFT )
{
if( lparam & MOD_SHIFT)
{ {
#if _DEBUG #if _DEBUG
// MessageBox( g_hFrameWindow, "Normal 280x192 size!", "PrintScreen", MB_OK ); // MessageBox( g_hFrameWindow, "Normal 280x192 size!", "PrintScreen", MB_OK );
#endif #endif
}
Video_TakeScreenShot( SCREENSHOT_280x192 ); Video_TakeScreenShot( SCREENSHOT_280x192 );
} }
else
if (wparam == VK_SNAPSHOT_TEXT) // ( lparam & MOD_CONTROL )
{
char *pText;
size_t nSize = Util_GetTextScreen( pText );
Util_CopyTextToClipboard( nSize, pText );
}
break; break;
case WM_KEYDOWN: case WM_KEYDOWN: