Digital Research
This commit is contained in:
2020-11-06 18:50:37 +01:00
parent 621ed8ccaf
commit 31738079c4
8481 changed files with 1888323 additions and 0 deletions

View File

@@ -0,0 +1,203 @@
$title ('MP/M 1.0 Abort Process')
name abort
cseg
;abort:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (datapg.ext)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (bdos.ext)
;$nolist
; declare rlr address external;
extrn rlr
; nfxdos:
; procedure (func,info) external;
extrn nfxdos
; declare func byte;
; declare info address;
; end nfxdos;
; xdos:
; procedure (func,info) byte external;
extrn xdos
; declare func byte;
; declare info address;
; end xdos;
; printb:
; procedure (bufferadr) external;
extrn printb
; declare bufferadr address;
; end printb;
; declare rlrpd based rlr process$descriptor;
;/*
dseg
; Abort Process Data Segment
;*/
; declare abort$pd process$descriptor public
; initial (0,rtr$status,20,.abort$stk+28,
; 'ABORT ',0,0ffh,0);
abortpd:
public abortpd
dw 0 ; pl
db 0 ; status
db 20 ; priority
dw abortstk+38 ; stkptr
db 'ABORT ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
ds 10
; declare abort$stk (20) address
; initial (restarts,.abort);
abortstk:
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
db 'FACBEDLHxiyifacbedlh'
dw abort
; declare abort$lqcb structure (
; lqueue,
; buf (12) byte )
; initial (0,'ABORT ',10,1);
abortlqcb:
dw $-$ ; ql
db 'ABORT ' ; name
dw 10 ; msglen
dw 1 ; nmbmsgs
dw $-$ ; dqph
dw $-$ ; nqph
dw $-$ ; mh
dw $-$ ; mt
dw $-$ ; bh
ds 12 ; buf (12) byte
; declare abort$uqcb userqcbhead public
; initial (.abort$lqcb,.apcb.param);
abortuqcb:
dw abortlqcb ; pointer
dw param ; msgadr
; declare abort$parameter$control$block structure (
apcb:
; pdadr address,
pdadr: dw 0
; param address,
param: ds 2
; pname (8) byte ) initial (0);
pname: ds 8
; declare console byte at (.apcb.param(1));
console equ param+1
cseg
abortfail:
db 'Abort failed.'
db '$'
;/*
; abort:
; The purpose of the abort process is to abort
; the specified process.
; Entry Conditions:
; None
; Exit Conditions:
; None
;*/
; abort:
abort:
; procedure public;
public abort
; declare i byte;
; call nfxdos (make$queue,.abort$lqcb);
LXI D,ABORTLQCB
MVI C,86H
; do forever;
@4:
CALL NFXDOS
; call nfxdos (read$queue,.abort$uqcb);
LXI D,ABORTUQCB
MVI C,89H
CALL NFXDOS
; rlrpd.console = console;
LXI B,0EH
LHLD RLR
DAD B
LDA CONSOLE
MOV M,A
; i = 0;
MVI C,8
LXI H,PNAME
; do while i <> 8;
@6:
; if field(i) = 0 then
MOV A,M
ORA A
JNZ @1
; do while i <> 8;
@8:
; field(i) = ' ';
MVI M,20H
; i = i + 1;
INX H
DCR C
JNZ @8
JMP @7
; end;
@1:
; else i = i + 1;
INX H
DCR C
JNZ @6
; end;
@7:
; /* parameters to XDOS abort process are terminate
; system or non-sytem process & release memory segment */
; apcb.param = 00ffh;
lxi h,00ffh
shld param
; if xdos (abort$process,.apcb) = 255 then
LXI D,apcb
MVI C,9dH
CALL XDOS
INR L
; do;
; call printb (.('Abort failed.','$'));
LXI B,abortfail
CZ PRINTB
; end;
; call nfxdos (detach,0);
MVI C,93H
; end; /* forever */
JMP @4
; end abort;
;end abort;
END


View File

@@ -0,0 +1,208 @@
$title ('MP/M 1.1 Attach Process')
name attch
cseg
;attch:
;do;
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (datapg.ext)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (bdos.ext)
;$nolist
; declare rlr address external;
extrn rlr
; nfxdos:
; procedure (func,info) external;
extrn nfxdos
; declare func byte;
; declare info address;
; end nfxdos;
; xdos:
; procedure (func,info) byte external;
extrn xdos
; declare func byte;
; declare info address;
; end xdos;
; printb:
; procedure (bufferadr) external;
extrn printb
; declare bufferadr address;
; end printb;
; declare rlrpd based rlr process$descriptor;
;/*
dseg
; Attach Process Data Segment
;*/
; declare attch$pd process$descriptor public
; initial (0,rtr$status,20,.attch$entrypt,
; 'ATTACH ',0,0ffh,0);
attchpd:
public attchpd
dw 0 ; pl
db 0 ; status
db 20 ; priority
dw attchentrypt ; stkptr
db 'ATTACH ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
dw $-$ ; disk set DMA
db $-$ ; disk select / user code
dw $-$ ; dcnt
db $-$ ; searchl
dw $-$ ; searcha
ds 2 ; drvact
ds 20 ; registers
ds 2 ; sratch
; declare attch$stk (10) address
; initial (restarts,.attch);
attchstk:
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
attchentrypt:
dw attch
; declare attch$lqcb structure (
; lqueue,
; buf (12) byte )
; initial (0,'ATTACH ',10,1);
attchlqcb:
dw $-$ ; ql
db 'ATTACH ' ; name
dw 10 ; msglen
dw 1 ; nmbmsgs
dw $-$ ; dqph
dw $-$ ; nqph
dw $-$ ; mh
dw $-$ ; mt
dw $-$ ; bh
ds 12 ; buf (12) byte
; declare attch$uqcb userqcbhead public
; initial (.attch$lqcb,.field);
attchuqcb:
dw attchlqcb ; pointer
dw field ; msgadr
; declare field (11) byte;
field:
ds 11
; declare console byte at (.field(1));
console equ field+1
cseg
atfail:
db 'Attach failed.'
db '$'
;/*
; attch:
; The purpose of the attach process is to attach
; the console to the specified process.
; Entry Conditions:
; None
; Exit Conditions:
; None
;*/
; attch:
attch:
; procedure public;
public attch
; declare i byte;
; call nfxdos (make$queue,.attch$lqcb);
LXI D,ATTCHLQCB
MVI C,86H
; do forever;
@4:
CALL NFXDOS
; call nfxdos (read$queue,.attch$uqcb);
LXI D,ATTCHUQCB
MVI C,89H
CALL NFXDOS
; rlrpd.console = console;
LXI B,0EH
LHLD RLR
DAD B
LDA CONSOLE
MOV M,A
; i = 2;
MVI C,8
LXI H,FIELD+2
; do while i <> 10;
@6:
; if field(i) = 0 then
MOV A,M
ORA A
JNZ @1
; do while i <> 10;
@8:
; field(i) = ' ';
MVI M,20H
; i = i + 1;
INX H
DCR C
JNZ @8
JMP @7
; end;
@1:
; else i = i + 1;
INX H
DCR C
JNZ @6
; end;
@7:
; /* specify that console of attached process must
; match that currently of the attach process */
; field(10) = 0ffh;
MVI M,0FFH
; if xdos (assign$console,.field(1)) = 255 then
LXI D,FIELD+1H
MVI C,95H
CALL XDOS
INR L
; do;
; call printb (.('Attach failed.','$'));
LXI B,atfail
CZ PRINTB
; end;
; call nfxdos (detach,0);
MVI C,93H
; end; /* forever */
JMP @4
; end attch;
;end attch;
END


View File

@@ -0,0 +1,342 @@
$title ('MP/M 1.1 CLBDOS Procedures')
name clbdos
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
cseg
; open:
open:
; procedure (fcb$adr) byte reentrant public;
public open
; declare fcb$adr address;
; declare fcb based fcb$adr fcb$descriptor;
;
mov d,b
mov e,c
mvi c,15
jmp mon2
; return mon2 (15,fcb$adr);
; end open;
;
; close:
close:
; procedure (fcb$adr) reentrant public;
public close
; declare fcb$adr address;
; declare ret byte;
;
mov d,b
mov e,c
mvi c,16
jmp mon2
; ret = mon2 (16,fcb$adr);
; end close;
;
; readbf:
readbf:
; procedure (fcb$adr) byte reentrant public;
public readbf
; declare fcb$adr address;
;
mov d,b
mov e,c
mvi c,20
jmp mon2
; return mon2 (20,fcb$adr);
; end readbf;
;
; init:
init:
; procedure reentrant public;
public init
;
mvi c,13
jmp mon1
; call mon1 (13,0);
; end init;
;
; set$dma:
setdma:
; procedure (dma$adr) reentrant public;
public setdma
; declare dma$adr address;
;
mov d,b
mov e,c
mvi c,26
jmp mon1
; call mon1 (26,dma$adr);
; end set$dma;
;
; lo:
lo:
; procedure (char) reentrant public;
public lo
; declare char byte;
;
mov e,c
mvi c,5
jmp mon1
; call mon1 (5,char);
; end lo;
;
; co:
co:
; procedure (char) reentrant public;
public co
; declare char byte;
;
mov e,c
mvi c,2
jmp mon1
; call mon1 (2,char);
; end co;
;
; ci:
ci:
; procedure byte reentrant public;
public ci
;
mvi c,1
jmp mon2
; return mon2 (1,0);
; end ci;
;
; rawci:
rawci:
; procedure byte reentrant public;
public rawci
;
mvi c,6
mvi e,0ffh
jmp mon2
; return mon2 (6,0ffh);
; end rawci;
;
; rawlst:
rawlst:
; procedure (string$address) reentrant public;
; declare string$address address;
; declare char based string$address byte;
public rawlst
;
; do while char <> '$';
ldax b
cpi '$'
rz
push b
mvi c,6
mov e,a
call mon1
; call mon1 (6,char);
pop b
inx b
jmp rawlst
; end;
; end rawlst;
;
; print$buffer:
printb:
; procedure (bufferadr) reentrant public;
public printb
; declare bufferadr address;
;
mov d,b
mov e,c
mvi c,9
jmp mon1
; call mon1 (9,bufferadr);
; end print$buffer;
;
; read$buffer:
readbu:
; procedure (bufferadr) reentrant public;
public readbu
; declare bufferadr address;
;
mov d,b
mov e,c
mvi c,10
jmp mon1
; call mon1 (10,bufferadr);
; end read$buffer;
;
; crlf:
crlf:
; procedure reentrant public;
public crlf
;
; call co (0DH);
mvi c,0dh
call co
; call co (0AH);
mvi c,0ah
jmp co
; end crlf;
;
terminate equ 143
public endp
endp:
push psw
push b
push d
push h
mvi c,terminate ;143
lxi d,0
call xbdos
pop h
pop d
pop b
pop psw
ret
public exitr
extrn indisp
exitr:
lda indisp
ora a
jz exitregion ;exit region only if not in dispatcher
ret
xiosoffset equ 33h
public xiosms
xiosms:
jmp $-$
public xiospl
xiospl:
jmp $-$
public strclk
strclk:
jmp $-$
public stpclk
stpclk:
jmp $-$
; public exitr
exitregion:
jmp $-$
public maxcns
maxcns:
jmp $-$
; public sysinit
;sysinit:
jmp $-$
public xidle
xidle:
jmp $-$
extrn sysdat,datapg
public syinit
syinit:
mvi l,252
lxi d,datapg
mov m,e
inx h
mov m,d ; datapg[252] = system data pg adr
lxi h,mpmtop
mvi l,-6
lxi d,xjmptbl
mvi b,6
moveloop:
ldax d
mov m,a
inx d
inx h
dcr b
jnz moveloop
inx h
mov e,m
inx h
mov d,m
xchg
shld xbdosadr
xchg
inx h
inx h
mov e,m
inx h
mov d,m
inx h
push h
lxi h,xiosoffset
dad d
; copy XIOS jump table
mvi b,24 ; 8 entries * 3 bytes
lxi d,xiosms
mvxiostbl:
mov a,m
stax d
inx h
inx d
dcr b
jnz mvxiostbl
extrn dspsvz80,dsprsz80
lxi h,-3
dad d
mvi a,0c3h
cmp m ;is XIOS idle routine present?
jz idleok
mov m,a
lxi d,pdisp
inx h
mov m,e
inx h
mov m,d
idleok:
lhld sysdat
mvi l,5
mov a,m
ora a
jz notz80 ;test z80 flag in sys dat page
xra a
sta dspsvz80
lxi h,0
shld dspsvz80+1
sta dsprsz80
shld dsprsz80+1
notz80:
lhld sysdat ;passed parameter, HL = sysdat
ret
public nfxdos
nfxdos:
extrn xdos,pdisp
xjmptbl:
jmp xdos
jmp pdisp
public xbdos
xbdos:
public mon1,mon2
mon1:
mon2:
lhld xbdosadr
pchl
dseg
xbdosadr:
ds 2
ds 3 ; make room for BDOS external jump table
ds 3
mpmtop:
db 0 ; force byte at end of mpm nucleus module
end


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,149 @@
$title ('MP/M 1.1 Clock Process')
name clock
cseg
;clock:
;do;
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (datapg.ext)
;$nolist
; xdos:
extrn xdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xdos;
; declare tod structure (
extrn tod
; day address,
; hr byte,
; min byte,
; sec byte ) external;
dseg
;/*
; Clock Process Data Segment
;*/
; declare clock$pd process$descriptor public
; initial (0,rtr$status,20,.tick$entrypt,
; 'Clock ',0,0ffh,0);
clockpd:
public clockpd
extrn clipd
dw clipd ; pl
db 0 ; status
db 20 ; priority
dw clockentrypt ; stkptr
db 'Clock ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
dw $-$ ; disk set DMA
db $-$ ; disk select / user code
dw $-$ ; dcnt
db $-$ ; searchl
dw $-$ ; searcha
ds 2 ; drvact
ds 20 ; registers
ds 2 ; scratch
; declare clock$stk (10) address
; initial (restarts,.clock);
clockstk:
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
clockentrypt:
dw clock
cseg
;/*
; clock:
; The purpose of the clock process is to maintain a time
; of day clock. It utilizes the XDOS delay function to
; increment the PUBLIC clock every one second.
;*/
; clock:
clock:
; procedure;
; declare ret byte;
; do forever;
@4:
; ret = xdos (flag$wait,2);
MVI E,2H
MVI C,84H
CALL XDOS
; if (tod.sec := dec (tod.sec + 1)) = 60h then
LXI H,TOD+4H
MOV A,M
INR A
DAA
MOV M,A
SUI 60H
JNZ @4
; do;
; tod.sec = 0;
MOV M,A
; ret = xdos (flag$set,3);
MVI E,3H
MVI C,85H
CALL XDOS
; if (tod.min := dec (tod.min + 1)) = 60h then
LXI H,TOD+3H
MOV A,M
INR A
DAA
MOV M,A
SUI 60H
JNZ @4
; do;
; tod.min = 0;
MOV M,A
; if (tod.hr := dec (tod.hr + 1)) = 24h then
DCX H
MOV A,M
INR A
DAA
MOV M,A
SUI 24H
JNZ @4
; do;
; tod.hr = 0;
MOV M,A
; tod.day = tod.day + 1;
LHLD TOD
INX H
SHLD TOD
; end;
; end;
; end;
; end;
JMP @4
; end clock;
;end clock;
END


View File

@@ -0,0 +1,188 @@
$title ('MP/M 1.1 Data Page')
name datapg
dseg
;datapg:
;do;
;
;/*
; Copyright (C) 1979,1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (proces.lit)
;$include (memmgr.lit)
;
; declare tod structure (
tod:
public tod
; day address,
; hr byte,
; min byte,
; sec byte ) public
; initial (761,00H,00H,00H);
dw 761 ; day
db 0 ; hr
db 0 ; min
db 0 ; sec
; /* 01/31/80 00:00:00 */
;
; declare datapg (1) byte public at (.tod);
datapg equ tod
public datapg
;
; declare initpd process$descriptor external;
extrn initpd
; declare rlr address public initial(initpd);
rlr: dw initpd
public rlr
;
; declare dlr address public initial(0);
dlr: dw 0
public dlr
;
; declare drl address public initial(0);
drl: dw 0
public drl
;
; declare plr address public initial(0);
plr: dw 0
public plr
;
; declare slr address public initial(0);
slr: dw 0
public slr
;
; declare qlr address public initial(0);
qlr: dw 0
public qlr
;
; declare thrdrt address public initial(0);
thrdrt: dw initpd
public thrdrt
;
; declare max$cns literally '16';
maxcns equ 16
;
; declare nmb$cns byte public;
nmbcns: ds 1
public nmbcns
;
; declare console$attached (max$cns) address public
; initial (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
; declare cnsatt (1) address public at (.console$attached);
cnsatt:
public cnsatt
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
;
; declare console$queue (max$cns) address public
; initial (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
; declare cnsque (1) address public at (.console$queue);
cnsque:
public cnsque
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
;
; declare max$flgs literally '32';
maxflgs equ 32
nmbflags:
public nmbflags
db maxflgs
;
; declare sys$flag (max$flgs) address public initial (
; 0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,
; 0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,
; 0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,
; 0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH,0FFFFH);
; declare sysfla address public at (.sys$flag);
sysfla:
public sysfla
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
dw 0ffffh,0ffffh,0ffffh,0ffffh
;
; declare max$usr$pr literally '8';
maxusrpr equ 8
;
; declare nmb$segs byte public
; initial (max$usr$pr);
nmbsegs:
public nmbsegs
db maxusrpr
;
; declare mem$seg$tbl (max$usr$pr) memory$descriptor public;
msegtbl:
public msegtbl
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
db 0,0,0,0
; declare memseg memory$descriptor public at (.mem$seg$tbl);
memseg equ msegtbl
public memseg
;
; declare pdtbl (max$usr$pr) process$descriptor public;
pdtbl:
public pdtbl
ds 52
ds 52
ds 52
ds 52
ds 52
ds 52
ds 52
ds 52
;
;
; *** Note:
; The user process stack table has been moved to the MPM
; module where it overlays the initialization code.
;
; declare stktbl (max$usr$pr)
; structure (loc (20) address) public;
;stktbl:
; public stktbl
;
;table of offsets
;
ostod equ tod-datapg
osrlr equ rlr-datapg
osdlr equ dlr-datapg
osdrl equ drl-datapg
osplr equ plr-datapg
osslr equ slr-datapg
osqlr equ qlr-datapg
osthrdrt equ thrdrt-datapg
osnmbcns equ nmbcns-datapg
oscnsatt equ cnsatt-datapg
oscnsque equ cnsque-datapg
osnmbflags equ nmbflags-datapg
ossysfla equ sysfla-datapg
osnmbsegs equ nmbsegs-datapg
osmsegtbl equ msegtbl-datapg
ospdtbl equ pdtbl-datapg
;osstktbl equ stktbl-datapg
;end datapg;
end


View File

@@ -0,0 +1,324 @@
$title ('MP/M 1.0 Disk Change Procedure')
name dskchg
cseg
;diskchange:
;do;
;/*
; Copyright (C) 1979
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;*/
; declare rlrpd based rlr process$descriptor;
extrn rlr
; declare nmb$cns byte external;
extrn nmbcns
; declare cns$att (1) address external;
extrn cnsatt
; declare cns$que (1) address external;
extrn cnsque
; declare plr address external;
extrn plr
; declare drl address external;
extrn drl
; rawlst:
; procedure (string$adr) external;
extrn rawlst
; declare string$adr address;
; end rawlst;
; rawci:
; procedure byte external;
extrn rawci
; end rawci;
dseg
; declare nomatch boolean;
; declare plrcontadr address;
plrcontadr:
ds 2
; declare plrcont based plrcontadr address;
cnsai: ds 2
cseg
cnfrmsg:
db 0dh,0ah
db 'Confirm disk system reset (Y/N)?'
db '$'
denied:
db 'Denied.'
db 0dh,0ah
db '$'
rspmsg:
db $-$
db 0dh,0ah
db '$'
;/*
; dskchg:
;*/
; dskchg:
dskchg:
; procedure boolean public;
public dskchg
dseg
; declare pdadr address;
pdadr: ds 2
; declare pd based pdadr process$descriptor;
; declare (cur$cns,respns,i) byte;
curcns: ds 1
respns: ds 1
i: ds 1
; declare xplradr address;
xplradr:
ds 2
; declare xplr based xplradr process$dercriptor;
; declare next$console$ptr address;
nextconsoleptr:
ds 2
; declare next$console based next$console$ptr address;
; declare pdladr address;
pdladr: ds 2
; declare pdl based pdladr process$descriptor;
cseg
; if nmb$cns < 2
LDA NMBCNS
CPI 2H
MVI A,0FFH
RC
; then return true;
; cur$cns = rlrpd.console;
LXI B,0EH
LHLD RLR
DAD B
MOV A,M
STA CURCNS
; do i = 0 to nmb$cns-1;
LXI H,I
MVI M,0FFH
@10:
LDA NMBCNS
DCR A
LXI H,I
INR M
CMP M
MVI A,0FFH
RC
; pdadr = console$attached(i);
; /* pull process off poll list */
MOV L,M
MVI H,0
LXI B,CNSATT
DAD H
DAD B
SHLD CNSAI
MOV E,M
INX H
MOV D,M
XCHG
SHLD PDADR
; xplradr = 0;
LXI H,0H
SHLD XPLRADR
; plrcontadr = .plr;
LXI H,PLR
SHLD PLRCONTADR
; nomatch = true;
; do while nomatch and (plrcont <> 0);
@12:
MOV A,M
MOV E,A
INX H
MOV D,M
ORA D
JZ @13
; if plrcont = pdadr then
LXI B,PDADR
LDAX B
CMP E
JNZ @2
INX B
LDAX B
CMP D
JNZ @2
; do;
; nomatch = false;
; xplradr = plrcont;
XCHG
SHLD XPLRADR
; plrcont = xplr.pl;
MOV C,M
INX H
MOV B,M
XCHG
MOV M,B
DCX H
MOV M,C
; end;
JMP @13
@2:
; else
; do;
; plrcontadr = plrcont;
XCHG
SHLD PLRCONTADR
; end;
@3:
; end;
JMP @12
@13:
; console$attached(i) = rlr;
LHLD RLR
XCHG
LHLD CNSAI
MOV M,E
INX H
MOV M,D
; rlrpd.console = i;
LXI B,0EH
XCHG
DAD B
LDA I
MOV M,A
; call rawlst (.(0dh,0ah,
LXI B,cnfrmsg
CALL RAWLST
; 'Confirm reset disk system (Y/N)?','$'));
; respns = rawci;
CALL RAWCI
STA RESPNS
; call crlf;
LXI B,RSPMSG
STAX B
CALL RAWLST
; rlrpd.console = cur$cns;
; /* assign console back to pre-disk reset state */
LXI B,0EH
LHLD RLR
DAD B
LDA CURCNS
MOV M,A
; console$attached(i) = pdadr;
LHLD PDADR
XCHG
LHLD CNSAI
MOV M,E
INX H
MOV M,D
; nomatch = true;
; next$console$ptr = .console$queue(i);
LHLD I
MVI H,0
LXI B,CNSQUE
DAD H
DAD B
SHLD NEXTCONSOLEPTR
; do while nomatch;
@14:
; if (pdladr := next$console) = 0 then
MOV E,M
INX H
MOV D,M
XCHG
SHLD PDLADR
MOV A,H
ORA L
JZ @15
; do;
; nomatch = false;
; end;
; else
; do;
; if pdladr = pdadr then
XCHG
LHLD PDADR
MOV A,L
CMP E
JNZ @6
MOV A,H
CMP D
JNZ @6
; do;
; next$console = pdl.pl;
XCHG
; pd.pl = drl;
LHLD DRL
XCHG
LHLD PDADR
MOV M,E
INX H
MOV M,D
; drl = pdadr;
DCX H
SHLD DRL
; nomatch = false;
; end;
JMP @15
@6:
; else
; do;
; next$console$ptr = next$console;
LHLD NEXTCONSOLEPTR
MOV E,M
INX H
MOV D,M
XCHG
SHLD NEXTCONSOLEPTR
; end;
@7:
; end;
@5:
; end;
JMP @14
@15:
; /* put process back on the poll list */
; if xplradr <> 0 then
LHLD XPLRADR
MOV A,H
ORA L
JZ @8
; do;
; xplr.pl = plr;
XCHG
LHLD PLR
XCHG
MOV M,E
INX H
MOV M,D
; plr = xplradr;
DCX H
SHLD PLR
; end;
@8:
; if not ((respns = 'y') or (respns = 'Y')) then
LDA RESPNS
ANI 5FH
CPI 59H
JZ @10
; do;
; call rawlst (.(
LXI B,denied
CALL RAWLST ; 'Disk reset denied.',0dh,0ah,'$'));
; return false;
XRA A
RET
; end;
; end;
; return true;
; end dskchg;
;end diskchange;
END


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,290 @@
$title('MP/M 1.1 Flag Management')
name flag
cseg
;flag:
;do;
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;/*
; Common Literals
;*/
; declare enter$region literally
; 'disable';
; exitr:
; procedure external;
extrn exitr
; end exitr;
; declare exit$region literally
; 'call exitr';
;/*
; Proces Literals
;*/
; declare process$header literally
; 'structure (pl address,
; status byte,
; priority byte,
; stkptr address';
; declare bdos$save literally
; 'disk$set$dma address,
; disk$slct$byte,
; dcnt address,
; searchl byte,
; searcha address,
; scratch (13) byte)';
; declare process$descriptor literally
; 'process$header,
; name (8) byte,
; console byte,
; memseg byte,
; b address,
; threadraddress,
; bdos$save';
; declare rtr$status literally '0',
; FlgWt$status literally '4';
;/*
; Data Page Externals
;*/
; declare rlr address external;
extrn rlr
; declare drl address external;
extrn drl
; declare nmbflags byte external;
extrn nmbflags
; declare sys$flag literally 'sysfla';
; declare sys$flag (1) address external;
extrn sysfla
;/*
; Proces Externals
;*/
; declare rlrpdrbased rlr process$descriptor;
; declare dsptch$param literally 'dparam';
; declare dsptch$paramraddress external;
extrn dparam
; declare dispatch literally 'dispat';
; dispatch:
; procedure external;
extrn dispat
; end dispatch;
; declare insert$process literally 'inspr';
; insert$process:
; procedure (pdladr,pdadr) external;
extrn inspr
; declare (pdladr,pdadr) address;
; end insert$process;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
sharedflagcode:
; shared flag code, wait & set
LDA NMBFLAGS
MOV B,A
MOV A,C
CMP B
JC @1
MVI A,0FFH
POP H ; DISCARD RETURN ADR FROM SHARED
RET
@1:
; enter$region;
DI
; if sys$flag(flagnmb) <> 0FFFEH then
MOV E,C
MVI D,0
LXI H,SYSFLA
DAD D
DAD D ; HL = .sys$flag(flagnmb)
MOV E,M
INX H
MOV D,M ; DE = sys$flag(flagnmb)
MVI A,0FFH
CMP D
RET
;/*
; flagwait:
; The purpose of the flag wait procedure is to wait
; until a specified flag has been set before continuing
; execution. If the flag is already set no waiting
; occurs. If a process is already waiting for the same
; flag, no waiting occurs and the boolean flag under run
; is set true.
; Entry Conditions:
; C = flag
; Exit Conditions:
; A = return code,
; where 0 = success,
; FFH = failure
; *** Note *** if waiting is to occur the process remains
; in a critical region until dispatch
;*/
; flag$wait:
flgwt:
public flgwt
; procedure (flagnmb) byte reentrant public;
; declare flagnmb byte; ; Register C
; declare ret byte; ; Register B
; if flagnmb >= nmbflags then return 0FFH;
CALL SHAREDFLAGCODE
; ret = 0;
; enter$region;
; if sys$flag(flagnmb) <> 0FFFEH then
JNZ @5A
DCR A ; A = 0FEH
CMP E
JZ @2
; do;
; if sys$flag(flagnmb) <> 0FFFFH then
INR A ; A = 0FFH
CMP E
JNZ @5A
; do;
; /* flag$under$run */
; ret = 0FFH;
; end;
; else
; do;
; rlrpd.status = flgwt$status;
LHLD RLR
INX H
INX H
MVI M,4H
; dsptch$param = flagnmb;
MOV L,C
MVI H,0
SHLD DPARAM
; call dispatch;
CALL DISPAT
; end;
; end;
JMP @5
@2:
; else sys$flag(flagnmb) = 0FFFFH;
DCX H
MVI M,0FFH
@5:
XRA A
; exit$region;
@5A:
PUSH PSW
CALL EXITR
; return ret;
POP PSW ; A = ret
RET
; end flag$wait;
;/*
; flagset:
; The purpose of the flag set procedure is to set the
; specified flag. If a process is waiting for the flag
; to be set it is placed on the dispatcher ready list.
; If the flag is already set the booleanrflag over run
; is set true.
; Entry Conditions:
; C = flag
; Exit Conditions:
; A = return code,
; where 0 = success,
; FFH = failure
;*/
; flag$set:
flgset:
public flgset
; procedure (flagnmb) byte reentrant public;
; declare flagnmb byte; ; Register C
; derlare ret byte; ; Register B
; if flagnmb >= nmbflags then return 0FFH;
CALL SHAREDFLAGCODE
; ret = 0;
; enter$region;
; pdadr = sys$flag(flagnmb);
; if pdadr = 0FFFFH then
JNZ @9
CMP E
JNZ @7
; do;
; sys$flag(flagnmb) = 0FFFEH;
DCX H
MVI M,0FEH
; end;
JMP @5
@7:
; else
; do;
; if pdadr = 0FFFEH then
DCR A
CMP E
MVI A,0FFH
JZ @5A
; do;
; /* flag$over$run */
; ret = 0FFH;
; end;
@9:
; else
; do;
; sys$flag(flagnmb) = 0FFFFH;
MOV M,A
DCX H
MOV M,A
; pd.pl = drl;
LHLD DRL
XCHG
MOV M,E
INX H
MOV M,D
; drl = pdadr;
DCX H
SHLD DRL
; pd.status = rtr$status;
INX H
INX H
MVI M,0H
; end;
; end;
JMP @5
; exit$region;
; return ret;
; end flag$set;
;end flag;
END


View File

@@ -0,0 +1,327 @@
$title ('MP/M 1.1 Memory Management')
name memmgr
cseg
;memory$manager:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (memmgr.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (datapg.ext)
;$nolist
;$include (proces.ext)
;$nolist
; declare rlr address external;
extrn rlr
; declare nmbsegs byte external;
extrn nmbsegs
; declare msegtbl (1) structure (memory$descriptor);
extrn msegtbl
; declare maxseg literally 'nmbsegs - 1';
; exitr:
extrn exitr
; procedure external;
; end exitr;
; memory descriptor offsets
size equ 1
attrib equ 2
; declare user$process literally 'userpr';
; user$process:
userpr:
public userpr
; procedure (pdadr) byte public;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
; return not (pd.memseg = 0ffh);
LXI H,0FH
DAD B
MOV A,M
INR A
RZ
MVI A,0FFH
RET
; end user$process;
; declare i byte;
; abs$rq:
absrq:
public absrq
; procedure (mdadr) byte public reentrant;
; declare mdadr address;
; declare md based mdadr memory$descriptor;
; enter$region;
DI
; do i = 0 to maxseg;
LDA NMBSEGS
MOV E,A
LXI H,MSEGTBL-2
@8:
INX H
INX H
INX H
INX H
; if (memsegtbl(i).attrib and allocated) = 0 then
MVI A,80H
ANA M
JNZ @1
; do;
; if memsegtbl(i).base = md.base then
DCX H
DCX H
LDAX B
CMP M
INX H
INX H
JNZ @2
; do;
; memsegtbl(i).attrib = memsegtbl(i).attrib
; or allocated;
MVI A,80H
ORA M
MOV M,A
; md.size = memsegtbl(i).size;
INX B
DCX H
MOV A,M
STAX B
; md.attrib = memsegtbl(i).attrib;
INX B
INX H
MOV A,M
STAX B
; md.bank = memsegtbl(i).bank;
inx b
inx h
mov a,m
stax b
; rlrpd.memseg = i;
LXI B,0FH
LHLD RLR
DAD B
LDA NMBSEGS
SUB E
MOV M,A
; exit$region;
CALL EXITR
; return 0;
XRA A
RET
; end;
@2:
; end;
@1:
; end;
DCR E
JNZ @8
; exit$region;
CALL EXITR
; return 0FFH;
MVI A,0FFH
RET
; end abs$rq;
dseg
; declare j byte;
; declare fit$size byte;
; declare fit$index byte;
fitindex:
ds 1
cseg
; /*
; rel$rq:
; The purpose of the relocatable memory request procedure
; is to find the unallocated memory segment which best fits
; the size request.
; */
; rel$rq:
relrq:
public relrq
; procedure (mdadr) byte public reentrant;
; declare mdadr address;
; declare md based mdadr memory$descriptor;
; enter$region;
DI
; fit$size = 0ffh;
MVI D,0FFH ; D = fitsize
; do j = 0 to maxseg;
LDA NMBSEGS
MOV E,A
LXI H,MSEGTBL-2
INX B ; BC = .MD.SIZE
@10:
INX H
INX H
INX H
INX H
; if (memsegtbl(j).attrib and allocated) = 0 then
MVI A,80H
ANA M
JNZ @3
; do;
; if memsegtbl(j).size >= md.size then
DCX H
LDAX B
DCR A
CMP M
JNC @4
; do;
; if memsegtbl(j).size <= fit$size then
MOV A,D
CMP M
JC @5
; do;
; fit$index = j;
LDA NMBSEGS
SUB E
STA FITINDEX
; fit$size = memsegtbl(j).size;
MOV A,M
MOV D,A
; end;
@5:
; end;
@4:
; end;
INX H
@3:
; end;
DCR E
JNZ @10
@11:
; if fit$size <> 0ffh then
INR D
JZ @6
DCR D
LHLD FITINDEX
MVI H,0
DAD H
DAD H
LXI D,msegtbl ; MEMSEGTBL
DAD D
; do;
; md.base = memsegtbl(fit$index).base;
DCX B
MOV A,M
STAX B
; md.size = memsegtbl(fit$index).size;
INX H
INX B
MOV A,M
STAX B
; memsegtbl(fit$index).attrib =
; memsegtbl(fit$index).attrib or allocated;
INX H
MVI A,80H
ORA M
MOV M,A
; md.attrib = memsegtbl(fit$index).attrib;
INX B
STAX B
; md.bank = memsegtbl(fit$index).bank;
inx h
inx b
mov a,m
stax b
; rlrpd.memseg = fit$index;
LXI B,0FH
LHLD RLR
DAD B
LDA FITINDEX
MOV M,A
; exit$region;
CALL EXITR
; return 0;
XRA A
RET
; end;
@6:
; exit$region;
CALL EXITR
; return 0FFH;
MVI A,0FFH
RET
; end rel$rq;
; mem$fr:
memfr:
public memfr
; procedure (mdadr) public reentrant;
; declare mdadr address;
; declare md based mdadr memory$descriptor;
; declare i byte;
; do i = 0 to maxseg;
LDA NMBSEGS
MOV E,A
LXI H,MSEGTBL-4
@12:
INX H
INX H
INX H
INX H
; if memsegtbl(i).base = md.base then
LDAX B
CMP M
JNZ @7
; do;
; if memsegtbl(i).bank = md.bank then
PUSH H
PUSH B
INX H
INX H
INX H
INX B
INX B
INX B
LDAX B
CMP M
POP B
POP H
JNZ @7
; do;
; memsegtbl(i).attrib = memsegtbl(i).attrib
; and (not allocated);
INX H
INX H
MVI A,7FH
ANA M
MOV M,A
; return;
RET
; end;
; end;
@7:
; end;
DCR E
JNZ @12
; end mem$fr;
RET
;end memory$manager;
END


View File

@@ -0,0 +1,496 @@
$title ('MP/M 1.1 Main Program')
name mpm
cseg
;mpm:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (bdosi.ext)
;$nolist
;$include (datapg.ext)
;$nolist
; xdos:
extrn xdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xdos;
; tmp:
extrn tmp
; procedure external;
; end tmp;
; syinit:
extrn syinit
; procedure external;
; end syinit;
; xidle:
extrn xidle
; procedure external;
; end xidle;
; xbdos:
extrn xbdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xbdos;
; maxcns:
extrn maxcns
; procedure byte external;
; end maxcons;
; declare datapg (1) byte external;
extrn datapg
; declare sysdat address external;
extrn sysdat
; declare rlr address external;
extrn rlr
; declare nmb$segs byte external;
extrn nmbsegs
; declare nmb$cns byte external;
extrn nmbcns
; declare m$seg$tbl (1) structure (
extrn msegtbl
; base byte,
; size byte,
; attrib byte,
; bank byte );
;/*
; Init Process Data Segment
;
; *** Note:
; Portions of the following 'data' have been moved into csegs
; for the purposes of combining all the initialization code and data
; together in one place so that it can be overlayed by the user
; process stack table.
;
;
; declare stktbl (max$usr$pr)
; structure (loc (20) address) public;
stktbl:
public stktbl
;
;
;*/
; declare init$pd process$descriptor
; initial (idlepd,rtr$status,254,0,'Init ',0,0ffh,0,0,0080h,0);
public initpd
initpd:
dw idlepd ; pl
db 0 ; status
db 254 ; priority
dw 0 ; stkptr
db 'Init ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
dw 0080h ; disk set DMA
db $-$ ; disk select / user code
dw $-$ ; dcnt
db $-$ ; searchl
dw $-$ ; searcha
ds 2 ; drvact
ds 20 ; registers
ds 2 ; scratch
; declare init$stk (24) address
; initial (restarts,0C7C7H);
; /* this stack area is in the system data page */
dseg
;/*
; Idle Process Data Segment
;*/
; declare idle$pd process$descriptor
; initial (0,rtr$status,255,.idlentrypt,'Idle ',0,0ffh,0,0,0080h,0);
public idlepd
idlepd:
dw $-$ ; pl
db 0 ; status
db 255 ; priority
dw idlentrypt ; stkptr
db 'Idle ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
dw 0080h ; disk set DMA
db $-$ ; disk select / user code
dw $-$ ; dcnt
db $-$ ; searchl
dw $-$ ; searcha
ds 2 ; drvact
ds 20 ; registers
ds 2 ; scratch
; declare idle$stk (10) address
; initial (restarts,0C7C7H);
public idlestk
idlestk:
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
idlentrypt:
dw idle
cseg
; declare tmp$pd$adr address;
tmppdadr:
ds 2
; declare tmp$pd based tmp$pd$adr process$descriptor;
; declare tmp$stk$adr address;
tmpstkadr:
ds 2
; declare tmp$stk based tmp$stk$adr (114) address;
; declare sys$dat based tmp$pd$adr (1) byte;
dseg
; declare disk$mx userqcb public
; initial (0,0,'MXDisk ');
diskmx:
public diskmx
dw $-$ ; pointer
dw $-$ ; msgadr
db 'MXDisk ' ; name
; declare list$mx userqcb public
; initial (0,0,'MXList ');
listmx:
public listmx
dw $-$ ; pointer
dw $-$ ; msgadr
db 'MXList ' ; name
cseg
; memory descriptor offsets:
size equ 0001h
attrib equ 0002h
bank equ 0003h
;/*
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Idle Program
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;*/
; declare ret byte;
; declare (i,j) byte;
i: ds 1
j: ds 1
; declare parse$cqcb queuehead external;
extrn parsecqcb
; declare parse$mutex userqcbhead external;
extrn parsemutex
; declare tick$pd process$descriptor external;
extrn tickpd
; declare rspladr address;
rspladr:
ds 2
; declare rspl based rspladr address;
; declare temp address;
temp: ds 2
; declare mem$segs$adr address;
memsegsadr:
ds 2
; declare mem$segs based mem$segs$adr (1) byte;
; declare mem$banks$adr address;
membanksadr:
ds 2
; declare mem$banks based mem$banks$adr (1) byte;
; declare template (16) byte initial (
; 0,0,0,198,0,0,'Tmpx ',0,0ffh);
template:
dw $-$ ; pl
db 0 ; status
db 198 ; priority
dw $-$ ; stkptr
db 'Tmpx ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
; mpm:
mpm:
public mpm
; procedure public;
; stackptr = .init$stk+48;
; rlr = .init$pd;
lhld sysdat
mvi l,0f0h
sphl ; stackptr = sysdat + f0h
; call syinit;
CALL SYINIT
; ret = xdos (open$queue,.disk$mx);
LXI D,DISKMX
MVI C,87H
CALL XDOS
; ret = xdos (open$queue,.list$mx);
LXI D,LISTMX
MVI C,87H
CALL XDOS
; ret = xdos (make$queue,.parse$cqcb);
LXI D,PARSECQCB
MVI C,86H
CALL XDOS
; ret = xdos (write$queue,.parse$mutex);
LXI D,PARSEMUTEX
MVI C,8BH
CALL XDOS
; ret = xdos (create,.tick$pd);
LXI D,TICKPD
MVI C,90H
CALL XDOS
; ret = xdos (create,.clock$pd);
; ret = xdos (create,.cli$pd);
; ret = xdos (create,.attch$pd);
; rspladr = (tmp$pd$adr:=xdos (system$data$adr,0)) + 252;
; /* system$data(252-253) = address of data page */
lhld sysdat
SHLD TMPPDADR
; rspl = .datapg;
; /* system$data(15) = max memory segment followed by table */
mvi l,0fch
LXI B,DATAPG
MOV M,C
INX H
MOV M,B
; mem$segs$adr = tmp$pd$adr + 15;
; /* system$data(32) = memory bank table */
mvi l,0fh
SHLD MEMSEGSADR
; mem$banks$adr = tmp$pd$adr + 32;
; /* system$data(254-255) = resident system process list head */
mvi l,20h
SHLD MEMBANKSADR
; rspladr = rspladr + 2;
mvi l,0feh
SHLD RSPLADR
; temp = rspl;
; /* create the processes on the resident system process
; list and set the first two bytes of the PRL to xbdos adr */
MOV E,M
INX H
MOV D,M
XCHG
SHLD TEMP
; do while temp <> 0;
@2:
LHLD TEMP
MOV A,H
ORA L
JZ @3
; rspladr = temp;
SHLD RSPLADR
; temp = rspl;
MOV E,M
INX H
MOV D,M
XCHG
SHLD TEMP
; rspl = .xbdos;
LXI B,XBDOS
XCHG
MOV M,B
DCX H
MOV M,C
; ret = xdos (create,rspladr + 2);
INX H
INX H
XCHG
MVI C,90H
CALL XDOS
; end;
JMP @2
@3:
; /* setup the memory segment table */
; nmb$segs = mem$segs(0);
LHLD MEMSEGSADR
MOV A,M
STA NMBSEGS
INX H
XCHG ; DE = .MEM$SEGS(1)
LXI H,MSEGTBL ; HL = .MEM$SEG$TBL(0).BASE
; do i = 1 to nmb$segs;
RLC
RLC
MOV C,A
@4:
; mem$seg$tbl(i-1).base = mem$segs(i);
; mem$seg$tbl(i-1).size = mem$size(i-1);
; mem$seg$tbl(i-1).attrib = mem$attribs(i-1);;
; mem$seg$tbl(i-1).bank = mem$banks(i-1);
LDAX D
MOV M,A
INX H
INX D
; end;
DCR C
JNZ @4
; /* see if consoles configured > max physical consoles */
; if (nmb$cns:=sys$dat(1)) > maxcns then
CALL MAXCNS
LHLD TMPPDADR
INX H
CMP M
JC @1
MOV A,M
; do;
; nmb$cns = maxcns;
@1:
STA NMBCNS
; end;
; /* create TMP process descriptors, one per console */
; i = nmb$cns;
STA I
; do while i <> 0;
@6:
LDA I
ORA A
JZ @7
; tmp$pd$adr = tmp$pd$adr - 256;
LHLD TMPPDADR
DCR H
SHLD TMPPDADR
XCHG
; tmp$stk$adr = .tmp$pd.scratch(0);
LXI H,34H
DAD D
SHLD TMPSTKADR
; call move (16,.template,.tmp$pd);
LXI B,TEMPLATE
MVI L,10H
LDAX B
STAX D
INX B
INX D
DCR L
JNZ $-5H
; tmp$pd.stkptr = .tmp$stk(101);
LXI B,0CAH
LHLD TMPSTKADR
DAD B
MOV B,H
MOV C,L
LHLD TMPPDADR
XCHG
LXI H,4H
DAD D
MOV M,C
INX H
MOV M,B
; i = i - 1;
LXI H,I
DCR M
; tmp$pd.name(3) = i + '0';
MOV A,M
MOV B,A
ADI 30H
LXI H,9H
DAD D
MOV M,A
; tmp$pd.console = i;
LXI H,0EH
DAD D
MOV M,B
; tmp$pd.disk$slct = i;
LXI H,16H
DAD D
MOV M,B
; do j = 0 to 100;
MVI C,202
LHLD TMPSTKADR
@8:
; tmp$stk(j) = 0C7C7H;
MVI M,0C7H
INX H
; end;
DCR C
JNZ @8
; tmp$stk(101) = .tmp;
LXI B,TMP
MOV M,C
INX H
MOV M,B
; ret = xdos (create,.tmp$pd);
LHLD TMPPDADR
XCHG
MVI C,90H
CALL XDOS
; end;
JMP @6
@7:
; /* Terminate the initialization process */
; ret = xdos (terminate,0ffh);
MVI C,8FH
MVI E,0FFH
JMP XDOS
; /* Idle Process */
idle:
; do forever;
; call xidle;
CALL XIDLE
; end;
JMP idle
; end mpm;
;end mpm;
END


View File

@@ -0,0 +1,451 @@
$title ('MP/M 1.1 Parse Filename')
name parse
cseg
;parse:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (xdos.ext)
;$nolist
; readq:
extrn readq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end readq;
; writeq:
extrn writeq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end writeq;
; xdos:
extrn xdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xdos;
dseg
;/*
; Parse Queue Data Segment
;*/
; declare parse$cqcb structure (cqueue,pdadr address) public
; initial (0,'MXParse ',0,1);
public parsecqcb
parsecqcb:
dw $-$ ; ql
db 'MXParse ' ; name
dw 0 ; msglen
dw 1 ; nmbmsgs
dw $-$ ; dqph
dw $-$ ; nqph
dw $-$ ; msgin
dw $-$ ; msgout
dw $-$ ; msgcnt
dw $-$ ; pdadr
; declare parse$mutex address public
; initial (.parse$cqcb);
parsemutex:
public parsemutex
dw parsecqcb ; pointer
cseg
del:
db 0dh,' =.:<>_[],'
; /*
; parse:
; */
parse:
; parse:
; procedure (pcb$adr) address;
dseg
; declare pcb$adr address;
pcbadr: ds 2
; declare pcb based pcb$adr structure (
; filename$adr address,
; fcb$adr address );
; declare pcb$filename$adr address;
pcbfilenameadr:
ds 2
; declare pcb$fcb$adr address;
pcbfcbadr:
ds 2
; declare filename based pcb$filename$adr (1) byte;
filename equ pcbfilenameadr+1
; declare fcb based pcb$fcb$adr (1) byte;
fcb equ pcbfcbadr+1
; declare
; /* return conditions */
; endline literally '00000H',
; badfile literally '0FFFFH',
; /* useful literals */
; disk literally 'fcb(0)',
; fcbname literally '8', /* end of name */
; fcbtype literally '11', /* end of type field */
; fcbsize literally '16'; /* partial size of fcb */
; declare char byte; /* global temp for current char */
char: ds 1
; declare fnp byte; /* index into file name buffer */
fnp: ds 1
; declare fnlen byte;
fnlen: ds 1
cseg
; /* initialize local bases */
; pcb$filename$adr = pcb.filename$adr;
LDAX B
MOV L,A
INX B
LDAX B
MOV H,A
SHLD PCBFILENAMEADR
; pcb$fcb$adr = pcb.fcb$adr;
; /* initialize file control block to empty */
INX B
LDAX B
MOV L,A
INX B
LDAX B
MOV H,A
SHLD PCBFCBADR
; char = ' ';
LXI H,CHAR
MVI M,20H
; fnlen = 0;
LXI H,FNLEN
MVI M,0H
; fnp = -1;
DCX H
MVI M,0FFH
; do while fnlen < fcbsize-1;
@24:
LDA FNLEN
CPI 0FH
JNC @25
; if fnlen = fcbtype then char = 0;
SUI 0BH
JNZ @4
LXI H,CHAR
MOV M,A
@4:
; call putchar;
CALL PUTCHAR
; end;
JMP @24
@25:
; disk = 0;
; /* scan next name */
LHLD PCBFCBADR
MVI M,0H
; do forever;
@26:
; /* deblank command buffer */
; call gnc;
CALL GNC ; char left in A
; do while char = ' ';
@28:
CPI 20H
JZ @26
; call gnc;
; end;
; if delimiter then return badfile;
CALL DELIMITER
RAR
JC @8A
; fnlen = 0;
LXI H,FNLEN
MVI M,0H
; do while not delimiter;
@30:
CALL DELIMITER
RAR
JC @31
; if fnlen >= fcbname then /* error, file name too long */
LDA FNLEN
CPI 8H
JC @6
; return badfile;
@8A:
LXI H,0FFFFH
RET
@6:
; if char = '*' then call fillq(fcbname); else call putchar;
LDA CHAR
CPI 2AH
JNZ @7
MVI C,8H
CALL FILLQ
JMP @8
@7:
CALL PUTCHAR
@8:
; call gnc;
CALL GNC
; end;
JMP @30
@31:
; /* check for disk name */
; if char = ':' then
LDA CHAR
CPI 3AH
JNZ @9
; do;
; if not (disk = 0 and fnlen = 1) then
LHLD PCBFCBADR
MOV A,M
ORA A
JNZ @8A
LDA FNLEN
DCR A
JNZ @8A
; return badfile;
; /* must be a disk name */
; if (disk := fcb(1) - 'A' + 1) > 26
; /* invalid disk name */
LHLD PCBFCBADR
INX H
MOV A,M
SUI 41H
INR A
DCX H
MOV M,A
CPI 27
JNC @8A
; then return badfile;
; /* valid disk name replace space in name */
; else fcb(fnlen) = ' ';
LHLD FNLEN
MVI H,0
XCHG
LHLD PCBFCBADR
DAD D
MVI M,20H
; end;
JMP @26
@9:
; else
; do;
; /* char is not ':', so file name is set. scan remainder */
; /* at least one char scanned */
; fnlen = fcbname;
LXI H,FNLEN
MVI M,8H
; if char = '.' then /* scan file type */
CPI 2EH
JNZ @14
; do;
; call gnc;
CALL GNC
; do while not delimiter;
@32:
CALL DELIMITER
RAR
JC @33
; if fnlen >= fcbtype then
LDA FNLEN
CPI 0BH
JC @15
; /* error, type field too long */
; return badfile;
LXI H,0FFFFH
RET
@15:
; if char = '*'
LDA CHAR
CPI 2AH
JNZ @16
; then call fillq(fcbtype);
MVI C,0BH
CALL FILLQ
JMP @17
@16:
; else call putchar;
CALL PUTCHAR
@17:
; call gnc;
CALL GNC
; end;
JMP @32
@33:
LDA CHAR
; end;
@14:
; if char = 0dh
CPI 0DH
LXI H,0000H
; then return endline;
RZ
; else return .filename(fnp);
LHLD FNP
MVI H,0
XCHG
LHLD PCBFILENAMEADR
DAD D
RET
; end;
; end; /* of forever */
; end parse;
; gnctran:
gnctran:
; procedure(b) byte;
; declare b byte;
; if b < ' ' then return 0dh; /* all non-graphics */
MOV A,C
CPI 20H
MVI A,0DH
RC
; /* translate alpha to upper case */
; if b >= 'a' and b <= 'z' then
MOV A,C
CPI 'a'
RC
CPI 'z'+1
RNC
ANI 5FH
RET
; b = b and 101$1111b; /* upper case */
; return b;
; end gnctran;
; gnc:
gnc:
; procedure;
; char = gnctran(filename(fnp := fnp + 1));
LXI H,FNP
INR M
MOV C,M
MVI B,0
LHLD PCBFILENAMEADR
DAD B
MOV C,M
CALL GNCTRAN
STA CHAR
; end gnc;
RET
; delimiter:
delimiter:
; procedure byte;
; declare i byte;
; declare del(*) byte data
; (0dh,' =.:<>_[],');
; do i = 0 to last(del);
MVI C,11
LXI D,DEL
LXI H,CHAR
@20:
; if char = del(i) then return true;
LDAX D
SUB M
MVI A,0FFH
RZ
INX D
DCR C
JNZ @20
; end;
; return false;
XRA A
RET
; end delimiter;
; putchar:
putchar:
; procedure;
; fcb(fnlen:=fnlen+1) = char;
; /* can check here for ambig ref's "char = '?'" */
LXI H,FNLEN
INR M
MOV C,M
MVI B,0
LHLD PCBFCBADR
DAD B
LDA CHAR
MOV M,A
; end putchar;
RET
; fillq:
fillq:
; procedure(len);
; /* fill current name or type with question marks */
; declare len byte;
; char = '?'; /* question mark */
LXI H,CHAR
MVI M,3FH
; do while fnlen < len;
@22:
LDA FNLEN
CMP C
RNC
; call putchar;
PUSH B
CALL PUTCHAR
POP B
; end;
JMP @22
; end fillq;
;/*
; parse$filename:
;*/
; parse$filename:
parsefilename:
PUSH B
; procedure (pcb$adr) address reentrant public;
public parsefilename
; declare pcb$adr address;
; declare nxt$chr$adr address;
; declare ret byte;
; ret = xdos (read$queue,.parse$mutex);
LXI B,PARSEMUTEX
CALL READQ
; nxt$chr$adr = parse (pcb$adr);
POP B
CALL PARSE
PUSH H
; ret = xdos (write$queue,.parse$mutex);
LXI B,PARSEMUTEX
CALL WRITEQ
; return nxt$chr$adr;
POP H
RET
; end parse$filename;
;end parse;
END


View File

@@ -0,0 +1,42 @@
$title ('MP/M 1.1 Patch Area')
name patch
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
cseg
patch:
;0000h-000fh
dw 0,0,0,0
dw 0,0,0,0
;0010h-001fh
dw 0,0,0,0
dw 0,0,0,0
;0020h-002fh
dw 0,0,0,0
dw 0,0,0,0
;0030h-003fh
dw 0,0,0,0
dw 0,0,0,0
;0040h-004fh
dw 0,0,0,0
dw 0,0,0,0
;0050h-005fh
dw 0,0,0,0
dw 0,0,0,0
;0060h-006fh
dw 0,0,0,0
dw 0,0,0,0
end


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,112 @@
$title ('MP/M 1.1 Release MX queues Procedure')
name rlsmx
cseg
;release$MX:
;do;
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
; Revised:
; 23 Jan 80 by Thomas Rolander
;*/
; writeq:
extrn writeq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end writeq;
; declare qlr address external;
extrn qlr
;/*
; rlsMX:
; Note- this procedure must be called from within a
; critical region.
;*/
; rlsMX:
rlsmx:
public rlsmx
; procedure (rlr$pdadr) public;
dseg
; declare rls$pdadr address;
; declare ret byte;
; decrare xqlradr address;
xqlradr:
ds 2
; declare xqlr based xqlradr address;
; declare que based xqlradr structure (
; cqueue,pdadr address);
cseg
; xqlradr = qlr;
LHLD QLR
XCHG ; DE = xqlradr
; do while xqlradr <> 0;
@5:
MOV A,D
ORA E
RZ
; if que.name(0) = 'M' then
LXI H,2
DAD D
MOV A,M
CPI 4DH
JNZ @1
; do;
; if que.name(1) = 'X' then
INX H
MOV A,M
CPI 58H
JNZ @1
; do;
; if que.msgcnt = 0 then
LXI H,16H
DAD D
MOV A,M
INX H
ORA M
JNZ @1
; do;
; if que.pdadr = rls$pdadr then
INX H
MOV A,M
CMP C
JNZ @1
INX H
MOV A,M
CMP B
JNZ @1
; do;
; ret = writeq (.xqlradr);
PUSH B
PUSH D
xchg
shld xqlradr
LXI B,XQLRADR
CALL WRITEQ
POP D
POP B
; end;
; end;
; end;
; end;
@1:
; xqlradr = xqlr;
XCHG
MOV E,M
INX H
MOV D,M
; end;
JMP @5
; end rlsMX;
;end release$MX;
END


View File

@@ -0,0 +1,398 @@
$title ('MP/M 1.1 Terminal Handler')
name th
cseg
;terminal$handler:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (datapg.ext)
;$nolist
;$include (proces.ext)
;$nolist
; declare console$attached (1) address external;
extrn cnsatt
; declare console$queue (1) address external;
extrn cnsque
; declare drl address external;
extrn drl
; declare thread$root address external;
extrn thrdrt
; declare nmb$cns byte external;
; extrn nmbcns
; declare insert$process literally 'inspr';
; insert$process:
extrn inspr
; procedure (pdladr,pdadr) external;
; declare (pdladr,pdadr) address;
; end insert$process;
; exitr:
extrn exitr
; procedure external;
; end exitr;
; process descriptor offsets
nameos equ 6
CMNCODE:
; if (console$attached(pd.console) = pdadr)
LXI H,0EH
DAD B
MOV E,M
INX H
MVI D,0
LXI H,CNSATT
DAD D
DAD D
MOV A,M
CMP C
RNZ
INX H
MOV A,M
CMP B
DCX H
RET
;/*
; attach:
; The purpose of the attach procedure is to attach a
; console to the calling process. The console to attach
; is obtained from the process descriptor. If the console
; is already attached to the process or if no one has the
; console attached the process is given the console and
; is then placed on the DRL list. If the console is
; attached to some other process the current process is
; placed on the console queue.
; Entry Conditions:
; BC = process descriptor address
; Exit Conditions:
; None
; **** Note: this procedure must be called from within a
; critical region.
;*/
; attach:
attach:
public attach
; procedure (pdadr) reentrant public;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
; if (console$attached(pd.console) = pdadr) or
CALL CMNCODE
JZ @1A
MOV A,M
INX H
ORA M
JNZ @1
; (console$attached(pd.console) = 0) then
; do;
; console$attached(pd.console) = pdadr;
MOV M,B
DCX H
MOV M,C
; pd.pl = drl;
@1A:
LHLD DRL
XCHG
MOV H,B
MOV L,C
MOV M,E
INX H
MOV M,D
; drl = pdadr;
DCX H
SHLD DRL
; end;
RET
@1:
; else
; do;
; call insert$process (.console$queue(pd.console),pdadr);
LXI H,CNSQUE
DAD D
DAD D
MOV D,B
MOV E,C
MOV B,H
MOV C,L
JMP INSPR
; end;
; end attach;
;/*
; detach:
; The purpose of the detach procedure is to detach the
; console from the calling process. After checking to
; determine that the console is attached to the process
; invoking the detach, the console is detached, attaching
; the next waiting process to the console and then placing
; it on the DRL.
; Entry Conditions:
; BC = process descriptor address
; Exit Conditions:
; None
; **** Note: this procedure must be called from within a
; critical region.
;*/
; detach:
detach:
public detach
; procedure (pdadr) reentrant public;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
; if pdadr = console$attached(pd.console) then
CALL CMNCODE
RNZ
; do;
; console$attached(pd.console) = console$queue(pd.console);
PUSH H
LXI H,CNSQUE
DAD D
DAD D
POP D
MOV A,M
STAX D
MOV C,A
INX H
INX D
MOV A,M
STAX D
MOV B,A
; pdadr = console$attached(pd.console);
; if pdadr <> 0 then
ORA C
RZ
; do;
; console$queue(pd.console) = pd.pl;
LDAX B
DCX H
MOV M,A
INX B
LDAX B
INX H
MOV M,A
; pd.pl = drl;
LHLD DRL
MOV A,H
STAX B
DCX B
MOV A,L
STAX B
; drl = pdadr;
MOV H,B
MOV L,C
SHLD DRL
; pd.status = rtr$status;
INX H
INX H
MVI M,0H
; end;
; end;
; end detach;
RET
;/*
; assign:
; The purpose of the assign procedure is to attach a
; specified console to a specified process. The process
; threads are traversed from the thread root to find a
; match between the name passed as a parameter and the
; process name.
; Entry Conditions:
; BC = name address, points to console # followed by
; 8 byte ASCII name
; Exit Conditions:
; A = return code,
; where 0 = success,
; FFH = failure
;*/
; assign:
assign:
public assign
; procedure (name$adr) byte reentrant public;
; declare name$adr address;
; declare pname based name$adr (1) byte;
; declare assign$cns literally 'pname(0)';
; declare match$reqd literally 'pname(9)';
; declare i byte;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
; declare next$console$ptr address;
; declare next$console based next$console$ptr address;
; declare pdladr address;
; declare pdl based pdladr process$descriptor;
; pdadr = thread$root;
LHLD THRDRT
XCHG
; if assign$cns < nmb$cns then
; LXI H,NMBCNS
; LDAX B
; CMP M
; MVI A,0FFH
; RNC
INX B
; do while pdadr <> 0;
@9:
; i = 1;
PUSH B
LXI H,6
DAD D
PUSH H
MVI L,8
; do while (i <> 9) and (pd.name(i-1) = pname(i));
@11:
XTHL
LDAX B
sub M
INX B
INX H
JZ @11A
ani 7fh
jz @11a ;don't care on high order bit
POP H
POP B
JMP @6
@11A:
XTHL
DCR L
JNZ @11
; i = i + 1;
; end;
; if (i = 9) and
; (not match$reqd or
LDAX B
RAR
POP H
POP B
DCX B
LDAX B
MOV C,A
MVI B,0
JNC @12
CMP M
JNZ @6
; (match$reqd and (assign$cns = pd.console))) then
; do;
; enter$region;
@12: ; DE = pdadr, BC = assign$cns
DI
; console$attached(assign$cns) = pdadr;
; /* if process is currently queued for the console
; then put the process on the dispatcher ready list */
LXI H,CNSATT
DAD B
DAD B
MOV M,E
INX H
MOV M,D
; next$console$ptr = .console$queue(assign$cns);
LXI H,CNSQUE
DAD B
DAD B
; do forever;
@13: ; HL = next$console$ptr, DE = pdadr
; if (pdladr := next$console) = 0 then
MOV C,M
INX H
MOV B,M
DCX H
MOV A,B
ORA C
JZ @7
; do;
; exit$region;
; return 0;
; end;
; if pdladr = pdadr then
; HL = NEXT$CONSOLE$PTR, DE = PDADR, BC = PDLADR
MOV A,E
CMP C
JNZ @8
MOV A,D
CMP B
JNZ @8
; do;
; next$console = pdl.pl;
LDAX B
MOV M,A
INX B
INX H
LDAX B
MOV M,A
; pd.pl = drl;
LHLD DRL
XCHG
MOV M,E
INX H
MOV M,D
; drl = pdadr;
DCX H
SHLD DRL
; exit$region;
@7:
CALL EXITR
; return 0;
XRA A
RET
; end;
@8:
; next$console$ptr = next$console;
MOV A,M
INX H
MOV H,M
MOV L,A
; end; /* of forever */
JMP @13
; end;
@6:
; pdadr = pd.thread;
LXI H,12H
DAD D
MOV E,M
INX H
MOV D,M
MOV A,D
ORA E
JNZ @9
; end;
; return 0FFH;
CMA
RET
; end assign;
;end terminal$handler;
END


View File

@@ -0,0 +1,171 @@
$title ('MP/M 1.1 Tick Process')
name tick
cseg
;tick:
;do;
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (bdosi.ext)
;$nolist
;$include (datapg.ext)
;$nolist
; xdos:
extrn xdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xdos;
; stpclk:
extrn stpclk
; procedure external;
; end stpclk;
; declare dlr address external;
extrn dlr
; declare drl address exteranl;
extrn drl
dseg
;/*
; Tick Process Data Segment
;*/
; declare tick$pd process$descriptor public
; initial (0,rtr$status,10,tick$entrypt,
; 'Tick ',0,0ffh,0,0,0);
tickpd:
public tickpd
extrn clockpd
dw clockpd ; pl
db 0 ; status
db 10 ; priority
dw tickentrypt ; stkptr
db 'Tick ' ; name
db $-$ ; console
db 0ffh ; memseg (system)
dw $-$ ; b
dw $-$ ; thread
dw $-$ ; disk set DMA
db $-$ ; disk select / user code
dw $-$ ; dcnt
db $-$ ; searchl
dw $-$ ; searcha
ds 2 ; drvact
ds 20 ; registers
ds 2 ; scratch
; declare tick$stk (10) address
; initial (restarts,.tick);
tickstk:
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
dw 0c7c7h,0c7c7h,0c7c7h
tickentrypt:
dw tick
; declare ret byte;
; declare pdadr address;
; declare pd based pdadr process$descriptor;
cseg
;/*
; tick:
;*/
; tick:
tick:
; procedure;
; do forever;
@4:
; ret = xdos (flag$wait,1);
MVI E,1
MVI C,84H
CALL XDOS
; if dlr <> 0 then
LHLD DLR
MOV A,H
ORA L
JZ @4
; do;
; pdadr = dlr;
XCHG
; if (pd.b := pd.b - 1) = 0 then
LXI H,10H
DAD D
DCR M
JNZ @2
INX H
MOV A,M
ORA A
JZ @6
DCR M
JMP @2
; do while (pdadr <> 0) and (pd.b = 0);
@6: ; DE = pdadr, HL = pd.b
MOV A,D
ORA E
JZ @2
LXI H,10H
DAD D
MOV A,M
INX H
ORA M
JNZ @2
; dlr = pd.pl;
XCHG
MOV E,M
INX H
MOV D,M
XCHG
SHLD DLR
; pd.pl = drl;
LHLD DRL
XCHG
MOV M,D
DCX H
MOV M,E
; drl = pdadr;
SHLD DRL
; pdadr = dlr;
LHLD DLR
XCHG
; end;
JMP @6
@7:
@2:
; if dlr = 0 then call stp$clk;
LHLD DLR
MOV A,H
ORA L
CZ STPCLK
; end;
; end;
JMP @4
; end tick;
;end tick;
END


View File

@@ -0,0 +1,631 @@
$title ('MP/M 1.1 Terminal Message Processor')
name tmp
cseg
;tmp:
;do;
;$include (copyrt.lit)
;/*
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (xdos.lit)
;$nolist
;$include (fcb.lit)
;$nolist
;$include (xdos.ext)
;$nolist
;$include (bdos.ext)
;$nolist
;$include (datapg.ext)
;$nolist
; xdos:
extrn xdos
; procedure (func,info) address external;
; declare func byte;
; declare info address;
; end xdos;
; mon1:
extrn mon1
; procedure (func,info) external;
; declare func byte;
; declare info address;
; end mon1;
; mon2:
extrn mon2
; procedure (func,info) byte external;
; declare func byte;
; declare info address;
; end mon2;
; open:
extrn open
; procedure (fcbadr) byte external;
; declare fcbadr address;
; end open;
; close:
extrn close
; procedure (fcbadr) byte external;
; declare fcbadr address;
; end close;
; readbf:
extrn readbf
; procedure (fcbadr) byte external;
; declare fcbadr address;
; end readbf;
; setdma:
extrn setdma
; procedure (dmaadr) external;
; declare dmaadr address;
; end setdma;
; co:
extrn co
; procedure (char) external;
; declare char byte;
; end co;
; ci:
extrn ci
; procedure byte external;
; end ci;
; printb:
extrn printb
; procedure (msgadr) external;
; declare msgadr address;
; end printb;
; readbu:
extrn readbu
; procedure (bufferadr) external;
; declare bufferadr address;
; end readbu;
; crlf:
extrn crlf
; procedure external;
; end crlf;
; assign:
extrn assign
; procedure (name$adr) byte external;
; declare name$adr address;
; end assign;
dseg
;/*
; TMP Data Segment
;*/
; declare rlr address external;
extrn rlr
; declare rlrpd based rlr process$descriptor;
; declare ver (1) byte external;
extrn ver
; declare cli$lqcb queuehead external;
extrn clilqcb
; declare subflgadr address;
subflgadr:
ds 2
; declare subflg based subflgadr (1) byte;
cseg
; declare cli$name (8) byte data ('c'+80h,'li ');
cliname:
db 'c'+80h,'li '
; declare submit$fcb (16) byte data (1,'$$$ SUB',
; 0,0,0,0);
submitfcb:
db 1
db '$$$ SUB'
db 0,0,0,0
dskerr:
db 'Disk error during submit file read.'
db '$'
;/*
; tmp:
;*/
; tmp:
tmp:
public tmp
LXI H,0FF4CH
DAD SP
SPHL
; procedure reentrant public;
; declare buf(129) byte;
; declare fcb fcb$descriptor;
; declare submit$flag byte;
; declare console byte;
; declare i byte;
; declare ret byte;
; declare CLIQ (2) address;
; declare pname (10) byte;
; console = rlrpd.console;
LXI B,0EH
LHLD RLR
DAD B
MOV A,M
LXI H,0A3H ; CONSOLE
DAD SP
MOV M,A
; subflgadr = xdos (system$data$adr,0) + 128;
MVI C,9AH
CALL XDOS
LXI D,80H
DAD D
SHLD SUBFLGADR
; subflg(console) = false;
LXI H,0A3H ; CONSOLE
DAD SP
MOV C,M
MVI B,0
LHLD SUBFLGADR
DAD B
MVI M,0H
; CLIQ(0) = .cli$lqcb;
LXI B,CLILQCB
LXI H,0A6H ; CLIQ
DAD SP
MOV M,C
INX H
MOV M,B
; CLIQ(1) = .buf;
LXI H,0H ; BUF
DAD SP
XCHG
LXI H,0A8H ; CLIQ+2H
DAD SP
MOV M,E
INX H
MOV M,D
; submit$flag = false;
LXI H,0A2H ; SUBMITFLAG
DAD SP
MVI M,0H
; pname(0) = console;
LXI H,0A3H ; CONSOLE
DAD SP
MOV A,M
LXI H,0AAH ; PNAME
DAD SP
MOV M,A
; call move (8,.cli$name,.pname(1));
INX H
XCHG
LXI B,CLINAME
MVI L,8H
LDAX B
STAX D
INX B
INX D
DCR L
JNZ $-5H
; pname(9) = 0;
XCHG
MOV M,E
; call set$dma (.buf(1));
LXI H,1H ; BUF+1H
DAD SP
MOV B,H
MOV C,L
;
; Temporarily swap stack pointers to avoid TMP process
; descriptor destruction.
;
lxi h,00a2h
dad sp
sphl
CALL SETDMA
; ret = xdos (attach,0);
MVI C,92H
CALL XDOS
; call print$b (.ver);
LXI B,VER
CALL PRINTB
; ret = xdos (detach,0);
MVI C,93H
CALL XDOS
lxi h,-00a2h
dad sp
sphl
; do forever;
@17:
; ret = xdos (attach,0);
MVI C,92H
CALL XDOS
; call crlf;
CALL CRLF
; i = rlrpd.disk$slct and 0fh;
LXI B,16H
LHLD RLR
DAD B
MOV A,M
PUSH PSW
ANI 0FH
; if (i:=i-10) < 15 then
SUI 10
JC @TMP0
; call co ('1');
PUSH PSW
MVI C,'1'
CALL CO
POP PSW
SUI 10
; call co (i + 10 + '0');
@TMP0:
ADI 10+'0'
MOV C,A
CALL CO
; call co (shr(rlrpd.disk$slct,4) + 'A');
POP PSW
ANI 0f8h
RAR
RAR
RAR
RAR
ADI 41H
MOV C,A
CALL CO
; call co ('>');
MVI C,3EH
CALL CO
; buf(0) = 100;
LXI H,0H ; BUF
DAD SP
MVI M,100
; if not submit$flag then
LXI H,0A2H ; SUBMITFLAG
DAD SP
MOV A,M
CMA
RAR
JNC @1
; do;
; if subflg(console) then
LXI H,0A3H ; CONSOLE
DAD SP
MOV C,M
MVI B,0
LHLD SUBFLGADR
DAD B
MOV A,M
RAR
JNC @2
; do;
; call move (16,.submit$fcb,.fcb.et);
LXI H,81H ; FCB
DAD SP
XCHG
LXI B,SUBMITFCB
MVI L,10H
LDAX B
STAX D
INX B
INX D
DCR L
JNZ $-5H
; fcb.fn(1) = console + '0';
MVI A,30H
LXI H,0A3H ; CONSOLE
DAD SP
ADD M
LXI H,83H ; FCB+2H
DAD SP
MOV M,A
; if open (.fcb) <> 0ffh then
LXI H,81H ; FCB
DAD SP
MOV B,H
MOV C,L
CALL OPEN
INR A
JZ @3
; do;
; submit$flag = true;
LXI H,0A2H ; SUBMITFLAG
DAD SP
MVI M,0FFH
; end;
@3:
; subflg(console) = false;
LXI H,0A3H ; CONSOLE
DAD SP
MOV C,M
MVI B,0
LHLD SUBFLGADR
DAD B
MOV M,B
; end;
@2:
; end;
; if submit$flag then
LXI H,0A2H ; SUBMITFLAG
DAD SP
MOV A,M
RAR
JNC @6
; do;
@1:
; use buffer area as temporary stack
lxi h,0081h
dad sp
sphl
; if mon2 (11,0) then
MVI C,0BH
CALL MON2
RAR
JNC @5
; do;
; ret = ci;
CALL CI
; call mon1 (19,.fcb);
; submit$flag = false;
; end;
lxi h,-0081h
dad sp
sphl
JMP @10A
@5:
lxi h,-0081h
dad sp
sphl
; else
; do;
; fcb.nr = fcb.rc - 1;
LXI H,90H ; FCB+0FH
DAD SP
MOV A,M
DCR A
LXI H,0A1H ; FCB+20H
DAD SP
MOV M,A
; if readbf (.fcb) = 0ffh then
LXI H,81H ; FCB
DAD SP
MOV B,H
MOV C,L
CALL READBF
INR A
JNZ @7
; do;
; submit$flag = false;
call endsubmit
; call mon1 (19,.fcb); /* delete file */
LXI H,81H ; FCB
DAD SP
XCHG
MVI C,13H
CALL MON1
; call print$b (.(
LXI B,dskerr
CALL PRINTB
; 'Disk error during submit file read.','$'));
; call crlf;
CALL CRLF
; end;
JMP @6
@7:
; else
; do;
; i = 2;
LXI H,2H ; BUF+2H
DAD SP
; do while buf(i) <> 0;
@7A:
mov a,m
ora a
jz @7B
mov c,a
; call co (.buf(i));
push h
CALL CO
pop h
; i = i + 1;
inx h
; end;
jmp @7A
; call co (0dh);
@7B:
mvi c,0dh
call co
JMP @9
; end;
; end;
; end;
; if not submit$flag then
; do;
@6:
; call read$bu (.buf);
LXI H,0H ; BUF
DAD SP
MOV B,H
MOV C,L
;
; The following stack swap is done to prevent destruction
; of the TMP process descriptor by the stack. The stack used
; during read$bu overlays the TMP fcb and the end of the
; line buffer. Note that the line buffer length is reduced
; from 128 to 100 bytes.
;
lxi h,00a2h
dad sp
sphl
CALL READBU
lxi h,-00a2h
dad sp
sphl
; end;
@9:
; if (buf(1) <> 0) and
LXI H,1H ; BUF+1H
DAD SP
MOV A,M
ORA A
JZ @10
MOV B,A
INX H
MOV A,M
CPI ';'
JZ @10
MOV C,A
; (buf(2) <> ';') then
; do;
; if (buf(1) = 2) and (buf(3) = ':') then
MOV A,B
CPI 2
JNZ @11
INX H
MOV A,M
CPI ':'
JNZ @11
; do;
; i = (buf(2) and 101$1111b) - 'A';
MVI A,5FH
ANA C
SUI 'A'
; if i < 16
CPI 10H
JNC @13
; then call mon1 (14,i);
MOV E,A
MVI C,0EH
CALL MON1
; end;
JMP @13
@11:
; else
; do;
; buf(buf(1)+2) = 0;
LXI H,1H ; BUF+1H
DAD SP
MOV C,M
MVI B,0
LXI H,2H ; BUF+2H
DAD SP
DAD B
MVI M,0H
; call co (0ah);
MVI C,0AH
CALL CO
; buf(0) = rlrpd.disk$slct;
LXI B,16H
LHLD RLR
DAD B
MOV A,M
LXI H,0H ; BUF
DAD SP
MOV M,A
; buf(1) = console;
XCHG
LXI H,0A3H ; CONSOLE
DAD SP
MOV A,M
INX D
STAX D
; ret = assign (.pname);
LXI H,0AAH ; PNAME
DAD SP
MOV B,H
MOV C,L
CALL ASSIGN
; ret = xdos (write$queue,.CLIQ);
LXI H,0A6H ; CLIQ
DAD SP
XCHG
MVI C,8BH
CALL XDOS
; end;
@13:
; end;
@10:
; if submit$flag then
LXI H,0A2H ; SUBMITFLAG
DAD SP
MOV A,M
RAR
JNC @17
; do;
; if fcb.nr = 1 then
dcx h
MOV A,M
DCR A
JNZ @15
@10A:
; do;
; submit$flag = false;
; call mon1 (19,.fcb); /* delete file */
LXI H,81H ; FCB
DAD SP
XCHG
MVI C,13H
CALL MON1
call endsubmit
; end;
JMP @17
@15:
; else
; do;
; fcb.rc = fcb.rc - 1;
LXI H,90H ; FCB+0FH
DAD SP
DCR M
; call close (.fcb);
LXI H,81H ; FCB
DAD SP
MOV B,H
MOV C,L
CALL CLOSE
; end;
; end;
; end;
JMP @17
; end tmp;
;end tmp;
endsubmit:
; submit$flag = false;
LXI H,0A2H+2 ; SUBMITFLAG
DAD SP
mvi m,0
; /* free drive */
; call mon1 (39,0ffffh);
mvi c,39
lxi d,0ffffh
jmp mon1
END


View File

@@ -0,0 +1,46 @@
$title ('MP/M Version & Revision Date')
name ver
;
; MP/M 1.1 Version
;
;/*
; Copyright (C) 1979,1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 27 Jan 80 by Thomas Rolander
;*/
cseg
;
extrn mpm
startmpm:
jmp mpm
public sysdat
sysdat:
dw $-$
copyright:
db 'COPYRIGHT (C) 1980,'
db ' DIGITAL RESEARCH '
serial:
db '654321'
public ver
ver:
db 0dh,0ah,0ah
db 'MP/M '
db '1.1'
; db '$'
db ' '
; db ' '
db '[27 Jan 80 9:45]'
db '$ '
end startmpm


View File

@@ -0,0 +1,987 @@
$title ('MP/M 1.1 Extended Disk Operating System')
name xdos
cseg
;xdos:
;do;
;/*
; Copyright (C) 1979,1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 18 Jan 80 by Thomas Rolander
;*/
;$include (common.lit)
;$nolist
;$include (queue.lit)
;$nolist
;$include (proces.lit)
;$nolist
;$include (memmgr.lit)
;$nolist
;$include (datapg.ext)
;$nolist
;$include (proces.ext)
;$nolist
;$include (queue.ext)
;$nolist
;$include (flag.ext)
;$nolist
;$include (memmgr.ext)
;$nolist
;$include (th.ext)
;$nolist
; parse$filename:
extrn parsefilename
; procedure (pcb$address) address external;
; declare pcb$address address;
; end parse$filename;
; exitr:
extrn exitr
; procedure external;
; end exitr;
; flgwt:
extrn flgwt
; procedure (flgnmb) byte external;
; declare flgnmb byte;
; end flgwt;
; flgset:
extrn flgset
; procedure (flgnmb) byte external;
; declare flgnmb byte;
; end flgset;
; absrq:
extrn absrq
; procedure (mdadr) byte external;
; declare mdadr address;
; end absrq;
; relrq:
extrn relrq
; procedure (mdadr) byte external;
; declare mdadr address;
; end relrq;
; memfr:
extrn memfr
; procedure (mdadr) byte external;
; declare mdadr address;
; end memfr;
; dispat:
extrn dispat
; procedure external;
; end dispat;
; makeq:
extrn makeq
; procedure (qcbadr) byte external;
; declare qcbadr address;
; end makeq;
; openq:
extrn openq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end openq;
; deletq:
extrn deletq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end deletq;
; readq:
extrn readq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end readq;
; creadq:
extrn creadq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end creadq;
; writeq:
extrn writeq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end writeq;
; cwriteq:
extrn cwriteq
; procedure (uqcbadr) byte external;
; declare uqcbadr address;
; end cwriteq;
; assign:
extrn assign
; procedure (pname) byte external;
; declare pname address;
; end assign;
; declare dparam address external;
extrn dparam
; declare rlr address external;
extrn rlr
; declare drl address external;
extrn drl
; declare dlr address external;
extrn dlr
; declare plr address external;
extrn plr
; declare slr address external;
extrn slr
; declare qlr address external;
extrn qlr
; declare thrdrt address external
extrn thrdrt
; declare nmbcns byte external;
extrn nmbcns
; declare cnsque (1) address external;
extrn cnsque
; declare tod structure (
extrn tod
; day address,
; hr byte,
; min byte,
; sec byte ) external;
; declare nmbflags byte external;
extrn nmbflags
; declare sysfla (1) address external;
extrn sysfla
; declare sysdat address external;
extrn sysdat
; declare cli$lqcb address external;
extrn clilqcb
dseg
; declare cli$uqcb userqcbhead
; initial (.cli$lqcb,0);
cliuqcb:
dw clilqcb ; pointer
dw $-$ ; msgadr
; declare rsp$adr address;
rspadr: ds 2
; declare rsp$uqcb userqcb
; initial (0,.rsp$adr,'$$$$$$$$');
rspuqcb:
dw $-$ ; pointer
dw rspadr ; msgadr
db '$$$$$$$$' ; name
; declare cpb$adr address;
cpbadr: ds 2
; declare cpb based cpb$adr structure (
; rsp$name$adr address,
; rsp$param address);
; declare flag$wait$function literally '4';
; declare flag$set$function literally '5';
; declare (svstk,old$drl,old$thread$root) address;
svstk: ds 2
olddrl: ds 2
oldthreadroot:
ds 2
cseg
; xdos:
xdos:
public xdos
; procedure (function,parameter) address reentrant public;
; declare function byte;
; declare parameter address;
; declare ret address;
; declare pd based parameter process$descriptor;
; ret = 0000H;
MOV A,C
; function = function - 128;
SUI 80H
; if function > max$xdos$function then
CPI maxfunc
LXI H,0FFFFH
RNC
; do;
; ret = 0FFFFH;
; end;
; else
; do case function;
CPI 4H
JZ @1 ; SETUP RETURN TO DISPATCH
CPI 5H ; FOR ALL BUT FLAG OP'S
JZ @1
LXI H,DISPAT
PUSH H
@1:
LXI H,EXDOS
PUSH H
MOV B,D
MOV C,E
MOV E,A
MVI D,0
LXI H,@37
DAD D
DAD D
MOV E,M
INX H
MOV D,M
LHLD RLR
INX H
INX H ; HL = .RLR.STATUS
XCHG
PCHL
; /* function = 128, Absolute Memory Request */
; ret = abs$rq (parameter);
; CALL ABSRQ
; /* function = 129, Relocatable Memory Request */
; ret = rel$rq (parameter);
; CALL RELRQ
; /* function = 130, Memory Free */
; call mem$fr (parameter);
; CALL MEMFR
; /* function = 131, Poll Device */
; do;
@7:
; enter$region;
DI
; dsptch$param = parameter;
MOV L,C
MOV H,B
SHLD DPARAM
; rlrpd.status = poll$status;
XCHG
MVI M,3H
; end;
RET
; /* function = 132, Flag Wait */
; ret = flag$wait (parameter);
; CALL FLGWT
; /* function = 133, Flag Set */
; ret = flag$set (parameter);
; CALL FLGSET
; /* function = 134, Make Queue */
; ret = makeq (parameter);
; CALL MAKEQ
; /* function = 135, Open Queue */
; ret = openq (parameter);
; CALL OPENQ
; /* function = 136, Delete Queue */
; ret = deletq (parameter);
; CALL DELETQ
; /* function = 137, Read Queue */
; ret = readq (parameter);
; CALL READQ
; /* function = 138, Conditional Read Queue */
; ret = creadq (parameter);
; CALL CREADQ
; /* function = 139, Write Queue */
; ret = writeq (parameter);
; CALL WRITEQ
; /* function = 140, Conditional Write Queue */
; ret = cwriteq (parameter);
; CALL CWRITEQ
; /* function = 141, Delay */
; do;
@17:
; enter$region;
DI
; dsptch$param = parameter;
MOV L,C
MOV H,B
SHLD DPARAM
; rlrpd.status = delay$status;
XCHG
MVI M,5H
; end;
RET
; /* function = 142, Dispatch */
; do;
@18:
; enter$region;
DI
; rlrpd.status = dispatch$status;
XCHG
MVI M,9H
; end;
RET
; /* function = 143, Terminate */
; do;
@19:
; enter$region;
DI
; dsptch$param = parameter;
MOV L,C
MOV H,B
SHLD DPARAM
; rlrpd.status = terminate$status;
XCHG
MVI M,7H
; end;
RET
; /* function = 144, Create */
; do;
@20:
; enter$region;
DI
; old$drl = drl;
LHLD DRL
SHLD OLDDRL
; old$thread$root = thread$root;
LHLD THRDRT
SHLD OLDTHREADROOT
; drl,
; thread$root = parameter;
MOV L,C
MOV H,B
SHLD DRL
SHLD THRDRT
; do while pd.pl <> 0;
@38:
MOV E,M
INX H
MOV D,M
MOV A,E
ORA D
JZ @39
; pd.thread = pd.pl;
LXI H,12H
DAD B
MOV M,E
INX H
MOV M,D
CALL @39A
; parameter = pd.pl;
MOV B,D
MOV C,E
XCHG
; end;
JMP @38
@39:
; pd.pl = old$drl;
XCHG
LHLD OLDDRL
XCHG
MOV M,D
DCX H
MOV M,E
; pd.thread = old$thread$root;
LHLD OLDTHREADROOT
XCHG
LXI H,12H
DAD B
MOV M,E
INX H
MOV M,D
@39A:
; pd.drvacc = 0;
lxi h,1ch
dad b
xra a
mov m,a
inx h
mov m,a
; end;
RET
; /* function = 145, Set Priority */
; do;
@21:
; enter$region;
DI
; dsptch$param = parameter;
MOV L,C
MOV H,B
SHLD DPARAM
; rlrpd.status = set$prior$status;
XCHG
MVI M,8H
; end;
RET
; /* function = 146, Attach */
; do;
@22:
; enter$region;
DI
; rlrpd.status = attach$status;
XCHG
MVI M,0AH
; end;
RET
; /* function = 147, Detach */
; do;
@23:
; enter$region;
DI
; rlrpd.status = detach$status;
XCHG
MVI M,0BH
; end;
RET
; /* function = 148, Set Console */
; do;
@24:
lxi h,nmbcns
mov a,c
cmp m
mvi a,0ffh
rnc ;** return if bad console #
; enter$region;
DI
; dsptch$param = parameter;
MOV L,C
MOV H,B
SHLD DPARAM
; rlrpd.status = set$cns$status;
XCHG
MVI M,0CH
; end;
RET
; /* function = 149, Assign Console */
; ret = assign (parameter);
; CALL ASSIGN
; /* function = 150, Send CLI Command */
; do;
@26:
; cli$uqcb.msgadr = parameter;
MOV L,C
MOV H,B
SHLD CLIUQCB+2H
; ret = writeq (.cli$uqcb);
LXI B,CLIUQCB
JMP WRITEQ
; end;
; /* function = 151, Call Resident System Process */
; do;
@27:
; enter$region;
DI
POP H ; DISCARD EXDOS RETURN
; cpb$adr = parameter;
MOV L,C
MOV H,B
SHLD CPBADR
; call move (8,cpb.rsp$name$adr,.rsp$uqcb.name);
MOV C,M
INX H
MOV B,M
LXI D,RSPUQCB+4H
MVI L,8H
LDAX B
STAX D
INX B
INX D
DCR L
JNZ $-5H
; /* open queue having passed procedure name */
; if low(ret := xdos (135,.rsp$uqcb)) <> 0ffh then
LXI B,RSPUQCB
CALL OPENQ
INR A
LXI H,0001H
JZ @30
; do;
; /* read queue to get procedure entry point address */
; ret = xdos (137,.rsp$uqcb);
; /* execute the procedure (function) */
LXI B,RSPUQCB
CALL READQ
; ret = xfunc (cpb.rsp$param,rsp$adr);
; /* write queue to put message back on queue, this
; mechanism makes the procedure a serially
; resuseable resource */
LHLD CPBADR
INX H
INX H
MOV C,M
INX H
MOV B,M
LHLD RSPADR
LXI D,XFUNC
PUSH D
PCHL
XFUNC:
; if low(xdos (139,.rsp$uqcb)) = 0ffh
PUSH H
LXI B,RSPUQCB
CALL WRITEQ
INR A
POP H
JNZ @30
; then ret = 0ffffh;
LXI H,0FFFFH
; end;
; else
; do;
; /* procedure not resident */
; ret = 1;
; end;
; exit$region;
; end;
@30:
PUSH H
CALL EXITR
POP H
RET
; /* function = 152, Parse Filename */
; ret = parse$filename (parameter);
@31:
POP H ; DISCARD EXDOS RETURN
JMP PARSEFILENAME
; /* function = 153, Get Console Number */
; ret = rlrpd.console;
@32:
LXI B,0CH
XCHG
DAD B
MOV A,M
RET
; /* function = 154, System Data Address */
; ret = sysdat;
@33:
POP H ; DISCARD EXDOS RETURN
LHLD SYSDAT
RET
; /* function = 155, Get Time & Date */
; do;
@34:
; call move (5,.tod,parameter);
LXI D,TOD
MVI L,5H
LDAX D
STAX B
INX B
INX D
DCR L
JNZ $-5H
; end;
RET
; /* function = 156, Return Process Descriptor Address */
; do;
rtnpdadr:
; return rlr;
pop h ; discard EXDOS return
lhld rlr
; end;
ret
; /* function = 157, Abort Specified Process */
; do;
abort:
;
; BC -> Abort$parameter$control$block
; declare apcb structure (
; pdadr address,
; param address,
; pname (8) byte );
ldax b
inx b
mov e,a
ldax b
inx b
mov d,a
ora e ;test for PD address present
ldax b
inx b
mov l,a
ldax b
inx b
mov h,a ;DE = apcb.pdadr, HL = apcb.param
di
shld dparam
shld tparam
jnz @15 ;jump if already have pdadr
; pdadr = thread$root;
LHLD THRDRT
XCHG
; do while pdadr <> 0;
@9:
; i = 1;
PUSH B
LXI H,6
DAD D
PUSH H
MVI L,9 ;** this includes the pd.console byte !
; do while (i <> 9) and (pd.name(i-1) = pname(i));
@11:
XTHL
LDAX B
sub M
INX B
INX H
JZ @11A
ani 7fh
jz @11a ;also don't care on high order bit
POP H
POP B
JMP @6
@11A:
XTHL
DCR L
JNZ @11
; i = i + 1;
; end;
pop h
pop b
jmp @15
@6:
; pdadr = pd.thread;
LXI H,12H
DAD D
MOV E,M
INX H
MOV D,M
MOV A,D
ORA E
JNZ @9
; end;
exitabort:
; return 0FFFFH;
call exitr
mvi a,0ffh
RET
@15:
lxi h,6
dad d
mov a,m
cpi '@'
jz exitabort ;cannot abort @pdname
lhld rlr
mov a,e
cmp l
jnz @16
mov a,d
cmp h
jnz @16
;
; aborting the running process
inx h
inx h
mvi m,7 ;set pd.status to terminate
ret
@16:
lxi b,setupabort
push b ;setup return address
lxi h,2
dad d
mov c,m
mvi b,0
lxi h,abtbl
dad b
dad b
mov a,m
inx h
mov h,m
mov l,a
pchl
abtbl:
dw abtrun ; 0 = Ready to run
dw abtque ; 1 = DQ
dw abtque ; 2 = NQ
dw abtpol ; 3 = Poll
dw abtflg ; 4 = Flag Wait
dw abtdly ; 5 = Delay
dw abtswp ; 6 = Swap
dw abtrun ; 7 = Terminate
dw abtrun ; 8 = Set Priority
dw abtrun ; 9 = Dispatch
dw abtcns ;10 = Attach
dw abtrun ;11 = Detach
dw abtcns ;12 = Set Console
;
; 0 Ready to run
; 7 Terminate
; 8 Set Priority
; 9 Dispatch
;11 Detach
;
abtrun:
pop h ;discard return addr
jmp procrdy ;no action simply setup abort
;
; 1 DQ
; 2 NQ
;
abtque:
;find queue link & remove
lxi b,qlr
abtq0:
ldax b
mov l,a
inx b
ldax b
mov h,a
ora l
rz ;not DQing or NQing ?
push h
lxi b,14
dad b
mov b,h
mov c,l
push b
call delpr
pop b
pop h
rc ;return if DQing & removed
push h
inx b
inx b
call delpr
pop b
rc ;return if NQing & removed
jmp abtq0
;
; 3 Poll
;
abtpol:
;remove PD from poll list
lxi b,plr
jmp delpr
;ret
;
; 4 Flag Wait
;
abtflg:
;remove PD from flag
lda nmbflags
mov c,a
inr c
lxi h,sysfla-1
abtfl0:
inx h
dcr c
rz ;not waiting for a flag ?!
mov a,e
cmp m
inx h
jnz abtfl0
mov a,d
cmp m
jnz abtfl0
mvi m,0ffh
dcx h
mvi m,0ffh
ret
;
; 5 Delay
;
abtdly:
;remove PD from delay list
lxi b,dlr
jmp delpr
;ret
;
; 6 Swap
;
abtswp:
;remove PD from swap list
lxi b,slr
jmp delpr
;ret
;
;10 Attach
;12 Set Console
;
abtcns:
;remove PD from console queue
lda nmbcns
inr a
mov l,a
lxi b,cnsque
abct0:
dcr l
rz ;not queued for any console ?
push b
push h
call delpr
pop h
pop b
inx b
inx b
jnc abct0
ret
setupabort:
;put PD on dispatcher ready list
lhld drl
xchg
mov m,e
inx h
mov m,d
dcx h
shld drl
xchg
procrdy:
;compute process return address location in stack
;and fill in with address of abort code.
lxi h,abortcode
shld abtcdadr
lxi h,4
dad d ;HL = .pd.stkptr
lxi d,abtstack
mov m,e
inx h
mov m,d
call exitr
xra a
ret
abortcode:
di
mvi c,143
lxi d,$-$ ;Note: Potential critical parameter !
tparam equ $-2
jmp xdos
dseg
abtstack:
abtcdadr:
dw abortcode
cseg
; end;
; end; /* case */
@37:
DW ABSRQ
DW RELRQ
DW MEMFR
DW @7
DW FLGWT
DW FLGSET
DW MAKEQ
DW OPENQ
DW DELETQ
DW READQ
DW CREADQ
DW WRITEQ
DW CWRITEQ
DW @17
DW @18
DW @19
DW @20
DW @21
DW @22
DW @23
DW @24
DW ASSIGN
DW @26
DW @27
DW @31
DW @32
DW @33
DW @34
dw rtnpdadr
dw abort
maxfunc equ ($-@37)/2
; if function <> flag$set$function then
; do;
; if function <> flag$wait$function then
; do;
; call dispatch;
; end;
; end;
; return ret;
EXDOS:
MVI H,0
MOV L,A
RET
; end xdos;
delpr0:
mov b,h
mov c,l
; delete$process:
; procedure (nxtpdladr,pdadr) public;
delpr:
public delpr
; declare (nxtpdladr,pdadr) address;
; declare pdladr based nxtpdladr address;
ldax b
mov l,a
inx b
ldax b
dcx b
mov h,a
ora l
rz ;end of list with no match
mov a,l
cmp e
jnz delpr0
mov a,h
cmp d
jnz delpr0
mov a,m ;found match, update pointers
stax b
inx h
inx b
mov a,m
stax b
stc ;indicate success
ret
;end xdos;
END


View File

@@ -0,0 +1,21 @@
0000 XDOS#
0000 VER#
0000 DATAPG#
0000 MPM#
0000 RLSMX#
0000 XDOS#
0000 DSPTCH#
0000 QUEUE#
0000 FLAG#
0000 MEMMGR#
0000 TH#
0000 TMP#
0000 CLI#
0000 PARSE#
0000 TICK#
0000 CLOCK#
0000 ATTCH#
0000 PATCH#
0000 CLBDOS#


Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.