Function: Position the command pointer past your command's parameter.
Pass: accumulator - number of bytes in your parameter plus one for a trailing space which is supposed to separate your command with the next.
Return: a4 - incremented the number of desired bytes.
Destroys: a, y
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.
Example:
... ;the bulk of your command.
lda #2 ;assuming your command only
;used one parameter plus a
;space after the parameter.
jsr IncCmdPointer ;point geoSHELL in the
;proper spot.
jmp ExitCommand ;and exit your command.
Example #2
... ;part of your command.
jsr ParamName ;point a2 to a filename
;parameter,
;and set NUM_IN_NAME to the
;length of the filename.
bit goodflag
bmi 10$
... ... ;display an error here.
jmp NoMoreCmds ;and then stop any further
;command processing.
... ;th
... ;the bulk of your command.
inc NUM_IN_NAME ;add one for a terminator
;following the filename.
lda NUM_IN_NAME ;and get the value.
jsr IncCmdPointer ;point geoSHELL in the
;proper spot.
jmp ExitCommand ;and exit your command.
See Also: ExitCommand
@InitCurPartition
Function: Open the currently active partition after changing to a different one.
@InitCurPartition
Function: Open the currently active partition after changing to a different one.
Pass: Certain internal variables must be set by calling GetRealDriveNum and SetPartParams beforehand.
Return: The partition the user is seeing will be reopened.
Destroys: a, x, y, r0-r15
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.
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.
Example:
;this could be part of the code that you might use for a command
;that would switch among partitions.
jsr SetPartStuff ;set up the variables for
;the current partition
bit goodflag ;does this device use
;partitions?
bmi 10$ ;branch if so.
jmp NotPartDevice ;otherwise display an error.
... ;do whatever you had planned.
jsr InitCurPartition ;open the current partition.
... ;continue with more code
SetPartStuff:
lda PRESDRIVE
jsr GetRealDriveNum ;is this a DOS type device?
bit goodflag
bpl 10$ ;branch if not.
jsr InitForIO
lda REALDRIVE ;this was set by GetRealDriveNum
jsr SetPartParams ;set some internal variables.
;this will set goodflag
;if the device has partitions.
jsr DoneWithIO
See Also: OpenPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
@InitgeoSHELL
Function: Start geoS
See Also: OpenPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
@InitgeoSHELL
Function: Start geoSHELL (Initial jump add
@InitgeoSHELL
Function: Start geoSHELL (Initial jump address).
Pass: nothing
Return: not applicable
Destroys: not applicable
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.
Example: no example since this routine is not recommended.
See Also: NoMoreCmds
@LoadProblem
Function: Display an error message and return control to the user.
Pass: nothing
Return: not applicable
Destroys: not applicable
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.
Example:
jsr ParamName ;fetch the filename the
bit goodflag ;user typed in.
bmi 10$ ;branch if successful.
jmp MissgFilename ;display 'Bad Parameter'.
jsr CkPresdrive ;find the file on the
bit goodflag ;current drive.
bmi 20$ ;branch if found.
jmp FileNotAvail ;tell the user it's not there.
MoveW a2,r0 ;point r0 to the now true
;filename without wildcards.
jsr OpenRecordFile ;let GEOS open it.
txa ;well?
beq 30$ ;branch if OK.
jsr CloseRecordFile ;make sure it's closed.
jmp LoadProblem ;and exit with an error.
... ;desired VLIR file is now
... ;open, so we can
... ;continue...
See Also: MissgFilename, NoMoreCmds, Message, OtherMessage, FileNotAvail, MissDisk, NotFound
@Message
Function: Display an internal geoSHELL message.
Pass: x - number of desired message.
@Message
Function: Display an internal geoSHELL message.
Pass: x - number of desired message.
a - formatting information.
Return: nothing
Destroys: no guarantees
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.
Example:
;this particular example is for a command that might only work
;from a startup or exec file. If coming from anything but, then
;message #72, 'This Is A Startup Command!', will be displayed.
;This example could be the first thing your command does.
bit STUPMODE ;are we in startup mode?
bmi 10$ ;branch if so.
ldx #72 ;point at message 72.
lda #(IN_TWO|TR_CR) ;indent two and carriage rtn.
jsr Message ;do the message.
jsr ClrTrnsName ;remove the command.
jmp NoMoreCmds ;and return to the user.
... ;continue on...
See Also: MissgFilename, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, NotFound
@MskCtrlCodes
Function: Remove control codes (any non-ASCII characters) from a text buffer.
Pass: r0 - start of buffer.
endoftext - one byte past end of b
@MskCtrlCodes
Function: Remove control codes (any non-ASCII characters) from a text buffer.
Pass: r0 - start of buffer.
endoftext - one byte past end of buffer.
txttype - always set this to zero.
Return: the buffer is altered.
endoftext - points to the new end of text + 1. The buffer will decrease in size if any unwanted bytes have been removed from it.
Destroys: a, y, r0, r2
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.
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.
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.
Example:
lda #10 ;check for a disk in
jsr CkForDisk ;drive C.
bit goodflag ;is there one?
bmi 10$ ;branch if so.
jsr MissDisk ;display a message.
jmp NoMoreCmds ;and exit.
... ;otherwise,
... ;continue on...
See Also: MissgFilename, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, Message, NotFound
@MissgFilename
Function: Display the message 'Bad Parameter!' without returning.
Pass: nothing
Return: not applicable
Destroys: not applicable
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.
Example:
jsr ParamName ;check if the user typed in
bit goodflag ;a filename.
bmi 10$ ;branch if so.
jmp MissgFilename ;tell him, bad parameter.
... ;otherwise,
... ;continue on...
See Also: Message, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, NotFound
@nogood
Function
@nogood
Function: Usually identifies a failure in a routine.
Pass: nothing
Return: goodflag - bit 7 set to zero.
Destroys: nothing
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.
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.
Example:
jsr OpenDisk ;call a GEOS routine.
txa ;check the value returned in x.
beq 10$ ;branch if OpenDisk was OK.
jmp nogood ;signal the calling routine
;that this routine failed.
... ;continue with more.
See Also: yesgood
@NoKeypress
Function: Wait for the user to release the keyboard.
Pass: nothing
Return: goodflag - meaningless, although the routine will always return with goodfla
@NoKeypress
Function: Wait for the user to release the keyboard.
Pass: nothing
Return: goodflag - meaningless, although the routine will always return with goodflag's bit 7 set.
the keyboard - completely released.
Destroys: a, x, y
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.
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.
Example:
... ;some of your command's code.
jsr NoKeypress ;wait for no keys being
;pressed.
... ;continue with further
... ;parts of your command.
See Also: YesKeypress, ClrKeyData, Wait, CkKeyboard
@NoMoreCmds
Function: Exit from just about anything and return complete control back to geoSHELL.
Pass: nothing
@NoMoreCmds
Function: Exit from just about anything and return complete control back to geoSHELL.
Pass: nothing
Return: not applicable
Destroys: not applicable
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.
Example:
... ;parts of your command.
jsr DoWhatever ;jsr to another routine.
bit goodflag ;check for an error on return.
bmi 10$ ;branch if routine was ok.
jsr DisplayError ;you might want to have a
;routine to display an error.
jmp NoMoreCmds ;stop any further commands.
... ;continue with your command.
See Also: ExitCommand, IncCmdPointer
@NotFound
Function: Display a 'FILENAME Not Found!' message.
Pass: a2 - pointer to null-terminated filename.
Return: nothing
Destroys: no guarantees
Descri
@NotFound
Function: Display a 'FILENAME Not Found!' message.
Pass: a2 - pointer to null-terminated filename.
Return: nothing
Destroys: no guarantees
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.
Example:
jsr ParamName ;get the filename.
bit goodflag ;is it valid?
bmi 10$ ;branch if so.
jmp MissgFilename ;display an error.
jsr CkAllDrives ;look for it.
bit goodflag ;did we find it?
bmi 20$ ;branch if so.
jsr NotFound ;display 'not found'.
jmp NoMoreCmds ;and in this case we
;will just exit.
... ;continue on...
See Also: Message, NoMoreCmds, LoadProblem, OtherMessage, FileNotAvail, MissDisk, MissgFilename
@Only128
Function: Inform the user w
@Only128
Function: Inform the user when a 128 command is being used on a 64 and exit.
Pass: nothing
Return: not applicable
Destroys: not applicable
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.
Example:
bit screenmode ;check the mode.
bvc 10$ ;branch if a 128.
jsr ClrTrnsName ;clear the command.
jmp Only128 ;do an error and exit.
... ;this is a 128, so
... ;continue on...
See Also: CkModeFlag
@OpenCurPartition
Function: Open the currently active partition after changing to a different one.
Pass: Certain internal variables must be set by calli
@OpenCurPartition
Function: Open the currently active partition after changing to a different one.
Pass: Certain internal variables must be set by calling GetRealDriveNum and SetPartParams beforehand.
InitForIO must be called first.
PurgeAllTurbos must be called first.
Return: The partition the user is seeing will be reopened.
Destroys: a, x, y, r0-r15
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.
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.
Example:
;this could be part of the code that you might use for a command
Function: Locate and open geoSHELL to gain access to it's VLIR records.
Pass: nothing
Return: goodflag - set if successful.
geoSHELL is now an open VLIR file, and
@OpenGS
Function: Locate and open geoSHELL to gain access to it's VLIR records.
Pass: nothing
Return: goodflag - set if successful.
geoSHELL is now an open VLIR file, and so everything pertaining to a call to OpenRecordFile pertains here.
pathload - set if geoSHELL was found on the path partition.
DRVFOUNDON - device number (8-11) of the drive that geoSHELL was found on.
curDevice and curDrive - the currently open drive.
PRESDRIVE - unchanged.
Also anything that OpenRecordFile returns is returned with this routine, such as the Index Table in fileHeader, and dirEntryBuf.
Destroys: a, x, y, r0-r15, a2
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.
Example:
jsr OpenGS ;open the geoSHELL file.
bit goodflag ;was it successful?
bmi 10$ ;branch if so.
jsr NotFound ;display that geoSHELL was
jmp NoMoreCmds ;not found and exit.
... ;now we can do what we
... ;want with the geoSHELL
... ;file that is the one
... ;that is currently in control.
See Also: OpenGSIndex
penCurPartition ;open the current partition.
jsr DoneWithIO
... ;continue with more
See Also: OpenGSIndex
penCurPartition ;open the current partition.
jsr DoneWithIO
... ;continue with more code... ...
DoWhatever ;jsr to another routine.
bit gge informing the user
@OpenGSIndex
Function: Load geoSHELL's VLIR index block into fileHeader.
Pass: nothing
Return: goodflag - set if routine was successful.
pathload - set if geoSHELL was found on the path partition.
DRVFOUNDON - device number (8-11) of the drive that geoSHELL was found on.
fileHeader - contains geoSHELL's index table if successful (goodflag set)
dirEntryBuf - geoSHELL's directory entry.
curDevice and curDrive - the currently open drive.
PRESDRIVE - unchanged.
Destroys: a, x, y, r0-r15, a2
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.
Example:
GetGSIndex:
jsr OpenGSIndex ;get geoSHELL index sector.
bit goodflag ;was it successful?
bmi 10$ ;branch if so.
rts ;goodflag is still cleared.
;geoSHELL's index sector is
;now in memory at fileHeader.
;We will now restore the drive.
;This could also be done by
;the calling routine if it
;needs to keep geoSHELL
;available while performing
;it's operation on it.
jsr ResetFromPath ;reset the drive to it's previous
;partition in case geoSHELL
;was found on the path
;partition.
jmp yesgood ;tell the calling routine
;that geoSHELL's index is
;in memory.
See also: OpenGS
@OpenPartition
Functi
;that geoSHELL's index is
;in memory.
See also: OpenGS
@OpenPartition
Function: Open a partition on a CMD device.
Pass: r0 - pointing to a string with
@OpenPartition
Function: Open a partition on a CMD device.
Pass: r0 - pointing to a string with 'CP' and the ascii characters representing the desired partition to open.
a - the real device number of the desired CMD device.
cmdlength - the length (3-5) of the string that r0 is pointing at.
PurgeAllTurbos, InitForIO, and SetPartParams must be called just before calling this routine.
Return: goodflag - set if the desired partition was opened.
Destroys: no guarantees
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.
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.
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
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.
Example:
;this example might look fairly lengthy, but the bulk of it is
;taking the parameter that the user typed in and building a
;string that we will pass on to OpenPartition. This example
;performs some sort of whatever to a desired partition that
;the user chooses. When finished, it will reopen the original
;partition.
;The command that the user types in might look like this:
;commandname 45
;This example command does not expect a fixed length parameter
;and so a space can terminate the 45 in this case. The 45
;represents partition number 45, the one the user wants this
;command to act on. A partition number such as 45 could be
;anything from 1 to 255 or the maximum allowed by the device.
lda PRESDRIVE ;this acts on the current
;drive as the user sees it.
jsr GetRealDriveNum ;just in case it's an RL or RD.
;This also calls PurgeAllTurbos.
LoadB paramsize,#2 ;let's keep track of the size
;of our parameter. (it's at
;least one plus a space)
ldx #2 ;first fill string with spaces.
lda #' '
sta partNumber,x
bpl 10$
lda ParamTable ;we need at least one character.
jsr CkTerminators ;is this a valid character?
bne 20$ ;branch if so.
jmp MissgFilename ;this will display
;'Bad Parameter' and exit.
sta partNumber+0 ;save this first character.
lda ParamTable+1 ;get the next character.
jsr CkTerminators ;is it a character?.
beq 40$ ;branch if not.
inc paramsize ;the parameter is at least
;two characters now.
sta partNumber+1
lda ParamTable+2
jsr CkTerminators
beq 40$
inc paramsize ;the parameter is at least
;three characters now.
sta partNumber+2
lda ParamTable+3 ;there must be a space or
;terminating character after
;the last character in the
;paramet
;the last character in the
;parameter.
jsr CkTerminators ;well?
bne 15$ ;branch if not.
jsr InitForIO ;pop out of GEOS.
lda REALDRIVE ;get the device number.
jsr SetPartParams ;set some internal variables
;and check if this device has
;partitions.
bit goodflag ;well?
bpl 50$ ;branch if not.
LoadW r0,#partString ;point r0 to the string we
;just built up.
LoadB cmdlength,#5 ;any spaces in the string are
;ignored by CMD's DOS.
jsr OpenPartition ;open the partition.
jsr DoneWithIO ;pop back into GEOS.
bit goodflag ;did the partition get opened?
bmi 60$ ;branch if so.
LoadW r0,#cantOpen ;otherwise, let's tell the
lda #(IN_TWO|TR_CR) ;user we couldn't get to the
jsr OtherMessage ;partition.
jmp NoMoreCmds ;and return control to him.
... ;here we can do what the
... ;command is designed to do
... ;with the partition that we
... ;just opened.
jsr InitCurPartition ;restore the original
;partition.
lda paramsize ;we were keeping track of this.
jsr IncCmdPointer ;point past our command and
;parameter.
jmp ExitCommand ;and do a clean exit.
partString:
.byte "CP"
partNumber:
.byte "1 " ;this gets changed.
cantOpen:
.byte "Unable To Open Partition!",0
See Also: InitCurPartition, OpenCurPartition, ResetFromPath, OpenPathPartition, SetPartParams
@OpenPathPartition
Function: Open the path partition.
Pass: nothing
Return: goodflag - set if s
@OpenPathPartition
Function: Open the path partition.
Pass: nothing
Return: goodflag - set if successful.
pathcheck - set to the device number of the drive containing the path partition.
REALDRIVE - contains the real device number of the drive containing the path partition.
Destroys: a, x, y, r0-r15
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.
When finished with the path partition, be sure to call ResetFromPath to restore the device to the partition that the user is currently seeing.
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.
Example:
jsr OpenPathPartition
bit goodflag
bmi 10$
... ;do what you need to do.
jsr ResetFromPath
jmp yesgood
See Also: InitCurPartition, OpenCurPartition, ResetFromPath, OpenPartition
@OpenWrFile
Function: Load a file's VLIR index into memory.
Pass: r0 - pointer to a null terminated filename.
Return: goodflag set if successful.
fileHeader contains the file's index sector
@OpenWrFile
Function: Load a file's VLIR index into memory.
Pass: r0 - pointer to a null terminated filename.
Return: goodflag set if successful.
fileHeader contains the file's index sector.
Destroys: a, y ,r1, r4-r6
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.
Example:
;here is how you would search all drives for a file and then
;load it's VLIR index into memory.
GetIndex:
jsr ParamName ;what filename did
;the user type in.
bit goodflag
bmi 10$ ;branch if the user entered
;a filename.
rts ;otherwise, exit with
;goodflag reset to zero.
;a2 now points to the filename
;that the user requests.
jsr CkAllDrives ;find the file.
bit goodflag
bpl 5$
;a2 now points to the
;real filename even if the
;user used wildcards.
MoveW a2,r0
jmp OpenWrFile ;this ends the routine.
;goodflag will represent the
;success or failure of loading
;in the file's VLIR index.
;if goodflag has bit 7 set,
;then the index is loaded.
;if not, then maybe the file
;was not a VLIR type file.
See Also: OpenGS, OpenGSIndex, GetHeader
r RD is seing it as 12 or higher.
When finished with the path partition, be sur user
Function: Check the user port via a geoCable for the presence of a printer.
Pass: nothing
InitForIO must be called before accessing this routine.
Return: x - zero means the printer is ready for input. (this is one of the few routines that doesn't affect goodflag)
Destroys: a, x, y
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.
Example:
jsr InitForIO ;pop out of GEOS.
jsr Open_GC_Channel ;check for a printer.
txa ;check if x = 0.
beq 10$ ;branch if so.
jsr DoneWithIO ;pop back into GEOS.
jmp nogood ;signal calling routine of error.
... ;continue on...
See Also: Send_GC_Byte
@OtherMessage
Function: Display a message.
Pass: r0 - pointer to text string to display.
a - formatting information.
Return: nothing
Destroys: no guarantees
Description: This routine will d
@OtherMessage
Function: Display a message.
Pass: r0 - pointer to text string to display.
a - formatting information.
Return: nothing
Destroys: no guarantees
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.
Example:
;this particular example is supposed to be some sort of
;command that acts on a GEOS file. If the file exists and
;it is not a GEOS file, then OtherMessage will be used
;to inform the user that this file is not a GEOS file.
jsr FindParName ;this won't return if error.
lda dirEntryBuf+0 ;first check the filetype.
and #%00001111
cmp #REL ;is it a REL file?
beq 20$ ;branch if so.
lda dirEntryBuf+22 ;is this a GEOS file?
bne 30$ ;branch if so.
MoveW a2,r0 ;tell the user that
lda #(IN_ONE|TR_ONE) ;this
jsr OtherMessage ;file...
LoadW r0,#notText ;is not
lda #TR_CR ;a
jsr OtherMessage ;GEOS file.
jmp NoMoreCmds ;and exit.
... ;this is a GEOS file, so
... ;we can continue on...
notText:
.byte "Is Not A GEOS File!",0
See Also: Message, NoMoreCmds, LoadProblem, NotFound, FileNotAvail, MissDisk, MissgFilename
The geoSHELL Programme
The geoSHELL Programmer's Development Package 2-PAGE