home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / genie-commodore-file-library / MRFiles / GS2DVPAK.ARC / GSDEVPAK4 (.txt) < prev    next >
Encoding:
GEOS ConVerT  |  2019-04-13  |  38.8 KB  |  644 lines

  1. gsdevpak4
  2. PRG formatted GEOS file V1.0
  3. CONVERTED WITH GEOSHELL V2.2
  4. Write Image V2.1
  5. geoWrite    V2.1
  6. TGrab128 Data2.2
  7. Please Select Option:
  8. new document
  9. existing document
  10. to deskTop
  11. File exists
  12. @IncCmdPointer
  13. Function:    Position the command pointer past your command's parameter.
  14. Pass:    accumulator - number of bytes in your parameter plus one for a trailing space which is supposed to separate your command with the next.
  15. Return:    a4 - incremented the number of desired bytes.
  16. Destroys:    a, y
  17. Description:    Since geoSHELL allows more than one command to be typed in on a single line and also since your command could contain a parameter that might not be any specific length, geoSHELL requires that your command manage the command pointer (a4) at some point in time before you exit your command. You must load the accumulator with the number of bytes that you need the pointer advanced and then call this routine. This number should be the number of characters that were in your parameter plus one for the space that the user should have typed in just before the next command. If your command does not use any parameter, then you do not need to call this routine, because geoSHELL's command pointer will already be pointing to the location just past your command's name in the command buffer.
  18. Example:
  19.     ...        ;the bulk of your command.
  20.     lda    #2    ;assuming your command only
  21.             ;used one parameter plus a
  22.             ;space after the parameter.
  23.     jsr    IncCmdPointer    ;point geoSHELL in the
  24.             ;proper spot.
  25.     jmp    ExitCommand    ;and exit your command.
  26. Example #2
  27.     ...        ;part of your command.
  28.     jsr    ParamName    ;point a2 to a filename
  29.             ;parameter,
  30.             ;and set NUM_IN_NAME to the
  31.             ;length of the filename.
  32.     bit    goodflag
  33.     bmi    10$
  34.     ...    ...    ;display an error here.
  35.     jmp    NoMoreCmds    ;and then stop any further
  36.             ;command processing.
  37.     ...        ;th
  38.     ...        ;the bulk of your command.
  39.     inc    NUM_IN_NAME    ;add one for a terminator
  40.             ;following the filename.
  41.     lda    NUM_IN_NAME    ;and get the value.
  42.     jsr    IncCmdPointer    ;point geoSHELL in the
  43.             ;proper spot.
  44.     jmp    ExitCommand    ;and exit your command.
  45. See Also:    ExitCommand
  46. @InitCurPartition
  47. Function:    Open the currently active partition after changing to a different one.
  48. @InitCurPartition
  49. Function:    Open the currently active partition after changing to a different one.
  50. Pass:    Certain internal variables must be set by calling GetRealDriveNum and SetPartParams beforehand.
  51. Return:    The partition the user is seeing will be reopened.
  52. Destroys:    a, x, y, r0-r15
  53. Description:    This routine requires that a certain amount of setup is performed to work properly. Normally you would want to call other routines such as ResetFromPath instead of this one.
  54.     In order to make this routine work properly, geoSHELL needs to figure out what the current partition is first as well as the correct device number. You do that by calling other geoSHELL routines to properly set up the internal routines.
  55. Example:
  56. ;this could be part of the code that you might use for a command
  57. ;that would switch among partitions.
  58.     jsr    SetPartStuff    ;set up the variables for
  59.             ;the current partition
  60.     bit    goodflag    ;does this device use
  61.             ;partitions?
  62.     bmi    10$    ;branch if so.
  63.     jmp    NotPartDevice    ;otherwise display an error.
  64.     ...        ;do whatever you had planned.
  65.     jsr    InitCurPartition    ;open the current partition.
  66.     ...        ;continue with more code
  67. SetPartStuff:
  68.     lda    PRESDRIVE
  69.     jsr    GetRealDriveNum    ;is this a DOS type device?
  70.     bit    goodflag
  71.     bpl    10$    ;branch if not.
  72.     jsr    InitForIO
  73.     lda    REALDRIVE    ;this was set by GetRealDriveNum
  74.     jsr    SetPartParams    ;set some internal variables.
  75.             ;this will set goodflag
  76.             ;if the device has partitions.
  77.     jsr    DoneWithIO
  78. See Also:    OpenPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
  79. @InitgeoSHELL
  80. Function:    Start geoS
  81. See Also:    OpenPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
  82. @InitgeoSHELL
  83. Function:    Start geoSHELL (Initial jump add
  84. @InitgeoSHELL
  85. Function:    Start geoSHELL (Initial jump address).
  86. Pass:    nothing
  87. Return:    not applicable
  88. Destroys:    not applicable
  89. Description:    This routine will 'start' geoSHELL. This routine is the main starting point of geoSHELL. When either GEOS or getshell loads geoSHELL into memory, this address is jumped to. It is not recommended to use this at any other time since the state of GEOS must be such as it is when an application is first started due to the way geoSHELL operates. There is actually no reason to ever jump to this routine. In some cases, if you were to try to restart geoSHELL with this routine, then some functions may not work quite right. NoMoreCmds may not work quite right afterwards. When it is necessary to reset the state of geoSHELL, use the routine NoMoreCmds instead of InitgeoSHELL. 
  90. Example:    no example since this routine is not recommended.
  91. See Also:    NoMoreCmds
  92. @LoadProblem
  93. Function:    Display an error message and return control to the user.
  94. Pass:    nothing
  95. Return:    not applicable
  96. Destroys:    not applicable
  97. Description:    If your command works in such a way that it attempts to load in a file and has some sort of problem with loading, you can use this routine to exit your command. This will display to the user, 'Problem Loading File!', and then it will jump to NoMoreCmds. Then the user can check to see why a problem occured, whether it be a bad disk or a missing or corrupted file or whatever and try your command again.
  98. Example:
  99.     jsr    ParamName    ;fetch the filename the
  100.     bit    goodflag    ;user typed in.
  101.     bmi    10$    ;branch if successful.
  102.     jmp    MissgFilename    ;display 'Bad Parameter'.
  103.     jsr    CkPresdrive    ;find the file on the
  104.     bit    goodflag    ;current drive.
  105.     bmi    20$    ;branch if found.
  106.     jmp    FileNotAvail    ;tell the user it's not there.
  107.     MoveW    a2,r0    ;point r0 to the now true
  108.             ;filename without wildcards.
  109.     jsr    OpenRecordFile    ;let GEOS open it.
  110.     txa        ;well?
  111.     beq    30$    ;branch if OK.
  112.     jsr    CloseRecordFile    ;make sure it's closed.
  113.     jmp    LoadProblem    ;and exit with an error.
  114.     ...        ;desired VLIR file is now
  115.     ...        ;open, so we can
  116.     ...        ;continue...
  117. See Also:    MissgFilename, NoMoreCmds, Message, OtherMessage, FileNotAvail, MissDisk, NotFound
  118. @Message
  119. Function:    Display an internal geoSHELL message.
  120. Pass:    x - number of desired message.
  121. @Message
  122. Function:    Display an internal geoSHELL message.
  123. Pass:    x - number of desired message.
  124.     a - formatting information.
  125. Return:    nothing
  126. Destroys:    no guarantees
  127. Description:    This routine will display one of geoSHELL's own internal messages. This allows you to make use of whatever is available without the need to include your own messages. Just load x with the number of the desired message, load the accumulator with the formatting information and call this routine. A complete list of available messages and a description of the formatting information is listed in the appendix.
  128. Example:
  129. ;this particular example is for a command that might only work
  130. ;from a startup or exec file. If coming from anything but, then
  131. ;message #72, 'This Is A Startup Command!', will be displayed.
  132. ;This example could be the first thing your command does.
  133.     bit    STUPMODE    ;are we in startup mode?
  134.     bmi    10$    ;branch if so.
  135.     ldx    #72    ;point at message 72.
  136.     lda    #(IN_TWO|TR_CR)    ;indent two and carriage rtn.
  137.     jsr    Message    ;do the message.
  138.     jsr    ClrTrnsName    ;remove the command.
  139.     jmp    NoMoreCmds    ;and return to the user.
  140.     ...        ;continue on...
  141. See Also:    MissgFilename, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, NotFound
  142. @MskCtrlCodes
  143. Function:    Remove control codes (any non-ASCII characters) from a text buffer.
  144. Pass:    r0 - start of buffer.
  145.     endoftext - one byte past end of b
  146. @MskCtrlCodes
  147. Function:    Remove control codes (any non-ASCII characters) from a text buffer.
  148. Pass:    r0 - start of buffer.
  149.     endoftext - one byte past end of buffer.
  150.     txttype - always set this to zero.
  151. Return:    the buffer is altered.
  152.     endoftext - points to the new end of text + 1. The buffer will decrease in size if any unwanted bytes have  been removed from it.
  153. Destroys:    a, y, r0, r2
  154. Description:    If your command has just loaded a buffer with text, you can call this routine to strip any characters from it that GEOS is unable to display on the screen. You will be left with only ASCII text plus any carriage returns, tabs, or shifted-spaces. You should always set txttype to zero, just in case the 'type' command has recently been used. The type command uses this variable for various purposes. One of the uses is to tell MskCtrlCodes if the buffer it is converting is a Text Scrap or a text album. In this case, MskCtrlCodes will strip the first escape ruler from the buffer. You could also use this routine for this purpose, however geoSHELL has other routines for doing this also. This feature is quite specific to the type command, so you would normally just clear the variable txttype before calling MskCtrlCodes.
  155.     ConvToAscii also calls this routine when it is converting from PetASCII to ASCII, so if your command uses ConvToAscii, calling MskCtrlCodes will not change anything in your buffer, since it will already have been done.
  156. Example:
  157.     jsr    ReadFile    ;use GEOS to read in a linked
  158.             ;chain of blocks.
  159.     txa        ;any problems?
  160.     beq    10$    ;branch if not.
  161.     jmp    LoadProblem    ;display an error and exit.
  162.     LoadW    r0,#textBuffer    ;point r0 to our new text.
  163.     MoveW    r7,endoftext    ;GEOS left r7 pointing to
  164.             ;the last byte plus one.
  165.     LoadB    txttype,#0    ;always do this.
  166.     jsr    MskCtrlCodes    ;strip unwanted characters.
  167.     ...        ;continue on...
  168. See Also:    AdjTxtPointer, Message, OtherMessage, D
  169.     jsr    MskCtrlCodes    ;strip unwanted characters.
  170.     ...        ;continue on...
  171. See Also:    AdjTxtPointer, Message, OtherMessage, DsplyLine, DsplyString, CarrReturn, ClearLine, ClearBoth, ClearRemainder, StripRulers, set_XY_pos, save_XY_pos, CkESC_RULERS, ConvToAscii, DispText
  172. @MissDisk
  173. Function:    Display the message 'Missing Disk?!'.
  174. Pass:    nothing
  175. Return:    nothing
  176.     goodflag - meaningless
  177. Destroys:    no guarante
  178. @MissDisk
  179. Function:    Display the message 'Missing Disk?!'.
  180. Pass:    nothing
  181. Return:    nothing
  182.     goodflag - meaningless
  183. Destroys:    no guarantees
  184. Description:    This routine displays a built-in message informing the user of a missing disk. It will return to your command so that you may act on it further if needed. 
  185. Example:
  186.     lda    #10    ;check for a disk in
  187.     jsr    CkForDisk    ;drive C.
  188.     bit    goodflag    ;is there one?
  189.     bmi    10$    ;branch if so.
  190.     jsr    MissDisk    ;display a message.
  191.     jmp    NoMoreCmds    ;and exit.
  192.     ...        ;otherwise,
  193.     ...        ;continue on...
  194. See Also:    MissgFilename, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, Message, NotFound
  195. @MissgFilename
  196. Function:    Display the message 'Bad Parameter!' without returning.
  197. Pass:    nothing
  198. Return:    not applicable
  199. Destroys:    not applicable
  200. Description:    This routine displays a built-in message informing the user of a bad parameter. It will not return to your command, since it then jumps through NoMoreCmds.
  201. Example:
  202.     jsr    ParamName    ;check if the user typed in
  203.     bit    goodflag    ;a filename.
  204.     bmi    10$    ;branch if so.
  205.     jmp    MissgFilename    ;tell him, bad parameter.
  206.     ...        ;otherwise,
  207.     ...        ;continue on...
  208. See Also:    Message, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, NotFound
  209. @nogood
  210. Function
  211. @nogood
  212. Function:    Usually identifies a failure in a routine.
  213. Pass:    nothing
  214. Return:    goodflag - bit 7 set to zero.
  215. Destroys:    nothing
  216. Description:    geoSHELL uses this routine extensively. nogood and yesgood are the universal routines for identifying successes and failures. This routine actually does nothing more than clear a flag (bit 7 of goodflag) to give an indication to a calling routine that a failure has occured. All the calling routine has to do is check goodflag with the bit instruction. It will be plus if nogood cleared it. As an example, the routine 'CkForDisk' will jump through nogood upon exit of the routine if it did not find a formatted disk in the drive.
  217.     It's true that the carry flag or some other form of error checking could have been used, but it's also possible that the x register or the carry flag could change before we are ready to check it. We have more control over how goodflag is affected, and can do some processing before checking it if needed.
  218. Example:
  219.     jsr    OpenDisk    ;call a GEOS routine.
  220.     txa        ;check the value returned in x.
  221.     beq    10$    ;branch if OpenDisk was OK.
  222.     jmp    nogood    ;signal the calling routine
  223.             ;that this routine failed.
  224.     ...        ;continue with more.
  225. See Also:    yesgood
  226. @NoKeypress
  227. Function:    Wait for the user to release the keyboard.
  228. Pass:    nothing
  229. Return:    goodflag - meaningless, although the routine will always return with goodfla
  230. @NoKeypress
  231. Function:    Wait for the user to release the keyboard.
  232. Pass:    nothing
  233. Return:    goodflag - meaningless, although the routine will always return with goodflag's bit 7 set.
  234.     the keyboard  - completely released.
  235. Destroys:    a, x, y
  236. Description:    This routine is only used when you want the user to release any keys that he may be pressing. When you desire user input of some sort, you might want to call this routine to first insure that no keys are being pressed and then proceed to look for a keypress with YesKeypress. Refer to the Wait routine, as it will call both of these routines for you.
  237.     One problem with using this routine however would be that GEOS will still return the character code of the key if the user was pressing one. If you merely want the user to let go of the keyboard, but do not need keyboard input, then this routine will do just fine. If you want to clear out the keypress that the user was holding, then call ClrKeyData instead. That routine will also wait for the user to release the keyboard.
  238. Example:
  239.     ...        ;some of your command's code.
  240.     jsr    NoKeypress    ;wait for no keys being
  241.             ;pressed.
  242.     ...        ;continue with further
  243.     ...        ;parts of your command.
  244. See Also:    YesKeypress, ClrKeyData, Wait, CkKeyboard
  245. @NoMoreCmds
  246. Function:    Exit from just about anything and return complete control back to geoSHELL.
  247. Pass:    nothing
  248. @NoMoreCmds
  249. Function:    Exit from just about anything and return complete control back to geoSHELL.
  250. Pass:    nothing
  251. Return:    not applicable
  252. Destroys:    not applicable
  253. Description:    On just about any kind of error that a user might create, or if you just want to get out of a situation, or if you want to end your command and not allow any further commands to be processed, call this routine. Certain situations occur when a command is running, and it is up to the programmer of the command to check for any possible situation that might arise, and when necessary call this routine to end a line of commands. As an example, 'fcopy' will call this routine when it is unable to find the desired file that the user typed. First it displays the necessary message and then jumps to NoMoreCmds so that no problems will arise with any other commands that might follow.
  254. Example:
  255.     ...        ;parts of your command.
  256.     jsr    DoWhatever    ;jsr to another routine.
  257.     bit    goodflag    ;check for an error on return.
  258.     bmi    10$    ;branch if routine was ok.
  259.     jsr    DisplayError    ;you might want to have a
  260.             ;routine to display an error.
  261.     jmp    NoMoreCmds    ;stop any further commands.
  262.     ...        ;continue with your command.
  263. See Also:    ExitCommand, IncCmdPointer
  264. @NotFound
  265. Function:    Display a 'FILENAME Not Found!' message.
  266. Pass:    a2 - pointer to null-terminated filename.
  267. Return:    nothing
  268. Destroys:    no guarantees
  269. Descri
  270. @NotFound
  271. Function:    Display a 'FILENAME Not Found!' message.
  272. Pass:    a2 - pointer to null-terminated filename.
  273. Return:    nothing
  274. Destroys:    no guarantees
  275. Description:    In a case where your command fails to find a desired filename that perhaps the user is requesting, you can call this routine to display a message that the filename in question is not available. Whatever the filename is that the user typed in will be displayed followed by 'Not Available!'. The routine will return to your command where you can decide how to continue processing. Just be sure that a2 is pointing at the null-terminated filename that you wish to include in the message.
  276. Example:
  277.     jsr    ParamName    ;get the filename.
  278.     bit    goodflag    ;is it valid?
  279.     bmi    10$    ;branch if so.
  280.     jmp    MissgFilename    ;display an error.
  281.     jsr    CkAllDrives    ;look for it.
  282.     bit    goodflag    ;did we find it?
  283.     bmi    20$    ;branch if so.
  284.     jsr    NotFound    ;display 'not found'.
  285.     jmp    NoMoreCmds    ;and in this case we
  286.             ;will just exit.
  287.     ...        ;continue on...
  288. See Also:    Message, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, MissgFilename
  289. @Only128
  290. Function:    Inform the user w
  291. @Only128
  292. Function:    Inform the user when a 128 command is being used on a 64 and exit.
  293. Pass:    nothing
  294. Return:    not applicable
  295. Destroys:    not applicable
  296. Description:    This routine will display the message '128 Only' and end by jumping to the routine NoMoreCmds, thereby bringing all commands to a halt. This is a nice way to get out of a command when it will only work on a 128, but an attempt is being made to use it on a 64. Simply test the variable 'screenmode' to determine the machine that is being used.
  297. Example:
  298.     bit    screenmode    ;check the mode.
  299.     bvc    10$    ;branch if a 128.
  300.     jsr    ClrTrnsName    ;clear the command.
  301.     jmp    Only128    ;do an error and exit.
  302.     ...        ;this is a 128, so
  303.     ...        ;continue on...
  304. See Also:    CkModeFlag
  305. @OpenCurPartition
  306. Function:    Open the currently active partition after changing to a different one.
  307. Pass:    Certain internal variables must be set by calli
  308. @OpenCurPartition
  309. Function:    Open the currently active partition after changing to a different one.
  310. Pass:    Certain internal variables must be set by calling GetRealDriveNum and SetPartParams beforehand.
  311.     InitForIO must be called first.
  312.     PurgeAllTurbos must be called first.
  313. Return:    The partition the user is seeing will be reopened.
  314. Destroys:    a, x, y, r0-r15
  315. Description:    This routine is a lower level geoSHELL routine that requires a certain amount of setup to work properly. Normally you would want to call other routines such as ResetFromPath instead of this one. But in the case of a filecopier, for instance, you may wish to bypass the routines that take you back into GEOS while moving data around using the drive's own DOS. In that case, this routine will reopen the current partition, while your command can maintain it's own variables for another partition that you are working with.
  316.     In order to make this routine work properly, geoSHELL needs to figure out what the current partition is first as well as the correct device number. You do that by calling other geoSHELL routines, GetRealDriveNum and SetPartParams, to properly set up the internal variables.
  317. Example:
  318. ;this could be part of the code that you might use for a command
  319. ;that would switch among partitions.
  320.     jsr    SetPartStuff    ;set up the variables for
  321.             ;the current partition
  322.     bit    goodflag    ;does this device use
  323.             ;partitions?
  324.     bmi    10$    ;branch if so.
  325.     jmp    NotPartDevice    ;otherwise display an error.
  326.     jsr    PurgeAllTurbos    ;SetPartParams also does this.
  327.     jsr    InitForIO
  328.     ...        ;do whatever you had planned.
  329.     jsr    OpenCurPartition    ;open the current partition.
  330.     jsr    DoneWithIO
  331.     ...        ;continue with more code...    ...
  332. SetPartStuff:
  333.     lda    PRESDRIVE
  334.     jsr    GetRealDriveNum    ;is this a DOS type device?
  335.     bit    goodflag
  336.     bpl    10$    ;branch if not.
  337.     jsr    InitForIO
  338.     lda    REALDRIVE    ;this was set by GetRealDriveNum
  339.     jsr    SetPartParams    ;set some internal variables.
  340.             ;this will set goodflag
  341.             ;if the device has partitions.
  342.     jsr    DoneWithIO
  343. See Also:    InitCurPartition, ResetFromPath, GetRealDriveNum, SetPartParams, OpenPartition, GetCMDType, FindCMDType, FindRamLink, PurgeAllTurbos, OpenPathPartition, SetPartParams
  344. @OpenGS
  345. Function:    Locate and open geoSHELL to gain access to it's VLIR records.
  346. Pass:    nothing
  347. Return:    goodflag - set if successful.
  348.     geoSHELL is now an open VLIR file, and 
  349. @OpenGS
  350. Function:    Locate and open geoSHELL to gain access to it's VLIR records.
  351. Pass:    nothing
  352. Return:    goodflag - set if successful.
  353.     geoSHELL is now an open VLIR file, and so everything     pertaining to a call to OpenRecordFile pertains     here.
  354.     pathload - set if geoSHELL was found on the path partition.
  355.     DRVFOUNDON - device number (8-11) of the drive that geoSHELL was found on.
  356.     curDevice and curDrive - the currently open drive.
  357.     PRESDRIVE - unchanged.
  358.     Also anything that OpenRecordFile returns is returned with this routine, such as the Index Table in fileHeader, and dirEntryBuf.
  359. Destroys:    a, x, y, r0-r15, a2
  360. Description:    This routine will search for geoSHELL on all available drives as well as a 'path' partition if one is set and jump through yesgood if it is found. If found, a call to OpenRecordFile is made and geoSHELL is left as an open VLIR file. If it was found on the path partition, then 'pathload' is also set. In this case, after closing geoSHELL with a call to CloseRecordFile, a call should also be made to ResetFromPath. Having geoSHELL open like this allows access to make modifications such as what the 'custom' command does. The search for geoSHELL is performed through CkPathOrder.
  361. Example:
  362.     jsr    OpenGS    ;open the geoSHELL file.
  363.     bit    goodflag    ;was it successful?
  364.     bmi    10$    ;branch if so.
  365.     jsr    NotFound    ;display that geoSHELL was
  366.     jmp    NoMoreCmds    ;not found and exit.
  367.     ...        ;now we can do what we
  368.     ...        ;want with the geoSHELL
  369.     ...        ;file that is the one
  370.     ...        ;that is currently in control.
  371. See Also:    OpenGSIndex
  372. penCurPartition    ;open the current partition.
  373.     jsr    DoneWithIO
  374.     ...        ;continue with more
  375. See Also:    OpenGSIndex
  376. penCurPartition    ;open the current partition.
  377.     jsr    DoneWithIO
  378.     ...        ;continue with more code...    ...
  379.     DoWhatever    ;jsr to another routine.
  380.     bit    gge informing the user
  381. @OpenGSIndex
  382. Function:    Load geoSHELL's VLIR index block into fileHeader.
  383. Pass:    nothing
  384. Return:    goodflag - set if routine was successful.
  385.     pathload - set if geoSHELL was found on the path partition.
  386.     DRVFOUNDON - device number (8-11) of the drive that geoSHELL was found on.
  387.     fileHeader - contains geoSHELL's index table if successful (goodflag set)
  388.     dirEntryBuf - geoSHELL's directory entry.
  389.     curDevice and curDrive - the currently open drive.
  390.     PRESDRIVE - unchanged.
  391. Destroys:    a, x, y, r0-r15, a2
  392. Description:    This routine will find geoSHELL and load it's index sector into memory at fileHeader. If bit 7 of pathload is set, then geoSHELL was found on the path partition. The path partition is still open if so, and a call to ResetFromPath should be made before your command exits, or the user will have to do it himself (not desireable). The geoSHELL file is not left as an open VLIR file with this routine, only the index table is loaded into memory.
  393. Example:
  394. GetGSIndex:
  395.     jsr    OpenGSIndex    ;get geoSHELL index sector.
  396.     bit    goodflag    ;was it successful?
  397.     bmi    10$    ;branch if so.
  398.     rts        ;goodflag is still cleared.
  399.             ;geoSHELL's index sector is
  400.             ;now in memory at fileHeader.
  401.             ;We will now restore the drive.
  402.             ;This could also be done by
  403.             ;the calling routine if it
  404.             ;needs to keep geoSHELL
  405.             ;available while performing
  406.             ;it's operation on it.
  407.     jsr    ResetFromPath    ;reset the drive to it's previous
  408.             ;partition in case geoSHELL
  409.             ;was found on the path
  410.             ;partition.
  411.     jmp    yesgood    ;tell the calling routine
  412.             ;that geoSHELL's index is
  413.             ;in memory.
  414. See also:    OpenGS
  415. @OpenPartition
  416. Functi
  417.             ;that geoSHELL's index is
  418.             ;in memory.
  419. See also:    OpenGS
  420. @OpenPartition
  421. Function:    Open a partition on a CMD device.
  422. Pass:    r0 - pointing to a string with
  423. @OpenPartition
  424. Function:    Open a partition on a CMD device.
  425. Pass:    r0 - pointing to a string with 'CP' and the ascii characters representing the desired partition to open.
  426.     a - the real device number of the desired CMD device.
  427.     cmdlength - the length (3-5) of the string that r0 is pointing at.
  428.     PurgeAllTurbos, InitForIO, and SetPartParams must be called just before calling this routine.
  429. Return:    goodflag - set if the desired partition was opened.
  430. Destroys:    no guarantees
  431. Description:    This routine is the one you would call when you wish to open a partition on a CMD device. It does not have to be the currently active drive either. Any connected CMD device may be controlled with this routine. Be sure to call PurgeAllTurbos and then InitForIO first. Also, you will need to call SetPartParams before calling OpenPartition. This is so that the type of partition that is currently open on the desired drive can be compared to the one that you are attempting to open. As long as they are of the same type, then the routine may open it. This is to prevent any problems with the disk driver that is being used.
  432.     All the low-level handling of the device is taken care of for you with this routine. This makes it a very easy task to open any partition. The only hitch with doing this is that you should only use this on one device at a time. Because geoSHELL maintains some internal variables for you that will be used when you do a subsequent call to OpenCurPartition or InitCurPartition. Those routines will restore the partition that was currently open before calling OpenPartition. That is another reason for calling SetPartParams first. In the case of the 'fcopy' command, if the user copies to a destination by specifying a particular partition instead of a drive, the source drive is always the current partition. If the destination is on the same drive, then fcopy has no problem. If the destination is a different drive, then then OpenCurPartition will consider the current partition to be the one that is currently open on the destination drive. A call to OpenCurPartition or InitCurPartition would then reopen the original partition on the destination drive. This may sound complicated but in reality it is not. As long as the current partition is restored, another call can be made to open a partition on another device or the same one. 
  433. Just remember to work with one partition at a time or you can work with a currently open partition and one that is not curr
  434. Just remember to work with one partition at a time or you can work with a currently open partition and one that is not currently open when you need to work with two partitions at the same time.
  435. Example:
  436. ;this example might look fairly lengthy, but the bulk of it is
  437. ;taking the parameter that the user typed in and building a
  438. ;string that we will pass on to OpenPartition. This example
  439. ;performs some sort of whatever to a desired partition that
  440. ;the user chooses. When finished, it will reopen the original
  441. ;partition.
  442. ;The command that the user types in might look like this:
  443. ;commandname 45
  444. ;This example command does not expect a fixed length parameter
  445. ;and so a space can terminate the 45 in this case. The 45 
  446. ;represents partition number 45, the one the user wants this
  447. ;command to act on. A partition number such as 45 could be
  448. ;anything from 1 to 255 or the maximum allowed by the device.
  449.     lda    PRESDRIVE    ;this acts on the current
  450.             ;drive as the user sees it.
  451.     jsr    GetRealDriveNum    ;just in case it's an RL or RD.
  452.             ;This also calls PurgeAllTurbos.
  453.     LoadB    paramsize,#2    ;let's keep track of the size
  454.             ;of our parameter. (it's at
  455.             ;least one plus a space)
  456.     ldx    #2    ;first fill string with spaces.
  457.     lda    #' '
  458.     sta    partNumber,x
  459.     bpl    10$
  460.     lda    ParamTable    ;we need at least one character.
  461.     jsr    CkTerminators    ;is this a valid character?
  462.     bne    20$    ;branch if so.
  463.     jmp    MissgFilename    ;this will display
  464.             ;'Bad Parameter' and exit.
  465.     sta    partNumber+0    ;save this first character.
  466.     lda    ParamTable+1    ;get the next character.
  467.     jsr    CkTerminators    ;is it a character?.
  468.     beq    40$    ;branch if not.
  469.     inc    paramsize    ;the parameter is at least
  470.             ;two characters now.
  471.     sta    partNumber+1
  472.     lda    ParamTable+2
  473.     jsr    CkTerminators
  474.     beq    40$
  475.     inc    paramsize    ;the parameter is at least
  476.             ;three characters now.
  477.     sta    partNumber+2
  478.     lda    ParamTable+3    ;there must be a space or
  479.             ;terminating character after
  480.             ;the last character in the
  481.             ;paramet
  482.             ;the last character in the
  483.             ;parameter.
  484.     jsr    CkTerminators    ;well?
  485.     bne    15$    ;branch if not.
  486.     jsr    InitForIO    ;pop out of GEOS.
  487.     lda    REALDRIVE    ;get the device number.
  488.     jsr    SetPartParams    ;set some internal variables
  489.             ;and check if this device has
  490.             ;partitions.
  491.     bit    goodflag    ;well?
  492.     bpl    50$    ;branch if not.
  493.     LoadW    r0,#partString    ;point r0 to the string we
  494.             ;just built up.
  495.     LoadB    cmdlength,#5    ;any spaces in the string are
  496.             ;ignored by CMD's DOS.
  497.     jsr    OpenPartition    ;open the partition.
  498.     jsr    DoneWithIO    ;pop back into GEOS.
  499.     bit    goodflag    ;did the partition get opened?
  500.     bmi    60$    ;branch if so.
  501.     LoadW    r0,#cantOpen    ;otherwise, let's tell the
  502.     lda    #(IN_TWO|TR_CR)    ;user we couldn't get to the
  503.     jsr    OtherMessage    ;partition.
  504.     jmp    NoMoreCmds    ;and return control to him.
  505.     ...        ;here we can do what the
  506.     ...        ;command is designed to do
  507.     ...        ;with the partition that we
  508.     ...        ;just opened.
  509.     jsr    InitCurPartition    ;restore the original
  510.             ;partition.
  511.     lda    paramsize    ;we were keeping track of this.
  512.     jsr    IncCmdPointer    ;point past our command and
  513.             ;parameter.
  514.     jmp    ExitCommand    ;and do a clean exit.
  515. partString:
  516.     .byte    "CP"
  517. partNumber:
  518.     .byte    "1  "    ;this gets changed.
  519. cantOpen:
  520.     .byte    "Unable To Open Partition!",0
  521. See Also:    InitCurPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
  522. @OpenPathPartition
  523. Function:    Open the path partition.
  524. Pass:    nothing
  525. Return:    goodflag - set if s
  526. @OpenPathPartition
  527. Function:    Open the path partition.
  528. Pass:    nothing
  529. Return:    goodflag - set if successful.
  530.     pathcheck - set to the device number of the drive containing the path partition.
  531.     REALDRIVE - contains the real device number of the drive containing the path partition.
  532. Destroys:    a, x, y, r0-r15
  533. Description:    This routine will open the partition of the device that has been defined by the path command to be the path partition. Upon return, if goodflag is set, the routine was successful and the device containing the path partition is now open along with the correct partition. Since this device is now open, curDrive will contain the device number as well as pathcheck. In the case of a RamLink or RamDrive being used as a RAM_1581, REALDRIVE will contain the real device number of the device for DOS purposes. In these cases, GEOS might see the device as 8-11, but the DOS in the RL or RD is seing it as 12 or higher.
  534.     When finished with the path partition, be sure to call ResetFromPath to restore the device to the partition that the user is currently seeing.
  535.     If no path has been established, or if the path partition has been defined, but cannot be opened for whatever reason, the routine will exit through nogood.
  536. Example:
  537.     jsr    OpenPathPartition
  538.     bit    goodflag
  539.     bmi    10$
  540.     ...        ;do what you need to do.
  541.     jsr    ResetFromPath
  542.     jmp    yesgood
  543. See Also:    InitCurPartition, OpenCurPartition, ResetFromPath, OpenPartition
  544. @OpenWrFile
  545. Function:    Load a file's VLIR index into memory.
  546. Pass:    r0 - pointer to a null terminated filename.
  547. Return:    goodflag set if successful.
  548.     fileHeader contains the file's index sector
  549. @OpenWrFile
  550. Function:    Load a file's VLIR index into memory.
  551. Pass:    r0 - pointer to a null terminated filename.
  552. Return:    goodflag set if successful.
  553.     fileHeader contains the file's index sector.
  554. Destroys:    a, y ,r1, r4-r6
  555. Description:    In cases where you need a VLIR file's index in memory, simply point r0 to the filename and call this routine. The index will be loaded in fileHeader. If the filename was typed in by the user, call ParamName to point r6 and a2 to the filename and then copy a2 or r6 to r0. You can then call this routine. This routine does not leave any VLIR files open, and only checks the currently active drive.
  556. Example:
  557. ;here is how you would search all drives for a file and then
  558. ;load it's VLIR index into memory.
  559. GetIndex:
  560.     jsr    ParamName    ;what filename did
  561.             ;the user type in.
  562.     bit    goodflag
  563.     bmi    10$    ;branch if the user entered
  564.             ;a filename.
  565.     rts        ;otherwise, exit with
  566.             ;goodflag reset to zero.
  567.             ;a2 now points to the filename
  568.             ;that the user requests.
  569.     jsr    CkAllDrives    ;find the file.
  570.     bit    goodflag
  571.     bpl    5$
  572.             ;a2 now points to the
  573.             ;real filename even if the
  574.             ;user used wildcards.
  575.     MoveW    a2,r0
  576.     jmp    OpenWrFile    ;this ends the routine.
  577.             ;goodflag will represent the
  578.             ;success or failure of loading
  579.             ;in the file's VLIR index.
  580.             ;if goodflag has bit 7 set,
  581.             ;then the index is loaded.
  582.             ;if not, then maybe the file
  583.             ;was not a VLIR type file.
  584. See Also:    OpenGS, OpenGSIndex, GetHeader
  585. r RD is seing it as 12 or higher.
  586.     When finished with the path partition, be sur user
  587. UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
  588. @Open_GC_Channel
  589. Function:    Check the user port via a geoCable for the presence of a printer.
  590. Pass:    nothing
  591.     InitForIO must be called before accessing this routine.
  592. Return:    x - zero means the printer is ready for input. (this is one of the few routines that doesn't affect goodflag)
  593. Destroys:    a, x, y
  594. Description:    This routine works with a parallel printer via a geoCable connected to the user port. It will check to make sure the printer is there. It is not necessary to call this routine if you already know that a printer is ready for input. However, if your command is uncertain that the printer is connected and running, call this routine. If x is zero upon return, the printer is connected and ready. Otherwise the printer might be there but not responding, such as if it is still printing from it's buffer or if it has been switched offline by the user. If you don't access this routine before sending any bytes, your command will just hang and the computer will appear locked up until the user  realizes that the printer is not available and turns the printer on. In most cases, the user doesn't think about this, he will think your command has caused a crash.
  595. Example:
  596.     jsr    InitForIO    ;pop out of GEOS.
  597.     jsr    Open_GC_Channel    ;check for a printer.
  598.     txa        ;check if x = 0.
  599.     beq    10$    ;branch if so.
  600.     jsr    DoneWithIO    ;pop back into GEOS.
  601.     jmp    nogood    ;signal calling routine of error.
  602.     ...        ;continue on...
  603. See Also:    Send_GC_Byte
  604. @OtherMessage
  605. Function:    Display a message.
  606. Pass:    r0 - pointer to text string to display.
  607.     a - formatting information.
  608. Return:    nothing
  609. Destroys:    no guarantees
  610. Description:    This routine will d
  611. @OtherMessage
  612. Function:    Display a message.
  613. Pass:    r0 - pointer to text string to display.
  614.     a - formatting information.
  615. Return:    nothing
  616. Destroys:    no guarantees
  617. Description:    This routine will display whatever message you wish to display in the geoSHELL window. You are limited to the length of the current screenwidth that is being used, 40 or 80 columns. Just point r0 to the null terminated text that you wish to display and load the accumulator with the formatting information and call this routine.
  618. Example:
  619. ;this particular example is supposed to be some sort of
  620. ;command that acts on a GEOS file. If the file exists and
  621. ;it is not a GEOS file, then OtherMessage will be used
  622. ;to inform the user that this file is not a GEOS file.
  623.     jsr    FindParName    ;this won't return if error.
  624.     lda    dirEntryBuf+0    ;first check the filetype.
  625.     and    #%00001111
  626.     cmp    #REL    ;is it a REL file?
  627.     beq    20$    ;branch if so.
  628.     lda    dirEntryBuf+22    ;is this a GEOS file?
  629.     bne    30$    ;branch if so.
  630.     MoveW    a2,r0    ;tell the user that
  631.     lda    #(IN_ONE|TR_ONE)    ;this
  632.     jsr    OtherMessage    ;file...
  633.     LoadW    r0,#notText    ;is not
  634.     lda    #TR_CR    ;a 
  635.     jsr    OtherMessage    ;GEOS file.
  636.     jmp    NoMoreCmds    ;and exit.
  637.     ...        ;this is a GEOS file, so
  638.     ...        ;we can continue on...
  639. notText:
  640.     .byte    "Is Not A GEOS File!",0
  641. See Also:    Message, NoMoreCmds, LoadProblem, NotFound, FileNotAvail, MissDisk, MissgFilename
  642. The geoSHELL Programme
  643. The geoSHELL Programmer's Development Package    2-PAGE
  644.