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

Function _CmdDisasmDataDefByteX

source/Debugger/Debugger_DisassemblerData.cpp:366–416  ·  view source on GitHub ↗

TODO: merge _CmdDisasmDataDefByteX() and _CmdDisasmDataDefWordX add params( iDirective, iOpcode ) to allow ASM_DEFINE_FLOAT, NOP_FAC ===========================================================================

Source from the content-addressed store, hash-verified

364// add params( iDirective, iOpcode ) to allow ASM_DEFINE_FLOAT, NOP_FAC
365//===========================================================================
366Update_t _CmdDisasmDataDefByteX (int nArgs)
367{
368 // DB
369 // DB symbol // use current instruction pointer
370 // DB symbol address
371 // DB symbol range:range
372 // DB address
373 // To "return to code" use ."X"
374 int iCmd = g_aArgs[0].nValue - NOP_BYTE_1;
375
376 // 2.9.2.2: Bug fix: DB HGR = 2000:3FFF was displaying help instead of being parsed.
377 if (nArgs > 5) // 2.7.0.31 Bug fix: DB range, i.e. DB 174E:174F
378 {
379 return Help_Arg_1( CMD_DEFINE_DATA_BYTE1 + iCmd );
380 }
381
382 DisasmData_t tData;
383 int iArg = 2;
384
385 if (nArgs == 3) // 2.7.0.31 Bug fix: DB range, i.e. DB 174E:175F
386 {
387 if (g_aArgs[ 2 ].eToken == TOKEN_COLON)
388 iArg = 1;
389 }
390
391 WORD nAddress = _CmdDefineByteRange( nArgs, iArg, tData );
392
393 // TODO: Allow user to select which assembler to use for displaying directives!
394 tData.iDirective = g_aAssemblerFirstDirective[ g_iAssemblerSyntax ] + ASM_DEFINE_BYTE;
395
396 // 2.9.1.22 Fixed: `df FAC` was incorrectly getting marked up as `db`
397 if (g_aArgs[0].nValue == NOP_FAC)
398 {
399 tData.iDirective = g_aAssemblerFirstDirective[ g_iAssemblerSyntax ] + ASM_DEFINE_FLOAT;
400 }
401
402 tData.eElementType = (Nopcode_e)( NOP_BYTE_1 + iCmd );
403 tData.bSymbolLookup = false;
404 tData.nTargetAddress = 0;
405
406 // Already exists, so update
407 DisasmData_t *pData = Disassembly_IsDataAddress( nAddress );
408 if ( pData )
409 {
410 *pData = tData;
411 }
412 else
413 Disassembly_AddData( tData );
414
415 return UPDATE_DISASM | ConsoleUpdate();
416}
417
418/*
419 Usage:

Callers 5

CmdDisasmDataDefByte1Function · 0.85
CmdDisasmDataDefByte2Function · 0.85
CmdDisasmDataDefByte4Function · 0.85
CmdDisasmDataDefByte8Function · 0.85
CmdDisasmDataDefFloatFunction · 0.85

Calls 5

Help_Arg_1Function · 0.85
_CmdDefineByteRangeFunction · 0.85
Disassembly_AddDataFunction · 0.85
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected