America Online
APPLE II DEVELOPMENT FORUM CONFERENCE LOG
November 14, 1989  10:00 pm eastern time
Topic:  BASIC Programming
Forum Leader:  Gary Jacobson (AFA Gary J)


AFA Gary J Good evening, and welcome to the Apple II Development Forum.
AFA Gary J Tonight's topic is BASIC programming.
AFA Gary J We'll be using forum protocol, STARTING NOW, so if you have a
          question,
AFA Gary J type a "?" on a line by itself, or if you have a comment on the
          current
AFA Gary J topic, type a "!" on a line by itself.
AFA Gary J Does anyone have any questions they'd like to start the evening
          off with?
AFA Gary J Ok, looks like Lyford has the first question.. GA
BIG LYFORD I've done an extensive prog in Asoft/Beagle compiler.
BIG LYFORD Have had trouble getting into a better basic
BIG LYFORD Have tried Micol, AC/Basic but have had much trouble.
BIG LYFORD Any suggestions?
AFA Gary J What kind of trouble?
BIG LYFORD The other manuals leave much to be desired and I can't seem to
          switch over.
AFA Gary J Hmmm.. sounds like a familiar story...
BIG LYFORD I've seen ads for TML Pascal II and others but the comments all
          allude to
BIG LYFORD trouble with these dialects as well.
BIG LYFORD So far, I feel ok with what I'm using....but think I'm missing
          something.
Astronewt  How does one open a file in assembly?
BIG LYFORD (Done)
AFA Gary J Good examples always help, or find someone who is using the
AFA Gary J languages you want to use, and get them to give you a step by
          step process
AFA Gary J to do something you want to do.  If you have a good programming
          project to
AFA Gary J motivate you, that helps too.
AFA Gary J Usually, if you can make those first couple of steps, the rest
          will
AFA Gary J fall into place.
AFA Gary J Anyone else have any suggestions?
AFA Gary J Guess not :)
AFA Gary J Does that help, Lyford?
BIG LYFORD Yes, thanks.. What Basic dialect do you use..and why?
AFA Gary J On the GS, I still use AppleSoft...because it's there  :)
AFA Gary J I use other dialects at work (Microsoft Quick Basic), but haven't
          even torn
Astronewt  I used Applesoft to test my master's thesis.
AFA Gary J the wrapper off of my TML BASIC.
AFA Gary J Any other questions?
BIG LYFORD (Thank goodness I'm not the only one)
Astronewt  Is tonight's topic AppleSoft?  I didn't check before...
AFA Gary J Well, tonight's topic is BASIC in general, but we'll answer other
          questions
AFA Gary J as well.
AFA Gary J (or try to :)
Dave Lyons What was your question, Astro?  Opening a ProDOS file from
          assembly?
Astronewt  I think I need a protocol tutorial.  Sorry if I interrupted.
AFA Gary J That's ok.  You have one infraction allowed before being kicked
          out :)
AFA Gary J (just kidding, of course)
AFA Gary J Yes, Astronewt, what was you question previously?
Astronewt  How does one open a ProDOS file from assembly (Merlin)?
AFA Gary J Are you answering this one, Dave?
Dave Lyons Do you have the ProDOS 8
Astronewt  My goal is to write a binary file to hold a sound wave.
Dave Lyons technical reference manual?  You need to do a ProDOS 8 MLI "OPEN"
          call, basically like this:
Dave Lyons   jsr $bf00    dfb $C8   dw OpenParms
Dave Lyons OpenParms dfb 3   ;number of parameters
Dave Lyons      dw theName
Dave Lyons (dang...out of order)
Dave Lyons OpenParms  dfb 3
Dave Lyons refNum    ds 1
Dave Lyons        dw theName
Dave Lyons        dw theBuffer
Dave Lyons theName   str 'MY.FILE.NAME'
DavidW185  I can't believe I'm finally on. It only took me 50 minutes.
Dave Lyons theBuffer is the address of a 1024-byte ($400) area ProDOS 8 will
          use for a buffer internally.  The
Dave Lyons reference number gets returned in "refNum".  You need the rest of
          the info from the manual to do
Dave Lyons similar paameter blocks for READ and WRITE and CLOSE.
Dave Lyons Is this the kind of info you're looking for?
Astronewt  Yes, thanks.  I'm just trying to get the feel of it.
AFA Gary J Yes, a operating system manual is a must when doing calls on that
          level.
Dave Lyons ok
AFA Gary J Lyford, did you have another question?  GA
BIG LYFORD Why do that (assembly) when you can do it in "english"?
AFA Gary J heheh
Astronewt  I've got the GS tech ref, and "mastering the toolbox," but it's
          hard reading.
Dave Lyons How can you do it in English?
Astronewt  I did it in Pascal, but asking for the sine 20000 times gets
          old.
Astronewt  That's why I'd like to use assembly.
BIG LYFORD ?chr$(4)"OPEN" ,etc  (Almost english)  ha ha
AFA Gary J It depends upon what it is you're writing, Lyford.
Astronewt  AppleSoft is convenient, but slow for heavy math.
AFA Gary J If you're writing something that requires assembly language to
          accomplish,
AFA Gary J and you need to open a file, you have to do something :)
          BASIC.SYSTEM isn't
AFA Gary J always in memory.
AFA Gary J (thank goodness)
BIG LYFORD I tried to decipher the assembly manuals..but gave up.  Show me
          how to do the
AFA Gary J Sometimes you can combine a hybrid of BASIC and assembly language
          very
AFA Gary J successfully, though.
BIG LYFORD following:  10 print "hello"
BIG LYFORD (done)
AFA Gary J In 6502 assembly, you can do the following:
Astronewt  So, I have to ask BASIC.SYSTEM to help with the filing?
AFA Gary J        ldx #0
AFA Gary J START  lda STRING,x
AFA Gary J        beq done
AFA Gary J        jsr $FDED
AFA Gary J        inx
AFA Gary J        bne  START
AFA Gary J done   rts
AFA Gary J STRING  ASC 'hello',00
Dave Lyons (BTW, to do that in Davex or a Davex command, I do:  jsr xmess,
          str 'Hello',0D,00
Dave Lyons (Whoops--asc, not str.)
Astronewt  Why the double zero (00)?
AFA Gary J It's not all that hard.
AFA Gary J The double zero at the end of the string is an 'end of string'
          indicator :)
Astronewt  Thanks-
BIG LYFORD Where do you learn this?  I tried Roger wagner's book.
AFA Gary J It's just one method of telling your program when to stop
          spitting out
AFA Gary J characters
AFA Gary J .
AFA Gary J Roger Wagner's book is a good one... there are others.  I think I
          learnd from
Astronewt  Yes, the basics seem to be the hardest to find.
AFA Gary J "Programming the 6502" by Rodney Zacks  (I think that's how it's
          spelled)
AFA Gary J Roger's book has many good examples, and is much better.
Dave Lyons The doube zero is what merlin wants, by the way--I just tried it
          with one, and it doesn't
Dave Lyons work (it's looking for two-character hex values there).
Astronewt  How do you switch in and out of Merlin so fast? Two machines?
Dave Lyons (Yes, two machines.)  And "xmess" is a subroutine in Davex, of
          course.  If anybody's interested,
AFA Gary J There are different methods of determining the lenth of output as
          well.
Dave Lyons you're welcome to it.
AFA Gary J Using zero at the end is just one method.
AFA Gary J xmess?
Astronewt  Could this be used to issue commands under BASIC.SYSTEM once
          you're in it?
Dave Lyons There is a ProDOS Technical Note you should look at,
          Astronewt--just a sec, and I'll look it up.
Dave Lyons Whoops--it's no longer a Technical Note.  It used to be ProDOS 8
          TN #2, but the information is
Dave Lyons now available in the Addison-Wesley book (_ProDOS 8 Technical
          Reference Manual_).  The DOSCMD vector
Dave Lyons will be very helpful to you--you can ask BASIC.SYSTEM to execute a
          command string using
Dave Lyons that vector.
Dave Lyons (Gary, the name "xmess" comes from sticking an "x" onto the front
          of "mess", since all the Davex
Dave Lyons subroutines available to eXternal commands start with "x".)
Astronewt  Thanks, I'll look it up.
BIG LYFORD Wouldn't it be great if someone would write an expanded Asoft for
          the GS with a
AFA Gary J Thanks, Dave :)
BIG LYFORD compiler...like Beagle Bros
BIG LYFORD .

BIG LYFORD But someone should be able to write a new interpreter...and
          compiler.
BIG LYFORD Lets bug the Beagle Bros.
Nuzz       You should bug the Zbasic people.
AFA Gary J That's what languages like AC BASIC, TML BASIC, and Micol BASIC
          are trying
AFA Gary J to do.
AFA Gary J Yeah, get ZBasic to do their thing on the GS
Nuzz       Anyone know of a utility that would write out source for
          patterns?
BIG LYFORD I heard Zedcor has quit supporting their product.
AFA Gary J Source for patterns?
Nuzz       Yea, you know, make a pattern then write out the pattern as
          source
AFA Gary J You mean like a graphic image pattern?
Nuzz       A pen pattern
AFA Gary J Not and write it out as source..
AFA Gary J (but it wouldn't be too hard to create your own).
Nuzz       Lyford, which versions <on Zedcor>
Nuzz       I'm getting lazy :)
AFA Gary J :)   It's always better to see if it exists first before
          re-inventing the
AFA Gary J wheel.  That's something I'd like to see as well.
Evan13     Has the Source Code Sampler, Volume 2  been released?
Dave Lyons Nope, volume 2 hasn't been released yet.