Category : Modula II Source Code
Archive   : FIOASM.ZIP
Filename : NFIO.DEF

 
Output of file : NFIO.DEF contained in archive : FIOASM.ZIP
(*$M CODE*)(*$D DATA*)
DEFINITION MODULE NFIO;
(* A module for JPI Topspeed Modula-2 *)
(* By Carl Neiburger
169 N. 25th St.
San Jose, Calif.

CompuServe No. 72336,2257

This module is designed to implement the same functions as
JPI's FIO, but using the assembly-language procedures in FioAsm.
In addition, it returns EOF as a function, by file, so you can tell
which file has reached the EOF marker.
*)

(*
NOTE!

THIS MODULE IS NOT COMPLETE!

You must copy some procedures from JPI's FIO.MOD to complete it.
I have deleted them to avoid violating JPI's copyright. The procedures
are listed below.

*)


IMPORT Str, Lib, FioAsm;


CONST
MaxOpenFiles = 15;

TYPE
File = CARDINAL;

CONST
DiskFull = 0F0H ; (* Error if Write fails with disk full *)

StandardInput = 0 ; (* MSDOS standard handles *)
StandardOutput = 1 ;
ErrorOutput = 2 ;
AuxDevice = 3 ;
PrinterDevice = 4 ;

TYPE
BufRec = RECORD
RWPos,
EOB,
BufSize : CARDINAL;
Buffer : ARRAY[0..0] OF SHORTCARD;
END;

CONST
BufferOverhead = SIZE(BufRec)-1;

readonly = FioAsm.readonly;
hidden = FioAsm.hidden;
system = FioAsm.system;
volume = FioAsm.volume;
directory = FioAsm.directory;
archive = FioAsm.archive;

TYPE
PathStr = FioAsm.PathStr;
PathTail = FioAsm.PathTail;

FileAttributes = FioAsm.FileAttributes;
FileAttr = FioAsm.FileAttr;
DirEntry = FioAsm.DirEntry;

(*
PROCEDURE IOresult() : CARDINAL;

These procedures set IOresult if they fail:

PROCEDURE Create(Name: ARRAY OF CHAR) : File;
*)
PROCEDURE Open (Name: ARRAY OF CHAR) : File;
PROCEDURE Append(Name: ARRAY OF CHAR) : File;
PROCEDURE Size (F: File) : LONGCARD;
PROCEDURE Seek (F: File; Pos: LONGCARD);
PROCEDURE SeekEOF(F: File);
PROCEDURE EOF (F:File): BOOLEAN;

(* These procedures check IOresult and set OK *)
PROCEDURE ChDir (Name: ARRAY OF CHAR);
PROCEDURE MkDir (Name: ARRAY OF CHAR);
PROCEDURE RmDir (Name: ARRAY OF CHAR);
PROCEDURE Rename(Name,NewName : ARRAY OF CHAR);
PROCEDURE Truncate(F: File);
PROCEDURE Erase (Name: ARRAY OF CHAR);
PROCEDURE GetPos(F: File) : LONGCARD;
PROCEDURE Close (F: File);

(* These procedures do not set IOresult: *)

PROCEDURE AssignBuffer(F : File; VAR Buf: ARRAY OF BYTE);
PROCEDURE Exists(Name: ARRAY OF CHAR) : BOOLEAN;
PROCEDURE GetDir(Drive: SHORTCARD; VAR Name: ARRAY OF CHAR);

(*
PROCEDURE ReadFirstEntry(DirName : ARRAY OF CHAR;
Attr : FileAttr;
VAR D : DirEntry) : BOOLEAN;

PROCEDURE ReadNextEntry (VAR D : DirEntry) : BOOLEAN;
*)

(* This is a good place to insert these procedures from JPI's
TopSpeed Modula-2, all of which set OK to false if IOresult <> 0:

WrChar, WrBool, WrShtInt, WrInt,
WrLngInt, WrShtCard, WrCard, WrLngCard,
WrShtHex, WrHex, WrLngHex, WrReal,
WrLngReal, WrStr, WrStrAdj, WrLn,
WrCharRep, RdBool, RdShtInt, RdInt,
RdLngInt, RdShtCard, RdCard, RdLngCard,
RdShtHex, RdHex, RdLngHex, RdReal,
RdLngReal, RdItem, RdChar, RdStr

*)

(* These two procedures, while defined identically to JPI's,
are performed differently:
*)

PROCEDURE WrBin (F: File; Buf: ARRAY OF BYTE; Count: CARDINAL);
PROCEDURE RdBin (F: File; VAR Buf: ARRAY OF BYTE; Count: CARDINAL) : CARDINAL;

VAR Separators : Str.CHARSET;
VAR OK : BOOLEAN;
VAR ChopOff : BOOLEAN;
VAR Eng : BOOLEAN; (* Engineering notation *)

CONST

IOresult = FioAsm.IOresult;
Write = FioAsm.Write;
Read = FioAsm.Read;
ReadNextEntry = FioAsm.ReadNextEntry;
ReadFirstEntry = FioAsm.ReadFirstEntry;
Create = FioAsm.Create;
END NFIO.


  3 Responses to “Category : Modula II Source Code
Archive   : FIOASM.ZIP
Filename : NFIO.DEF

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/