minor changes

This commit is contained in:
ceriel 1987-03-11 14:54:29 +00:00
parent 778948b661
commit b99a714497
6 changed files with 192 additions and 269 deletions

View file

@ -1,5 +1,6 @@
.\" $Header$ .\" $Header$
.TH 6500_AS 6ACK .TH 6500_AS 6ACK
.ad
.SH NAME .SH NAME
6500_as \- assembler for Mostek 6500 6500_as \- assembler for Mostek 6500
.SH SYNOPSIS .SH SYNOPSIS

View file

@ -2,18 +2,19 @@
NROFF=nroff NROFF=nroff
MANDIR=/usr/man MANDIR=/usr/man
SUF=opr
all: all:
for i in *.[1-8] ; do \ for i in *.[1-8] ; do \
$(NROFF) -man head $$i > $$i.opr ; \ $(NROFF) -man head $$i > $$i.$(SUF) ; \
done done
install: install:
for i in *.[1-8] ; do \ for i in *.[1-8] ; do \
num=expr $$i : '.*\.\([1-8]\)' ; \ num=expr $$i : '.*\.\([1-8]\)' ; \
if test -f $(MANDIR)/man$$num/$$i ; \ if test -f $(MANDIR)/man$$num/$$i ; \
then cp $$i $(MANDIR)/man$$num/em_$$i ; \ then cat head $$i > $(MANDIR)/man$$num/em_$$i ; \
else cp $$i $(MANDIR)/man$$num/$$i ; \ else cat head $$i $(MANDIR)/man$$num/$$i ; \
fi ; \ fi ; \
done done
@ -26,3 +27,4 @@ pr:
clean: clean:
-rm -f *.opr *.out -rm -f *.opr *.out
-rm -f *.$(SUF)

View file

@ -5,71 +5,71 @@
libpc \- library of external routines for Pascal programs libpc \- library of external routines for Pascal programs
.SH SYNOPSIS .SH SYNOPSIS
.ta 11n .ta 11n
const bufsize = ?; const bufsize = ?;
.br .br
type br1 = 1..bufsize; type br1 = 1..bufsize;
.br .br
br2 = 0..bufsize; br2 = 0..bufsize;
.br .br
br3 = -1..bufsize; br3 = -1..bufsize;
.br .br
ok = -1..0; ok = -1..0;
.br .br
buf = packed array[br1] of char; buf = packed array[br1] of char;
.br .br
alfa = packed array[1..8] of char; alfa = packed array[1..8] of char;
.br .br
string = ^packed array[1..?] of char; string = ^packed array[1..?] of char;
.br .br
filetype = file of ?; filetype = file of ?;
.br .br
long = record high,low:integer end; long = record high,low:integer end;
{all routines must be declared extern} {all routines must be declared extern}
function argc:integer; function argc:integer;
.br .br
function argv(i:integer):string; function argv(i:integer):string;
.br .br
function environ(i:integer):string; function environ(i:integer):string;
.br .br
procedure argshift; procedure argshift;
procedure buff(var f:filetype); procedure buff(var f:filetype);
.br .br
procedure nobuff(var f:filetype); procedure nobuff(var f:filetype);
.br .br
procedure notext(var f:text); procedure notext(var f:text);
.br .br
procedure diag(var f:text); procedure diag(var f:text);
.br .br
procedure pcreat(var f:text; s:string); procedure pcreat(var f:text; s:string);
.br .br
procedure popen(var f:text; s:string); procedure popen(var f:text; s:string);
.br .br
procedure pclose(var f:filetype); procedure pclose(var f:filetype);
procedure trap(err:integer); procedure trap(err:integer);
.br .br
procedure encaps(procedure p; procedure q(n:integer)); procedure encaps(procedure p; procedure q(n:integer));
function perrno:integer; function perrno:integer;
.br .br
function uread(fd:integer; var b:buf; len:br1):br3; function uread(fd:integer; var b:buf; len:br1):br3;
.br .br
function uwrite(fd:integer; var b:buf; len:br1):br3; function uwrite(fd:integer; var b:buf; len:br1):br3;
function strbuf(var b:buf):string; function strbuf(var b:buf):string;
.br .br
function strtobuf(s:string; var b:buf; len:br1):br2; function strtobuf(s:string; var b:buf; len:br1):br2;
.br .br
function strlen(s:string):integer; function strlen(s:string):integer;
.br .br
function strfetch(s:string; i:integer):char; function strfetch(s:string; i:integer):char;
.br .br
procedure strstore(s:string; i:integer; c:char); procedure strstore(s:string; i:integer; c:char);
function clock:integer; function clock:integer;
.SH DESCRIPTION .SH DESCRIPTION
This library contains some often used external routines for Pascal programs. This library contains some often used external routines for Pascal programs.
Two versions exist: one for the EM interpreter and another one Two versions exist: one for the EM interpreter and another one
@ -214,71 +214,70 @@ Return the number of ticks of user and system time consumed by the program.
The following program presents an example of how these routines can be used. The following program presents an example of how these routines can be used.
This program is equivalent to the UNIX command cat(1). This program is equivalent to the UNIX command cat(1).
.nf .nf
{$c+} {$c+}
program cat(input,inp,output); program cat(input,inp,output);
var inp:text; var inp:text;
s:string; s:string;
function argc:integer; extern; function argc:integer; extern;
function argv(i:integer):string; extern; function argv(i:integer):string; extern;
procedure argshift; extern; procedure argshift; extern;
function strlen(s:string):integer; extern; function strlen(s:string):integer; extern;
function strfetch(s:string; i:integer):char; extern; function strfetch(s:string; i:integer):char; extern;
procedure copy(var fi:text); procedure copy(var fi:text);
var c:char; var c:char;
begin reset(fi); begin reset(fi);
while not eof(fi) do while not eof(fi) do
begin begin
while not eoln(fi) do while not eoln(fi) do
begin begin
read(fi,c); read(fi,c);
write(c) write(c)
end; end;
readln(fi); readln(fi);
writeln writeln
end end
end; end;
begin {main} begin {main}
if argc = 1 then if argc = 1 then
copy(input) copy(input)
else else
repeat repeat
s := argv(1); s := argv(1);
if (strlen(s) = 1) and (strfetch(s,1) = '-') if (strlen(s) = 1) and (strfetch(s,1) = '-')
then copy(input) then copy(input)
else copy(inp); else copy(inp);
argshift; argshift;
until argc <= 1; until argc <= 1;
end. end.
.fi .fi
.PP .PP
Another example gives some idea of the way to manage trap handling: Another example gives some idea of the way to manage trap handling:
.nf .nf
program bigreal(output); program bigreal(output);
const EFOVFL=4; const EFOVFL=4;
var trapped:boolean; var trapped:boolean;
procedure encaps(procedure p; procedure encaps(procedure p; procedure q(n:integer)); extern;
procedure q(n:integer)); extern; procedure trap(n:integer); extern;
procedure trap(n:integer); extern;
procedure traphandler(n:integer); procedure traphandler(n:integer);
begin if n=EFOVFL then trapped:=true else trap(n) end; begin if n=EFOVFL then trapped:=true else trap(n) end;
procedure work; procedure work;
var i,j:real; var i,j:real;
begin trapped:=false; i:=1; begin trapped:=false; i:=1;
while not trapped do while not trapped do
begin j:=i; i:=i*2 end; begin j:=i; i:=i*2 end;
writeln('bigreal = ',j); writeln('bigreal = ',j);
end; end;
begin begin
encaps(work,traphandler); encaps(work,traphandler);
end. end.
.fi .fi
.SH FILES .SH FILES
.IP ~em/lib/*/tail_pc 20 .IP ~em/lib/*/tail_pc 20

View file

@ -1,5 +1,5 @@
.\" $Header$ .\" $Header$
.TH NS_ASS 6ACK .TH NS_AS 6ACK
.ad .ad
.SH NAME .SH NAME
ns_as \- National Semiconductor 16032 assembler/linker ns_as \- National Semiconductor 16032 assembler/linker

View file

@ -4,196 +4,117 @@
.SH NAME .SH NAME
pc_prlib \- library of Pascal runtime routines pc_prlib \- library of Pascal runtime routines
.SH SYNOPSIS .SH SYNOPSIS
.ta 11n .ta 11n 22n 33n 44n 55n
type alpha=packed array[1..8] of char; .nf
.br type alpha=packed array[1..8] of char;
pstring= ^packed array[] of char; pstring= ^packed array[] of char;
function _abi(i:integer):integer; function _abi(i:integer):integer;
.br function _abl(i:long):long;
function _abl(i:long):long; function _mdi(j,i:integer):integer;
.br function _mdl(j,i:long):long;
function _mdi(j,i:integer):integer; function _abr(r:real):real;
.br function _sin(r:real):real;
function _mdl(j,i:long):long; function _cos(r:real):real;
.br function _atn(r:real):real;
function _abr(r:real):real; function _exp(r:real):real;
.br function _log(r:real):real;
function _sin(r:real):real; function _sqt(r:real):real;
.br function _rnd(r:real):real;
function _cos(r:real):real;
.br
function _atn(r:real):real;
.br
function _exp(r:real):real;
.br
function _log(r:real):real;
.br
function _sqt(r:real):real;
.br
function _rnd(r:real):real;
type compared=-1..1; type compared=-1..1;
.br gotoinfo=record
gotoinfo=record pcoffset:^procedure; { procedure id. without static link }
.br nlocals: integer;
pcoffset:^procedure; { procedure id. without static link } end;
.br
nlocals: integer;
.br
end;
function _bcp(sz:integer; s2,s1:pstring):compared; function _bcp(sz:integer; s2,s1:pstring):compared;
.br function _bts(size,high,low:integer; base:^set 0..(8*size-1))
function _bts(size,high,low:integer; base:^set 0..(8*size-1)) :set of 0..(8*size-1);
:set of 0..(8*size-1); procedure _gto(lb:^integer; p:^gotoinfo);
.br
procedure _gto(lb:^integer; p:^gotoinfo);
procedure _new(size:integer; var p:^integer); procedure _new(size:integer; var p:^integer);
.br procedure _dis(size:integer; var p:^integer);
procedure _dis(size:integer; var p:^integer); procedure _sav(var p:^integer);
.br procedure _rst(var p:^integer);
procedure _sav(var p:^integer);
.br
procedure _rst(var p:^integer);
type arrdescr=record type arrdescr=record
.br lowbnd: integer;
lowbnd: integer; diffbnds:integer;
.br elsize: integer;
diffbnds:integer; end;
.br arr1=array[] of ?;
elsize: integer; arr2=packed array[] of ?;
.br
end;
.br
arr1=array[] of ?;
.br
arr2=packed array[] of ?;
procedure _pac(var ad,zd:arrdescr; var zp:arr2; i:integer; procedure _pac(var ad,zd:arrdescr; var zp:arr2; i:integer;
.br var ap:arr1);
var ap:arr1); procedure _unp(var ad,zd:arrdescr; i:integer; var ap:arr1;
.br var zp:arr2;);
procedure _unp(var ad,zd:arrdescr; i:integer; var ap:arr1; function _asz(var dp:arrdescr):integer;
.br
var zp:arr2;);
.br
function _asz(var dp:arrdescr):integer;
procedure _ass(line:integer; b:boolean); procedure _ass(line:integer; b:boolean);
.br procedure procentry(var name:alpha);
procedure procentry(var name:alpha); procedure procexit(var name:alpha);
.br
procedure procexit(var name:alpha);
const lowbyte=[0..7]; const lowbyte=[0..7];
.br MAGIC =[1,3,5,7];
MAGIC =[1,3,5,7]; WINDOW =[11];
.br ELNBIT =[12];
WINDOW =[11]; EOFBIT =[13];
.br TXTBIT =[14];
ELNBIT =[12]; WRBIT =[15];
.br type file=record
EOFBIT =[13]; ptr: ^char;
.br flags: set of [0..15];
TXTBIT =[14]; fname: string;
.br ufd: 0..15;
WRBIT =[15]; size: integer;
.br count: 0..buflen;
type file=record buflen: max(512,size) div size * size;
.br bufadr: packed array[1..max(512,size)]
ptr: ^char; of char;
.br end;
flags: set of [0..15]; filep=^file;
.br const NFILES=15;
fname: string; _extfl:^array[] of filep;
.br
ufd: 0..15;
.br
size: integer;
.br
count: 0..buflen;
.br
buflen: max(512,size) div size * size;
.br
bufadr: packed array[1..max(512,size)]
.br
of char;
.br
end;
.br
filep=^file;
.br
const NFILES=15;
.br
_extfl:^array[] of filep;
procedure _ini(var args:integer; var hb:integer; procedure _ini(var args:integer; var hb:integer;
var p:array[] of filep; var mainlb:integer); var p:array[] of filep; var mainlb:integer);
.br procedure _hlt(status:0..255);
procedure _hlt(status:0..255);
procedure _opn(size:integer; f:filep); procedure _opn(size:integer; f:filep);
.br procedure _cre(size:integer; f:filep);
procedure _cre(size:integer; f:filep); procedure _cls(f:filep);
.br
procedure _cls(f:filep);
procedure _get(f:filep); procedure _get(f:filep);
.br procedure _put(f:filep);
procedure _put(f:filep); function _wdw(f:filep):^char;
.br function _efl(f:filep):boolean;
function _wdw(f:filep):^char;
.br
function _efl(f:filep):boolean;
function _eln(f:filep):boolean; function _eln(f:filep):boolean;
.br function _rdc(f:filep):char;
function _rdc(f:filep):char; function _rdi(f:filep):integer;
.br function _rdl(f:filep):long;
function _rdi(f:filep):integer; function _rdr(f:filep):real;
.br procedure _rln(f:filep);
function _rdl(f:filep):long; procedure _wrc(c:char; f:filep);
.br procedure _wsc(w:integer; c:char; f:filep);
function _rdr(f:filep):real; procedure _wri(i:integer; f:filep);
.br procedure _wsi(w:integer; i:integer; f:filep);
procedure _rln(f:filep); procedure _wrl(l:long; f:filep);
.br procedure _wsl(w:integer; l:long; f:filep);
procedure _wrc(c:char; f:filep); procedure _wrr(r:real; f:filep);
.br procedure _wsr(w:integer; r:real; f:filep);
procedure _wsc(w:integer; c:char; f:filep); procedure _wrf(ndigit:integer; w:integer; r:real; f:filep);
.br procedure _wrs(l:integer; s:pstring; f:filep);
procedure _wri(i:integer; f:filep); procedure _wss(w:integer; l:integer; s:pstring; f:filep);
.br procedure _wrb(b:boolean; f:filep);
procedure _wsi(w:integer; i:integer; f:filep); procedure _wsb(w:integer; b:boolean; f:filep);
.br procedure _wrz(s:string; f:filep);
procedure _wrl(l:long; f:filep); procedure _wsz(w:integer; s:string; f:filep);
.br procedure _wln(f:filep);
procedure _wsl(w:integer; l:long; f:filep); procedure _pag(f:filep);
.br .fi
procedure _wrr(r:real; f:filep);
.br
procedure _wsr(w:integer; r:real; f:filep);
.br
procedure _wrf(ndigit:integer; w:integer; r:real; f:filep);
.br
procedure _wrs(l:integer; s:pstring; f:filep);
.br
procedure _wss(w:integer; l:integer; s:pstring; f:filep);
.br
procedure _wrb(b:boolean; f:filep);
.br
procedure _wsb(w:integer; b:boolean; f:filep);
.br
procedure _wrz(s:string; f:filep);
.br
procedure _wsz(w:integer; s:string; f:filep);
.br
procedure _wln(f:filep);
.br
procedure _pag(f:filep);
.SH DESCRIPTION .SH DESCRIPTION
This library is used by the Pascal to EM compiler and This library is used by the Pascal to EM compiler and
contains all the runtime routines for standard Pascal programs. contains all the runtime routines for standard Pascal programs.
@ -428,7 +349,7 @@ the argument list to global memory, mainlb to _m_lb and hb to _hbase.
The first contains the local base of the program body, the second The first contains the local base of the program body, the second
contains the address of the hol containing the global variables contains the address of the hol containing the global variables
of the program. of the program.
A last task of _ini is to set the global variables _argc, _argv and _environ A last task of _ini is to set the global variables _argc, _argv and _environ
from args for from args for
possible reference later on. possible reference later on.
Args points to the argument count placed on the stack by the EM runtime system, Args points to the argument count placed on the stack by the EM runtime system,

View file

@ -1,5 +1,5 @@
.\" $Header$ .\" $Header$
.TH z80_AS 6ACK .TH Z80_AS 6ACK
.ad .ad
.SH NAME .SH NAME
z80_as \- assembler for Zilog z80 z80_as \- assembler for Zilog z80