home *** CD-ROM | disk | FTP | other *** search
- {*********************************************************************
- (C) Copyright 1983-92 MetaWare Incorporated; Santa Cruz, CA 95060.
- *********************************************************************}
- Export(System,MSDOS,Fileh_type);
- pragma include('STATUS.pf');
- pragma include('SYSTEM.pf');
- pragma include('MSDOS.pf');
- pragma fragmented_implementation(System);
- pragma fragmented_implementation(MSDOS);
- with Status;
-
- program Implement_DOS_interface;
- pragma Alias(Implement_DOS_interface,Implement.RTE || 'dos_interface4');
-
- with Registers;
- with Loopholes:[Address,Adr,Retype,&];
- pragma off(emit_names); pragma on(optimize_for_space);
-
- function Read(F: File_handle; Bufp: Address; Cnt: Byte_count): Byte_count;
- begin
- Load_DS_DX(Bufp);
- CX.R := Cnt;
- BX.R := F;
- DOS(63);
- return(AX.R);
- end;
-
- function Write_(F: File_handle; Bufp: Address; Cnt: Byte_count):Byte_count;
- begin
- Load_DS_DX(Bufp);
- CX.R := Cnt;
- BX.R := F;
- DOS(64);
- if (AX.R < Cnt) and (Errno = No_error_occurred) then
- Errno := Error_write_failed;
- return(AX.R);
- end;
-
- -- Used when "create" is specified to truncate the file:
-
- procedure Trunc(F: File_handle);
- begin
- { Truncating a file is done by writing 0 bytes (how awful!) }
- Write(F,Adr(F),0);
- end;
-
- -- Fileclass is called when Open or Create is from the Pascal or C I/O
- -- routines.
- function Fileclass(F: File_handle): File_class;
- begin
- BX.R := F;
- Ax.L := 0; { Read fcn. }
- DOS(68);
- if DX.R & #0080 = 0 then return(Disk_file)
- else if DX.R & #0002 <> 0 then return(Console_output)
- else if DX.R & #0001 <> 0 then return(Console_input)
- else return(Other_device);
- end;
-
- -- (C) Copyright 1983,84,85 MetaWare Incorporated; Santa Cruz, CA 95060.
-
-