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,178 @@
title 'Clock process'
;*****************************************************
;*
;* CLOCK RSP
;*
;* The clock process will update the MP/M-86 Time of
;* Day structure each time it returns from waiting for
;* the 'Second' System Flag (Flag 2). When the minute
;* is updated, the 'minute' flag is set (Flag 3).
;*
;*****************************************************
; MPM functions
mpmint equ 224 ; mpm entry interrupt
mpm_flagw equ 132 ; flagwait
mpm_flags equ 133 ; flagset
mpm_tod equ 155 ; get tod address
tod_offset equ 07Eh
sec_flag equ 2
min_flag equ 3
; TOD format
tod_day equ word ptr 0
tod_hour equ byte ptr 2
tod_min equ byte ptr 3
tod_sec equ byte ptr 4
; PD fields
pdlen equ 48 ; length of process descriptor
ps_run equ 0 ; PD run status
pf_keep equ 2 ; PD nokill flag
; RSP format
rsp_top equ 0 ; rsp offset
rsp_pd equ 010h ; PD offset
rsp_uda equ 040h ; UDA offset
rsp_bottom equ 140h ; end rsp header
;*****************************************************
;*
;* CLOCK CODE SEGMENT
;*
;*****************************************************
cseg
org 0
mpm: int mpmint ! ret
clock: ; Clock process starts here
mov ds,sysdat
mov bx,tod_offset
; Loop forever
clockloop:
; BX -> TOD structure in SYSDAT
; Wait for Seconds Flag
mov cx,mpm_flagw ! mov dx,sec_flag
push bx ! call mpm ! pop bx
; increment seconds
clc
mov al,tod_sec[bx]
inc al ! daa ! mov tod_sec[bx],al
; check for minute mark
cmp al,60h ! jae update_min
jmp clock_loop
update_min:
; set minute flag
mov tod_sec[bx],0
mov cx,mpm_flags ! mov dx,min_flag
push bx ! call mpm ! pop bx
; increment minute field of TOD
clc ! mov al,tod_min[bx]
inc al ! daa ! mov tod_min[bx],al
; check if hour
cmp al,60h ! jae update_hour
jmp clock_loop
update_hour:
;update hour field
mov tod_min[bx],0
clc ! mov al,tod_hour[bx]
inc al ! daa ! mov tod_hour[bx],al
; check for day
cmp al,24h ! jae update_day
jmp clock_loop
update_day:
; update Day field
mov tod_hour[bx],0
inc tod_day[bx]
jmp clock_loop ; loop forever
;*****************************************************
;*
;* Data Segment
;*
;*****************************************************
dseg
org 0
sysdat dw 0,0,0
dw 0,0,0
dw 0,0
org rsp_pd
dw 0,0 ; link,thread
db ps_run ; status
db 190 ; priority
dw pf_keep ; flags
db 'CLOCK ' ; name
dw offset uda/10h ; uda seg
db 0,0,0,0 ; dsk,usr,ldsk,luser
dw 0 ; mem partitions
dw 0,0 ; dvract,wait
db 0,0 ; org,net
dw 0 ; parent
db 0,0,0,0 ; cns,abort,cin,cout
db 0,0,0,0 ; lst,sf3,sf4,sf5
dw 0,0,0,0 ; reserved,pret,scratch
org rsp_uda
uda dw 0,offset dma,0,0 ;0
dw 0,0,0,0
dw 0,0,0,0 ;10
dw 0,0,0,0
dw 0,0,0,0 ;20
dw 0,0,0,0
dw 0,0,offset stack_tos,0 ;30
dw 0,0,0,0
dw 0,0,0,0 ;40
dw 0,0,0,0
dw 0,0,0,0 ;50
dw 0,0,0,0
dw 0,0,0,0 ;60
dw 0,0,0,0
org rsp_bottom
dma rb 128
stack dw 0CCCCH,0CCCCH,0CCCCH
dw 0CCCCH,0CCCCH,0CCCCH
dw 0CCCCH,0CCCCH,0CCCCH
dw 0CCCCH,0CCCCH,0CCCCH
dw 0CCCCH,0CCCCH,0CCCCH
stack_tos dw offset clock ; offset
dw 0 ; segment
dw 0 ; flags
dw 0 ; END OF DATA
;
end

View File

@@ -0,0 +1,192 @@
;
; ECHO - Resident System Process
; Print Command tail to console
;
;
; DEFININTIONS
;
mpmint equ 224 ;mpm entry interrupt
mpm_conwrite equ 9 ;print string
mpm_qmake equ 134 ;create queue
mpm_qopen equ 135 ;open queue
mpm_qread equ 137 ;read queue
mpm_qwrite equ 139 ;write queue
mpm_setprior equ 145 ;set priority
mpm_condetach equ 147 ;detach console
mpm_setdefcon equ 148 ;set default console
pdlen equ 48 ;length of Process
; Descriptor
p_cns equ byte ptr 020h ;default cns
p_disk equ byte ptr 012h ;default disk
p_user equ byte ptr 013h ;default user
p_list equ byte ptr 024h ;default list
ps_run equ 0 ;PD run status
pf_keep equ 2 ;PD nokill flag
rsp_top equ 0 ;rsp offset
rsp_pd equ 010h ;PD offset
rsp_uda equ 040h ;UDA offset
rsp_bottom equ 140h ;end rsp header
qf_rsp equ 08h ;queue RSP flag
;
; CODE SEGMENT
;
CSEG
org 0
mpm: int mpmint
ret
main: ;create ECHO queue
mov cl,mpm_qmake ! mov dx,offset qd
call mpm
;open ECHO queue
mov cl,mpm_qopen ! mov dx,offset qpb
call mpm
;set priority to normal
mov cl,mpm_setprior ! mov dx,200
call mpm
;ES points to SYSDAT
mov es,sdatseg
loop: ;forever
;read cmdtail from queue
mov cl,mpm_qread ! mov dx,offset qpb
call mpm
;set default values from PD
mov bx,pdadr
; mov dl,es:p_disk[bx] ;p_disk=0-15
; inc dl ! mov disk,dl ;make disk=1-16
; mov dl,es:p_user[bx]
; mov user,dl
; mov dl,es:p_list[bx]
; mov list,dl
mov dl,es:p_cns[bx]
mov console,dl
;set default console
; mov dl,console
mov cl,mpm_setdefcon ! call mpm
;scan cmdtail and look for '$' or 0.
;when found, replace w/ cr,lf,'$'
lea bx,cmdtail ! mov al,'$' ! mov ah,0
mov dx,bx ! add dx,131
nextchar:
cmp bx,dx ! ja endcmd
cmp [bx],al ! je endcmd
cmp [bx],ah ! je endcmd
inc bx ! jmps nextchar
endcmd:
mov byte ptr [bx],13
mov byte ptr 1[bx],10
mov byte ptr 2[bx],'$'
;write command tail
lea dx,cmdtail ! mov cl,mpm_conwrite
call mpm
;detach console
mov dl,console
mov cl,mpm_condetach ! call mpm
;done, get next command
jmps loop
;
; DATA SEGMENT
;
DSEG
org rsp_top
sdatseg dw 0,0,0
dw 0,0,0
dw 0,0
org rsp_pd
pd dw 0,0 ; link,thread
db ps_run ; status
db 190 ; priority
dw pf_keep ; flags
db 'ECHO ' ; name
dw offset uda/10h ; uda seg
db 0,0 ; disk,user
db 0,0 ; load dsk,usr
dw 0 ; mem
dw 0,0 ; dvract,wait
db 0,0
dw 0
db 0 ; console
db 0,0,0
db 0 ; list
db 0,0,0
dw 0,0,0,0
org rsp_uda
uda dw 0,offset dma,0,0 ;0
dw 0,0,0,0
dw 0,0,0,0 ;10h
dw 0,0,0,0
dw 0,0,0,0 ;20h
dw 0,0,0,0
dw 0,0,offset stack_tos,0 ;30h
dw 0,0,0,0
dw 0,0,0,0 ;40h
dw 0,0,0,0
dw 0,0,0,0 ;50h
dw 0,0,0,0
dw 0,0,0,0 ;60h
org rsp_bottom
qbuf rb 131 ;Queue buffer
qd dw 0 ;link
db 0,0 ;net,org
dw qf_rsp ;flags
db 'ECHO ' ;name
dw 131 ;msglen
dw 1 ;nmsgs
dw 0,0 ;dq,nq
dw 0,0 ;msgcnt,msgout
dw offset qbuf ;buffer addr.
dma rb 128
stack dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
stack_tos dw offset main ; start offset
dw 0 ; start seg
dw 0 ; init flags
pdadr rw 1 ; QPB Buffer
cmdtail rb 129 ; starts here
db 13,10,'$'
qpb db 0,0 ;must be zero
dw 0 ;queue ID
dw 1 ;nmsgs
dw offset pdadr ;buffer addr.
db 'ECHO ' ;name to open
console db 0
;disk db 0
;user db 0
;list db 0
end


View File

@@ -0,0 +1,48 @@
;
; GENERATE TMP.RSP
;
a86 tmp
gencmd tmp
era tmp.rsp
ren tmp.rsp=tmp.cmd
vax tmp.lst $$atn
xref86 tmp
vax tmp.xrf $$atn
;
; GENERATE ECHO.RSP
;
a86 echo
gencmd echo
era echo.rsp
ren echo.rsp=echo.cmd
vax echo.lst $$atn
xref86 echo
vax echo.xrf $$atn
;
; GENERATE CLOCK.RSP
;
a86 clock
gencmd clock
era clock.rsp
ren clock.rsp=clock.cmd
vax clock.lst $$atn
xref86 clock
vax clock.xrf $$atn
;
; GENERATE SUBMIT.CMD
;
a86 submit
gencmd submit
vax submit.lst $$atn
xref86 submit
vax submit.xrf $$atn
;
; GENERATE RANDOM.CMD
;
a86 random
gencmd random
vax random.lst $$atn
xref86 random
vax random.xrf $$atn
;


View File

@@ -0,0 +1,334 @@
;
;****************************************************
;* *
;* Sample Random Access Program for MP/M-86 *
;* *
;****************************************************
;
; BDOS Functions
;
coninp equ 1 ;console input function
conout equ 2 ;console output function
pstring equ 9 ;print string until '$'
rstring equ 10 ;read console buffer
version equ 12 ;return version number
openf equ 15 ;file open function
closef equ 16 ;close function
makef equ 22 ;make file function
readr equ 33 ;read random
writer equ 34 ;write random
writerz equ 40 ;write random zero fill
;
; Equates for non graphic characters
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
;
;
; load SP, ready file for random access
;
cseg
pushf ;push flags in CCP stack
pop ax ;save flags in AX
cli ;disable interrupts
mov bx,ds ;set SS register to base of DATA group
mov ss,bx ;set SS, SP with interrupts disabled
mov sp,offset stack ; for 80888
push ax ;restore the flags
popf
;
; CP/M-86 initial release returns the file
; system version number of 2.2: check is
; shown below for illustration purposes.
;
mov cl,version
call bdos
cmp al,20h ;version 2.0 or later?
jnb versok
; bad version, message and go back
mov dx,offset badver
call print
jmp abort
;
versok:
; correct version for random access
mov cl,openf ;open default fct
mov dx,offset fcb
call bdos
inc al ;err 255 becomes zero
jnz ready
;
; cannot open file, so create it
mov cl,makef
mov dx,offset fcb
call bdos
inc al ;err 255 becomes zero
jnz ready
;
; cannot create file, directory full
mov dx,offset nospace
call print
jmp abort ;back to ccp
;
; loop back to "ready" after each command
;
ready:
; file is ready for processing
;
call readcom ;read next command
mov ranrec,dx ;store input record#
mov ranovf,ch ;set high byte
cmp al,'Q' ;quit?
jnz notq
;
; quit processing, close file
mov cl,closef
mov dx,offset fcb
call bdos
inc al ;err 255 becomes 0
jnz $+5
jmp error ;error message, retry
jmp abort ;back to ccp
;
;
; end of quit command, process write
;
;
notq:
; not the quit command, random write?
cmp al,'W'
jnz notw
;
; this is a random write, fill buffer until cr
mov dx,offset datmsg
call print ;data prompt
mov cx,127 ;up to 127 characters
mov bx,offset buff ;destination
rloop: ;read next character to buff
push cx ;save loop conntrol
push bx ;next destination
call getchr ;character to AL
pop bx ;restore destination
pop cx ;restore counter
cmp al,cr ;end of line?
jz erloop
; not end, store character
mov byte ptr [bx],al
inc bx ;next to fill
loop rloop ;decrement cx ..loop if not 0
erloop:
; end of read loop, store 00
mov byte ptr [bx],0h
;
; write the record to selected record number
mov cl,writer
mov dx,offset fcb
call bdos
or al,al ;error code zero?
jz ready ;for another record
jmps error ;message if not
;
;
;
; end of write random command, process write random zero fill
;
;
notw:
; not the quit command, random write?
cmp al,'Z'
jnz notz
;
; this is a random write, fill buffer until cr
mov dx,offset datmsg
call print ;data prompt
mov cx,127 ;up to 127 characters
mov bx,offset buff ;destination
rzloop: ;read next character to buff
push cx ;save loop conntrol
push bx ;next destination
call getchr ;character to AL
pop bx ;restore destination
pop cx ;restore counter
cmp al,cr ;end of line?
jz erzloop
; not end, store character
mov byte ptr [bx],al
inc bx ;next to fill
loop rzloop ;decrement cx ..loop if not 0
erzloop:
; end of read loop, store 00
mov byte ptr [bx],0h
;
; write the record to selected record number
mov cl,writerz
mov dx,offset fcb
call bdos
or al,al ;error code zero?
jnz $+5
jmp ready ;for another record
jmps error ;message if not
;
;
;
; end of write random zero fill command, process read
;
;
notz:
; not a write command, read record?
cmp al,'R'
jz ranread
jmps error ;skip if not
;
; read random record
ranread:
mov cl,readr
mov dx,offset fcb
call bdos
or al,al ;return code 00?
jz readok
jmps error
;
; read was successful, write to console
readok:
call crlf ;new line
mov cx,128 ;max 128 characters
mov si,offset buff ;next to get
wloop:
lods al ;next character
and al,07fh ;mask parity
jnz wloop1
jmp ready ;for another command if 00
wloop1:
push cx ;save counter
push si ;save next to get
cmp al,' ' ;graphic?
jb skipw ;skip output if not graphic
call putchr ;output character
skipw:
pop si
pop cx
loop wloop ;decrement CX and check for 00
jmp ready
;
;
; end of read command, all errors end-up here
;
;
error:
mov dx,offset errmsg
call print
jmp ready
;
; BDOS entry subroutine
bdos:
int 224 ;entry to BDOS if by INT 224
ret
;
abort: ;return to CCP
mov cl,0
call bdos ;use function 0 to end execution
;
; utility subroutines for console i/o
;
getchr:
;read next console character to a
mov cl,coninp
call bdos
ret
;
putchr:
;write character from a to console
mov cl,conout
mov dl,al ;character to send
call bdos ;send character
ret
;
crlf:
;send carriage return line feed
mov al,cr ;carriage return
call putchr
mov al,lf ;line feed
call putchr
ret
;
print:
;print the buffer addressed by dx until $
push dx
call crlf
pop dx ;new line
mov cl,pstring
call bdos ;print the string
ret
;
readcom:
;read the next command line to the conbuf
mov dx,offset prompt
call print ;command?
mov cl,rstring
mov dx,offset conbuf
call bdos ;read command line
; command line is present, scan it
mov ax,0 ;start with 0000
mov bx,offset conlin
mov ch,0 ;zero high byte of 3 byte result
readc: mov dl,[bx] ;next command character
inc bx ;to next command position
mov dh,0 ;zero high byte for add
or dl,dl ;check for end of command
jnz getnum
ret
; not zero, numeric?
getnum:
sub dl,'0'
cmp dl,10 ;carry if numeric
jnb endrd
cmp ch,0
jnz error ;error - number too large
push dx ;multiply by 10
mov cx,10
mul cx
mov ch,dl
pop dx
add ax,dx ;+digit
adc ch,0
jmps readc ;for another char
endrd:
; end of read, restore value in a and return value in bx
mov dx,ax ;return value in DX
mov al,-1[bx]
cmp al,'a' ;check for lower case
jnb transl
ret
transl: and al,5fH ;translate to upper case
ret
;
;
; Template for Page 0 of Data Group
; Contains default FCB and DMA buffer
;
dseg
org 05ch
fcb rb 33 ;default file control block
ranrec rw 1 ;random record position
ranovf rb 1 ;high order (overflow) byte
buff rb 128 ;default DMA buffer
;
; string data area for console messages
badver db 'sorry, you need cp/m version 2$'
nospace db 'no directory space$'
datmsg db 'type data: $'
errmsg db 'error, try again.$'
prompt db 'next command? $'
;
;
; fixed and variable data area
;
conbuf db conlen ;length of console buffer
consiz rs 1 ;resulting size after read
conlin rs 32 ;length 32 buffer
conlen equ offset $ - offset consiz
;
rs 31 ;16 level stack
stack rb 1
db 0 ;end byte for GENCMD
end


View File

@@ -0,0 +1,884 @@
;*****************************************************
;*
;* Submit MP/M-86
;*
;*****************************************************
true equ 0ffh
false equ 0
unknown equ 0
mpmint equ 224 ; int vec for mpm ent.
mpm_conin equ 1
mpm_conout equ 2
mpm_conwrite equ 9
mpm_conread equ 10
mpm_constat equ 11
mpm_version equ 12
mpm_diskselect equ 14
mpm_openfile equ 15
mpm_readfile equ 20
mpm_getdefdisk equ 25
mpm_setdma equ 26
mpm_usercode equ 32
mpm_terminate equ 143
mpm_setprior equ 145
mpm_conattach equ 146
mpm_condetach equ 147
mpm_setdefcon equ 148
mpm_clicmd equ 150
mpm_parse equ 152
mpm_getdefcon equ 153
mpm_getpdadr equ 156
mpm_setdeflst equ 160
mpm_getdeflst equ 164
; fcb offsets
mode2 equ 6 ; 2nd open mode byte
ftype equ 9 ; file type
cr equ 32 ; offset of current record
e_no_memory equ 3 ; cant find memory
e_no_pd equ 12 ; no free pd's
e_q_full equ 15 ; full queue
e_badfname equ 24 ; illegal filename
e_badftype equ 25 ; illegal filetype
e_bad_load equ 28 ; bad ret. from BDOS load
e_bad_read equ 29 ; bad ret. from BDOS read
e_bad_open equ 30 ; bad ret. from BDOS open
e_nullcmd equ 31 ; null command sent
p_prior equ 05H ;process descriptor priority
p_flag equ word ptr 06H ;flags
p_name equ 08H ;name of process
p_parent equ 1EH ;PD's parent
pf_keep equ 02H ;keep flag
pf_childabort equ 800H ;child aborted abnormally
pf_ctlc equ 080H ;control c occured
;*****************************************************
;*
;* Submit Code
;*
;*****************************************************
cseg
org 0
jmps submit
db 'COPYRIGHT (C) 1981,'
db ' DIGITAL RESEARCH '
db '5 Oct 1981'
db 13,10,0,'$'
;======
submit: ; PROGRAM MAIN - INITIALIZATION
;======
mov ax,ds
pushf ! pop bx
mov ss,ax
mov sp,offset stacktop
push bx ! popf
mov cl,mpm_version
call mpm
cmp bh,11H
jz okvers
mov dx,offset wrongvers
mov cl, mpm_conwrite ! call mpm
mov cl,0 ! call mpm
okvers:
;
;set priority better than parent
;
mov cl,mpm_getpdadr
call mpm ;get our PD address
mov pdadr,bx ;save PD address
mov sysdatseg,es ;and the system data area segment
mov bx,es:p_parent[bx] ;get our parent's PD address
cmp bx,0 ! jne psetpar ;see if parent exists
mov dx,197 ! jmps setp ; oops, set to better than TMP
psetpar:mov dx,es:p_prior[bx] ;our parent's priority
dec dx ;we run at one better,
cmp dx,64 ! jae setp
mov dx,64 ;don't compete w/system
setp: mov cl,mpm_setprior
call mpm ;set our priority
mov cl,mpm_setdma ;using default buffer at 80H for
mov dx,offset dma ;command tail and argument expansion
call mpm
mov si,offset fcb
mov byte ptr ftype[si],'S' ;look for file with type = SUB
mov byte ptr ftype+1[si],'U'
mov byte ptr ftype+2[si],'B'
mov byte ptr cr[si],0 ;zero current record
or byte ptr mode2[si],80h ;open in R/O mode
mov dx,si
call openfile
cmp al,0ffh
jnz exists
mov dx,offset sopen_err
call con_write
jmp submitexit
exists:
mov al,fcb ;save disk number where command file is
cmp al,0 ;default disk ?
jnz save_disk_no
mov cl,mpm_getdefdisk
call mpm
inc al
save_disk_no:
mov command_disk,al
mov cl,mpm_usercode ;save user number of
mov dl,0ffh
call mpm ;command file
mov command_user,al
mov cx,mpm_getdefcon
call mpm ;save console number this
mov command_con,al ;program was run from
;
;deblank command tail
;
mov si,offset cmdtail + 1
mov di,offset deblankbuf
firstwhites:
cmp byte ptr [si],' '
jnz tab
jmps morewhites
tab:
cmp byte ptr [si],9
jnz deblank
morewhites:
inc si
jmps firstwhites
deblank:
mov al,byte ptr [si]
inc si
cmp al,' '
jz skipwhite
cmp al,9 ;tab
jz skipwhite
jmps copychar
copychar:
cmp al,0 ;end of of command tail ?
jz putlastblank
mov [di],al
inc di
jmps deblank
putlastblank:
mov byte ptr [di],' '
inc di
mov [di],al ;ends with space and zero
jmps dedone
skipmore:
inc si
skipwhite: ;input = si points at tab or blank
mov al,[si]
cmp al,' '
jz skipmore
cmp al,9 ;tab
jz skipmore
mov byte ptr [di],' '
inc di
jmps deblank ;si points to non white char
;di is next char to copy
dedone:
;
;fill argument tail
;
mov bp,offset deblankbuf
mov bx,offset argtable
xor si,si ;pointer into deblankbuf
mov di,si ;index into argtable
nxtfill:
mov al,byte ptr [bp + si] ;0th argument is '<filename>.sub'
cmp al,0
jz filldone
mov [bx + di],si
inc di
call skiparg ;skip over argument and blank
jmps nxtfill
skiparg:
inc si
cmp byte ptr [bp + si],' '
jnz skiparg
inc si ;char after blank
ret
filldone:
mov numargs,di
call crlf
;get first command from SUB file
mov cmdbuf,maxcmdlen ! mov dx,offset cmdbuf
call readbuffer ;read from file to next crlf
cmp bx,0 ! je topofcmdloop ;assume EOF if BX <> 0
;jmp submitexit
;==========
submitexit:
;==========
mov cl,0 ! mov dx,0
;jmp mpm
;===
mpm: ; INTERFACE ROUTINE FOR SYSTEM ENTRY POINTS
;===
int mpmint ! ret
;===========
topofcmdloop: ; LOOP FOREVER
;===========
;
; check to see if control c was typed during last command
;
mov bx,pdadr
mov es,sysdatseg
test es:p_flag[bx],pf_childabort
jz gonext
and es:p_flag[bx],not pf_childabort ;turn off child abort flg
mov cl,11 ! mov si,offset fcb + 1
mov di, offset subfilename
push ds ! pop es
rep movs al,al
mov dx,offset askabortmsg
call con_write
call charin
and al,5fh ;make upper case
cmp al,'Y'
jnz gonext
;stop this submit and turn on
;pf_ctlc flag
mov bx,pdadr ! mov es,sysdatseg
or es:p_flag[bx],pf_ctlc
submitexit1: jmp submitexit
gonext:
;
; print CR,LF if we just sent a command
;
cmp cmdsent,false ! je noclearline
mov cmdsent,false
call crlf
noclearline:
;
; set up and print user prompt
;
; get current default disk
mov cl,mpm_getdefdisk ! call mpm
mov defdisk,al
; get current default user #
; this call should be made on every
; loop in case the 'USER' program
; has changed the default user number
mov cl,mpm_usercode ! mov dl,0ffh
call mpm
mov defuser,al
;create user part of prompt string
mov promptutens,13
mov promptuones,'0'
cmp al,10 ! jb ones
mov promptutens,'1'
sub al,10
ones: add promptuones,al
; create disk part of prompt string
mov al,'A' ! add al,defdisk
mov promptdisk,al
; write user prompt
mov dx,offset prompt
cmp promptutens,13 ! jne writeprompt
mov dx,offset promptutens
writeprompt:
mov cl,mpm_conwrite ! call mpm
;
; copy command to cli buffer, make upper case and
; expand command arguments
;
mov si,offset cmd ;where command is
mov bp,offset clicmd ;copy w/ expanded args here
xor di,di ;index into cli command
nextchar:
mov al,[si] ;char from command
inc si
cmp al,'$' ;argument ?
jz argmaybe
noarg:
call copyit
jmps nextchar
argmaybe:
cmp byte ptr [si],'0' ;is next char after '$' a digit ?
jb noarg
cmp byte ptr [si],'9'
ja noarg
realarg:
xor ax,ax ;copy argument throw out - '$' in al
mov al,[si]
sub al,'0' ;1st digit
inc si
cmp byte ptr [si],'0' ;is there a second digit ?
jb onedigit
cmp byte ptr [si],'9'
ja onedigit
mov dl,10 ;1st digit is tens in column
mul dl
mov dl,[si] ;2nd argument is ones column
inc si
sub dl,'0'
add al,dl
onedigit:
mov bx,ax
copyarg:
cmp bx,numargs ;
jb oknum ;numargs in range 1 to n
jmps nextchar ;no such argument
oknum:
mov bl,argtable[bx] ;argument address rel to deblankbuf
copymore:
mov al,deblankbuf[bx]
cmp al,' '
jz nextchar ;end of argument
call copyit
inc bx
jmps copymore
;utility subroutine
copyit:
mov [bp + di],al ;mov to cli command buffer
inc di
cmp di,maxcmdlen ;cli buffer size
jae donecopy
testend:
cmp al,0
jz donecopy
ret
donecopy:
mov byte ptr [bp + di], '$'
pop ax ;return is garbage
;jmps echocommand ;fall through to echocommand
echocommand:
;print command after argument
mov dx,offset clicmd ;substitution
mov bx,dx ! cmp byte ptr [bx], '$'
jnz writecommand
inc dx ;skip '$' if line begins with '$'
writecommand:
call con_write
;
; echo newline
;
call crlf
;
; make sure not a null command
;
lea bx,cmd
cmp blen,0 ! je gonextcmd
cmp byte ptr [bx],';' ! je gonextcmd
;
; see if disk change - if 'X:' change def disk to X
;
cmp blen,2 ! jne notdrive
cmp byte ptr 1[bx],':' ! jne try_builtin
; change default disk
mov dl,[bx] ;get disk name
and dl,5fh ;make Upper Case
sub dl,'A' ;make disk number
; check bounds
cmp dl,0 ! jb subex
cmp dl,15 ! jbe okdrive
subex:
jmp submitexit
okdrive:
; select default disk
mov cl,mpm_diskselect
call mpm
gonextcmd: jmp getnxtcmd
notdrive: mov di,offset clicmd
mov si, offset parseresult
call parsefilename
jcxz goodparse
mov cl,126
mov di,offset clicmd
mov al, ' '
push cs ! pop es
repne scasb
mov byte ptr[di], '$'
jmp clierror
goodparse: mov parseret,bx
cmp parseresult,0 ! jz try_builtin
jmp not_builtin
try_builtin:
mov di,offset usercmd
mov si,offset parseresult ! inc si
push ds ! pop es
mov cx,4 ! repz cmpsw
jnz notuser
mov si,offset parseresult
mov di,parseret ! cmp di,0
je pruser
call parsefilename ; CX = 0 if ok
cmp cx,0 ! jne pruser
mov si,offset parseresult ! inc si
mov dx,[si]
call a_to_b
cmp bl,15 ! ja usererr
mov dl,bl ! call setuser
jmp pruser
usererr: mov dx,offset usererrmsg
call con_write
pruser: mov dx,offset usermsg
call con_write
call getuser
mov dl,bl ! call prnum
call crlf
jmp getnxtcmd
notuser:
mov si,offset parseresult ! inc si
mov di,offset printercmd
push ds ! pop es
mov cx,4 ! repz cmpsw
jnz notprinter
mov si,offset parseresult
mov di,parseret ! test di,di
jz prprinter
call parsefilename ; CX = 0 if ok
cmp cx,0 ! jne prprinter; no tail
mov si,offset parseresult ! inc si
mov dx,[si]
call a_to_b
cmp bl,0ffh ! je printererr
mov dl,bl ! call setlist
jcxz prprinter
printererr: mov dx,offset printererrmsg
call con_write
prprinter: mov dx,offset printermsg
call con_write
call getlist
mov dl,bl ! call prnum
call crlf
jmp getnxtcmd
notprinter:
; check for '$include' option
mov si,offset parseresult ! inc si
mov di,offset includecmd
push ds ! pop es
mov cx,4 ! repz cmpsw
jnz notinclude
mov si,offset parseresult
mov di,parseret ! test di,di
jz notinclude
call parsefilename ; CX = 0 if ok
cmp cx,0 ! jne includerr; no tail
mov si,pdadr
add si,p_name
mov di,offset clicmd
mov cl,4
push ds ! pop es
push ds ! mov ds,sysdatseg
; overwrite $include with
rep movsw ; name of this program
; for recursive submits
pop ds
mov dx,offset includemsg
call con_write
jmps clicall ; send submit command
includerr: mov dx,offset includerrmsg
call con_write
jmp submitexit
notinclude:
notbuiltin:
;=======
clicall: ; SEND CLI COMMAND
;=======
; initialize Cli Control Block
mov clicb_net,0
; make cli call
mov cmdsent,true
lea dx,clicb ! mov cl,mpm_clicmd
call mpm
cmp bx,0 ! jne clierror
;
; more commands in sub file to process ?
;
getnxtcmd:
mov cmdbuf,maxcmdlen ! mov dx,offset cmdbuf
call readbuffer ;read from file to next crlf
cmp bx,0 ! je moretodo ;assume EOF if BX <> 0
jmp submitexit
moretodo:
mov cl,mpm_conattach ! call mpm
jmp topofcmdloop
;========
clierror:
;========
; Cli call unsuccesful, analyze and display error message
; input: CX = ERROR CODE
;null command?
cmp cx,e_nullcmd ! jne not_nullcmd
mov cmdsent,false
jmp getnxtcmd
not_nullcmd:
;no memory?
cmp cx,e_no_memory ! jne memory_ok
mov dx,offset memerr ! jmp showerr
memory_ok:
;no pd in table?
cmp cx,e_no_pd ! jne pd_ok
mov dx,offset pderr ! jmp showerr
pd_ok:
;illegal command name?
cmp cx,e_badfname ! je fname_bad
cmp cx,e_badftype ! jne fname_ok
fname_bad: mov dx,offset fnameerr ! jmp showerr
fname_ok:
;bad load?
cmp cx,e_bad_load ! je load_bad
cmp cx,e_bad_read ! jne load_ok
load_bad: mov dx,offset loaderr ! jmp showerr
load_ok:
;bad open?
cmp cx,e_bad_open ! jne open_ok
mov dx,offset openerr ! jmp showerr
open_ok:
;RSP que full?
cmp cx,e_q_full ! jne que_ok
mov dx,offset qfullerr ! jmp showerr
que_ok:
;some other error...
mov dx,offset catcherr
;jmp showerr
;=======
showerr:
;=======
; Print Error String
; input: DX = address of Error String
call conwrite
jmp submitexit
;==========
readbuffer:
;==========
; Simulate Read Console buffer from a disk file.
; input: DX = buffer address
; output: BX <> 0 if EOF
mov di,dx
xor al,al
mov 1[di],al ;no chars read
cmp 0[di],al ;zero length buffer
jnz buf_ok ;return no error - nop
mov bx,0ffffh
ret
buf_ok:
mov si,di ! inc si ! inc si
;si is next char
read_another:
mov al,1[di]
cmp al,[di]
jae done_ok ;full buffer
push di
call readchar ;fills [si]
pop di
cmp bx,0 ;non-zero or eof error
jz not_error
ret
not_error:
cmp byte ptr [si],0ah ! jne not_lf
jmps done_ok
not_lf: cmp byte ptr [si],0dh ! je done_ok
inc byte ptr 1[di] ;not cr, inc buffer count
inc si ;inc char position
jmp read_another
done_ok:
cmp byte ptr 1[di],0 ;no characters read in buffer
jz read_another ;skip leading cr's and lf's
mov byte ptr [si],0
mov bx,0 ! ret
;========
readchar:
;========
; Read a character from file.
; input = si is address of where to put character
; output = bx <> 0 if error
;
xor bh,bh
mov bl,buf_ptr ;char ptr in dma buffer
cmp bl,128
jb no_read
push si
mov dl,command_user ;user of command file
mov cl,mpm_usercode
call mpm
mov bx,offset fcb
mov al,command_disk ;disk drive number of command file
mov [bx],al ;re-open each time to allow deletion
or byte ptr mode2[bx],80h ;of command file, open in R/O mode
mov dx,bx
call openfile
cmp al,0ffh
jz readerr
mov dx,offset fcb
call readfile ;read sequential
cmp al,0
jnz readerr
mov cl,mpm_usercode ;set user back to what the command
mov dl,defuser ;file has set it to
call mpm
mov bx,0
pop si
no_read:
mov al,dma[bx]
cmp al,1ah ;check for EOF
jz eof
mov [si],al
inc bl
mov buf_ptr,bl ;point to next char in disk buffer
xor bx,bx
ret
readerr:
pop si
eof:
mov bx,0ffffh ;error or eof
ret
;*****************************************************
;*
;* SUBROUTINES
;*
;*****************************************************
parsefilename: ;SI = fcb DI = string
mov cx,mpm_parse
mov bx,offset pcb
mov [bx],di ! mov 2[bx],si
mov dx,bx ! jmp mpm
a_to_b: ;dl = 1st char, dh = 2nd char
cmp dh,' ' ! jne atob2char
mov dh,dl ! mov dl,'0'
atob2char: cmp dh,'0' ! jb atoberr
cmp dh,'9' ! ja atoberr
cmp dl,'0' ! jb atoberr
cmp dl,'9' ! ja atoberr
sub dh,'0' ! sub dl,'0'
mov ax,0 ! mov al,dl
push dx ! mov cl,10 ! mul cl ! pop dx
mov dl,dh ! mov dh,0 ! add ax,dx
mov bx,ax ! ret
atoberr: mov bl,0ffh ! ret
prnum: ; dl = num (0-15)
cmp dl,10 ! jb prnum_one
push dx
mov dl,'1' ! call prchar
pop dx ! sub dl,10
prnum_one: add dl,'0'
jmp prchar
charin: mov cl,mpm_conin ! jmp mpm
prchar: mov cl,mpm_conout ! jmp mpm
getuser: mov dl,0ffh
setuser: mov cl,mpm_usercode ! jmp mpm
setconsole: mov cl,mpm_setdefcon ! jmp mpm
setdisk: mov cl,mpm_diskselect ! jmp mpm
getdisk: mov cl,mpm_getdefdisk ! jmp mpm
setlist: mov cl,mpm_setdeflst ! jmp mpm
getlist: mov cl,mpm_getdeflst ! jmp mpm
attach: mov cl,mpm_conattach ! jmp mpm
detach: mov cl,mpm_condetach ! jmp mpm
conread: mov cl,mpm_conread ! jmp mpm
crlf:
mov dx,offset newline
;jmp con_write
con_write:
mov cl,mpm_conwrite
jmp mpm
openfile:
mov cl,mpm_openfile
jmp mpm
readfile:
mov cl,mpm_readfile
jmp mpm
;*****************************************************
;*
;* Data Area
;*
;*****************************************************
dseg
org 05cH
fcb rb 024H
org 080h
cmdtail rb 128
stack dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
stacktop rw 0
maxcmdlen equ 128
; the Read Console Buffer and the
; Cli Control Block share the same memory
dma rb 128
numargs rw 1
argtable rb 64 ;address of arguments in cmdtail
deblankbuf rb maxcmdlen + 1
cmdbuf rb 1 ;single command gets put here
blen rb 1
cmd rb maxcmdlen + 1
clicb rb 0 ;command w/ expanded args goes here
clicb_net db 0
clicmd rb maxcmdlen+1
command_user rb 1
command_disk rb 1
command_con rb 1
defdisk rb 1
defuser rb 1
buf_ptr db 128 ;force initial read
;in readchar routine
prompt db 13
promptutens db '0'
promptuones db '0'
promptdisk db 'A'
promptend db '>$'
pcb dw offset clicmd
dw offset parseresult
parseret dw 0
parseresult rb 36
cmdsent db false
pdadr rw 1 ;our pd address
sysdatseg rw 1 ;the system data area's segment
;*****************************************************
;*
;* CONSTANTS
;*
;*****************************************************
wrongvers db 'Requires MP/M-86'
newline db 10,13,'$'
askabortmsg db 13,10,10,'Terminate '
subfilename rb 11
db ' (Y/N) ? $'
usercmd db 'USER '
printercmd db 'PRINTER '
includecmd db '$INCLUDE'
usererrmsg db 13,10,'Invalid User Number, IGNORED',13,10,'$'
usermsg db 13,10,'User Number = $'
printererrmsg db 13,10,'Invalid Printer Number, IGNORED',13,10,'$'
printermsg db 13,10,'Printer Number = $'
includerrmsg db 13,10,'Include Error$'
includemsg db '(submit)',10,13,'$'
memerr db '?Not Enough Memory$'
pderr db '?PD Table Full$'
fnameerr db '?Illegal Command$'
loaderr db '?Load Error$'
openerr db '?Can''t Find Command$'
catcherr db '?$'
qfullerr db '?RSP Command Que Full$'
;SUBMIT error messages
sopenerr db 'No ''SUB'' File Present$'
argerr db 'Illegal Argument$'
end


View File

@@ -0,0 +1,509 @@
;*****************************************************
;*
;* Terminal Message Processor
;*
;* The TMP determines the user interface to MPM.
;* Much of the interface is available though
;* system calls. This TMP takes advantage of
;* as much as possible for simplicity. The TMP
;* could, for instance, be easily modified to
;* force logins and have non-standard defaults.
;*
;* With a little more work, The TMP could do all
;* command parsing and File Loading instead of
;* using the CLI COMMAND FUNCTION. This is also
;* the place to AUTOLOAD programs for specific
;* users. Suggestions are given in the MP/M-86
;* SYSTEM'S GUIDE.
;*
;*****************************************************
true equ 0ffh
false equ 0
unknown equ 0
mpmint equ 224 ; int vec for mpm
cr equ 13
lf equ 10
mpm_conout equ 2
mpm_conwrite equ 9
mpm_conread equ 10
mpm_diskselect equ 14
mpm_getdefdisk equ 25
mpm_usercode equ 32
mpm_freedrive equ 39
mpm_conattach equ 146
mpm_condetach equ 147
mpm_setdefcon equ 148
mpm_clicmd equ 150
mpm_parse equ 152
mpm_setdeflst equ 160
mpm_getdeflst equ 164
ps_run equ 00 ; on ready list root
pf_sys equ 001h ; system process
pf_keep equ 002h ; do not terminate
s_mpmseg equ word ptr 40H ;begin MPM segment
s_sysdisk equ byte ptr 04bh ;system disk
s_ncns equ byte ptr 47H ;sys. consoles
s_version equ word ptr 78h ;ofst ver. str in SUP
rsp_top equ 0
rsp_md equ 008h
rsp_pd equ 010h
rsp_uda equ 040h
rsp_bottom equ 140h
e_no_memory equ 3 ; cant find memory
e_no_pd equ 12 ; no free pd's
e_q_full equ 15 ; full queue
e_illdisk equ 23 ; illegal disk #
e_badfname equ 24 ; illegal filename
e_badftype equ 25 ; illegal filetype
e_bad_load equ 28 ; bad ret. from BDOS load
e_bad_read equ 29 ; bad ret. from BDOS read
e_bad_open equ 30 ; bad ret. from BDOS open
e_nullcmd equ 31 ; null command sent
e_ill_lst equ 37 ; illegal list device
e_ill_passwd equ 38 ; illegal password
;*****************************************************
;*
;* TMP Shared Code and Constant Area
;*
;*****************************************************
cseg
org 0
;===
mpm: ; INTERFACE ROUTINE FOR SYSTEM ENTRY POINTS
;===
int mpmint ! ret
;===
tmp: ; PROGRAM MAIN - INITIALIZATION
;===
; set default console # = TMP#
mov dl,defconsole ! call setconsole
; set default disk = drive A
push ds ! mov ds,sysdatseg
mov dl,.s_sysdisk ! pop ds
call setdisk
; set default user # = console
mov dl,defconsole ! call setuser
; print version
call attach
push ds ! mov ds,sysdatseg
mov dx,.s_version
mov ds,.s_mpmseg
call print_ds_string ! pop ds
call detach
; THIS IS WHERE A LOGIN ROUTINE MIGHT
; BE IMPLEMENTED. THE DATA FILE THAT
; CONTAINS THE USER NAME AND PASSWORD
; MIGHT ALSO CONTAIN AN INITIAL DEFAULT
; DISK AND USER NUMBER FOR THAT USER.
;===========
nextcommand: ; LOOP FOREVER
;===========
; free drive
mov dx,0ffffh ! call freedrive
; attach console
call attach
; print CR,LF if we just sent command
cmp cmdsent,false ! je noclearline
mov cmdsent,false
call crlf
noclearline:
; set up and print user prompt
; get current default user # and disk
; this call should be made on every
; loop in case the last command
; has changed the default.
mov dl,cr ! call prchar
call getuser
mov dl,bl ! call prnum
call getdisk
mov dl,'A' ! add dl,bl
call prchar
mov dx,offset prompt
call print_string
; Read Command from Console
mov dx,offset read_buf ! call conread
; echo newline
mov dl,lf ! call prchar
; make sure not a null command
lea bx,clicb_cmd
cmp read_blen,0 ! je gonextcmd
cmp byte ptr [bx],';' ! je gonextcmd
; see if disk change
; if 'X:' change def disk to X
cmp read_blen,2 ! jne clicall
cmp byte ptr 1[bx],':'
jne clicall
; change default disk
mov dl,[bx] ;get disk name
and dl,5fh ;Upper Case
sub dl,'A' ;disk number
; check bounds
cmp dl,0 ! jb gonextcmd
cmp dl,15 ! ja gonextcmd
; select default disk
call setdisk
gonextcmd: jmp nextcommand
;=======
clicall: ; SEND CLI COMMAND
;=======
; put null at end of input
mov bx,offset clicb_cmd
mov al,read_blen ! mov ah,0
add bx,ax ! mov byte ptr [bx],0
; copy command string for err
; reporting later and to check
; for built in commands...
mov cx,64
mov si,offset clicb_cmd
mov di,offset savebuf
push ds ! pop es
rep movsw
; parse front to see if
; built in command
mov si,offset fcb
mov di,offset savebuf
call parsefilename
jcxz goodparse
sub bx,bx ! mov bl,read_blen
add bx,offset savebuf
mov byte ptr [bx],'$'
jmp clierror
goodparse: mov parseret,bx
cmp bx,0 ! jne haveatail
mov bl,read_blen
add bx,offset savebuf
haveatail: mov byte ptr [bx],'$' ! inc bx
cmp fcb,0 ! je try_builtin
jmp not_builtin
; is it USER command?
try_builtin: mov si,offset fcb ! inc si
mov di,offset usercmd
push cs ! pop es
mov cx,4 ! repz cmpsw
jnz notuser
mov si,offset fcb
mov di,parseret
cmp di,0 ! je pruser
inc di
call parsefilename
cmp cx,0 ! jne pruser
mov si,offset fcb
inc si
mov dx,[si]
call a_to_b
cmp bl,15 ! ja usererr
mov dl,bl
call setuser
jmp pruser
usererr: mov dx,offset usererrmsg
call printstring
pruser: mov dx,offset usermsg
call printstring
call getuser
mov dl,bl ! call prnum
call crlf
jmp nextcommand
notuser:
mov si,offset fcb ! inc si
mov di,offset printercmd
push cs ! pop es
mov cx,4 ! repz cmpsw
jnz notprinter
mov si,offset fcb
mov di,parseret
cmp di,0 ! je prprinter
inc di
call parsefilename
cmp cx,0 ! jne prprinter
mov si,offset fcb
inc si
mov dx,[si]
call a_to_b
cmp bl,0ffh
je printererr
mov dl,bl
call setlist
jcxz prprinter
printererr: mov dx,offset printemsg
call printstring
prprinter: mov dx,offset printermsg
call printstring
call getlist
mov dl,bl ! call prnum
call crlf
jmp nextcommand
notprinter:
not_builtin:
; initialize Cli Control Block
mov clicb_net,0
; make cli call
mov cmdsent,true
lea dx,clicb ! mov cl,mpm_clicmd
call mpm
cmp bx,0 ! jne clierror
jmp nextcommand
;========
clierror:
;========
; Cli call unsuccesful, analyze and display err msg
; input: CX = ERROR CODE
;null command?
cmp cx,e_nullcmd ! jne not_nullcmd
mov cmdsent,false
jmp nextcommand
not_nullcmd:
;no memory?
cmp cx,e_no_memory ! jne memory_ok
mov dx,offset memerr ! jmp showerr
memory_ok:
;no pd in table?
cmp cx,e_no_pd ! jne pd_ok
mov dx,offset pderr ! jmp showerr
pd_ok:
;bad file spec?
cmp cx,e_badfname ! je fname_bad
cmp cx,e_illdisk ! je fname_bad
cmp cx,e_ill_passwd ! je fname_bad
cmp cx,e_badftype ! jne fname_ok
fname_bad: mov dx,offset fnameerr ! jmp showerr
fname_ok:
;bad load?
cmp cx,e_bad_load ! je load_bad
cmp cx,e_bad_read ! jne load_ok
load_bad: mov dx,offset loaderr ! jmp showerr
load_ok:
;bad open?
cmp cx,e_bad_open ! jne open_ok
mov dx,offset openerr ! jmp showerr
open_ok:
;RSP que full?
cmp cx,e_q_full ! jne que_ok
mov dx,offset qfullerr ! jmp showerr
que_ok:
;some other error...
mov dx,offset catcherr
;jmp showerr
showerr: ; Print Error String
; input: DX = address of Error
; string in CSEG
push dx
mov dx,offset savebuf ! call print_ds_string
mov dl,':' ! call prchar
mov dl,' ' ! call prchar
pop dx
call printstring ! call crlf
jmp nextcommand
parsefilename: ; SI = fcb DI = string
mov cx,mpm_parse
mov bx,offset pcb
mov [bx],di ! mov 2[bx],si
mov dx,bx ! jmp mpm
a_to_b: ;dl = 1st char, dh = 2nd char
cmp dh,' ' ! jne atob2char
mov dh,dl ! mov dl,'0'
atob2char: cmp dh,'0' ! jb atoberr
cmp dh,'9' ! ja atoberr
cmp dl,'0' ! jb atoberr
cmp dl,'9' ! ja atoberr
sub dh,'0' ! sub dl,'0'
mov ax,0 ! mov al,dl
push dx ! mov cl,10
mul cl ! pop dx
mov dl,dh ! mov dh,0
add ax,dx
mov bx,ax ! ret
atoberr: mov bl,0ffh ! ret
prnum: ; dl = num (0-15)
cmp dl,10 ! jb prnum_one
push dx
mov dl,'1' ! call prchar
pop dx ! sub dl,10
prnum_one: add dl,'0'
; jmp prchar
prchar: mov cl,mpm_conout ! jmp mpm1
getuser: mov dl,0ffh
setuser: mov cl,mpm_usercode ! jmp mpm1
crlf: mov dx,offset crlfstr
;jmp printstring
printstring: push ds ! mov ax,cs ! mov ds,ax
call print_ds_string ! pop ds ! ret
print_ds_string:mov cl,mpm_conwrite ! jmps mpm1
setconsole: mov cl,mpm_setdefcon ! jmps mpm1
setdisk: mov cl,mpm_diskselect ! jmps mpm1
getdisk: mov cl,mpm_getdefdisk ! jmps mpm1
setlist: mov cl,mpm_setdeflst ! jmps mpm1
getlist: mov cl,mpm_getdeflst ! jmps mpm1
attach: mov cl,mpm_conattach ! jmps mpm1
detach: mov cl,mpm_condetach ! jmps mpm1
conread: mov cl,mpm_conread ! jmps mpm1
freedrive: mov cl,mpm_freedrive ! jmps mpm1
mpm1: jmp mpm
;*****************************************************
;*
;* CONSTANTS (IN SHARED CODE SEGMENT)
;*
;*****************************************************
prompt db '>$'
crlfstr db 13,10,'$'
memerr db '?Not Enough Memory$'
pderr db '?PD Table Full$'
fnameerr db '?Bad File Spec$'
loaderr db '?Load Error$'
openerr db '?Can''t Find Command$'
catcherr db '?$'
qfullerr db '?RSP Command Que Full$'
usererrmsg db 13,10,'Invalid User Number,'
db ' IGNORED',13,10,'$'
usermsg db 13,10,'User Number = $'
printemsg db 13,10,'Invalid Printer Number,'
db ' IGNORED',13,10,'$'
printermsg db 13,10,'Printer Number = $'
usercmd db 'USER '
printercmd db 'PRINTER '
;*****************************************************
;*
;* TMP Data Area - this area is copied once for
;* each system console. The 'defconsole'
;* field is unique for each copy
;* - Each Data Area is run by a common
;* shared code segment.
;*
;*****************************************************
DSEG
org rsp_top
sysdatseg dw 0
sdatvar dw s_ncns
defconsole db 0,0
dw 0,0,0,0,0
org rsp_pd
pd dw 0,0 ; link fields
db ps_run ; status
db 198 ; priority
dw pf_sys+pf_keep ; flags
db 'Tmp ' ; Name
dw offset uda/10h ; uda seg
db 0,0 ; disk,user
db 0,0 ; ldisk,luser
dw 0ffffh ; mem
dw 0,0 ; dvract,wait
db 0,0 ; org,net
dw 0 ; parent
db 0,0 ; cns,abort
db 0,0 ; cin,cout
db 0,0 ; lst,sf3
db 0,0 ; sf4,sf5
dw 0,0 ; reserved
dw 0,0 ; pret,scratch
org rsp_uda
uda dw 0,offset dma,0,0 ;0-7
dw 0,0,0,0 ;8-fh
dw 0,0,0,0 ;10-17
dw 0,0,0,0 ;18-1f
dw 0,0,0,0 ;20-27
dw 0,0,0,0 ;28-2f
dw 0,0,offset stack_top,0 ;30-37
dw 0,0,0,0 ;38-3f
dw 0,0,0,0 ;40-47
dw 0,0,0,0 ;48-4f
dw 0,0,0,0 ;50-57
dw 0,0,0,0 ;58-5f
dw 0,0,0,0 ;60-67
org rsp_bottom
dma rb 128
stack dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
dw 0cccch,0cccch,0cccch
stack_top dw offset tmp ; code offset
dw unknown ; code seg
dw unknown ; init. flags
maxcmdlen equ 128
; the Read Console Buffer and the
; Cli Control Block share the same memory
read_buf rb 0
read_maxcmd db 128
clicb rb 0
clicb_net rb 0
read_blen rb 1
clicb_cmd rb maxcmdlen + 1
cmdsent db false
parseret dw 0
pcb dw offset savebuf
dw offset fcb
fcb rb 32
savebuf rb 128
;make sure hex is formed
db 0
end