mirror of
https://github.com/irmen/prog8.git
synced 2024-11-08 14:07:32 +00:00
improved ForloopAsmGen loopvar zp allocation
This commit is contained in:
parent
a798fe72d3
commit
0f0f40bff3
@ -289,17 +289,15 @@ $loopLabel sty $indexVar
|
|||||||
bne $loopLabel
|
bne $loopLabel
|
||||||
beq $endLabel""")
|
beq $endLabel""")
|
||||||
}
|
}
|
||||||
if(length>=16 && asmgen.zeropage.hasByteAvailable()) {
|
if(length>=16) {
|
||||||
// TODO don't check for byte avail first, just use allocate and handle error
|
// allocate index var on ZP if possible
|
||||||
// allocate index var on ZP
|
|
||||||
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
||||||
result.fold(
|
result.fold(
|
||||||
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
||||||
failure = { /*TODO regular allocation */}
|
failure = { asmgen.out("$indexVar .byte 0") }
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
asmgen.out("""
|
asmgen.out("$indexVar .byte 0")
|
||||||
$indexVar .byte 0""")
|
|
||||||
}
|
}
|
||||||
asmgen.out(endLabel)
|
asmgen.out(endLabel)
|
||||||
}
|
}
|
||||||
@ -332,17 +330,15 @@ $loopLabel sty $indexVar
|
|||||||
bne $loopLabel
|
bne $loopLabel
|
||||||
beq $endLabel""")
|
beq $endLabel""")
|
||||||
}
|
}
|
||||||
if(length>=16 && asmgen.zeropage.hasByteAvailable()) {
|
if(length>=16) {
|
||||||
// TODO don't check for byte avail first, just use allocate and handle error
|
// allocate index var on ZP if possible
|
||||||
// allocate index var on ZP
|
|
||||||
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
||||||
result.fold(
|
result.fold(
|
||||||
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
||||||
failure = { /*TODO regular allocation */}
|
failure = { asmgen.out("$indexVar .byte 0") }
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
asmgen.out("""
|
asmgen.out("$indexVar .byte 0")
|
||||||
$indexVar .byte 0""")
|
|
||||||
}
|
}
|
||||||
asmgen.out(endLabel)
|
asmgen.out(endLabel)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ TODO
|
|||||||
For next compiler release (7.7)
|
For next compiler release (7.7)
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
- fix array and string initialization in zeropage
|
- fix array and string initialization in zeropage
|
||||||
- fix ForloopAsmGen zp allocation handling
|
|
||||||
- check all examples if they still run correctly (c64 + cx16)
|
- check all examples if they still run correctly (c64 + cx16)
|
||||||
- document check: arrays and strings can also be placed in zeropage (but almost never should, due to size!)
|
- document check: arrays and strings can also be placed in zeropage (but almost never should, due to size!)
|
||||||
- document @requirezp and add to syntax def files and IDEA
|
- document @requirezp and add to syntax def files and IDEA
|
||||||
|
Loading…
Reference in New Issue
Block a user