Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Digital Archaeology » Computer Arcana » Commodore » Commodore 8-bit » C=128 Basic 7.0 HEADER command with variables
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
C=128 Basic 7.0 HEADER command with variables [message #331157] Tue, 01 November 2016 10:33 Go to next message
Anonymous
Karma:
Originally posted by: GEO

I am trying to use the header command with a variable and it won't
work with the DISK ID as a variable.

A$="Disk-NAME"
B$="9U"
HEADER (A$),I(B$),D0,U8

Gives a syntax error.
HEADER (A$),I9U,D0,U8

Works fine.

TIA.
Re: C=128 Basic 7.0 HEADER command with variables [message #331158 is a reply to message #331157] Tue, 01 November 2016 17:43 Go to previous messageGo to next message
Andreas Kohlbach is currently offline  Andreas Kohlbach
Messages: 1439
Registered: December 2011
Karma: 0
Senior Member
On Tue, 01 Nov 2016 07:33:38 -0700, GEO wrote:
>
> I am trying to use the header command with a variable and it won't
> work with the DISK ID as a variable.
>
> A$="Disk-NAME"
> B$="9U"
> HEADER (A$),I(B$),D0,U8
>
> Gives a syntax error.
> HEADER (A$),I9U,D0,U8
>
> Works fine.

Did you declare the array(s)? Suppose "I(B$)" is an array. But then I
don't know C=128 Basic 7.0.
--
Andreas
You know you are a redneck if
your good deed for the month was hiding your brother for a few days.
Re: C=128 Basic 7.0 HEADER command with variables [message #331231 is a reply to message #331157] Wed, 02 November 2016 14:17 Go to previous messageGo to next message
Anonymous
Karma:
Originally posted by: GEO

On Tue, 01 Nov 2016 07:33:38 -0700, GEO <ghandle75.x@gmail.com-SPAM>
wrote:

> I am trying to use the header command with a variable and it won't
> work with the DISK ID as a variable.
>
> A$="Disk-NAME"
> B$="9U"
> HEADER (A$),I(B$),D0,U8
>
> Gives a syntax error.
> HEADER (A$),I9U,D0,U8
>
> Works fine.
>
> TIA.


I solved this by putting everything into one variable:

A$="Disk-NAME": B$=",I":C$="7U"
A$=A$+B$+C$
HEADER (A$),D0,U8
Re: C=128 Basic 7.0 HEADER command with variables [message #331238 is a reply to message #331157] Wed, 02 November 2016 18:16 Go to previous messageGo to next message
Anton Treuenfels is currently offline  Anton Treuenfels
Messages: 105
Registered: December 2011
Karma: 0
Senior Member
"GEO" <ghandle75.x@gmail.com-SPAM> wrote in message
news:nm9h1cl5g0f66qdjofd23tps7rsvivtm6k@4ax.com...
> I am trying to use the header command with a variable and it won't
> work with the DISK ID as a variable.
>
> A$="Disk-NAME"
> B$="9U"
> HEADER (A$),I(B$),D0,U8
>
> Gives a syntax error.

I(B$) is interpreted as an array variable. BASIC does not allow array
indices to be strings. You would get the same syntax error wherever you
tried to do this.

- Anton Treuenfels
Re: C=128 Basic 7.0 HEADER command with variables [message #368576 is a reply to message #331238] Mon, 04 June 2018 07:10 Go to previous message
Anonymous
Karma:
Originally posted by: Johann Klasek - swap last two domainparts

Anton Treuenfels <teamtempest@yahoo.com> wrote:
>
> "GEO" <ghandle75.x@gmail.com-SPAM> wrote in message
> news:nm9h1cl5g0f66qdjofd23tps7rsvivtm6k@4ax.com...
>> I am trying to use the header command with a variable and it won't
>> work with the DISK ID as a variable.
>>
>> A$="Disk-NAME"
>> B$="9U"
>> HEADER (A$),I(B$),D0,U8
>>
>> Gives a syntax error.
>
> I(B$) is interpreted as an array variable. BASIC does not allow array
> indices to be strings. You would get the same syntax error wherever you
> tried to do this.

Not a bad guess, but not exactly that what the interpreter really does.
It a syntax error too, but not the same!

All disk based commands uses a sub-parser to handle the position
independent arguments. The parser expects for the "I" argument exactly 2
following characters following. There is no expression evaluation at
all. You have to be careful on known tokens like "ON", "TO", "FN", "IF"
which represents only one byte, expecting an additional byte which are
taken as ID.
In the case above, the parser takes "(B" as ID and the parser wants to
continue with "$)" where it expects a "," or "TO" (not in this case) or
a end-of-line, which raises the syntax error.

Currently I may only offer the german version of the command description
for HEADER as Wiki article, https://www.c64-wiki.de/wiki/HEADER, which
describes the special behavior on disk parameters.

The workaround as mentioned before by using ",Ixx" in the diskname
parameter is just possible, because the diskname is written directly to
command channel. The only limit is the length of 16 characters. In that
way the diskname is limited to 12 characters, if the remaining 4
characters are needed for ",Ixx".


Johann
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Commodore 64 BASIC upgrades?
Next Topic: Any SID's Replicate DJ Scratching?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Tue Sep 27 22:09:32 EDT 2022

Total time taken to generate the page: 0.33170 seconds