home *** CD-ROM | disk | FTP | other *** search
- (* GEMDOS.PAS
- Written by Jinfu Chen
- Copyright @ Jan, 1987 *)
-
- (* An included file for GEMDOS definition in Personal Pascal.
- Portion of this file is copyright by OSS and CCD, 1986, used
- by permission of OSS.
-
- I finally decide to do this after creating some GEMDOS files
- for several programs again and again. This file is not a
- program, it is basically a collection of ALL GEMDOS calls.
- Efforts have been made to make the calling convention consistent
- with Atari's in C since there are many C source codes available
- in public domain.
-
- The major references are Abacus's Atari ST Internals and Atari's
- GEMDOS Reference Manual. I haven't tested all the calls extesively
- so use of these calls are on your own risk. Bugs report can be
- sent to:
-
- Jinfu Chen
- 41 Riverbend Drive
- Yarmouth, ME04096
-
- BBS : MANIAC BBS, 207-854-2687
- GEnie J.CHEN
- CompuServe [72327,2434]
-
- *)
-
- (* In order to use the routines, we have to define some constants and
- types and they have to be included as a seperate file.
- *)
-
- PROCEDURE Pterm0 ;
- GEMDOS($00) ;
- (* Terminate Process *)
-
- FUNCTION Cconin : LONG ;
- GEMDOS($01) ;
- (* Read character from Standard Input *)
- (* format :
- 31..24 bits $00 or shift bytes
- 23..16 bits scancode or $00
- 15..8 bits $00
- 7..0 bits ASCII
- *)
-
- PROCEDURE Cconout( outchar : WORD ) ;
- GEMDOS($02) ;
- (* Write character to Standard Output *)
-
- FUNCTION Cauxin : WORD ;
- GEMDOS($03) ;
- (* Read character from Standard AUX *)
-
- PROCEDURE Cauxout( outchar : WORD ) ;
- GEMDOS($04) ;
- (* Write character to Standard AUX *)
-
- PROCEDURE Cprnout( outchar : WORD ) ;
- GEMDOS($05) ;
- (* Write character to Standard PRN *)
-
- FUNCTION Crawio( VAR iochar : WORD ) : LONG ;
- GEMDOS($06) ;
- (* Raw I/O to Standard Input/Output *)
-
- FUNCTION Crawin : LONG ;
- GEMDOS($07) ;
- (* Raw Input from Standard Input *)
-
- FUNCTION Cnecin : LONG ;
- GEMDOS($08) ;
- (* Read character from Standard Input, No Echo *)
-
- PROCEDURE Conws( VAR outstr : CSTRING ) ;
- GEMDOS($09) ;
- (* Write string to Standard Output *)
- (* String has to be in C format ! *)
-
- PROCEDURE Cconrs( VAR buf : edit_str ) ;
- GEMDOS($0A) ;
- (* Read Edited String from Standard Input *)
- (* According to GEMDOS manual, the first byte of the string is the maximum
- size of the input line and has to be initialized. In Pascal string type,
- buf[0] is just the one we need here. The second byte, buf[1], is the
- actual size of the string read from keyboard and the string starts from
- buf[2]
- *)
-
- FUNCTION Cconis : BOOLEAN ;
- GEMDOS($0B) ;
- (* Check Status of Standard Input *)
-
- FUNCTION Dsetdrv( drive : WORD ) : LONG ;
- GEMDOS($0E) ;
- (* Set Default Drive *)
- (* Don't know why GEMDOS asks 16 bit data for selected drive id and return
- 32 bit data for the 'old' drive id. Stupid heh? *)
-
- FUNCTION Cconos : BOOLEAN ;
- GEMDOS($10) ;
- (* Check Status of Standard Output *)
-
- FUNCTION Cprnos : BOOLEAN ;
- GEMDOS($11) ;
- (* Check Status of Standard PRN *)
-
- FUNCTION Cauxis : BOOLEAN ;
- GEMDOS($12) ;
- (* Check Status of Standard AUX: Input *)
-
- FUNCTION Cauxos : BOOLEAN ;
- GEMDOS($13) ;
- (* Check Status of Standard AUX: Output *)
-
- FUNCTION Dgetdrv : WORD ;
- GEMDOS($19) ;
- (* Get Default Drive *)
-
- PROCEDURE Tsetdta( VAR addr : dta ) ;
- GEMDOS($1A) ;
- (* Set DTA( Disk Transfer Address) *)
- (* Used by Fsfirst, Fsnext *)
-
- FUNCTION Super( stack : LONG ) : LONG ;
- GEMDOS($20) ;
- (* Get/Set/Inquire Supervisor Mode *)
-
- FUNCTION Tgetdate : WORD ;
- GEMDOS($2A) ;
- (* Get Date *)
-
- FUNCTION Tsetdate( date : WORD ) : WORD ;
- GEMDOS($2B) ;
- (* Set Date *)
-
- FUNCTION Tgettime : WORD ;
- GEMDOS($2C) ;
- (* Get Time *)
-
- FUNCTION Tsettime( time : WORD ) : WORD ;
- GEMDOS($2D) ;
- (* Set Time *)
-
- FUNCTION Fgetdta : LONG ;
- GEMDOS($2F) ;
- (* Get DTA( Disk Transfer Address ) *)
-
- FUNCTION Sversion : WORD ;
- GEMDOS($30) ;
- (* Get Version Number *)
- (* High byte is minor number and low byte is major number. For TOS in ROM, it
- should return $1300 ==> 0.19 (?), no wonder GEM is buggy *)
-
- PROCEDURE Ptermres ( keepcnt : LONG ; VAR retcode : WORD ) ;
- GEMDOS($31) ;
- (* Terminate and Stay Resident *)
-
- PROCEDURE Dfree( VAR buf : DRIVE_ARRAY ; driveno : WORD ) ;
- GEMDOS($36) ;
- (* Get Drive Free Space *)
- (* Some Information :
- buf[1] : number of free clusters ;
- buf[2] : total number of clusters ;
- buf[3] : sector size in bytes ;
- buf[4] : cluster size in butes.
- *)
-
- FUNCTION Dcreate( VAR pathname : CSTRING ) : WORD ;
- GEMDOS($39) ;
- (* Create Directory *)
-
- FUNCTION Ddelete( VAR pathname : CSTRING ) : WORD ;
- GEMDOS($3A) ;
- (* Delete Directory *)
-
- FUNCTION Dsetpath( VAR pathname : CSTRING ) : WORD ;
- GEMDOS($3B) ;
- (* Set Current Directory *)
- (* Typos in Atari ST Internal, filename should proceeded with a backslash
- '\' instead of slash '/' *)
-
- FUNCTION Fcreate( VAR fname : CSTRING ; sttribs : WORD ) : WORD ;
- GEMDOS($3C) ;
- (* Create File *)
-
- FUNCTION Fopen ( VAR fname : CSTRING ; mode : WORD ) : WORD ;
- GEMDOS($3D) ;
- (* Open File *)
-
- FUNCTION Fclose( handle : WORD ) : WORD ;
- GEMDOS($3E) ;
- (* Close File *)
-
- FUNCTION Fread( handle : WORD ; count : LONG ; VAR buffer : buf_type ) : WORD ;
- GEMDOS($3F) ;
- (* Read from File *)
- (* define your own buf_type, not necessory as in my example. Read OSS's doc
- for more details *)
-
- FUNCTION Fwrite(handle : WORD ; count : LONG ; VAR buffer : buf_type ) : WORD ;
- GEMDOS($40) ;
- (* Write to File *)
- (* define your own buf_type, not necessory as in my example. Read OSS's doc
- for more details *)
-
- FUNCTION Fdelete( VAR fname : CSTRING ) : WORD ;
- GEMDOS($41) ;
- (* Delete File *)
-
- FUNCTION Fseek( offset : LONG ; handle, seekmode : WORD ) : LONG ;
- GEMDOS($42) ;
- (* Seek File Pointer *)
-
- FUNCTION Fattribs(VAR fname : CSTRING ; wflag : WORD ;
- VAR attribs : WORD) : WORD ;
- GEMDOS($43) ;
- (* Get/Set File Attributes *)
-
- FUNCTION Fdup( handle : WORD ) : WORD ;
- GEMDOS($45) ;
- (* Duplicate File Handle *)
-
- FUNCTION Fforce( stdh, nonstdh : WORD ) : WORD ;
- GEMDOS($46) ;
- (* Force File Handle *)
-
- PROCEDURE Dgetpath( VAR buf : CSTRING ; driveno : WORD ) ;
- GEMDOS($47) ;
- (* Get Current Directory *)
-
- FUNCTION Malloc( VAR amoutn : LONG ) : LONG ;
- GEMDOS($48) ;
- (* Allocate Memory *)
-
- FUNCTION Mfree( saddr : LONG ) : WORD ;
- GEMDOS($49) ;
- (* Release Memory *)
-
- FUNCTION Mshrink( block, newsize : LONG ) : WORD ;
- GEMDOS($4A) ;
- (* Shrink Size of Allocated Block *)
- (* PASLIB takes care of the first zeri argument already *)
-
- FUNCTION Pexec( mode : WORD ; VAR ptr1, ptr2, ptr3 : CSTRING ) : WORD ;
- GEMDOS($4B) ;
- (* Load/Execute Process *)
- (* Brief information:
-
- Mode Ptr1 Ptr2 Ptr3
- ---------------------------------------------------------------------------
- 0 = Load & Go file to execute command trail enviroment string
- 3 = Load, no go file to load command trail enviroment string
- 4 = Just go unused unused basepage address
- 5 = Create basepage unused command trail enviroment string
- ---------------------------------------------------------------------------
-
- *)
-
- PROCEDURE Pterm( VAR reccode : WORD ) ;
- GEMDOS($4C) ;
- (* Terminate Process *)
-
- FUNCTION Ffirst( VAR fspec : CSTRING ; attribs : WORD ) : WORD ;
- GEMDOS($4E) ;
- (* Search First *)
-
- FUNCTION Fsnext : WORD ;
- GEMDOS($4F) ;
- (* Search Next *)
-
- FUNCTION Frename( VAR oldname, newname : CSTRING ) : WORD ;
- GEMDOS($56) ;
- (* Rename File *)
-
- PROCEDURE Fdatime( VAR timeptr : LONG ; handle, wflag : WORD ) ;
- GEMDOS($57) ;
- (* Get/Set File Timestamp *)
-
- (* END of GEMDOS.PAS *)
-