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,15 @@
era resbdos.asm
pip resbdos.asm=resbdos1.asm,conbdos.asm
rmac resbdos
era resbdos.asm
xref resbdos
vax resbdos.xrf $$stan
link resbdos[os]
era bnkbdos.asm
pip bnkbdos.asm=bnkbdos1.asm,bdos30.asm
rmac bnkbdos
era bnkbdos.asm
xref bnkbdos
vax bnkbdos.xrf $$stan
link bnkbdos[os]


File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,288 @@
title 'Non-Resident Portion of Banked BDOS'
cseg
;***************************************************************
;***************************************************************
;** **
;** B a s i c D i s k O p e r a t i n g S y s t e m **
;** **
;** N o n - R e s i d e n t P o r t i o n **
;** B a n k e d B D O S **
;** **
;***************************************************************
;***************************************************************
;/*
; Copyright (C) 1978,1979,1980,1981
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 14 Sept 81 by David K. Brown
;*/
on equ 0ffffh
off equ 00000h
MPM EQU ON
MPMENV EQU ON
BNKBDOS EQU ON
ctlc equ 03h ;control-c
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
;
; BDOS call equates
dskinit equ 13
dskslct equ 14
dsksetDMA equ 26
setusercode equ 32
;
; Process Descriptor Offsets
pname equ 6
console equ 14
memseg equ 15
thread equ 18
disksetDMA equ 20
diskselect equ 22
diskparams equ 23
MULT$CNT$OFF EQU 50
PD$CNT$OFF EQU 51
;
; System Data Page Offsets
userstackflag equ 3
brkvctr equ 48
usrstkregion equ 80
;
;
; MP/M Data Page Offsets
rlros equ 5
thrdrt equ 17
msegtbl equ 150
;
;**************************************************
;* *
;**************************************************
;
org 0000h
base equ $
jmp bnkbdose
JMP BNKBDOSINIT
JMP REMOVE$FILES
XDMAAD: DW $-$
SYSDAT: DW $-$
BUFFA: DW $-$
bnkbdosinit:
pop h! push h! inx h! inx h! inx h
lxi d,extjmptbl! mvi c,24! xchg
CALL MOVE
;INITIALIZE OPEN FILE AND LOCKED RECORD LIST
LHLD SYSDAT! MVI L,187
MOV A,M! STA LOCK$MAX! INX H
MOV A,M! STA OPEN$MAX
INX H! MOV E,M! INX H! MOV D,M! INX H
PUSH D
MOV E,M! INX H! MOV D,M! XCHG! SHLD FREE$ROOT
POP D! DCX D! LXI B,10
ILIST:
PUSH D
MOV D,H! MOV E,L! DAD B! XCHG
MOV M,E! INX H! MOV M,D! XCHG
POP D! DCX D! MOV A,D! ORA E! JNZ ILIST
MOV M,A! DCX H! MOV M,A! RET
extjmptbl:
reboot: jmp $-$
rlr: jmp $-$
rlradr: jmp $-$
dsplynm: jmp $-$
xprint: jmp $-$
xcrlf: jmp $-$
conoutx: jmp $-$
getmemseg: jmp $-$
;
;************************************************
;* *
;************************************************
;
bnkbdose:
push d! push b
LXI H,DELETED$FILES
DI
MOV A,M! ORA A! MVI M,0
EI
CNZ DELETE$FILES
;perform the necessary BDOS parameter initialization
;disk set DMA
call rlr! SHLD PDADDR
lxi b,disksetDMA! dad b
mov e,m! inx h! mov d,m! push h! xchg! shld dmaad
mov b,h! mov c,l! call setdmaf
;disk select
pop h! inx h
mov a,m! rrc! rrc! rrc! rrc! ani 0fh! STA SELDSK
;set user code
mov a,m! ani 0fh! STA USRCODE
;copy local disk params
inx h! push h! lxi d,dcnt
XCHG! MVI C,2! CALL MOVE
LXI H,SEARCHL! LDAX D! MOV M,A
LXI H,MULT$CNT$OFF-DISKPARAMS-2! DAD D
MOV A,M! STA MULT$CNT
INX H! MOV A,M! ANI 0F0H! CMP M! JZ BNKBDOS1
ADI 10H! MOV M,A
BNKBDOS1:
STA PDCNT
;perform requested BDOS function
pop h! pop b! pop d! push h
call bdose
;save results
pop d! push h ; save results in HL
;copy disk params
lxi h,dcnt
XCHG! MVI C,2! CALL MOVE
LXI D,SEARCHL! LDAX D! MOV M,A
;return to non-banked bdos, will restore calling bank
; and release disk mutual exclusion message
pop h! ret
bdose:
xchg! shld info! xchg ;save parameter
mov a,e! sta linfo ;linfo = low(info) - don't equ
lxi h,0! shld aret ;return value defaults to 0000
SHLD RESEL ; RESEL,FCBDSK = 0
SHLD COMP$FCB$CKS ; COMP$FCB$CKS,SEARCH$USER0 = 0
SHLD MAKE$XFCB ; MAKE$XFCB,FIND$XFCB = 0
DAD SP! SHLD ENTSP ; SAVE STACK POSITION
lxi h,goback! push h ;fake return address
;compute disk function code address
mov a,c! STA FX! mov c,e! mov b,d
CPI NFUNCS+12! JNC HIGH$FXS
LXI H,DISKF-24! JMP BDOS$JMP
HIGH$FXS:
LXI H,XDISKF-200
BDOS$JMP:
mov e,a! mvi d,0 ;DE=func, HL=.diskf-24
dad d! dad d! mov e,m! inx h! mov d,m ;DE=functab(func)
LHLD INFO ;INFO IN DE FOR LATER EXCHANGE
xchg! pchl ;dispatched
;
; dispatch table for disk functions
diskf:
dw func12,func13,func14,func15
dw func16,func17,func18,func19
dw func20,func21,func22,func23
dw func24,func25,func26,func27
dw func28,func29,func30,func31
dw func32,func33,func34,func35
dw func36,func37,func38,func39
DW FUNC40,FUNC41,FUNC42,FUNC43
DW FUNC44,FUNC45,FUNC46,FUNC47
DW FUNC48,FUNC49,FUNC50
nfuncs equ ($-diskf)/2
XDISKF:
DW FUNC100,FUNC101,FUNC102,FUNC103
DW FUNC104,FUNC105,FUNC106,FUNC107
PERERR: DW PERSUB ;PERMANENT ERROR SUBROUTINE
RODERR: DW RODSUB ;RO DISK ERROR SUBROUTINE
ROFERR: DW ROFSUB ;RO FILE ERROR SUBROUTINE
SELERR: DW SELSUB ;SELECT ERROR SUBROUTINE
;
; error subroutines
PERSUB:
;report permanent error
lxi h,permsg! jmp report$err ;to report the error
;
SELSUB:
;report select error
lxi h,selmsg! jmp report$err ;wait console before boot
;
RODSUB:
;report write to read/only disk
lxi h,rodmsg! jmp report$err ;wait console
;
ROFSUB:
;report read/only file
lxi h,rofmsg ;drop through to wait for console
;
report$err:
;report error to console, message address in HL
push h ;stack msg address
;set D=console #
call rlr! lxi d,console! dad d! mov d,m
call xcrlf ;new line
LDA SELDSK! adi 'A'! sta dskerr ;current disk name
lxi b,dskmsg! call xprint ;the error message
pop b! call xprint ;error mssage tail
lda fx! mvi b,30h
lxi h,pr$fx1
cpi 100! jc rpt$err1
mvi m,31h! inx h! sui 100
rpt$err1:
sui 10! jc rpt$err2
inr b! jmp rpt$err1
rpt$err2:
mov m,b! inx h! adi 3ah! mov m,a
inx h! mvi m,20h
lxi h,pr$fcb! mvi m,0
lda resel! ora a! jz rpt$err3
mvi m,20h! push d
lhld info! inx h! xchg! lxi h,pr$fcb1
mvi c,8! call move! mvi m,'.'! inx h
mvi c,3! call move! pop d
rpt$err3:
call xcrlf
lxi b,pr$fx! call xprint
CALL GET$MEM$SEG
ORA A! JZ RTN$PHY$ERRS
INR A! JZ RTN$PHY$ERRS
LXI D,PNAME+5! CALL TEST$ERROR$MODE1! JNZ RTN$PHY$ERRS
jmp reboot ;terminate process
;ret
xerr$list:
dw xe3,xe4,xe5,xe6,xe7,xe8,xe9,xe10,xe11
xe3: db 'File Opened in Read/Only Mode',0
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
pr$fx: db 'Bdos Function: '
pr$fx1: db ' '
pr$fcb: db ' File: '
pr$fcb1:ds 12
db 0
fx: ds 1


View File

@@ -0,0 +1,674 @@
;***************************************************************
;***************************************************************
;** **
;** B a s i c D i s k O p e r a t i n g S y s t e m **
;** **
;** C o n s o l e P o r t i o n **
;** **
;***************************************************************
;***************************************************************
cnsfunc:
mov a,c! mov c,e! mov b,d
lxi h,functab! mov e,a! mvi d,0 ;DE=func, HL=.functab
dad d! dad d! mov e,m! inx h! mov d,m ;DE=functab(func)
xchg! pchl ;dispatched
;
; dispatch table for functions
functab:
dw bootf,func1,func2,func3
dw func4,func5,func6,func7
dw cmnret,func9,func10,func11
diskf equ ($-functab)/2
nfuncs equ 41 ;must match with banked bdos # fns
;
func1:
;return console character with echo
call conech
mov l,a! ret
;
func2:
;write console character with tab expansion
call attcns! jmp tabout
;
func3:
;return raw unattached console character
call rawattcns
jmp dirinp
;
func4:
;write raw unattached console character
call rawattcns
jmp conoutf
;
func5:
;write list character
call testlstatt
;write to list device if already attached
jz listf
;else must attach list device first
push b! push d
mvi c,attlst! call xdos
pop d! pop b
jmp listf
;
func6:
;direct console i/o - 0ffh = read/status
; 0feh = status
; 0fdh = read
call rawattcns
mov a,c! inr a! jz stsdirinp
inr a! jz stsinp
inr a! jz dirinp
;direct output function
jmp conoutf
stsdirinp:
push d! call constf! pop d
ora a! jnz dirinp
mvi c,dispatch! call xdos
xra a! mov l,a! ret
stsinp:
;direct console status input
call constf ;to A
mov l,a! ret
dirinp:
lxi h,kbchar! call ofsthl
mov a,m! mvi m,0! ora a
cz coninf ;to A
mov l,a! ret
;
func7:
;return io byte
;*** Not implemented in MP/M ***
xra a
mov l,a! ret
;
;func8:
;set i/o byte
;*** Not implemented in MP/M ***
;ret
;
func9:
;write line until $ encountered
;BC = string address
call attcns! jmp print ;out to console
;
func10:
;read a buffered console line
call attcns! jmp read
;
func11:
;check console status
call testcnsatt
jz doconbrk
mvi c,dispatch! call xdos
xra a! mov l,a! ret
doconbrk:
call conbrk
mov l,a
;
cmnret:
ret
;
tstlivekbd:
;test for simulated 'live keyboard'
;pd.name(3)' = off
call rlr! lxi b,pname+3! dad b! mov a,m! ani 80h
ret
;
testlstatt:
;test to determine if list is attached
;Zero = attached, D = List #
di
call rlr! xchg ;DE = Ready List Root
lxi h,console! dad d! mov a,m! ani 0f0h
rrc! rrc! rrc! rrc! push psw! push b
lxi b,lstatt-rlros! jmp attcmn
;ret
;
testcnsatt:
;test to determine if console is attached
;Zero = attached, D = Console #
di
call rlr! xchg ;DE = Ready List Root
lxi h,console! dad d! mov a,m! ani 0fh
push psw! push b
lxi b,cnsatt-rlros
attcmn:
lhld rlradr! dad b
add a! mov c,a! mvi b,0! dad b
mov a,m! cmp e! inx h! jnz notatt
mov a,m! cmp d! jz testext
notatt:
mov a,m! dcx h! ora m! jnz testext
mov m,e! inx h! mov m,d! xra a ;attach ok
testext:
ei! pop b! pop d
mvi e,0 ;cns req'd flag false
ret
;
rawattcns:
push b! mvi b,80h! jmp attcns0
attcns:
push b! mvi b,0
attcns0:
call rlr
inx h! inx h! inx h! inx h! inx h! inx h
mov a,m! ani 7fh! ora b! mov m,a ;set/reset direct i/o
inx h! inx h! inx h
mov a,m! ani 7fh! ora b! mov m,a ;set/reset simul. live kbd
pop b
;attach console if req'd
call testcnsatt
mvi e,0ffh! rz ;cns req'd flag true
push b! push d!
mvi c,attach! call xdos
pop d! push d ;restore DE
call dsplyatchmsg
pop d! pop b
ret
;
ofsthl:
;offset HL by console # (in D)
push psw
mov a,d! add l! mov l,a
mvi a,0! adc h! mov h,a
pop psw
ret
;
; console handlers
constx:
push d! call constf! pop d! ret
coninx:
;returns char & cond code = NZ if raw input
push d! call rlr! lxi d,pname! dad d
pop d! push d! ;restore console #
mov a,m! ani 80h! push psw
call coninf
mov b,a! pop psw! mov a,b
pop d! ret
conoutx:
mov a,c! ani 7fh! mov c,a
push d! call conoutf! pop d! ret
conin:
;read console character to A
;attach console first
call attcns
lxi h,kbchar! call ofsthl
mov a,m! mvi m,0! ora a! rnz
;no previous keyboard character ready
call getchr ;get character externally and test it
jmp conin ;only exit is with kbchar <> 0
;ret
;
conech:
;read character with echo
call conin! call echoc! rc ;echo character?
;character must be echoed before return
push psw! mov c,a! call tabout! pop psw
ret ;with character in A
;
echoc:
;echo character if graphic
;cr, lf, tab, or backspace
cpi cr! rz ;carriage return?
cpi lf! rz ;line feed?
cpi tab! rz ;tab?
cpi ctlh! rz ;backspace?
cpi ' '! ret ;carry set if not graphic
;
conbrk: ;check for character ready
call constx! ani 1
lxi h,kbchar! call ofsthl
jnz pgetchr ;jump if char to be read in
mov a,m! ora a! rz ;return if no char in kbchar either
jmp conb1 ;active kbchar
pgetchr:
mvi m,0 ;clear kbchar to prepare for new char
;character ready, read it
getchr: ;entry point used by conin
call coninx ;to A
jnz conb0; skip char testing if pd.pname.f0 is "on"
cpi ctls! jnz notcts ;check stop screen function
;found ctls, read next character
getctlq:
call coninx ;to A
cpi ctlc! jz controlc ;ctlc implies re-boot
cpi ctlq! jz gotctlq
mvi c,7! call conoutx ;send bell character
jmp getctlq
gotctlq:
;resume after ^Q
xra a! ret ;with zero in accumulator
notcts:
;not a control s, control q?
cpi ctlq! jz gotctlq
;ignore control Q's
notctq:
;not a control s, control d?
cpi ctld! jnz notctd
;found ctld, detach console
;^D is ignored if submit in progress
lhld sysdat! mvi l,128! call ofsthl
mov a,m! ora a! mvi a,0! rnz
push d! lxi h,listcp! call ofsthl
;if ^D and ^P then detach list
mov a,m! ora a! jz notctlp
mvi c,detlst! call XDOS
notctlp:
mvi c,detach! call XDOS
;then attach console back
; unless cns not req'd
pop d! mov a,e! ora a
rz! push d ;return if cns not req'd
mvi c,attach! call XDOS! pop d
dsplyatchmsg:
;print console attach message
lxi b,atchmsg! call xprint
call rlr
dsplynm:
call pdsplynm
xcrlf:
;output crlf without CONBRK calls
mvi c,cr! call conoutx
mvi c,lf! call conoutx
xra a! ret ;with zero in A
pdsplynm:
lxi b,pname! dad b! mvi e,8
dsploop:
mov c,m! push h! push d! call conoutx
pop d! pop h! inx h! dcr e
jnz dsploop
inr e ;cns req'd set true
ret
notctd:
;not a control d, control c?
cpi ctlc! jnz conb0
controlc: ;entry point
lhld sysdat! mvi l,128! call ofsthl
mov a,m! ora a! jz ctlcnt
push h! lxi b,submsg! call query
pop h! jnz ctlcnt
mvi m,0
ctlcnt:
;test for suppress abort flag
call rlr! lxi b,(pname+7)! dad b
mov a,m! ani 80h! jz notctlcsupr
dcx h! mov a,m! ori 80h! mov m,a
xra a! ret
notctlcsupr:
;test to see if this is a user process
inx h! inx h
mov a,m! ora a! rz
inr a! rz ;ignore ^C if system process running
;print Abort (Y/N) ?
lxi b,abtmsg1! call xprint
call rlr! call pdsplynm
lxi b,abtmsg2! call query! jz xreboot
xra a! ret ;with zero in A
conb0:
;character in accum, save it
lxi h,kbchar! call ofsthl! mov m,a
conb1:
;return with true set in accumulator
mvi a,1! ret
;
query:
call xprint
eatctlc:
call coninx! ani 7fh
cpi ctlc! jz eatctlc! push psw
mov c,a! call conoutx
mvi c,cr! call conoutx
mvi c,lf! call conoutx
pop psw
ani 5fh! cpi 'Y'
ret
;
conout:
;compute character position/write console char from C
;compcol = true if computing column position
lxi h,compcol! call ofsthl
mov a,m! ora a! jnz compout
;write the character, then compute the column
;write console character from C
push b! call conoutx ;externally, to console
call tstlivekbd ;conbrk only if simulated 'live kbd'
cz conbrk ;check for screen stop function
pop b! push b! push d ;recall/save character & con #
;may be copying to the list device
lxi h,listcp! call ofsthl
mov a,m! ani 01h! cnz func5 ;to printer, if so
pop d! pop b ;recall the character & con #
compout:
mov a,c ;recall the character
;and compute column position
lxi h,column! call ofsthl ;A = char, HL = .column
cpi rubout! rz ;no column change if nulls
inr m ;column = column + 1
cpi ' '! rnc ;return if graphic
;not graphic, reset column position
dcr m ;column = column - 1
mov a,m! ora a! rz ;return if at zero
;not at zero, may be backspace or end line
mov a,c ;character back to A
cpi ctlh! jnz notbacksp
;backspace character
dcr m ;column = column - 1
ret
notbacksp:
;not a backspace character, eol?
cpi lf! rnz ;return if not
;end of line, column = 0
mvi m,0 ;column = 0
ret
;
ctlout:
;send C character with possible preceding up-arrow
mov a,c! call echoc ;cy if not graphic (or special case)
jnc tabout ;skip if graphic, tab, cr, lf, or ctlh
;send preceding up arrow
push psw! mvi c,ctl! call conout ;up arrow
pop psw! ori 40h ;becomes graphic letter
mov c,a ;ready to print
;(drop through to tabout)
;
tabout:
;expand tabs to console
mov a,c! cpi tab! jnz conout ;direct to conout if not
;tab encountered, move to next tab position
tab0:
mvi c,' '! call conout ;another blank
call ldacolumn! ani 111b ;column mod 8 = 0 ?
jnz tab0 ;back for another if not
ret
;
backup:
;back-up one screen position
call pctlh! mvi c,' '! call conoutx ;jmp pctlh
;
pctlh:
;send ctlh to console without affecting column count
mvi c,ctlh! jmp conoutx
;ret
;
crlfp:
;print #, cr, lf for ctlx, ctlu, ctlr functions
;then move to strtcol (starting column)
mvi c,'#'! call conout
call crlf
;column = 0, move to position strtcol
crlfp0:
call ldacolumn! lxi h,strtcol! call ofsthl
cmp m! rnc ;stop when column reaches strtcol
mvi c,' '! call conout ;print blank
jmp crlfp0
;;
;
crlf:
;carriage return line feed sequence
mvi c,cr! call conout! mvi c,lf! jmp conout
;ret
;
xprint:
;print routine which does not CONBRK
;BC = string address, string terminated with a '$'
ldax b! ORA A! rz
push b! mov c,a! call conoutx! pop b
inx b! jmp xprint
;
print:
;print message until M(BC) = '$'
ldax b! cpi '$'! rz ;stop on $
;more to print
inx b! push b! mov c,a ;char to C
call tabout ;another character printed
pop b! jmp print
;
pread: ;entry to read, restores buffer address
pop b
read: ;BC = address (max length, current length, buffer)
push b ;save buffer address for possible ^X or ^U
call ldacolumn
lxi h,strtcol! call ofsthl
mov m,a ;save start for ctl-x, ctl-h
mov h,b! mov l,c! mov c,m! inx h! push h! mvi b,0
;B = current buffer length,
;C = maximum buffer length,
;HL= next to fill - 1
readnx:
;read next character, BC, HL active
push b! push h ;blen, cmax, HL saved
readn0:
call conin ;next char in A
ani 7fh ;mask parity bit
pop h! pop b ;reactivate counters
cpi cr! jz readen ;end of line?
cpi lf! jz readen ;also end of line
cpi ctlh! jnz noth ;backspace?
;do we have any characters to back over?
mov a,b! ora a! jz readnx
;characters remain in buffer, backup one
dcr b ;remove one character
call ldacolumn
lxi h,compcol! call ofsthl
mov m,a ;col > 0
;compcol > 0 marks repeat as length compute
jmp linelen ;uses same code as repeat
noth:
;not a backspace
cpi rubout! jnz notrub ;rubout char?
;rubout encountered, rubout if possible
mov a,b! ora a! jz readnx ;skip if len=0
;buffer has characters, resend last char
mov a,m! dcr b! dcx h ;A = last char
;blen=blen-1, next to fill - 1 decremented
jmp rdech1 ;act like this is an echo
;
notrub:
;not a rubout character, check end line
cpi ctle! jnz note ;physical end line?
;yes, save active counters and force eol
push b! push h! call crlf
lxi h,strtcol! call ofsthl
xra a! mov m,a ;start position = 00
jmp readn0 ;for another character
note:
;not end of line, list toggle?
cpi ctlp! jnz notp ;skip if not ctlp
lda kbproc! ora a! jnz notp
;list toggle - change parity
push h ;save next to fill - 1
push b! push d
lxi h,listcp! call ofsthl ;HL=.listcp flag
mvi a,01h! xra m! mov m,a ;listcp=-listcp
push h ;save address of listcp
jnz prntron ; jump if printer to be turned on
prntroff:
;return list mutex queue message
mvi m,0! ;zero listcp(console)
mvi c,detlst! call XDOS
pop h! jmp ctlpxit
prntron:
call testlstatt
pop h! jz ctlpxit
;printer busy, could not ^p
mvi m,0! lxi b,pbsymsg
;D = console #
pop d! push d
call xprint
ctlpxit:
pop d! pop b
pop h! jmp readnx ;for another char
notp:
;not a ctlp, line delete?
cpi ctlx! jnz notx
pop h ;discard start position
;loop while column > strtcol
backx:
lxi h,strtcol! call ofsthl
mov a,m! lxi h,column! call ofsthl
cmp m! jnc pread ;start again
dcr m ;column = column - 1
call backup ;one position
jmp backx
notx:
;not a control x, control u?
cpi ctlu! jnz notu ;skip if not
;delete line (ctlu)
call crlfp ;physical eol
pop h ;discard starting position
jmp pread ;to start all over
notu:
;not line delete, repeat line?
cpi ctlr! jnz notr
linelen:
;repeat line, or compute line len (ctlh)
;if compcol > 0
push b! call crlfp ;save line length
pop b! pop h! push h! push b
;bcur, cmax active, beginning buff at HL
rep0:
mov a,b! ora a! jz rep1 ;count len to 00
inx h! mov c,m ;next to print
dcr b! push b! push h ;count length down
call ctlout ;character echoed
pop h! pop b ;recall remaining count
jmp rep0 ;for the next character
rep1:
;end of repeat, recall lengths
;original BC still remains pushed
push h ;save next to fill
lxi h,compcol! call ofsthl
mov a,m! ora a ;>0 if computing length
jz readn0 ;for another char if so
;column position computed for ctlh
lxi h,column! call ofsthl! sub m ;diff > 0
lxi h,compcol! call ofsthl
mov m,a ;count down below
;move back compcol-column spaces
backsp:
;move back one more space
call backup ;one space
lxi h,compcol! call ofsthl! dcr m
jnz backsp
jmp readn0 ;for next character
notr:
;not a ctlr, place into buffer
rdecho:
inx h! mov m,a ;character filled to mem
inr b ;blen = blen + 1
rdech1:
;look for a random control character
push b! push h ;active values saved
mov c,a ;ready to print
call ctlout ;may be up-arrow C
pop h! pop b! mov a,b ;len to A
;are we at end of buffer?
cmp c! jc readnx ;go for another if not
readen:
;end of read operation, store blen
pop h! mov m,b ;M(current len) = B
pop h ;discard buffer address
mvi c,cr! jmp conout ;return carriage
;ret
;
ldacolumn:
lxi h,column! call ofsthl! mov a,m! ret
pbsymsg:
db cr,lf,'Printer Busy.',cr,lf,0
abtmsg1:
db cr,lf,'Abort ',0
abtmsg2:
db ' (Y/N) ?',0
atchmsg:
db cr,lf,'Attach:',0
submsg:
db cr,lf,'Terminate Submit ?',0
;
; data areas
;
nmbcns equ 16
compcol:db 0 ;true if computing column position
rept nmbcns-1
db 0
endm
strtcol:db 0 ;starting column position after read
rept nmbcns-1
db 0
endm
column: db 0 ;column position
rept nmbcns-1
db 0
endm
kbchar: db 0 ;initial key char = 00
rept nmbcns-1
db 0
endm
listcp: db 0 ;listing toggle
rept nmbcns-1
db 0
endm
kbproc: db 0 ;kb proc resident flag
;
patch$size equ 80
ds patch$size
patch:
org (((patch-base)+255) AND 0ff00h)-patch$size
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
dw 0,0,0,0,0,0,0,0
;
; bios external jump table
;
bios equ $ ;base of the bios jump table
bootf equ bios ;cold boot function
wbootf equ bootf+3 ;warm boot function
constf equ wbootf+3 ;console status function
coninf equ constf+3 ;console input function
conoutf equ coninf+3 ;console output function
listf equ conoutf+3 ;list output function
punchf equ listf+3 ;punch output function
readerf equ punchf+3 ;reader input function
homef equ readerf+3 ;disk home function
seldskf equ homef+3 ;select disk function
settrkf equ seldskf+3 ;set track function
setsecf equ settrkf+3 ;set sector function
setdmaf equ setsecf+3 ;set dma function
readf equ setdmaf+3 ;read disk function
writef equ readf+3 ;write disk function
liststf equ writef+3 ;list status function
sectran equ liststf+3 ;sector translate
;
; xios access table
xiosms equ sectran+3 ;memory select / protect
xiospl equ xiosms+3 ;device poll
strclk equ xiospl+3 ;start clock
stpclk equ strclk+3 ;stop clock
exitr equ stpclk+3 ;exit critical region
maxcns equ exitr+3 ;max console #
syinitf equ maxcns+3 ;MP/M system initialization
;
end


View File

@@ -0,0 +1,772 @@
title 'MP/M II V2.0 Resident Portion of Banked BDOS'
cseg
;***************************************************************
;***************************************************************
;** **
;** B a s i c D i s k O p e r a t i n g S y s t e m **
;** **
;** R e s i d e n t P o r t i o n - B a n k e d B D O S **
;** **
;***************************************************************
;***************************************************************
;/*
; Copyright (C) 1978,1979,1980,1981
; Digital Research
; P.O. Box 579
; Pacific Grove, CA 93950
;
; Revised:
; 14 Sept 81 by David K. Brown
;*/
;
org 0000h
base equ $
;
; XDOS jump table below BDOS origin
pdisp equ $-3
xdos equ pdisp-3
; equates for non graphic characters
ctlc equ 03h ;control c, abort
ctld equ 04h ;control d, detach
ctle equ 05h ;physical eol
ctlh equ 08h ;backspace
ctlp equ 10h ;prnt toggle
ctlq equ 11h ;prnt owner toggle
ctlr equ 12h ;repeat line
ctls equ 13h ;stop/start screen
ctlu equ 15h ;line delete
ctlx equ 18h ;=ctl-u
ctlz equ 1ah ;end of file
rubout equ 7fh ;char delete
tab equ 09h ;tab char
cr equ 0dh ;carriage return
lf equ 0ah ;line feed
ctl equ 5eh ;up arrow
;
; XDOS call equates
makeque equ 134
readque equ 137
writeque equ 139
dispatch equ 142
terminate equ 143
setprior equ 145
attach equ 146
detach equ 147
asgncns equ 149
sendcli equ 150
ATTLST EQU 158
DETLST EQU 159
;
; Process Descriptor Offsets
pname equ 6
console equ 14
memseg equ 15
disksetDMA equ 20
diskselect equ 22
searcha equ 26
MULT$CNT EQU 50
;
; System Data Page Offsets
userstackflag equ 3
brkvctr equ 48
usrstkregion equ 80
LISTCPADR EQU 126
;
; MP/M Data Page Offsets
rlros equ 5
cnsatt equ 20
msegtbl equ 150
LSTATT EQU 599
;
;*****
;
; enter here from the user's program with function number
; in c, and information address in d,e
jmp xbdos ;to xbdos handler
jmp bios ;to bios jump table base address
JMP SYINIT
JMP REMOVE$FILES
JMP SWITCH$USER
JMP SWITCH$ZERO
XREMOVE$FILES:
JMP $-$
;
; bdos/xdos initialization code
syinit:
;HL = sysdat page address
shld sysdat
mvi l,14! lxi b,bnkbdos+1
mov a,m! mov d,a! stax b
xchg! mvi l,3
shld bnkbdosinit
MVI L,6! SHLD XREMOVE$FILES+1
MVI L,9! LXI D,COMMON$DMA
MOV M,E! INX H! MOV M,D! INX H
XCHG! LHLD SYSDAT! XCHG
MOV M,E! INX H! MOV M,D
INX H! PUSH H
bnkbdosinit equ $+1
call $-$ ;initialize the banked bdos
jmp syinitcontd
extjmptbl:
jmp extreboot
jmp rlr
jmp getrlradr
jmp dsplynm
jmp xprint
jmp xcrlf
jmp conoutx
jmp xgetmemseg
;
syinitcontd:
lhld sysdat! mov c,h
MVI L,LISTCPADR! LXI D,LISTCP ;PUT .LISTCP IN SYS DTA PG
MOV M,E! INX H! MOV M,D
mvi l,252! mov a,m! inx h! mov h,m
mov l,a! lxi d,0005! dad d! shld rlradr
lxi d,0091h! dad d! shld msegtadr
mov h,c! mvi l,userstackflag
mov a,m! sta usrstkflg
dcr l! mov l,m! mvi h,0 ;HL = RST #
mov c,l ;put RST # into C for use by SYSINITF
dad h! dad h! dad h ;HL = breakpoint address
mvi m,0C3h! inx h ;store jump to brkpt hndlr
lxi d,brkpt ;DE = brkpt entry address
mov m,e! inx h! mov m,d
;initialize jmp at 0000H to fake BIOS jump table
mvi a,0C3H! sta 0000H
lxi h,drctjmptbl! shld 0001H
;execute the XIOS SYSINIT function
call syinitf
ei ;in case it was not done in sysinit
;create disk mutual exclusion queue
mvi c,makeque! lxi d,diskcqcb! call xdos
mvi c,writeque! lxi d,MXDisk! call xdos
;create printer mutual exclusion queue
mvi c,makeque! lxi d,listcqcb! call xdos
;INHIBIT MXList EXCLUSION
LXI H,0FFFFH! SHLD LISTNMSGS! SHLD LISTMSGCNT
;get the directory buffer address
mvi c,0! call seldskf
lxi d,8! dad d! mov e,m! inx h! mov d,m
JMP SYINITEXTRA
;
CoNm:
db ' COPYRIGHT (C) 1981,'
db ' DIGITAL RESEARCH '
Serial:
db '654321'
lstack equ Serial+4
entsp equ lstack ;BDOS entry stack pointer
dtbl equ $
org ((dtbl-base)+0ffh) and 0ff00h
; *** this table is page aligned
; BIOS jump table for *.COM file support
jmp bootf
drctjmptbl:
jmp wbootf
jmp bconst
jmp bconin
jmp bconout
jmp blist
;
; Support for direct BIOS console & list device I/O
;
SYINITEXTRA:
xchg! shld dirbufa
XCHG! POP H! MOV M,E! INX H! MOV M,D
ret
bconst: mvi e,0feh! mvi c,6! jmp xbdos
bconin: mvi c,3! jmp xbdos
bconout:mov e,c! mvi c,4! jmp xbdos
blist: mov e,c! mvi c,5! jmp xbdos
; Disk and List data structures
diskcqcb:
;disk mutual exclusion circular que ctl blk
dw $-$ ;link
db 'MXDisk ' ;name
dw 0 ;message length
dw 1 ;number of messages
dw $-$ ;dq process head
dw $-$ ;nq process head
dw $-$ ;msgin
dw $-$ ;msgout
dw $-$ ;msgcnt
dw $-$ ;owner Process descriptor adr
MXDisk:
;disk user queue control block
dw diskcqcb
listcqcb:
;list mutual exclusion circular queue control block
dw $-$ ;link
db 'MXList ' ;name
dw 0 ;message length
LISTNMSGS:
dw 0FFFFH ;number of messages
dw $-$ ;dq process head
dw $-$ ;nq process head
dw $-$ ;msgin
dw $-$ ;msgout
LISTMSGCNT:
dw 0FFFFH ;msgcnt
dw listcqcb-4 ;owner Process Descriptor adr
xbdos: ;arrive here from user programs
mov a,c! ora c ; test function code
jz reboot ;zero terminates calling process
jp notXDOS ;jump if a BDOS call
call XDOS ;func >= 128 is a XDOS call
mov a,l ;XDOS returns address put low byte into A
ret
badfunc:
;invalid function code
lxi h,0ffffh! mov a,l! ret
brkpt: ;debugger breakpoint entry
di! shld svdhl! pop h! shld svdrt! push psw
;set HL = RLR
lhld rlradr! mov a,m! inx h! mov h,m! mov l,a
mvi a,memseg! add l! mov l,a
mvi a,0! adc h! mov h,a ;HL = .pd.memseg
mov a,m! add a! adi brkvctr
lhld sysdat! mov l,a ;HL = brkpt hndlr address
mov a,m! inx h! mov h,m! mov l,a
shld jmptobrk+1
pop psw! lhld svdrt! push h! lhld svdhl
jmptobrk:
jmp $-$
restore:
;restore user stack
xchg! pop h! sphl! xchg ;get user stack pointer
ret
tst$stk$swap:
lda usrstkflg! ora a
rz ; if flag set then change stack
; get memory segment index
lhld rlradr! mov a,m! inx h
mov h,m! mov l,a
mvi a,pname+2! add l! mov l,a
mvi a,0! adc h! mov h,a
mov a,m ; A = pd.name(2)
ani 80h! jz tst$stk$swap1 ;no stk chg if name(2) "on"
xra a! ret
tst$stk$swap1:
mvi a,memseg-(pname+2)! add l! mov l,a
mvi a,0! adc h! mov h,a
mov a,m ; A = memory segment index
ora a! rz
inr a! ret ;no stack change if system process call
notXDOS:
call tst$stk$swap! jz BDOS
dcr a! dcr a! add a! adi usrstkregion
lhld sysdat! mov l,a
mov a,d! mov b,e ;save DE in AB
mov e,m! inx h! mov d,m
lxi h,0! dad sp
xchg! sphl! push d ;set & save user SP
lxi h,restore! push h ; setup return address to restore stack
mov d,a! mov e,b ;restore DE
BDOS:
mov a,c! cpi diskf! jc cnsfunc ;jump if not disk i/o
cpi 26! jnz BDOS2
call rlr! mvi a,disksetDMA! add l! mov l,a
mvi a,0! adc h! mov h,a
inx d! mov a,e! ora d
jz BDOS1
dcx d
BDOS1:
mov m,e! inx h! mov m,d
ret
BDOS2:
cpi ndf+1! jc OKdf ;func <= ndf
cpi 100! jc badfunc ;ndf < func < 100
cpi nxdf+1! jnc badfunc ;func > nxdf
OKdf:
cpi chainf! jz chain
push d! push b ;save info & func
CALL TSTLIVEKBD ;TST FOR PD.NAME(3)' OFF
cz func11 ;simulate 'live console' with kbd status chk
;if not suppressing abort then set ctlc flg off, in BDOS on
call rlr! lxi d,(pname+7)! dad d
mov a,m! ani 80h! jnz noinbdosflg
dcx h! mov a,m! ani 7fh! mov m,a
dcx h! dcx h! dcx h! dcx h! dcx h
;DO NOT ALLOW ABORT WHEN IN BDOS
MOV A,M! ORI 80H! MOV M,A
noinbdosflg:
;obtain entry by getting disk mutual exclusion message
mvi c,readque! lxi d,MXDisk! call XDOS
;setup & jump to banked bdos
pop b! pop d ;restore info & func
lxi h,0! dad sp! shld entsp
lxi sp,lstack
;perform the required buffer transfers from
; the user in common memory
mov a,c! cpi 17 ;search ?
jnz skipsrch
call rlr! push d! lxi d,searcha! dad d! pop d
mov m,e! inx h! mov m,d
jmp skipsrchnxt
skipsrch:
cpi 18 ;search next ?
jnz skipsrchnxt
call rlr! lxi d,searcha! dad d
mov e,m! inx h! mov d,m
skipsrchnxt:
lxi h,dfctbl-12
mov a,c! cpi 100! jc normalCPM
lxi h,xdfctbl-100
normalCPM:
mvi b,0! dad b! mov a,m
;***** SAVE DFTBL ITEM, INFO, & FUNCTION *****
MOV B,A! PUSH B! PUSH D
rar! jc cpydmain
RAR! JC CPYCDMAIN
rar! jc cpyfcbin
jmp nocpyin
CPYCDMAIN:
LXI H,COMMON$DMA! PUSH H! MVI B,16! PUSH B
JMP CPYDMAIN1
cpydmain:
LHLD DIRBUFA! PUSH H! MVI B,128! PUSH B
CPYDMAIN1:
CALL SET$DMABUFA
XCHG! POP B! POP H
call move
pop d! push d
cpyfcbin:
lxi h,commonfcb! mvi b,36
call move
lxi d,commonfcb
nocpyin:
MOV A,C! MVI B,0! CPI 41! JZ SHELL
PUSH D! CALL GET$MULT$CNT$ADD! POP D
MOV A,M! DCR A! JZ BDOSE2
LXI H,MULT$FXS! INR B
BDOSE1:
MOV A,M! ORA A! JZ BDOSE2
CMP C! JZ SHELL
INX H! JMP BDOSE1
BDOSE2:
CALL BANK$BDOS
BDOSE3:
POP D ;RESTORE FCB ADDRESS
POP B! MOV A,B ;RESTORE DFCTBL BYTE & FUNCTION #
ral! jc dmacpyout
RAL! JC CDMACPYOUT
COPYOUT:
lxi h,commonfcb! xchg! mvi b,33
ral! jc cpyoutcmn
ral! jnc nocpyout
MOV A,C! CPI 105! MVI B,4! JZ CPYOUTCMN
CPI 107! MVI B,6! JZ CPYOUTCMN
mvi b,36! CPI 15! JZ CPYOUT1
CPI 22! JNZ CPYOUTCMN
CPYOUT1:
DCR B! PUSH H! LXI H,12! DAD D! MOV A,M! POP H
ANI 80H! JNZ CPYOUTCMN
MVI B,33! jmp cpyoutcmn
CDMACPYOUT:
PUSH D ;SAVE FCB ADDRESS FOR COPYOUT
CALL SET$DMA$BUFA
MVI B,3! CALL COPY$CDMA$OUT
POP D! JMP NOCPYOUT
dmacpyout:
lhld dirbufa! xchg! lhld dmabufa! mvi b,128
cpyoutcmn:
call move
nocpyout:
lhld entsp! sphl ;user stack restored
RELEASE:
lhld aret
push h
;release disk mutual exclusion message
mvi c,writeque! lxi d,MXDisk! call XDOS
;if in BDOS flag on, check for abt spc proc flg
call rlr! lxi d,(pname+1)! dad d
mov a,m! ani 7fh! cmp m! mov m,a
jz funcdone
inx h! inx h! inx h! inx h! inx h
mov a,m! ani 7fh! cmp m! mov m,a
CNZ REBOOT
funcdone:
;function done
pop h! mov a,l! mov b,h ;BA = HL = aret
ret
BANK$BDOS:
push d! push b ;save info & func
call getmemseg! sta usermemseg
xra a ;set memseg to 0 (memseg #0 must be bank zero)
call extbnkswt
pop b! pop d
bnkbdos equ $+1
call $-$
shld aret
call getmemseg! lda usermemseg
jmp extbnkswt ;ret
COPY$CDMA$OUT: ;B = 2 | 3
LHLD DMABUFA! LXI D,COMMON$DMA
;FALLS THROUGH TO MOVE
move:
;move data length of B from source DE to
;destination HL
inr b ;in case of length=0
move0:
dcr b! rz
ldax d! mov m,a
inx d! inx h
jmp move0
MULT$FXS: DB 20,21,33,34,40,0
;
getrlradr:
lhld rlradr! ret
rlr:
;set HL = contents of Ready List Root
lhld rlradr! mov a,m! inx h! mov h,m! mov l,a
ret
;
GET$MULT$CNT$ADD:
CALL RLR! LXI D,MULT$CNT! DAD D! RET
;
xgetmemseg:
lda usermemseg
ret
;
getmemseg:
;set A = memory segment #
call rlr ;HL = Ready List Root
mvi a,memseg! add l! mov l,a
mvi a,0! adc h! mov h,a ;HL = .pd.memseg
mov a,m! ret
;
REMOVE$FILES:
CALL GETMEMSEG! PUSH A! XRA A
PUSH B! CALL EXTBNKSWT! POP B
CALL XREMOVE$FILES
CALL GETMEMSEG! POP A! JMP EXTBNKSWT
;
;
; intercept bios boot to switch banks
extreboot:
call getmemseg! lda usermemseg
call extbnkswt
lxi h,0ffffh! shld aret
LHLD ENTSP! SPHL ;RESTORE USER'S STACK
CALL RELEASE ;RELEASE MXDisk
LDA USERMEMSEG
ORA A! RZ! INR A! RZ ;DON'T TERMINATE IF SYS PROCESS
xreboot:
call tst$stk$swap! jz reboot
lxi h,0! dad sp! lxi d,3fh! dad d
mov a,l! ani 0c0h! mov l,a! dcx h
mov d,m! dcx h! mov e,m! xchg! sphl
reboot:
call rlr! lxi d,memseg! dad d
mov a,m! ora a! rz
inr a! rz
dcx h! dcx h
mov a,m! ani 80h! rnz
;terminate the calling process
mvi c,terminate! lxi d,0
jmp xdos
SWITCH$USER:
call getmemseg! lda usermemseg
jmp extbnkswt
SWITCH$ZERO:
call getmemseg! xra a
;call extbnkswt
;ret
extbnkswt:
di
mov m,a! inr a! jz extbnkswt1 ;return if system process
dcr a! add a! add a! lhld msegtadr
add l! mov c,a
mvi a,0! adc h! mov b,a
call xiosms
extbnkswt1:
ei
ret
;
; Local Data Segment
msegtadr: ds 2 ;address of memory segment table
rlradr: ds 2 ;address of Ready List Root
sysdat: ds 2 ;address of system data page
usrstkflg: ds 1 ;user stack flag, 0ffh=users stack
svdhl: ds 2 ;saved HL at breakpoint entry
svdrt: ds 2 ;saved return address at breakpoint entry
;
dirbufa: ds 2 ;directory buffer address
dmabufa: ds 2 ;dma buffer address
usermemseg: ds 1 ;saved user mem seg index
aret: ds 2 ;address value to return
commonfcb:
ds 36 ;fcb copy in common memory
;
COMMON$DMA:
DS 16 ;LOCAL DMA FOR PASSWORDS, ETC.
;
; Disk Function Copy Table
;
dmain equ 00000001b ;dma copy on entry
CDMAIN EQU 00000010B ;COPY 1ST 16 BYTES OF DMA TO
fcbin equ 00000100b ;fcb copy on entry
;COMMON$DMA ON ENTRY
dmaout equ 10000000b ;dma copy on exit
CDMAOUT EQU 01000000B ;COPY 1ST 2 | 3 BYTES OF COMMON$DMA
;TO DMA ON EXIT
;2 IF UNLOCKED OPEN
;3 IF GET DISK FREE SPACE
fcbout equ 00100000b ;fcb copy on exit
pfcbout equ 00010000b ;random fcb copy on exit
dfctbl:
db 0 ; 12=return version #
db 0 ; 13=reset disk system
db 0 ; 14=select disk
db fcbin+PFCBOUT+CDMAIN ; 15=open file
db fcbin+fcbout ; 16=close file
db fcbin+dmain+dmaout ; 17=search first
db fcbin+dmain+dmaout ; 18=search next
db fcbin+CDMAIN ; 19=delete file
db fcbin+fcbout ; 20=read sequential
db fcbin+fcbout ; 21=write sequential
db fcbin+PFCBOUT+CDMAIN ; 22=make file
db fcbin+CDMAIN ; 23=rename file
db 0 ; 24=return login vector
db 0 ; 25=return current disk
db 0 ; 26=set DMA address
db 0 ; 27=get alloc address
db 0 ; 28=write protect disk
db 0 ; 29=get R/O vector
db fcbin+CDMAIN ; 30=set file attributes
db 0 ; 31=get disk param addr
db 0 ; 32=get/set user code
db fcbin+fcbout ; 33=read random
db fcbin+fcbout ; 34=write random
db fcbin+pfcbout ; 35=compute file size
db fcbin+pfcbout ; 36=set random record
db 0 ; 37=drive reset
db 0 ; 38=access drive
db 0 ; 39=free drive
db fcbin+fcbout ; 40=write random w/ zero fill
db fcbin+fcbout ; 41=test & write record
db fcbin+fcbout+CDMAIN ; 42=record lock
db fcbin+fcbout+CDMAIN ; 43=record unlock
db 0 ; 44=set multi-sector count
db 0 ; 45=set BDOS error mode
db CDMAOUT ; 46=get disk free space
db fcbin ; 47=chain to program
db 0 ; 48=flush buffers
db 0 ; 49=CCP chain query (CP/M)
db 0 ; 50=direct BIOS call (CP/M)
ndf equ ($-dfctbl)+12
xdfctbl:
db fcbin+CDMAIN ; 100=set directory label
db 0 ; 101=return directory label data
db fcbin+fcbout+CDMAIN ; 102=read file xfcb
db fcbin+CDMAIN ; 103=write or update file xfcb
db fcbin ; 104=set current date and time
db fcbin+pfcbout ; 105=get current date and time
db fcbin ; 106=set default password
db fcbin+pfcbout ; 107=return serial number
nxdf equ ($-xdfctbl)+100
get$dma$add:
call rlr! lxi d,disksetdma! dad d! ret
set$dmabufa:
call get$dma$add
mov e,m! inx h! mov d,m
xchg! shld dmabufa! ret
shell:
sta fx! call set$dmabufa
shld shell$dma
call get$mult$cnt$add
mov a,m! sta shell$cnt
lxi h,shell$rtn! push h! push b
call save$rr! call save$dma
pop psw! ora a! jz tst$wrt
jmp mult$io ; HL = .DMA
;
shell$cnt: db 0
fx: db 0
shell$rr: db 0,0,0
;
hold$dma: dw 0
shell$dma: dw 0
;
cbdos:
lda fx! mov c,a
cbdos1:
lxi d,common$fcb! call bank$bdos! lda aret! ret
;
adv$dma:
lhld shell$dma
lxi d,80h! dad d! shld shell$dma
;
set$process$dma:
push h
call get$dma$add! pop d! mov m,e! inx h! mov m,d
ret
;
save$dma:
lhld shell$dma! shld hold$dma! ret
;
reset$dma:
lhld hold$dma! jmp set$process$dma
;
shell$err:
lhld aret
lda shell$cnt! pop b! sub b
add a! add a! add a! add a
ora h! mov h,a! ret
;
shell$rtn:
shld aret! lda fx! cpi 33! cnc reset$rr
call reset$dma! jmp bdose3
;
incr$rr:
call get$rra
inr m! rnz
inx h! inr m! rnz
inx h! inr m! ret
;
save$rr:
call save$rr2! xchg
save$rr1:
mvi b,3! jmp move ;ret
save$rr2:
call get$rra! lxi d,shell$rr! ret
;
reset$rr:
call save$rr2! jmp save$rr1
;
tst$wrt:
lhld dirbufa! xchg
mvi c,26! call bank$bdos
lda shell$cnt
tst$wrt1:
push a! mvi c,33! call cbdos1
ora a! jnz shell$err
call compare$recs
call incr$rr
lxi d,80h! lhld shell$dma! dad d! shld shell$dma
pop a! dcr a! jnz tst$wrt1
call set$process$dma
call reset$rr
mvi a,34! sta fx ; jmp mult$io
;
mult$io:
lda shell$cnt
mult$io1:
push a! call cbdos
ora a! jnz shell$err
lda fx! cpi 33! cnc incr$rr
call adv$dma
pop a! dcr a! jnz mult$io1
lxi h,0
ret
;
compare$recs:
lhld shell$dma! xchg! lhld dirbufa
mvi c,128
call compare! rz
pop h! lxi h,0007! jmp shell$err
;
compare:
ldax d! cmp m! rnz
inx h! inx d! dcr c! rz
jmp compare
;
get$rra:
lxi h,common$fcb! lxi d,33! dad d! ret
;******************************************************
;** **
;** C h a i n **
;** **
;******************************************************
;
chainf equ 47
chain:
call getmemseg! lhld rlradr
lxi b,msegtbl-rlros! dad b
add a! add a! mov e,a! mvi d,0! dad d
mov h,m! mvi l,5ch
push h! inx h! mvi c,8! lxi d,clipdname
moveclipdname:
ldax d! mov m,a! inx d! inx h
dcr c! jnz moveclipdname
mvi m,0
;set no user sys stacks
call rlr! lxi b,pname+2! dad b
mov a,m! ori 80h! mov m,a
lxi b,console-(pname+2)! dad b! mov a,m
pop d! push d! stax d! mvi e,7dh! stax d
lxi b,diskselect-console! dad b
dcx d! mov a,m! stax d
inx d! inx d! xra a! stax d! inx d
call getmemseg! stax d;
;assign the console to the cli
mvi c,asgncns! pop d! push d! call xdos
;raise process priority
mvi c,setprior! mvi e,0! call xdos
;send special form of send cli command
mvi c,sendcli! pop d! mvi e,7ch! call xdos
;terminate the calling process
mvi c,terminate! lxi d,0ff00h! jmp xdos
clipdname:
db 'cli '