Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #618 > unrolled thread

Need help with a line in a BASIC program

Started byA2CPM <a2@wilserv.com>
First post2013-01-29 07:11 -0800
Last post2013-01-31 08:01 -0800
Articles 15 — 8 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  Need help with a line in a BASIC program A2CPM <a2@wilserv.com> - 2013-01-29 07:11 -0800
    Re: Need help with a line in a BASIC program David Schmidt <schmidtd@my-deja.com> - 2013-01-29 10:48 -0500
      Re: Need help with a line in a BASIC program retrogear <larrygr510@gmail.com> - 2013-01-29 08:21 -0800
        Re: Need help with a line in a BASIC program BLuRry <brendan.robert@gmail.com> - 2013-01-29 08:34 -0800
      Re: Need help with a line in a BASIC program A2CPM <a2@wilserv.com> - 2013-01-29 09:31 -0800
        Re: Need help with a line in a BASIC program David Schmidt <schmidtd@my-deja.com> - 2013-01-29 13:15 -0500
          Re: Need help with a line in a BASIC program A2CPM <a2@wilserv.com> - 2013-01-29 10:35 -0800
      Re: Need help with a line in a BASIC program Michael J. Mahon <mjmahon@aol.com> - 2013-01-29 13:51 -0600
    Re: Need help with a line in a BASIC program Charlie <charlieDOTd@verEYEzon.net> - 2013-01-29 14:56 -0500
      Re: Need help with a line in a BASIC program Michael J. Mahon <mjmahon@aol.com> - 2013-01-29 14:03 -0600
        Re: Need help with a line in a BASIC program Charlie <charlieDOTd@verEYEzon.net> - 2013-01-29 15:34 -0500
      Re: Need help with a line in a BASIC program A2CPM <a2@wilserv.com> - 2013-01-29 12:21 -0800
        Re: Need help with a line in a BASIC program David Schmidt <schmidtd@my-deja.com> - 2013-01-29 15:40 -0500
          Re: Need help with a line in a BASIC program "Bill Buckels" <bbuckels@mts.net> - 2013-01-31 08:36 -0600
            Re: Need help with a line in a BASIC program gids.rs@sasktel.net - 2013-01-31 08:01 -0800

#618 — Need help with a line in a BASIC program

FromA2CPM <a2@wilserv.com>
Date2013-01-29 07:11 -0800
SubjectNeed help with a line in a BASIC program
Message-ID<3e30ecec-5a39-4dc4-95aa-675d00deef3f@f6g2000yqm.googlegroups.com>
Hi!

    One of the ProDOS format disk images for the Mill 6809 card have
two BASIC
programs for extracting all the files on a disk formatted by the FLEX
operating system for the Apple ][.  The names are "FLEX.TO.PRODOS" and
"FLEX.TO.DECIMAL".  The two programs are identical except for line
2030.

    Expanded line 2030 from "FLEX.TO.DECIMAL":
2030 FOR I = 4 TO 255:
       PRINT(PEEK(SA + I)):
     NEXT I

    Expanded line 2030 from "FLEX.TO.PRODOS":
2030 FOR I = 4 TO 255:
       PRINT CHR$(PEEK(SA + I));:
     NEXT I

    "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
written
to the output disk are so much bigger than the files on the input disk
so
the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
showing
"SYNTAX ERROR".

    So, why does "FLEX.TO.DECIMAL" run and "FLEX.TO.PRODOS" not run?
I was
able to get all the files extracted from the FLEX disk with
"FLEX.TO.DECIMAL"
but would like to know how to change line 2030 to make
"FLEX.TO.PRODOS" run.

Willi

[toc] | [next] | [standalone]


#619

FromDavid Schmidt <schmidtd@my-deja.com>
Date2013-01-29 10:48 -0500
Message-ID<ke8qvc$e91$1@dont-email.me>
In reply to#618
On 1/29/2013 10:11 AM, A2CPM wrote:
>      Expanded line 2030 from "FLEX.TO.DECIMAL":
> 2030 FOR I = 4 TO 255:
>         PRINT(PEEK(SA + I)):
>       NEXT I
>
>      Expanded line 2030 from "FLEX.TO.PRODOS":
> 2030 FOR I = 4 TO 255:
>         PRINT CHR$(PEEK(SA + I));:
>       NEXT I
>
>      "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
> written
> to the output disk are so much bigger than the files on the input disk
> so
> the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
> showing
> "SYNTAX ERROR".

The line 2030 looks ok syntactically - and runs by itself under 
emulation.  Does the SYNTAX ERROR happen in line 2030?  Is this image 
somewhere we can download it?  I don't see any such named programs on 
any of the disks on Asimov.

[toc] | [prev] | [next] | [standalone]


#620

Fromretrogear <larrygr510@gmail.com>
Date2013-01-29 08:21 -0800
Message-ID<2c2237e5-609f-4b3a-8585-7c98cc5ded74@googlegroups.com>
In reply to#619
On Tuesday, January 29, 2013 9:48:05 AM UTC-6, schmidtd wrote:
> On 1/29/2013 10:11 AM, A2CPM wrote: > Expanded line 2030 from "FLEX.TO.DECIMAL": > 2030 FOR I = 4 TO 255: > PRINT(PEEK(SA + I)): > NEXT I > > Expanded line 2030 from "FLEX.TO.PRODOS": > 2030 FOR I = 4 TO 255: > PRINT CHR$(PEEK(SA + I));: > NEXT I > > "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files > written > to the output disk are so much bigger than the files on the input disk > so > the output disk becomes full. "FLEX.TO.PRODOS" breaks out of BASIC, > showing > "SYNTAX ERROR". The line 2030 looks ok syntactically - and runs by itself under emulation. Does the SYNTAX ERROR happen in line 2030? Is this image somewhere we can download it? I don't see any such named programs on any of the disks on Asimov.

I see a semi-colon inserted - is that the problem ?

[toc] | [prev] | [next] | [standalone]


#621

FromBLuRry <brendan.robert@gmail.com>
Date2013-01-29 08:34 -0800
Message-ID<719f62ac-0f6b-4c41-81a1-b80898b7cb3a@googlegroups.com>
In reply to#620
On Tuesday, January 29, 2013 10:21:02 AM UTC-6, retrogear wrote:
> On Tuesday, January 29, 2013 9:48:05 AM UTC-6, schmidtd wrote:
> 
> > On 1/29/2013 10:11 AM, A2CPM wrote: > Expanded line 2030 from "FLEX.TO.DECIMAL": > 2030 FOR I = 4 TO 255: > PRINT(PEEK(SA + I)): > NEXT I > > Expanded line 2030 from "FLEX.TO.PRODOS": > 2030 FOR I = 4 TO 255: > PRINT CHR$(PEEK(SA + I));: > NEXT I > > "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files > written > to the output disk are so much bigger than the files on the input disk > so > the output disk becomes full. "FLEX.TO.PRODOS" breaks out of BASIC, > showing > "SYNTAX ERROR". The line 2030 looks ok syntactically - and runs by itself under emulation. Does the SYNTAX ERROR happen in line 2030? Is this image somewhere we can download it? I don't see any such named programs on any of the disks on Asimov.
> 
> 
> 
> I see a semi-colon inserted - is that the problem ?

That shouldn't matter really -- that just tells Print to not add a LF/CR at the end.

-B

[toc] | [prev] | [next] | [standalone]


#622

FromA2CPM <a2@wilserv.com>
Date2013-01-29 09:31 -0800
Message-ID<d8eb5f4c-1a8c-44e8-b426-09388c1c41ba@l9g2000yqp.googlegroups.com>
In reply to#619
Hi!

On Jan 29, 10:48 am, David wrote:
<--- snip --->
> The line 2030 looks ok syntactically - and runs by itself under
> emulation.  Does the SYNTAX ERROR happen in line 2030?  Is this image
> somewhere we can download it?  I don't see any such named programs on
> any of the disks on Asimov.

    The programs are in "asm6809.sdk" which is in:
"ftp://public.asimov.net/pub/apple_II/images/hardware/processor/
stellation_mill/Mill-6809.zip".
I didn't see the FLEX disk in a quick look.  Of course, all programs
and disks are available in the 'Files' section of the Yahoo! Apple
6809 group.

Willi

[toc] | [prev] | [next] | [standalone]


#623

FromDavid Schmidt <schmidtd@my-deja.com>
Date2013-01-29 13:15 -0500
Message-ID<ke93k5$kit$1@dont-email.me>
In reply to#622
On 1/29/2013 12:31 PM, A2CPM wrote:
> Hi!
>
> On Jan 29, 10:48 am, David wrote:
> <--- snip --->
>> The line 2030 looks ok syntactically - and runs by itself under
>> emulation.  Does the SYNTAX ERROR happen in line 2030?  Is this image
>> somewhere we can download it?  I don't see any such named programs on
>> any of the disks on Asimov.
>
>      The programs are in "asm6809.sdk" which is in:
> "ftp://public.asimov.net/pub/apple_II/images/hardware/processor/
> stellation_mill/Mill-6809.zip".
> I didn't see the FLEX disk in a quick look.

Ah, got it.  I don't know how I missed that.  Ok, I converted 
asm6809.sdk to asm6809.dsk, booted a ProDOS disk, put asm6809 into s6d1, 
and ran OS9.TO.PRODOS.  It asks for source/destination disks - I put 
"Stellation The Mill Excel Flex 9.po" in s6d1, and a blank ProDOS disk 
in s6d2.  After pressing Return, it spits out a bunch of lines that seem 
to indicate attributes - but they're all zeroes:
DD.TOT 0 SECTORS
DD.TKS 0 SECTORS/TRACK
etc.
Proceeding seems to end in SYNTAX ERROR, and a break at 1500.  Do I have 
the procedure right?

[toc] | [prev] | [next] | [standalone]


#624

FromA2CPM <a2@wilserv.com>
Date2013-01-29 10:35 -0800
Message-ID<a7b2a45c-f2fd-40ee-98b6-5dcbaae045c2@w7g2000yqo.googlegroups.com>
In reply to#623
Hi!

On Jan 29, 1:15 pm, David wrote:
> Ah, got it.  I don't know how I missed that.  Ok, I converted
> asm6809.sdk to asm6809.dsk, booted a ProDOS disk, put asm6809 into s6d1,
> and ran OS9.TO.PRODOS.  It asks for source/destination disks - I put
> "Stellation The Mill Excel Flex 9.po" in s6d1, and a blank ProDOS disk
> in s6d2.  After pressing Return, it spits out a bunch of lines that seem
> to indicate attributes - but they're all zeroes:
> DD.TOT 0 SECTORS
> DD.TKS 0 SECTORS/TRACK
> etc.
> Proceeding seems to end in SYNTAX ERROR, and a break at 1500.  Do I have
> the procedure right?

    Right idea, wrong program.  You want "FLEX.TO.PRODOS", not
"OS9.TO.PRODOS".  Having the FLEX disk image in the wrong order may be
the next problem, perhaps not.

Willi

[toc] | [prev] | [next] | [standalone]


#625

FromMichael J. Mahon <mjmahon@aol.com>
Date2013-01-29 13:51 -0600
Message-ID<584274543381181643.194629mjmahon-aol.com@news.giganews.com>
In reply to#619
David Schmidt <schmidtd@my-deja.com> wrote:
> On 1/29/2013 10:11 AM, A2CPM wrote:
>>      Expanded line 2030 from "FLEX.TO.DECIMAL":
>> 2030 FOR I = 4 TO 255:
>>         PRINT(PEEK(SA + I)):
>>       NEXT I
>> 
>>      Expanded line 2030 from "FLEX.TO.PRODOS":
>> 2030 FOR I = 4 TO 255:
>>         PRINT CHR$(PEEK(SA + I));:
>>       NEXT I
>> 
>>      "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
>> written
>> to the output disk are so much bigger than the files on the input disk
>> so
>> the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
>> showing
>> "SYNTAX ERROR".
> 
> The line 2030 looks ok syntactically - and runs by itself under
> emulation.  Does the SYNTAX ERROR happen in line 2030?  Is this image
> somewhere we can download it?  I don't see any such named programs on any
> of the disks on Asimov.

What happens when the chr$ results in a ctl-D ($04 or $84)?

It would be both safer and much faster to write the ProDOS file as a binary
file using explicit byte offsets and lengths.  Then the data copying would
be sector by sector instead of byte by byte. 

-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

[toc] | [prev] | [next] | [standalone]


#626

FromCharlie <charlieDOTd@verEYEzon.net>
Date2013-01-29 14:56 -0500
Message-ID<ke99ge$293$1@dont-email.me>
In reply to#618
On 1/29/2013 10:11 AM, A2CPM wrote:
> Hi!
>
>      One of the ProDOS format disk images for the Mill 6809 card have
> two BASIC
> programs for extracting all the files on a disk formatted by the FLEX
> operating system for the Apple ][.  The names are "FLEX.TO.PRODOS" and
> "FLEX.TO.DECIMAL".  The two programs are identical except for line
> 2030.
>
>      Expanded line 2030 from "FLEX.TO.DECIMAL":
> 2030 FOR I = 4 TO 255:
>         PRINT(PEEK(SA + I)):
>       NEXT I
>
>      Expanded line 2030 from "FLEX.TO.PRODOS":
> 2030 FOR I = 4 TO 255:
>         PRINT CHR$(PEEK(SA + I));:
>       NEXT I
>
>      "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
> written
> to the output disk are so much bigger than the files on the input disk
> so
> the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
> showing
> "SYNTAX ERROR".
>
>      So, why does "FLEX.TO.DECIMAL" run and "FLEX.TO.PRODOS" not run?
> I was
> able to get all the files extracted from the FLEX disk with
> "FLEX.TO.DECIMAL"
> but would like to know how to change line 2030 to make
> "FLEX.TO.PRODOS" run.
>
> Willi

Is one of the numbers PEEKED a 4?  A PRINT CHR$(4); will cause a SYNTAX 
ERROR in the FOR/NEXT loop (at least in AppleWin).  Try running it 
without the semi-colon to see if that's it.

Charlie

[toc] | [prev] | [next] | [standalone]


#627

FromMichael J. Mahon <mjmahon@aol.com>
Date2013-01-29 14:03 -0600
Message-ID<1877742389381182277.970401mjmahon-aol.com@news.giganews.com>
In reply to#626
Charlie <charlieDOTd@verEYEzon.net> wrote:
> On 1/29/2013 10:11 AM, A2CPM wrote:
>> Hi!
>> 
>>      One of the ProDOS format disk images for the Mill 6809 card have
>> two BASIC
>> programs for extracting all the files on a disk formatted by the FLEX
>> operating system for the Apple ][.  The names are "FLEX.TO.PRODOS" and
>> "FLEX.TO.DECIMAL".  The two programs are identical except for line
>> 2030.
>> 
>>      Expanded line 2030 from "FLEX.TO.DECIMAL":
>> 2030 FOR I = 4 TO 255:
>>         PRINT(PEEK(SA + I)):
>>       NEXT I
>> 
>>      Expanded line 2030 from "FLEX.TO.PRODOS":
>> 2030 FOR I = 4 TO 255:
>>         PRINT CHR$(PEEK(SA + I));:
>>       NEXT I
>> 
>>      "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
>> written
>> to the output disk are so much bigger than the files on the input disk
>> so
>> the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
>> showing
>> "SYNTAX ERROR".
>> 
>>      So, why does "FLEX.TO.DECIMAL" run and "FLEX.TO.PRODOS" not run?
>> I was
>> able to get all the files extracted from the FLEX disk with
>> "FLEX.TO.DECIMAL"
>> but would like to know how to change line 2030 to make
>> "FLEX.TO.PRODOS" run.
>> 
>> Willi
> 
> Is one of the numbers PEEKED a 4?  A PRINT CHR$(4); will cause a SYNTAX
> ERROR in the FOR/NEXT loop (at least in AppleWin).  Try running it
> without the semi-colon to see if that's it.
> 
> Charlie

That was my point. Ctl-D signals ProDOS that the following PRINTed
characters are a ProDOS command. Since the purpose of this loop is to copy
arbitrary binary data to a text file (!), the semicolon is necessary to
prevent the insertion of a CR after each byte. 

This loop will only work on files that do not contain ctl-Ds--not very
useful for arbitrary data, an a bog-slow byte at a time copy. 

-michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

[toc] | [prev] | [next] | [standalone]


#629

FromCharlie <charlieDOTd@verEYEzon.net>
Date2013-01-29 15:34 -0500
Message-ID<ke9bnf$jcf$1@dont-email.me>
In reply to#627
On 1/29/2013 3:03 PM, Michael J. Mahon wrote:
> Charlie<charlieDOTd@verEYEzon.net>  wrote:
>> On 1/29/2013 10:11 AM, A2CPM wrote:
>>> Hi!
>>>
>>>       One of the ProDOS format disk images for the Mill 6809 card have
>>> two BASIC
>>> programs for extracting all the files on a disk formatted by the FLEX
>>> operating system for the Apple ][.  The names are "FLEX.TO.PRODOS" and
>>> "FLEX.TO.DECIMAL".  The two programs are identical except for line
>>> 2030.
>>>
>>>       Expanded line 2030 from "FLEX.TO.DECIMAL":
>>> 2030 FOR I = 4 TO 255:
>>>          PRINT(PEEK(SA + I)):
>>>        NEXT I
>>>
>>>       Expanded line 2030 from "FLEX.TO.PRODOS":
>>> 2030 FOR I = 4 TO 255:
>>>          PRINT CHR$(PEEK(SA + I));:
>>>        NEXT I
>>>
>>>       "FLEX.TO.DECIMAL" runs in AppleWin but stops because the files
>>> written
>>> to the output disk are so much bigger than the files on the input disk
>>> so
>>> the output disk becomes full.  "FLEX.TO.PRODOS" breaks out of BASIC,
>>> showing
>>> "SYNTAX ERROR".
>>>
>>>       So, why does "FLEX.TO.DECIMAL" run and "FLEX.TO.PRODOS" not run?
>>> I was
>>> able to get all the files extracted from the FLEX disk with
>>> "FLEX.TO.DECIMAL"
>>> but would like to know how to change line 2030 to make
>>> "FLEX.TO.PRODOS" run.
>>>
>>> Willi
>>
>> Is one of the numbers PEEKED a 4?  A PRINT CHR$(4); will cause a SYNTAX
>> ERROR in the FOR/NEXT loop (at least in AppleWin).  Try running it
>> without the semi-colon to see if that's it.
>>
>> Charlie
>
> That was my point. Ctl-D signals ProDOS that the following PRINTed
> characters are a ProDOS command. Since the purpose of this loop is to copy
> arbitrary binary data to a text file (!), the semicolon is necessary to
> prevent the insertion of a CR after each byte.
>
> This loop will only work on files that do not contain ctl-Ds--not very
> useful for arbitrary data, an a bog-slow byte at a time copy.
>
> -michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon

Michael, your post hadn't showed up yet on my newsreader when I posted 
(you beat me by 5 minutes :-)
I only suggested removing the semi-colon to see if the SYNTAX ERROR went 
away, not to use it for copying data.  I should have been more clear on 
that.

Charlie

[toc] | [prev] | [next] | [standalone]


#628

FromA2CPM <a2@wilserv.com>
Date2013-01-29 12:21 -0800
Message-ID<2b206d58-eb81-4356-904e-135858272e32@f6g2000yqm.googlegroups.com>
In reply to#626
Hi!

    Michael and Charlie, thank you, thank you, thank you!!!  I'm glad
I gave up on "FLEX.TO.PRODOS" and used "FLEX.TO.NUMERIC" to extract
all the files from the FLEX disk.  I rarely use BASIC for anything and
would NEVER have figured out this problem by myself.  If there were
multiple FLEX disks in Apple ][ format to extract files from, I would
have written a copy program in Pascal.  But with only one known FLEX
disk in Apple ][ format, I decided to make do with what was
available.  Again, thank you, gentlemen.

Willi

[toc] | [prev] | [next] | [standalone]


#630

FromDavid Schmidt <schmidtd@my-deja.com>
Date2013-01-29 15:40 -0500
Message-ID<ke9c3g$m45$1@dont-email.me>
In reply to#628
On 1/29/2013 3:21 PM, A2CPM wrote:
> Hi!
>
>      Michael and Charlie, thank you, thank you, thank you!!!  I'm glad
> I gave up on "FLEX.TO.PRODOS" and used "FLEX.TO.NUMERIC" to extract
> all the files from the FLEX disk.  I rarely use BASIC for anything and
> would NEVER have figured out this problem by myself.  If there were
> multiple FLEX disks in Apple ][ format to extract files from, I would
> have written a copy program in Pascal.  But with only one known FLEX
> disk in Apple ][ format, I decided to make do with what was
> available.  Again, thank you, gentlemen.

I'm not sure how they ever intended this to work in the first place... 
maybe on pure text files?

[toc] | [prev] | [next] | [standalone]


#631

From"Bill Buckels" <bbuckels@mts.net>
Date2013-01-31 08:36 -0600
Message-ID<kedvdm$jti$1@speranza.aioe.org>
In reply to#630
"David Schmidt" <schmidtd@my-deja.com> wrote:

>I'm not sure how they ever intended this to work in the first place... 
>maybe on pure text files?

If they had been gifted with the excellent level of analysis provided by the 
comp.sys.apple2.programmer team they would not have released this without at 
least a comment in the code providing errrata and Willi would not have 
needed to start this excellent thread.

I will forever consider Ctrl-D as I am certain we all will.

Bill 

[toc] | [prev] | [next] | [standalone]


#632

Fromgids.rs@sasktel.net
Date2013-01-31 08:01 -0800
Message-ID<daa19885-df3a-4aca-8137-d578428f8918@googlegroups.com>
In reply to#631
> If they had been gifted with the excellent level of analysis provided by the 
> comp.sys.apple2.programmer team they would not have released this without at 
> least a comment in the code providing errrata and Willi would not have
> needed to start this excellent thread. 
> I will forever consider Ctrl-D as I am certain we all will.
 
> Bill


I hate Ctrl-D.  No!  I mean it.  I absolutely despise Ctrl-D.  So much so that it no longer appears in any applesoft programs that I use.  It is no longer needed.  I created the Applesoft Enhancements package that totally eliminates and replaces all disk commands.

More power to Applesoft!
More speed to Applesoft!
Way smaller Applesoft programs!

Chain command is redundant, Text file disk commands are redundant, 
Bloading binary files way simpler.  Splitting applesoft programs or moving program above Hi-res screen, rarely needed.

But I do owe you a great debt of gratitude, Ctrl-D.  Without my passionate hatred towards you, all this would not have been possible.

Thanks for being my object of aggression, Ctrl-D.

I hate you with all my heart, but I could not have become a better programmer without you.

Rest in Peace.

Rob

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web