mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
vm assembler now understands simple indexed addresses (symbol+number)
This commit is contained in:
parent
3091e3a1c8
commit
c8f3bfa726
@ -3,9 +3,9 @@ TODO
|
||||
|
||||
For next release
|
||||
^^^^^^^^^^^^^^^^
|
||||
- IR/VM: add address calculation for simple addition: conv.string_out+42
|
||||
- IR/VM: add proper memory mapped variables support - replace the symbol by the memory address in the IR code.
|
||||
- IR/VM: check that the above works ok now with the cx16 virtual registers.
|
||||
- IR/VM: actually support the physical cpu registers and status flags in the STORECPU and LOADCPU opcodes.
|
||||
- IR/VM: add proper memory slabs support
|
||||
- IR/VM: improve unit tests
|
||||
|
||||
|
@ -247,7 +247,15 @@ class Assembler {
|
||||
for((line, label) in placeholders) {
|
||||
val replacement = labels[label]
|
||||
if(replacement==null) {
|
||||
println("TODO: find address of symbol $label") // TODO
|
||||
// it could be an address + index: symbol+42
|
||||
if('+' in label) {
|
||||
val (symbol, indexStr) = label.split('+')
|
||||
val index = indexStr.toInt()
|
||||
val address = labels.getValue(symbol) + index
|
||||
program[line] = program[line].copy(value = address)
|
||||
} else {
|
||||
throw IllegalArgumentException("placeholder not found in labels: $label")
|
||||
}
|
||||
} else {
|
||||
program[line] = program[line].copy(value = replacement)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user