As I keep working on the IS-DOS source code, I have just come across this.
It looks like the flags that are sent to the EXOS RESET function are wrong, at least according to the documentation that I have seen.
Is it a bug?
Another thing ... why is the SP saved and loaded before and after the EXOS RESET? The documentation does not mention that the EXOS RESET changes the SP ... is the documentation wrong?
;******************************************************************************
OPENALL::
;
; This routine attempts to ensure that IS-DOS's keyboard, video and editor
; channels are open. It does this by first trying to open them, and ignoring
; 'channel exists' errors. If some other error occurs, then the editor, video
; and keyboard channels are closed, and an attempt is made to re-open them. If
; this fails, then all channels up to the first one used by IS-DOS batch files
; are closed, and the open again attempted. If this fails, then another open
; attempt is made with the video in 40 column mode. If this still fails, then
; as a last resort an EXOS reset is done, closing all channels (including
; batch file channels). If it is still impossible to open the channels, then
; IS-DOS gives up and prints 'FATAL IS-DOS ERROR' on the status line and, in
; the traditional Enterprise 'I've given up' way, flashes the border.
;
;
CALL OPEN ; Make sure kbd, editor & vid are open.
RET Z ; Ret if OK.
CALL CLOPEN ; Else close all three and try again.
RET Z ; Ret if OK.
LD H,0 ; Else close all user channels.
CLCHAN: LD A,H
RST EXOS
DEFB @CLOSE##
INC H
LD A,H
CP ISCHAN## ; Reached first IS-DOS channel ?
JR NZ,CLCHAN ; Close next if not.
CALL CLOPEN ; Attempt to open again.
RET Z ; Ret if OK now.
PUSH AF ; Else save error code.
XOR A
LD (VIDMOD),A ; Else try in 40 column mode.
CALL CLOPEN
POP BC
LD A,B
RET Z ; Ret if OK with 80 col. error code.
EXX ; Else reset EXOS.
PUSH HL ; Save HL'.
LD (CLI_SP##),SP ; Save SP.
LD C,0001000B ; Forcibly close all channels. <<<--- BUG ???
RST EXOS
DEFB @RESET##
LD SP,(CLI_SP##) ; Restore SP.
EI
POP HL
EXX
CALL OPEN ; Try openning one more time.
RET Z ; Ret if OK, else give up.
;
FATALIS:: CALL TST_LANG##
LD DE,FATALM ; Else print 'FATAL IS_DOS ERROR' on
JR Z,FIS10 ; status line & flash border.
LD DE,GFATALM ; German.
FIS10: CALL STLINE
;
FLASH: DI
LD A,01001001B
LD B,3
FL10: OUT (BORDER),A
ADD A,A
DJNZ FL10
JR FLASH