AppleLink
APPLE II DEVELOPMENT FORUM
June 6, 1989  10:00 p.m. Eastern Time
Topic:   Assembly Language
Forum Leader:  Dave Sugar  (AFL Dyfet)

A2GS       Has anybody accessed the DOC directly through the softswitches?
AFA Gary J Hi Matt.
Coach101   Good evening Matt
AFA Parik  (I have A2GS, time saved vs. using tools is VERY minimal.  only
          recommended if
AFA Parik  you find your program going s l o w  with sound.
A2GS       I don,t have any problem playing things directly through it,
          but...
A GibberFC A2GS... don't fool with the softswitches... if you want future
          compatibility
A GibberFC sometimes apple will pull a fast one and change them...expecting
          you to have
A GibberFC made tool calls instead.
Richbourne Hi guys, I have a pretty weird situation, can you people help me?
       :)
AFA Gary J Hmmm... Dyfet isn't around, and it's time to start....
A GibberFC I don't know.. what type of weird situation is it.....;)
A2GS       I get this nagging FATAL SYSTEM error- Unclaimed sound
          Interrupt...
Richbourne Well... (this is partly from Lets Discuss) I consider myself
          proficient at.....
A2GS       and I know that in the first place I turned off all of the
          Oscillators...
Richbourne ATARI BASIC (was published numerous times), and dabbed a little in
          Atari's
Richbourne machine language, but never got into it. I also dabbed a little
          into Apple
A2GS       Interrupts just to avoid this kind of error,Why is it happening
          anyways?
AFA Gary J Wait just a second, Richbourne.  Let's start this forum formally
          and we'll take
Richbourne II machine language (Lisa assembler! In 1989!), but those attempts
          to get into
AFA Gary J your question first.
AE PhilM   Hi Matt!
Richbourne Whew! I should get a macro program! :)
A GibberFC Hi Phil!!! what is up??
AFA Gary J :)
AFA Gary J Welcome to the Apple II Developer's Forum.  Tonight's topic is
          assembly
AE PhilM   Hi Gibber, Vulcan...that's up!  Looking real good!
AFA Gary J language.
AFA Gary J We'll be using forum protocol starting *NOW*, which means...
A2GS       I realize I'm taking a chance on future compatibility by using the
          softswitches
A2GS       but, hey, that's life! :-)
AFA Gary J If you have a question, type a question mark (?) followed by a
          return.
AFA Gary J If you have a comment on the current topic, type an explanation
          point (!),
AFA Gary J followed by a return.
A2GS       ?
ASEMBLER13 ?
AFA Gary J Richbourne has the first question....(which he has already
          partially asked)
A GibberFC be bak
AFA Gary J Can you continue where you left off?
Richbourne ...continuing.... so how can I make a smooth transition from
          Atari/Applesoft...
Richbourne to GS development-level assembly?
AFA Gary J Q = Richbourne, A2GS, ASEMBLER13
Coach101   !
JSchober   (Yo!)
AFA Gary J GA Coach.
Richbourne :: all ears ::
Coach101   The list of books that were provided in the Lets Discuss section
          would
Coach101   be a very good start.  I would get one of the "machine language"
          books
Richbourne oh yeah... I was going to mention... I HAVE Apple IIgs Technical
          Reference,
Coach101   to learn the machine architecture and then proceed to the Apple
Richbourne but it doesn't start you anywhere.
AE PhilM   !
Coach101   publication (via APDA) with HodgePodge implemented in "C", Pascal,
          and
Coach101   assembler.
Coach101   Beyond that, given the size of the II-GS (memory that is) I
          would
Coach101   strongly consider using either Pascal or C instead of assembler
          (except
Coach101   in those time critical spots you may find).  GA
AFL Marty  AE PhilM ... GA
AE PhilM   You need to get several books:  Tool Box Ref 1&2, Firmware Ref
          Manual, Hardware
AFL Marty  Q:  Richbourne (Phil), A2GS, ASSEMBLER13
AE PhilM   Ref Manual, GS/OS Ref Manual 1&2, and Assembler or Pascal or C
          books...if you
AE PhilM   want to get serious...also sign up to be a developer and get the
          Tech Notes.
AFA Gary J You can also get the tech notes online, here.
AFA Parik  (sell your house, its the first step)
AFL Marty  Done Phil?
AE PhilM   That should give you all you need...(for a while)
AE PhilM   Done
PsychoPunk ?
AFL Marty  A2GS Go ahead
AFA Gary J Anything else, Rich?
A2GS       I'm accessing the DOC directly through the softswitches (risky
          business)...
AFL Marty  q+ punk
AFL Marty  Q= A2GS, ASSEMBLER13, PsychoPunk
MAILMAN60  How do you sign up to be a developer?
A2GS       and I know I've turned off the Oscillators interrupts, why do I
          get (after a
A GibberFC bak
A2GS       while) a FATAL SYSTEM error- Unclaimed sound interrupts?
AFA Gary J Q = A2GS, ASSEMBLER13, PsychoPunk, MAILMAN60
AFA Parik  !
Dave Lyons !
AFA Parik  (ga Dave :
Dave Lyons Sounds like you *haven't* successfully turned off the sound
          interrupt, to me.  Are you using the
Dave Lyons sound tools or dealing with the hardware directly?
A2GS       Hardware directly
Dave Lyons Hmmm...I've never done that myself.  If you have turned on the
          interrupt
AFA Parik  !
Dave Lyons temporarily, on purpose, you should install a routine to handle
          the
Dave Lyons interrupt--do you?
Dave Lyons (SetVector would be needed here.)
A2GS       I never turn on the sound interrupts, so I never put in an
          Interrupt Handler.
AFA Gary J Q = A2GS (Dave, Parik), ASSEMBLER13, PsychoPunk, MAILMAN60
AFA Parik  i use the DOC directly sucessfully, leave me email and we'll work
          it out.  You
Dave Lyons I'm confused.  You "successfully turned off the oscillators
          interrupts" but never turned them on?
AE PhilM   !
AFA Parik  still need to replace the IRQ.SOUND ($E1002C) with your own
          routine.
AFA Parik  ga
A2GS       I left the interrupts off while the sound continuously plays.
AFL Dyfet  Okay. GA Phil.
AE PhilM   I wrote Sonic Blaster and I can probably help you...send me a
          flash if you
AE PhilM   want to go into a private room and hack this one out.
A2GS       Why Parik? the interrupts are never being produced?
AFA Parik  (phil would help you better :-)
Dave Lyons (*I'm* done...dunno about everybody else)
AE PhilM   Done
AFL Dyfet  Okay, any other comments?
AFA Parik  done
AFA Gary J Q = ASSEMBLER13, PsychoPunk, MAILMAN60
AFL Dyfet  I believe we then turn to our next question, From Assembler.  GA
          Assembler.
Nuzz       ?
A2GS       done, thanks..
ASEMBLER13 Could somebody write a program which splits the screen in half so
          1 program
ASEMBLER13 could be on top and another on the bottom?????
Dave Lyons !
JSchober   !
AFL Dyfet  GA Dave
Dave Lyons Only if the programs are polite enough to follow whatever rules
          you
Dave Lyons laid down for them.  Many programs store directly to the screen
          memory,
AFA Gary J Q = ASSEMBLER13 (Dave, Joe), PsychoPunk, MAILMAN60, Nuzz
Dave Lyons and the hardware just displays whatever is there.  I read
          something
Dave Lyons interesting that came with Byte this month about a
Dave Lyons patented method of dealing with this sort of thing on a competing
          brand of
Dave Lyons blueish computers, and I don't know how well it would apply here.
          Apparently
Dave Lyons the idea is to *notice* that an application stored a character
Dave Lyons directly to the screen, and take it off & hide it somewhere
          before
Dave Lyons the hardware actually manages to display it on the screen.  I
          don't see how to
Coach101   !
Dave Lyons apply this to the Apple II.  (ga)
AFL Dyfet  Okay, GA Joe.
JSchober   There's a program out for the enhanced //e and //c with mouse card
          (doesn't
JSchober   seem to work on the GS) called SHARE, that does loosely what you
          ask -- let's
JSchober   you run 2 binary files under P8 simultaneously, so long as they
          don't compete
AFA Gary J Q = ASSEMBLER13 (Joe, Coach), PsychoPunk, MAILMAN60, Nuzz
JSchober   for memory.  Although the screen control isn't as you desire,
          since it's based
JSchober   on an interrupt scheme of some sort, you could probably patch the
          code to ...
JSchober   toggle text screen windows (33..36 or whatever in the Z-page)
          every time it
JSchober   switched the PC and whatever else it switches.  Just a thought;
          I've never
JSchober   tried it.  GA...
AFL Dyfet  Okay, GA Coach.
Coach101   Or, in the future as 5.0 catches on and we start to see Text
AFA Parik  641236984
Coach101   applications that use the Console driver, you could capture the
JSchober   (same to you, Parik)
AFA Parik  (sorry)
Coach101   console driver calls (with a custom driver maybe) and then map
          the
Matt DTS   !
Coach101   programs calls into a "virtual" screen with some sort of
          scrolling.
Coach101   Could be real cute.  Of course you still have to consider the
          basic
AFA Gary J Q = ASSEMBLER13 (Coach, Matt), PsychoPunk, MAILMAN60, Nuzz
Coach101   horsepower of the II-GS in a "multi-taksing" environment.  GA
AFL Dyfet  I see Matt wishes to add something.  GA Matt.
Matt DTS   Actually, 5.0 provides limited capabilities for standard input,
          output and
Matt DTS   error using the Console Driver, as well as adding console driver
          traps for
Matt DTS   better control of such things. GA.
AFL Dyfet  Hmm.  Sounds interesting.  Any other comments?
AFL Dyfet  Will this mean the end of shells that patch the GS/OS service
          vector for I/O
AFL Dyfet  handling, Matt?
AFL Dyfet  (redirection=handling)
HMT          !
AFL Dyfet  GA HMT.
Matt DTS   If you mean the $E100A8 vectors, perhaps.  *Most* applications
          will not need
HMT        still here
Matt DTS   to patch that any longer, but there will be exceptions.
Matt DTS   (Things like APW which use $01xx calls to that vector, for
          example.)  GA
AFL Dyfet  It seems the need for some of the $01xx functions will be
          eliminated in 5.0.
AFL Dyfet  In any case, GA HMT.
Matt DTS   That won't stop the old shell from making the calls. (GA)
HMT        Just Watchibg trying to see what I can lern!
MarcSSSi   !
AFL Dyfet  Okay.  Well, that's one of the reasons we're here :).  Ga Marc.
AFA Gary J Q = ASSEMBLER13 (MarcSSSi), PsychoPunk, MAILMAN60, Nuzz
MarcSSSi   The existing APW/Orca shell calls exceed simple redirection query
          so it seems
MarcSSSi   obvious that continued support into 5.0 and beyond is required for
          compatabilit
MarcSSSi   y!
Matt DTS   ! (I think I'm gonna have to explain this...)
MarcSSSi   ga
AFL Dyfet  I didn't mean to sidetrack into this issue, but since we have, GA
          Matt.
Matt DTS   (neither did I)  What it is, is this:
Matt DTS   Before launching a program ($B3/$B5), GS/OS sets prefixes 10: 11:
          and 12:
AFA Gary J Q = ASSEMBLER13 (Matt), PsychoPunk, MAILMAN60, Nuzz
Matt DTS   to .CONSOLE (requiring this device exists and is the Console
          Driver). A
Matt DTS   controlling program can set those prefixes to different devices or
          files and
Matt DTS   control redirection that way (for example, setting 11: for output
          to something
Matt DTS   like ":MYDISK:SPOOL.FILE".)  10 is input, 11 is output, 12 is
          error.
Matt DTS   This gets a lot more complicated when you get into the subtle
          issues of it,
Matt DTS   but that's the gist of it.  It's not overly complicated, but it
          will work,
Matt DTS   since programs written for 5.0 can simply "open 10:" for input,
          "open 11:" for
Matt DTS   standard output (and 12 for error).  This is really easy from
          higher-level
Matt DTS   languages.  GA.
AFL Dyfet  Hmm...I see a few subtle problems with that in unusual situations
          as apposed to
AFL Dyfet  the more standard use of passing stdin/stdout/stderr handles, but
          I will bring
AFL Dyfet  this up with you in mail sometime.  Now, I believe the next
          question is from
AFL Dyfet  Psychopunk.  GA Psychopunk.
ASEMBLER13 OK Thanks Alot :-)
PsychoPunk I've got problems making programs to be used in auxilary memory.
PsychoPunk I load it in normal memory, and move it to aux, but it crashes.
PsychoPunk The program works fine in norm but is really screwed up in aux.
Matt DTS   ! (since Dave's not responding)
AFL Dyfet  GA Matt.
PsychoPunk Also, if it does happen to work, the final rts will crash.
Matt DTS   How does it crash, exactly?  Any more details at this point would
          "hep".
Matt DTS   "Final RTS" = this program ends with an RTS?
PsychoPunk something like 6000- X=65 A=64 Y=53  etc...
PsychoPunk Yes.
Dave Lyons !
Matt DTS   Which is supposed to return you to BASIC, I suppose?  (getting
          warm?)
AFA Gary J Q = PsychoPunk (Matt, Dave), MAILMAN60, Nuzz
Dave Lyons Do the locations $0100 and $0101 mean anything to you, PP?  (If
          not, somebody's going
PsychoPunk I supposed if it was executed from monitor, it would return to
          monitor?
Dave Lyons to have to explain them.)
Matt DTS   Ah.  Diagnosis complete.  Dr. Lyons will now issue a
          prescription.
PsychoPunk I think they're used to check if under aux or norm?
PsychoPunk (Am I close?)
Dave Lyons Me?  Ack.  Well, the general idea is that you keep the stack
          pointer for the
Dave Lyons non-active memory bank in one of those locations, but I don't
Dave Lyons have the details right in front of me.  Are you twiddling the
          $C0xx switches
Dave Lyons directly, or are you using the AUXMOVE and XFER entries into the
          $C3xx space?  (I
Dave Lyons think those take care of the stack switching automatically.)
Dave Lyons BTW, you definitely need to switch back to main memory somehow or
          other
Dave Lyons before you can return to the monitor or whoever executed you.
Coach101   !
Dave Lyons (I suppose I should be more careful: you need to return the
          environment to how it was
Dave Lyons before you return, especially the stack.)
Dave Lyons (done for now)
AFL Dyfet  Feel free to jump in here at this point, Coach.
PsychoPunk Okay.  Also, what happens if one tried to issue prodos cmds from
          aux?
Coach101   The II-E and II-C technical reference manuals (one or both)
Matt DTS   Horribly, nasty things that we don't want to talk about.
Dave Lyons Ack!  Very bad, I think.
Coach101   contain a pretty detailed explanation of how to make use of
Coach101   the aux mem bank for either data or program.  All of what Dave
Matt DTS   (some will tell you MLI calls from aux work in certain instances,
          but I
Coach101   was saying is explained in those books (in excruciating detail).
Coach101   ga
Matt DTS   wouldn't bet other people's disks on that.)
AFL Dyfet  The best way to call the MLI from aux memory is to setup an
          interface routine
AFL Dyfet  that switches back to standard memory before calling the real MLI
          and then
AFL Dyfet  sets auxmem active again for the return.
Matt DTS   In other words, the actual call to the MLI is in main memory.
AE PhilM   !
PsychoPunk Hmmm.  Helpful!  Well, I'm done.
AFL Dyfet  GA Phil.
AE PhilM   Dyfet, that is a good idea for some calls but it gets a little
          complicated
AE PhilM   when you are passing pointers to data areas that you want to pass
          or return
AE PhilM   stuff too.
AE PhilM   Then you need to copy all that stuff over manually...get's real
          messy.
PsychoPunk done
AE PhilM   done
AFL Dyfet  You can solve that with a little more smarts in the interface
          routine, to
AFL Dyfet  recognize and automatically move data around for read/write calls,
          etc.  I
AFL Dyfet  never said it would be easy :).
PsychoPunk (looks hard!)
AE PhilM   A lot more smarts :))
AFL Dyfet  Well, any other comments?
PsychoPunk done
AFL Dyfet  Okay, Mailman left before his question was called.  I believe the
          next
AFL Dyfet  question is from Nuzz.  GA Nuzz.
HMT
Nuzz       I want to set the rPage and rPaper fields on the Gs print mgr. I
          tried using
Nuzz       iVres * inches I want for rPage, and adding a few to rPaper, but I
          get a
Matt DTS   !
AFA Gary J Q = Nuzz
Nuzz       scrunched up picture when I copy in my bit map
Nuzz       any suggestions.GA
AFL Dyfet  GA Matt.
Matt DTS   Didn't we send you an answer to this?
Nuzz       Not as of yet
Matt DTS   Ack!  Send another one in for tomorrow asking for your answer.
Matt DTS   Be indignant and insulting so we feel at home.
Matt DTS   GA.
JSchober   :)
Nuzz       I could never be that. You all helped too much
AE PhilM   LOL
AFL Dyfet  Okay, do we have any other questions for tonight?
AE PhilM   ?
HMT        ?
Nuzz       I'll ask for an answer in the morning. Thanks GA
AFL Dyfet  GA Phil
AE PhilM   Can we talk a little about the data structures used to maintain
          the cache block
AE PhilM   s in the cache manager?
Matt DTS   No.  Those are OS internal structures, subject to change at
          strange times.
AE PhilM   It looks like it is a linked list and is giving me preformance
          degradation on
AE PhilM   my Vulcan native mode driver.
Matt DTS   Drivers should only access the cache through the system service
          calls.
Dave Lyons So decrease the cache size. :-)
Matt DTS   Your driver has the ultimate authority on caching.  If caching is
          slower than
AE PhilM   I do!  And they are slow.
Matt DTS   not caching, then refuse the request to cache the blocks.
AE PhilM   On the 100Meg Vulcan, the cache manager slows me down...I guess
          it's best not
AE PhilM   to use it.
Matt DTS   The FSTs will not cache the blocks after you return them - they
          ask you to
Matt DTS   do it instead.
AE PhilM   Should have used a hashing technique...oh well a recommendation
          then.
Coach101   !
AFL Dyfet  GA Coach.
AFA Gary J Q = Phil (Matt, Coach), HMT
AE PhilM   I know, Matt....but CacheFindBlock it terribly inefficient...you
          really should
Matt DTS   (I'm not getting into the internal structures - I'm just saying
          that if you
AE PhilM   take a look at it for next rev.
Coach101   Just wanted to second AE's recommendation.  Cache is a
          performance
Matt DTS   don't wanna cache, you don't have to)
Coach101   option, and I think if it has a sluggishness problem it should
Coach101   be addressed in future releases and not pushed back on the
AE PhilM   Yes, and not a very good implementation at that!  The cache
          manager should be
AE PhilM   optimized for preformance!!!
Coach101   device driver/manufacturer.   GA
AE PhilM   done
AFL Dyfet  Anything more?
AFL Dyfet  Okay, I believe the next question is from HMT.  GA HMT.
HMT        OK since uzz opened the printer can of worms, I have a ? about
          Imagewriter II
HMT        when it get to the end of the carriage it gives a carriage return
          but not a lin
HMT        feed has anything ewver been done about this?.
HMT        GA
AFL Dyfet  Hi Jim.  Anyone wish to comment on this?
Matt DTS   Do you have the switches set to tell it put a line feed after a
          CR?
Dave Lyons !
Dave Lyons There is a code you can send to the serial port firmware that
          tells it
Coach101   Switch Sw1-8...
HMT        I have a question into Apple ab out this via APL, PE but haven't
          heard
Dave Lyons to insert linefeeds.  I think it's Ctrl-I LE...it's in the
          Firmware Reference for the GS.
Matt DTS   Or you can set your control panel to do that on a IIgs.
Jump Long  You can also write your application so it doesn't print past the
          end of the
AFA Gary J Q = HMT (Dave)
Jump Long  carriage :)
JimMensch  how bout trying ctrl-i80N ctl-iC
JimMensch  that works with most apple interfaces (including IIgs and super
          serial card)

HMT        Sorry I cant  agree.  This is only used when thewre isn,t a
          program around
HMT        guiding the printer
Matt DTS   HMT:  The printer or the interface is configured incorrectly.
Jump Long  type "PR#1", then type the keystrokes. The IWII will stay in that
          mode until
HMT        I GUESS I'M NOT EXPRESSING MYSELF VERY WQELL
Jump Long  you reset it.
Matt DTS   You're either going to have to change some dip-switch settings or
          change the
Matt DTS   Control Panel settings.
HMT        ok TNKS
Jump Long  or make a small BASIC program out of it to set up your printer
          whenever you
Matt DTS   There should be two "packages" of eight little switches each.
Jump Long  want to print some program listings.
Matt DTS   Take the left-most group of eight switches and look at the
          right-most switch
Matt DTS   within that group.  Flip it the other way and try printing
          again.
AFL Dyfet  I've had a GS with an ImageWriter II for several years, and have
          not had any
AFL Dyfet  problem printing with it when configured correctly, so I know it
          does work :).
AFL Dyfet  I guess we have reached the end of this chat.  Protocol disengaged
          :)