• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Emily's Z80 assembler for the Gameboy.


Commit MetaInfo

Revisión9433a4bcc4f35714aa97e50c0945d52010702eaa (tree)
Tiempo2021-02-05 11:21:56
AutorAlaskanEmily <emily@alas...>
CommiterAlaskanEmily

Log Message

Add expression evaluation for !equ directives

Cambiar Resumen

Diferencia incremental

--- a/em_gb_asm.py
+++ b/em_gb_asm.py
@@ -532,7 +532,7 @@ def writeOpcode(mnemonic, block, ops, i, operands):
532532 if operand[0] == '{' and operand[-1] == '}':
533533 # Evaluate expression.
534534 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))
536536 else:
537537 if operand[0] in "<>=":
538538 c = operand[0]
@@ -609,7 +609,10 @@ def assemble(block, mnemonic, operands=()):
609609 return
610610
611611 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]
613616 return
614617
615618 try: