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

Function CmdMemoryFill

source/Debugger/Debug.cpp:4348–4394  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

4346
4347//===========================================================================
4348Update_t CmdMemoryFill (int nArgs)
4349{
4350 // F address end value
4351 // F address,len value
4352 // F address:end value
4353 if ((!nArgs) || (nArgs < 3) || (nArgs > 4))
4354 return Help_Arg_1( CMD_MEMORY_FILL );
4355
4356 WORD nAddress2 = 0;
4357 WORD nAddressStart = 0;
4358 WORD nAddressEnd = 0;
4359 int nAddressLen = 0;
4360 BYTE nValue = 0;
4361
4362 if ( nArgs == 3)
4363 {
4364 nAddressStart = g_aArgs[1].nValue;
4365 nAddressEnd = g_aArgs[2].nValue;
4366 nAddressLen = MIN(_6502_MEM_END , nAddressEnd - nAddressStart + 1 );
4367 }
4368 else
4369 {
4370 RangeType_t eRange = Range_Get( nAddressStart, nAddress2, 1 );
4371
4372 if (! Range_CalcEndLen( eRange, nAddressStart, nAddress2, nAddressEnd, nAddressLen ))
4373 return Help_Arg_1( CMD_MEMORY_MOVE );
4374 }
4375#if DEBUG_VAL_2
4376 nBytes = MAX(1,g_aArgs[1].nVal2); // TODO: This actually work??
4377#endif
4378
4379 if ((nAddressLen > 0) && (nAddressEnd <= _6502_MEM_END))
4380 {
4381 nValue = g_aArgs[nArgs].nValue & 0xFF;
4382 while ( nAddressLen-- ) // v2.7.0.22
4383 {
4384 // TODO: Optimize - split into pre_io, and post_io
4385 if ((nAddress2 < APPLE_IO_BEGIN) || (nAddress2 > APPLE_IO_END))
4386 {
4387 WriteByteToMemory(nAddressStart, nValue);
4388 }
4389 nAddressStart++;
4390 }
4391 }
4392
4393 return UPDATE_ALL; // UPDATE_CONSOLE_DISPLAY;
4394}
4395
4396
4397static std::string g_sMemoryLoadSaveFileName;

Callers

nothing calls this directly

Calls 4

Help_Arg_1Function · 0.85
Range_GetFunction · 0.85
Range_CalcEndLenFunction · 0.85
WriteByteToMemoryFunction · 0.85

Tested by

no test coverage detected