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

Function AssemblerUpdateAddressingMode

source/Debugger/Debugger_Assembler.cpp:1372–1467  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1370
1371//===========================================================================
1372bool AssemblerUpdateAddressingMode()
1373{
1374 SetFlag( AF_HaveEitherParen, TestFlag(AF_HaveLeftParen) || TestFlag(AF_HaveRightParen) );
1375 SetFlag( AF_HaveBothParen, TestFlag(AF_HaveLeftParen) && TestFlag(AF_HaveRightParen) );
1376
1377 if ((TestFlag( AF_HaveLeftParen )) && (! TestFlag( AF_HaveRightParen )))
1378 {
1379 ConsoleBufferPush( " Syntax Error: Missing ')'" );
1380 return false;
1381 }
1382
1383 if ((! TestFlag( AF_HaveLeftParen )) && ( TestFlag( AF_HaveRightParen )))
1384 {
1385 ConsoleBufferPush( " Syntax Error: Missing '('" );
1386 return false;
1387 }
1388
1389 if (TestFlag( AF_HaveComma ))
1390 {
1391 if ((! TestFlag( AF_HaveRegisterX )) && (! TestFlag( AF_HaveRegisterY )))
1392 {
1393 ConsoleBufferPush( " Syntax Error: Index 'X' or 'Y'" );
1394 return false;
1395 }
1396 }
1397
1398 if (TestFlag( AF_HaveBothParen ))
1399 {
1400 if (TestFlag( AF_HaveComma ))
1401 {
1402 if (TestFlag( AF_HaveRegisterX ))
1403 {
1404 m_iAsmAddressMode = AM_AX;
1405 m_nAsmBytes = 2;
1406 if (m_nAsmTargetAddress <= _6502_ZEROPAGE_END)
1407 {
1408 m_iAsmAddressMode = AM_ZX;
1409 m_nAsmBytes = 1;
1410 }
1411 }
1412 if (TestFlag( AF_HaveRegisterY ))
1413 {
1414 m_iAsmAddressMode = AM_AY;
1415 m_nAsmBytes = 2;
1416 if (m_nAsmTargetAddress <= _6502_ZEROPAGE_END)
1417 {
1418 m_iAsmAddressMode = AM_ZY;
1419 m_nAsmBytes = 1;
1420 }
1421 }
1422 }
1423 }
1424
1425 if ((m_iAsmAddressMode == AM_A) || (m_iAsmAddressMode == AM_Z))
1426 {
1427 if (! TestFlag( AF_HaveEitherParen)) // if no paren
1428 {
1429 if (TestFlag( AF_HaveComma ) && TestFlag( AF_HaveRegisterX ))

Callers 1

AssembleFunction · 0.85

Calls 4

SetFlagFunction · 0.85
TestFlagFunction · 0.85
_6502_CalcRelativeOffsetFunction · 0.85
ConsoleBufferPushFunction · 0.70

Tested by

no test coverage detected