1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-23 23:30:22 +00:00

Fix zeropage allocation

This commit is contained in:
Karol Stasiak 2018-06-18 22:40:14 +02:00
parent b5aa4674b4
commit 13b06bd505
5 changed files with 9 additions and 4 deletions

View File

@ -5,7 +5,7 @@ modules=c128_hardware,loader_1c01,c128_kernal,default_panic
[allocation]
; TODO
zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$45,$47,$4B
zp_pointers=$FB,$FD,$43,$45,$47,$4B,$F7,$F9,$9E,$9B,$3D
segment_default_start=$1C0D
segment_default_end=$FEFF

View File

@ -12,7 +12,7 @@ emit_illegals=true
[allocation]
; list of free zp pointer locations (these assume that some BASIC routines will keep working)
zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$45,$47,$4B
zp_pointers=$FB,$FD,$43,$45,$47,$4B,$F7,$F9,$9E,$9B,$3D
segments=default
default_code_segment=default
segment_default_start=$80D

View File

@ -7,7 +7,7 @@ modules=c64_hardware,loader_0801,c64_kernal,c64_panic,stdlib
emit_65816=emulation
[allocation]
zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$45,$47,$4B
zp_pointers=$FB,$FD,$43,$45,$47,$4B,$F7,$F9,$9E,$9B,$3D
segment_default_start=$80D
segment_default_codeend=$9fff
segment_default_end=$cfff

View File

@ -9,7 +9,7 @@ emit_65816=native
[allocation]
main_org=$811
zp_pointers=$C1,$C3,$FB,$FD,$39,$3B,$3D,$43,$45,$47,$4B
zp_pointers=$FB,$FD,$43,$45,$47,$4B,$F7,$F9,$9E,$9B,$3D
segment_default_start=$80D
segment_default_codeend=$9fff
segment_default_end=$cfff

View File

@ -32,10 +32,14 @@ sealed trait ByteAllocator {
var lastFree = startAt
var counter = 0
val occupied = mem.occupied
var previous = -800
for(i <- preferredOrder.getOrElse(startAt until endBefore)) {
if (occupied(i) || counter == 0 && count == 2 && i.&(0xff) == 0xff && options.flags(CompilationFlag.PreventJmpIndirectBug)) {
counter = 0
} else {
if (previous != i - 1) {
counter = 0
}
if (counter == 0) {
lastFree = i
}
@ -47,6 +51,7 @@ sealed trait ByteAllocator {
return lastFree
}
}
previous = i
}
-1
}