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,590 @@
;*****************************************************
;*
;* Character I/0 Routines
;*
;*****************************************************
;===========
conin_entry: ;Function 1:console input
;===========
call coninit ! call attach ;verify attach
call conbrk ! call conin ;chk for ctl char pending
mov bl,dl ! call chkctl ;wait for input, chk for ctl
cmp al,0 ! je conin_entry
call echoc ! jb ciexit ;check nonprint char
call tabout ;echo character
ciexit: mov bl,dl ! ret
;============
conout_entry: ;Function 2:console output - DL = char
;============
call coninit ! call attach ;verify attach
jmp tabout ;output char
;============
rconin_entry: ; raw console input
;============
call rawinit ! call attach
conin: mov dl,c_nchar[si]
mov c_nchar[si],0
cmp dl,0 ! jne ciout
call coninf ! mov dl,bl ! ret
ciout: mov bl,dl ! ret
;=============
rconout_entry: ; raw console output - DL = char
;=============
call rawinit ! call attach
rconout:jmp conout
;=============
listout_entry: ; write to list device - DL = char
;=============
mov bx,rlr ! mov dh,p_lst[bx]
call getccbadr
push dx ! call lstattach_entry ! pop dx
sub dh,ncondev ! jmp listf
;=============
constat_entry: ;check console status
;=============
call coninit
mov di,rlr ! cmp di,c_attach[si]
je cse_cl
mov cl,f_dispatch ! call mpmif
mov bl,0 ! ret
cse_cl: call conbrk
mov bl,al ! ret
;===========
dirio_entry:
;===========
; direct console i/o - read if 0ffh
; input: DL = 0ffh if readif (ret=0 on not ready)
; = 0feh if status
; = 0fdh if read (hang until ready)
; = char if write
call rawinit ! call attach
cmp dl,0fdh ! je conin ;DL=0FDh, read
jb rconout ;output DL
call conbrk ! mov bl,al ;get status
cmp dl,0feh ! jne diocin ;DL=0FEh, return status
dec bl ! not bl ! ret
diocin: cmp bl,0 ! jne conin ;DL=0FFh, if char,conin
mov cx,f_dispatch
call mpmif
mov bl,0 ! ret
;==============
conwrite_entry: ;write line until $ encountered
;==============
; input: DX = buffer addr in u_wrkseg
mov bh,0 ! mov bl,'$'
;jmps conprint_entry
;==============
conprint_entry: ;write line until delimiter or max
;==============
; input: DX = address of buffer in u_wrkseg
; BH = max characters (0=no max)
; BL = delimiter character
push bx ! push dx
call coninit ! call attach
pop bx ! pop ax ! sub cx,cx ! and al,07fh
; AH=max, AL=delimiter, BX->buffer
; CX = count = 0
cpr1: cmp ah,cl ! jne cpr2
cmp ah,0 ! jne cpr_e
cpr2: push ds ! mov ds,u_wrkseg
mov dl,[bx] ! pop ds
and dl,07fh
cmp dl,al ! je cpr_e
push ax ! push cx ! push bx
call tabout
pop bx ! pop cx ! pop ax
inc cl ! inc bx
jmps cpr1
cpr_e: ret
;=============
conread_entry: ;read a buffered console line
;=============
; buffer=(max length, current length, buffer)
push dx ! call coninit
call attach ! pop bx
read: push bx ;[SP] = buffer offset
mov al,c_column[si]
mov c_strtcol[si],al ;start column = current column
sub bx,bx ;BX = character count
;read next character, CX, BX active
readnx: push bx
readn0: call conin ! and dl,07fh ;DL = char just read
pop bx
; Carriage Return
cmp dl,cr ! jnz notcr
eofre: jmp readen
notcr:
; Line Feed
cmp dl,lf ! jz eofre
; check for Ctrl C,Ctrl D and Ctrl S
; only if first character
or bl,bl ! jnz tryh
push bx
mov bl,dl ! call chkctl
pop bx
cmp al,1 ! je tryh
pop dx ! jmp conread_entry
tryh: ; Backspace
cmp dl,ctlh ! jnz noth
or bl,bl ! jz readnx ;if not 1st char
dec bl ! mov al,c_column[si] ;decrement char count
mov di,rlr ! mov p_scratch[di],al ;temporary hold
or c_flag[si],cf_compc ! jmp linelen
noth:
; Rubout
cmp dl,rubout ! jnz notrub
or bl,bl ! jz readnxx ;only if not 1st char
pop di ! push di
push ds ! mov ds,u_wrkseg
mov dl,1[di+bx] ! pop ds ;make char=last char
dec bx ;dec char count
jmp rdech1 ;echo, read next
readnxx: jmp readnx
notrub:
; Control E
cmp dl,ctle ! jnz note
push bx
call pcr ! mov dl,lf ! call conoutf
mov c_column[si],0
mov c_strtcol[si],0
jmp readn0
note:
; Control P
cmp dl,ctlp ! jnz notp
call control_p
jmps readnxx
notp:
; Control X
cmp dl,ctlx ! jnz notx
backx: mov al,c_strtcol[si]
cmp al,c_column[si] ! jb backxxx
sub bx,bx ! jmps readnxx
backxxx: call pbacksp ! call pspace
call pbacksp
dec c_column[si]
jmps backx
notx:
; Control U
cmp dl,ctlu ! jnz notu
call crlfp
pop bx ! jmp read
notu:
; CONTROL R - redraw line
cmp dl,ctlr ! jnz notr
linelen: push bx ! call crlfp
;print buffer on screen
pop cx ! sub bx,bx
rep0: or cl,cl ! jz rep1
pop di ! push di
push ds ! mov ds,u_wrkseg
inc bx ! dec cl
mov dl,1[di+bx] ! pop ds ;DL = nxt char
mov ch,bl ! push cx
call ctlout
pop cx ! mov bh,0 ! mov bl,ch
jmps rep0
rep1: test c_flag[si],cf_compc
push bx ! jz l_22
and c_flag[si],not cf_compc
backsp: mov di,rlr ! mov al,p_scratch[di]
sub al,c_column[si]
or al,al ! jz l_22
call pbacksp ! call pspace
call pbacksp
mov di,rlr ! dec byte ptr p_scratch[di]
jmps backsp
l_22: jmp readn0
notr:
; All other characters
rdecho: inc bx
pop di ! push di
push ds ! mov ds,u_wrkseg
mov 1[di+bx],dl ! pop ds
rdech1: push bx ! call ctlout ! pop bx
pop di ! push di
push ds ! mov ds,u_wrkseg
cmp bl,[di] ! pop ds ! jae readen
push bx ! jmps l_22
; End of Console String
readen: pop di
push ds ! mov ds,u_wrkseg
mov 1[di],bl ! pop ds
call pcr
mov c_column[si],0
ret
rawinit:
;-------
call getconnum
or p_flag[bx],pf_raw
jmps getccbadr
coninit:
;-------
call getconnum
and p_flag[bx],not pf_raw
jmps getccbadr
getconnum: ;get console number
;---------
; output: DH = console #
; DL = character (unchanged)
; BX = PD address
mov bx,rlr
mov dh,p_cns[bx]
ret
attach: ;attach to default console
;------
; output: DH = console #
; DL = character (unchanged)
; SI = CCB address
cmp c_attach[si],bx ! je attret
push dx ! push si
call conattach_entry
mov bx,rlr
test p_flag[bx],pf_ctld ! jz noattmsg
and p_flag[bx],not pf_ctld
mov dx,offset attachmsg
call prcsmsg
mov dx,rlr ! add dx,p_name
call prname
pop si ! pop dx ! call crlf
mov bx,rlr ! ret
noattmsg: pop si ! pop dx
attret: ret
getccbadr:
;---------
; get CCB for calling proc's default console
; input: DH = console number
; DL = character
; output: SI = address of ccb
; BX = PD address
; DX unchanged
mov bx,rlr
sub ax,ax ! mov al,dh
shl ax,1 ! shl ax,1
mov si,ccb ! add si,ax
add si,ax ! add si,ax ;ccb+12(ccbnum)
ret
echoc:
;-----
; check if character is graphic
; input: DL = character
; DH = console #
; SI = CCB address
; output: carry set if not graphic
; DL,DH,SI pass through
cmp dl,cr ! je ret0
cmp dl,lf ! je ret0
cmp dl,tab ! je ret0
cmp dl,ctlh ! je ret0
cmp dl,' '
ret0: ret
conbrk:
;------
; read next character, check for break
; input: DH = console #
; DL = current char
; SI -> CCB
; output: DX,SI unchanged
; AL = 0 if no character
; = 1 if character
; see if char already available
cmp c_nchar[si],0 ! jne conb_y
;char not ready, check external break
call constf
and bl,1 ! jz conb_no
;character ready, read it
call coninf
mov di,rlr ! mov ax,p_flag[di]
test p_flag[di],pf_raw ! jnz conb0
call chkctl
cmp al,0 ! je conb_no
conb0: mov c_nchar[si],bl ! jmps conb_y
conb_no: mov al,0 ! ret
conb_y: mov al,1 ! ret
chkctl:
;------
; input: bl=char to check
; return: al=0 if ctr char found
; al=1 if char is not ctrl c,d,s
; dx,si preserved
; bl preserved if al=1
mov al,1
chkd: cmp bl,ctld ! jne chks
push dx ! push si
mov bx,rlr
or p_flag[bx],pf_ctld
call condetach_entry
pop si ! pop dx
jmp chk0
chks: cmp bl,ctls ! jne chkc
control_s: call coninf
cmp bl,ctlc ! je chkc
cmp bl,ctlq ! je chk0
push dx ! mov dl,bell
call conoutf ! pop dx
jmps control_s
chkc: cmp bl,ctlc ! jne chk1
;print Abort string
chkc1: push dx ! push si
call crlf ; CR,LF
mov bx,rlr
lea dx,p_name[bx]
call prname ; Process Name
mov dx,offset abortmsg
call prcsmsg ; Abort String
pop si ! pop dx
;get answer from user
call coninf ! and bl,05fh
cmp bl,' ' ! jb ctlc_r
push dx ! push bx
mov dl,bl ! call conoutf
pop bx ! pop dx
cmp bl,'Y' ! jne ctlc_r
mov bx,rlr ! or p_flag[bx],pf_ctlc
push dx ! mov cx,f_terminate ! sub dx,dx
push si ! call mpmif ! pop si ! pop dx
ctlc_r: cmp bl,ctlc ! je chkc1
call crlf
chk0: mov al,0
chk1: ret
control_p:
;---------
push bx ! push dx ! push si
mov bx,rlr
test c_flag[si],cf_listcp
jz mimic
; turn off control p
mov dl,c_mimic[si]
call unmimic_entry ! jcxz mimout
pop si ! jmps mimpret
; turn on control p
mimic: mov dh,p_cns[bx]
mov dl,p_lst[bx]
call mimic_entry
jcxz mimout
; print 'Printer Busy'
mov dx,offset ptrmsg
call prcsmsg
pop si ! jmps mimpret
; toggle listcp for current console
mimout: pop si ! xor c_flag[si],cf_listcp
mimpret:pop dx ! pop bx ! ret
prcsmsg:
;-------
; print string in Code Segment
; input: DX->null terminated string in CS
sub bx,bx ! mov ax,cs
prstr: push u_wrkseg
mov u_wrkseg,ax
call conprint_entry
pop u_wrkseg ! ret
prname:
;------
; print name
; input: DX->8 char name in DS
mov bh,8 ! mov bl,' '
mov ax,ds ! jmps prstr
conout:
;------
; compute character position/write console
; input: DL = character
; DH = console #
; SI = ccb address
; output: DL = character
; DH = console #
; SI = ccb address
;check if only calculating column position
test c_flag[si],cf_compc ! jnz compout
;write the character, then compute column.
call conbrk ! call attach
call conoutf
; check if mimic device
cmp c_mimic[si],0ffh ! je compout
push dx ! push si
mov dh,c_mimic[si]
call getccbadr
call stdout
pop si ! pop dx
;compute column position
compout:
mov al,c_column[si]
cmp dl,rubout ! je ccret
inc al
cmp dl,' ' ! jae ccret
dec al
or al,al ! jz ccret
cmp dl,ctlh ! jnz notbs
dec al ! jmps ccret
notbs: cmp dl,cr ! jne ccret
mov al,0
ccret: mov c_column[si],al
ret
stdout:
;------
cmp dh,ncondev ! jl xcout
push dx ! sub dh,ncondev
cmp dh,nlstdev ! jl xlout
ret
xlout: call listf ! pop dx ! ret
xcout: jmp conoutf
ctlout:
;------
; send CTRL character with possible preceding up-arrow
; input: DL = character
; DH = console #
; SI = ccb address
; output: DL,DH = character,console
; SI = ccb address
call echoc ! jae tabout
push dx ! mov dl,ctl ! call conout
pop dx ! or dl,40h
; jmp tabout
tabout:
;------
; expand tabs to console
; input: DL = character
; DH = console
; SI = ccb address
; output: DL,DH = char,console
; SI = ccb address
cmp dl,tab ! jne conout
mov dl,' '
tab0: call conout
mov al,c_column[si]
and al,111b ! jnz tab0
mov dl,tab
ret2: ret
pspace:
;------
; print space
mov dl,' ' ! jmps conoutf
pbacksp:
;-------
; print backspace
mov dl,ctlh ! jmps conoutf
pcr:
;---
; print CR
mov dl,cr ! jmps conoutf
crlf:
;----
push dx ! mov dl,cr ! call conout
mov dl,lf ! call conout ! pop dx
ret
crlfp:
;-----
; print #, cr, lf for ctlx, ctlu, ctlr functions
; then print ' ' until we are at strtcol (starting column)
; input: DH = console
; SI = ccb address
; output: DH = console
; SI = ccb address
mov dl,'#' ! call conout
call crlf
mov dl,' '
crlfp0: mov al,c_column[si]
cmp al,c_strtcol[si] ! jae crlfp1
call conout ! jmps crlfp0
crlfp1: ret
;
; XIOS CHARACTER I/O INTERFACE
;
; input: DH = console #
; DL = character
; SI = ccb address
; output: DH = console #
; DL = character
; SI = ccb address
; AX = BX = return
listf: mov ax,io_list ! jmps xiolst
conoutf:mov ax,io_conout
xiolst: push dx ! mov cl,dl
mov dl,dh ! mov dh,0
call xiosc
pop dx ! ret
constf: mov ax,io_const ! jmps xio1
coninf: mov ax,io_conin
xio1: mov cl,dh
xiosc: push si ! push dx
mov ch,0 ! call xiosif
pop dx ! pop si ! ret
;
; String Constants
;
ptrmsg db cr,lf,'Printer Busy',cr,lf,0
abortmsg db ': Abort (Y/N)? ',0
attachmsg db cr,lf,'Attach: ',0


View File

@@ -0,0 +1,305 @@
;*****************************************************
;*
;* More CIO Routines
;*
;*****************************************************
;===============
lstattach_entry:
;===============
mov cx,0 ! mov si,p_lst
jmps cioattach
;===============
clstattch_entry:
;===============
mov cx,0ffffh ! mov si,p_lst
jmps cioattach
;===============
cconattch_entry:
;===============
mov cx,0ffffh ! mov si,p_cns
jmps cioattach
;===============
conattach_entry:
;===============
mov cx,0 ! mov si,p_cns
;jmps cioattach
;=========
cioattach:
;=========
; Attach calling process to default ciodev.
; if ciodev is being used, sleep on c_queue
; until another process detaches from device
; and calling process is next in queue.
; input: SI = offset of dev number in PD
; CX = 0ffffh if conditional
push si ! push cx ! mov bx,rlr
mov dh,[si+bx] ! call getccbadr
pop cx
; BX = PD addr
; SI = CCB addr
pushf ! cli
cmp bx,c_attach[si] ! je ca_ret
cmp c_attach[si],0 ! je ca_atch
cmp c_attach[si],0ffffh ! jne ca_chkslp
;This is a Mimic Device
mov dh,c_msource[si]
push cx ! push si ! call getccbadr
cmp bx,c_attach[si]
pop si ! pop cx ! je ca_ret
ca_chkslp: jcxz ca_sleep
popf ! pop si ! mov bx,0ffffh
mov cx,e_no_attach ! ret
ca_sleep: lea dx,c_queue[si]
mov p_stat[bx],ps_ciowait
mov cx,f_sleep ! call mpmif
popf ! pop si ! sub cx,cx
jmps cioattach
ca_atch: mov c_attach[si],bx
ca_ret: popf ! pop si
sub bx,bx ! mov cx,bx ! ret
;===============
lstdetach_entry:
;===============
mov si,p_lst ! jmps ciodetach
;===============
condetach_entry:
;===============
mov si,p_cns
;jmps ciodetach
;=========
ciodetach:
;=========
; Detach Calling process from default ciodev.
; If current owner of ciodev then zero c_attach
; and wakeup the c_queue list to give another
; process the ciodev.
; input: SI = offset of default dev in PD
mov bx,rlr
mov dh,[si+bx] ! call getccbadr
; SI = CCB address
; BX = PD address
pushf ! cli
cmp c_attach[si],0 ! je cd_ret
cmp c_attach[si],bx ! je cd_detach
popf ! mov bx,0ffffh
mov cx,e_not_owner ! ret
cd_detach: mov ax,c_queue[si]
mov c_attach[si],ax
mov cx,f_wakeup
lea dx,c_queue[si]
call mpmif
cd_ret: popf ! sub bx,bx
mov cx,bx ! ret
;===============
conassign_entry:
;===============
; Attach specified console to specified process
;
; input: DX -> acb address in u_wrkseg
;
; +-----+-----+-----+-----+
; | cns |match| PD addr |
; +-----+-----+-----+-----+-----+-----+-----+-----+
; | Name |
; +-----+-----+-----+-----+-----+-----+-----+-----+
;
; cns - console to assign
; match - if not 0,
; PD's default console must match acb_cns
; PD addr - PD to assign to
; name - PD name to assign to if PD addr=0
;
; return: BX = 0 if success,0ffffh if failure
; CX = Error Code
;get console #
push ds ! mov ds,u_wrkseg
mov di,dx ! mov ah,acb_cns[di] ! pop ds
;DI->ACB in u_wrkseg
;AH = console
;check if legal console
cmp ah,ncns ! jbe as_gcns
mov cx,e_ill_cns ! mov bx,0ffffh ! ret
;check if owner is passing console
as_gcns:push di ! push dx ! push ax ! mov dh,ah
call getccbadr ! pop ax ! pop dx ! pop di
mov bx,si ! mov si,rlr
; AH = console
; BX = CCB address
; SI = Calling PD address
; DI = ACB in u_wrkseg
cmp c_attach[bx],0 ! je as_own
cmp c_attach[bx],si ! je as_own
mov cx,e_not_owner ! mov bx,0ffffh ! ret
as_own:
;find pd to assign to
mov bp,bx
push ds ! mov ds,u_wrkseg
mov bx,acb_pd[di]
cmp bx,0 ! jne as_gpd
mov bx,(offset thrdrt)-p_thread
as_trya: push bp ! push ax ! push di
lea dx,acb_name[di]
mov cx,f_findpdname ! call mpmif
pop di ! pop ax ! pop bp
jcxz as_gpd
pop ds ! mov bx,0ffffh ! ret
as_gpd:
;see if pd has same default cns
; BP -> CCB
; BX -> matched pd
mov cl,acb_match[di]
pop ds
cmp cl,0 ! jz as_mok
cmp ah,p_cns[bx] ! je as_mok
push ds ! mov ds,u_wrkseg
jmps as_trya
; see if process is waiting in c_queue
; wakeup if it is
as_mok: mov si,bx ! mov bx,bp
; BP=BX = CCB
; SI = PD to assign to
mov c_attach[bx],si ! add bx,c_queue-p_link
pushf ! cli
as_nqpd:cmp p_link[bx],0 ! jz as_gexit ; cnsque
cmp p_link[bx],si ! je as_qfix
mov bx,p_link[bx] ! jmps as_nqpd
;found pd in c_queue
;take off queue and wakeup
as_qfix: mov ax,p_link[si] ! mov p_link[bx],ax
mov bx,bp ! mov bp,c_queue[bx]
mov c_queue[bx],si
mov p_link[si],bp
popf ! lea dx,c_queue[bx]
mov cx,f_wakeup ! call mpmif
jmps as_ge
as_gexit: ; console is assigned
popf
as_ge: sub cx,cx ! mov bx,cx ! ret
;=============== =====================
getdefcon_entry: ; Get Default Console
;=============== =====================
mov si,rlr
mov bh,0 ! mov bl,p_cns[si]
sub cx,cx ! ret
;=============== ==================
getdeflst_entry: ; Get Default List
;=============== ==================
mov si,rlr
mov bh,0 ! mov bl,p_lst[si]
sub bl,ncondev
sub cx,cx ! ret
;=============== =====================
setdefcon_entry: ; Set Default Console
;=============== =====================
cmp dl,ncondev ! jb sd_good
mov cx,e_ill_cns
mov bx,0ffffh ! ret
sd_good:mov si,rlr
cmp dl,p_cns[si] ! je sd_nodet
push dx ! call condetach_entry ! pop dx
sd_nodet:
mov si,rlr ! mov p_cns[si],dl
sub bx,bx ! mov cx,bx ! ret
; jmp conattach_entry ; NO AUTO ATTACH
;=============== ==================
setdeflst_entry: ; Set Default List
;=============== ==================
cmp dl,nlstdev ! jb sdl_good
mov cx,e_ill_lst
mov bx,0ffffh ! ret
sdl_good:
add dl,ncondev
mov si,rlr
cmp dl,p_lst[si] ! je sdl_nodet
push dx ! call lstdetach_entry ! pop dx
sdl_nodet:
mov si,rlr ! mov p_lst[si],dl
sub bx,bx ! mov cx,bx ! ret
; jmp lstattach_entry ; NO AUTO ATTACH
;=========== ========================
mimic_entry: ; mimic character device
;=========== ========================
; mimic a device. All character output from a source device
; will be echoed on the mimic device.
; input: DH=source
; DL=mimic device
; output: BX = 0 if successful
; BX = 0ffffh on error
; CX = Error Code
; check if source is owned
push dx ! call getccbadr
mov bx,rlr ! pop dx
pushf ! cli
cmp c_attach[si],bx ! jne mim_err
cmp c_mimic[si],0ffh ! jne mim_err
push si ! push dx ! mov dh,dl
call getccbadr ! pop dx ! pop di
cmp c_attach[si],0 ! jne mim_err
cmp c_mimic[si],0ffh ! jne mim_err
; SI->mimic CCB , DI->source CCB
mov c_attach[si],0ffffh
mov c_msource[si],dh
mov c_mimic[di],dl ! popf ! ret
mim_err:mov bx,0ffffh ! mov cx,e_no_mimic
popf ! ret
;============= ===================
unmimic_entry: ; un mimic a device
;============= ===================
; input: DL = device
mov dh,dl ! call getccbadr
pushf ! cli
cmp c_attach[si],0ffffh ! jne mim_err
push dx ! push si
mov dh,c_msource[si]
call getccbadr ! pop di ! pop dx
cmp c_mimic[si],dl ! jne mim_err
mov bx,rlr
mov c_attach[di],bx
mov c_msource[di],0ffh
mov al,c_mimic[di]
mov c_mimic[si],al
mov al,p_lst[bx]
mov p_lst[bx],dl
push ax ! push bx
call lstdetach_entry
pop bx ! pop ax ! mov p_lst[bx],al
popf ! ret


View File

@@ -0,0 +1,404 @@
;*****************************************************
;*
;* BDOS Data Area
;*
;*****************************************************
if CPM
;
; 8086 variables that must reside in code segment
;
cseg $
;
axsave dw 0 ; register saves
SS_save dw 0
SP_save dw 0
stack_begin dw endstack
;
; Variables in data segment:
;
dseg cpmsegment
org bdosoffset+bdoscodesize
header rs 128
rs 72
pag0 dw 0 ;address of user's page zero
ip0 db 0 ;initial page value for IP register
;
; memory control block
;
umembase dw 0 ;user'sbase for memory request
umemlg dw 0 ;length of memory req
contf db 0 ;flag indicates added memory is avail
;
;
hold_info dw 0 ;save info
hold_spsave dw 0 ;save user SP during program load
hold_sssave dw 0 ;save user SS during program load
mod8080 db 0
;
; byte I/O variables:
;
compcol db 0 ;true if computing column position
strtcol db 0 ;starting column position after read
column db 0 ;column position
listcp db 0 ;listing toggle
kbchar db 0 ;initial key char = 00
endif
if MPM
DSEG
org 0c00h
endif
efcb db 0e5h ;0e5=avail dir entry
rodsk dw 0 ;read only disk vector
dlog dw 0 ;logged-in disks
if MPM
RLOG DW 0 ;REMOVEABLE LOGGED-IN DISKS
TLOG DW 0 ;REMOVEABLE DISK TEST LOGIN VECTOR
NTLOG DW 0 ;NEW TLOG VECTOR
REM_DRV DB 0 ;REMOVABLE DRIVE FLAG
;1 = REMOVABLE DRIVE
;0 = PERMANENT DRIVE
endif
;The following variables are set to zero upon entry to file system
fcbdsk db 0 ;disk named in fcb
parcopfl db 0 ;true if parameter block copied
resel db 0 ;reselection flag
aret dw 0 ;adr value to return
lret equ byte ptr aret ;low(aret)
COMP_FCB_CKS DB 0 ;COMPUTE FCB CHECKSUM FLAG
SEARCH_USER0 DB 0 ;SEARCH USER 0 FOR FILE (OPEN)
MAKE_XFCB DB 0 ;MAKE & SEARCH XFCB FLAG
FIND_XFCB DB 0 ;SEARCH FIND XFCB FLAG
usrcode db 0 ;curr user num
zerolength equ (offset usrcode)-(offset fcbdsk)
if CPM
curdsk db 0 ;curr disk num
endif
SELDSK DB 0 ;SELECTED DISK NUM
info dw 0 ;info adr
srcha dw 0 ;search adr
;The Following variable order is critical
;Variables copied from UDA for MP/M X
;Variables included in FCB checksum for MP/M and CP/M X
;Variables used to access System Lock List for MP/M X
dmaad dw 0 ;dma offset 1
dmabase dw 0 ;dma base 2
FX DB 0 ;BDOS FUNCTION # 3
srchl db 0 ;search len 4
if MPM
srchaofst dw 0 ;search adr ofst 5
srchabase dw 0 ;search adr base 6
endif
dcnt dw 0 ;directory counter 7
DBLK DW 0 ;DIRECTORY BLOCK 8
ERROR_MODE DB 0 ;BDOS ERROR MODE 9
MULT_CNT DB 0 ;BDOS MULTI-SECTOR CNT 10
DF_PASSWORD RB 8 ;PROCESS DEFAULT PW 11
if MPM
PD_CNT DB 0 ;BDOS PROCESS CNT 12 1
endif
HIGH_EXT DB 0 ;FCB HIGH EXTENT BITS 2
XFCB_READ_ONLY DB 0 ;XFCB READ ONLY FLAG 3
CURDSK DB 0FFH ;CURRENT DISK 4 1
if MPM
PACKED_DCNT DB 0 ;PACKED DBLK+DCNT 2
DB 0
DB 0
PDADDR DW 0 ;PROCESS DESCRIPTOR ADDR 3
endif
; curtrka - alloca are set upon disk select
; (data must be adjacent)
cdrmaxa dw 0 ;ptr to cur dir max val
DRVLBLA dw 0 ;DRIVE LABEL DATA BYTE ADDR
buffa dw 0 ;ptr to dir dma addr
dpbaddr dw 0 ;curr disk param block addr
checka dw 0 ;curr checksum vector addr
alloca dw 0 ;curr alloc vector addr
addlist EQU 8 ;"$-buffa" = addr list size
; sectpt - offset obtained from disk parm block at dpbaddr
; (data must be adjacent)
sectpt dw 0 ;sectors per track
blkshf db 0 ;block shift factor
blkmsk db 0 ;block mask
extmsk db 0 ;extent mask
maxall dw 0 ;max alloc num
dirmax dw 0 ;max dir num
dirblk dw 0 ;reserved alloc bits for dir
chksiz dw 0 ;size of checksum vector
offsetv dw 0 ;offset tracks at beginning
endlist rs 0 ;end of list
dpblist equ (offset endlist)-(offset sectpt)
;size
; local variables
COMMON_DMA RB 16 ;COPY OF USER'S DMA 1ST 16 BYTES
XDMAAD DW OFFSET COMMON_DMA
RETURN_FFFF DB 0 ;SEL ERR FLAG FOR FXS 27 & 31
MAKE_FLAG DB 0 ;MAKE FUNCTION FLAG
FCB_EXISTS DB 0 ;FCB EXISTS FLAG (MAKE)
ACTUAL_RC DB 0 ;DIRECTORY EXT RECORD COUNT
SAVE_XFCB DB 0 ;SEARCH XFCB SAVE FLAG
SAVE_MOD DB 0 ;OPEN_REEL MODULE SAVE FIELD
SAVE_EXT DB 0 ;OPEN_REEL EXTENT SAVE FIELD
ATTRIBUTES DB 0 ;FCB INTERFACE ATTRIBUTES HOLD BYTE
if MPM
CHK_OLIST_FLAG DB 0 ;CHECK | TEST OLIST FLAG
LOCK_SP DW 0 ;LOCK STACK PTR
LOCK_SHELL DB 0 ;LOCK SHELL FLAG
CHECK_FCB_RET DB 0 ;CHECK_FCB RETURN SWITCH
LOCK_UNLOCK DB 0 ;LOCK | UNLOCK FUNCTION FLAG
INCR_PDCNT DB 0 ;INCREMENT PROCESS_CNT FLAG ??
FREE_MODE DB 0 ;FREE LOCK LIST ENTRIES FLAG ??
;1=FREE ENTRIES FOR CURDSK
;0=FREE ALL ENTRIES
CUR_POS DW 0 ;CURRENT POSITION IN LOCK LIST
PRV_POS DW 0 ;PREVIOUS POSITION IN LOCK LIST
;SDCNT, SDBLK, SDCNT0, SDBLK0 order critical
SDCNT DW 0 ;SAVED DCNT OF FILE'S 1ST FCB
SDBLK DW 0 ;SAVED DBLK OF FILE'S 1ST FCB
SDCNT0 DW 0 ;SAVED DCNT (USER 0 PASS)
SDBLK0 DW 0 ;SAVED DBLK (USER 0 PASS)
DONT_CLOSE DB 0 ;INHIBIT ACTUAL CLOSE FLAG
OPEN_CNT DB 0 ;PROCESS OPEN FILE COUNT
LOCK_CNT DB 0 ;PROCESS LOCKED RECORD COUNT
FILE_ID DW 0 ;ADDRESS OF FILE' LOCK LIST ENTRY
DELETED_FILES DB 0 ;DELETED FILES FLAG
SET_RO_FLAG DB 0 ;SET DRIVE R/O FLAG
CHECK_DISK DB 0 ;DISK RESET OPEN FILE CHECK FLAG
FLUSHED DB 0 ;LOCK LIST OPEN FILE FLUSH FLAG
;FREE_ROOT, LOCK_MAX, OPEN_MAX INITIALIZED BY SYSGEN
DW OFFSET FREE_ROOT
OPEN_ROOT DW 0 ;LOCK LIST OPEN FILE LIST ROOT
LOCK_ROOT DW 0 ;LOCK LIST LOCKED RECORD LIST ROOT
endif
if CPM
CHAIN_FLAG DB 0 ;CHAIN FLAG ??
STAMP DB 0FFH,0FFH,0FFH,0FFH ??
endif
tranv dw 0 ;adr of translate vector
fcbcopied db 0 ;true if copy$fcb called
rmf db 0 ;read mode flag for open$reel
wflag db 0 ;XIOS/BIOS write flag
dirloc db 0 ;directory flag in rename, etc.
seqio db 0 ;1 if seq i/o
linfo db 0 ;low(info)
dminx db 0 ;local for diskwrite
tinfo dw 0 ;temp for info in "make"
single db 0 ;set true if single byte
;alloc map
olddsk db 0 ;disk on entry to bdos
rcount db 0 ;record count in curr fcb
extval db 0 ;extent num and extmsk
VRECORD DB 0 ;curr virtual record
arecord dw 0 ;curr actual record
DB 0 ;CURR ACTUAL RECORD HIGH BYTE
ablock dw 0 ;curr actual block# * blkmsk
; local variables for directory access
dptr db 0 ;directory pointer 0,1,2,3
ldcnt equ byte ptr dcnt ;low(dcnt)
XDCNT DW 0 ;EMPTY DIRECTORY DCNT
XDBLK DW 0 ;EMPTY DIRECTORY DBLK
USER_ZERO_PASS DB 0 ;SEARCH USER ZERO FLAG
; SHELL VARIABLES
SHELL_SI DW 0 ;BDOS COMMAND OFFSET
SHELL_DMA DW 0 ;DMAAD SAVE AREA
SHELL_FLAG DB 0 ;PARSAVE SHELL FLAG
SHELL_RR DB 0,0,0 ;R0,R1,R2 SAVE AREA
; Special 8086 variables:
infosave dw 0 ;save for FCB adr
parametersegment dw 0 ;user parameter segment
if MPM
returnseg dw 0 ;user return segment
endif
parlg db 0 ;len of parameter block
; error messages
dskmsg db 'Bdos Err On '
dskerr db ' : ',0
permsg db 'Bad Sector',0
selmsg db 'Select',0
rofmsg db 'File '
rodmsg db 'R/O',0
XERR_LIST:
DW XE3,XE4,XE5,XE6,XE7,XE8,XE9,XE10,XE11
XE3 DB 'File Opened in Read/Only Mode'
XE4 DB 0
XE5 DB 'File Currently Open',0
XE6 DB 'Close Checksum Error',0
XE7 DB 'Password Error',0
XE8 DB 'File Already Exists',0
XE9 DB 'Illegal ? in FCB',0
XE10 DB 'Open File Limit Exceeded',0
XE11 DB 'No Room in System Lock List',0
crlfstr db 13,10,0
PR_FX DB 'Bdos Function: '
PR_FX1 DB ' '
PR_FCB DB ' File: '
PR_FCB1 RS 12
DB 0
DENIEDMSG DB 13,13,'Disk reset denied, Drive '
DENIEDDRV DB 0,':'
DB ' Console '
DENIEDCNS DB 0
DB ' Program '
DENIEDPRC DB '12345678',0
; Local buffer area:
loc_par_area rb 258 ;local user parameter (FCB,...)
if MPM
; bdos stack switch variables and stack
; used for all bdos disk functions
SAVE_SP RW 1
sssave rw 1
spsave rw 1
; 60 word BDOS 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
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
bdosstack rw 0
setdf db 0 ;flag to see if disk needs set on entry
setbf db 0 ;flag to see if dma needs set on entry
pf_keepsav dw 0 ;save pf_keep flag
mxdiskqd dw 0 ;link
db 0,0 ;net,org
dw qf_mx ;flags (MX queue)
db 'MXdisk '
dw 0,1 ;msglen,nmsgs
dw 0,0 ;nq,dq
dw 0,0 ;msgcnt,out
dw 0 ;buffer ptr
mxdiskqpb db 0 ;flgs
db 0 ;net
dw 0 ;qaddr
dw 1 ;nmsgs
dw 0 ;buffer
db 'MXdisk '
endif
if CPM
;
; Special 8086 variables:
;
ioloc db 0 ;iobyte
user_parm_seg dw 0 ;holds user parameter seg during load
nallocmem db 0 ;no. of allocated memory segments
ncrmem db 0 ;no. of available memory segments
crmem dw 0,0 ;memory table (16 elements)
dw 0,0,0,0,0,0
dw 0,0,0,0,0,0,0,0
dw 0,0,0,0,0,0,0,0
dw 0,0,0,0,0,0,0,0
;
mem_stack_length equ 40
memstack rs mem_stack_length
;8 possible allocations
stbase equ word ptr 0
stlen equ word ptr 2
ccpflag equ byte ptr 4
nccpalloc db 0 ;number of current ccp allocations
mem_stk_ptr dw 0 ;current memory stack location
stackarea rw ssize ;stack size
endstack rb 0 ;top of stack
;
endif
org 0fffh
db 0
end


View File

@@ -0,0 +1,16 @@
;*****************************************************
;*
;* System Entry Table entry format
;*
;*****************************************************
ent_mod equ byte ptr 0
ent_func equ byte ptr (ent_mod + byte)
ent_flag equ byte ptr (ent_func + byte)
entlen equ ent_flag + byte
; Flags Values in ent_flag
ef_network equ 001h ; network intercept


View File

@@ -0,0 +1,15 @@
;*****************************************************
;*
;* Format of Flag Table Entry
;*
;*****************************************************
flg_pd equ word ptr 0
flg_ignore equ byte ptr (flg_pd + word)
flglen equ flg_ignore + byte
flag_off equ 0ffffh ;flag not set
flag_on equ 0fffeh ;flag set
flag_zig equ 0ffh ;normal value


View File

@@ -0,0 +1,18 @@
;*****************************************************
;*
;* Idle Process
;*
;*****************************************************
;====
idle: ;Idle Process
;====
; Jump to the XIOS idle routine
mov ds,sysdat
mov bx,rlr
mov es,p_uda[bx]
mov ax,io_idle
jmp xiosif


View File

@@ -0,0 +1,41 @@
;*****************************************************
;*
;* PATCH AREA -- 128 bytes long
;*
;*****************************************************
patch:
nop ! nop ! nop ! nop ! nop ! nop ;00-0f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;10-1f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;20-2f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;30-3f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;40-4f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;50-5f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;60-6f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop
nop ! nop ! nop ! nop ! nop ! nop ;70-7f
nop ! nop ! nop ! nop ! nop ! nop
nop ! nop ! nop ! nop


View File

@@ -0,0 +1,57 @@
;*****************************************************
;*
;* RSP.DEF - Describes the relative offsets of
;* data items in the Data Segment of a
;* Resident System Process. GENSYS
;* links all RSP's together through the
;* rsp_link field (segment address ptrs).
;* Each RSP is started up as System
;* Initialization.
;*
;* Format:
;*
;* +---+---+---+---+---+---+---+---+
;* 00 | link |sdatvar|ncp| reserved |
;* +---+---+---+---+---+---+---+---+
;* 08 | reserved | CS |reserve|
;* +---+---+---+---+---+---+---+---+
;* 10 | Process Descriptor |
;* +---+---+---+---+---+---+---+---+
;* +---+---+---+---+---+---+---+---+
;* 40 | User Data Area |
;* +---+---+---+---+---+---+---+---+
;* +---+---+---+---+---+---+---+---+
;* E0 | RSP data area |
;* +---+---+---+---+---+---+---+---+
;*
;* link - GENSYS links all RSP's through this.
;* At system init, this value is filled
;* with the SYSDAT segment address
;*
;* sdatvar - if non-zero, this is a variable address
;* in the SYSDAT area which indicates the
;* a value to put into ncopies (ncp).
;*
;* ncp - Number of copies - Used by GENSYS to determine
;* how many copies of this RSP to generate.
;* This number is modified to be the specific
;* copy that was generated.
;*
;* CS - Used by GENSYS to determine where a shared
;* code segment may exist in multiple copy
;* RSPs.
;*
;*****************************************************
rsp_top equ 0
rsp_link equ word ptr rsp_top
rsp_sysdat equ rsp_link
rsp_sdatvar equ word ptr rsp_link + word
rsp_ncopies equ byte ptr rsp_sdatvar + word
rsp_reserved equ rsp_ncopies + byte
rsp_md equ 08h
rsp_pd equ 10h
rsp_uda equ ((rsp_pd+pdlen+0fh)/10h)*10h
rsp_bottom equ rsp_uda + ulen


View File

@@ -0,0 +1,26 @@
;*****************************************************
;*
;* Interrupt Vectors - to fiddle with the interrupt
;* vectors, set the Data Segment Register to 0
;* and use the following variables.
;*
;*****************************************************
DSEG
i_divide_ip rw 1 ; int 0
i_divide_cs rw 1
i_trace_ip rw 1 ; int 1
i_trace_cs rw 1
i_nomask_ip rw 1 ; int 2
i_nomask_cs rw 1
i_break_ip rw 1 ; int 3
i_break_cs rw 1
i_ovrflw_ip rw 1 ; int 4
i_ovrflw_cs rw 1
i_interrupts rw ((mpmint-5)*2)
i_mpm_ip rw 1
i_mpm_cs rw 1
i_debug_ip rw 1
i_debug_cs rw 1