mirror of
https://github.com/irmen/prog8.git
synced 2025-02-18 05:30:34 +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
|
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: 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: 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: add proper memory slabs support
|
||||||
- IR/VM: improve unit tests
|
- IR/VM: improve unit tests
|
||||||
|
|
||||||
|
@ -247,7 +247,15 @@ class Assembler {
|
|||||||
for((line, label) in placeholders) {
|
for((line, label) in placeholders) {
|
||||||
val replacement = labels[label]
|
val replacement = labels[label]
|
||||||
if(replacement==null) {
|
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 {
|
} else {
|
||||||
program[line] = program[line].copy(value = replacement)
|
program[line] = program[line].copy(value = replacement)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user