home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / atari / 8bit / 5931 < prev    next >
Encoding:
Text File  |  1993-01-22  |  3.3 KB  |  78 lines

  1. Newsgroups: comp.sys.atari.8bit
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!news.belwue.de!ifi!straif
  3. From: straif@minnie.informatik.uni-stuttgart.de (Peter Straif)
  4. Subject: Re: File Headers.
  5. Message-ID: <1993Jan22.115353.29144@ifi.informatik.uni-stuttgart.de>
  6. Sender: news@informatik.uni-stuttgart.de
  7. Organization: Informatik, Uni Stuttgart, Germany
  8. References: <1jjps0INNek1@nz12.rz.uni-karlsruhe.de> <C16AKJ.3CI@mentor.cc.purdue.edu>
  9. Date: Fri, 22 Jan 1993 11:53:53 GMT
  10. Lines: 66
  11.  
  12. In <C16AKJ.3CI@mentor.cc.purdue.edu> smb@pern.cc.purdue.edu (Scott M. Ballew) writes:
  13.  
  14. >In article <1jjps0INNek1@nz12.rz.uni-karlsruhe.de> UJ1G@DKAUNI2.BITNET (Marek Tomczyk) writes:
  15. >>> What determines if it runs or returns to DOS?
  16. >>
  17. >>In order to automatically run a program you should specify a
  18. >>starting address. This starting address is stored into the
  19. >>memory locations $02E0-$02E1. An initiation address should be
  20. >>written into $02E2-$02E3 (it could be vice versa, I don't have my
  21. >>notes with me).
  22. >>
  23. >> ...
  24. >>
  25. >>> If you chain (by appending) files together, Which one gets control?
  26. >>
  27. >>Very simple, that one whose address is stored in the $02E0 vector.
  28. >>You could specify an init address somewhere in the middle of the
  29. >>chained file. Then DOS jumps to this routine. In order to continue
  30. >>loading you have to exit your init routine with an RTS instruction.
  31.  
  32. >You missed a very important subtlety in this system.  First, there
  33. >is a difference between the RUN address and the INIT address (and I,
  34. >too, cannot remember which is at $2E0-2E1 vs $2E2-2E3).  When DOS
  35. >loads the INIT address, it does a jsr to that address _immediately_
  36. >(without continuing the load).  When that code does and rts to DOS,
  37. >DOS picks up with the load where it left off.  This means that you can
  38. >have multiple INIT addresses strewn through your load file and they
  39. >are treated like subroutines to the load process (be sure the code
  40. >they run has already been loaded, though :-).  In the case of the RUN
  41. >address, only the last value stored here matters.  This is the one
  42. >that DOS jsr's to _after_ the load is complete.
  43.  
  44. >Now, can someone with a memory map handy verify which address is
  45. >which?  I'm not sure where my memory map is.
  46.  
  47. >Scott
  48.  
  49.  
  50.     Ok, $02E0 - $02E1 is the run address,
  51.         $02E2 - $02E3 is the init address.
  52.  
  53. I'm have an addition to: There is one problem, that occurs, when you
  54. use any SIO-handler (like P:) in an Init-Part:
  55.     All IOCB-Blocks are copied into the zero page, when an operation
  56.     is done on any channel.Normally, this doesn't matter, because
  57.     on every SIO/CIO call this is done. But when you do it in the init part
  58.     of a COM-File and then return to DOS ( with RTS ) , sometimes
  59.     something strange can happen. For instance, I've programmed
  60.     one time an Init-Part that sended a text to the printer ( p:),
  61.     and after the RTS, Dos continued to load, but the floppy didn't
  62.     READ from the file, but WROTE to it, because I've opened before
  63.     an IOCB to the Printer with open #x,8,0,"P:". The only solution
  64.     I saw, was to save the zero page IOCB before outputting to the
  65.     printer, and afterwards to restore it.
  66.     The same thing can happen, if you use handler-routines in the VBI
  67.     ( for instance a T:-handler to get the current time from an
  68.     real time clock).
  69.  
  70.  
  71. Peter
  72.  
  73. ---------------------------------------------------------
  74. E-Mail: straif@minnie.informatik.uni-stuttgart.de
  75.  
  76.  
  77.  
  78.