home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1987-08-17 | 4.5 KB | 160 lines |
- DEFINITION MODULE System;
-
- (* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)
-
- (*
- This module contains definitions that are SYSTEM DEPENDENT.
- This version is for the IBM PC running DOS >= 2.0.
- *)
-
- FROM SYSTEM IMPORT WORD, ADDRESS;
-
-
- (*** FOR EXCLUSIVE USE OF M2LINK. DO NOT TOUCH! ***)
- VAR
- Main, ProfStart, ProfEnd :PROC;
-
-
- (*** START OF EXPORTED STUFF: ***)
-
- TYPE
- MemoryModel = ( tiny, small, compact, medium, large, huge );
-
- VAR
- MemModel :MemoryModel; (* mem model used to compile/link this pgm *)
- DOSVersion :CARDINAL; (* DOS version * 100 *)
- PSP :CARDINAL; (* paragraph pointer to DOS program prefix *)
- MemTop :CARDINAL; (* end of memory (paragraph) *)
- HeapBase :CARDINAL; (* start of heap (paragraph) *)
- StackSeg :CARDINAL; (* stack segment (paragraph) *)
- StackSize :CARDINAL; (* initial SP value *)
-
- HeapTop :CARDINAL; (* end of heap (paragraph) *)
- (* updated by Storage *)
-
- AX, BX, CX, DX, SI, DI :CARDINAL;
- BP, DS, ES :CARDINAL;
- FLAGS :BITSET;
-
- CONST
- carryFlag = 0; (* carry flag IN FLAGS *)
- zeroFlag = 6; (* zero flag IN FLAGS *)
-
-
- PROCEDURE GetArg( VAR arg: ARRAY OF CHAR; VAR length :CARDINAL );
- (*
- returns the next argument in the command line.
-
- 1. spaces separate arguments.
- 2. / starts a new argument (option).
- 3. to override the above, an argument may be quoted (Modula-2
- string).
-
- Ex: COMMAND arg1 'arg 2' /option "command's last arg"
- *)
-
- PROCEDURE GetEnv( var :ARRAY OF CHAR; VAR val :ARRAY OF CHAR );
- (*
- loads val with the value of the environment variable var.
- val will be loaded with the null string if var is not found.
- *)
-
- PROCEDURE Trap( intno :CARDINAL );
- (*
- loads the 8088 registers with the contents of AX..DI
- and then generates the software interrupt specified.
-
- On return from the interrupt, the registers are saved
- in AX..DI. The processor flags are stored in FLAGS.
- *)
-
- PROCEDURE XTrap( intno :CARDINAL );
- (*
- loads the 8088 registers with the contents of AX..ES
- and then generates the software interrupt specified.
-
- On return from the interrupt, the registers are saved
- in AX..ES. The processor flags are stored in FLAGS.
- *)
-
- PROCEDURE Move( src :ADDRESS; dest :ADDRESS; size :CARDINAL );
- (*
- Move size bytes from src to dest.
-
- IF FLAT(src) > FLAT(dest) THEN
- move from low to high address
- ELSE
- move from high to low address
- END
- *)
-
- PROCEDURE TermProcedure( p :PROC );
- (*
- installs a procedure to be executed when the program
- terminates.
-
- Up to 20 termination procedures may be installed.
- *)
-
- PROCEDURE Terminate( exitStatus :CARDINAL );
- (*
- terminates execution, sets the DOS errorlevel to exitStatus
- *)
-
- PROCEDURE GetVector( IntNum :CARDINAL; VAR ISR :ADDRESS );
- (*
- loads in ISR the value of the interrupt vector IntNum
- *)
-
- PROCEDURE SetVector( IntNum :CARDINAL; ISR :PROC );
- (*
- installs ISR to be executed when interrupt IntNum occurs.
- the address loaded in the interrupt vector is that of the
- start of the procedure ISR, skipping the compiler generated
- entry code.
-
- ISR must be compiled with stack checking disabled ($S-).
- *)
-
- PROCEDURE ResetVector( IntNum :CARDINAL; ISR :ADDRESS );
- (*
- loads the interrupt vector IntNum with the value in ISR
- *)
-
-
- TYPE
- ErrorProc = PROCEDURE( CARDINAL, ADDRESS );
- (*
- A user error handling procedure is passed, in case of a runtime
- error, the runtime error number and the address of the error
- location.
-
- For a list of current runtime error numbers, please consult the
- system's documentation.
-
- The error address can be related to an address in the MAP file
- produced by DBG2MAP by adjusting the segment part thus:
-
- a.SEG := a.SEG - (PSP + 10H);
-
- If the user error handling procedure returns, default error
- processing will take place and the program is terminated.
-
- *)
-
- PROCEDURE InstallRTErrorHandler( errorProc :ErrorProc );
- (*
- installs errorProc to be invoked if a runtime error is
- detected.
-
- Up to 10 error procedures may be installed, but only the last
- one installed will be invoked in case of a runtime error.
- *)
-
- PROCEDURE UninstallRTErrorHandler;
- (*
- uninstalls the errorProc installed last.
- *)
-
-
- END System.