misc/DOCS/ANSI.PAS
1.3 KB
0d3a9fcfa594d8e2…
uses ansi_drv,crt,dos;
var a: text;
x : integer;
ANSISCREEN : CHAR;
filename : string;
FUNCTION Exist(FileName : string) : Boolean; ASSEMBLER;
ASM
PUSH DS {Save DS }
LDS SI,Filename {DS:SI => Filename }
XOR BX,BX {Clear BX }
MOV BL,[SI] {BX = Length(Filename) }
INC SI {DS:SI => Filename[1] }
MOV DX,SI {DS:DX => Filename[1] }
MOV [SI+BX],BH {Append Ascii 0 to Filename }
MOV AX,4300h {Get Attribute Function Code }
INT 21h {Get File Attributes }
MOV AL,BH {Default Result = FALSE }
ADC CL,CL {Attribute * 2 + Carry Flag }
AND CL,31h {Directory or VolumeID or Failed }
JNZ @@Done {Yes - Exit }
INC AL {No - Change Result to TRUE }
@@Done:
POP DS {Restore DS }
END;
begin
writeln('Skaboy101''s Ansi Viewer - ');
write(#13,'Enter Ansifile - ');
readln(filename);
if not exist(filename) then
begin
writeln(#13'This file does not exist - halting!!!');
halt(5);
end;
assign(a,filename);
reset(a);
while not eof(a) do
begin
read(a,ansiscreen);
display_ansi(ansiscreen);
end;
close(a);
readln;
end.