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,6 @@
pip lst:=b:apnote01.tex[p]
pip lst:=b:apnote02.tex[p]
pip lst:=b:apnote03.tex[p]
pip lst:=b:apnote04.tex[p]
pip lst:=b:apnote05.tex[p]


View File

@@ -0,0 +1,15 @@
.br
.ce 9
********************************************
* Note: *
* This program listing has been *
* included only as a sample and may not *
* reflect changes required by later MP/M *
* releases. For this reason the reader *
* should assemble and list the program *
* as provided on the distribution disk. *
********************************************
.li


View File

@@ -0,0 +1,250 @@
; CP/M 2.0 disk re-definition library
;
; Copyright (c) 1979
; Digital Research
; Box 579
; Pacific Grove, CA
; 93950
;
; CP/M logical disk drives are defined using the
; macros given below, where the sequence of calls
; is:
;
; disks n
; diskdef parameter-list-0
; diskdef parameter-list-1
; ...
; diskdef parameter-list-n
; endef
;
; where n is the number of logical disk drives attached
; to the CP/M system, and parameter-list-i defines the
; characteristics of the ith drive (i=0,1,...,n-1)
;
; each parameter-list-i takes the form
; dn,fsc,lsc,[skf],bls,dks,dir,cks,ofs,[0]
; where
; dn is the disk number 0,1,...,n-1
; fsc is the first sector number (usually 0 or 1)
; lsc is the last sector number on a track
; skf is optional "skew factor" for sector translate
; bls is the data block size (1024,2048,...,16384)
; dks is the disk size in bls increments (word)
; dir is the number of directory elements (word)
; cks is the number of dir elements to checksum
; ofs is the number of tracks to skip (word)
; [0] is an optional 0 which forces 16K/directory entry
;
; for convenience, the form
; dn,dm
; defines disk dn as having the same characteristics as
; a previously defined disk dm.
;
; a standard four drive CP/M system is defined by
; disks 4
; diskdef 0,1,26,6,1024,243,64,64,2
; dsk set 0
; rept 3
; dsk set dsk+1
; diskdef %dsk,0
; endm
; endef
;
; the value of "begdat" at the end of assembly defines the
; beginning of the uninitialize ram area above the bios,
; while the value of "enddat" defines the next location
; following the end of the data area. the size of this
; area is given by the value of "datsiz" at the end of the
; assembly. note that the allocation vector will be quite
; large if a large disk size is defined with a small block
; size.
;
dskhdr macro dn
;; define a single disk header list
dpe&dn: dw xlt&dn,0000h ;translate table
dw 0000h,0000h ;scratch area
dw dirbuf,dpb&dn ;dir buff,parm block
dw csv&dn,alv&dn ;check, alloc vectors
endm
;
disks macro nd
;; define nd disks
ndisks set nd ;;for later reference
dpbase equ $ ;base of disk parameter blocks
;; generate the nd elements
dsknxt set 0
rept nd
dskhdr %dsknxt
dsknxt set dsknxt+1
endm
endm
;
dpbhdr macro dn
dpb&dn equ $ ;disk parm block
endm
;
ddb macro data,comment
;; define a db statement
db data comment
endm
;
ddw macro data,comment
;; define a dw statement
dw data comment
endm
;
gcd macro m,n
;; greatest common divisor of m,n
;; produces value gcdn as result
;; (used in sector translate table generation)
gcdm set m ;;variable for m
gcdn set n ;;variable for n
gcdr set 0 ;;variable for r
rept 65535
gcdx set gcdm/gcdn
gcdr set gcdm - gcdx*gcdn
if gcdr = 0
exitm
endif
gcdm set gcdn
gcdn set gcdr
endm
endm
;
diskdef macro dn,fsc,lsc,skf,bls,dks,dir,cks,ofs,k16
;; generate the set statements for later tables
if nul lsc
;; current disk dn same as previous fsc
dpb&dn equ dpb&fsc ;equivalent parameters
als&dn equ als&fsc ;same allocation vector size
css&dn equ css&fsc ;same checksum vector size
xlt&dn equ xlt&fsc ;same translate table
else
secmax set lsc-fsc ;;sectors 0...secmax
sectors set secmax+1;;number of sectors
als&dn set dks/8 ;;size of allocation vector
if (dks mod 8) ne 0
als&dn set als&dn+1
endif
css&dn set cks/4 ;;number of checksum elements
;; generate the block shift value
blkval set bls/128 ;;number of sectors/block
blkshf set 0 ;;counts right 0's in blkval
blkmsk set 0 ;;fills with 1's from right
rept 16 ;;once for each bit position
if blkval=1
exitm
endif
;; otherwise, high order 1 not found yet
blkshf set blkshf+1
blkmsk set (blkmsk shl 1) or 1
blkval set blkval/2
endm
;; generate the extent mask byte
blkval set bls/1024 ;;number of kilobytes/block
extmsk set 0 ;;fill from right with 1's
rept 16
if blkval=1
exitm
endif
;; otherwise more to shift
extmsk set (extmsk shl 1) or 1
blkval set blkval/2
endm
;; may be double byte allocation
if dks > 256
extmsk set (extmsk shr 1)
endif
;; may be optional [0] in last position
if not nul k16
extmsk set k16
endif
;; now generate directory reservation bit vector
dirrem set dir ;;# remaining to process
dirbks set bls/32 ;;number of entries per block
dirblk set 0 ;;fill with 1's on each loop
rept 16
if dirrem=0
exitm
endif
;; not complete, iterate once again
;; shift right and add 1 high order bit
dirblk set (dirblk shr 1) or 8000h
if dirrem > dirbks
dirrem set dirrem-dirbks
else
dirrem set 0
endif
endm
dpbhdr dn ;;generate equ $
ddw %sectors,<;sec per track>
ddb %blkshf,<;block shift>
ddb %blkmsk,<;block mask>
ddb %extmsk,<;extnt mask>
ddw %dks-1,<;disk size-1>
ddw %dir-1,<;directory max>
ddb %dirblk shr 8,<;alloc0>
ddb %dirblk and 0ffh,<;alloc1>
ddw %cks/4,<;check size>
ddw %ofs,<;offset>
;; generate the translate table, if requested
if nul skf
xlt&dn equ 0 ;no xlate table
else
if skf = 0
xlt&dn equ 0 ;no xlate table
else
;; generate the translate table
nxtsec set 0 ;;next sector to fill
nxtbas set 0 ;;moves by one on overflow
gcd %sectors,skf
;; gcdn = gcd(sectors,skew)
neltst set sectors/gcdn
;; neltst is number of elements to generate
;; before we overlap previous elements
nelts set neltst ;;counter
xlt&dn equ $ ;translate table
rept sectors ;;once for each sector
if sectors < 256
ddb %nxtsec+fsc
else
ddw %nxtsec+fsc
endif
nxtsec set nxtsec+skf
if nxtsec >= sectors
nxtsec set nxtsec-sectors
endif
nelts set nelts-1
if nelts = 0
nxtbas set nxtbas+1
nxtsec set nxtbas
nelts set neltst
endif
endm
endif ;;end of nul fac test
endif ;;end of nul bls test
endm
;
defds macro lab,space
lab: ds space
endm
;
lds macro lb,dn,val
defds lb&dn,%val&dn
endm
;
endef macro
;; generate the necessary ram data areas
begdat equ $
dirbuf: ds 128 ;directory access buffer
dsknxt set 0
rept ndisks ;;once for each disk
lds alv,%dsknxt,als
lds csv,%dsknxt,css
dsknxt set dsknxt+1
endm
enddat equ $
datsiz equ $-begdat
endm
;


View File

@@ -0,0 +1,229 @@
page 0
org 0000H
base equ $
org 0100H
;
; Note: either BASE0100.ASM or BASE0200.ASM must be appended
; to the beginning of this file before assembling.
;
; title 'File Dump Program'
; File dump program, reads an input file and
; prints in hex
;
; Copyright (C) 1975, 1976, 1977, 1978, 1979, 1980
; Digital Research
; Box 579, Pacific Grove
; California, 93950
;
bdos equ base+5 ;dos entry point
cons equ 1 ;read console
typef equ 2 ;type function
printf equ 9 ;buffer print entry
brkf equ 11 ;break key function
openf equ 15 ;file open
readf equ 20 ;read function
;
fcb equ base+5ch;file control block address
buff equ base+80h;input disk buffer address
;
; non graphic characters
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
;
; file control block definitions
fcbdn equ fcb+0 ;disk name
fcbfn equ fcb+1 ;file name
fcbft equ fcb+9 ;disk file type (3 characters)
fcbrl equ fcb+12 ;file's current reel number
fcbrc equ fcb+15 ;file's record count (0 to 128)
fcbcr equ fcb+32 ;current (next) record number
fcbln equ fcb+33 ;fcb length
;
; set up stack
lxi h,0
dad sp
; entry stack pointer in hl from the ccp
shld oldsp
; set sp to local stack area (restored at finis)
lxi sp,stktop
; read and print successive buffers
call setup ;set up input file
cpi 255 ;255 if file not present
jnz openok ;skip if open is ok
;
; file not there, give error message and return
lxi d,opnmsg
call err
jmp finis ;to return
;
openok: ;open operation ok, set buffer index to end
mvi a,80h
sta ibp ;set buffer pointer to 80h
; hl contains next address to print
lxi h,0 ;start with 0000
;
gloop:
push h ;save line position
call gnb
pop h ;recall line position
jc finis ;carry set by gnb if end file
mov b,a
; print hex values
; check for line fold
mov a,l
ani 0fh ;check low 4 bits
jnz nonum
; print line number
call crlf
;
; check for break key
call break
; accum lsb = 1 if character ready
rrc ;into carry
jc purge ;don't print any more
;
mov a,h
call phex
mov a,l
call phex
nonum:
inx h ;to next line number
mvi a,' '
call pchar
mov a,b
call phex
jmp gloop
;
purge:
mvi c,cons
call bdos
finis:
; end of dump, return to ccp
; (note that a jmp to 0000h reboots)
call crlf
lhld oldsp
sphl
; stack pointer contains ccp's stack location
ret ;to the ccp
;
;
; subroutines
;
break: ;check break key (actually any key will do)
push h! push d! push b; environment saved
mvi c,brkf
call bdos
pop b! pop d! pop h; environment restored
ret
;
pchar: ;print a character
push h! push d! push b; saved
mvi c,typef
mov e,a
call bdos
pop b! pop d! pop h; restored
ret
;
crlf:
mvi a,cr
call pchar
mvi a,lf
call pchar
ret
;
;
pnib: ;print nibble in reg a
ani 0fh ;low 4 bits
cpi 10
jnc p10
; less than or equal to 9
adi '0'
jmp prn
;
; greater or equal to 10
p10: adi 'A' - 10
prn: call pchar
ret
;
phex: ;print hex char in reg a
push psw
rrc
rrc
rrc
rrc
call pnib ;print nibble
pop psw
call pnib
ret
;
err: ;print error message
; d,e addresses message ending with "$"
mvi c,printf ;print buffer function
call bdos
ret
;
;
gnb: ;get next byte
lda ibp
cpi 80h
jnz g0
; read another buffer
;
;
call diskr
ora a ;zero value if read ok
jz g0 ;for another byte
; end of data, return with carry set for eof
stc
ret
;
g0: ;read the byte at buff+reg a
mov e,a ;ls byte of buffer index
mvi d,0 ;double precision index to de
inr a ;index=index+1
sta ibp ;back to memory
; pointer is incremented
; save the current file address
lxi h,buff
dad d
; absolute character address is in hl
mov a,m
; byte is in the accumulator
ora a ;reset carry bit
ret
;
setup: ;set up file
; open the file for input
xra a ;zero to accum
sta fcbcr ;clear current record
;
lxi d,fcb
mvi c,openf
call bdos
; 255 in accum if open error
ret
;
diskr: ;read disk file record
push h! push d! push b
lxi d,fcb
mvi c,readf
call bdos
pop b! pop d! pop h
ret
;
; fixed message area
signon:
db 'File Dump MP/M Version 1.0$'
opnmsg:
db cr,lf,'No input file present on disk$'
; variable area
ibp: ds 2 ;input buffer pointer
oldsp: ds 2 ;entry sp value from ccp
;
; stack area
ds 64 ;reserve 32 level stack
stktop:
;
end


View File

@@ -0,0 +1,7 @@
.MB +5
.MT -3
.LL 65
.PN
.HE MP/M User's Guide
.FT (All Information Herein is Proprietary to Digital Research.)


View File

@@ -0,0 +1,184 @@
Abort (^c), 5
ABORT, 5, 16
Abort Specified Process, 80
Absolute Memory Request, 62
Access Drive, 51
ASM, Assembler, 10
Assign Console, 74
ATTACH, 5
Attach Console, 72
Bank Switched Memory, 102, 112
BDOS, 29-52, 108, 118
BIOS, 96-101
BNKBDOS, 19, 109
Boot, 97
Call Resident System Procedure, 76
Calling Conventions, 21
Circular Queue, 54
CLI, Command Line Interpreter, 20
Close File, 38
Conditional Read Queue, 68
Conditional Write Queue, 69
Conin, 98
Conout, 98
CONSOLE, 8
Console I/O Direct, 32
Console Input, 29, 30
Console Number, 78
Console Output, 30, 31
Console Status, 35
CONSOLE.DAT, 19
Const, 98
Control Characters, 6
Create Process, 71
Date and Time, 15
DDT, Dynamic Debugging Tool, 12, 148
Delay, 70
Delete File, 40
Delete Queue, 67
Detach (^d), 5
Detach Console, 73
DIR, File Directory, 10
Direct Console I/O, 32
Diskette Organization, 94
Dispatch, 70
DMA Address, 43
DSKRESET, 8
DUMP, 11, 122
ERA, ERAQ, Erase File(s), 9
Exitregion, 103
FCB, File Control Block, 25, 26
File Attributes, 45
File Structure, 24
Flag Assignments, 116
Flag Wait, 65
Flag Set, 65
Free Drive, 52
GENHEX, 11
GENMOD, 11
GENSYS, 110
Get Console Number, 78
Get Date and Time, 79
Home, 98
Idle, 104
Interrupt Service Routines, 105
LDRBIOS, 86
Line editing, 6
Linked Queue, 55
List, 98
List Output, 31
Listst, 100
LOAD, 11
Login Vector, 42
Make File, 41
Make Queue, 66
Maxconsole, 103
Memory Allocation, 15
MD, Memory Descriptor, 62
Memory Free, 64
Memory Segment Base Page, 120
Memory Structure, 18
MPMLDR, 86, 114
MPMSTAT, 13
ODOS, 108
Open File, 37
Open Queue, 67
Page Relocatable Programs, PRL, 81, 149
Parse Filename, 77
PIP, Peripheral Interchange Program, 10
Poll, 64
Polldevice, 102
Print String, 33
PD, Process Descriptor, 59
Process Desciptor Address, 79
Process Naming Conventions, 61
Process Priority, 72, 117
PRLCOM, 11
Queue, 53
Queue Naming, 58
Raw Console Input, 30
Raw Console Output, 31
RDT, Relocatable DDT, 12
Read, 100
Read Console Buffer, 34
Read File Random, 47
Read File Sequential, 40
Read Queue, 68
Read/Only Vector, 45
Relocatable Memory Request, 63
REN, Rename File, 10, 42
Reset Disk System, 8, 36
Reset Drive, 51
Resident System Procedure, 76, 83
Return Process Descriptor Address, 79
RSP, Resident System Process, 19, 83, 108
SCHED, Scheduler, 16
Search for First, Next, 38, 39
Sectran, 101
Selmemory, 102
Send CLI Command, 75
Seldsk, 99
Select Disk, 36
Set Console, 73
Set DMA Address, 43
Set Priority, 72
Set Random Record, 50
Setdma, 100
Setsec, 99
Settrk, 99
SPOOLer, 15
Startclock, 102
STAT, Status, 11
Stopclock, 103
STOPSPLR, 15
SUBMIT, 10
System Data, 107
System Data Address, 78
System File Components, 107
System Generation, 110
System Reset, 29
SYSTEM.DAT, 19
Systeminit, 103
Text Editing, ED, 10
Terminate Process, 71
Tick, 106
Time, 15
Time Base Management, 106
TOD, Date and Time, 15, 79
TPA, 20
TYPE, 9
USER, get/set user code, 8, 46
User Queue Control Block, 57
USERSYS.STK, 19
Version Number, 35
Wboot, 98
Write, 100
Write File Random, 48, 52
Write File Sequential, 41
Write Protect Disk, 44
Write Queue, 69
XDOS, 19, 108, 119
XIOS, 19, 87
XIOS External Jump Vector, 106


View File

@@ -0,0 +1,16 @@
;single b:
stat b:=r/o
pip lst:=b:mpmug0.prn[t8]
pip lst:=b:mpmug1.prn[t8]
pip lst:=b:mpmug20.prn[t8]
pip lst:=b:mpmug21.prn[t8]
pip lst:=b:mpmug22.prn[t8]
pip lst:=b:mpmug23.prn[t8]
pip lst:=b:mpmug24.prn[t8]
;
;type a ctl-c
;remove disk from drive b:
;place the second User's Guide list diskette in drive b:
;the enter: sub list+
;


View File

@@ -0,0 +1,13 @@
;single b:
stat b:=r/o
pip lst:=b:mpmug30.prn[t8]
pip lst:=b:mpmug31.prn[t8]
pip lst:=b:mpmug32.prn[t8]
pip lst:=b:mpmug33.prn[t8]
pip lst:=b:mpmuga-f.prn[t8]
pip lst:=b:mpmugg.prn[t8]
pip lst:=b:mpmugh.prn[t8]
pip lst:=b:mpmugi.prn[t8]
pip lst:=b:mpmugj-k.prn[t8]
pip lst:=b:mpmugidx.prn[t8]


Binary file not shown.

View File

@@ -0,0 +1,25 @@
mac b:dump $$szhz
pip b:mpmugg.tex=b:mpmugghd.tex,b:disclaim.lib,b:dump.prn[t8d70l],b:break.tex
era b:dump.prn
tex b:mpmugg b:
era b:mpmugg.tex
pip lst:=b:mpmugg.prn[t8]
era b:mpmugg.prn
mac b:type $$szhz
pip b:mpmugh.tex=b:mpmughhd.tex,b:disclaim.lib,b:type.prn[t8d70l],b:break.tex
era b:type.prn
tex b:mpmugh b:
era b:mpmugh.tex
pip lst:=b:mpmugh.prn[t8]
era b:mpmugh.prn
mac b:xios $$szhz
pip b:mpmugi.tex=b:mpmugihd.tex,b:disclaim.lib,b:xios.prn[t8d70l],b:break.tex
era b:xios.prn
tex b:mpmugi b:
era b:mpmugi.tex
pip lst:=b:mpmugi.prn[t8]
era b:mpmugi.prn
tex b:mpmugj-k b:
pip lst:=b:mpmugj-k.prn[t8]
era b:*.prn


View File

@@ -0,0 +1,5 @@
era b:x.*
pip b:x.tex=b:mpmfs.tex,b:bios.prn,b:break.tex
b:tex b:x b:
pip lst:=b:x.prn


View File

@@ -0,0 +1,26 @@
b:tex b:mpmfs0 b:
pip lst:=b:mpmfs0.prn[d79]
b:tex b:mpmfs1 b:
pip lst:=b:mpmfs1.prn[d79]
mac b:bios $$+s+m
pip b:mpmfs2.tex=b:mpmfs2hd.tex,b:bios.prn,b:break.tex
era b:bios.prn
era b:bios.hex
b:tex b:mpmfs2 b:
pip lst:=b:mpmfs2.prn[d79]
era b:mpmfs2.*
mac b:dump $$+s
pip b:mpmfs3.tex=b:mpmfs3hd.tex,b:dump.prn,b:break.tex
era b:dump.hex
era b:dump.prn
b:tex b:mpmfs3 b:
pip lst:=b:mpmfs3.prn[d79]
era b:mpmfs3.*
mac b:type $$+s
pip b:mpmfs4.tex=b:mpmfs4hd.tex,b:type.prn,b:break.tex
era b:type.hex
era b:type.prn
b:tex b:mpmfs4 b:
pip lst:=b:mpmfs4.prn[d79]
era b:mpmfs4.*


View File

@@ -0,0 +1,5 @@
pip b:mpmfs$1.tex=b:mpmfs$1hd.tex,b:$2.prn,b:break.tex
b:tex b:mpmfs$1 b:
pip lst:=b:mpmfs$1.prn
era b:mpmfs$1.*


View File

@@ -0,0 +1,29 @@
single b:
tex a:mpmug0 b:
;pip lst:=b:mpmug0.prn
;era b:*.prn
tex a:mpmug1 b:
;pip lst:=b:mpmug1.prn
;era b:*.prn
tex a:mpmug20 b:
;pip lst:=b:mpmug20.prn
;era b:*.prn
tex a:mpmug21 b:
;pip lst:=b:mpmug21.prn
;era b:*.prn
tex a:mpmug22 b:
;pip lst:=b:mpmug22.prn
;era b:*.prn
tex a:mpmug23 b:
;pip lst:=b:mpmug23.prn
;era b:*.prn
tex a:mpmug24 b:
;pip lst:=b:mpmug24.prn
;era b:*.prn
;
;type ^C
;then remove disk from drive b:
;place a blank single density disk in drive b:
;then enter: sub mpmug+
;


View File

@@ -0,0 +1,28 @@
;mac a:dump $$szhz
;pip a:mpmugg.tex=a:mpmugghd.tex,a:disclaim.lib,a:dump.prn[t8d70l],a:break.tex
;era a:dump.prn
;tex a:mpmugg b:
;era a:mpmugg.tex
;;pip lst:=b:mpmugg.prn
;;era b:*.prn
;mac a:type $$szhz
;pip a:mpmugh.tex=a:mpmughhd.tex,a:disclaim.lib,a:type.prn[t8d70l],a:break.tex
;era a:type.prn
;tex a:mpmugh b:
;era a:mpmugh.tex
;;pip lst:=b:mpmugh.prn
;;era b:*.prn
mac a:xios $$szhz
pip a:mpmugi.tex=a:mpmugihd.tex,a:disclaim.lib,a:xios.prn[t8d70l],a:break.tex
era a:xios.prn
tex a:mpmugi b:
era a:mpmugi.tex
;pip lst:=b:mpmugi.prn
;era b:*.prn
tex a:mpmugj-k b:
;pip lst:=b:mpmugj-k.prn[t8]
;era b:*.prn
tex a:mpmugidx b:
;pip lst:=b:mpmugidx.prn[t8]
;era b:*.prn


View File

@@ -0,0 +1,18 @@
single b:
tex a:mpmug30 b:
;pip lst:=b:mpmug30.prn
;era a:*.prn
tex a:mpmug31 b:
;pip lst:=b:mpmug31.prn
;era a:*.prn
tex a:mpmug32 b:
;pip lst:=b:mpmug32.prn
;era a:*.prn
tex a:mpmug33 b:
;pip lst:=b:mpmug33.prn
;era a:*.prn
tex a:mpmuga-f b:
;pip lst:=b:mpmuga-f.prn
;era a:*.prn
sub a:mpmugasm.sub


Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,20 @@
A brief description of the CLI operation should illustrate this point.
When CLI receives a command line it parses the first entry on the
command line and then tries to open a queue using the parsed name.
If the open queue succeeds the command tail is written to the queue
and the CLI operation is finished. If the open queue fails a file type
of PRL is entered for the parsed file name and a file open is
attempted. If the file open succeeds then the header of the PRL
file is read to determine the memory requirements.
A relocatable memory request is made to obtain a memory segment in
which to load and run the program. If this request is satisfied
the PRL file is read into the memory segment, relocated, and it is
executed, completing the CLI operation.
.PP
If the PRL file type open fails then the file type of COM is entered
for the parsed file name and a file open is attempted. If the open
succeeds then a memory request is made for the absolute TPA, memory
segment based at 0000H. If this request is satisfied the COM file is
read into the absolute TPA and it is executed, completing the CLI
operation.


View File

@@ -0,0 +1,19 @@
mac b:bios $$+s+m
pip b:mpmfs2.tex=b:mpmfs2hd.tex,b:bios.prn,b:break.tex
era b:bios.prn
era b:bios.hex
b:tex b:mpmfs2 b:
era b:b:mpmfs2.tex
mac b:dump $$+s
pip b:mpmfs3.tex=b:mpmfs3hd.tex,b:dump.prn,b:break.tex
era b:dump.hex
era b:dump.prn
b:tex b:mpmfs3 b:
era b:mpmfs3.tex
mac b:type $$+s
pip b:mpmfs4.tex=b:mpmfs4hd.tex,b:type.prn,b:break.tex
era b:type.hex
era b:type.prn
b:tex b:mpmfs4 b:
era b:mpmfs4.tex


Binary file not shown.

View File

@@ -0,0 +1,181 @@
page 0
title 'Type File on Console'
; File TYPE program, reads an input file and prints
; it on the console
;
; Copyright (C) 1979, 1980
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
ORG 0000H ; standard rsp start
CTLZ EQU 1AH ; control-Z used for EOF
CONOUT EQU 2 ; bdos conout function #
PRINTF EQU 9 ; "" print buffer
READF EQU 20 ; read next record
OPENF EQU 15 ; open fcb
PARSEFN EQU 152 ; parse file name
MKQUE EQU 134 ; make queue
RDQUE EQU 137 ; read queue
STPRIOR EQU 145 ; set priority
DETACH EQU 147 ; detach console
;
; BDOS entry point address
bdosadr:
dw $-$ ; ldr will fill this in
;
; Type process descriptor
;
typepd:
dw 0 ; link
db 0 ; status
db 10 ; priority (initial)
dw stack+38 ; stack pointer
db 'TYPE ' ; name in upper case
pdconsole:
ds 1 ; console
db 0ffh ; memseg
ds 2 ; b
ds 2 ; thread
dw buff ; disk set DMA address
ds 1 ; user code & disk select
ds 2 ; dcnt
ds 1 ; searchl
ds 2 ; searcha
ds 2 ; active drives
ds 20 ; register save area
ds 2 ; scratch
;
; Type linked queue control block
;
typelqcb:
dw 0 ; link
db 'TYPE ' ; name in upper case
dw 72 ; msglen
dw 1 ; nmbmsgs
ds 2 ; dqph
ds 2 ; nqph
ds 2 ; mh
ds 2 ; mt
ds 2 ; bh
ds 74 ; buf (72 + 2 byte link)
;
; Type user queue control block
;
typeuserqcb:
dw typelqcb ; pointer
dw field ; msgadr
;
; Field for message read from Type linked qcb
;
field:
ds 1 ; disk select
console:
ds 1 ; console
filename:
ds 72 ; message body
;
; Parse file name control block
;
pcb:
dw filename ; file name address
dw fcb ; file control block address
;
; Type Stack & other local data structures
;
stack:
ds 38 ; 20 level stack
dw type ; process entry point
fcb: ds 36 ; file control block
buff: ds 128 ; file buffer
;
; BDOS call procedure
;
bdos:
lhld bdosadr ; HL = BDOS address
pchl
;
; Type main program
;
type:
mvi c,mkque
lxi d,typelqcb
call bdos ; make typelqcb
mvi c,stprior
lxi d,200
call bdos ; set priority to 200
forever:
mvi c,rdque
lxi d,typeuserqcb
call bdos ; read from type queue
mvi c,parsefn
lxi d,pcb
call bdos ; parse the file name
inx h
mov a,h
ora l ; test for 0FFFFH
jz error
lda console
sta pdconsole ; typepd.console = console
MVI C,OPENF
LXI D,FCB
CALL BDOS ; open file
INR A ; test return code
JZ ERROR ; if it was 0ffh, no file
XRA A ; else,
STA FCB+32 ; set next record to zero
NEW$SECTOR:
MVI C,READF
LXI D,FCB
CALL BDOS ; read next record
ORA A
JNZ DONE ; exit if eof or error
LXI H,BUFF ; point to data sector
MVI C,128 ; get byte count
NEXT$BYTE:
MOV A,M ; get the byte
MOV E,A ; save in E
CPI CTLZ
JZ DONE ; exit if eof
PUSH B ; save byte counter
PUSH H ; save address register
MVI C,CONOUT
CALL BDOS ; write console
POP H ; restore pointer
POP B ; and counter
INX H ; bump pointer
DCR C ; dcr byte counter
JNZ NEXT$BYTE ; more in this sector
JMP NEW$SECTOR ; else, we need a new one
ERROR:
LXI D,ERR$MSG ; point to error message
MVI C,PRINTF ; get function code to print
CALL BDOS
done:
mvi c,detach
call bdos ; detach the console
jmp forever
ERR$MSG:
DB 0DH,0AH,'File Not Found or Bad File Name$'
END


View File

@@ -0,0 +1,880 @@
page 0
ORG 0000H
;
; Note: this module assumes that an ORG statement will be
; provided by concatenating either BASE0000.ASM or BASE0100.ASM
; to the front of this file before assembling.
;
; title 'Xios for the MDS-800'
; (four drive single density version)
; -or-
; (four drive mixed double/single density)
; Version 1.1 January, 1980
; Copyright (C) 1979, 1980
; Digital Research
; Box 579, Pacific Grove
; California, 93950
false equ 0
true equ not false
asm equ true
mac equ not asm
sgl equ true
dbl equ not sgl
if mac
maclib diskdef
endif
numdisks equ 4 ;number of drives available
; external jump table (below xios base)
pdisp equ $-3
xdos equ pdisp-3
; mds interrupt controller equates
revrt equ 0fdh ; revert port
intc equ 0fch ; mask port
icon equ 0f3h ; control port
rtc equ 0ffh ; real time clock
inte equ 1111$1101b ; enable rst 1
; mds disk controller equates
dskbase equ 78h ; base of disk io prts
dstat equ dskbase ; disk status
rtype equ dskbase+1 ; result type
rbyte equ dskbase+3 ; result byte
ilow equ dskbase+1 ; iopb low address
ihigh equ dskbase+2 ; iopb high address
readf equ 4h ; read function
writf equ 6h ; write function
iordy equ 4h ; i/o finished mask
retry equ 10 ; max retries on disk i/o
; basic i/o system jump vector
jmp coldstart ;cold start
wboot:
jmp warmstart ;warm start
jmp const ;console status
jmp conin ;console character in
jmp conout ;console character out
jmp list ;list character out
jmp rtnempty ;punch not implemented
jmp rtnempty ;reader not implemented
jmp home ;move head to home
jmp seldsk ;select disk
jmp settrk ;set track number
jmp setsec ;set sector number
jmp setdma ;set dma address
jmp read ;read disk
jmp write ;write disk
jmp pollpt ;list status
jmp sect$tran ;sector translate
; extended i/o system jump vector
jmp selmemory ; select memory
jmp polldevice ; poll device
jmp startclock ; start clock
jmp stopclock ; stop clock
jmp exitregion ; exit region
jmp maxconsole ; maximum console number
jmp systeminit ; system initialization
jmp idle ; idle procedure
coldstart:
warmstart:
mvi c,0 ; see system init
; cold & warm start included only
; for compatibility with cp/m
jmp xdos ; system reset, terminate process
; MP/M 1.0 console handlers
nmbcns equ 2 ; number of consoles
poll equ 131 ; xdos poll function
pllpt equ 0 ; poll printer
pldsk equ 1 ; poll disk
plco0 equ 2 ; poll console out #0 (CRT:)
plco1 equ 3 ; poll console out #1 (TTY:)
plci0 equ 4 ; poll console in #0 (CRT:)
plci1 equ 5 ; poll console in #1 (TTY:)
;
const: ; console status
call ptbljmp ; compute and jump to hndlr
dw pt0st ; console #0 status routine
dw pt1st ; console #1 (TTY:) status rt
conin: ; console input
call ptbljmp ; compute and jump to hndlr
dw pt0in ; console #0 input
dw pt1in ; console #1 (TTY:) input
conout: ; console output
call ptbljmp ; compute and jump to hndlr
dw pt0out ; console #0 output
dw pt1out ; console #1 (TTY:) output
;
ptbljmp: ; compute and jump to handler
; d = console #
; do not destroy <d>
mov a,d
cpi nmbcns
jc tbljmp
pop psw ; throw away table address
rtnempty:
xra a
ret
tbljmp: ; compute and jump to handler
; a = table index
add a ; double table index for adr offst
pop h ; return adr points to jump tbl
mov e,a
mvi d,0
dad d ; add table index * 2 to tbl base
mov e,m ; get handler address
inx h
mov d,m
xchg
pchl ; jump to computed cns handler
; ascii character equates
rubout equ 7fh
space equ 20h
; serial i/o port address equates
data0 equ 0f6h
sts0 equ data0+1
data1 equ 0f4h
sts1 equ data1+1
lptport equ 0fah
lptsts equ lptport+1
; poll console #0 input
polci0:
pt0st: ; return 0ffh if ready,
; 000h if not
in sts0
ani 2
rz
mvi a,0ffh
ret
;
; console #0 input
;
pt0in: ; return character in reg a
mvi c,poll
mvi e,plci0
call xdos ; poll console #0 input
in data0 ; read character
ani 7fh ; strip parity bit
ret
;
; console #0 output
;
pt0out: ; reg c = character to output
in sts0
ani 01h
jnz co0rdy
push b
call pt0wait ; poll console #0 output
pop b
co0rdy:
mov a,c
out data0 ; transmit character
ret
;
; wait for console #0 output ready
;
pt0wait:
mvi c,poll
mvi e,plco0
jmp xdos ; poll console #0 output
; ret
;
; poll console #0 output
;
polco0:
; return 0ffh if ready,
; 000h if not
in sts0
ani 01h
rz
mvi a,0ffh
ret
;
;
; line printer driver:
;
list: ; list output
in lptsts
ani 01h
jnz lptrdy
push b
mvi c, poll
mvi e, pllpt
call xdos
pop b
lptrdy:
mov a,c
cma
out lptport
ret
;
; poll printer output
;
pollpt:
; return 0ffh if ready,
; 000h if not
in lptsts
ani 01h
rz
mvi a,0ffh
ret
;
; poll console #1 (TTY:) input
;
polci1:
pt1st:
; return 0ffh if ready,
; 000h if not
in sts1
ani 2
rz
mvi a,0ffh
ret
;
; console #1 (TTY:) input
;
pt1in:
; return character in reg a
mvi c,poll
mvi e,plci1
call xdos ; poll console #1 input
in data1 ; read character
ani 7fh ; strip parity bit
ret
;
; console #1 (TTY:) output
;
pt1out:
in sts1
ani 01h
jnz co1rdy
; reg c = character to output
push b
call pt1wait
pop b
co1rdy:
mov a,c
out data1 ; transmit character
ret
; wait for console #1 (TTY:) output ready
pt1wait:
mvi c,poll
mvi e,plco1
jmp xdos ; poll console #1 output
; ret
; poll console #1 (TTY:) output
polco1:
; return 0ffh if ready,
; 000h if not
in sts1
ani 01h
rz
mvi a,0ffh
ret
;
;
; MP/M 1.0 extended i/o system
;
;
nmbdev equ 6 ; number of devices in poll tbl
polldevice:
; reg c = device # to be polled
; return 0ffh if ready,
; 000h if not
mov a,c
cpi nmbdev
jc devok
mvi a,nmbdev; if dev # >= nmbdev,
; set to nmbdev
devok:
call tbljmp ; jump to dev poll code
dw pollpt ; poll printer output
dw poldsk ; poll disk ready
dw polco0 ; poll console #0 output
dw polco1 ; poll console #1 (TTY:) output
dw polci0 ; poll console #0 input
dw polci1 ; poll console #1 (TTY:) input
dw rtnempty; bad device handler
; select / protect memory
selmemory:
; reg bc = adr of mem descriptor
; bc -> base 1 byte,
; size 1 byte,
; attrib 1 byte,
; bank 1 byte.
; this hardware does not have memory protection or
; bank switching
ret
; start clock
startclock:
; will cause flag #1 to be set
; at each system time unit tick
mvi a,0ffh
sta tickn
ret
; stop clock
stopclock:
; will stop flag #1 setting at
; system time unit tick
xra a
sta tickn
ret
; exit region
exitregion:
; ei if not preempted
lda preemp
ora a
rnz
ei
ret
; maximum console number
maxconsole:
mvi a,nmbcns
ret
; system initialization
systeminit:
; note: this system init assumes that the usarts
; have been initialized by the coldstart boot
; setup restart jump vectors
mvi a,0c3h
sta 1*8
lxi h,int1hnd
shld 1*8+1 ; jmp int1hnd at restart 1
; setup interrupt controller & real time clock
mvi a,inte
out intc ; enable int 0,1,7
xra a
out icon ; clear int mask
out rtc ; enable real time clock
ret
;
; Idle procedure
;
idle:
mvi c,dsptch
jmp xdos ; perform a dispatch, this form
; of idle must be used in systems
; without interrupts, i.e. all polled
; -or-
; ei ; simply halt until awaken by an
; hlt ; interrupt
; ret
; MP/M 1.0 interrupt handlers
flagset equ 133
dsptch equ 142
int1hnd:
; interrupt 1 handler entry point
;
; location 0008h contains a jmp
; to int1hnd.
push psw
mvi a,2h
out rtc ; reset real time clock
out revrt ; revert intr cntlr
lda slice
dcr a ; only service every 16th slice
sta slice
jz t16ms ; jump if 16ms elapsed
pop psw
ei
ret
t16ms:
mvi a,16
sta slice ; reset slice counter
pop psw
shld svdhl
pop h
shld svdret
push psw
lxi h,0
dad sp
shld svdsp ; save users stk ptr
lxi sp,intstk+48 ; lcl stk for intr hndl
push d
push b
mvi a,0ffh
sta preemp ; set preempted flag
lda tickn
ora a ; test tickn, indicates
; delayed process(es)
jz notickn
mvi c,flagset
mvi e,1
call xdos ; set flag #1 each tick
notickn:
lxi h,cnt64
dcr m ; dec 64 tick cntr
jnz not1sec
mvi m,64
mvi c,flagset
mvi e,2
call xdos ; set flag #2 @ 1 sec
not1sec:
xra a
sta preemp ; clear preempted flag
pop b
pop d
lhld svdsp
sphl ; restore stk ptr
pop psw
lhld svdret
push h
lhld svdhl
; the following dispatch call will force round robin
; scheduling of processes executing at the same priority
; each 1/64th of a second.
; note: interrupts are not enabled until the dispatcher
; resumes the next process. this prevents interrupt
; over-run of the stacks when stuck or high frequency
; interrupts are encountered.
jmp pdisp ; MP/M dispatch
;
; bios data segment
;
slice: db 16 ; 16 slices = 16ms = 1 tick
cnt64: db 64 ; 64 tick cntr = 1 sec
intstk: ds 48 ; local intrpt stk
svdhl: dw 0 ; saved regs hl during int hndl
svdsp: dw 0 ; saved sp during int hndl
svdret: dw 0 ; saved return during int hndl
tickn: db 0 ; ticking boolean,true = delayed
preemp: db 0 ; preempted boolean
;
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Intel MDS-800 diskette interface routines *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
seldsk: ;select disk given by register c
lxi h, 0
mov a,c
cpi numdisks
rnc ; first, insure good select
ani 2
sta dbank ; then save it
lxi h,sel$table
mvi b,0
dad b
mov a,m
sta iof
mov h,b
mov l,c
dad h
dad h
dad h
dad h ; times 16
lxi d,dpbase
dad d
ret
home: ;move to home position
; treat as track 00 seek
mvi c,0
;
settrk: ;set track address given by c
lxi h,iot
mov m,c
ret
;
setsec: ;set sector number given by c
mov a,c ;sector number to accum
sta ios ;store sector number to iopb
ret
;
setdma: ;set dma address given by regs b,c
mov l,c
mov h,b
shld iod
ret
sect$tran: ; translate the sector # in <c> if needed
mov h,b
mov l,c
inx h ; in case of no translation
mov a, d
ora e
rz
xchg
dad b ; point to physical sector
mov l,m
mvi h,0
ret
read: ;read next disk record (assuming disk/trk/sec/dma set)
mvi c,readf ;set to read function
jmp setfunc
;
write: ;disk write function
mvi c,writf
;
setfunc:
; set function for next i/o (command in reg-c)
lxi h,iof ;io function address
mov a,m ;get it to accumulator for masking
ani 1111$1000b ;remove previous command
ora c ;set to new command
mov m,a ;replaced in iopb
; single density drive 1 requires bit 5 on in sector #
; mask the bit from the current i/o function
ani 0010$0000b ;mask the disk select bit
lxi h,ios ;address the sector select byte
ora m ;select proper disk bank
mov m,a ;set disk select bit on/off
;
waitio:
mvi c,retry ;max retries before perm error
rewait:
; start the i/o function and wait for completion
call intype ;in rtype
call inbyte ;clears the controller
lda dbank ;set bank flags
ora a ;zero if drive 0,1 and nz if 2,3
mvi a,iopb and 0ffh ;low address for iopb
mvi b,iopb shr 8 ;high address for iopb
jnz iodr1 ;drive bank 1?
out ilow ;low address to controller
mov a,b
out ihigh ;high address
jmp wait0 ;to wait for complete
iodr1: ;drive bank 1
out ilow+10h ;88 for drive bank 10
mov a,b
out ihigh+10h
wait0:
push b ; save retry count
mvi c, poll ; function poll
mvi e, pldsk ; device is disk
call xdos
pop b ; restore retry counter in <c>
; check io completion ok
call intype ;must be io complete (00) unlinked
; 00 unlinked i/o complete, 01 linked i/o complete (not used)
; 10 disk status changed 11 (not used)
cpi 10b ;ready status change?
jz wready
; must be 00 in the accumulator
ora a
jnz werror ;some other condition, retry
; check i/o error bits
call inbyte
ral
jc wready ;unit not ready
rar
ani 11111110b ;any other errors? (deleted data ok)
jnz werror
; read or write is ok, accumulator contains zero
ret
poldsk:
call instat ; get current controller status
ani iordy ; operation complete ?
rz ; not done
mvi a,0ffh ; done flag
ret ; to xdos
wready: ;not ready, treat as error for now
call inbyte ;clear result byte
jmp trycount
werror: ;return hardware malfunction (crc, track, seek, etc.)
; the mds controller has returned a bit in each position
; of the accumulator, corresponding to the conditions:
; 0 - deleted data (accepted as ok above)
; 1 - crc error
; 2 - seek error
; 3 - address error (hardware malfunction)
; 4 - data over/under flow (hardware malfunction)
; 5 - write protect (treated as not ready)
; 6 - write error (hardware malfunction)
; 7 - not ready
; (accumulator bits are numbered 7 6 5 4 3 2 1 0)
trycount:
; register c contains retry count, decrement 'til zero
dcr c
jnz rewait ;for another try
; cannot recover from error
mvi a,1 ;error code
ret
; intype, inbyte, instat read drive bank 00 or 10
intype: lda dbank
ora a
jnz intyp1 ;skip to bank 10
in rtype
ret
intyp1: in rtype+10h ;78 for 0,1 88 for 2,3
ret
inbyte: lda dbank
ora a
jnz inbyt1
in rbyte
ret
inbyt1: in rbyte+10h
ret
instat: lda dbank
ora a
jnz insta1
in dstat
ret
insta1: in dstat+10h
ret
; data areas (must be in ram)
dbank: db 0 ;disk bank 00 if drive 0,1
; 10 if drive 2,3
iopb: ;io parameter block
db 80h ;normal i/o operation
iof: db readf ;io function, initial read
ion: db 1 ;number of sectors to read
iot: db 2 ;track number
ios: db 1 ;sector number
iod: dw $-$ ;io address
sel$table:
if sgl
db 00h, 30h, 00h, 30h ; drive select bits
endif
if dbl
db 00h, 10h, 00h, 30h ; drive select bits
endif
if mac and sgl
disks numdisks ; generate drive tables
diskdef 0,1,26,6,1024,243,64,64,2
diskdef 1,0
diskdef 2,0
diskdef 3,0
endef
endif
if mac and dbl
disks numdisks ; generate drive tables
diskdef 0,1,52,,2048,243,128,128,2,0
diskdef 1,0
diskdef 2,1,26,6,1024,243,64,64,2
diskdef 3,2
endef
endif
if asm
dpbase equ $ ;base of disk param blks
dpe0: dw xlt0,0000h ;translate table
dw 0000h,0000h ;scratch area
dw dirbuf,dpb0 ;dir buff, parm block
dw csv0,alv0 ;check, alloc vectors
dpe1: dw xlt1,0000h ;translate table
dw 0000h,0000h ;scratch area
dw dirbuf,dpb1 ;dir buff, parm block
dw csv1,alv1 ;check, alloc vectors
dpe2: dw xlt2,0000h ;translate table
dw 0000h,0000h ;scratch area
dw dirbuf,dpb2 ;dir buff, parm block
dw csv2,alv2 ;check, alloc vectors
dpe3: dw xlt3,0000h ;translate table
dw 0000h,0000h ;scratch area
dw dirbuf,dpb3 ;dir buff, parm block
dw csv3,alv3 ;check, alloc vectors
dpb0 equ $ ;disk param block
endif
if asm and dbl
dw 52 ;sec per track
db 4 ;block shift
db 15 ;block mask
db 0 ;extnt mask
dw 242 ;disk size-1
dw 127 ;directory max
db 192 ;alloc0
db 0 ;alloc1
dw 32 ;check size
dw 2 ;offset
xlt0 equ 0 ;translate table
dpb1 equ dpb0
xlt1 equ xlt0
dpb2 equ $
endif
if asm
dw 26 ;sec per track
db 3 ;block shift
db 7 ;block mask
db 0 ;extnt mask
dw 242 ;disk size-1
dw 63 ;directory max
db 192 ;alloc0
db 0 ;alloc1
dw 16 ;check size
dw 2 ;offset
endif
if asm and sgl
xlt0 equ $
endif
if asm and dbl
xlt2 equ $
endif
if asm
db 1
db 7
db 13
db 19
db 25
db 5
db 11
db 17
db 23
db 3
db 9
db 15
db 21
db 2
db 8
db 14
db 20
db 26
db 6
db 12
db 18
db 24
db 4
db 10
db 16
db 22
endif
if asm and sgl
dpb1 equ dpb0
xlt1 equ xlt0
dpb2 equ dpb0
xlt2 equ xlt0
dpb3 equ dpb0
xlt3 equ xlt0
endif
if asm and dbl
dpb3 equ dpb2
xlt3 equ xlt2
endif
if asm
begdat equ $
dirbuf: ds 128 ;directory access buffer
endif
if asm and sgl
alv0: ds 31
csv0: ds 16
alv1: ds 31
csv1: ds 16
endif
if asm and dbl
alv0: ds 31
csv0: ds 32
alv1: ds 31
csv1: ds 32
endif
if asm
alv2: ds 31
csv2: ds 16
alv3: ds 31
csv3: ds 16
enddat equ $
datsiz equ $-begdat
endif
db 0 ; this last db is req'd to
; ensure that the hex file
; output includes the entire
; diskdef
end