make memtop adjust automatically when you use %address larger than the default memtop setting.

This commit is contained in:
Irmen de Jong 2024-11-10 23:44:10 +01:00
parent 1b528491c2
commit 573cecb087
3 changed files with 12 additions and 11 deletions

View File

@ -264,7 +264,14 @@ internal fun determineProgramLoadAddress(program: Program, options: CompilationO
}
options.loadAddress = loadAddress
options.memtopAddress = program.toplevelModule.memtopAddress?.first ?: options.compTarget.machine.PROGRAM_MEMTOP_ADDRESS
if(loadAddress>options.memtopAddress) {
errors.warn("program load address ${loadAddress.toHex()} is beyond default memtop address ${options.memtopAddress.toHex()}. " +
"Memtop has been adjusted to ${'$'}ffff to avoid assembler error. Set a valid %memtop yourself to get rid of this warning.", program.toplevelModule.position)
options.memtopAddress = 0xffffu
}
}

View File

@ -3,8 +3,6 @@ TODO
make repeat support 65536 iterations
make memtop adjust automatically when you use %address larger than the default . Then simply set it at $ffff because apparently the programmer knows better?
scripts/cx16_images : add an option to keep the first palette entry black (there's already the option to retain the first 16 entries)
support this usage of defer:

View File

@ -1,16 +1,12 @@
%import textio
%zeropage basicsafe
%option no_sysinit
%zeropage basicsafe
%address $f200
%output raw
%launcher none
main {
sub start() {
repeat 100 {
cx16.r0++
if cx16.r0!=0
goto mylabel
}
mylabel:
txt.print_uwhex(cbm.MEMTOP(0, true), true)
}
}