MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / Util_GetTextScreen

Function Util_GetTextScreen

source/Debugger/Debug.cpp:5276–5325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5274}
5275
5276size_t Util_GetTextScreen ( char* &pText_ )
5277{
5278 WORD nAddressStart = 0;
5279
5280 char *pBeg = &g_aTextScreen[0];
5281 char *pEnd = &g_aTextScreen[0];
5282
5283 g_nTextScreen = 0;
5284 memset( pBeg, 0, sizeof( g_aTextScreen ) );
5285
5286 const unsigned int uBank2 = (!GetVideo().VideoGetSW80STORE() && GetVideo().VideoGetSWPAGE2()) ? 1 : 0;
5287 LPBYTE g_pTextBank1 = MemGetAuxPtr (0x400 << uBank2);
5288 LPBYTE g_pTextBank0 = MemGetMainPtr(0x400 << uBank2);
5289
5290 for ( int y = 0; y < 24; y++ )
5291 {
5292 // nAddressStart = 0x400 + (y%8)*0x80 + (y/8)*0x28;
5293 nAddressStart = ((y&7)<<7) | ((y&0x18)<<2) | (y&0x18); // no 0x400| since using MemGet*Ptr()
5294
5295 for ( int x = 0; x < 40; x++ ) // always 40 columns
5296 {
5297 char c; // TODO: FormatCharTxtCtrl() ?
5298
5299 if ( GetVideo().VideoGetSW80COL() )
5300 { // AUX
5301 c = g_pTextBank1[ nAddressStart ] & 0x7F;
5302 c = RemapChar(c);
5303 *pEnd++ = c;
5304 } // MAIN -- NOTE: intentional indent & outside if () !
5305
5306 c = g_pTextBank0[ nAddressStart ] & 0x7F;
5307 c = RemapChar(c);
5308 *pEnd++ = c;
5309
5310 nAddressStart++;
5311 }
5312
5313 // Newline // http://en.wikipedia.org/wiki/Newline
5314#ifdef _WIN32
5315 *pEnd++ = 0x0D; // CR // Windows inserts extra char
5316#endif
5317 *pEnd++ = 0x0A; // LF // OSX, Linux
5318 }
5319 *pEnd = 0;
5320
5321 g_nTextScreen = (int) (pEnd - pBeg);
5322
5323 pText_ = pBeg;
5324 return g_nTextScreen;
5325}
5326
5327//===========================================================================
5328Update_t CmdNTSC (int nArgs)

Callers 2

CmdTextSaveFunction · 0.85
WndProcMethod · 0.85

Calls 6

MemGetAuxPtrFunction · 0.85
MemGetMainPtrFunction · 0.85
RemapCharFunction · 0.85
VideoGetSW80STOREMethod · 0.80
VideoGetSWPAGE2Method · 0.80
VideoGetSW80COLMethod · 0.80

Tested by

no test coverage detected