Basic does a simple memory test to determine memory size. (On my first KIM-1 with my own 2114 SRAM based RAM modules this helped me to find bad RAM).
The memory test of KB9 is writing to memory a patttern, starting after the last part of the KB9 program loaded ($4262 if no sin/cos/atn), reading it back, shift it left and read and write back
The test stops when reading back fails. So this routine writes $92 and then $24 to the last available upper RAM location + 1! Note the +1 !!!!!!
If that location has I/O or zeropage the result will be disaster (this explains the YYYYY printed!).
This is the part of the Microsoft Basic from pagetable in init.s
.ifdef CONFIG_2
lda #$55 ; 01010101 / 10101010
.else
lda #$92 ; 10010010 / 00100100
.endif
sta (LINNUM),y
cmp (LINNUM),y
bne L40FA
asl a
sta (LINNUM),y
cmp (LINNUM),y
.ifdef CONFIG_CBM_ALL
beq L40D7
.else
.ifndef CONFIG_11
beq L40D7; old: faster
bne L40FA
.else
bne L40FA; new: slower
beq L40D7
.endif
On the KIM-1 this results in memory filled with $24 (=$92 asl a)
When you have ram to $E000 (32K + 16 K) there will be 40894 BYTES FREE
Now with the PAL-1 32K RAM module the lower 8K and upper 8K of memory are overlapping (pin Q7 and pin Q0 of the 74LS145 are connected to DEN, vectors NMI RESET IRQ of thh KIM-1 ROM at 1XXX also appear at Fxxx ).
Memory expansion is therefore limited to max $E000 if you do not break that connection and have the vectors served by another ROM or a circuit that only maps FFFE and above to 1FFE (see the Junior articles for that).
With 48K RAM you must enter memory size therefore. 49000 is too much!
See the Appendix A of the KIM-1 User manual about expanding the system.