Page 1 of 1

Syntax Error after *RUN

Posted: Mon Jul 24, 2017 10:25 pm
by davidb
I've just converted a utility from BASIC to 6502 assembly language and it runs fine except for one thing: if I *RUN it instead of *LOADing it then CALLing the code, it produces a Syntax Error when it exits.

I'm sure there's something I'm supposed to do before I return to BASIC or is my use of zero page addresses &70-&75 making BASIC unhappy?

Re: Syntax Error after *RUN

Posted: Tue Jul 25, 2017 5:59 am
by MartinB
There should be no practical difference David and using &70-&75 is fine. I suspect you're doing something subtly wrong in your code such as, are you perhaps (example only) mistakenly using &0700 onwards (instead of &0070) which tends to be the keyboard input buffer? I think you are leaving some residual character(s) somewhere like that such that when you *RUN and return, BASIC subsequently tries to parse the debris.

Re: Syntax Error after *RUN

Posted: Tue Jul 25, 2017 6:43 am
by Rich Talbot-Watkins
Is it on the Electron? Something to do with this perhaps?

Re: Syntax Error after *RUN

Posted: Tue Jul 25, 2017 6:51 am
by MartinB
Ha! Your memory is way better than mine Rich! :lol:

Re: Syntax Error after *RUN

Posted: Tue Jul 25, 2017 9:36 am
by davidb
I was thinking about the other thread because this program also uses OSFILE and I'd forgotten that it modifies the file block, so that was another problem-within-a-problem. But it looks like the same issue with loading from TAPE or ROM immediately after a reset. Loading another file first sidesteps the problem. Thanks for the reminder! :)

Re: Syntax Error after *RUN

Posted: Tue Jul 25, 2017 11:01 am
by Rich Talbot-Watkins
Still not really clear what this problem is, or whether it's an Electron only thing or not. But I've never ever been bitten by it myself!

Re: Syntax Error after *RUN

Posted: Fri Oct 06, 2017 10:24 pm
by regregex
FWIW it may have something to do with a bug in *RUN under CFS/RFS.

In BBC OS 1.20 and Electron OS 1.00 after *RUN loads the file it tries to update the OSFILE block with the length of the file, except that *RUN did not set the address (stored at &C8) of the OSFILE block. If !&C8 points into the code image some four bytes of it may be corrupted. Try:

Code: Select all

*TAPE
!&C8=&C2
*RUN
which has *RUN safely copy the computed file length over itself. (Credit to John Kortink for finding this bug.)

Re: Syntax Error after *RUN

Posted: Fri Oct 06, 2017 10:32 pm
by davidb
Thanks for the tip, regregex, and welcome back!