Syntax Error after *RUN

Discuss all aspects of programming here. From 8-bit through to modern architectures.
User avatar
davidb
Posts: 1901
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Syntax Error after *RUN

Postby davidb » Mon Jul 24, 2017 10:25 pm

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?

User avatar
MartinB
Posts: 4555
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity

Re: Syntax Error after *RUN

Postby MartinB » Tue Jul 25, 2017 5:59 am

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.

User avatar
Rich Talbot-Watkins
Posts: 1121
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Syntax Error after *RUN

Postby Rich Talbot-Watkins » Tue Jul 25, 2017 6:43 am

Is it on the Electron? Something to do with this perhaps?

User avatar
MartinB
Posts: 4555
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity

Re: Syntax Error after *RUN

Postby MartinB » Tue Jul 25, 2017 6:51 am

Ha! Your memory is way better than mine Rich! :lol:

User avatar
davidb
Posts: 1901
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Syntax Error after *RUN

Postby davidb » Tue Jul 25, 2017 9:36 am

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! :)

User avatar
Rich Talbot-Watkins
Posts: 1121
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca

Re: Syntax Error after *RUN

Postby Rich Talbot-Watkins » Tue Jul 25, 2017 11:01 am

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!

User avatar
regregex
Posts: 558
Joined: Sun Jan 02, 2005 9:51 pm
Location: London, UK
Contact:

Re: Syntax Error after *RUN

Postby regregex » Fri Oct 06, 2017 10:24 pm

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.)

User avatar
davidb
Posts: 1901
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Syntax Error after *RUN

Postby davidb » Fri Oct 06, 2017 10:32 pm

Thanks for the tip, regregex, and welcome back!


Return to “programming”

Who is online

Users browsing this forum: No registered users and 2 guests