Emily's Z80 assembler for the Gameboy.
リビジョン | 9433a4bcc4f35714aa97e50c0945d52010702eaa (tree) |
---|---|
日時 | 2021-02-05 11:21:56 |
作者 | AlaskanEmily <emily@alas...> |
コミッター | AlaskanEmily |
Add expression evaluation for !equ directives
@@ -532,7 +532,7 @@ def writeOpcode(mnemonic, block, ops, i, operands): | ||
532 | 532 | if operand[0] == '{' and operand[-1] == '}': |
533 | 533 | # Evaluate expression. |
534 | 534 | num = block.eval(operand[1:-1]) |
535 | - print("INFO: Evaluated " + operand[1:-1] + " as " + hex(num)) | |
535 | + # print("INFO: Evaluated " + operand[1:-1] + " as " + hex(num)) | |
536 | 536 | else: |
537 | 537 | if operand[0] in "<>=": |
538 | 538 | c = operand[0] |
@@ -609,7 +609,10 @@ def assemble(block, mnemonic, operands=()): | ||
609 | 609 | return |
610 | 610 | |
611 | 611 | if mnemonic == "!equ" or mnemonic == "!set": |
612 | - block.equ[operands[0]] = operands[1] | |
612 | + if operands[1][0] == '{' and operands[1][-1] == '}': | |
613 | + block.equ[operands[0]] = block.eval(operands[1][1:-1]) | |
614 | + else: | |
615 | + block.equ[operands[0]] = operands[1] | |
613 | 616 | return |
614 | 617 | |
615 | 618 | try: |