This section of the manual contains information about each of the routines that are accessible in geoSHELL from it's jump table. It is laid out in a manner that should be familiar to those of you who have either the Official GEOS Programmer's Reference Manaul by Bantam Books or The Hitchhiker's Guide To GEOS by Berkeley Softworks.
In some of the source code examples that are given, you might see references to a jump to another routine. Some of these might refer to other routines or error routines that you would create somewhere in your own source code. Hopefully, it is understandable which routines are geoSHELL routines and which are not.
Whenever you access any of the geoSHELL routines, be sure that you are doing it from a mode that is allowed. For instance, if you have called the GEOS kernal routine InitForIO, you can't call a geoSHELL routine that also does so. Likewise, some geoSHELL routines require that you call InitForIO first. If you don't, this could be the source of a serious crash or lockup. Read the description about the routine thoroughly before using it. You might also want to refer to the index to find other parts of this manual that might have information about a particular routine.
@AdjTxtPointer
Function: Used with DispText to advance r0 within a text buffer.
Pass: textpointer - any value 0-255 (normally set by DispText).
Return: r0 - holding n
@AdjTxtPointer
Function: Used with DispText to advance r0 within a text buffer.
Pass: textpointer - any value 0-255 (normally set by DispText).
Return: r0 - holding new value.
Destroys: a
Description: When using DispText to display text to a line of the geoSHELL window, r0 will still be pointing at the text and the variable textpointer will hold a value that if added to r0 will then point r0 at the next segment of text that should be displayed. Calling this routine will add that value to r0.
Example: See the entry for DispText for an example on how to use this routine.
Function: Convert an ascii number (0-255) to a single byte.
Pass: r0 - pointer to a 1,2 or 3 digit ascii number.
Return: r5L -
@Asc_3_Byte
Function: Convert an ascii number (0-255) to a single byte.
Pass: r0 - pointer to a 1,2 or 3 digit ascii number.
Return: r5L - contains the byte.
a - contains the byte.
goodflag - set if value is allowed.
r0 - unchanged.
Destroys: a, x, y, r5L, r8L
Description: Point r0 at an ascii representation of a byte from 0-255 and call this routine to convert it to a single byte that will be placed in r5L. If r0 was pointing to something that did not represent a number between 0 and 255, then the routine will exit through nogood. Always check goodflag before proceeding any further. The number should also end with either a space or some sort of terminator such as an up-arrow, or a null byte. When the user types in a number such as a parameter after your command, ParamTable will be loaded with this number. You could then point r0 at ParamTable and call this routine.
Example:
;this example will get the number the user types in and then
;locate a requested font file that was typed after the
;number on the current drive.
... ;some of your code.
LoadW r0,#ParamTable ;point at the first parameter.
jsr Asc_3_Byte ;convert it to a single byte.
bit goodflag ;was it a good value?
bmi 10$ ;branch if so.
jmp DoError ;jump to an error routine.
MoveB r5L,pointSize ;save the value for now.
ldx #1 ;there was at least one digit.
lda ParamTable,x
beq 5$ ;branch if no more data.
cmp #' ' ;look for the first space.
beq 30$
bne 20$ ;branch always.
inx ;point one past the space.
jsr IncCmdPointer ;aim the command pointer.
jsr ParamName ;and get a possible filename.
bit goodflag
jsr IncCmdPointer ;aim the command pointer.
jsr ParamName ;and get a possible filename.
bit goodflag
bpl 5$ ;branch if not valid.
jsr CkPresdrive ;look for the file on the
;current drive.
bit goodflag
bpl 5$ ;branch if not found.
... ;at this point we can
... ;continue to check if it
... ;is a font file.
pointSize:
.block 1
See Also: Asc_Byte, Asc_BCD, ByteNZ_Ascii, ByteWZ_Ascii, ConvertK
@Asc_BCD
Function: Convert a two digit ascii number to one byte in binary coded decimal (BCD) format.
Pass: r5L - first ascii digit of number '0'-'9'
r8L - second ascii digit of number '0'-'9'
Return: r5L -
@Asc_BCD
Function: Convert a two digit ascii number to one byte in binary coded decimal (BCD) format.
Pass: r5L - first ascii digit of number '0'-'9'
r8L - second ascii digit of number '0'-'9'
Return: r5L - BCD byte $00 - $99
goodflag - set if a valid number and within the allowable range.
Destroys: a
Description: This routine will take a two-character ascii decimal number from '00' - '99' and convert it to a one-byte binary coded decimal number from $00 - $99 and return it in r5L.
Example:
;this example takes a one or two character number from the
;user (0-99) and converts it to a one-byte BCD number.
lda ParamTable+1 ;did the user enter just
jsr CkTerminators ;one digit? (0-9)
bit goodflag
bmi 10$ ;branch if so.
lda ParamTable+2 ;how about two
jsr CkTerminators ;digits? (00-99)
bit goodflag
bmi 20$ ;branch if so.
jmp NotValid ;do an error message.
;a single digit number is
;handled here.
MoveB ParamTable+0,r8L ;r8L gets the one (2nd) digit.
LoadB r5L,#'0' ;we create the first digit.
beq 30$ ;branch always.
MoveB ParamTable+0,r5L ;load r5L with first digit.
MoveB ParamTable+1,r8L ;load r8L with second digit.
jsr Asc_BCD ;convert to BCD byte.
bit goodflag ;was it a valid number?
bpl 5$ ;branch if not.
... ;continue on...
See Also: Asc_Byte, Asc_3_Byte, ByteNZ_Ascii, ByteWZ_Ascii, ConvertK
@Asc_Byte
Function:
@Asc_Byte
Function: Convert a two digit ascii number to a one byte value.
Pass: r5L - first ascii digit of number '0'-'9'
r8L - second ascii digit of number '0'-'9'
Return: r5L - value of 0-99.
goodflag - set if a valid number and within the allowable range.
Destroys: a
Description: This routine will take a two-character ascii decimal number from '00' - '99' and convert it to a one-byte value and return it in r5L.
Example:
MoveB asciiNum+0,r5L ;load r5L with first digit.
MoveB asciiNum+1,r8L ;load r8L with second digit.
jsr Asc_BCD ;convert to one byte.
bit goodflag ;was it a valid number?
bmi 10$ ;branch if so.
jmp DoError ;display some sort of error.
... ;continue on...
asciiNum:
.byte "58"
See Also: Asc_3_Byte, Asc_BCD, ByteNZ_Ascii, ByteWZ_Ascii, ConvertK
Function: Convert a 16 bit number to an ascii representation of the number with no leading zeros.
Pass: r8 - number to convert.
Return: Asc_String - ascii characters '0' to '65536'.
Destroys: a, x, y, r4, r8
Description: This routine will take the 16 bit value in r8 and convert it to it's ascii decimal representation and put the result of the conversion at Asc_String. Asc_String will also contain a null byte in the sixth character position. If the result is less than five digits, then any leading zeros are replaced by ascii spaces.
Example:
;This example will take the value in r0 and display it to the
;screen at the current cursor position.
ShowValue:
MoveW r0,r8 ;copy r0 to r8.
jsr ByteNZ_Ascii ;convert to a string.
LoadW r0,#Asc_String ;point r0 to the string.
ldy #0 ;point to the left-most digit.
lda (r0),y ;check a digit to see if
cmp #' ' ;it is a space character.
bne 20$ ;branch on the first
;non-space character.
iny ;point to the next one
bne 10$ ;and branch always.
clc ;add the value in y
tya ;to r0.
adc r0L
sta r0L
lda r0H
adc #0
sta r0H
;r0 now points to the
;first non-space character.
lda #TR_CR ;do a carriage return
jmp OtherMessage ;after displaying the string.
See Also: Asc_3_Byte, Asc_Byte, Asc_BCD, ByteWZ_Ascii, ConvertK
@ByteWZ_Ascii
Function: Convert a 16 bit number to a 5 digit ascii representati
@ByteWZ_Ascii
Function: Convert a 16 bit number to a 5 digit ascii representation of the number with leading zeros.
Pass: r8 - number to convert.
Return: Asc_String - five ascii characters containing 00000 to 65536.
Destroys: a, x, y, r4, r8
Description: This routine will take the 16 bit value in r8 and convert it to it's ascii decimal representation and put the result of the conversion at Asc_String. Asc_String will also contain a null byte in the sixth character position. The result will always have five digits, since leading zeros are left in.
Example:
;This example will take the value in r0 and display it to the
;screen at the current cursor position with leading zeros
;remaining.
ShowValue:
MoveW r0,r8 ;copy r0 to r8.
jsr ByteWZ_Ascii ;convert to a string.
LoadW r0,#Asc_String ;point r0 to the string.
lda #TR_CR ;do a carriage return
jmp OtherMessage ;after displaying the string.
See Also: Asc_3_Byte, Asc_Byte, Asc_BCD, ByteNZ_Ascii, ConvertK
@Byte_Time
Function: Convert the time as contained in directory entries to ascii format. (this routine should not be used)
Pass: not applicable
Return: not applicable
@Byte_Time
Function: Convert the time as contained in directory entries to ascii format. (this routine should not be used)
Pass: not applicable
Return: not applicable
Destroys: not applicable
Description: This routine should not be used. The variables that need to be set are only accessible by internal routines. The routine was invariably left in the jump table and should have been removed, or the required variables should have been moved to where they could be accessed by outside routines. For these reasons, only internal geoSHELL routines have proper access to this routine.
Example: no example since this routine is not recommended.
See Also:
@CarrReturn
Function: Perform a
@CarrReturn
Function: Perform a carriage return.
Pass: nothing
Return: cur_line - line that cursor is now on.
cur_X_pos - screen X coordinate of cursor.
cur_Y_pos - screen Y coordinate of cursor.
Destroys: no guarantees
Description: Simply perform a carriage return in the geoSHELL window and the cursor will then be on the next line down. If the cursor was already on the last line, then all the lines will scroll up and the cursor will still be on the last line.
DRVFOUNDON - device number of the drive where file is found.
curDrive - the drive where the file is located is now open.
PRESDRIVE - unchanged
a2 - points to the filename converted to the actual name, any wildcards are converted to the characters they represent.
dirEntryBuf - directory entry for this file.
Destroys: no guarantees
Description: This routine will search all available drives A, B, C, and D for the filename that a2 points at. Upon return, the first thing to test is goodflag. If goodflag is cleared, then the file was not found for whatever reason. If goodflag is set, then the file exists and the drive it is on will be the open drive. PRESDRIVE will still reflect the drive that the user thinks is currently active.
Example:
jsr ParamName ;point a2 at a filename the
;user typed in.
bit goodflag ;is there a filename?
bmi 10$ ;branch if so.
jmp DoError ;display an error.
jsr CkAllDrives ;look for the file.
bit goodflag ;does it exist somewhere?
bpl 5$ ;branch if not.
... ;continue on...
See Also: CkPresdrive, CkThisDrive, CkOtherDrives, CkPathOrder, CkPath, CkForDisk, FindParName
@CkDrvLetter
Function: Tests if the accumulator is holding a value from 97 to 100 ('a', 'b', 'c', 'd') and conv
@CkDrvLetter
Function: Tests if the accumulator is holding a value from 97 to 100 ('a', 'b', 'c', 'd') and converts it to a device number.
Pass: a - with value to test.
Return: goodflag - set if value falls within allowable range.
a - converted to device number 8-11
Destroys: nothing (a is altered however)
Description: This routine can be used by any routine that might work with the drives and gets an input from the user. This will test if a value falls within a range that would equal the ascii value that represents a, b, c, or d. If the accumulator holds a value less than 97 or greater than 100, then the routine will exit through nogood. Otherwise, the routine exits through yesgood and the accumulator will contain a new value from 8-11.
Example:
lda ParamTable+0 ;get the first parameter.
jsr CkDrvLetter ;is this a, b, c, or d?
bit goodflag ;branch if so.
bmi 10$
jmp NotDriveLetter ;go do an error.
... ;accumulator now
... ;holds 8, 9, 10, or 11.
... ;continue processing.
See Also: CkForDisk, ParamName
@CkESC_RULER
Function: Used for advancing a pointer past bytes used with ruler
@CkESC_RULER
Function: Used for advancing a pointer past bytes used with ruler escapes in a GeoWrite document.
Pass: a - value that r0 is pointing at.
Return: * If byte is a ruler escape:
r0 - incremented by the number of bytes used in the ruler.
goodflag - cleared if byte was a ruler escape.
* If byte is not a ruler escape:
a - unchanged.
r0 - unchanged.
goodflag - set if byte was not a ruler escape.
Destroys: If byte is a ruler escape:
a, x
If byte is not a ruler escape:
Description: Here is a routine that geoSHELL uses when processing a startup or exec file. Each byte of the GeoWrite page is sent through this routine to jump past any rulers that might be contained within the file. geoSHELL only needs the actual text that is contained in the file. The text is what makes up the commands. The user is allowed to use different fonts and graphics in a startup file, but geoSHELL doesn't need them. By loading the accumulator with each byte and accessing this routine, the rulers can be stripped from the buffer that the file is loaded into. The 'type' command also makes use of this routine when displaying a GeoWrite file to the screen.
Example:
;this example will strip the rulers from a buffer that a
;GeoWrite page was loaded into and then display it
;within the geoSHELL window. The example AdjustBuffer will work
;because the size of the bytes in the buffer will always
;decrease in size. Refer to DispText for an example on how
;to display this converted text to the screen.
AdjustBuffer:
lda #[ourBuffer ;point r0 and r1
sta r0L ;to the buffer that a
sta r1L ;GeoWrite page is
lda #]ourBuffer ;loaded into.
sta r0H
sta r1H
ldy #0 ;star
sta r1H
ldy #0 ;start y at zero.
lda (r0),y ;get a byte from the buffer.
beq 90$ ;branch if end of text.
jsr CkESC_RULER ;process this byte.
bit goodflag ;do we have a good byte?
bpl 10$ ;branch if not.
sta (r1),y ;store this byte.
iny ;increment to point at the
;next byte.
bne 10$ ;branch if y hasn't not zero.
inc r0H ;otherwise increment the
inc r1H ;high bytes of our pointers.
bne 10$ ;branch always.
rts ;done with this routine.
See Also: AdjTxtPointer, Message, OtherMessage, DsplyLine, DsplyString, CarrReturn, ClearLine, ClearBoth,
Return: goodflag set if the drive contains a formatted disk.
Refer to OpenDisk for other values that are set.
Destroys: no guarantees
Description: This routine performs a simple check to see if a particular drive contains a valid disk that can be read. You might call this routine before processing your command if it requires disk access. This would allow you to inform the user of a 'missing disk' if necessary. The routine jumps through yesgood if a valid disk is found.
Example:
lda ParamTable+0 ;get a parameter from the user.
jsr CkDrvLetter ;convert it to 8-11.
bit goodflag ;was it a, b, c, or d?
bmi 10$ ;branch if so.
jmp DoError ;display an error.
jsr CkForDisk ;does the desired drive have
bit goodflag ;a disk in it?
bmi 20$ ;branch if so.
jsr MissDisk ;do a geoSHELL error routine.
jmp NoMoreCmds ;and quit the command.
... ;otherwise,
... ;continue on...
See Also: CkPresdrive, CkThisDrive, CkOtherDrives, CkPathOrder, CkPath, CkAllDrives, MissDisk, FindParName
@CkKeyboard
@CkKeyboard
Function: Check for CONTROL, STOP and other keys and process accordingly.
Pass: kboardoff - (optional) ignore the keyboard if bit 7 is set, or if clear, continue with CkKeyboard. Set bit 6 to ignore only the STOP key.
Return: y - keycode of the key that is being pressed.
Destroys: a, x, y
Description: This routine is usually used to check for the user pressing the STOP key or the CONTROL key. If the STOP key is pressed when CkKeyboard is called, your command will end and CkKeyboard will exit through NoMoreCmds. If you call CkKeyboard, be sure that the geoSHELL window is still displayed on the screen, otherwise the user will have whatever your command has put on the screen with a blinking cursor somewhere in the middle. Also be sure that InitForIO is not in effect while calling this routine.
If the user presses the CONTROL key during this routine, the routine will simply pause and wait for the user to let go of the CONTROL key and then it will return. If any other key is pressed, the keycode of the key will be returned in the y register.
CkKeyboard should be called whenever your command does something such as displaying a series of scrolling text that the user might want to halt. Just put CkKeyboard somewhere in the loop of your routine. Think about how your command is working and try to imagine if the user might want a way out or a way to pause the output. In that case, use this routine. If your routine is using certain geoSHELL routines, CkKeyboard may already be in use. Test your command to see if the STOP key or CONTROL key is already functioning.
Example:
... ;the bulk of your command.
jsr CkKeyboard ;allow the user a way out.
... ;continue with something here.
bit goodflag ;this might be another way out.
bmi 10$ ;loop back and do it again.
See Also: Wait, YesKeypress, NoKeypress, NoMoreCmds
@CkModeFlag
Function:
@CkModeFlag
Function: Test if a file is compatible with the current mode.
Pass: Load fileHeader with the file's header block.
Return: goodflag - set if file is compatible.
x - pointer to error message if file is not compatible.
Destroys: a, x
Description: geoSHELL uses this routine before it allows a file to be loaded and run. It will check the mode flag in the file's header block which is loaded in at fileHeader. It checks to make sure that the file is configured as being compatible with the mode that the computer is currently running in, whether it be 64, 128, 40 or 80 columns, etc. If the current mode is not compatible with the file, then the routine will exit through nogood and the value in x will be a pointer to a geoSHELL error message that you can display if desired. Otherwise, if goodflag is set, then the file is compatible. See the appendix for a listing of the correct byte to use in the header block for a particular mode.
Example:
;this example will get a filename from the user and check the
;currently active drive for the file and if it is compatible,
;it will continue with whatever it is intending to do.
jsr ParamName ;get a filename.
bit goodflag ;is it valid?
bmi 10$ ;branch if so.
jmp DoError ;display an error.
jsr CkPresdrive ;this will load dirEntryBuf.
bit goodflag ;does the file exist?
bpl 5$ ;branch if not.
jsr GetHeader ;get the file's header block.
;GetHeader doesn't return if
;any error.
jsr CkModeFlag ;check the file's compatibility.
bit goodflag ;well?
bmi 20$ ;branch if OK.
lda #(IN_TWO|TR_CR) ;x points to the error message.
jsr Message ;display the message.
jmp NoMoreCmds ;and quit.
... ;otherwise, continue on...
See Also: GetHeader, Only128, Message, OtherMessage, DoRun
@CkOtherDrives
Function: Search all drives for a file that have not yet been searched.
See Also: GetHeader, Only128, Message, OtherMessage, DoRun
@CkOtherDrives
Function: Search all drives for a file that have not yet been searched.
Pass: a2 -
@CkOtherDrives
Function: Search all drives for a file that have not yet been searched.
Pass: a2 - pointer to a null-terminated filename.
drivesChecked - (4 bytes) identify the drives that should be searched. If zero, then search the drive, if bit 7 is set, then ignore the drive.
Return: goodflag - set if file found.
a2 - now points to the exact name of the file in case the user included wildcards in the filename.
DRVFOUNDON - set to device number of the drive the file was found on.
curDevice and curDrive - the drive the file was found on is now open.
PRESDRIVE - unchanged.
dirEntryBuf - directory entry for file if found.
Destroy: no guarantees
Description: When searching for a file, you can choose the order that you wish to search the drives in. Just load the accumulator with a device number and call CkThisDrive. You can check another drive if desired also. When you've checked the ones that you feel should have priority, and wish to check the remaining ones, just call CkOtherDrives and geoSHELL will proceed to do just that. CkOtherDrives will check four locations at drivesChecked before accessing a drive. If a corresponding byte at drivesChecked is zero, that drive will be searched. The ramdisks get priority here, and then the real drives are tested. By manipulating the bytes at drivesChecked, you can force CkOtherDrives to either check a drive or to ignore it. So, you might want to mark the drives that you have already checked. Otherwise, those drives will get searched again. If all the drives have already been checked, then the routine will return as though the file was not found anyway and goodflag will be cleared.
Example:
;this example will search only drives A and B for a desired file.
jsr ParamName ;get a filename from the user.
bit goodflag ;is it valid?
bmi 10$ ;branch if so.
jmp DoError ;display an error message.
lda #128
sta drivesChecked+2 ;ignore drive C.
lda #128
sta drivesChecked+2 ;ignore drive C.
sta drivesChecked+3 ignore drive D.
lda #0
sta drivesChecked+0 ;allow drive A.
sta drivesChecked+1 ;allow drive B.
jsr CkOtherDrives ;and search them.
bit goodflag
bmi 20$
jmp FileNotAvail ;do a geoSHELL error routine.
... ;file is found,
... ;so continue on...
See Also: CkPresdrive, CkThisDrive, CkAllDrives, CkPathOrder,
CkPath, CkForDisk, FindParName
it 7 is se
@CkPath
Function: Check to see if a file is on the path partition.
Pass: a2 - pointed to a null-terminated filename
Return: goodflag - set if successful.
DRVFOUNDON - contains the device number (8-11) of the path device if successful.
pathload - bit 7 set if successful.
a2 - will point to the null-terminated filename.
path partition - will be left open.
dirEntryBuf - will contain the directory entry for the file.
Destroys: no guarantees.
Description: Call this routine to check the path partition for a desired filename. Check goodflag first after calling this routine. If the file was found on the path partition, then goodflag will be set. Once you have finished with the file, be sure to call ResetFromPath to put the device back to the partition it was in prior to calling this routine. DRVFOUNDON will contain the device number (8-11) of the path device. If a path has not been defined with the path command, or if the defined path does not exist, the routine will exit through nogood.
Example:
jsr CkPath
bit goodflag
bmi 10$
rts ;goodflag will still be zero.
... ;do whatever you need to do
... ;with the file here.
jsr ResetFromPath
jmp yesgood ;tell the calling routine
;that this routine was
;was successful.
@CkPathOrder
Function: Search a path partition for a file, but first check all available ramdisks, then the path partition, and then all remaining drives.
@CkPathOrder
Function: Search a path partition for a file, but first check all available ramdisks, then the path partition, and then all remaining drives.
Pass: a2 - pointer to a null-terminated filename.
Return: goodflag - set if file is found.
DRVFOUNDON - contains the device number (8-11) of the device the file is found on.
curDevice and curDrive - drive file is found on will be open.
PRESDRIVE - unchanged.
pathload - bit 7 set if file is found on the path partition.
a2 - will point to the null-terminated filename with any wildcards converted to the characters they represent.
dirEntryBuf - will contain the directory entry for the file.
Destroys: no guarantees.
Description: This routine will search all available drives for a file, including the path partition. The ramdisks get checked first, then the path partition gets the next priority, and then all remaining drives will be searched. As soon as the file is found, the search will end through yesgood and the drive the file is found on will be open. If the file is not found, then the routine will exit through nogood and the currently active drive as the user sees it will remain the open drive.
Example:
... ;a2 already points to a filename.
jsr CkPathOrder ;search for the file, including
;the path partition.
bit goodflag ;did we find the file?
bmi 10$ ;branch if so.
jmp FileNotAvail ;do a geoSHELL error routine.
... ;file is found,
... ;so continue on...
... ;before finishing, be sure to
... ;close the path partition.
jsr ResetFromPath ;in case the file was found
;on the path partition.
ldx NUM_IN_NAME ;how big was the filename?
inx ;add one for a space.
;on the path partition.
ldx NUM_IN_NAME ;how big was the filename?
inx ;add one for a space.
txa ;put in in a.
jsr IncCmdPointer ;and point the command pointer
;past our command.
jmp ExitCommand ;exit cleanly.
See Also: CkPresdrive, CkThisDrive, CkOtherDrives, CkAllDrives, CkPath, CkForDisk, FindParName
@CkPresdrive
Function: Check the currently active drive for a file.
Pass: a2 - null terminat
@CkPresdrive
Function: Check the currently active drive for a file.
Pass: a2 - null terminated filename.
Return: goodflag - set if file is found.
DRVFOUNDON - device number of the current drive where file is found.
curDrive - the current drive where the file is located is now open.
PRESDRIVE - unchanged (the current drive)
a2 - points to the filename converted to the actual name, any wildcards are converted to the characters they represent.
dirEntryBuf - directory entry for this file.
Destroys: no guarantees
Description: This routine will search the currently active drive for the filename that a2 points at. Upon return, the first thing to test is goodflag. If goodflag is cleared, then the file was not found for whatever reason. If goodflag is set, then the file exists on the drive.
Example:
jsr ParamName ;point a2 at a filename the
;user typed in.
bit goodflag ;is there a filename?
bmi 10$ ;branch if so.
jmp DoError ;display an error.
jsr CkPredrive ;look for the file.
bit goodflag ;does the file exist?
bpl 5$ ;branch if not.
... ;continue on...
See Also: CkAllDrives, CkThisDrive, CkOtherDrives, CkPathOrder, CkPath, CkForDisk, FindParName
@CkTerminators
Function: Check if the value is one of the geoSHELL text terminators.
Pass: a - value to test.
Return: a - unchanged.
goodflag - set if a terminator
Destroys: not
@CkTerminators
Function: Check if the value is one of the geoSHELL text terminators.
Pass: a - value to test.
Return: a - unchanged.
goodflag - set if a terminator
Destroys: nothing
Description: This will test the value in the accumulator and return through nogood or yesgood depending on the value. If the value is either a space, an up-arrow, a CMDR up-arrow or a null byte, then goodflag will be set because it will exit through yesgood. The catch here is that a space character will also be considered a valid terminator by this routine. geoSHELL uses this because a command with no parameters may be terminated by a space. If you wish to test for a terminator and ignore a space, then use CkTermNoSpace.
Example:
LoadW r0,#textBuffer ;point at our buffer.
ldy #0
lda (a4),y ;get a byte from input.
jsr CkTerminators ;find the first space
bit goodflag ;or end of parameter.
bmi 20$ ;branch if terminator.
sta (r0),y ;otherwise store byte.
iny ;point y at next byte.
cpy #80 ;let's limit to 80 bytes.
bne 10$ ;loop back for more.
iny ;point at next byte
tya ;transfer value to a.
jsr IncCmdPointer ;set for the next command
;in line after ours.
... ;now do what we want with
... ;the text in our buffer.
See Also: CkTermNoSpace
@CkTermNoSpace
Function: Check if the value is one of the geoSHELL text terminators except for a space.
Pass: a -
@CkTermNoSpace
Function: Check if the value is one of the geoSHELL text terminators except for a space.
Pass: a - value to test.
Return: a - unchanged.
goodflag - set if a terminator.
Destroys: nothing
Description: This will test the value in the accumulator and return through nogood or yesgood depending on the value. If the value is either an up-arrow, a CMDR up-arrow or a null byte, then goodflag will be set because it will exit through yesgood.
Example:
ldx #0
lda ParamTable,x ;get a byte from ParamTable.
jsr CkTermNoSpace ;check if a terminator?
bit goodflag ;well?
bmi 20$ ;branch if end of parameter.
inx ;point at the next byte.
cpx #16 ;let's only allow 16 bytes.
bne 10$ ;loop back for more, maybe.
jmp DoError ;do an error of some sort.
inx ;point just past our
txa ;parameter,
jsr IncCmdPointer ;at the next command.
... ;and continue on...
See Also: CkTerminators
@CkThisDrive
Function: Check a drive for a file.
Pass: a2 - null terminated filename.
a - device number (8-11) of drive to search.
Return: goodflag - set if file is found.
DRVFOUNDON - device number of th
@CkThisDrive
Function: Check a drive for a file.
Pass: a2 - null terminated filename.
a - device number (8-11) of drive to search.
Return: goodflag - set if file is found.
DRVFOUNDON - device number of the drive if file is found.
curDrive - the drive if file is found, is now open.
PRESDRIVE - unchanged
a2 - points to the filename converted to the actual name, any wildcards are converted to the characters they represent.
dirEntryBuf - directory entry for this file.
Destroys: no guarantees
Description: This routine will search a specific drive for the filename that a2 points at. Upon return, the first thing to test is goodflag. If goodflag is cleared, then the file was not found for whatever reason. If goodflag is set, then the file exists and the desired drive will be the open drive. PRESDRIVE will still reflect the drive that the user thinks is currently active.
Example:
;this example will use a drive specifier that the user types in,
;plus a filename also entered by the user and then check the
;desired drive for that file.
;the command might look like: command b filename
lda ParamTable+0 ;get the first parameter
;from the user.
jsr CkDriveLetter ;convert it to a device number.
bit goodflag ;is it a device number?
bpl 5$ ;branch if not.
sta devNum ;save it for now.
lda #2 ;point past the drive
jsr IncCmdPointer ;specifier.
jsr ParamName ;and get the filename the
;user typed in.
bit goodflag ;is there a filename?
bmi 10$ ;branch if so.
jmp DoError ;display an error.
lda devNum
jsr CkThisDrive ;look for the file.
bit goodflag ;does it exist?
bpl 5$ ;branch if not.
... ;continue on...
devNum:
lda devNum
jsr CkThisDrive ;look for the file.
bit goodflag ;does it exist?
bpl 5$ ;branch if not.
... ;continue on...
devNum:
.block 1
See Also: CkPresdrive, CkAllDrives, CkOtherDrives, CkPathOrder, CkPath, CkForDisk, FindParName
@ClearBoth
Function: Clear the current line on the screen and in the memory buffer.
Pass: nothing
Return: nothing
Destroys: a, x, r0, r1, r2L, r11
Description
@ClearBoth
Function: Clear the current line on the screen and in the memory buffer.
Pass: nothing
Return: nothing
Destroys: a, x, r0, r1, r2L, r11
Description: geoSHELL maintains an internal buffer that represents the characters that the user sees in the geoSHELL window. This is how geoSHELL is able to restore a window when switching screens, for instance, or returning from a Desk Accessory. If your command intends to work directly with the data that is on the screen as well as the data in the buffer, you can clear both the current line that the cursor is on as well as the internal memory buffer that corresponds to it by calling this routine. Normally, there is no need to work directly like this. geoSHELL does a pretty good job of maintaining the text and buffers while your command can do other things.
Function: Clear the current line in the geoSHELL window.
Pass: r1H - vertical pixel location set by calling set_XY_pos.
Return: nothing
Destroys: nothing
Description: This is mostly an internal routine for clearing the current line in the geoSHELL window. It does not clear the corresponding memory buffer.
Function: Clear the window below the current cursor position.
Pass: nothing
Return: nothing
Destroys: a, r1H, r11
Description: If your command displays a series of text to the window, you may desire to clear all text below the current cursor position for a cleaner display. The 'type' command does this as well as some other commands. This makes it easier for the user to read what it being put on the screen. The internal buffers are not cleared, only the visible text on the screen. As new text is added (through the normal geoSHELL text displaying routines), it will show up on the screen and also replace what is in the memory buffers.