working on address-of

This commit is contained in:
Irmen de Jong
2022-09-15 01:32:48 +02:00
parent e34bab9585
commit 7294ec9a3c
10 changed files with 316 additions and 147 deletions
@@ -49,7 +49,7 @@ class AssemblyProgram(override val name: String, private val allocations: Variab
is VmCodeLabel -> write("_" + line.name.joinToString(".") + ":\n")
is VmCodeInlineAsm -> {
val asm = line.assembly.replace("""&[a-zA-Z\d_\.]+""".toRegex()) { matchResult ->
// "&X" -> address of X
// need to replace &X by address of X. TODO: this actually needs to be done by the vm assembler/loader. Then this can be omitted
val name = matchResult.value.substring(1, matchResult.value.length).split('.')
allocations.get(name).toString() }
write(asm+"\n")