If you're using the hSerial port for background serial reception and you want to share the scratchpad storage with other data, you can easily restrict the size of the received data buffer in the scratchpad. This allows you to use the remainder of the scratchpad for other storage functions.
In your initialisation, along with
hSerSetup, enable Serial interrupts via the
SetIntFlags command. Then create your interrupt service routine around the following template:
Rich (BB code):
Interrupt:If hSerInFlag = 1 then
hSerInPtr = hSerInPtr And %00111111 'Restrict pointer to 0-63 (Must be first command)
hSerInFlag = False
EndIf
<insert other interrupt code here if required>
SetIntFlags <flag>, <mask> 'Restore interrupts
Return
With judicious use of the Boolean (
And/Or) masks, it should be possible to move the serial buffer away from the bottom of the scratchpad, if required.