Under Level 2: If a bootfile is too small (<24K) it will crash the CoCo 3. I have traced this to the kernel in two areas: F$Move in fmove.asm and the the code that copies user/system stacks in krn.asm. Specifically, the use of the MMU at $FFA5/A6 causes problems if the bootfile is too small, which causes certain data structures to be allocated "too high" in system RAM.
The F$Move problem seems relegated to 6809 only, and I have modified the 6809 code so that it does not use the stack (the stack was disappearing when the MMU switched out the block at $FFA5).
The problem code in krn.asm spans both 6809 and 6309. I'm not sure how to deal with it.
Anonymous
I'm not sure if this is relevant to the bug but seems a curious treatment of the stack in krn.asm.
In the Level2 krn.asm, part of the initialization has
std <D.Proc set user process descriptor to $0600
adda #$02 set stack pointer to $0800
tfr d,s
inca set system stack to $0900
std <D.SysStk
The stack pointer with a 6809/6309 is set to the top of the stack and builds down. So why is regS set to $800 and D.SysStk set to $900? Shouldn't the reverse be true?
Robert, the D.SysStk area appears to be used differently. I did a grep and found that it is loaded into S in fnproc.asm and fexit.asm. More study is needed.
Some additional notes: it appears that the minimum safe bootfile size is $4D00 (19712) bytes. This comes from the fact that the boot track is located at $ED00 and KrnP2 should be at $A000 and no higher ($ED00-$A000 = $4D00). If KrnP2 is at $A000 then it is guaranteed that all kernel data structures will be allocated BELOW $A000, so the kernel's stack copy routine can safely use the $FFA5 ($A000-$BFFF) region as a temporary map in/map out place.