geoSHELL uses a fair amount of memory in it's operation and does not leave a great deal for you to use with your command. However with some thought and making use of geoSHELL resources, you will find that you do not need much memory to do even complex tasks. The smaller your command, the faster you will create it anyway. And perhaps, the more commands you will be able to create, also.
Even still, there is almost 6K of programming space that you are free to use for your command. This is sufficient for all but the largest of commands. The command 'fcopy' works well with this amount of memory and even includes it's transfer buffer in this space. The 'type' command works just fine in this space also, including the area it uses for it's text buffer. Usually when a command needs more room than this, it will be because it needs a larger area for a buffer, rather than for program code. The 'dcopy' command likes a big buffer. The bigger, the better. For this reason, it will use the area from $a000 to $a000+8000, the area occupied by the 40 column foreground screen. If you've ever used the dcopy command in 40 column mode, you've noticed that it blanks the screen all except for enough room at the bottom to display a message to the user. With both the foreground and background colors being the same, the user is unaware of all the activity going on with the screen memory.
Your command is always loaded in at $6800 and is jumped to at that address. Obviously, if you make use of a GEOS printer driver, you will have to limit yourself to the area from $6800-$78ff, since the printer driver will load in at $7900. Otherwise, your program code may extend on up to $7f3f. You are free to use the area up to $7fff but geoSHELL won't allow your command to load if it is large enough to fill the area between $7f40 and $7fff. This should have been changed as geoSHELL was being developed, but it never was, and this oversight wasn't discovered until this manual was being put together. Normally, this shouldn't be a problem, since most commands need some free space just for variable storage.
In looking through this listing of memory that geoSHELL uses, you might find a byte here and a byte there that you can use. You might even find a whole page of memory here or there. And there will be locations outside of your command that you will be using anyway.
Here is a simplified memory map of geoSHELL:
$0400 - $10ff Variable Storage Area
$1100 - $16ff Startup Buffer
$1700 - $1846 Jump Table
$1847 - $66ff The geoSHELL main code. Do not attempt to alte
Here is a simplified memory map of geoSHELL:
$0400 - $10ff Variable Storage Area
$1100 - $16ff Startup Buffer
$1700 - $1846 Jump Table
$1847 - $66ff The geoSHELL main code. Do not attempt to alter any of this area.
$6700 - $67ff EnOfShell - Routines that read a drive's error channel use this area. Free for use at any other time.
$6800 - $7fff Transient Command Area
It is not really necessary to know the actual location of any variable or routine since everything available in geoSHELL can be accessed with a label. All of the labels are listed in this document with explanations of their uses and are available when you link the file GSVariables.rel with your source code. The variables are also defined for you in this appendix. You might also wish to study the file ShellEquates to discover some of the equates that are available to you when creating your source code. Some of these equates and the available variables are discussed throughout the descriptions of the geoSHELL routines. You should become familiar with these equates and variables and use them to your advantage.
On the 128, geoSHELL uses only front ram (bank 1) so that you are free to use whatever back ram is not being used by the GEOS kernal as needed.
geoSHELL doesn't care if your command uses any of the zero page locations, r0-r15. You will just have to keep track of what routines in geoSHELL and the GEOS kernal might trash any of these that you are using. If necessary, use PushStuff and PopStuff to preserve these when needed.
Also, some of the registers from a0 through a9 are available. Two of them are used heavily by geoSHELL and your command, a2 and a4. Normally, you will let geoSHELL manage a4 for you. a4 is the command pointer. It is always pointing at the current parameter that is being used or the next command that will be used. a2 is the universal filename pointer. Here is the list of the a0-a9 registers:
a0 geoSHELL's user input buffer pointer. (not a good idea to mess with this one)
a1 not used.
a2 universal filename pointer.
a3 not used.
a4 command pointer. (use this properly)
a5 used by time and directory routines.
a6 used by time and directory routines.
a7 not used.
a8 used by directory routines.
a9 not used.
As you can see, there are plenty of free zero page registers that you can use as needed.
One of the geoSHELL variables that you should remember about
is called 'PRESDRIVE'.
is called 'PRESDRIVE'. This variable holds the device number of
the currently active drive that the user thinks he is working from. In other words, if the drive letter on the screen looks like this...
...then PRESDRIVE will contain the value 9. None of the routines that geoSHELL uses for searching the different drives will alter PRESDRIVE. This way, any drive can be accessed by your routine and the user will still keep the same drive as his current one. geoSHELL let's the user control which drive is the currently active one. He can change it by entering a letter followed by a colon. If do have a need to change the currently active drive, then simply change the value in PRESDRIVE. Just make sure that the drive is online before doing so.
This is a listing of all the variables that will always be available, even in future versions of geoSHELL. They begin at StOfRamsect ($0400) and e
This is a listing of all the variables that will always be available, even in future versions of geoSHELL. They begin at StOfRamsect ($0400) and end at EnOfRamsect ($16ff). Actually, the last $0600 bytes of this area is the startup buffer.
StOfRamsect: ;used as a reference point for
;initializing this area.
screenmode: .block 1 ;current mode of the machine
;that is being used.
;#%10000000 =80 column 128
;#%00000000 =40 column 128
;#%01000000 =64
PRESDRIVE: .block 1 ;device number of the currently
;active drive as seen by
;the user.
goodflag: .block 1 ;universal success/error flag.
DRVFOUNDON: .block 1 ;drive a file is found on.
STUPMODE: .block 1 ;bit7 set =startup or exec mode.
FKEYMODE: .block 1 ;bit7 set =function key mode.
NUM_IN_NAME: .block 1 ;number of characters in a
;filename.
ParamTable: .block 44 ;table that holds the parameter
;for a command.
comchars: .block 1
cur_Y_pos: .block 1 ;current vertical pixel position
;of cursor.
cur_X_pos: .block 2 ;current horizontal pixel
;position of cursor.
cur_line: .block 1 ;current line (0-11) of cursor.
cur_char: .block 1 ;current character (0-39 or 0-79)
;position of cursor.
tempFileName: .block 17 ;temporary storage.
curTransName: .block 17 ;transient command that is
;currently in memory.
scrnwidth: .block 1 ;40 or 80.
domessages: .block 1 ;a zero here will prevent
;messages from being displayed.
;bit 7 set will allow messages.
cur_keyData: .block 1
CMD_POINTER: .block 1 ;normally zero during execution
;of a command. Leave this alone.
tempDrive: .block 1 ;temporary storage used for
;status and directory displays.
typeset: .block 1 ;used by DispText.
cmpwidth: .block 1 ;used by DispText.
paramsize: .block 1 ;holds the size of the parameter
;that is loaded in ParamTable.
pathload: .block 1 ;this is set to 128 when a
;file is found on the
;specified path partition.
Asc_String: .block 6 ;ascii decimal strings are
;built here.
endecho: .block 1 ;used by DispText.
sourceType: .block 1 ;used by copy commands.
destType: .block 1 ;used by copy commands.
sourceDrive: .block 1 ;used by copy commands.
destDrive: .block 1 ;used by copy commands.
sourcePartition: .block 1 ;used by copy commands.
destP
destType: .block 1 ;used by copy commands.
sourceDrive: .block 1 ;used by copy commands.
destDrive: .block 1 ;used by copy commands.
sourcePartition: .block 1 ;used by copy commands.
destPartition: .block 1 ;used by copy commands.
;the custom command saves the following locations from StOfDefs
;to EnOfDefs to the geoSHELL file on disk.
StOfDefs:
videomode: .block 1 ;used only for 80 columns.
;0 = monochrome
;128 = color
distype: .block 1 ;used by 'ddate' and 'dtype'.
fastdirectory: .block 1 ;used by 'fast' and 'slow'.
back40pattern: .block 1 ;default background pattern for
;40 column.
back80pattern: .block 1 ;default background pattern for
;80 column.
clr80pattern: .block 1 ;default background pattern for
;80 column RGB mode.
.block 3 ;these bytes are unused.
curPrinter: .block 1 ;printer device number 4 or 5.
curSecond: .block 1 ;printer secondary address.
crtextstring: .block 3
curCharSet: .block 1 ;character set to send to
;printer when @p or @g is used.
; 0 = Ascii
;128 = PetAscii
.block 10 ;reserved for future use...
EnOfDefs:
TrRtnLAddr: .block 16 ;do not mess with this!
TrRtnHAddr: .block 16 ;do not mess with this!
.block 4 ;reserved for future use.
RAMLINK: .block 1 ;the real device number for
;RamLink or RamDrive is set
;here after a call to
;FindRamlink. This is
;normally only needed if there
;is a RAM1581 used.
cmdtype: .block 3 ;contains FD,HD,RD, or RL.
cmdtype: .block 3 ;contains FD,HD,RD, or RL.
;cmdtype+2 can be from 1-4
;1=FD drive
;2=HD
;3=RD
;4=RL
KeyBuffStart:
Key1Buff: .block 81 ;buff_size =81
Key2Buff: .block 81 ;each buffer here holds
Key3Buff: .block 81 ;a function key definition.
Key4Buff: .block 81
Key5Buff: .block 81
Key6Buff: .block 81
Key7Buff: .block 81
Key8Buff: .block 81
restartbyte: .block 1
CmdNumber: .block 1
zeroflag: .block 1
hotkeycommand: .block 2
top_rectangle: .block 1
bot_rectangle: .block 1
left_rectangle: .block 2
right_rectangle: .block 2
temp_line: .block 1
temp_check: .block 1 ;used for temporary storage of
;a, x, or y registers.
ck_year: .block 1
ck_month: .block 1
ck_day: .block 1
ck_hour: .block 1
ck_minute: .block 1
CMD_COUNT: .block 1
lastblock: .block 2
filesiz: .block 2
lstbyte: .block 2
headlocation: .block 6
FIRSTDRIVE: .block 1
DRIVECHECK: .block 1
foundtrans: .block 1
inserty: .block 1
stparsize: .block 1
scancheck: .block 1
check_key: .block 1
nosearchmessage: .block 1
saver0: .block 2
numfillbytes: .block 1
numfillcopies: .block 1
numfillstrings: .block 1
stringlocation: .block 2
dublclickspot: .block 1
drivesChecked: .block 4
PRNTMODE: .block 1 ;bit 7 set =send output to the
;serial printer in addition to
;the screen.
;bit 6 set =send output to the
;geoCable.
strtoprint: .block 2 ;temporarily save r0 here until
;ready to send the string that
;it points at to the printer.
savex: .block 1 ;temp storage for x.
line_count: .block 1
cursorStatus: .block 1 ;bit 7 set means cursor is
;inverted.
;cleared means cursor is normal.
cursorOn: .block 1 ;high bit set means cursor is
;active.
;clear means cursor is inactive.
st_keyData: .block 1
reg24: .block 1
gs_stack: .block 256
stackpointer: .block 1
stupsequence: .block 1
ActHWide: .block 1
ActLeft: .block 1
svkeyVector: .block 2
Dir_Entry: .block 2
Dir_Type: .block 1
StripZFlag: .block 1
ParentName: .block 17
PermName: .block 17
DiskName: .block 17
filetoload: .block 17
WILDCARD: .block 1
DRV_CKD: .block 1
FILECOUNTER: .block 1
NxtBlock: .block 2
X_PARAM: .block 2
Y_PARAM: .block 1
MoveXTable: .block 2
MoveYTable: .block 2
NOSPACE: .block 1
stackReturn: .block 2
stripStack: .block 1
NMCreturn: .block 2
DISPBUFFER: .block 84
WrModeFlag: .block 1
test1string: .block 17
test2string: .block 17
clrlineflag: .block 1
clearcount: .block 1
messflag: .block 1
msgchars: .block 1
messlocation: .block 2
horizcount: .block 1
kboardoff: .block 1
tempr0: .block 2
gstructype: .block 1
gfiletype: .block 1
cfiletype: .block 1
texttrsc: .block 2
nozero: .block 1
gscolcount: .block 1
headcolor: .block 1
colbyte: .block 1
staddress: .block 2
clickspot: .block 1
tempy:
gfiletype: .block 1
cfiletype: .block 1
texttrsc: .block 2
nozero: .block 1
gscolcount: .block 1
headcolor: .block 1
colbyte: .block 1
staddress: .block 2
clickspot: .block 1
tempy: .block 1 ;temp storage of y register.
.block 16 ;currently unused.
TrRtnNum: .block 1
tcomnum: .block 1
pathcheck: .block 1
REALDRIVE: .block 1
cmdlength: .block 1
curparnum: .block 1
curpartype: .block 1
curdrvtype: .block 1
errorck: .block 1
partdir: .block 1
syscount: .block 1
cmdtosend: .block 1
lastck: .block 1
runorprint: .block 1
textpointer: .block 1
interpret: .block 1
endoftext: .block 2 ;this contains the byte past
;the last byte read in.
txttype: .block 1 ;0=SEQfile (CBM or GEOS)
;1=SCRAPfile (Text Scrap)
;2=WRITEfile (GeoWrite file)
;3=VLIRfile (but not GeoWrite)
;4=ALBUMfile (text album)
nextbatch: .block 2
ovrflbyte: .block 1
curpage: .block 1
scrcode: .block 2
asciicode: .block 2
petcode: .block 2
cur_table: ;variables defining the
;location and size of the
;geoSHELL window.
lft_shell: .block 2 ;left position word
;(0-319 or 0-639).
rht_shell: .block 2 ;right position word
;(0-319 or 0-639).
left_shell: .block 1 ;left position of window on
;screen in bytes.
wid_shell: .block 1 ;width of the bitmap in bytes.
lft_window: .block 2
rht_window: .block 2
col0: .block 2
rht_column: .block 2
en_cur_table:
;the internal memory buffers holding a copy of the text
;that appears on the screen for each line in the geoSHE
rht_window: .block 2
col0: .block 2
rht_column: .block 2
en_cur_table:
;the internal memory buffers holding a copy of the text
;that appears on the screen for each line in the geoSHELL
;window, lines 0-11.
buff_0: .block 81
buff_1: .block 81
buff_2: .block 81
buff_3: .block 81
buff_4: .block 81
buff_5: .block 81
buff_6: .block 81
buff_7: .block 81
buff_8: .block 81
buff_9: .block 81
buff_10: .block 81
buff_11: .block 81
.block 3 ;extra added here to
;protect bufmem10.
;copies of the ten most recent command line strings.
bufmem10: .block 80
bufmem9: .block 80
bufmem8: .block 80
bufmem7: .block 80
bufmem6: .block 80
bufmem5: .block 80
bufmem4: .block 80
bufmem3: .block 80
bufmem2: .block 80
bufmem1: .block 80
CmdBuffer: .block 82
.block 10 ;currently unused.
StUpBuffer: .block $0600 ;buffer for startup
;and exec files.
EnOfStUpBuffer:
EnOfRamsect:
staddress: .block 2
clickspot: .block 1
tempy: .block 1 ;temp storage of y register.
'ddate' and 'dtype
@THE JUMP TABLE
Here is a list of all the available routines that are easily accessible in geoSHELL through it's jump table. The jump table begins at $1700. These routines are listed in the order as they appear in the jump table. For a complete description of each routine, refer to section 2 of this manual.