mirror of
https://github.com/PDP-10/its.git
synced 2026-04-16 00:31:13 +00:00
706 lines
7.7 KiB
Plaintext
706 lines
7.7 KiB
Plaintext
;
|
|
; c20sys - system-call interfaces (tops20)
|
|
;
|
|
|
|
title c20sys
|
|
.insrt c:minsrt
|
|
|
|
; general jsys interface - see documentation
|
|
|
|
centry %jsys,[num,acs]
|
|
|
|
push p,4 ; ac4 and ac5 aren't temp regs
|
|
push p,5 ; the current compiler
|
|
move 5,acs ; pointer to ac block
|
|
move t1,0(5) ; load the ac's
|
|
move t2,1(5)
|
|
move t3,2(5)
|
|
move t4,3(5)
|
|
hrrz 5,num ; get the jsys number
|
|
hrli 5,104000 ; build a jsys
|
|
xct 5 ; and do it
|
|
erjmp js$err ; lose?
|
|
move 5,acs ; nope, update ac block
|
|
movem t4,3(5)
|
|
movem t3,2(5)
|
|
movem t2,1(5)
|
|
movem t1,0(5)
|
|
movei t1,0 ; return 0 for success
|
|
jrst js$ret
|
|
|
|
js$err: move 5,acs ; get ac block pointer
|
|
movem t4,3(5) ; put the ac's back in the ac block
|
|
movem t3,2(5)
|
|
movem t2,1(5)
|
|
movem t1,0(5)
|
|
movei t1,.fhslf ; get the error code
|
|
geter
|
|
hrr t1,t2 ; and return it
|
|
|
|
js$ret: pop p,5 ; get ac's back
|
|
pop p,4
|
|
return
|
|
|
|
centry %erstr,[err,buf,size]
|
|
|
|
hrr t1,buf
|
|
hrli t1,444400 ; make a 36 bit byteptr for C string
|
|
hrr t2,err
|
|
hrli t2,.fhslf
|
|
movn t3,size ; trying to get -size,,0
|
|
movs t3,t3
|
|
trz t3,777777
|
|
erstr ; write the error message
|
|
jfcl ; unknown error number or
|
|
skipa ; output error, skip to ...
|
|
skipa t1,buf ; OK, return buffer address
|
|
setz t1, ; ... error return of 0
|
|
return
|
|
|
|
|
|
; Interfaces for specific system calls
|
|
|
|
centry %gtjfn,[flags,name]
|
|
|
|
move a,flags
|
|
move b,name
|
|
gtjfn
|
|
jfcl ; leave error code in a
|
|
return
|
|
|
|
centry %gnjfn,[handle]
|
|
|
|
move a,handle
|
|
gnjfn
|
|
jfcl
|
|
return
|
|
|
|
centry %openf,[jfn,flags]
|
|
|
|
move a,jfn
|
|
move b,flags
|
|
openf
|
|
caia
|
|
movei a,0
|
|
return
|
|
|
|
centry %sfptr,[jfn,byteno]
|
|
|
|
move a,jfn
|
|
move b,byteno
|
|
sfptr
|
|
caia
|
|
movei a,0
|
|
return
|
|
|
|
centry %rfptr,[jfn]
|
|
|
|
move a,jfn
|
|
rfptr
|
|
seto b,
|
|
move a,b
|
|
return
|
|
|
|
centry %bin,[source]
|
|
|
|
move a,source
|
|
bin
|
|
move a,b
|
|
return
|
|
|
|
centry %bout,[dest,byte]
|
|
|
|
move a,dest
|
|
move b,byte
|
|
bout
|
|
return
|
|
|
|
centry %sin,[source,ptr,count,tbyte]
|
|
|
|
move a,source
|
|
move b,ptr
|
|
move c,count
|
|
move d,tbyte
|
|
sin
|
|
move a,c
|
|
return
|
|
|
|
centry %sout,[jfn,ptr,count,tbyte]
|
|
|
|
move a,jfn
|
|
move b,ptr
|
|
move c,count
|
|
move d,tbyte
|
|
sout
|
|
move a,c
|
|
return
|
|
|
|
centry %bkjfn,[jfn]
|
|
|
|
move a,jfn
|
|
bkjfn
|
|
tdza a,a
|
|
seto a,
|
|
setca a,
|
|
return
|
|
|
|
centry %gests,[jfn] ; gtsts
|
|
|
|
move a,jfn
|
|
gtsts
|
|
move a,b
|
|
return
|
|
|
|
centry %gtsts,[jfn]
|
|
|
|
move a,jfn
|
|
gtsts
|
|
move a,b
|
|
return
|
|
|
|
centry %sibe,[jfn]
|
|
|
|
move a,jfn
|
|
sibe
|
|
caia
|
|
movei b,0
|
|
move a,b
|
|
return
|
|
|
|
centry %closf,[jfn]
|
|
|
|
move a,jfn
|
|
closf
|
|
jfcl
|
|
return
|
|
|
|
centry %rdtty,[buf,siz,opt]
|
|
|
|
move a,buf
|
|
move b,siz
|
|
move c,opt
|
|
setz d,
|
|
rdtty
|
|
seto d,
|
|
move a,d
|
|
return
|
|
|
|
centry %psout,[str]
|
|
|
|
move a,str
|
|
psout
|
|
return
|
|
|
|
centry %dobe,[jfn]
|
|
|
|
move a,jfn
|
|
dobe
|
|
return
|
|
|
|
centry %gyp,[jfn] ; gttyp
|
|
|
|
move a,jfn
|
|
seto b,
|
|
gttyp
|
|
erjmp l2
|
|
l2: move a,b
|
|
return
|
|
|
|
centry %dvchr,[jfn,vals]
|
|
|
|
move a,jfn
|
|
dvchr
|
|
move d,vals
|
|
movem a,(d)
|
|
movem b,1(d)
|
|
movem c,2(d)
|
|
return
|
|
|
|
centry %rscan,[ptr]
|
|
|
|
move a,ptr
|
|
rscan
|
|
seto a,
|
|
return
|
|
|
|
centry %rljfn,[jfn]
|
|
|
|
move a,jfn
|
|
rljfn
|
|
jfcl
|
|
return
|
|
|
|
centry %jfns,[buf,jfn,bits]
|
|
|
|
move a,buf
|
|
move b,jfn
|
|
move c,bits
|
|
jfns
|
|
return
|
|
|
|
centry %gji,[job,ptr,first] ;getji
|
|
|
|
move a,job
|
|
move b,ptr
|
|
move c,first
|
|
setz d,
|
|
getji
|
|
seto d,
|
|
move a,d
|
|
return
|
|
|
|
centry %dirst,[buf,num]
|
|
|
|
move a,buf
|
|
move b,num
|
|
setz c,
|
|
dirst
|
|
seto c,
|
|
move a,c
|
|
return
|
|
|
|
centry %odcnv,[dat,bits,vec]
|
|
|
|
move b,dat
|
|
move d,bits
|
|
odcnv
|
|
move a,vec
|
|
movem b,(a)
|
|
movem c,1(a)
|
|
movem d,2(a)
|
|
return
|
|
|
|
centry %idtim,[str,bits]
|
|
|
|
move a,str
|
|
move b,bits
|
|
idtim
|
|
seto b,
|
|
move a,b
|
|
return
|
|
|
|
centry %rtad,[jfn,ptr,len] ; rftad
|
|
|
|
move a,jfn
|
|
move b,ptr
|
|
move c,len
|
|
rftad
|
|
return
|
|
|
|
centry %ftad,[jfn,ptr,len] ; sftad
|
|
|
|
move a,jfn
|
|
move b,ptr
|
|
move c,len
|
|
sftad
|
|
return
|
|
|
|
centry %gtad ; gtad
|
|
|
|
gtad
|
|
return
|
|
|
|
centry %runtm,[prcs,prt,pct]
|
|
move a,prcs
|
|
runtm
|
|
movem a,@prt
|
|
movem c,@pct
|
|
return
|
|
|
|
centry %rcoc,[jfn,ptr] ;rfcoc
|
|
|
|
move a,jfn
|
|
rfcoc
|
|
move a,ptr
|
|
movem b,(a)
|
|
movem c,1(a)
|
|
return
|
|
|
|
centry %scoc,[jfn,ptr] ;sfcoc
|
|
|
|
move a,ptr
|
|
move b,(a)
|
|
move c,1(a)
|
|
move a,jfn
|
|
sfcoc
|
|
return
|
|
|
|
centry %dsms,[msec] ;disms
|
|
|
|
move a,msec
|
|
disms
|
|
return
|
|
|
|
centry %smod,[jfn,mode] ;sfmod
|
|
|
|
move a,jfn
|
|
move b,mode
|
|
sfmod
|
|
return
|
|
|
|
centry %sfmod,[jfn,mode]
|
|
|
|
move a,jfn
|
|
move b,mode
|
|
sfmod
|
|
return
|
|
|
|
centry %stpar,[jfn,mode]
|
|
|
|
move a,jfn
|
|
move b,mode
|
|
stpar
|
|
return
|
|
|
|
centry %rmod,[jfn] ;rfmod
|
|
|
|
move a,jfn
|
|
rfmod
|
|
move a,b
|
|
return
|
|
|
|
centry %rfmod,[jfn]
|
|
|
|
move a,jfn
|
|
rfmod
|
|
move a,b
|
|
return
|
|
|
|
centry %rtiw,[frk,wrd]
|
|
|
|
move a,frk
|
|
rtiw
|
|
move a,wrd
|
|
movem b,(a)
|
|
move a,c
|
|
return
|
|
|
|
centry %stiw,[frk,wrd1,wrd2]
|
|
|
|
move a,frk
|
|
move b,wrd1
|
|
move c,wrd2
|
|
stiw
|
|
return
|
|
|
|
centry %rpcap,[frk,wrd]
|
|
|
|
move a,frk
|
|
rpcap
|
|
move a,wrd
|
|
movem c,(a)
|
|
move a,b
|
|
return
|
|
|
|
centry %epcap,[frk,wrd1,wrd2]
|
|
|
|
move a,frk
|
|
move b,wrd1
|
|
move c,wrd2
|
|
epcap
|
|
return
|
|
|
|
centry %cfibf,[jfn]
|
|
|
|
move a,jfn
|
|
cfibf
|
|
return
|
|
|
|
centry %gtfdb,[jfn,cptr,ptr]
|
|
|
|
move a,jfn
|
|
move b,cptr
|
|
move c,ptr
|
|
gtfdb
|
|
return
|
|
|
|
centry %chfdb,[jfn,mask,stuff]
|
|
|
|
move a,jfn
|
|
move b,mask
|
|
move c,stuff
|
|
chfdb
|
|
return
|
|
|
|
centry %delf,[jfn]
|
|
move a,jfn
|
|
delf
|
|
jfcl
|
|
return
|
|
|
|
centry %deldf,[bits,dirn]
|
|
move a,bits
|
|
move b,dirn
|
|
deldf
|
|
return
|
|
|
|
centry %spjfn,[ph,pin,pout]
|
|
move a,ph
|
|
hrl b,pin
|
|
hrr b,pout
|
|
spjfn
|
|
return
|
|
|
|
centry %gpjfn,[ph]
|
|
move a,ph
|
|
gpjfn
|
|
move a,b
|
|
return
|
|
|
|
centry %cfork,[bits,blk]
|
|
move a,bits
|
|
move b,blk
|
|
cfork
|
|
jfcl
|
|
return
|
|
|
|
centry %wfork,[ph]
|
|
move a,ph
|
|
wfork
|
|
return
|
|
|
|
centry %kfork,[ph]
|
|
move a,ph
|
|
kfork
|
|
return
|
|
|
|
centry %sfork,[ph,sa]
|
|
move a,ph
|
|
move b,sa
|
|
sfork
|
|
return
|
|
|
|
centry %rfork,[ph]
|
|
move a,ph
|
|
rfork
|
|
return
|
|
|
|
centry %sfrkv,[ph,en]
|
|
move a,ph
|
|
move b,en
|
|
sfrkv
|
|
return
|
|
|
|
centry %rfsts,[ph]
|
|
move a,ph
|
|
rfsts
|
|
return
|
|
|
|
centry %rfpc,[ph]
|
|
move a,ph
|
|
rfsts
|
|
move a,b
|
|
return
|
|
|
|
centry %get,[info,pns]
|
|
move a,info
|
|
move b,pns
|
|
get
|
|
erjmp get$1
|
|
tdza a,a
|
|
get$1: seto a,
|
|
return
|
|
|
|
centry %gevec,[ph]
|
|
move a,ph
|
|
gevec
|
|
move a,b
|
|
return
|
|
|
|
centry %rnamf,[jfn1,jfn2]
|
|
move a,jfn1
|
|
move b,jfn2
|
|
rnamf
|
|
caia
|
|
movei a,0
|
|
return
|
|
|
|
centry %gtdal,[dirn,pnwork,pnused,pnperm]
|
|
move a,dirn
|
|
gtdal
|
|
movem a,@pnwork
|
|
movem b,@pnused
|
|
movem c,@pnperm
|
|
return
|
|
|
|
centry %gjinf,[puser,pdir,pjob,pterm]
|
|
gjinf
|
|
movem a,@puser
|
|
movem b,@pdir
|
|
movem c,@pjob
|
|
movem d,@pterm
|
|
return
|
|
|
|
centry %ssave,[pj,te,flags]
|
|
move a,pj
|
|
move b,te
|
|
move c,flags
|
|
ssave
|
|
return
|
|
|
|
centry %pmap,[source,dest,bits]
|
|
move a,source
|
|
move b,dest
|
|
move c,bits
|
|
pmap
|
|
return
|
|
|
|
centry %sevec,[ph,vw]
|
|
move a,ph
|
|
move b,vw
|
|
sevec
|
|
jfcl
|
|
return
|
|
|
|
centry %rfacs,[ph,blk]
|
|
move a,ph
|
|
move b,blk
|
|
rfacs
|
|
return
|
|
|
|
centry %sfacs,[ph,blk]
|
|
move a,ph
|
|
move b,blk
|
|
sfacs
|
|
return
|
|
|
|
centry %haltf
|
|
haltf
|
|
return
|
|
|
|
centry %rmap,[ph,pn,pac]
|
|
hrlz a,ph
|
|
hrr a,pn
|
|
rmap
|
|
movem b,@pac
|
|
return
|
|
|
|
centry %spacs,[ph,pn,acs]
|
|
hrlz a,ph
|
|
hrr a,pn
|
|
move b,acs
|
|
spacs
|
|
return
|
|
|
|
centry %aic,[frk,wrd]
|
|
move a,frk
|
|
move b,wrd
|
|
movei c,0
|
|
aic
|
|
erjmp aic$1
|
|
movei c,1
|
|
aic$1: movei a,(c)
|
|
return
|
|
|
|
centry %dic,[frk,wrd]
|
|
move a,frk
|
|
move b,wrd
|
|
movei c,0
|
|
dic
|
|
erjmp dic$1
|
|
movei c,1
|
|
dic$1: movei a,(c)
|
|
return
|
|
|
|
centry %iic,[frk,wrd]
|
|
move a,frk
|
|
move b,wrd
|
|
movei c,0
|
|
iic
|
|
erjmp iic$1
|
|
movei c,1
|
|
iic$1: movei a,(c)
|
|
return
|
|
|
|
centry %ati,[wrd]
|
|
move a,wrd
|
|
movei c,0
|
|
ati
|
|
erjmp ati$1
|
|
movei c,1
|
|
ati$1: movei a,(c)
|
|
return
|
|
|
|
centry %dti,[wrd]
|
|
move a,wrd
|
|
movei c,0
|
|
dti
|
|
erjmp dti$1
|
|
movei c,1
|
|
dti$1: movei a,(c)
|
|
return
|
|
|
|
centry %eir,[frk]
|
|
move a,frk
|
|
movei c,0
|
|
eir
|
|
erjmp eir$1
|
|
movei c,1
|
|
eir$1: movei a,(c)
|
|
return
|
|
|
|
centry %dir,[frk]
|
|
move a,frk
|
|
movei c,0
|
|
dir
|
|
erjmp dir$1
|
|
movei c,1
|
|
dir$1: movei a,(c)
|
|
return
|
|
|
|
centry %skpir,[frk]
|
|
move a,frk
|
|
skpir
|
|
tdza a,a
|
|
movei a,1
|
|
return
|
|
|
|
centry %rcm,[frk]
|
|
move a,frk
|
|
rcm
|
|
return
|
|
|
|
centry %rwm,[frk,levs]
|
|
move a,frk
|
|
rwm
|
|
movem b,@levs
|
|
return
|
|
|
|
centry %wait
|
|
wait
|
|
return
|
|
|
|
centry %prarg,[x,y,z]
|
|
move a,x
|
|
move b,y
|
|
move c,z
|
|
prarg
|
|
erjmp pr$err
|
|
skipa a,c
|
|
pr$err: movni a,1
|
|
return
|
|
|
|
centry %mtopr,[x,y,z]
|
|
move a,x
|
|
move b,y
|
|
move c,z
|
|
mtopr
|
|
move a,c
|
|
return
|
|
|
|
centry %hfork,[ph]
|
|
|
|
move a,ph
|
|
hfork
|
|
return
|
|
|
|
centry %hptim,[clk]
|
|
|
|
move a,clk
|
|
hptim
|
|
jrst [ setz a,
|
|
jrst .+1]
|
|
return
|
|
|
|
end
|