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

  1. #gsdevpak3
  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. @ClearScreen
  13. Function:    Clear the entire screen.
  14. Pass:    nothing
  15. Return:    nothing
  16. Destroys:    no guarantees
  17. Description:    This routine will clear the screen with the default background pattern as established by the command 'backpatt'. By using this routine, geoSHELL will take care of whatever screenmode is being used. This also takes care of the proper screen coloring if the user is in 80 column color mode. By adjusting the above mentioned variables (back40pattern, etc) you can change the pattern that is used.
  18. Example:
  19.     jsr    ClearScreen
  20. See Also:    ResetScreen, ClearRemainder, ClearWindow, EraseWindow, ReDoWindow, DispLetter, DriveLetter, DsplyLine, DsplyString, CarrReturn, set_XY_pos, save_XY_pos, ClearBoth, ClearLine, ReDisplayWindow, DispText, unsetPrompt
  21. @ClearWindow
  22. Function:    Clear the geoSHELL window.
  23. Pass:    nothing
  24. Return:    nothing
  25. Destroys:    no guarantees
  26. Descrip
  27. @ClearWindow
  28. Function:    Clear the geoSHELL window.
  29. Pass:    nothing
  30. Return:    nothing
  31. Destroys:    no guarantees
  32. Description:    Calling this routine will clear any text that is displayed in the geoeSHELL window. The buffer that is holding the text internally is also cleared and the cursor position is reset to be at the top left of the window. This is what takes place when the user hits SHIFT CLR/HOME.
  33. Example:
  34.     jsr    ClearWindow
  35. See Also:    ResetScreen, ClearScreen, ClearRemainder, EraseWindow, ReDoWindow, DispLetter, DriveLetter, DsplyLine, DsplyString, CarrReturn, set_XY_pos, save_XY_pos, ClearBoth, ClearLine, ReDisplayWindow, DispText, unsetPrompt
  36. @ClrKeyData
  37. Function:    Eliminate any detected keypresses.
  38. Pass:    nothing
  39. Return:    keyData gets reset to zero.
  40.     goodflag is always set by this routine.
  41. Destroys:    a, x, y
  42. Description:    Call this routine to clear out any keypresses that GEOS has detected. This might be needed when the user has pressed a key before your routine actually gets handled. After executing this routine, you can then get a valid keypress. This routine will also wait for the user to let go of the keyboard.
  43. Example:
  44.     ...        ;the bulk of your command.
  45.     jsr    ClrKeyData    ;clear any existing keypresses
  46.             ;and wait for the user to let
  47.             ;go of the keyboard
  48.     ...        ;no chance for the next
  49.     ...        ;routine to get a wrong
  50.     ...        ;keypress.
  51. See Also:    NoKeypress, YesKeypress, Wait
  52. @ClrTrnsName
  53. Function:    Clear a transient command's name from memory.
  54. Pass:    nothing
  55. Return:    curTransName - set to null.
  56. @ClrTrnsName
  57. Function:    Clear a transient command's name from memory.
  58. Pass:    nothing
  59. Return:    curTransName - set to null.
  60. Destroys:    a, x
  61. Description:    When a transient command is loaded into memory and executed, it will remain in memory until either another command is loaded or if a resident command needs to use the area reserved for transient commands. In the latter case, the resident command will call ClrTrnsName to inform geoSHELL that no transient command is in memory. Then if the user enters that particular command again, geoSHELL will be forced to reload it from disk.
  62.     In most cases, a transient command will not need to call this routine, because it is advantageous to just let your command remain in memory should the user need to use it several times in a row. However, if your command is loaded from a VLIR file or does anything that would change itself to a state that can not be restarted properly, then call ClrTrnsName at any time before exiting your command. This way, your command will be loaded in fresh each time it is used.
  63. Example:
  64.     ...        ;some of the code in your
  65.     ...        ;command might trash the
  66.     ...        ;basic state of your command.
  67.     jsr    ClrTrnsName    ;remove your command's name
  68.             ;from memory.
  69.     jmp    ExitCommand    ;and finish.
  70. @ColorScreen
  71. Function:    Color an area of the 80 column screen.
  72. Pass:    r0 - table of compressed locations.
  73.     r1 - table of various color combinations to use.
  74. Retur
  75. @ColorScreen
  76. Function:    Color an area of the 80 column screen.
  77. Pass:    r0 - table of compressed locations.
  78.     r1 - table of various color combinations to use.
  79. Return:    goodflag - always zero (not an error).
  80. Destroys:    a, x, y, r0, r1
  81. Description:    This routine will put colors on the 80 column screen of the 128. Your routine must test the current screenmode and videomode to be sure that a 64 is not being used or that a 128 is not in monochrome mode before calling this routine. ColorScreen does not check it for you.
  82.     Point r0 to a table of compressed bytes and r1 to a table of color combinations. This color table may contain as many as 256 different combinations of foreground and background colors. Each character area can contain it's own foreground and background color. You might say that the table that this routine uses could be called a 'Color Scrap' since it can color a portion of the screen.
  83.     It is not a good idea to put colors below the 176th scanline. geoSHELL does not normally use this lower area of the screen. This is so that 128s with only 16K of video memory may also use the color mode.
  84.     In the appendix, you will find an explanation of how to create the table of compressed bytes and the color tables for this routine.
  85. Example:    Refer to the appendix for a full explanation and example for using this routine. You will also find the complete source code for the command 'color80' included with this package. Naturally, this routine is used in that command, since it was originally developed specifically for color80.
  86. See Also:    FixColors
  87. @ConvertK
  88. Function:    Convert a 16-bit number to an ascii string representing kilobytes.
  89. @ConvertK
  90. Function:    Convert a 16-bit number to an ascii string representing kilobytes.
  91. Pass:    r4 - 16 bit number to convert.
  92. Return:    Asc_String - a five-character ascii decimal string with leading zeros converted to spaces and null-terminated.
  93. Destroys:    a, x, y, r4, r5, r8, r9
  94. Description:    This routine is used by the 'dir' command when it displays the 'K Bytes Free' message after displaying a directory. The routine will take the value in r4 and convert it to a decimal string after dividing it by 4 and rounding it down to the nearest whole number (4 blocks equals 1 Kbyte). If the value originally passed in r4 is less than four, then the decimal string will be rounded up to 1. In the case of the 'dir' command, it loads r4 with the number of blocks free on a disk and calls this routine to create the number of kilobytes free. The resulting null-terminated decimal string can be found at Asc_String.
  95. Example:
  96. ;this example will display the kbytes free on the current drive.
  97. ShowFree:
  98.     LoadW    r5,#curDirHead    ;get the number of blocks
  99.     jsr    CalcBlksFree    ;free on the current drive.
  100.     jsr    ConvertK    ;convert it to the nearest K.
  101.     LoadW    r0,#Asc_String    ;point r0 to the string.
  102.     lda    #(IN_TWO|TR_ONE)    ;indent two + trailing space.
  103.     jsr    OtherMessage    ;put the string on the screen.
  104.     LoadW    r0,#kbyteText    ;along with 'KBytes Free'.
  105.     lda    #TR_CR    ;and a carriage return.
  106.     jmp    OtherMessage    ;do it.
  107. kbyteText:
  108.     .byte    "KBytes Free",0
  109. See Also:    Asc_3_Byte, Asc_Byte, Asc_BCD, ByteNZ_Ascii, ByteWZ_Ascii
  110. @ConvToAscii
  111. Function:    Convert PetASCII text to ASCII text.
  112. Pass:    r0 - start of text to convert.
  113.     endoftext - pointer to one byte past the last byte of 
  114. @ConvToAscii
  115. Function:    Convert PetASCII text to ASCII text.
  116. Pass:    r0 - start of text to convert.
  117.     endoftext - pointer to one byte past the last byte of text.
  118. Return:    r0 - (unchanged) points to converted text.
  119.     endoftext - adjusted to point to a null byte at the new end of text plus one.
  120.     r2 - pointing at same location as endoftext.
  121. Destroys:    a, x, y, r2
  122. Description:    This routine will take any length of PetASCII text and convert it to ASCII text. Just point r0 to the start of the buffer holding the text and point endoftext at the byte following the end of the text. Call this routine and that text will be converted to ASCII. Unrecognized bytes are removed from the buffer. Upon return, r0 will still be pointing at the same starting point, but endoftext might point to a different spot making the buffer smaller in size. The buffer will never grow, since characters will never be added, only removed. The bytes that may get removed are usually control codes such as might be created by various wordprocessors. The text after conversion will also have any null bytes removed and a null terminator will be added at the end.
  123. Example:
  124.     LoadW    r0,#textBuffer
  125.     LoadW    endoftext,#(bufEnd+1)
  126.     jsr    ConvToAscii
  127. See Also:    AdjTxtPointer, Message, OtherMessage, DsplyLine, DsplyString, DispText, ClearLine, ClearBoth, ClearRemainder, StripRulers, set_XY_pos, save_XY_pos, MskCtrlCodes, CarrReturn, CkESC_RULER
  128. tring.
  129. @DateDisplay
  130. Function:    Display the current date.
  131. Pass:    nothing
  132. Return:    nothing
  133. Destroys:    no guarantees
  134. Description:    This routine merely displays the current date to the geoSHELL window just as if the user had typed it in without any parameters.
  135. Example:
  136.     jsr    DateDisplay    ;display the date.
  137. See Also:
  138. Function:    Display the directory of the current drive.
  139. Function:    Display the directory of the current drive.
  140. Pass:    ParamTable - parameters just as the user might enter.
  141.     kboardoff - (optional) set bit 7 to ignore the keyboard. Set bit 6 to ignore just the STOP key.
  142. Return:    nothing
  143. Destroys:    no guarantees
  144. Description:    This will display a directory of the currently active drive just as if the user typed in the 'dir' command. The format command accesses this routine after it finishes formatting a disk so that the user can see that the disk formatting is complete. You would want to load ParamTable with any parameters you wish Dir to work with just as if the user typed them in at the keyboard. If you place an ascii '6' at ParamTable+0 and a null byte at ParamTable+1 and call this routine, a directory of all the applications on the current drive will be displayed. If ParamTable+0 contains a null byte, then all of the files on the disk will be displayed just as if the user typed 'dir' without a parameter. If the user presses the STOP key while the directory is scrolling, your command will terminate and control will return to the user. You can turn off the keyboard by setting bit 7 of kboardoff. However, this will not allow the user to pause the display. So, instead, you can set bit 6 to just ignore the STOP key. This way, Dir will always return to your command. Just remember to reset kboardoff to zero when finished.
  145. Example:
  146. ;this example will display all files ending with '.src'.
  147. ShowFiles:
  148.     ldx    #6
  149.     lda    fileText,x
  150.     sta    ParamTable,x
  151.     bpl    10$
  152.     jmp    Dir
  153. fileText:
  154.     .byte    "*.src",0
  155. See Also:    CkForDisk, MissDisk, Status
  156. @DispLetter
  157. Function
  158. @DispLetter
  159. Function:    Display the drive letter of the currently active drive.
  160. Pass:    nothing
  161. Return:    nothing
  162. Destroys:    a, x, y, r0-r15
  163. Description:    This is primarily an internal geoSHELL routine. It will simply display the letter (A,B,C or D) of the currently active drive at the left of the current line the cursor is on. The cursor will now be in the third character position on the current line.
  164. Example:
  165. See Also:    DriveLetter
  166. @DispText
  167. Function:    
  168. Display ascii text to the geoSHELL window up to a maximum of the width of the window.
  169. Pass:    r0 - point to the start of ascii text.
  170.     endecho - ze
  171. @DispText
  172. Function:    
  173. Display ascii text to the geoSHELL window up to a maximum of the width of the window.
  174. Pass:    r0 - point to the start of ascii text.
  175.     endecho - zero if only one line of text is needed, or set bit 7 if you need to test for end of text.
  176.     typeset - bit 7 set will handle carriage returns and tabs and ignore up-arrow terminators, while if cleared, then carriage returns and tabs are ignored, and an up-arrow will clear endecho.
  177.     kboardoff - normally zero. Set to 128 to turn the keyboard off while displaying text. (reset it to zero when finished)
  178. Return:    goodflag - meaningless
  179.     r0 - unchanged
  180.     endecho - bit 7 cleared if end of text reached
  181.     textpointer - offset pointer to next word to display
  182. Destroys:    a, x, y, r1-r15
  183. Description:    Display any amount of text in the geoSHELL window. Both the echo and type commands use this routine. Just point r0 at the start of the text you wish to display and call this routine. If you wish to have carriage returns and tabs recognized, then set typeset to 128. Also, before calling this routine, set endecho to 128, because DispText will clear it to zero if the end of text is reached. End of text is a null byte. This allows you to repeatedly call DispText to put text in the window. Of course, you would have to keep updating r0 between calls to DispText since it does not change. There is a routine that will do this for you. Call AdjTxtPointer and r0 will point to the next word to display on the next line. DispText will automatically do a carriage return when it reaches the right side of the window, so that the next call will display text on the next line down. If the bottom line is reached, the text will be scrolled. While this is taking place, the keyboard is active so that the user may pause or halt the text displaying with the CONTROL or STOP keys.
  184. Example:
  185. ;this example will display ascii text that is contained in
  186. ;a buffer of your choice. In this example we will call the
  187. ;buffer 'textStart'.
  188. DoText:
  189.     LoadW    r0,#textStart    ;set r0 to the start
  190.             ;of your text.
  191.     LoadB    endecho,#128    ;initialize a flag.
  192.     LoadB    typeset,#128    ;do tabs and carriage
  193.             ;returns.
  194.     jsr    Dis
  195. DoText:
  196.     LoadW    r0,#textStart    ;set r0 to the start
  197.             ;of your text.
  198.     LoadB    endecho,#128    ;initialize a flag.
  199.     LoadB    typeset,#128    ;do tabs and carriage
  200.             ;returns.
  201.     jsr    DispText    ;display up to 80 columns
  202.             ;of text.
  203.     jsr    AdjTxtPointer    ;advance a pointer to
  204.             ;some more of the text.
  205.     bit    endecho    ;have we reached the end?
  206.     bmi    10$    ;branch if not.
  207. See Also:    AdjTxtPointer, Message, OtherMessage, DsplyLine, DsplyString, CarrReturn, ClearLine, ClearBoth, ClearRemainder, StripRulers, set_XY_pos, save_XY_pos, MskCtrlCodes, ConvToAscii, CkESC_RULER
  208. @DoRun
  209. Function:    Load and run a file.
  210. Pass:    a2 - pointer to null terminated filename.
  211. Return:    not applicable.
  212. @DoRun
  213. Function:    Load and run a file.
  214. Pass:    a2 - pointer to null terminated filename.
  215. Return:    not applicable.
  216. Destroys:    not applicable.
  217. Description:    You can use this routine if you desire to load and run any file that is capable of doing so. All you need to do is point a2 to a null terminated filename. You don't even have to know where the file is located, DoRun will find it for you. DoRun will take over and cause your command to cease it's function. If any errors are encoutered, control will return to the user. For this reason you might only want to call this routine if the geoSHELL window is displayed.
  218. Example:
  219. ;this routine takes the filename that the user typed in and
  220. ;then passes control to DoRun. If the file is found on one of the
  221. ;available drives, it will be loaded and run.
  222.     jsr    ParamName    ;get the filename.
  223.     bit    goodflag    ;is it a valid filename?
  224.     bmi    10$    ;branch if so.
  225.     jmp    DoError    ;otherwise display an error.
  226.     jmp    DoRun    ;find it and run it.
  227. See Also:
  228. escription:    This is primarily an internal geoSHELL routine. It will simply displs example will display the kb
  229. UUUUUUUUUUUUUUUU
  230. @DriveLetter
  231. Function:    Display the drive letter of the active drive and turn the cursor on.
  232. Pass:    nothing
  233. Return:    nothing
  234. Destroys:    a, x, y, r0-r15
  235. Description:    Most commands have no use for this routine. It is mostly an internal routine that is accessed just before control is returned to the user. However, since geoSHELL gives your command control of the system, you could use this to also return control to the user and interact with the user instead of geoSHELL's own main processor doing so. You would need some sort of routine to call for user input. This routine also gets the cursor blinking.
  236. Example:
  237. See Also:    DispLetter
  238. @DsplyLine
  239. Function:    Display a line of text to th
  240. @DsplyLine
  241. Function:    Display a line of text to the geoSHELL window beginning at the left side of the current line.
  242. Pass:    a0 set to the null terminated string to be displayed.
  243. Return:    cur_line - updated to reflect the line the cursor is on. A carriage return is performed after the line is displayed.
  244. Destroys:    no guarantees.
  245. Description:    This routine should only be used by a command that might need a more direct approach for displaying text to the geoSHELL window. The 'type' command uses it and so does geoSHELL's main display routines. For general message displaying, use Message and OtherMessage. a0 is normally used by internal routines for keeping the cursor in sync with the internal memory buffers. A carriage return is always performed after the line of text is displayed and if the cursor is on the last line, the text will scroll up one line.
  246.     This routine also calls CkKeyboard to check for the CONTROL or STOP key. So, if you wish this feature turned off, set bit 7 of kboardoff. If you wish to allow the user to still be able to use the CONTROL key to pause text, then set bit 6 of kboardoff and the STOP key will be ignored.
  247. Example:
  248.     lda    PRESDRIVE    ;get the real device number
  249.     jsr    GetRealDriveNum    ;of the currently active drive.
  250.     bit    goodflag    ;is it a real drive?
  251.     bmi    10$    ;branch if so.
  252.     LoadW    r0,#notReal    ;inform the user that this
  253.     lda    #(IN_TWO|TR_CR)    ;won't work on this drive.
  254.     jsr    OtherMessage
  255.     jmp    NoMoreCmds    ;and exit.
  256.     jsr    PushStuff    ;save a bunch of stuff.
  257.     jsr    InitForIO    ;pop out of GEOS.
  258.     LoadW    r0,#iText    ;send an init command 
  259.     LoadB    cmdlength,#2    ;to the drive.
  260.     lda    REALDRIVE    ;get the device number.
  261.     jsr    SendCmd    ;and send the command.
  262.     lda    REALDRIVE    ;read the error channel.
  263.     jsr    ReadChannel
  264.     jsr    DoneWithIO    ;pop back into GEOS.
  265.     LoadW    a0,#EnOfShell    ;and display the text
  266.     jsr    DsplyLine    ;from the error channel.
  267.     jsr    PopStuff    ;restore a bunch of stuff.
  268. notReal:
  269.     .byte    "This Is No
  270. notReal:
  271.     .byte    "This Is Not A Real Drive!",0
  272. iText:
  273.     .byte    "I0"    ;initialize command (be sure
  274.             ;to use an upper-case i here)
  275. See Also:    AdjTxtPointer, Message, OtherMessage, DispText, DsplyString, CarrReturn, ClearLine, ClearBoth, ClearRemainder, StripRulers, set_XY_pos, save_XY_pos, MskCtrlCodes, ConvToAscii, CkESC_RULER
  276. @DsplyString
  277. Function:    Display a string at the current cursor position.
  278. Pass:    a0 
  279. @DsplyString
  280. Function:    Display a string at the current cursor position.
  281. Pass:    a0 - pointing to the null-terminated string to be displayed.
  282. Return:    cur_X_pos holds the new horizontal pixel location of the cursor.
  283.     cur_Y_pos holds the new vertical pixel location of the cursor.
  284. Destroys:    no guarantees.
  285. Description:    This routine is mostly an internal routine and normally need not be used. It will display a null-terminated string pointed to by a0 to the screen beginning at the current cursor position. The cursor will be left at the end of the string on the screen. This routine will check the bytes before they are printed and any bytes that cannot be printed on the screen by GEOS will be converted to '?'. 
  286. Example:
  287. See Also:    AdjTxtPointer, Message, OtherMessage, DispText, DsplyLine, CarrReturn, ClearLine, ClearBoth, ClearRemainder, StripRulers, set_XY_pos, save_XY_pos, MskCtrlCodes, ConvToAscii, CkESC_RULER
  288. @EraseWindow
  289. Function:    Clear only the geoSHELL window
  290. Pass:    nothing
  291. Return:    nothing
  292. Destroys:    no guarantees
  293. Description:    This is called by ClearWindow and is usually not needed by most commands unless your command is not dealing entirely with text input and/or display. This routine does not clear the buffer that is holding the text that was displayed in the window. So, in some cases this routine could be used without losing what was in the buffer, and a subsequent call to ReDoWindow will therefore restore the text to the screen.
  294. Example:
  295.     jsr    EraseWindow
  296. See Also:    ResetScreen, ClearScreen, ClearWindow, ClearBoth, ReDoWindow, DispLetter, DriveLetter, DsplyLine, DsplyString, CarrReturn, set_XY_pos, save_XY_pos, ClearLine, ClearRemainder, ReDisplayWindow, DispText, unsetPrompt
  297. @execStartup
  298. Function:    Execute a string of commands located beginning at StUpBuffer.
  299. @execStartup
  300. Function:    Execute a string of commands located beginning at StUpBuffer.
  301. Pass:    nothing (other than to load StUpBuffer with the commands).
  302. Return:    not applicable
  303. Destroys:    not applicable
  304. Description:    Fill the buffer at StUpBuffer with a group of commands and call this routine to execute them. This does not return to your command. When all commands in the buffer have been executed, control will return to the user.
  305. Example:
  306. See Also:
  307. @ExitCommand
  308. Function:    Exit a transient command cleanly.
  309. Pass:    nothing
  310. Return:    not applicable
  311. Destroys:    not applicable
  312. Description:    When everything in your command goes as expe
  313. @ExitCommand
  314. Function:    Exit a transient command cleanly.
  315. Pass:    nothing
  316. Return:    not applicable
  317. Destroys:    not applicable
  318. Description:    When everything in your command goes as expected and you are ready to terminate it and return control to geoSHELL, call this routine. If you simply perform an 'rts', then your command will put the GEOS mainloop in control without the user being able to have access to geoSHELL's keyboard input. ExitCommand puts things back like they were before your command was called.
  319.     In some cases, you may want to do an rts somewhere within your command if you wish to have it working with the GEOS main loop instead of geoSHELL doing so. In this case, your command really isn't finished yet, but perhaps you have set up your own user input routines for mainloop to handle. geoSHELL contains certain routines that can do many things for you, but some special situations may need new routines to do different things. But when your routine is finally finished, exit through ExitCommand and geoSHELL will process any further commands that the user may have entered.
  320. Example:
  321.     ...        ;the bulk of your command.
  322.     jmp    ExitCommand    ;exit cleanly.
  323. See Also:    NoMoreCmds
  324. @FileNotAvail
  325. Function:    Display a 'Filename Not Available!' message and return control to the user.
  326. Pass:    a2 - pointing to a null terminated filename.
  327. Return:    not applicable
  328. Destroys:    not applicabl
  329. @FileNotAvail
  330. Function:    Display a 'Filename Not Available!' message and return control to the user.
  331. Pass:    a2 - pointing to a null terminated filename.
  332. Return:    not applicable
  333. Destroys:    not applicable
  334. Description:    If your command fails to find a file that the user requests, you could end your command by jumping through this routine. If a2 is still pointing at the null-terminated filename, this routine will display the filename on the screen, followed by 'Not Available!'. Control is then returned to the user instead of your command.
  335. Example:
  336.     jsr    ParamName    ;get the filename.
  337.     bit    goodflag    ;is it valid?
  338.     bmi    10$    ;branch if so.
  339.     jmp    MissgFilename    ;display a geoSHELL error
  340.             ;and exit.
  341.     jsr    CkAllDrives    ;find the file.
  342.     bit    goodflag    ;does it exist?
  343.     bmi    20$
  344.     jmp    FileNotAvail    ;display error and exit.
  345.     ...        ;continue on...
  346. See Also:    Message, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, MissgFilename, NotFound
  347. @FindCMDType
  348. Function:    Find the location of a CMD device.
  349. Pass:    a - an upper-case letter corresponding to the desired device to locate: F, H, 
  350. @FindCMDType
  351. Function:    Find the location of a CMD device.
  352. Pass:    a - an upper-case letter corresponding to the desired device to locate: F, H, or R.
  353.       F = FD Series
  354.       H = HD Series
  355.       R = RamLink or RamDrive
  356. Return:    goodflag - bit 7 set if the requested CMD device was found.
  357.     curDrive - desired CMD device is opened
  358.     REALDRIVE - real device number of the CMD device
  359. Destroys:    no guarantees
  360. Description:    To find out if a particular CMD device is being used, load the accumulator with an F, H, or R and call this routine. If goodflag is set upon return, then the device was found. This routine also calls GetCMDType, and so the variables that are set with that routine will also be in effect.
  361. Example:
  362. ;this example will locate an FD Series drive if one is being used.
  363. ;this same routine can be modified to locate any CMD drive.
  364. ;If a RamLink or RamDrive is being searched for and found, then
  365. ;the variables are set by GetCMDType can be checked:
  366. ;cmdtype+0 will contain an 'R'
  367. ;and cmdtype+1 will have either an 'L' or a 'D'
  368. ;while cmdtype+2 will contain either a 3 or a 4.
  369. FindFD:
  370.     lda    #'F'    ;let's find the FD Drive.
  371.     jsr    FindCMDType
  372.     bit    goodflag
  373.     bmi    10$
  374.     LoadB    FDdrive,#0    ;set variable to zero to
  375.             ;indicate no FD.
  376.     jmp    NoFD    ;do whatever, if not found.
  377.     MoveB    REALDRIVE,FDdrive
  378.     rts        ;goodflag is still set
  379.             ;and FDdrive now contains
  380.             ;the device number of the FD.
  381. FDdrive:
  382.     .block    1
  383. See Also:    GetCMDType
  384. @FindParName
  385. Function:    Search the current drive for a desired file from a parameter the user entered.
  386. Pass:    nothing
  387. Return:    If file not found, routine does not return.
  388.     If routine returns then file is found on the current drive.
  389.     a2 - now points to a null-terminated filename.
  390.     dirEntryBuf - contains the directory entry for the file.
  391. Destroys:    no guarantees
  392. Description:    You could use this routine when you wish to search the current drive for a file that the user desires your command to act on. This routine will take care of calling ParamName for you and call the necessary routines for searching the drive. If the file is not found, however, the routine will display an error that the file is not available and jump through NoMoreCmds, which will return control to the user. If the user did not enter a parameter that could possibly be a filename, this routine will also handle that error for you without returning. If the routine returns, then obviously the file is found, and your command may continue.
  393. Example:
  394.     jsr    FindParName    ;find the desired file.
  395.     ...        ;file is found, so continue...
  396. See Also:    CkAllDrives, CkThisDrive, CkOtherDrives, CkPathOrder, CkPath, CkForDisk, CkPresdrive
  397. @FindRamLink
  398. Function:    Find a RamLink or RamDrive if one is currently being used.
  399. Pass:    InitForIO must be called first!
  400. Return:    goodflag - set if an
  401. @FindRamLink
  402. Function:    Find a RamLink or RamDrive if one is currently being used.
  403. Pass:    InitForIO must be called first!
  404. Return:    goodflag - set if an RL/RD is found on the system.
  405.     RAMLINK - holds the real device number of the RL or RD.
  406.     cmdtype - (two bytes) holds the characters 'RL' or 'RD'
  407.     cmdtype+2 - holds a 3 for RamDrive or a 4 for RamLink.
  408. Destroys:    no guarantees
  409. Description:    This routine will check to see if a RamLink or RamDrive is connected and enabled, even if it is not being used by GEOS. The only way this routine will not find the device is if the user has given it a device number of 14. geoSHELL always ignores device number 14 in order to prevent a possible crash should the user have a Xetec Super Graphics Gold printer interface connected. Don't forget to call InitForIO before calling this routine.
  410. Example:
  411. ;this example routine will find a RamDrive. If a RamDrive is found
  412. ;then the variable RAMLINK will contain the device number of the
  413. ;RamDrive.
  414. FindRD:
  415.     jsr    InitForIO    ;pop out of GEOS.
  416.     jsr    FindRamLink    ;look for an RL or RD.
  417.     jsr    DoneWithIO    ;pop back in.
  418.     bit    goodflag    ;did we find one or the other?
  419.     bpl    20$    ;branch if not.
  420.     lda    cmdtype+2    ;check the device type.
  421.     cmp    #3    ;is it an RD?
  422.     bne    10$    ;branch if not.(if it was an RL)
  423.     rts        ;goodflag already set.
  424.     LoadB    RAMLINK,#0    ;in case a RamLink was found,
  425.             ;because we were looking for
  426.             ;a RamDrive instead.
  427.     jmp    nogood    ;signal to calling routine
  428.             ;that no RamDrive is found.
  429. See Also:    GetCMDType, FindCMDType, GetRealDriveNum
  430. for you without returning. If the routine returns, then obviously the file is foestroys:    no guarantees
  431. Description:    To find out if a particular CMD devi
  432. @FixColors
  433. Function:    Restore the default colors to the 40 column screen.
  434. Pass:    nothing
  435. Return:    Colors on screen restored.
  436. Destroys:    a, y, r0, r1, r2L
  437. Description:    geoSHELL uses this routine to restore the colors on the 40 column screen whenever a desk accessory exits back to geoSHELL. Some DA's alter the screen colors without restoring them upon exit. This is actually allowed and is left up to the application to restore the colors as well as any other data displayed on the screen. If your command alters the colors for it's own purpose, use this routine to restore them, unless the intention is to alter the colors permanently. In this case, you would also want to change the GEOS variable, screencolors. The high nybble of screencolors is the foreground color (0-15) while the low nybble is the background color (0-15).
  438. Example:
  439.     jsr    FixColors    ;restore 40 column color
  440. See Also:    ColorScreen
  441. @GetCMDType
  442. Function:    Check if a device is a CMD device and if so, what type.
  443. Pass:    a - real device number of device to check. (remember that a RamLink or RamDrive can be 12 or higher if it is being used as a RAM_1581)
  444.     InitForIO must be called before calling this routine.
  445. Return:    goodflag - set if a CMD device.
  446.     cmdtype - (two bytes) contains 'FD', 'HD', 'RD', or 'RL'.
  447.     cmdtype+2 - contains 1, 2, 3, or 4.
  448.     1 = FD Series drive.
  449.     2 = HD Series hard drive.
  450.     3 = PP RamDrive.
  451.     4 = RamLink.
  452. Destroys:    a, x, y, r0
  453. Description:    After calling InitForIO, you can call this routine to find out if a particular drive is a CMD device and exactly what type it is. Upon return, if goodflag is set, then the device is a CMD device. Then you can proceed to check the bytes at cmdtype to see which CMD device it is.
  454. Example:
  455. ;this particular example will check if drive A is a CMD HD.
  456. CheckHD:
  457.     jsr    InitForIO    ;first, pop out of GEOS.
  458.     lda    #8    ;drive A.
  459.     jsr    GetCMDType    ;is it a CMD device?
  460.     jsr    DoneWithIO    ;pop back into GEOS.
  461.     bit    goodflag    ;so was it a CMD?
  462.     bpl    90$    ;branch if not.
  463.     lda    cmdtype+2    ;check the type byte.
  464.     cmp    #2    ;is it an HD?
  465.     bne    90$    ;branch if not.
  466.     rts        ;or exit with goodflag
  467.             ;still set.
  468.     jmp    nogood    ;tell the calling routine
  469.             ;that this is not an HD.
  470. See Also:    FindRamLink, FindCMDType, GetRealDriveNum
  471. @GetHeader
  472. Function:    Load the header block of a file into fileHe
  473. @GetHeader
  474. Function:    Load the header block of a file into fileHeader.
  475. Pass:    dirEntryBuf with a file's directory entry.
  476. Return:    fileHeader contains the file's header block.
  477.     r7 - start address of the file.
  478.     r1 - track and sector of first data block, or if VLIR file, then T/S of index block.
  479. Description:    This routine will not return if any errors are encountered. If an error such as file not found occurs, then an error message will be displayed and control will return to the user. If a header block is successfully loaded, then control returns to your command and you may continue.
  480. Example:
  481.     jsr    ParamName    ;get the filename.
  482.     jsr    CkAllDrives    ;find the file.
  483.     bit    goodflag    ;did we find it?
  484.     bmi    10$    ;branch if so.
  485.     jmp    FileNotAvail    ;tell the user, no file.
  486.     jsr    GetHeader    ;no need to check for errors,
  487.             ;routine returns if OK.
  488.     ...        ;so we can continue...
  489. See Also:
  490. @GetMess
  491. Function:    Set a pointer to a message.
  492. Pass:    r0 - pointing to the start of a group of null-terminated message strings.
  493.     x - desired message number (1-255)
  494. Return:    r0 - pointing to the desired message.
  495. Destroys:    a, x, y
  496. Description:    This is part of the routine that 'Message' uses to locate a particular message within a whole group of messages. You can set up a table of messages, with each message being null-terminated. Set x to the message you need and r0 to the start of the group of messages and then call this routine. Upon return, r0 will be pointing at the desired message. A maximum of 255 messages can be contained in a table. 
  497. Example:
  498. ;this example will display the error message corresponding to the
  499. ;value in x.
  500. DoError:
  501.     LoadW    r0,#errorMessages    ;point to the start of
  502.             ;message table.
  503.             ;x is set before calling this.
  504.     jsr    GetMess    ;point to the desired message.
  505.     lda    #(IN_TWO|TR_CR)    ;indent two and trailing CR.
  506.     jmp    OtherMessage    ;display the message.
  507. errorMessages:
  508.     .byte    "This Would Be Error Number 1!",0
  509.     .byte    "And Error Number 2!",0
  510.     .byte    "Or Number 3!",0
  511.     .byte    "This Can Be Error Number 4!",0
  512.     .byte    "Number 5 Might Be Here!",0
  513. See Also:    GetMessage, Message, OtherMessage
  514. @GetMessage
  515. Function:    Point at one of geoSHELL's built-in messages.
  516. Pass:    x - desired message number.
  517. Return:    r0 - pointing to the message
  518. Destroys:    a, x, y
  519. Description:    This ro
  520. @GetMessage
  521. Function:    Point at one of geoSHELL's built-in messages.
  522. Pass:    x - desired message number.
  523. Return:    r0 - pointing to the message
  524. Destroys:    a, x, y
  525. Description:    This routine will simply point r0 to the desired message contained in the standard geoSHELL message table, depending on the value in x. There really isn't much use for this command, although it could be used to locate a particular message and then alter the message. The only problem with this is that the message must contain the exact same number of characters, since if any null bytes are added, then they are treated as blank messages and any following messages will be out of sync when geoSHELL tries to display one of them. In other words, the wrong message might get displayed, thereby creating confusion for the user.
  526. Example:
  527. See Also:    GetMess, Message, OtherMessage
  528. @GetRealDriveNum
  529. Function:    Get the 'real' device number of a drive.
  530. Pass:    a - device num
  531. @GetRealDriveNum
  532. Function:    Get the 'real' device number of a drive.
  533. Pass:    a - device number 8-11 of drive.
  534. Return:    goodflag - set if device is a real drive or a device that uses some form of CBM DOS such as a RamLink.
  535.     REALDRIVE - device number of the device.
  536.     curdrvtype - drive type of device as GEOS sees it.
  537.     RAMLINK - 0 if device is not a RamLink or RamDrive or if so it will contain a copy of REALDRIVE.
  538. Destroys:    a, x, y, r0-r15
  539. Description:    If working with the built-in DOS in the drive is desired, you need to know the device number before using standard kernal routines to access the device. Normally this is not a problem. However, it is possible that a RamLink or RamDrive might be used with 1581 partitions being used to emulate a RAM_1581. In these cases, the GEOS disk driver is controlling the device as a RAM device and not a DOS device. So, the device number of the device in question might be 12 or higher instead of the usual 8-11 that GEOS uses. This routine will test the device and return the correct device number for you in REALDRIVE.
  540.     This routine will also call PurgeAllTurbos. So, if you call another routine after this one that needs the turbo code purged in the drives, it will not be necessary to call PurgeAllTurbos.
  541. Example:
  542.     lda    PRESDRIVE    ;let's get the device number
  543.             ;of the currently active
  544.             ;drive.
  545.     jsr    GetRealDriveNum
  546.     bit    goodflag
  547.     bmi    10$
  548.     jmp    NotRealDrive    ;go do some sort of error.
  549.     ...        ;now we have the real
  550.             ;drive number for sure
  551.             ;just in case a RamLink
  552.             ;is being used.
  553. See Also:
  554. The geoSHELL Programmer's Development Package    2-PAGE
  555. sync when geoSHELL tries to displa
  556. The geoSHELL Programmer's Development Package    2-PAGE
  557.