Logitech Modula-2 v1.10
This commit is contained in:
parent
3ef4966f02
commit
789af5acbf
45
Logitech Modula-2 v1.1/ASCII.DEF
Normal file
45
Logitech Modula-2 v1.1/ASCII.DEF
Normal file
@ -0,0 +1,45 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE ASCII;
|
||||
(*
|
||||
Symbolic constants for non-printing ASCII characters.
|
||||
This module has an empty implementation.
|
||||
*)
|
||||
|
||||
EXPORT QUALIFIED
|
||||
nul, soh, stx, etx, eot, enq, ack, bel,
|
||||
bs, ht, lf, vt, ff, cr, so, si,
|
||||
dle, dc1, dc2, dc3, dc4, nak, syn, etb,
|
||||
can, em, sub, esc, fs, gs, rs, us,
|
||||
del,
|
||||
EOL;
|
||||
|
||||
|
||||
CONST
|
||||
nul = 00C; soh = 01C; stx = 02C; etx = 03C;
|
||||
eot = 04C; enq = 05C; ack = 06C; bel = 07C;
|
||||
bs = 10C; ht = 11C; lf = 12C; vt = 13C;
|
||||
ff = 14C; cr = 15C; so = 16C; si = 17C;
|
||||
dle = 20C; dc1 = 21C; dc2 = 22C; dc3 = 23C;
|
||||
dc4 = 24C; nak = 25C; syn = 26C; etb = 27C;
|
||||
can = 30C; em = 31C; sub = 32C; esc = 33C;
|
||||
fs = 34C; gs = 35C; rs = 36C; us = 37C;
|
||||
del = 177C;
|
||||
|
||||
CONST
|
||||
EOL = 36C;
|
||||
(*
|
||||
- end-of line character
|
||||
|
||||
This (non-ASCII) constant defines the internal name
|
||||
of the end-of-line character. Using this constant has
|
||||
the advantage, that only one character is used to
|
||||
specify line ends (as opposed to cr/lf).
|
||||
|
||||
The standard I/O modules interpret this character
|
||||
and transform it into the (sequence of) end-of-line
|
||||
code(s) required by the device they support. See
|
||||
definition modules of 'Terminal' and 'FileSystem'.
|
||||
*)
|
||||
|
||||
END ASCII.
|
||||
|
BIN
Logitech Modula-2 v1.1/ASCII.LNK
Normal file
BIN
Logitech Modula-2 v1.1/ASCII.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/ASCII.REF
Normal file
BIN
Logitech Modula-2 v1.1/ASCII.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/ASCII.SYM
Normal file
BIN
Logitech Modula-2 v1.1/ASCII.SYM
Normal file
Binary file not shown.
71
Logitech Modula-2 v1.1/BREAK.DEF
Normal file
71
Logitech Modula-2 v1.1/BREAK.DEF
Normal file
@ -0,0 +1,71 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Break;
|
||||
(*
|
||||
Handling of the ctrl-break interrupt
|
||||
|
||||
This module provides an interrupt handler for the
|
||||
ctrl-break interrupt 1BH of MS-DOS and PC-DOS. It
|
||||
installs a default break handler, which stops the
|
||||
execution of the current program with 'Terminate(stopped)'
|
||||
(see module 'System'). This produces a memory dump of the
|
||||
stopped program. A program may install its own break
|
||||
handler, and it can enable or disable the break handler
|
||||
which is currently installed.
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED
|
||||
EnableBreak, DisableBreak, InstallBreak, UnInstallBreak;
|
||||
|
||||
|
||||
PROCEDURE EnableBreak;
|
||||
(*
|
||||
- Enable the activation of the current break handler
|
||||
|
||||
If a ctrl-break is detected, the currently installed break
|
||||
handler will be called.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE DisableBreak;
|
||||
(*
|
||||
- Disable the activation of the current break handler
|
||||
|
||||
If a ctrl-break is detected, no action takes place. The
|
||||
ctrl-break is ignored.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE InstallBreak (BreakProc: PROC );
|
||||
(*
|
||||
- Install a break handler
|
||||
|
||||
in: BreakProc break procedure to be called upon
|
||||
crtl-break
|
||||
|
||||
A program can install its own break handler. Module
|
||||
'Break' maintains a stack of break procedures. The break
|
||||
procedure on top of the stack (i.e. the one which was
|
||||
installed most recently) will be called upon the
|
||||
occurence of a ctrl-break. The default break handler
|
||||
which is installed initially terminates the program with
|
||||
a call to 'System.Terminate(stopped)'.
|
||||
|
||||
Up to four user defined break procedure may be installed
|
||||
at the same time.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE UnInstallBreak;
|
||||
(*
|
||||
- Uninstall the current break handler
|
||||
|
||||
Removes the break procedure which is currently on top of
|
||||
the stack. So the last installed break procedure will be
|
||||
deactivated, and the one installed previously becomes
|
||||
active again.
|
||||
*)
|
||||
|
||||
|
||||
END Break.
|
||||
|
BIN
Logitech Modula-2 v1.1/BREAK.LNK
Normal file
BIN
Logitech Modula-2 v1.1/BREAK.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/BREAK.REF
Normal file
BIN
Logitech Modula-2 v1.1/BREAK.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/BREAK.SYM
Normal file
BIN
Logitech Modula-2 v1.1/BREAK.SYM
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87MATH0.LNK
Normal file
BIN
Logitech Modula-2 v1.1/C87MATH0.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87MATH0.REF
Normal file
BIN
Logitech Modula-2 v1.1/C87MATH0.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87REALC.LNK
Normal file
BIN
Logitech Modula-2 v1.1/C87REALC.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87REALC.REF
Normal file
BIN
Logitech Modula-2 v1.1/C87REALC.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87REALI.LNK
Normal file
BIN
Logitech Modula-2 v1.1/C87REALI.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87REALI.REF
Normal file
BIN
Logitech Modula-2 v1.1/C87REALI.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/C87REALS.LNK
Normal file
BIN
Logitech Modula-2 v1.1/C87REALS.LNK
Normal file
Binary file not shown.
52
Logitech Modula-2 v1.1/CARDINAL.DEF
Normal file
52
Logitech Modula-2 v1.1/CARDINAL.DEF
Normal file
@ -0,0 +1,52 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE CardinalIO;
|
||||
(*
|
||||
Terminal input/output of CARDINALs in decimal and hex
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
EXPORT QUALIFIED
|
||||
ReadCardinal, WriteCardinal, ReadHex, WriteHex;
|
||||
|
||||
|
||||
PROCEDURE ReadCardinal (VAR c: CARDINAL);
|
||||
(*
|
||||
- Read an unsigned decimal number from the terminal.
|
||||
out: c the value that was read.
|
||||
|
||||
The read terminates only on ESC, EOL, or blank, and the
|
||||
terminator must be re-read, for example with Terminal.Read.
|
||||
|
||||
If the read encounters a non-digit, or a digit which would
|
||||
cause the number to exceed the maximum CARDINAL value, the
|
||||
bell is sounded and that character is ignored. No more
|
||||
than one leading '0' is allowed.
|
||||
*)
|
||||
|
||||
PROCEDURE WriteCardinal (c: CARDINAL; w: CARDINAL);
|
||||
(*
|
||||
- Write a CARDINAL in decimal format to the terminal.
|
||||
in: c value to write,
|
||||
w minimum field width.
|
||||
|
||||
The value of c is written, even if it takes more than w
|
||||
digits. If it takes fewer digits, leading blanks are
|
||||
output to make the field w characters wide.
|
||||
*)
|
||||
|
||||
PROCEDURE ReadHex (VAR c: CARDINAL);
|
||||
(*
|
||||
- Read a CARDINAL in hexadecimal format from the terminal.
|
||||
[see ReadCardinal above]
|
||||
*)
|
||||
|
||||
PROCEDURE WriteHex (c: CARDINAL; digits: CARDINAL);
|
||||
(*
|
||||
- Write a CARDINAL in hexadecimal format to the terminal.
|
||||
[see WriteCardinal above]
|
||||
*)
|
||||
|
||||
END CardinalIO.
|
||||
|
BIN
Logitech Modula-2 v1.1/CARDINAL.LNK
Normal file
BIN
Logitech Modula-2 v1.1/CARDINAL.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CARDINAL.REF
Normal file
BIN
Logitech Modula-2 v1.1/CARDINAL.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CARDINAL.SYM
Normal file
BIN
Logitech Modula-2 v1.1/CARDINAL.SYM
Normal file
Binary file not shown.
49
Logitech Modula-2 v1.1/CLOCK.DEF
Normal file
49
Logitech Modula-2 v1.1/CLOCK.DEF
Normal file
@ -0,0 +1,49 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Clock;
|
||||
(*
|
||||
Access to the system's date and time
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED
|
||||
SetTime, GetTime, Time;
|
||||
|
||||
|
||||
TYPE
|
||||
Time = RECORD day, minute, millisec: CARDINAL; END;
|
||||
(*
|
||||
- date and time of day
|
||||
|
||||
'day' is : Bits 0..4 = day of month (1..31),
|
||||
Bits 5..8 = month of the year (1..12),
|
||||
Bits 9..15 = year - 1900.
|
||||
'minute' is hour * 60 + minutes.
|
||||
'millisec' is second * 1000 + milliseconds,
|
||||
starting with 0 at every minute.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE GetTime (VAR curTime: Time);
|
||||
(*
|
||||
- Return the current date and time.
|
||||
|
||||
out: curTime record containing date and time.
|
||||
|
||||
On systems which do not keep date or time, 'GetTime'
|
||||
returns a pseudo-random number.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetTime (curTime: Time);
|
||||
(*
|
||||
- Set the current date and time.
|
||||
|
||||
in: curTime record containing date and time.
|
||||
|
||||
On systems which do not keep date or time, this call has
|
||||
no effect.
|
||||
*)
|
||||
|
||||
|
||||
END Clock.
|
||||
|
BIN
Logitech Modula-2 v1.1/CLOCK.LNK
Normal file
BIN
Logitech Modula-2 v1.1/CLOCK.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CLOCK.REF
Normal file
BIN
Logitech Modula-2 v1.1/CLOCK.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CLOCK.SYM
Normal file
BIN
Logitech Modula-2 v1.1/CLOCK.SYM
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/COMP.LNK
Normal file
BIN
Logitech Modula-2 v1.1/COMP.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/COMP.LOD
Normal file
BIN
Logitech Modula-2 v1.1/COMP.LOD
Normal file
Binary file not shown.
58
Logitech Modula-2 v1.1/COMP.MAP
Normal file
58
Logitech Modula-2 v1.1/COMP.MAP
Normal file
@ -0,0 +1,58 @@
|
||||
Modula-2/86 Linker, DOS 8086, Rel. 1.10, Nov 84,
|
||||
|
||||
Output file name: E:comp.LOD
|
||||
|
||||
++ Program map (11 modules included in this layer):
|
||||
Modules are listed in order of module code execution.
|
||||
|
||||
+ MODULE = ASCII KEY= A9110434E3EE
|
||||
FILE= E:ASCII.LNK
|
||||
CODE-SEG= 053A DATA-SEG= 056F
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = System KEY= A91104246A54
|
||||
FILE= E:System.LNK
|
||||
CODE-SEG= 04FF DATA-SEG= 055E
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = Keyboard KEY= A9110433A5D2
|
||||
FILE= E:Keyboard.LNK
|
||||
CODE-SEG= 04CD DATA-SEG= 0555
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = Display KEY= A911043455B4
|
||||
FILE= E:Display.LNK
|
||||
CODE-SEG= 04C5 DATA-SEG= 0555
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = Termbase KEY= A91104381612
|
||||
FILE= E:Termbase.LNK
|
||||
CODE-SEG= 0489 DATA-SEG= 054E
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = Terminal KEY= A91104323CC8
|
||||
FILE= E:Terminal.LNK
|
||||
CODE-SEG= 0467 DATA-SEG= 054D
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = ProgMessage KEY= A91104983B1A
|
||||
FILE= E:ProgMess.LNK
|
||||
CODE-SEG= 0427 DATA-SEG= 054D
|
||||
PROC-TABLE= 01CC
|
||||
+ MODULE = Storage KEY= A9110435A460
|
||||
FILE= E:Storage.LNK
|
||||
CODE-SEG= 0345 DATA-SEG= 054C
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = Program KEY= A911049712DE
|
||||
FILE= E:Program.LNK
|
||||
CODE-SEG= 01EF DATA-SEG= 0548
|
||||
PROC-TABLE= 0002
|
||||
+ MODULE = CompFile KEY= A91104CC43A8
|
||||
FILE= E:CompFile.LNK
|
||||
CODE-SEG= 0041 DATA-SEG= 0544
|
||||
PROC-TABLE= 018C
|
||||
+ MODULE = Comint KEY= A6ED008351F4
|
||||
FILE= E:comp.LNK
|
||||
CODE-SEG= 0000 DATA-SEG= 053C
|
||||
PROC-TABLE= 004E
|
||||
|
||||
++ Base (0 modules assumed to be in base layers):
|
||||
|
||||
|
||||
Length of code (in paragraphs): 053C
|
||||
Length of data (in paragraphs): 0033
|
||||
|
BIN
Logitech Modula-2 v1.1/COMPFILE.LNK
Normal file
BIN
Logitech Modula-2 v1.1/COMPFILE.LNK
Normal file
Binary file not shown.
192
Logitech Modula-2 v1.1/COMPPARA.DEF
Normal file
192
Logitech Modula-2 v1.1/COMPPARA.DEF
Normal file
@ -0,0 +1,192 @@
|
||||
(****************************************
|
||||
* *
|
||||
* MODULA-2 Multi-Pass Compiler *
|
||||
* **************************** *
|
||||
* *
|
||||
* Implementation for Intel 8086 *
|
||||
* *
|
||||
* *
|
||||
* CompPara: *
|
||||
* *
|
||||
* parameter module to configurate *
|
||||
* the Modula-2 compiler *
|
||||
* implementation module may be *
|
||||
* changed by the user *
|
||||
* *
|
||||
* *
|
||||
* Version: *
|
||||
* 1.10 Nov 23' 1984 *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 1984 Logitech. *
|
||||
* All Rights Reserved. *
|
||||
* *
|
||||
* This program is a trade secret of *
|
||||
* Logitech, and it is not to be *
|
||||
* reproduced, published, disclosed *
|
||||
* to others, copied, adapted, *
|
||||
* distributed or displayed without *
|
||||
* the prior authorization of Logitech *
|
||||
* *
|
||||
* Licensee agrees to attach or embed *
|
||||
* this notice on all copies of the *
|
||||
* program, including partial copies *
|
||||
* or modified versions thereof. *
|
||||
* *
|
||||
****************************************)
|
||||
DEFINITION MODULE CompPara;
|
||||
|
||||
EXPORT QUALIFIED
|
||||
CPpageLength, CPpageWidth, (* listing definition *)
|
||||
CPffAtEnd, CPffAtBegin,
|
||||
CPheader, CPdate,
|
||||
CPfooter, CPfooterText,
|
||||
CPpriorityLevels, (* interrupt system definition: 8259A *)
|
||||
CPRTSfunctVector, (* interrupt vector to access to RTS functions *)
|
||||
CPemulator, (* default settings of compiler options *)
|
||||
CPinteractiv,
|
||||
CPstatistic,
|
||||
CPquery, CPautoquery,
|
||||
CPdebug, CPversion,
|
||||
CPlister, CPerrorLister,
|
||||
CPafterPass1, CPafterPass2,(* defines moment of listing generation *)
|
||||
CPstacktest, CPrangetest, (* default settings of program-source options *)
|
||||
CPindextest;
|
||||
|
||||
VAR
|
||||
|
||||
(* the following variables are used to define the format of *)
|
||||
(* the listing generated by the compiler *)
|
||||
|
||||
CPpageLength,
|
||||
(* number of lines per page : initial value is 60 *)
|
||||
(* valid range: 40..65535 (if out of range: 60 is taken) *)
|
||||
|
||||
CPpageWidth: CARDINAL;
|
||||
(* number of characters per line : initial value is 79 *)
|
||||
(* valid range: 50..150 (if out of range: 79 is taken) *)
|
||||
|
||||
(* the next two parameters are used to define the page eject *)
|
||||
|
||||
CPffAtEnd: BOOLEAN;
|
||||
(* defines whether a formfeed at last character *)
|
||||
(* is generated or not: initial value is TRUE *)
|
||||
|
||||
CPffAtBegin: BOOLEAN;
|
||||
(* defines whether a formfeed at first character *)
|
||||
(* is generated or not: initial value is FALSE *)
|
||||
|
||||
(* the next two parameters define the header of each page *)
|
||||
|
||||
CPheader: BOOLEAN;
|
||||
(* defines whether a headerline is generated on each *)
|
||||
(* page or not: initial value is TRUE *)
|
||||
|
||||
CPdate: BOOLEAN;
|
||||
(* defines whether date in headerline is generated *)
|
||||
(* or not: initial value is FALSE *)
|
||||
|
||||
|
||||
(* a header line has the following format: *)
|
||||
(* Modula-2/86 Date filename.ext Page n *)
|
||||
(* e.g. *)
|
||||
(* Modula-2/86 Nov 16'83 COMPPARA.DEF Page 1 *)
|
||||
|
||||
|
||||
(* the next two parameters define the footer of each page *)
|
||||
|
||||
CPfooter: BOOLEAN;
|
||||
(* defines whether a footerline is generated on each *)
|
||||
(* page or not: initial value is FALSE *)
|
||||
|
||||
CPfooterText: ARRAY [0..149] OF CHAR;
|
||||
(* string of pagewidth characters that defines the footerline *)
|
||||
(* normally used for Copyright text: initially an empty string *)
|
||||
|
||||
|
||||
(* definition of interrupt system: number of priority levels *)
|
||||
|
||||
CPpriorityLevels: CARDINAL;
|
||||
(* initial value of distributed version is 8: *)
|
||||
(* defined by the (8259A) interrupt controller(s) *)
|
||||
|
||||
|
||||
(* definition of interface to Run-Time-Support system *)
|
||||
|
||||
CPRTSfunctVector: CARDINAL;
|
||||
(* defines the interrupt vector to acces the RTS *)
|
||||
(* RTS: Runtime Support: Assembley part of Modula-2/86 System *)
|
||||
(* normally 228: may be only changed if RTS is changed *)
|
||||
|
||||
|
||||
(* the following boolean variable defines whether code for an *)
|
||||
(* 8087 coprocessor or an 8087 emulator is generated by the compiler *)
|
||||
|
||||
CPemulator: BOOLEAN; (* initial value is TRUE *)
|
||||
|
||||
(* the following options define the interactive behaviour of the compiler *)
|
||||
|
||||
CPinteractiv: BOOLEAN; (* initial value is TRUE *)
|
||||
(* whether compiler may be stopped by typing a key *)
|
||||
|
||||
CPstatistic: BOOLEAN; (* initial value is TRUE *)
|
||||
(* whether compiler displays some statistic values *)
|
||||
|
||||
CPquery: BOOLEAN; (* initial value is FALSE *)
|
||||
(* whether compiler asks for the symbol files of *)
|
||||
(* the imported modules or tries to find them by *)
|
||||
(* the default strategy: *)
|
||||
(* build filename from module name by taking *)
|
||||
(* the 8 first characters and the extension 'SYM' *)
|
||||
|
||||
CPautoquery: BOOLEAN; (* initial value is TRUE *)
|
||||
(* whether compiler falls automatically in query mode *)
|
||||
(* if it didn't find the file by the default mechanism *)
|
||||
|
||||
CPdebug: BOOLEAN; (* initial value is TRUE *)
|
||||
(* whether compiler generates a reference file *)
|
||||
(* that would be used by the debugger, or not *)
|
||||
|
||||
CPversion: BOOLEAN; (* initial value is FALSE *)
|
||||
(* whether compiler displays version info or not *)
|
||||
|
||||
CPlister: BOOLEAN; (* initial value is FALSE *)
|
||||
(* whether compiler generates a listing file or not *)
|
||||
|
||||
CPerrorLister: BOOLEAN; (* initial value is TRUE *)
|
||||
(* whether compiler generates automatically an *)
|
||||
(* error listing if errors occured or not *)
|
||||
|
||||
(* moment of listing generation in case of errors *)
|
||||
|
||||
(* if both variables are set to FALSE the listing *)
|
||||
(* will be generated after pass3 *)
|
||||
(* the functions of the different passes are: *)
|
||||
(* pass1 checks syntactic of program *)
|
||||
(* pass2 checks declaration parts (allocation) *)
|
||||
(* pass3 checks bodys (compatibility test) *)
|
||||
|
||||
|
||||
CPafterPass1: BOOLEAN; (* initial value: TRUE *)
|
||||
(* whether compiler goes to lister if error detected *)
|
||||
(* in pass1 and terminates compilation, or not *)
|
||||
|
||||
CPafterPass2: BOOLEAN; (* initial value: FALSE *)
|
||||
(* whether compiler goes to lister if error detected *)
|
||||
(* in pass2 and terminates compilation, or not *)
|
||||
|
||||
(* the following boolean variables are used to define the default *)
|
||||
(* setting of the corresponding testcode options: *)
|
||||
(* TRUE means: default is '+'; FALSE means: default is '-' *)
|
||||
|
||||
CPstacktest: BOOLEAN;
|
||||
(* for option 'S': initial value is TRUE *)
|
||||
|
||||
CPrangetest: BOOLEAN;
|
||||
(* for option 'R': initial value is TRUE *)
|
||||
|
||||
CPindextest: BOOLEAN;
|
||||
(* for option 'T': initial value is TRUE *)
|
||||
|
||||
END CompPara.
|
||||
|
BIN
Logitech Modula-2 v1.1/COMPPARA.LNK
Normal file
BIN
Logitech Modula-2 v1.1/COMPPARA.LNK
Normal file
Binary file not shown.
174
Logitech Modula-2 v1.1/COMPPARA.MOD
Normal file
174
Logitech Modula-2 v1.1/COMPPARA.MOD
Normal file
@ -0,0 +1,174 @@
|
||||
(****************************************
|
||||
* *
|
||||
* MODULA-2 Multi-Pass Compiler *
|
||||
* **************************** *
|
||||
* *
|
||||
* Implementation for Intel 8086 *
|
||||
* *
|
||||
* *
|
||||
* CompPara: *
|
||||
* *
|
||||
* parameter module to configurate *
|
||||
* the Modula-2 compiler *
|
||||
* implementation module may be *
|
||||
* changed by the user *
|
||||
* *
|
||||
* *
|
||||
* Version: *
|
||||
* 1.10 Nov 23' 1984 *
|
||||
* *
|
||||
* *
|
||||
* Copyright (C) 1984 Logitech. *
|
||||
* All Rights Reserved. *
|
||||
* *
|
||||
* This program is a trade secret of *
|
||||
* Logitech, and it is not to be *
|
||||
* reproduced, published, disclosed *
|
||||
* to others, copied, adapted, *
|
||||
* distributed or displayed without *
|
||||
* the prior authorization of Logitech *
|
||||
* *
|
||||
* Licensee agrees to attach or embed *
|
||||
* this notice on all copies of the *
|
||||
* program, including partial copies *
|
||||
* or modified versions thereof. *
|
||||
* *
|
||||
****************************************)
|
||||
IMPLEMENTATION MODULE CompPara;
|
||||
|
||||
BEGIN
|
||||
(* the following variables are used to define the format of *)
|
||||
(* the listing generated by the compiler *)
|
||||
|
||||
CPpageLength := 60;
|
||||
(* number of lines per page : initial value is 60 *)
|
||||
(* valid range: 40..65535 (if out of range: 60 is taken) *)
|
||||
|
||||
CPpageWidth := 79;
|
||||
(* number of characters per line : initial value is 79 *)
|
||||
(* valid range: 50..150 (if out of range: 79 is taken) *)
|
||||
|
||||
(* the next two parameters are used to define the page eject *)
|
||||
|
||||
CPffAtEnd := TRUE;
|
||||
(* defines whether a formfeed at last character *)
|
||||
(* is generated or not: initial value is TRUE *)
|
||||
|
||||
CPffAtBegin := FALSE;
|
||||
(* defines whether a formfeed at first character *)
|
||||
(* is generated or not: initial value is FALSE *)
|
||||
|
||||
(* the next two parameters define the header of each page *)
|
||||
|
||||
CPheader := TRUE;
|
||||
(* defines whether a headerline is generated on each *)
|
||||
(* page or not: initial value is TRUE *)
|
||||
|
||||
CPdate := FALSE;
|
||||
(* defines whether date in headerline is generated *)
|
||||
(* or not: initial value is FALSE *)
|
||||
|
||||
|
||||
(* a header line has the following format: *)
|
||||
(* Modula-2/86 Date filename.ext Page n *)
|
||||
(* e.g. *)
|
||||
(* Modula-2/86 Nov 16'83 COMPPARA.DEF Page 1 *)
|
||||
|
||||
|
||||
(* the next two parameters define the footer of each page *)
|
||||
|
||||
CPfooter := FALSE;
|
||||
(* defines whether a footerline is generated on each *)
|
||||
(* page or not: initial value is FALSE *)
|
||||
|
||||
CPfooterText := "";
|
||||
(* string of pagewidth characters that defines the footerline *)
|
||||
(* normally used for Copyright text: initially an empty string *)
|
||||
|
||||
|
||||
(* definition of interrupt system: number of priority levels *)
|
||||
|
||||
CPpriorityLevels := 8;
|
||||
(* initial value of distributed version is 8: *)
|
||||
(* defined by the (8259A) interrupt controller(s) *)
|
||||
|
||||
|
||||
(* definition of interface to Run-Time-Support system *)
|
||||
|
||||
CPRTSfunctVector := 228;
|
||||
(* defines the interrupt vector to acces the RTS *)
|
||||
(* RTS: Runtime Support: Assembley part of Modula-2/86 System *)
|
||||
(* normally 228: may be only changed if RTS is changed *)
|
||||
|
||||
|
||||
(* the following boolean variable defines whether code for an *)
|
||||
(* 8087 coprocessor or an 8087 emulator is generated by the compiler *)
|
||||
|
||||
CPemulator := TRUE; (* initial value is TRUE *)
|
||||
|
||||
(* the following options define the interactive behaviour of the compiler *)
|
||||
|
||||
CPinteractiv := TRUE; (* initial value is TRUE *)
|
||||
(* whether compiler may be stopped by typing a key *)
|
||||
|
||||
CPstatistic := TRUE; (* initial value is TRUE *)
|
||||
(* whether compiler displays some statistic values *)
|
||||
|
||||
CPquery := FALSE; (* initial value is FALSE *)
|
||||
(* whether compiler asks for the symbol files of *)
|
||||
(* the imported modules or tries to find them by *)
|
||||
(* the default strategy: *)
|
||||
(* build filename from module name by taking *)
|
||||
(* the 8 first characters and the extension 'SYM' *)
|
||||
|
||||
CPautoquery := TRUE; (* initial value is TRUE *)
|
||||
(* whether compiler falls automatically in query mode *)
|
||||
(* if it didn't find the file by the default mechanism *)
|
||||
|
||||
CPdebug := TRUE; (* initial value is TRUE *)
|
||||
(* whether compiler generates a reference file *)
|
||||
(* that would be used by the debugger, or not *)
|
||||
|
||||
CPversion := FALSE; (* initial value is FALSE *)
|
||||
(* whether compiler displays version info or not *)
|
||||
|
||||
CPlister := FALSE; (* initial value is FALSE *)
|
||||
(* whether compiler generates a listing file or not *)
|
||||
|
||||
CPerrorLister := TRUE; (* initial value is TRUE *)
|
||||
(* whether compiler generates automatically an *)
|
||||
(* error listing if errors occured or not *)
|
||||
|
||||
(* moment of listing generation in case of errors *)
|
||||
|
||||
(* if both variables are set to FALSE the listing *)
|
||||
(* will be generated after pass3 *)
|
||||
(* the functions of the different passes are: *)
|
||||
(* pass1 checks syntactic of program *)
|
||||
(* pass2 checks declaration parts (allocation) *)
|
||||
(* pass3 checks bodys (compatibility test) *)
|
||||
|
||||
|
||||
CPafterPass1 := TRUE; (* initial value: TRUE *)
|
||||
(* whether compiler goes to lister if error detected *)
|
||||
(* in pass1 and terminates compilation, or not *)
|
||||
|
||||
CPafterPass2 := FALSE; (* initial value: FALSE *)
|
||||
(* whether compiler goes to lister if error detected *)
|
||||
(* in pass2 and terminates compilation, or not *)
|
||||
|
||||
(* the following boolean variables are used to define the default *)
|
||||
(* setting of the corresponding testcode options: *)
|
||||
(* TRUE means: default is '+'; FALSE means: default is '-' *)
|
||||
|
||||
CPstacktest := TRUE;
|
||||
(* for option 'S': initial value is TRUE *)
|
||||
|
||||
CPrangetest := TRUE;
|
||||
(* for option 'R': initial value is TRUE *)
|
||||
|
||||
CPindextest := TRUE;
|
||||
(* for option 'T': initial value is TRUE *)
|
||||
|
||||
END CompPara.
|
||||
|
BIN
Logitech Modula-2 v1.1/COMPPARA.SYM
Normal file
BIN
Logitech Modula-2 v1.1/COMPPARA.SYM
Normal file
Binary file not shown.
3
Logitech Modula-2 v1.1/CONFIG.SYS
Normal file
3
Logitech Modula-2 v1.1/CONFIG.SYS
Normal file
@ -0,0 +1,3 @@
|
||||
files=12
|
||||
buffers=13
|
||||
|
57
Logitech Modula-2 v1.1/CONVERSI.DEF
Normal file
57
Logitech Modula-2 v1.1/CONVERSI.DEF
Normal file
@ -0,0 +1,57 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Conversions;
|
||||
(*
|
||||
Convert from INTEGER and CARDINAL to string
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
EXPORT QUALIFIED
|
||||
ConvertOctal, ConvertHex,
|
||||
ConvertCardinal, ConvertInteger;
|
||||
|
||||
|
||||
PROCEDURE ConvertOctal(num, len: CARDINAL;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
(*
|
||||
- Convert number to right-justified octal representation
|
||||
|
||||
in: num value to be represented,
|
||||
len minimum width of representation,
|
||||
out: str result string.
|
||||
|
||||
If the representation of 'num' uses fewer than 'len'
|
||||
digits, blanks are added on the left. If the representa-
|
||||
tion will not fit in 'str', it is truncated on the right.
|
||||
*)
|
||||
|
||||
PROCEDURE ConvertHex(num, len: CARDINAL;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
(*
|
||||
- Convert number to right-justified hexadecimal
|
||||
representation.
|
||||
[see ConvertOctal]
|
||||
*)
|
||||
|
||||
PROCEDURE ConvertCardinal(num, len: CARDINAL;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
(*
|
||||
- Convert a CARDINAL to right-justified decimal
|
||||
representation.
|
||||
[see ConvertOctal]
|
||||
*)
|
||||
|
||||
PROCEDURE ConvertInteger(num: INTEGER; len: CARDINAL;
|
||||
VAR str: ARRAY OF CHAR);
|
||||
(*
|
||||
- Convert an INTEGER to right-justified decimal
|
||||
representation.
|
||||
[see ConvertOctal]
|
||||
|
||||
Note that a leading '-' is generated if num < 0, but never
|
||||
a '+'.
|
||||
*)
|
||||
|
||||
END Conversions.
|
||||
|
BIN
Logitech Modula-2 v1.1/CONVERSI.LNK
Normal file
BIN
Logitech Modula-2 v1.1/CONVERSI.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CONVERSI.REF
Normal file
BIN
Logitech Modula-2 v1.1/CONVERSI.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/CONVERSI.SYM
Normal file
BIN
Logitech Modula-2 v1.1/CONVERSI.SYM
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DBCLASS.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DBCLASS.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DBLOAD.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DBLOAD.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DBTYPE.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DBTYPE.LNK
Normal file
Binary file not shown.
654
Logitech Modula-2 v1.1/DBUG.ASM
Normal file
654
Logitech Modula-2 v1.1/DBUG.ASM
Normal file
@ -0,0 +1,654 @@
|
||||
;*****************************************************************
|
||||
;
|
||||
; Copyrigth (C) 1984 Logitech. All Rights Reserved.
|
||||
;
|
||||
; Permission is hereby granted to registered users to use or
|
||||
; abstract the following program in the implementation of
|
||||
; customized versions. This permission does not include the
|
||||
; right to redistribute the source code of this program.
|
||||
;
|
||||
; LOGITECH SA. CH-1143 Apples, Switzerland
|
||||
;
|
||||
; Modula-2/86 Run Time Support package
|
||||
;
|
||||
; Module: DBUG.ASM
|
||||
; Produces the Post Mortem Dump on a disk file
|
||||
; and provides the interface to the Run-Time Debugger.
|
||||
;
|
||||
; Version: 8086, RAM-based, MS-DOS 2.0 compatible
|
||||
; Release: 1.10 - Dec 84
|
||||
;
|
||||
;*****************************************************************
|
||||
|
||||
CGROUP group code
|
||||
DGROUP group data
|
||||
|
||||
assume CS: CGROUP
|
||||
assume DS: DGROUP
|
||||
assume ES: NOTHING
|
||||
assume SS: DGROUP
|
||||
|
||||
include RTS.INC
|
||||
|
||||
;*****************************************************************
|
||||
;
|
||||
; EXPORT QUALIFIED
|
||||
public INSTALL_DEBUG
|
||||
public RTD_AFTER_LOAD
|
||||
public DEBUGGER
|
||||
|
||||
;
|
||||
;*****************************************************************
|
||||
data segment public 'data'
|
||||
|
||||
; FROM RTS IMPORT
|
||||
extrn START_MEM:word, MEM_SIZE:word
|
||||
extrn SAVED_DISK:byte
|
||||
extrn RTS_DISK:byte
|
||||
extrn RTS_PROCESS:byte ;:ProcessDescriptor
|
||||
extrn CUR_proc_addr:dword
|
||||
extrn cur_process:byte ;:ProcessDescriptor
|
||||
|
||||
data ends
|
||||
;*****************************************************************
|
||||
|
||||
|
||||
;*****************************************************************
|
||||
code segment public 'code'
|
||||
|
||||
; FROM RTS IMPORT
|
||||
extrn RTS_DS:word ; really belongs here!
|
||||
extrn DUMMY_ISR: near
|
||||
extrn NORM_ADDR:near
|
||||
extrn WRITE_LN:near
|
||||
extrn WRITE_MSG:near
|
||||
extrn GET_CURR_DISK:near
|
||||
extrn SELECT_DISK:near
|
||||
|
||||
code ends
|
||||
;*****************************************************************
|
||||
|
||||
|
||||
;*****************************************************************
|
||||
data segment public 'data'
|
||||
|
||||
; string constants
|
||||
|
||||
DUMP_NAME DB 'MEMORY.PMD',0
|
||||
DUMP_MSG DB ' writing post mortem dump ... $'
|
||||
BAD_DUMP_MSG DB 'failed', 0DH,0AH, '$'
|
||||
OK_DUMP_MSG DB 'done', 0DH,0AH, '$'
|
||||
|
||||
; Variables for Post Mortem Dump:
|
||||
|
||||
even
|
||||
DUMP_LOW_START dw ? ; first paragraph of 'low' dump area
|
||||
DUMP_LOW_END dw ? ; last paragraph of same
|
||||
DUMP_HIGH_START dw ?
|
||||
DUMP_HIGH_END dw ?
|
||||
DUMP_FILE_SPEC db 64H dup(?)
|
||||
DUMP_FILE_HANDLE dw ?
|
||||
|
||||
SAVE_SP dw ?
|
||||
SAVE_SS dw ?
|
||||
|
||||
s_rts_CS dw ? ; registers of main P.D.
|
||||
s_rts_IP dw ?
|
||||
s_rts_SS dw ?
|
||||
s_rts_SP dw ?
|
||||
s_rts_DS dw ?
|
||||
s_rts_BP dw ?
|
||||
|
||||
s_cur_CS dw ? ; registers of current P.D.
|
||||
s_cur_IP dw ?
|
||||
s_cur_SS dw ?
|
||||
s_cur_SP dw ?
|
||||
s_cur_DS dw ?
|
||||
s_cur_BP dw ?
|
||||
|
||||
old_break dd ? ; to save old break_vector around dumping
|
||||
|
||||
pmd_stack dw 160 dup (?) ; should be enough
|
||||
pmd_stack_end label word
|
||||
|
||||
; Variables for the Run-Time Debugger:
|
||||
RTD_PRESENT DB FALSE ; set through fct DEBUG_MODE_FCT
|
||||
|
||||
data ends
|
||||
;*****************************************************************************
|
||||
|
||||
|
||||
;
|
||||
; The file containing the Post Mortem Dump has the following format:
|
||||
;
|
||||
; First 80H bytes are the header with
|
||||
; 0 : addr process-descr of main process
|
||||
; 4 : addr process-descr of terminating process
|
||||
; 9..0D : not used
|
||||
; 0E : number of dumped areas
|
||||
; 0F : version number of dump file format
|
||||
; 00 = first version (V1.0)
|
||||
; 10H = new header (V1.03)
|
||||
; 10 : first paragraph of first dumped area
|
||||
; 12 : last " " " " "
|
||||
; 14 : first paragraph of second dumped area
|
||||
; 16 : last " " " " "
|
||||
; 18 : first paragraph of third dumped area
|
||||
; 1A : last " " " " "
|
||||
;
|
||||
; Every dumped area is a multiple of paragraphs (16 bytes).
|
||||
; The first area starts with offset 80H in the file, subsequent
|
||||
; areas follow immediately the previous area.
|
||||
;
|
||||
;************************************************************
|
||||
|
||||
code segment public 'code'
|
||||
|
||||
; public INSTALL_DEBUG
|
||||
|
||||
INSTALL_DEBUG proc NEAR
|
||||
;============
|
||||
; Allows to install and remove a Run-Time Debugger.
|
||||
; Parameter: CL defines mode (0= remove, 1=install).
|
||||
MOV ES: RTD_PRESENT, FALSE
|
||||
TEST CL, CL
|
||||
JZ DEBUG_SET
|
||||
MOV ES: RTD_PRESENT, TRUE
|
||||
DEBUG_SET:
|
||||
IRET
|
||||
INSTALL_DEBUG endp
|
||||
|
||||
;************************************************************
|
||||
|
||||
; public RTD_AFTER_LOAD
|
||||
|
||||
RTD_AFTER_LOAD proc NEAR
|
||||
;=============
|
||||
; Calls the Run-Time Debugger, if present.
|
||||
; Upon entry: ES is assumed to be set to RTS.
|
||||
; DS:0 points to current process
|
||||
; called from RUN_PROGRAM
|
||||
|
||||
CMP ES:RTD_PRESENT, TRUE
|
||||
JNE NO_RTD
|
||||
MOV CUR_PROCESS.PD_dbug_status,1 ; 'loaded' state.
|
||||
MOV ES:RTD_PRESENT, FALSE ; to avoid recursivity
|
||||
INT 3
|
||||
MOV ES:RTD_PRESENT, TRUE
|
||||
MOV CUR_PROCESS.PD_dbug_status,0
|
||||
NO_RTD: RET
|
||||
|
||||
RTD_AFTER_LOAD endp
|
||||
|
||||
;************************************************************
|
||||
|
||||
; public DEBUGGER
|
||||
|
||||
DEBUGGER proc NEAR
|
||||
;=======
|
||||
; Upon entry, DS is assumed to be set to RTS.
|
||||
; We arrive here when an overlay has terminated, or any program,
|
||||
; including level 0 has fallen into a run-time error.
|
||||
; If the run-time debugger is present, we call it in any case, if
|
||||
; it is not present, we produce a memory dump, if the status is
|
||||
; not NORMAL nor WARNED.
|
||||
mov ax,word ptr cur_proc_addr + 2
|
||||
mov es,ax
|
||||
|
||||
; Test if status legal:
|
||||
MOV AX,ES:CUR_PROCESS.PD_STATUS
|
||||
CMP AX,HIGHEST_ERR_CODE
|
||||
JBE ERR_CODE_OK
|
||||
MOV ES:CUR_PROCESS.PD_STATUS, ILL_FCT_CODE
|
||||
MOV AX,ILL_FCT_CODE
|
||||
|
||||
ERR_CODE_OK:
|
||||
CMP AX,stop_code ; no dump if normal or warned
|
||||
JB NORMAL_TERMINATION
|
||||
|
||||
; check, if the Run-Time Debugger is present:
|
||||
CMP RTD_PRESENT, TRUE
|
||||
JNE TAKE_A_DUMP
|
||||
MOV ES:CUR_PROCESS.PD_dbug_status,0 ; indicates 'running'
|
||||
MOV RTD_PRESENT, FALSE ; to avoid recursivity
|
||||
INT 3
|
||||
MOV RTD_PRESENT, TRUE
|
||||
RET
|
||||
|
||||
|
||||
TAKE_A_DUMP: ; no RTD, take a dump
|
||||
|
||||
; a bad function call will not produce a dump (probably bad code):
|
||||
cmp ax,ILL_FCT_CODE
|
||||
je NO_DUMP
|
||||
|
||||
; We use an auxiliary stack
|
||||
; (we may have a stack overflow):
|
||||
MOV SAVE_SS, SS
|
||||
MOV SAVE_SP, SP
|
||||
MOV AX, DS
|
||||
MOV SS, AX
|
||||
lea SP, pmd_stack_end
|
||||
CALL P_M_DUMP
|
||||
; Restore stack of user process:
|
||||
MOV SS, SAVE_SS
|
||||
MOV SP, SAVE_SP
|
||||
|
||||
NORMAL_TERMINATION:
|
||||
|
||||
NO_DUMP:
|
||||
|
||||
; aw 16 oct
|
||||
|
||||
; check, if the Run-Time Debugger is present:
|
||||
CMP RTD_PRESENT, TRUE
|
||||
JNE RETURN
|
||||
MOV ES:CUR_PROCESS.PD_dbug_status,2 ; indicates 'terminated'
|
||||
MOV RTD_PRESENT, FALSE ; to avoid recursivity
|
||||
INT 3
|
||||
MOV RTD_PRESENT, TRUE
|
||||
MOV ES:CUR_PROCESS.PD_dbug_status,0 ; indicates 'running'
|
||||
|
||||
RETURN:
|
||||
RET
|
||||
|
||||
DEBUGGER endp
|
||||
|
||||
;************************************************************
|
||||
|
||||
|
||||
P_M_DUMP proc NEAR
|
||||
;========
|
||||
CLD ; just to make sure
|
||||
|
||||
; Entry point for Post Mortem Dump
|
||||
; When arriving here, we assume the relevant
|
||||
; registers to be saved in the process descriptor.
|
||||
; They are saved into local vars because interrupts
|
||||
; cannot be disabled during DOSCALLs
|
||||
|
||||
mov ds,rts_ds ; set DS to own data
|
||||
|
||||
; set breakvector to a dummy ISR during writing the dump
|
||||
; save old vector into old_break
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
mov bx, 4 * 1BH
|
||||
mov ax, es: [bx]
|
||||
mov word ptr old_break, ax
|
||||
mov ax, es: 2[bx]
|
||||
mov word ptr old_break+2, ax
|
||||
mov es: word ptr [bx], offset DUMMY_ISR
|
||||
mov es: word ptr 2[bx], cs
|
||||
|
||||
|
||||
CALL WRITE_LN
|
||||
LEA DX, DUMP_MSG
|
||||
CALL WRITE_MSG
|
||||
mov ax,rts_process.PD_SS
|
||||
mov s_rts_SS,ax
|
||||
mov ax,rts_process.PD_SP
|
||||
mov s_rts_SP,ax
|
||||
mov ax,rts_process.PD_CS
|
||||
mov s_rts_CS,ax
|
||||
mov ax,rts_process.PD_IP
|
||||
mov s_rts_IP,ax
|
||||
mov ax,rts_process.PD_DS
|
||||
mov s_rts_DS,ax
|
||||
mov ax,rts_process.PD_BP
|
||||
mov s_rts_BP,ax
|
||||
|
||||
mov es,word ptr cur_proc_addr + 2 ; base of cur P.D.
|
||||
mov ax,ES:cur_process.PD_SS
|
||||
mov s_cur_SS,ax
|
||||
mov ax,ES:cur_process.PD_SP
|
||||
mov s_cur_SP,ax
|
||||
mov ax,ES:cur_process.PD_CS
|
||||
mov s_cur_CS,ax
|
||||
mov ax,ES:cur_process.PD_IP
|
||||
mov s_cur_IP,ax
|
||||
mov ax,ES:cur_process.PD_DS
|
||||
mov s_cur_DS,ax
|
||||
mov ax,ES:cur_process.PD_BP
|
||||
mov s_cur_BP,ax
|
||||
|
||||
; paragraph address of :
|
||||
mov ax, RTS_DS
|
||||
mov DUMP_LOW_START, ax
|
||||
; end of lower memory area:
|
||||
MOV BX,word ptr RTS_PROCESS.PD_HEAP_TOP + 2
|
||||
MOV AX,word ptr RTS_PROCESS.PD_HEAP_TOP
|
||||
CALL NORM_ADDR
|
||||
INC BX ; next paragraph
|
||||
MOV DUMP_LOW_END, BX ; just save it
|
||||
; start of higher memory area:
|
||||
MOV BX, RTS_PROCESS.PD_SS
|
||||
MOV AX, RTS_PROCESS.PD_SP
|
||||
CALL NORM_ADDR
|
||||
MOV DUMP_HIGH_START, BX ; just save it
|
||||
; last paragraph of memory:
|
||||
mov bx, START_MEM
|
||||
dec bx
|
||||
add bx, MEM_SIZE
|
||||
MOV DUMP_HIGH_END, BX ; just save it
|
||||
|
||||
; Now, we create the file on the same disk
|
||||
; where the resident part was found. Therefore,
|
||||
; we have first to save the currrent disk:
|
||||
call GET_CURR_DISK
|
||||
|
||||
; set up the filespec:
|
||||
MOV AL, RTS_DISK
|
||||
add al,'A'
|
||||
PUSH DS
|
||||
POP ES
|
||||
MOV SI, OFFSET DUMP_NAME
|
||||
MOV DI, offset DUMP_FILE_SPEC
|
||||
mov byte ptr[di],al
|
||||
inc di
|
||||
mov byte ptr[di],':'
|
||||
inc di
|
||||
MOV CX, 11 ; Drive, Name, Typ and Extent
|
||||
REP MOVSB
|
||||
|
||||
CALL DELETE_FILE ; Delete the old DUMP-file
|
||||
CALL MAKE_FILE ; and create the new-one
|
||||
JNB D_FILE_MADE ; yes
|
||||
MOV AL, 0FFH ; no, dump fails
|
||||
JMP AFTER_DUMP
|
||||
D_FILE_MADE:
|
||||
mov DUMP_FILE_HANDLE,ax
|
||||
CALL SET_DEFAULT_DMA
|
||||
; Fill the header record:
|
||||
MOV AX, 0 ; First fill with zeroes
|
||||
MOV DI, DEFAULT_DMA
|
||||
PUSH DS
|
||||
POP ES
|
||||
MOV CX, 64
|
||||
REP STOSW
|
||||
; Now put the info required by the debugger:
|
||||
MOV DI, DEFAULT_DMA
|
||||
; addr of MAIN process descr:
|
||||
MOV word ptr [DI], OFFSET RTS_PROCESS
|
||||
MOV word ptr 2[DI], DS
|
||||
; addr of descriptor of terminating process:
|
||||
LES SI,cur_proc_addr
|
||||
MOV [DI]+4, SI
|
||||
MOV [DI]+6, ES
|
||||
; put number of dumped areas:
|
||||
MOV BYTE PTR [DI]+14, 3
|
||||
; and version number of dump-file format:
|
||||
MOV BYTE PTR [DI]+15, 10H
|
||||
; start and end of interrupt vector table:
|
||||
MOV WORD PTR [DI]+16, 0
|
||||
MOV WORD PTR [DI]+18, 3FH
|
||||
; paragraph address of :
|
||||
mov ax,DUMP_LOW_START
|
||||
mov [di]+20, ax
|
||||
; end of lower memory area:
|
||||
MOV bx,DUMP_LOW_END
|
||||
MOV [DI]+22, BX ; top of main heap (parag)
|
||||
; start of higher memory area:
|
||||
MOV bx,DUMP_HIGH_START
|
||||
MOV [DI]+24, BX ; top of main stack (parag)
|
||||
; last paragraph of memory:
|
||||
MOV bx,DUMP_HIGH_END
|
||||
MOV [DI]+26, BX
|
||||
|
||||
mov ax,PD_SS
|
||||
mov [DI]+20H,ax
|
||||
mov ax,s_rts_SS
|
||||
mov [DI]+22H,ax
|
||||
mov ax,PD_SP
|
||||
mov [DI]+24H,ax
|
||||
mov ax,s_rts_SP
|
||||
mov [DI]+26H,ax
|
||||
mov ax,PD_CS
|
||||
mov [DI]+28H,ax
|
||||
mov ax,s_rts_CS
|
||||
mov [DI]+2AH,ax
|
||||
mov ax,PD_IP
|
||||
mov [DI]+2CH,ax
|
||||
mov ax,s_rts_IP
|
||||
mov [DI]+2EH,ax
|
||||
mov ax,PD_DS
|
||||
mov [DI]+30H,ax
|
||||
mov ax,s_rts_DS
|
||||
mov [DI]+32H,ax
|
||||
mov ax,PD_BP
|
||||
mov [DI]+34H,ax
|
||||
mov ax,s_rts_BP
|
||||
mov [DI]+36H,ax
|
||||
mov ax,0FFFFH
|
||||
mov [DI]+38H,ax ; mark end of main P.D. values
|
||||
|
||||
mov ax,PD_SS
|
||||
mov [DI]+3AH,ax
|
||||
mov ax,s_cur_SS
|
||||
mov [DI]+3CH,ax
|
||||
mov ax,PD_SP
|
||||
mov [DI]+3EH,ax
|
||||
mov ax,s_cur_SP
|
||||
mov [DI]+40H,ax
|
||||
mov ax,PD_CS
|
||||
mov [DI]+42H,ax
|
||||
mov ax,s_cur_CS
|
||||
mov [DI]+44H,ax
|
||||
mov ax,PD_IP
|
||||
mov [DI]+46H,ax
|
||||
mov ax,s_cur_IP
|
||||
mov [DI]+48H,ax
|
||||
mov ax,PD_DS
|
||||
mov [DI]+4AH,ax
|
||||
mov ax,s_cur_DS
|
||||
mov [DI]+4CH,ax
|
||||
mov ax,PD_BP
|
||||
mov [DI]+4EH,ax
|
||||
mov ax,s_cur_BP
|
||||
mov [DI]+50H,ax
|
||||
mov ax,0FFFFH
|
||||
mov [DI]+52H,ax ; mark end of current P.D. values
|
||||
|
||||
; Send the first record to the file:
|
||||
CALL SEQ_WRITE
|
||||
CMP AL, 80H
|
||||
MOV AX, 0FFH ; to indicate error, necessary if AL = 0
|
||||
JNE DUMP_BAD
|
||||
|
||||
; Now dump the memory:
|
||||
; We dump 3 memory areas: the interrupt vectors (0..3FFH), the 'low'
|
||||
; memory from start of RESIDENT to heaptop of main and the 'high'
|
||||
; memory starting at stacktop of main to end of memory.
|
||||
; These 3 areas are dumped paragraph-wise.
|
||||
MOV CX, 0 ; start of first area
|
||||
MOV BX, 03FH ; end of first area
|
||||
CALL DUMP_PART
|
||||
CMP AL, 0
|
||||
JNE DUMP_BAD ; there was an error
|
||||
MOV CX, DUMP_LOW_START ; start of second area
|
||||
MOV BX, DUMP_LOW_END ; end of second area
|
||||
CALL DUMP_PART
|
||||
CMP AL, 0
|
||||
JNE DUMP_BAD ; there was an error
|
||||
MOV CX, DUMP_HIGH_START ; start of third area
|
||||
MOV BX, DUMP_HIGH_END ; end of third area
|
||||
CALL DUMP_PART
|
||||
CMP AL, 0
|
||||
JNE DUMP_BAD ; there was an error
|
||||
MOV AX, 0 ; to indicate 'no error'
|
||||
DUMP_BAD:
|
||||
PUSH AX
|
||||
; Close the file:
|
||||
CALL CLOSE_FILE
|
||||
POP AX
|
||||
|
||||
AFTER_DUMP:
|
||||
; Dump is made. AX contains 0 for successfull
|
||||
; dump and > 0 if an error occured:
|
||||
CMP AX, 0
|
||||
JE DUMP_OK
|
||||
LEA DX, BAD_DUMP_MSG
|
||||
CALL WRITE_MSG
|
||||
CALL DELETE_FILE
|
||||
JMP DUMP_EXIT
|
||||
DUMP_OK:
|
||||
LEA DX, OK_DUMP_MSG
|
||||
CALL WRITE_MSG
|
||||
DUMP_EXIT:
|
||||
; Restore the disk of before the dump:
|
||||
MOV DL, SAVED_DISK
|
||||
CALL SELECT_DISK
|
||||
|
||||
; set breakvector to previous ISR
|
||||
mov ds, rts_ds
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
mov bx, 4 * 1BH
|
||||
mov ax, word ptr old_break
|
||||
mov es: [bx], ax
|
||||
mov ax, word ptr old_break+2
|
||||
mov es: 2[bx], ax
|
||||
|
||||
RET
|
||||
|
||||
P_M_DUMP endp
|
||||
;------------
|
||||
|
||||
|
||||
data segment public 'data' ; data for the following procedure
|
||||
|
||||
TEMP_W DW ? ; auxiliary word-variable
|
||||
|
||||
DUMP_AT_ONCE EQU 0FFFH ; number of pargraphs that will be
|
||||
; dumped with one write.
|
||||
data ends
|
||||
|
||||
|
||||
DUMP_PART proc NEAR
|
||||
;------------------
|
||||
; Dumps a part of the memory to the open dump file
|
||||
; at the current position.
|
||||
; Upon entry:
|
||||
; CX holds addr of first paragraph to
|
||||
; dump; BX is addr of last paragraph
|
||||
; to dump (BX=CX means 1 par. to dump);
|
||||
; file handle in external variable DUMP_FILE_HANDLE.
|
||||
; Upon exit:
|
||||
; AL=0 if no error occurred while writing,
|
||||
; AL=0FFH otherwise.
|
||||
|
||||
; compute number of paragraphs to dump:
|
||||
MOV AX, BX
|
||||
INC AX ; can't be last paragraph (boot!)
|
||||
SUB AX, CX ; startaddr < endaddr ?
|
||||
JBE DP_BAD ; no
|
||||
DP_NEXT: ; yes
|
||||
; save the parameters:
|
||||
PUSH CX ; first paragraph to dump
|
||||
PUSH AX ; # of paragraphs to dump
|
||||
MOV DX, CX
|
||||
; compute number of paragraphs to dump at once:
|
||||
CMP AX, DUMP_AT_ONCE
|
||||
JBE DP_NBR_PARA_SET ; dump remaining paragraphs
|
||||
MOV AX, DUMP_AT_ONCE ; dump maximum possible
|
||||
DP_NBR_PARA_SET:
|
||||
; transform number of paragraphs in bytes:
|
||||
MOV CL, 4
|
||||
SHL AX, CL
|
||||
MOV CX, AX
|
||||
MOV TEMP_W, AX ; save it for the compare
|
||||
; get file handle:
|
||||
MOV BX, DUMP_FILE_HANDLE
|
||||
; set transfer address:
|
||||
PUSH DS
|
||||
MOV DS, DX
|
||||
MOV DX, 0
|
||||
; and write the bytes:
|
||||
MOV AH, 40H
|
||||
INT OS
|
||||
POP DS
|
||||
CMP AX, TEMP_W ; write ok ?
|
||||
POP AX ; # of pargraphs to dump
|
||||
POP CX ; first paragraph to dump
|
||||
JNE DP_BAD ; no
|
||||
; update pointer and counter:
|
||||
CMP AX, DUMP_AT_ONCE
|
||||
JBE DP_GOOD ; we're finished
|
||||
SUB AX, DUMP_AT_ONCE
|
||||
ADD CX, DUMP_AT_ONCE
|
||||
JMP SHORT DP_NEXT
|
||||
DP_BAD:
|
||||
MOV AL, 0FFH
|
||||
RET
|
||||
DP_GOOD:
|
||||
MOV AL, 0
|
||||
RET
|
||||
DUMP_PART endp
|
||||
;------------------------------------------------------------------
|
||||
|
||||
|
||||
OPEN_FILE:
|
||||
; open file in FILE_SPEC: returns carry flag set if not found
|
||||
mov ax,3D01H ; open for write only
|
||||
mov dx,offset DUMP_FILE_SPEC
|
||||
int OS
|
||||
ret
|
||||
|
||||
|
||||
CLOSE_FILE:
|
||||
; closes the file given in the DUMP_FILE_HANDLE
|
||||
mov ah,3EH
|
||||
mov bx,DUMP_FILE_HANDLE
|
||||
int OS
|
||||
ret
|
||||
|
||||
|
||||
DELETE_FILE:
|
||||
; deletes the file given in the DUMP_FILE_SPEC
|
||||
mov ah,41H
|
||||
mov dx,offset DUMP_FILE_SPEC
|
||||
int OS
|
||||
ret
|
||||
|
||||
|
||||
SET_DEFAULT_DMA:
|
||||
; DS is assumed to be the one of RTS
|
||||
mov dx, DEFAULT_DMA
|
||||
mov ah, 01Ah
|
||||
int OS
|
||||
ret
|
||||
|
||||
|
||||
SEQ_WRITE:
|
||||
; writes the next byte in the file given
|
||||
; in the DUMP_FILE_HANDLE.
|
||||
push ds
|
||||
mov ah,2FH ; get current dma (buffer address)
|
||||
int os
|
||||
push es
|
||||
push bx
|
||||
mov bx,DUMP_FILE_HANDLE
|
||||
pop dx
|
||||
mov cx,80H
|
||||
mov ah,40H
|
||||
pop ds
|
||||
int OS
|
||||
pop ds
|
||||
ret
|
||||
|
||||
|
||||
MAKE_FILE:
|
||||
; creates the file given in the DUMP_FILE_SPEC
|
||||
mov ah, 3CH
|
||||
mov cx,0 ; attribute of zero
|
||||
mov dx,offset DUMP_FILE_SPEC
|
||||
int OS
|
||||
ret
|
||||
|
||||
|
||||
code ends
|
||||
;*****************************************************************************
|
||||
|
||||
|
||||
end
|
||||
|
BIN
Logitech Modula-2 v1.1/DBXCLI.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DBXCLI.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DBXINOUT.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DBXINOUT.LNK
Normal file
Binary file not shown.
103
Logitech Modula-2 v1.1/DEVICES.DEF
Normal file
103
Logitech Modula-2 v1.1/DEVICES.DEF
Normal file
@ -0,0 +1,103 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Devices;
|
||||
(*
|
||||
Additional facilities for device and interrupt handling
|
||||
|
||||
The MODULA-2/86 system (i.e. the run-time support)
|
||||
maintains a device mask that indicates from which devices
|
||||
interrupts are enabled. When the program is running at no
|
||||
priority, this device mask is identical to the mask
|
||||
register of the interrupt controller. If the program is
|
||||
running at some priority, then the mask register of the
|
||||
interrupt controller is set to the logical OR of the
|
||||
device mask and the corresponding priority mask. When
|
||||
the priority or the device mask changes, the MODULA-2/86
|
||||
system will set the mask register of the interrupt
|
||||
controller in this way. At any point in time, all the
|
||||
interrupts masked out, either in the device mask or in the
|
||||
current priority mask, are disabled. The priority mask for
|
||||
'no priority' does not mask out any interrupt, i.e. its
|
||||
value is all zeros.
|
||||
|
||||
When writing interrupt handlers in MODULA-2/86, it is
|
||||
strongly recommended to use only the procedures provided
|
||||
by this module, and not to access directly the mask
|
||||
register of the interrupt controller.
|
||||
|
||||
The following should be performed in order to install an
|
||||
interrupt handler: First save the old interrupt vector,
|
||||
then set up the interrupt handler (IOTRANSFER), and if
|
||||
necessary, save the current device status (interrupts
|
||||
enabled or disabled) and enable interrupts from the
|
||||
device.
|
||||
|
||||
Before the program terminates, or in order to remove an
|
||||
interrupt handler, the following sequence of procedure
|
||||
calls should be performed: If necessary, restore the old
|
||||
device status or disable interrupts from the device, and
|
||||
then restore the old interrupt vector.
|
||||
|
||||
At the end of a program the MODULA-2/86 system will reset
|
||||
the mask register of the interrupt controller to its
|
||||
initial value.
|
||||
*)
|
||||
|
||||
|
||||
FROM SYSTEM IMPORT ADDRESS;
|
||||
|
||||
EXPORT QUALIFIED
|
||||
GetDeviceStatus, SetDeviceStatus,
|
||||
SaveInterruptVector, RestoreInterruptVector;
|
||||
|
||||
|
||||
PROCEDURE GetDeviceStatus(device: CARDINAL;
|
||||
VAR enabled: BOOLEAN);
|
||||
(*
|
||||
- Return the status of a device in the device mask
|
||||
|
||||
in: device device to be checked
|
||||
|
||||
out: enabled TRUE if interrupts from the device are
|
||||
enabled, FALSE otherwise
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetDeviceStatus(device: CARDINAL;
|
||||
enable: BOOLEAN);
|
||||
(*
|
||||
- Set the status of a device in the device mask
|
||||
|
||||
in: device device to enable or disable
|
||||
enable if TRUE, enable interrupts from the
|
||||
device, otherwise disable them
|
||||
|
||||
The mask register of the interrupt controller will
|
||||
be updated according to the current priority and
|
||||
the new device mask.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SaveInterruptVector(vectorNr: CARDINAL;
|
||||
VAR vector: ADDRESS);
|
||||
(*
|
||||
- Save the current value of an interrupt vector
|
||||
|
||||
in: vectorNr interrupt vector number
|
||||
|
||||
out: vector value of current interrupt vector
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE RestoreInterruptVector(vectorNr: CARDINAL;
|
||||
vector: ADDRESS);
|
||||
(*
|
||||
- Restore the value of an interrupt vector
|
||||
|
||||
in: vectorNr interrupt vector number
|
||||
vector value to restore (previously saved
|
||||
with 'SaveInterruptVector')
|
||||
*)
|
||||
|
||||
|
||||
END Devices.
|
||||
|
BIN
Logitech Modula-2 v1.1/DEVICES.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DEVICES.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DEVICES.REF
Normal file
BIN
Logitech Modula-2 v1.1/DEVICES.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DEVICES.SYM
Normal file
BIN
Logitech Modula-2 v1.1/DEVICES.SYM
Normal file
Binary file not shown.
77
Logitech Modula-2 v1.1/DIRECTOR.DEF
Normal file
77
Logitech Modula-2 v1.1/DIRECTOR.DEF
Normal file
@ -0,0 +1,77 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Directories;
|
||||
(*
|
||||
Additional directory operations
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED
|
||||
DirQueryProc, DirResult, DirQuery,
|
||||
Delete, Rename;
|
||||
|
||||
|
||||
TYPE
|
||||
DirQueryProc = PROCEDURE(ARRAY OF CHAR, VAR BOOLEAN);
|
||||
|
||||
DirResult = (OK,
|
||||
ExistingFile, (* rename to existing name *)
|
||||
NoFile, (* file not found *)
|
||||
OtherError);
|
||||
|
||||
|
||||
PROCEDURE DirQuery( wildFileName : ARRAY OF CHAR;
|
||||
DirProc : DirQueryProc;
|
||||
VAR result : DirResult);
|
||||
(*
|
||||
- Apply the a procedure to all matching files
|
||||
|
||||
in: wildFileName file name, wild-characters are allowed
|
||||
DirProc procedure to be called for each file
|
||||
matching 'wildFileName'
|
||||
|
||||
out: result result of directory operation
|
||||
|
||||
'DirQuery' executes 'DirProc' on each file which satisfies
|
||||
the specification of 'wildFileName' where wild-characters
|
||||
are allowed. If no more files are found, or as soon as
|
||||
'DirProc' returns FALSE, the execution is stopped.
|
||||
|
||||
If an incorrect filename is passed, this may return a
|
||||
'result <> OK', and 'DirProc' will not be called.
|
||||
|
||||
Possible results are OK, NoFile, or OtherError.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Delete( FileName : ARRAY OF CHAR;
|
||||
VAR result : DirResult);
|
||||
|
||||
(*
|
||||
- Delete a file.
|
||||
|
||||
in: FileName name of the file to delete
|
||||
|
||||
out: result result of directory operation
|
||||
|
||||
Possible results are OK, or NoFile.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Rename( FromName : ARRAY OF CHAR;
|
||||
ToName : ARRAY OF CHAR;
|
||||
VAR result : DirResult);
|
||||
(*
|
||||
- Rename a file.
|
||||
|
||||
in: FromName name of the file to rename
|
||||
ToName new name of the file
|
||||
|
||||
out: result result of directory operation
|
||||
|
||||
Possible results are OK, NoFile, ExistingFile, or
|
||||
OtherError.
|
||||
*)
|
||||
|
||||
|
||||
END Directories.
|
||||
|
BIN
Logitech Modula-2 v1.1/DIRECTOR.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DIRECTOR.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DIRECTOR.REF
Normal file
BIN
Logitech Modula-2 v1.1/DIRECTOR.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DIRECTOR.SYM
Normal file
BIN
Logitech Modula-2 v1.1/DIRECTOR.SYM
Normal file
Binary file not shown.
120
Logitech Modula-2 v1.1/DISKDIRE.DEF
Normal file
120
Logitech Modula-2 v1.1/DISKDIRE.DEF
Normal file
@ -0,0 +1,120 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE DiskDirectory;
|
||||
(*
|
||||
Interface to directory functions of the underlying OS
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED
|
||||
CurrentDrive, SelectDrive,
|
||||
CurrentDirectory, ChangeDirectory,
|
||||
MakeDir, RemoveDir,
|
||||
ResetDiskSys, ResetDrive;
|
||||
|
||||
|
||||
PROCEDURE CurrentDrive (VAR drive: CHAR);
|
||||
(*
|
||||
- Returns the current default drive.
|
||||
|
||||
out: drive name of the default drive, given in
|
||||
character format (e.g. 'A').
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SelectDrive (drive: CHAR; VAR done: BOOLEAN);
|
||||
(*
|
||||
- Set default drive.
|
||||
|
||||
in: drive name of drive to make default, specified
|
||||
in character format.
|
||||
|
||||
out: done TRUE if operation was successful.
|
||||
|
||||
The default drive will be used by all routines referring
|
||||
to DK: .
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE CurrentDirectory (drive: CHAR;
|
||||
VAR dir: ARRAY OF CHAR);
|
||||
(*
|
||||
- Gets the current directory for the specified drive.
|
||||
|
||||
in: drive name of the drive, specified in
|
||||
character format (e.g. 'A'); blank or
|
||||
0C denotes the current drive.
|
||||
|
||||
out: dir current directory for that drive.
|
||||
|
||||
Under DOS 1.1, dir[0] will be set to nul (0C).
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ChangeDirectory (dir: ARRAY OF CHAR;
|
||||
VAR done: BOOLEAN);
|
||||
(*
|
||||
- Set the current directory
|
||||
|
||||
in: dir drive and directory path name.
|
||||
|
||||
out: done TRUE if successful; FALSE if the
|
||||
directory does not exist.
|
||||
|
||||
Under DOS 1.1, this function has no effect and 'done'
|
||||
is FALSE.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE MakeDir (dir: ARRAY OF CHAR;
|
||||
VAR done: BOOLEAN);
|
||||
(*
|
||||
- Create a sub-directory
|
||||
|
||||
in: dir drive, optional pathname and name of
|
||||
sub-directory to create.
|
||||
|
||||
out: done TRUE if successful; FALSE if path or
|
||||
drive does not exist.
|
||||
|
||||
Under DOS 1.1, this function has no effect and 'done'
|
||||
is FALSE.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE RemoveDir (dir: ARRAY OF CHAR;
|
||||
VAR done: BOOLEAN);
|
||||
(*
|
||||
- Remove a directory
|
||||
|
||||
in: dir drive and name of the sub-directory
|
||||
to remove.
|
||||
|
||||
out: done: TRUE if successful; FALSE if directory
|
||||
does not exist.
|
||||
|
||||
The specified directory must be empty or the procedure
|
||||
returns FALSE. Under DOS 1.1, this function has no effect
|
||||
and 'done' is FALSE.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ResetDiskSys;
|
||||
(*
|
||||
- MS-DOS disk reset
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ResetDrive (d: CHAR): CARDINAL;
|
||||
(*
|
||||
- This function has no effect and always returns 255.
|
||||
It is part of this definition module for reasons of
|
||||
compatibility with other implementations.
|
||||
*)
|
||||
|
||||
|
||||
END DiskDirectory.
|
||||
|
||||
|
BIN
Logitech Modula-2 v1.1/DISKDIRE.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DISKDIRE.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DISKDIRE.REF
Normal file
BIN
Logitech Modula-2 v1.1/DISKDIRE.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DISKDIRE.SYM
Normal file
BIN
Logitech Modula-2 v1.1/DISKDIRE.SYM
Normal file
Binary file not shown.
54
Logitech Modula-2 v1.1/DISKFILE.DEF
Normal file
54
Logitech Modula-2 v1.1/DISKFILE.DEF
Normal file
@ -0,0 +1,54 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE DiskFiles;
|
||||
(*
|
||||
Interface to disk file functions of the underlying OS.
|
||||
[Private module of the Modula-2 system.]
|
||||
|
||||
The default drive 'DK:', and drives 'A:' through 'P:'
|
||||
are supported under DOS or CP/M-86. This driver provides
|
||||
buffering. The maximum number of open files is 12.
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
FROM FileSystem IMPORT File;
|
||||
|
||||
EXPORT QUALIFIED
|
||||
InitDiskSystem,
|
||||
DiskFileProc, DiskDirProc;
|
||||
|
||||
|
||||
PROCEDURE InitDiskSystem;
|
||||
(*
|
||||
- Initialize mediums for further disk file operations
|
||||
|
||||
This procedure has to be imported by FileSystem. This has
|
||||
the side-effect, that this module is referenced and will
|
||||
therefore be linked to the user program.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE DiskFileProc (VAR f: File);
|
||||
(*
|
||||
- low-level interface for disk operations within a file
|
||||
|
||||
This procedure is passed as a parameter to the procedure
|
||||
CreateMedium in FileSystem.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE DiskDirProc (VAR f: File;
|
||||
name: ARRAY OF CHAR);
|
||||
(*
|
||||
- low-level interface for disk operations within a
|
||||
directory
|
||||
|
||||
This procedure is passed as a parameter to the procedure
|
||||
CreateMedium in FileSystem.
|
||||
*)
|
||||
|
||||
|
||||
END DiskFiles.
|
||||
|
BIN
Logitech Modula-2 v1.1/DISKFILE.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DISKFILE.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DISKFILE.REF
Normal file
BIN
Logitech Modula-2 v1.1/DISKFILE.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DISKFILE.SYM
Normal file
BIN
Logitech Modula-2 v1.1/DISKFILE.SYM
Normal file
Binary file not shown.
35
Logitech Modula-2 v1.1/DISPLAY.DEF
Normal file
35
Logitech Modula-2 v1.1/DISPLAY.DEF
Normal file
@ -0,0 +1,35 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Display;
|
||||
(*
|
||||
Low-level Console Output
|
||||
[Private module of the Modula-2 system]
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED Write;
|
||||
|
||||
|
||||
PROCEDURE Write (ch: CHAR);
|
||||
(*
|
||||
- Display a character on the console.
|
||||
|
||||
in: ch character to be displayed.
|
||||
|
||||
The following codes are interpreted:
|
||||
|
||||
ASCII.EOL (36C) = go to beginning of next line
|
||||
ASCII.ff (14C) = clear screen and set cursor home
|
||||
ASCII.del (177C) = erase the last character on the left
|
||||
ASCII.bs (10C) = move 1 character to the left
|
||||
ASCII.cr (15C) = go to beginning of current line
|
||||
ASCII.lf (12C) = move 1 line down, same column
|
||||
|
||||
Write uses direct console I/O.
|
||||
*)
|
||||
|
||||
|
||||
END Display.
|
||||
|
BIN
Logitech Modula-2 v1.1/DISPLAY.LNK
Normal file
BIN
Logitech Modula-2 v1.1/DISPLAY.LNK
Normal file
Binary file not shown.
60
Logitech Modula-2 v1.1/DISPLAY.MOD
Normal file
60
Logitech Modula-2 v1.1/DISPLAY.MOD
Normal file
@ -0,0 +1,60 @@
|
||||
(*$T-*)
|
||||
(*$R-*)
|
||||
(****************************************************************)
|
||||
(* *)
|
||||
(* MODULA-2/86 Library *)
|
||||
(* *)
|
||||
(* LOGITECH SA., CH-1143 Apples (Switzerland) *)
|
||||
(* *)
|
||||
(* Module: Display *)
|
||||
(* Terminal driver for writing to the screen. *)
|
||||
(* This module is private to the Terminal Sub-System and *)
|
||||
(* should not be used by application programs. *)
|
||||
(* *)
|
||||
(* Version 1.05 (Aug 84) *)
|
||||
(* Characters are output through MS-DOS. *)
|
||||
(* The special characters, which are interpreted, *)
|
||||
(* produce code-sequences, according to ANSI standard. *)
|
||||
(* *)
|
||||
(* (C) Copyright 1983, 1984 Logitech, All Rights Reserved *)
|
||||
(* *)
|
||||
(* Permission is hereby granted to registered users to use *)
|
||||
(* or abstract the following program in the implementation *)
|
||||
(* of customized versions. This permission does not *)
|
||||
(* include the right to redistribute the source code of *)
|
||||
(* this program. *)
|
||||
(****************************************************************)
|
||||
|
||||
(*$T-*)
|
||||
(*$R-*)
|
||||
IMPLEMENTATION MODULE Display; (* WS *)
|
||||
FROM SYSTEM IMPORT DOSCALL;
|
||||
FROM ASCII IMPORT EOL;
|
||||
|
||||
|
||||
PROCEDURE Write (ch: CHAR);
|
||||
(* the following code are interpreted:
|
||||
14C = FF, clear page, cursor home
|
||||
ASCII.EOL, go to beginning of next line (scrolls possibly)
|
||||
177C = DEL, backspace one char and clear it
|
||||
*)
|
||||
|
||||
BEGIN (* ANSI standard : *)
|
||||
IF ch = 177C THEN (* Delete *)
|
||||
DOSCALL (6, 10C); (* BackSpace *)
|
||||
DOSCALL (6, ' ');
|
||||
DOSCALL (6, 10C); (* BackSpace *)
|
||||
ELSIF ch = EOL THEN (* EOL: end of line character in Modula system *)
|
||||
DOSCALL (6, 15C);
|
||||
DOSCALL (6, 12C);
|
||||
ELSIF ch = 14C THEN (* Form Feed: clear screen *)
|
||||
DOSCALL (6, 33C);
|
||||
DOSCALL (6, '[');
|
||||
DOSCALL (6, '2');
|
||||
DOSCALL (6, 'J');
|
||||
ELSE DOSCALL (6, ch);
|
||||
END;
|
||||
END Write;
|
||||
|
||||
END Display.
|
||||
|
BIN
Logitech Modula-2 v1.1/DISPLAY.REF
Normal file
BIN
Logitech Modula-2 v1.1/DISPLAY.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/DISPLAY.SYM
Normal file
BIN
Logitech Modula-2 v1.1/DISPLAY.SYM
Normal file
Binary file not shown.
49
Logitech Modula-2 v1.1/E.MOD
Normal file
49
Logitech Modula-2 v1.1/E.MOD
Normal file
@ -0,0 +1,49 @@
|
||||
(*$S-*)
|
||||
(*$R-*)
|
||||
(*$T-*)
|
||||
|
||||
MODULE e;
|
||||
|
||||
FROM SYSTEM IMPORT WORD, BYTE, ADDRESS;
|
||||
FROM NumberConversion IMPORT StringToCard;
|
||||
FROM Strings IMPORT Assign;
|
||||
FROM InOut IMPORT WriteLn, WriteInt, WriteCard, WriteString;
|
||||
FROM Clock IMPORT GetTime, Time;
|
||||
|
||||
CONST
|
||||
DIGITS = 200;
|
||||
|
||||
VAR
|
||||
high, n, x : CARDINAL;
|
||||
a : ARRAY [ 0..DIGITS ] OF CARDINAL;
|
||||
|
||||
BEGIN
|
||||
high := DIGITS;
|
||||
x := 0;
|
||||
|
||||
n := high - 1;
|
||||
WHILE n > 0 DO
|
||||
a[ n ] := 1;
|
||||
n := n - 1;
|
||||
END;
|
||||
|
||||
a[ 1 ] := 2;
|
||||
a[ 0 ] := 0;
|
||||
|
||||
WHILE high > 9 DO
|
||||
high := high - 1;
|
||||
n := high;
|
||||
WHILE 0 <> n DO
|
||||
a[ n ] := x MOD n;
|
||||
x := 10 * a[ n - 1 ] + x DIV n;
|
||||
n := n - 1;
|
||||
END;
|
||||
|
||||
WriteCard( x, 0 );
|
||||
END;
|
||||
|
||||
WriteLn;
|
||||
WriteString( "done" );
|
||||
WriteLn;
|
||||
END e.
|
||||
|
BIN
Logitech Modula-2 v1.1/E87MATH0.LNK
Normal file
BIN
Logitech Modula-2 v1.1/E87MATH0.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87MATH0.REF
Normal file
BIN
Logitech Modula-2 v1.1/E87MATH0.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87REALC.LNK
Normal file
BIN
Logitech Modula-2 v1.1/E87REALC.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87REALC.REF
Normal file
BIN
Logitech Modula-2 v1.1/E87REALC.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87REALI.LNK
Normal file
BIN
Logitech Modula-2 v1.1/E87REALI.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87REALI.REF
Normal file
BIN
Logitech Modula-2 v1.1/E87REALI.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/E87REALS.LNK
Normal file
BIN
Logitech Modula-2 v1.1/E87REALS.LNK
Normal file
Binary file not shown.
9
Logitech Modula-2 v1.1/EXAMP1.MOD
Normal file
9
Logitech Modula-2 v1.1/EXAMP1.MOD
Normal file
@ -0,0 +1,9 @@
|
||||
MODULE Examp1;
|
||||
FROM Terminal IMPORT WriteString, WriteLn, Read;
|
||||
VAR ch: CHAR;
|
||||
BEGIN
|
||||
WriteString('The program worked! (Hit a key)');
|
||||
WriteLn;
|
||||
Read(ch);
|
||||
END Examp1.
|
||||
|
47
Logitech Modula-2 v1.1/EXAMP2.MOD
Normal file
47
Logitech Modula-2 v1.1/EXAMP2.MOD
Normal file
@ -0,0 +1,47 @@
|
||||
MODULE Examp2; (* Program Module to demonstrate basic file I/O *)
|
||||
|
||||
IMPORT InOut;
|
||||
FROM InOut IMPORT
|
||||
OpenInput, OpenOutput, CloseInput, CloseOutput, Read, Write, EOL;
|
||||
IMPORT Terminal; (* get qualified access to Terminal routines *)
|
||||
IMPORT CardinalIO;
|
||||
|
||||
CONST ESC = 33C;
|
||||
|
||||
VAR Ch: CHAR;
|
||||
LinesToCopy, LinesCopied: CARDINAL;
|
||||
|
||||
BEGIN
|
||||
(* Note that interaction with user is done via Terminal and CardinalIO,
|
||||
* because InOut input/output is being redirected to files.
|
||||
*)
|
||||
REPEAT
|
||||
Terminal.WriteString("enter input file:"); Terminal.WriteLn;
|
||||
OpenInput(""); (* request input file, no default extension *)
|
||||
UNTIL InOut.Done; (* keep trying until open is successful *)
|
||||
REPEAT
|
||||
Terminal.WriteString("Lines to copy> ");
|
||||
CardinalIO.ReadCardinal(LinesToCopy); Terminal.WriteLn;
|
||||
Terminal.Read(Ch); (* read terminator of ReadCardinal *)
|
||||
UNTIL Ch <> ESC; (* keep asking until entry ends with ' ' or EOL *)
|
||||
REPEAT
|
||||
Terminal.WriteString("enter output file:"); Terminal.WriteLn;
|
||||
OpenOutput(""); (* request output file, no default extension *)
|
||||
UNTIL InOut.Done;
|
||||
LinesCopied := 0;
|
||||
LOOP
|
||||
IF LinesCopied >= LinesToCopy THEN EXIT END;
|
||||
Read(Ch); (* read from in file *)
|
||||
IF NOT InOut.Done THEN EXIT END; (* check for EOF *)
|
||||
Write(Ch); (* otherwise copy char *)
|
||||
IF Ch = EOL THEN INC(LinesCopied) END;
|
||||
END; (* LOOP *)
|
||||
IF LinesCopied < LinesToCopy THEN
|
||||
Terminal.WriteString("[Only ");
|
||||
CardinalIO.WriteCardinal(LinesCopied,0);
|
||||
Terminal.WriteString(" lines in file]"); Terminal.WriteLn;
|
||||
END;
|
||||
CloseOutput;
|
||||
CloseInput;
|
||||
END Examp2.
|
||||
|
27
Logitech Modula-2 v1.1/FILEMESS.DEF
Normal file
27
Logitech Modula-2 v1.1/FILEMESS.DEF
Normal file
@ -0,0 +1,27 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE FileMessage;
|
||||
(*
|
||||
Write file status/response to the terminal
|
||||
*)
|
||||
|
||||
FROM FileSystem IMPORT Response;
|
||||
|
||||
EXPORT QUALIFIED WriteResponse;
|
||||
|
||||
|
||||
PROCEDURE WriteResponse (r: Response);
|
||||
(*
|
||||
- Write a short description of a FileSystem response on
|
||||
the terminal.
|
||||
|
||||
in: r the response from some FileSystem
|
||||
operation.
|
||||
|
||||
The actual argument for 'r' is typically the field 'res'
|
||||
of a variable of type 'File'. The printed message is up
|
||||
to 32 characters long.
|
||||
*)
|
||||
|
||||
|
||||
END FileMessage.
|
||||
|
BIN
Logitech Modula-2 v1.1/FILEMESS.LNK
Normal file
BIN
Logitech Modula-2 v1.1/FILEMESS.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILEMESS.REF
Normal file
BIN
Logitech Modula-2 v1.1/FILEMESS.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILEMESS.SYM
Normal file
BIN
Logitech Modula-2 v1.1/FILEMESS.SYM
Normal file
Binary file not shown.
38
Logitech Modula-2 v1.1/FILENAME.DEF
Normal file
38
Logitech Modula-2 v1.1/FILENAME.DEF
Normal file
@ -0,0 +1,38 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE FileNames;
|
||||
(*
|
||||
Read a file specification from the terminal.
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED
|
||||
FNParts, FNPartSet, ReadFileName;
|
||||
|
||||
|
||||
TYPE
|
||||
FNParts = (FNDrive, FNPath, FNName, FNExt);
|
||||
FNPartSet = SET OF FNParts;
|
||||
|
||||
|
||||
PROCEDURE ReadFileName(VAR resultFN: ARRAY OF CHAR;
|
||||
defaultFN: ARRAY OF CHAR;
|
||||
VAR ReadInName: FNPartSet);
|
||||
(*
|
||||
- Read a file specification from terminal.
|
||||
|
||||
in: defaultFN default file specification,
|
||||
out: resultFN the file specification read,
|
||||
ReadInName which parts are in specification.
|
||||
|
||||
Reads until a <cr>, blank, <can>, or <esc> is typed.
|
||||
After a call to ReadFileName, Terminal.Read must be called
|
||||
to read the termination character. The format of the
|
||||
specification depends on the host operating system.
|
||||
*)
|
||||
|
||||
|
||||
END FileNames.
|
||||
|
BIN
Logitech Modula-2 v1.1/FILENAME.LNK
Normal file
BIN
Logitech Modula-2 v1.1/FILENAME.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILENAME.REF
Normal file
BIN
Logitech Modula-2 v1.1/FILENAME.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILENAME.SYM
Normal file
BIN
Logitech Modula-2 v1.1/FILENAME.SYM
Normal file
Binary file not shown.
657
Logitech Modula-2 v1.1/FILESYST.DEF
Normal file
657
Logitech Modula-2 v1.1/FILESYST.DEF
Normal file
@ -0,0 +1,657 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE FileSystem;
|
||||
(*
|
||||
File manipulation routines
|
||||
|
||||
This implementation is based on the underlying operating
|
||||
system for file handling. It distinguishes between BINARY
|
||||
files and TEXT files.
|
||||
|
||||
File structure:
|
||||
|
||||
After any file operation the result should be checked
|
||||
for errors, by testing the field 'res' of the file
|
||||
variable (see type declarations for 'File' and
|
||||
'Response').
|
||||
|
||||
The BOOLEAN field 'eof' in a file variable (variable of
|
||||
type 'File)' allows to determine the end-of-file. It is
|
||||
set to TRUE after the first unsuccessful attempt to read
|
||||
information from the file. This first attempt to read
|
||||
beyond end-of-file does not set any error condition; the
|
||||
field 'res' of the file variable still indicates 'done'.
|
||||
However, the character (or other data) returned is
|
||||
not valid.
|
||||
|
||||
Binary files:
|
||||
|
||||
A file is a sequence of bytes with no other structure
|
||||
implied.
|
||||
|
||||
Under some operating systems (e.g. CP/M-86) the file
|
||||
may be organized in records (128 bytes each), and
|
||||
therefore, the length of a file will always be a
|
||||
multiple of this record size.
|
||||
|
||||
Text files:
|
||||
|
||||
A file is a sequence of characters. The character code
|
||||
32C (Ctrl-Z) indicates end-of-file). All other
|
||||
character codes from 0C to 377C are legal. When reading
|
||||
a text file, 'eof' becomes TRUE when encountering the
|
||||
character 32C, or at the pysical end of the file. When
|
||||
closing a text file that has been modified, the
|
||||
character 32C is written on the file.
|
||||
|
||||
When reading from a text file (by means of procedure
|
||||
'ReadChar'), the character ASCII.EOL is returned for
|
||||
the sequence <CR, LF>, or for a single <CR> or <LF>.
|
||||
When writing to a text file (by means of procedure
|
||||
'WriteChar'), the character ASCII.EOL is changed to
|
||||
the sequence <CR,LF>.
|
||||
|
||||
Any file is in one of the states 'opened', 'reading',
|
||||
'writing', or 'modifying'. These states have the following
|
||||
meaning:
|
||||
|
||||
opened = Content of file buffer is undefined and not
|
||||
associated with a position in the file.
|
||||
When starting to read or write from a file
|
||||
that is in state open, the state is changed
|
||||
implicitly to reading or writing.
|
||||
reading = No writing is allowed.
|
||||
writing = No reading is allowed. Writing always takes
|
||||
place at the end-of-file position.
|
||||
When writing on an existing file, which is
|
||||
(physically) longer than the current write
|
||||
position, it is undefined, whether the file
|
||||
is truncated upon a close.
|
||||
modifying = Reading and writing are allowed. Writing an
|
||||
element inside of a file means 'overwriting'
|
||||
the value of the element with a new value.
|
||||
Upon a close, the file is not truncated.
|
||||
|
||||
The state of the file is given by the field 'flags' of
|
||||
a file variable. By means of the procedures SetRead,
|
||||
SetWrite, SetModify, and SetOpen, it is possible to change
|
||||
the status of an open file.
|
||||
|
||||
To every file is associated a 'current position'. This
|
||||
corresponds to the number of the current byte inside the
|
||||
file, starting with zero for the first byte. The next
|
||||
reading or writing takes place at the current position.
|
||||
This position is updated automatically after reading or
|
||||
writing. It can also be inquired or set through the
|
||||
procedure GetPos or SetPos.
|
||||
|
||||
After the opening of a file (by means of Lookup or Create)
|
||||
it is state 'opened' and positioned at the beginning
|
||||
(low = 0, high = 0).
|
||||
|
||||
Conventions for filenames:
|
||||
|
||||
For the procedures Lookup and Rename, a filename has to be
|
||||
given, including a medium name (drive name), a file name
|
||||
and an optional file type. For the procedure Create, a
|
||||
medium name has to be given. The medium name is up to
|
||||
three characters long (alphanumeric, starting with a
|
||||
letter). It is separated from the file name by a colon
|
||||
(':'). The medium name must always be given explicitly.
|
||||
The default medium must be denoted by 'DK:'.
|
||||
Depending on the operating system, the file name may
|
||||
include a path name, specifying the the directory where
|
||||
the file exists. The length of the file (and path) name,
|
||||
and the characters legal for file names, depend on the
|
||||
operating system.
|
||||
|
||||
By default, the mediums (i.e. disk drives) handled by
|
||||
module 'DiskFiles' are installed.
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
FROM SYSTEM IMPORT ADDRESS, WORD, BYTE;
|
||||
|
||||
EXPORT QUALIFIED
|
||||
File, Response, Command,
|
||||
Flag, FlagSet,
|
||||
|
||||
(* basic file operations: *)
|
||||
Create, Close, Lookup, Rename, Delete,
|
||||
SetRead, SetWrite, SetModify, SetOpen,
|
||||
Doio,
|
||||
SetPos, GetPos, Length,
|
||||
|
||||
(* stream-like I/O: *)
|
||||
Reset, Again,
|
||||
ReadWord, ReadChar, ReadByte, ReadNBytes,
|
||||
WriteWord, WriteChar, WriteByte, WriteNBytes,
|
||||
|
||||
(* medium handling: *)
|
||||
MediumType,
|
||||
FileProc, DirectoryProc,
|
||||
CreateMedium, RemoveMedium,
|
||||
|
||||
FileNameChar;
|
||||
|
||||
|
||||
TYPE
|
||||
|
||||
MediumHint = CARDINAL;
|
||||
(*- medium index used in DiskFiles *)
|
||||
|
||||
MediumType = ARRAY [0..2] OF CHAR;
|
||||
(*- medium name (A, B...) *)
|
||||
|
||||
Flag = (er, ef, rd, wr, ag, txt);
|
||||
(*
|
||||
- status flag for file operations:
|
||||
|
||||
er = error occured, ef = end-of-file reached,
|
||||
rd = in read mode, wr = in write mode,
|
||||
ag = "Again" has been called after last read,
|
||||
txt = text-file (the last access to the file was a
|
||||
'WriteChar' or 'ReadChar').
|
||||
*)
|
||||
|
||||
FlagSet = SET OF Flag;
|
||||
(*- status flag set *)
|
||||
|
||||
Response = (done,
|
||||
notdone, notsupported, callerror,
|
||||
unknownmedium, unknownfile, paramerror,
|
||||
toomanyfiles, eom, userdeverror);
|
||||
(*- result of a file operation *)
|
||||
|
||||
Command = (create, close, lookup, rename, delete,
|
||||
setread, setwrite, setmodify, setopen,
|
||||
doio, setpos, getpos, length);
|
||||
(*- commands passed to module 'DiskFiles' *)
|
||||
|
||||
BuffAdd = POINTER TO ARRAY [0..0FFFEH] OF CHAR;
|
||||
(*- file buffer pointer type *)
|
||||
|
||||
File = RECORD
|
||||
bufa: BuffAdd;
|
||||
(*- buffer address *)
|
||||
buflength: CARDINAL;
|
||||
(*- size of buffer in bytes. In the
|
||||
current release it is always a
|
||||
multiple of 128. *)
|
||||
validlength: CARDINAL;
|
||||
(*- number of valid bytes in buffer *)
|
||||
bufind: CARDINAL;
|
||||
(*- byte-index to the buffer of the
|
||||
current position *)
|
||||
flags: FlagSet;
|
||||
(*- status of the file *)
|
||||
eof: BOOLEAN;
|
||||
(*- TRUE if last access was past the end
|
||||
of the file *)
|
||||
res: Response;
|
||||
(*- result of last operation *)
|
||||
lastRead: CARDINAL;
|
||||
(*- the word or byte (char) last read *)
|
||||
mt: MediumType;
|
||||
(*- selects the driver that supports this
|
||||
file *)
|
||||
fHint: CARDINAL;
|
||||
(*- used internally by device driver *)
|
||||
mHint: MediumHint;
|
||||
(*- used internally by medium handler *)
|
||||
CASE com: Command OF
|
||||
lookup: new: BOOLEAN;
|
||||
| setpos,
|
||||
getpos,
|
||||
length: highpos, lowpos: CARDINAL;
|
||||
END;
|
||||
END;
|
||||
(*- file structure used for bookkeeping by DiskFiles *)
|
||||
|
||||
|
||||
PROCEDURE Create (VAR f: File; mediumName: ARRAY OF CHAR);
|
||||
(*
|
||||
- create a temporary file
|
||||
|
||||
in: mediumName name of medium to create file on,
|
||||
in character format
|
||||
|
||||
out: f initialized file structure
|
||||
|
||||
A temporary file is characterized by an empty name. To
|
||||
make the file permanent, it has to be renamed with a
|
||||
non-empty name before closing it. For subsequent
|
||||
operations on this file, it is referenced by 'f'.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Close (VAR f: File);
|
||||
(*
|
||||
- Close a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f the field f.res will be set appropriately.
|
||||
|
||||
Terminates the operations on file "f". If "f" is a
|
||||
temporary file, it will be destroyed, whereas a file with
|
||||
a non-empty name remains on its medium and is accessible
|
||||
through "Lookup". When closing a text-file after writing,
|
||||
the end-of-file code 32C is written on the file (MS-DOS
|
||||
and CP/M-86 convention).
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Lookup (VAR f: File; fileName: ARRAY OF CHAR;
|
||||
newFile: BOOLEAN);
|
||||
(*
|
||||
- look for a file
|
||||
|
||||
in: filename drive and name of file to search for
|
||||
newFile TRUE if file should be created if
|
||||
not found
|
||||
|
||||
out: f initialized file structure; f.res will
|
||||
be set appropriately.
|
||||
|
||||
Searches the medium specified in "filename" for a file
|
||||
that matches the name and type given in "filename". If
|
||||
the file is not found and "newFile" is TRUE, a new
|
||||
(permanent) file with the given name and type is created.
|
||||
If it is not found and "newFile" is FALSE, no action
|
||||
takes place and "notdone" is returned in the result
|
||||
field of "f".
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Rename (VAR f: File; newname: ARRAY OF CHAR);
|
||||
(*
|
||||
- rename a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
newname filename to rename to, with
|
||||
device:name.type specified
|
||||
|
||||
out: f file name in f will be changed and the
|
||||
field f.res will be set appropriately.
|
||||
|
||||
The medium, on which the files reside can not be changed
|
||||
with this command. The medium name inside "newname" has
|
||||
to be the old one.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Delete (name: ARRAY OF CHAR; VAR f: File);
|
||||
(*
|
||||
- delete a file
|
||||
|
||||
in: name name of file to delete, with
|
||||
dev:name.type specified
|
||||
|
||||
out: f the field f.res will be set appropriately.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadWord (VAR f: File; VAR w: WORD);
|
||||
(*
|
||||
- Returns the word at the current position in f
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: w word read from file
|
||||
f the result field f.res will be set
|
||||
appropriately.
|
||||
|
||||
The file will be positioned at the next word when the
|
||||
read is done.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteWord (VAR f: File; w: WORD);
|
||||
(*
|
||||
- Write one word to a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
w word to write
|
||||
|
||||
out: f the field f.res will be set appropriately.
|
||||
|
||||
When overwriting, the file will be positioned at the next
|
||||
word when the write is done.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadChar (VAR f: File; VAR ch: CHAR);
|
||||
(*
|
||||
- Read one character from a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: ch character read from file
|
||||
f the field f.res will be set appropriately.
|
||||
|
||||
The file will be positioned at the next character when
|
||||
the read is done.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteChar (VAR f: File; ch: CHAR);
|
||||
(*
|
||||
- Write one character to a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
ch character to write
|
||||
|
||||
out: f the field f.res will be set apporopriately.
|
||||
|
||||
When overwriting, the file will be positioned at the next
|
||||
character when the write is done.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadByte (VAR f: File; VAR b: BYTE);
|
||||
(*
|
||||
- Read one byte from a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: b byte read from file
|
||||
f the field f.res will be set appropriately.
|
||||
|
||||
The file will be positioned at the next byte when the
|
||||
read is completed.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteByte (VAR f: File; b: BYTE);
|
||||
(*
|
||||
- Write one byte to a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
b byte to write
|
||||
|
||||
out: f the field f.res will be set appropriately.
|
||||
|
||||
When overwriting, the file will be positioned at the next
|
||||
byte when the write is done.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadNBytes (VAR f: File;
|
||||
bufPtr: ADDRESS;
|
||||
requestedBytes: CARDINAL;
|
||||
VAR read: CARDINAL);
|
||||
(*
|
||||
- Read a specified number of bytes from a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
bufPtr pointer to buffer area to read bytes into
|
||||
requestedBytes number of bytes to read
|
||||
|
||||
out: bufPtr^ bytes read from file
|
||||
f the field f.res will be set appropriately.
|
||||
read the number of bytes actually read.
|
||||
|
||||
The file will be positioned at the next byte after the
|
||||
requested sequence of bytes.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteNBytes (VAR f: File;
|
||||
bufPtr: ADDRESS;
|
||||
requestedBytes: CARDINAL;
|
||||
VAR written: CARDINAL);
|
||||
(*
|
||||
- Write a specified number of bytes to a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
bufPtr pointer to string of bytes to write
|
||||
requestedBytes number of bytes to write
|
||||
out: f the field f.res will be set appropriately.
|
||||
written the number of bytes actually written
|
||||
|
||||
When overwriting, the file will be positioned at the next
|
||||
byte after the requested sequence of bytes.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Again (VAR f: File);
|
||||
(*
|
||||
- returns a character to the buffer to be read again
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f the f.res field will be set appropriately.
|
||||
|
||||
This should be called after a read operation only (it has
|
||||
no effect otherwise). It prevents the subsequent read
|
||||
from reading the next element; the element just read
|
||||
before will be returned a second time. Multiple calls to
|
||||
Again without a read in between have the same effect as
|
||||
one call to Again. The position in the file is undefined
|
||||
after a call to Again (it is defined again after the next
|
||||
read operation).
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetRead (VAR f: File);
|
||||
(*
|
||||
- Sets the file in reading- state, without changing the
|
||||
current position.
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
Upon calling SetRead, the current position must be before
|
||||
the eof. In reading state, no writing is allowed.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetWrite (VAR f: File);
|
||||
(*
|
||||
- Sets the file in writing-state, without changing the
|
||||
current position.
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
Upon calling SetWrite, the current position must be a
|
||||
legal position in the file (including eof). In writing
|
||||
state, no reading is allowed, and a write always takes
|
||||
place at the eof. The current implementation does not
|
||||
truncate the file.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetModify (VAR f: File);
|
||||
(*
|
||||
- Sets the file in modifying-state, without changing the
|
||||
current position.
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
Upon calling SetModify, the current position must be
|
||||
before the eof. In modifying-state, reading and writing
|
||||
are allowed. Writing is done at the current position,
|
||||
overwriting whatever element is already there. The file
|
||||
is not truncated.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetOpen (VAR f: File);
|
||||
(*
|
||||
- Set the file to opened-state, without changing the
|
||||
current position.
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
The buffer content is written back on the file, if the
|
||||
file has been in writing or modifying status. The new
|
||||
buffer content is undefined. In opened-state, neither
|
||||
reading nor writing is allowed.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Reset (VAR f: File);
|
||||
(*
|
||||
- Set the file to opened state and position it to the
|
||||
top of file.
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE SetPos (VAR f: File; high, low: CARDINAL);
|
||||
(*
|
||||
- Set the current position in file
|
||||
|
||||
in: f structure referencing an open file
|
||||
high high part of the byte offset
|
||||
low low part of the byte offset
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
The file will be positioned (high*2^16 +low) bytes from
|
||||
top of file.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE GetPos (VAR f: File; VAR high, low: CARDINAL);
|
||||
(*
|
||||
- Return the current byte position in file
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: high high part of byte offset
|
||||
low low part of byte offset
|
||||
|
||||
The actual position is (high*2^16 +low) bytes from the top of file.
|
||||
*)
|
||||
|
||||
PROCEDURE Length (VAR f: File; VAR high, low: CARDINAL);
|
||||
(*
|
||||
- Return the length of the file in bytes.
|
||||
|
||||
in: f structure referencing an open file.
|
||||
|
||||
out: high high part of byte offset
|
||||
low low part of byte offset
|
||||
|
||||
The actual length is (high*2^16 +low) bytes. Depending on
|
||||
the operating system, this length may always be a multiple
|
||||
of some record size reflecting the physical length of the
|
||||
file and maybe not the true logical file length.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Doio (VAR f: File);
|
||||
(*
|
||||
- Do various read/write operations on a file
|
||||
|
||||
in: f structure referencing an open file
|
||||
|
||||
out: f f.res will be set appropriately.
|
||||
|
||||
The exact effect of this command depends on the state of
|
||||
the file (flags):
|
||||
|
||||
opened = NOOP.
|
||||
reading = reads the record that contains the current
|
||||
byte from the file. The old content of the
|
||||
buffer is not written back.
|
||||
writing = the buffer is written back. It is then
|
||||
assigned to the record, that contains the
|
||||
current position. Its content is not
|
||||
changed.
|
||||
modifying = the buffer is written back and the record
|
||||
containing the current position is read.
|
||||
|
||||
Note that 'Doio' does not need to be used when reading
|
||||
through the stream-like I/O routines. Its use is limited
|
||||
to special applications.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE FileNameChar (c: CHAR): CHAR;
|
||||
(*
|
||||
- Check the character c for legality in a filename.
|
||||
|
||||
in: c charater to check
|
||||
|
||||
out: 0C for illegal characters and c otherwise;
|
||||
lowercase letters are transformed into
|
||||
uppercase letters.
|
||||
|
||||
Which characters are leagl in a filename depends on the
|
||||
host operating system.
|
||||
*)
|
||||
|
||||
|
||||
TYPE
|
||||
FileProc = PROCEDURE (VAR File);
|
||||
(*- Procedure type to be used for internal file
|
||||
operations
|
||||
|
||||
A procedure of this type will be called for the following
|
||||
functions (see TYPE 'Command'): setread, setwrite,
|
||||
setmodify, setopen, doio, setpos, getpos, and length.
|
||||
*)
|
||||
|
||||
DirectoryProc = PROCEDURE (VAR File, ARRAY OF CHAR);
|
||||
(*- Procedure type to be used for operations on
|
||||
entire files
|
||||
|
||||
A procedure of this type will be called for the following
|
||||
functions (see TYPE 'Command'): create, close, lookup,
|
||||
rename, and delete.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE CreateMedium (mt: MediumType;
|
||||
fproc: FileProc;
|
||||
dproc: DirectoryProc;
|
||||
VAR done: BOOLEAN);
|
||||
(*
|
||||
- Install the medium "mt" in the file system
|
||||
|
||||
in: mt medium type to install
|
||||
fproc procedure to handle internal file
|
||||
operations
|
||||
dproc procedure to handle operations on an
|
||||
entire file
|
||||
|
||||
out done TRUE if medium was installed successfully
|
||||
|
||||
Before accessing or creating a file on a medium, this
|
||||
medium has to be announced to the file system by means
|
||||
of the routine CreateMedium. FileSystem calls "fproc"
|
||||
and "dproc" to perform operations on a file of this
|
||||
medium. Up to 24 mediums can be announced.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE RemoveMedium (mt: MediumType; VAR done: BOOLEAN);
|
||||
(*
|
||||
- Remove the medium "mt" from the file system
|
||||
|
||||
in: mt medium type to remove
|
||||
|
||||
out: done TRUE if medium was removed successfully
|
||||
|
||||
Attempts to access a file on this medium result in an
|
||||
error (unknownmedium).
|
||||
*)
|
||||
|
||||
|
||||
END FileSystem.
|
||||
|
BIN
Logitech Modula-2 v1.1/FILESYST.LNK
Normal file
BIN
Logitech Modula-2 v1.1/FILESYST.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILESYST.REF
Normal file
BIN
Logitech Modula-2 v1.1/FILESYST.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/FILESYST.SYM
Normal file
BIN
Logitech Modula-2 v1.1/FILESYST.SYM
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/INIT.LOD
Normal file
BIN
Logitech Modula-2 v1.1/INIT.LOD
Normal file
Binary file not shown.
233
Logitech Modula-2 v1.1/INOUT.DEF
Normal file
233
Logitech Modula-2 v1.1/INOUT.DEF
Normal file
@ -0,0 +1,233 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE InOut;
|
||||
(*
|
||||
Standard high-level formatted input/output,
|
||||
allowing for redirection to/from files
|
||||
|
||||
From the book 'Programming in Modula-2' by Prof.
|
||||
N. Wirth.
|
||||
*)
|
||||
|
||||
|
||||
FROM SYSTEM IMPORT WORD;
|
||||
FROM FileSystem IMPORT File;
|
||||
|
||||
EXPORT QUALIFIED
|
||||
EOL, Done, in, out, termCH,
|
||||
OpenInput, OpenOutput, CloseInput, CloseOutput,
|
||||
Read, ReadString, ReadInt, ReadCard, ReadWrd,
|
||||
Write, WriteLn, WriteString, WriteInt, WriteCard,
|
||||
WriteOct, WriteHex, WriteWrd;
|
||||
|
||||
|
||||
CONST
|
||||
EOL = 36C;
|
||||
(*- end-of-line character *)
|
||||
|
||||
|
||||
VAR
|
||||
Done: BOOLEAN;
|
||||
(*
|
||||
- set by several procedures; TRUE if the
|
||||
operation was successful, FALSE otherwise.
|
||||
*)
|
||||
|
||||
termCH: CHAR;
|
||||
(*
|
||||
- terminating character from ReadString, ReadInt,
|
||||
ReadCard.
|
||||
*)
|
||||
|
||||
in, out: File;
|
||||
(*
|
||||
- The currently open input and output files.
|
||||
Use for exceptional cases only.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE OpenInput(defext: ARRAY OF CHAR);
|
||||
(*
|
||||
- Accept a file name from the terminal and open it for
|
||||
input (file variable 'in').
|
||||
|
||||
in: defext default filetype or 'extension'.
|
||||
|
||||
If the file name that is read ends with '.', then 'defext'
|
||||
is appended to the file name.
|
||||
|
||||
If OpenInput succeeds, Done = TRUE and subsequent input is
|
||||
taken from the file until CloseInput is called.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE OpenOutput(defext: ARRAY OF CHAR);
|
||||
(*
|
||||
- Accept a file name from the terminal and open it for
|
||||
output (file variable 'out').
|
||||
|
||||
in: defext default filetype or 'extension'.
|
||||
|
||||
If the file name that is read ends with '.', then 'defext'
|
||||
is appended to the file name.
|
||||
|
||||
If OpenOutput succeeds, Done = TRUE and subsequent output
|
||||
is written to the file until CloseOutput is called.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE CloseInput;
|
||||
(*
|
||||
- Close current input file and revert to terminal for
|
||||
input.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE CloseOutput;
|
||||
(*
|
||||
- Close current output file and revert to terminal for
|
||||
output.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Read(VAR ch: CHAR);
|
||||
(*
|
||||
- Read the next character from the current input.
|
||||
|
||||
out: ch the character read; EOL for end-of-line
|
||||
|
||||
Done = TRUE unless the input is at end of file.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadString(VAR s: ARRAY OF CHAR);
|
||||
(*
|
||||
- Read a string from the current input.
|
||||
|
||||
out: s the string that was read, excluding
|
||||
the terminator character.
|
||||
|
||||
Leading blanks are accepted and thrown away, then
|
||||
characters are read into 's' until a blank or control
|
||||
character is entered. ReadString truncates the input
|
||||
string if it is too long for 's'. The terminating
|
||||
character is left in 'termCH'. If input is from the
|
||||
terminal, BS and DEL are allowed for editing.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadInt(VAR x: INTEGER);
|
||||
(*
|
||||
- Read an INTEGER representation from the current input.
|
||||
|
||||
out: x the value read.
|
||||
|
||||
ReadInt is like ReadString, but the string is converted to
|
||||
an INTEGER value if possible, using the syntax:
|
||||
["+"|"-"] digit { digit }.
|
||||
Done = TRUE if some conversion took place.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadCard(VAR x: CARDINAL);
|
||||
(*
|
||||
- Read an unsigned decimal number from the current input.
|
||||
|
||||
out: x the value read.
|
||||
|
||||
ReadCard is like ReadInt, but the syntax is:
|
||||
digit { digit }.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE ReadWrd(VAR w: WORD);
|
||||
(*
|
||||
- Read a WORD value from the current input.
|
||||
|
||||
out: w the value read.
|
||||
|
||||
Done is TRUE if a WORD was read successfully. This
|
||||
procedure cannot be used when reading from the terminal.
|
||||
Note that the meaning of WORD is system dependent.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE Write(ch: CHAR);
|
||||
(*
|
||||
- Write a character to the current output.
|
||||
|
||||
in: ch character to write.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteLn;
|
||||
(*
|
||||
- Write an end-of-line sequence to the current output.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteString(s: ARRAY OF CHAR);
|
||||
(*
|
||||
- Write a string to the current output.
|
||||
|
||||
in: s string to write.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteInt(x: INTEGER; n: CARDINAL);
|
||||
(*
|
||||
- Write an integer in right-justified decimal format.
|
||||
|
||||
in: x value to be output,
|
||||
n minimum field width.
|
||||
|
||||
The decimal representation of 'x' (including '-' if x is
|
||||
negative) is output, using at least n characters (but
|
||||
more if needed). Leading blanks are output if necessary.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteCard(x, n: CARDINAL);
|
||||
(*
|
||||
- Output a CARDINAL in decimal format.
|
||||
|
||||
in: x value to be output,
|
||||
n minimum field width.
|
||||
|
||||
The decimal representation of the value 'x' is output,
|
||||
using at least n characters (but more if needed).
|
||||
Leading blanks are output if necessary.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteOct(x, n: CARDINAL);
|
||||
(*
|
||||
- Output a CARDINAL in octal format.
|
||||
[see WriteCard above]
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteHex(x, n: CARDINAL);
|
||||
(*
|
||||
- Output a CARDINAL in hexadecimal format.
|
||||
|
||||
in: x value to be output,
|
||||
n minimum field width.
|
||||
|
||||
Four uppercase hex digits are written, with leading
|
||||
blanks if n > 4.
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE WriteWrd(w: WORD);
|
||||
(*
|
||||
- Output a WORD
|
||||
|
||||
in: w WORD value to be output.
|
||||
|
||||
Note that the meaning of WORD is system dependent, and
|
||||
that a WORD cannot be written to the terminal.
|
||||
*)
|
||||
|
||||
|
||||
END InOut.
|
||||
|
BIN
Logitech Modula-2 v1.1/INOUT.LNK
Normal file
BIN
Logitech Modula-2 v1.1/INOUT.LNK
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/INOUT.REF
Normal file
BIN
Logitech Modula-2 v1.1/INOUT.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/INOUT.SYM
Normal file
BIN
Logitech Modula-2 v1.1/INOUT.SYM
Normal file
Binary file not shown.
7
Logitech Modula-2 v1.1/INSTALL0.BAT
Normal file
7
Logitech Modula-2 v1.1/INSTALL0.BAT
Normal file
@ -0,0 +1,7 @@
|
||||
pause * Loading M2.EXE and examples onto current drive from drive B: *
|
||||
copy b:m2.exe
|
||||
copy b:examp*.mod
|
||||
rem ****** BEFORE USING MODULA-2/86 PLEASE MAKE SURE THAT ****************
|
||||
rem * You have a CONFIG.SYS file, and it includes 'FILES=12'. *
|
||||
rem **********************************************************************
|
||||
|
11
Logitech Modula-2 v1.1/INSTALL1.BAT
Normal file
11
Logitech Modula-2 v1.1/INSTALL1.BAT
Normal file
@ -0,0 +1,11 @@
|
||||
pause ** Creating Modula-2/86 directories on current drive **
|
||||
mkdir \m2lod
|
||||
mkdir \m2lib
|
||||
mkdir \m2lib\def
|
||||
mkdir \m2lib\mod
|
||||
mkdir \m2lib\sym
|
||||
mkdir \m2lib\lnk
|
||||
mkdir \m2lib\ref
|
||||
mkdir \m2lib\map
|
||||
rem ** Now execute INSTALL2 to load Modula-2 system from diskettes **
|
||||
|
2
Logitech Modula-2 v1.1/INSTALL2.BAT
Normal file
2
Logitech Modula-2 v1.1/INSTALL2.BAT
Normal file
@ -0,0 +1,2 @@
|
||||
copy a:installx.bat
|
||||
installx
|
20
Logitech Modula-2 v1.1/INSTALLX.BAT
Normal file
20
Logitech Modula-2 v1.1/INSTALLX.BAT
Normal file
@ -0,0 +1,20 @@
|
||||
pause * Loading Modula-2/86 system onto current drive from drive A: *
|
||||
pause Insert 'System' disk in drive A:
|
||||
copy a:comppara.sym \m2lib\sym
|
||||
copy a:*.def \m2lib\def
|
||||
copy a:*.mod \m2lib\mod
|
||||
pause Insert 'Compiler' disk in drive A:
|
||||
copy a:*.lod \m2lod
|
||||
copy a:*.sym \m2lib\sym
|
||||
pause Insert 'Linker' disk in drive A:
|
||||
copy a:*.lod \m2lod
|
||||
copy a:*.lnk \m2lib\lnk
|
||||
pause Insert 'Debugger' disk in drive A:
|
||||
copy a:*.lod \m2lod
|
||||
copy a:*.ref \m2lib\ref
|
||||
rem ****** BEFORE USING MODULA-2/86 PLEASE MAKE SURE THAT ****************
|
||||
rem * You have a CONFIG.SYS file, and it includes 'FILES=12' *
|
||||
rem * You have an AUTOEXEC.BAT file, and it sets the search paths, *
|
||||
rem * as described in the INSTALLATION section of the manual. *
|
||||
rem **********************************************************************
|
||||
del installx.bat
|
40
Logitech Modula-2 v1.1/KEYBOARD.DEF
Normal file
40
Logitech Modula-2 v1.1/KEYBOARD.DEF
Normal file
@ -0,0 +1,40 @@
|
||||
(* Version 1.10, Nov 1984 *)
|
||||
DEFINITION MODULE Keyboard;
|
||||
(*
|
||||
Default driver for terminal input.
|
||||
[Private module of the Modula-2 system]
|
||||
|
||||
Derived from the Lilith Modula-2 system developed by the
|
||||
group of Prof. N. Wirth at ETH Zurich, Switzerland.
|
||||
*)
|
||||
|
||||
|
||||
EXPORT QUALIFIED Read, KeyPressed;
|
||||
|
||||
|
||||
PROCEDURE Read (VAR ch: CHAR);
|
||||
(*
|
||||
- Read a character from the keyboard.
|
||||
|
||||
out: ch character read
|
||||
|
||||
If necessary, Read waits for a character to be entered.
|
||||
Characters that have been entered are returned
|
||||
immediately, with no echoing, editing or buffering.
|
||||
|
||||
- Ctrl-C terminates the current program
|
||||
- ASCII.cr is transformed into ASCII.EOL
|
||||
*)
|
||||
|
||||
|
||||
PROCEDURE KeyPressed (): BOOLEAN;
|
||||
(*
|
||||
- Test if a character is available from the keyboard.
|
||||
|
||||
out: returns TRUE if a character is available
|
||||
for reading
|
||||
*)
|
||||
|
||||
|
||||
END Keyboard.
|
||||
|
BIN
Logitech Modula-2 v1.1/KEYBOARD.LNK
Normal file
BIN
Logitech Modula-2 v1.1/KEYBOARD.LNK
Normal file
Binary file not shown.
159
Logitech Modula-2 v1.1/KEYBOARD.MOD
Normal file
159
Logitech Modula-2 v1.1/KEYBOARD.MOD
Normal file
@ -0,0 +1,159 @@
|
||||
(*$T-*)
|
||||
(*$R-*)
|
||||
(****************************************************************)
|
||||
(* *)
|
||||
(* MODULA-2/86 Library *)
|
||||
(* *)
|
||||
(* LOGITECH SA., CH-1143 Apples (Switzerland) *)
|
||||
(* *)
|
||||
(* Module: Keyboard *)
|
||||
(* Terminal driver for reading from the keyboard. *)
|
||||
(* The keyboard is read through MS-DOS. *)
|
||||
(* This module is private to the Terminal Sub-System and *)
|
||||
(* should not be used by application programs. *)
|
||||
(* *)
|
||||
(* Version 1.1 (Oct '84) *)
|
||||
(* *)
|
||||
(* (C) Copyright 1983, 1984 Logitech, All Rights Reserved *)
|
||||
(* *)
|
||||
(* Permission is hereby granted to registered users to use *)
|
||||
(* or abstract the following program in the implementation *)
|
||||
(* of customized versions. This permission does not *)
|
||||
(* include the right to redistribute the source code of *)
|
||||
(* this program. *)
|
||||
(****************************************************************)
|
||||
|
||||
(*$T-*)
|
||||
(*$R-*)
|
||||
IMPLEMENTATION MODULE Keyboard; (* WS *)
|
||||
|
||||
FROM SYSTEM IMPORT DOSCALL, SWI, RTSVECTOR,
|
||||
SETREG, GETREG, AX, BX, CX;
|
||||
(* FROM System IMPORT Status, Terminate; *)
|
||||
FROM ASCII IMPORT EOL;
|
||||
|
||||
|
||||
CONST
|
||||
CtrlC = 3C;
|
||||
KBDCR = 15C;
|
||||
BREAK = 1BH;
|
||||
|
||||
PROCEDURE KeyPressed (): BOOLEAN;
|
||||
(* Returns TRUE, if a character has been entered,
|
||||
FALSE otherwise.
|
||||
*)
|
||||
VAR result: CARDINAL;
|
||||
BEGIN
|
||||
IF ti < tailc THEN
|
||||
RETURN TRUE
|
||||
END;
|
||||
DOSCALL (11, result);
|
||||
RETURN (result <> 0);
|
||||
END KeyPressed;
|
||||
|
||||
|
||||
PROCEDURE Read (VAR ch: CHAR);
|
||||
(* Waits until a character has been entered and returns it.
|
||||
If Ctrl-C is entered, the program is stopped.
|
||||
CR is transformed into ASCII.EOL.
|
||||
*)
|
||||
VAR ready: BOOLEAN;
|
||||
BEGIN
|
||||
IF ti < tailc THEN
|
||||
ch := tail[ti];
|
||||
INC(ti)
|
||||
ELSE
|
||||
REPEAT
|
||||
DOSCALL (6, 0FFH, ch, ready);
|
||||
UNTIL ready;
|
||||
END;
|
||||
IF ch = CtrlC THEN
|
||||
(* Terminate (warned); to ensure that module Break is called *)
|
||||
SWI(BREAK);
|
||||
END;
|
||||
IF ch = KBDCR THEN ch := EOL;
|
||||
(* ASCII-cr is transformed in Modula-2 EOL character *)
|
||||
END;
|
||||
END Read;
|
||||
|
||||
|
||||
PROCEDURE FNChar (ch: CHAR) : BOOLEAN;
|
||||
BEGIN
|
||||
CASE ch OF
|
||||
'A'..'Z', '0'..'9', 'a'..'z',
|
||||
'$', '&', '#', '@', '!', '%',
|
||||
"'", '`', '(', ')', '-', '_',
|
||||
'^', '~',
|
||||
'.', ':', '\' : RETURN (TRUE);
|
||||
ELSE RETURN (FALSE);
|
||||
END;
|
||||
END FNChar;
|
||||
|
||||
|
||||
|
||||
TYPE PSP = RECORD
|
||||
stuff: ARRAY [1..128] OF CHAR;
|
||||
commTail: ARRAY [0..127] OF CHAR
|
||||
END;
|
||||
|
||||
VAR PSPPtr: RECORD
|
||||
CASE BOOLEAN OF
|
||||
TRUE: addr: POINTER TO PSP;
|
||||
| FALSE: offset,base: CARDINAL;
|
||||
END;
|
||||
END;
|
||||
tail: ARRAY [0..127] OF CHAR;
|
||||
tailc,ti: [0..128];
|
||||
|
||||
BEGIN
|
||||
(* DOS puts the command string in the Program Segment Prefix (PSP).
|
||||
This module Keyboard is reading and returning the command tail to
|
||||
the user. Therefore we get first the PSP address from RTS:
|
||||
*)
|
||||
SETREG(AX,0026H); (* RTS(38) - get Program Segment Prefix Pointer *)
|
||||
SWI(RTSVECTOR); (* rts call *)
|
||||
GETREG(BX,PSPPtr.offset);
|
||||
GETREG(CX,PSPPtr.base);
|
||||
|
||||
(* Get length of command and copy it in the local variable 'tail':
|
||||
*)
|
||||
WITH PSPPtr.addr^ DO
|
||||
tailc := ORD(commTail[0]);
|
||||
FOR ti := 1 TO tailc DO
|
||||
tail[ti-1] := commTail[ti]
|
||||
END; (* FOR *)
|
||||
END; (* WITH *)
|
||||
|
||||
(* we are going to skip the characters in PSP that have already
|
||||
been read by the RTS to load the Modula-2 program. We assume
|
||||
the following command structure:
|
||||
1: rtsname (not in PSP, read and skipped by DOS)
|
||||
2: parameters (for RTS, optional)
|
||||
3: separator (one or more spaces)
|
||||
4: M-2-program-name
|
||||
------- Keyboard swallows the above parts and
|
||||
------- returns the following parts
|
||||
5: parameters (for M-2 programs, optional)
|
||||
6: separator (optional)
|
||||
7: string (any sequence of characters, optional)
|
||||
*)
|
||||
ti := 0;
|
||||
WHILE (ti < tailc) AND (tail[ti] <> ' ') DO
|
||||
INC(ti) (* skip leading parameters *)
|
||||
END;
|
||||
WHILE (ti < tailc) AND (tail[ti] = ' ') DO
|
||||
INC(ti) (* skip leading blanks *)
|
||||
END;
|
||||
WHILE (ti < tailc) AND FNChar(tail[ti]) DO
|
||||
INC(ti) (* skip program name *)
|
||||
END;
|
||||
WHILE (ti < tailc) AND (tail[ti] = ' ') DO
|
||||
INC(ti) (* skip separator immediatly after progname *)
|
||||
END;
|
||||
IF ti < tailc THEN
|
||||
(* if there is a command tail, we return a CR at the end *)
|
||||
tail[tailc] := KBDCR;
|
||||
INC (tailc);
|
||||
END;
|
||||
END Keyboard.
|
||||
|
BIN
Logitech Modula-2 v1.1/KEYBOARD.REF
Normal file
BIN
Logitech Modula-2 v1.1/KEYBOARD.REF
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/KEYBOARD.SYM
Normal file
BIN
Logitech Modula-2 v1.1/KEYBOARD.SYM
Normal file
Binary file not shown.
BIN
Logitech Modula-2 v1.1/LINK.LNK
Normal file
BIN
Logitech Modula-2 v1.1/LINK.LNK
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user