TSAVE: Remap control chars to printable ones

This commit is contained in:
tomcw 2014-08-27 22:13:14 +01:00
parent 77aef24880
commit 313e7bdcc8

View File

@ -4691,6 +4691,16 @@ int g_nTextScreen = 0;
23 17 0001_0111 -> $7D0 0111 1101 0000 23 17 0001_0111 -> $7D0 0111 1101 0000
*/ */
static char RemapChar(const char c)
{
if ( c < 0x20 )
return c + '@'; // Remap INVERSE control character to NORMAL
else if ( c == 0x7F )
return ' '; // Remap checkboard (DEL) to space
return c;
}
size_t Util_GetTextScreen ( char* &pText_ ) size_t Util_GetTextScreen ( char* &pText_ )
{ {
WORD nAddressStart = 0; WORD nAddressStart = 0;
@ -4717,14 +4727,12 @@ size_t Util_GetTextScreen ( char* &pText_ )
if ( g_bVideoMode & VF_80COL ) if ( g_bVideoMode & VF_80COL )
{ // AUX { // AUX
c = g_pTextBank1[ nAddressStart ] & 0x7F; c = g_pTextBank1[ nAddressStart ] & 0x7F;
if ( c < 0x20 ) c = RemapChar(c);
c = ' '; // INVERSE control character
*pEnd++ = c; *pEnd++ = c;
} // MAIN -- NOTE: intentional indent & outside if() ! } // MAIN -- NOTE: intentional indent & outside if() !
c = g_pTextBank0[ nAddressStart ] & 0x7F; c = g_pTextBank0[ nAddressStart ] & 0x7F;
if ( c < 0x20 ) c = RemapChar(c);
c = ' '; // INVERSE control character
*pEnd++ = c; *pEnd++ = c;
nAddressStart++; nAddressStart++;