Enhanced BASIC, errata for 3rd May 2002 by Lee Davison
[Back]
STR$() always returns a null string.Cause
While juggling the page zero variables this reference got forgotten. The result is it tries to read the returned string from the wrong location and always gets a null byte.The fix
The fix for this is easy, it just entails changing the reference.SymptomsJust after LAB_STRS was ..
LAB_STRS JSR LAB_CTNM ; check if source is numeric, else do type mismatch LDY #$00 ; set string index JSR LAB_2970 ; convert FAC1 to string PLA ; dump return address (return via get value from line) PLA ; dump return address LDA #$FF ; set string start low byte LDY #$00 ; set string start high byte.. change the LDA and LDY and this now becomes ..LAB_STRS JSR LAB_CTNM ; check if source is numeric, else do type mismatch LDY #$00 ; set string index JSR LAB_2970 ; convert FAC1 to string PLA ; dump return address (return via get value from line) PLA ; dump return address LDA #<(Decss+1) ; set result string low pointer LDY #>(Decss+1) ; set result string high pointer.. This is done in version 1.02.If you change Decss be carefull that it remains in page zero or the branch after the LDY will fail.
NEXT followed by a colon gives a Syntax ERROR. E.g.CauseDO:FORA=0TOTWOPISTEPPI/10:?SPC(SIN(A)*18.5+20);"Hello world":NEXT:LOOP
should work (oh yes it should!) but prints one line and stops with the error.
At one time the get BASIC byte routine returned Zb = 1 and A = $00 for both [EOL] and : (statement separator). This later got changed to return A = $3A for : but NEXT still assumed Zb = 1 meant A = $00, hence the Syntax ERROR.The fix
The fix for this is easy, it just entails changing the way Y is cleared.SymptomsJust after LAB_NEXT was ..
LAB_NEXT BNE LAB_1A46 ; branch if NEXT var TAY ; else clear Y (A=$00 here) BEQ LAB_1A49 ; branch always (no variable to search for).. and this now becomes ..LAB_NEXT BNE LAB_1A46 ; branch if NEXT var LDY #$00 ; else clear Y BEQ LAB_1A49 ; branch always (no variable to search for).. This is done in version 1.02.
None.The fix
Part of a comment has an error code incorrectly labeled but the code is correct. This is just to clear up any confusion.SymptomsA few lines after LAB_CONT was ..
LDX #$1E ; error code $1C ("Can't continue" error).. and this now becomes ..LAB_NEXT LDX #$1E ; error code $1E ("Can't continue" error).. This is done in version 1.02.
None.The fix
Move a small section of code. This saves three cycles and two bytes. (Woo hoo!)OthersThe code at LAB_244E was ..
; add 0.5 to FAC1 LAB_244E LDA #<LAB_2A96 ; set 0.5 pointer low byte LDY #>LAB_2A96 ; set 0.5 pointer high byte BNE LAB_246C ; add (AY) to FAC1 & RET (Y is always <>$00).. and this now moves to immediately before LAB_246C and becomes ..; add 0.5 to FAC1 LAB_244E LDA #<LAB_2A96 ; set 0.5 pointer low byte LDY #>LAB_2A96 ; set 0.5 pointer high byte ; add (AY) to FAC1 LAB_246C JSR LAB_264D ; unpack memory (AY) into FAC2.. This is done in version 1.02.
The code at LAB_2970 gains the following comment ..LAB_2970 ; STR$() function enters here.. This is done in version 1.02.
Spurious code at LAB_2E05 is removed ..LAB_2E05 LDA Smeml ; get start of mem low byte LDY Smemh ; get start of mem high byte ; no longer need this ; JSR LAB_121F ; check available memory, "Out of memory" error if no room ; addr to check is in AY (low/high) JSR LAB_CRLF ; print CR/LF JSR LAB_1463 ; do "NEW" and "CLEAR".. becomes ..LAB_2E05 JSR LAB_CRLF ; print CR/LF JSR LAB_1463 ; do "NEW" and "CLEAR".. This is done in version 1.02.