Up one Enhanced BASIC, errata. 18th Dec. 2001 By Lee Davison. Up to top

Symptoms
Sometimes, when cold starting, the interpreter would either crash totally or give spurious error messages such as "Out of memory error." or "Syntax error." instead of reporting the ammount of free memory. This was more likely the less memory BASIC had available.
Cause
The end of array memory pointer hadn't been set at this point and could cause the print string subroutine, which prints the string created from the bytes free value, to think that no memory was available. Also, as the pointers weren't all set yet, the garbage collection routine could then either fail, causing the "Out of memory" error, or crash causing other errors or even a hung machine.
The fix
The fix for this is easy, it just entails moving the "NEW" and "CLEAR" call to before you try to print anything.

Just after LAB_2E05 was ..


JSR	LAB_CRLF		; print CR/LF
LDA	Ememl			; get end of mem low byte
SEC				; set carry for subtract
SBC	Smeml			; subtract start of mem low byte
TAX				; copy to X
LDA	Ememh			; get end of mem high byte
SBC	Smemh			; subtract start of mem high byte
JSR	LAB_295E		; print XA as unsigned integer (bytes free)
LDA	#LAB_SMSG		; point to sign-on message (high addr)
JSR	LAB_18C3		; print null terminated string from memory
JSR	LAB_1463		; do "NEW" and "CLEAR"
LDA	#LAB_1274		; warm start vector high byte
STA	Wrmjpl			; save warm start vector low byte
STY	Wrmjph			; save warm start vector high byte
JMP	(Wrmjpl)		; go do warm start
.. and this now becomes ..

JSR	LAB_CRLF		; print CR/LF
JSR	LAB_1463		; do "NEW" and "CLEAR"
LDA	Ememl			; get end of mem low byte
SEC				; set carry for subtract
SBC	Smeml			; subtract start of mem low byte
TAX				; copy to X
LDA	Ememh			; get end of mem high byte
SBC	Smemh			; subtract start of mem high byte
JSR	LAB_295E		; print XA as unsigned integer (bytes free)
LDA	#LAB_SMSG		; point to sign-on message (high addr)
JSR	LAB_18C3		; print null terminated string from memory
LDA	#LAB_1274		; warm start vector high byte
STA	Wrmjpl			; save warm start vector low byte
STY	Wrmjph			; save warm start vector high byte
JMP	(Wrmjpl)		; go do warm start
.. This ensures that the "bytes free." message always prints correctly and is done in version 1.01.

Last page update: 14th July, 2003. e-mail me e-mail