Up one Enhanced BASIC, errata. 25th July 2002 By Lee Davison. Up to top

Symptoms
Any command that has an integer first parameter can fail, e.g. try this ..

 POKE 760,0 : POKE761,255
 PRINT PEEK(760);PEEK(761)
  0 255

 Ready
 _
.. so far so good, but now do ..

 POKE 761,PEEK(760)
 PRINT PEEK(760);PEEK(761)
  0 255

 Ready
 _
.. which is obviously wrong as both bytes should now be zero.
Cause
When BASIC commands have an integer parameter, such as an address, it is stored in the temporary integer word. If, during the evaluation of following parameters, a function that has an integer parameter is called then the temporary integer is overwritten. This can happen with commands such as PEEK, WAIT, BITSET etc.
The fix
One routine is changed to fix this, just after LAB_SCGB was ..


LAB_SCGB
	JSR	LAB_1C01	; scan for "," else do syntax error/warm start
	JMP	LAB_GTBY	; get byte parameter & RET

.. this needs to stack the temporary integer, so it becomes ..


LAB_SCGB
	JSR	LAB_1C01	; scan for "," else do syntax error/warm start
	LDA	Itemph		; save temporary integer high byte
	PHA			; on stack
	LDA	Itempl		; save temporary integer low byte
	PHA			; on stack
	JSR	LAB_GTBY	; get byte parameter
	PLA			; pull low byte
	STA	Itempl		; restore temporary integer low byte
	PLA			; pull high byte
	STA	Itemph		; restore temporary integer high byte
	RTS			;

.. This is done in version 1.05.


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