Creating GEOS Files:
It is important that all GEOS programs have an information
sector. Therefore, to create GEOS programs, it is suggested that
a small BASIC-Assembly language shell be added to the beginning
of a user's program. This shell will consist of a BASIC SYS
statement and some assembly code to delete the file (Use DeleteFile)
and resave the file as a GEOS file (Use SaveFile). After having
done this, for completeness, the info sector that is in memory
should be rewritten because SaveFile will clear the text field.
Also the directory should be modified to include the proper time
and date of file creation (Use FindFile and PutBlock). After all
this has been done, a call to FirstInit and EnterDesktop will
restart GEOS. The CONVERT program by BSW does not convert itself
in this way. It is designed so that the information sector is
exactly in the last disk sector of the file. It then modifies the
sector links of the last two sectors and changes the directory
entry for convert. This leaves the conversion code as part of
the final program; the method outlined above does not. Another
possibility is to use the same method as BSW, but to make the info
sector the first sector after the initial shell. Then only 1 sector
and the directory need be modified, and sectors for the shell
program can be freed up. This is all up to a user's discretion.
Creating CBM-style GEOS programs:
If a program with a BASIC start (10 SYS2061), is to use GEOS
it must first disable interrupts (SEI) and then set the system to
all RAM by loading location $01 with a value of $30. This is
important because GEOS resides beneath the Commodore's ROMs and
I/O section. When GEOS needs to do I/O, it switches in the I/O
ports, relieving the user of this burden. Also a call to FirstInit
will set things up so that the GEOS graphic screen is displayed.
Simple Applications:
Application programs have everything set up for them before
they are run. To terminate an application properly, a EnterDesktop
is made at some point. If the program is simply a menu, like
Convert, then a call to DoMenu and an RTS is sufficient to be the
main body of code. One of the menu options should make the jump
to EnterDesktop. More on that RTS later.