mirror of
https://github.com/irmen/prog8.git
synced 2025-02-27 03:29:22 +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
|
||||
beq $endLabel""")
|
||||
}
|
||||
if(length>=16 && asmgen.zeropage.hasByteAvailable()) {
|
||||
// TODO don't check for byte avail first, just use allocate and handle error
|
||||
// allocate index var on ZP
|
||||
if(length>=16) {
|
||||
// allocate index var on ZP if possible
|
||||
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
||||
result.fold(
|
||||
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
||||
failure = { /*TODO regular allocation */}
|
||||
failure = { asmgen.out("$indexVar .byte 0") }
|
||||
)
|
||||
} else {
|
||||
asmgen.out("""
|
||||
$indexVar .byte 0""")
|
||||
asmgen.out("$indexVar .byte 0")
|
||||
}
|
||||
asmgen.out(endLabel)
|
||||
}
|
||||
@ -332,17 +330,15 @@ $loopLabel sty $indexVar
|
||||
bne $loopLabel
|
||||
beq $endLabel""")
|
||||
}
|
||||
if(length>=16 && asmgen.zeropage.hasByteAvailable()) {
|
||||
// TODO don't check for byte avail first, just use allocate and handle error
|
||||
// allocate index var on ZP
|
||||
if(length>=16) {
|
||||
// allocate index var on ZP if possible
|
||||
val result = asmgen.zeropage.allocate(indexVar, DataType.UBYTE, null, stmt.position, asmgen.errors)
|
||||
result.fold(
|
||||
success = { zpAddr-> asmgen.out("""$indexVar = $zpAddr ; auto zp UBYTE""") },
|
||||
failure = { /*TODO regular allocation */}
|
||||
failure = { asmgen.out("$indexVar .byte 0") }
|
||||
)
|
||||
} else {
|
||||
asmgen.out("""
|
||||
$indexVar .byte 0""")
|
||||
asmgen.out("$indexVar .byte 0")
|
||||
}
|
||||
asmgen.out(endLabel)
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ TODO
|
||||
For next compiler release (7.7)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
- fix array and string initialization in zeropage
|
||||
- fix ForloopAsmGen zp allocation handling
|
||||
- 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 @requirezp and add to syntax def files and IDEA
|
||||
|
Loading…
x
Reference in New Issue
Block a user