diff --git a/include/c128.ini b/include/c128.ini index cc588250..e719ed3d 100644 --- a/include/c128.ini +++ b/include/c128.ini @@ -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 diff --git a/include/c64.ini b/include/c64.ini index d2aaba0f..f31814df 100644 --- a/include/c64.ini +++ b/include/c64.ini @@ -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 diff --git a/include/c64_scpu.ini b/include/c64_scpu.ini index 3cc45d25..0be7553d 100644 --- a/include/c64_scpu.ini +++ b/include/c64_scpu.ini @@ -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 diff --git a/include/c64_scpu16.ini b/include/c64_scpu16.ini index 9370f8b4..f1e4582a 100644 --- a/include/c64_scpu16.ini +++ b/include/c64_scpu16.ini @@ -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 diff --git a/src/main/scala/millfork/output/VariableAllocator.scala b/src/main/scala/millfork/output/VariableAllocator.scala index 665ad139..ec2a0356 100644 --- a/src/main/scala/millfork/output/VariableAllocator.scala +++ b/src/main/scala/millfork/output/VariableAllocator.scala @@ -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 }