Welcome, Guest. Please login or register.


Author Topic: IS-DOS crash bug. (Read 3050 times)

Online elmer

  • EP fan
  • *
  • Posts: 184
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #60 on: 2021.January.15. 20:51:03 »
Here is the final set of changes to the IS-DOS 1.0 source to convert it to fully build with Z80ASM and SLRNK1.

The advantages of Z80ASM and SLRNK1 are ...

1) It is much faster than M80/L80.
2) There is no need to output the .REL files with different names to the .MAC files.
3) Labels are significant to 16 characters (rather than 6 in L80), allowing them to be more readable.
4) SLRNK1 can link to Page3 ($C000-$FFFF) without leaving Page3 unused in CP/M. This means that IS-DOS can now be built on an actual Enterprise!
5) SLRNK1 does not put a relocation header onto the output file, meaning that the output that it writes is directly usable as IS-DOS.SYS (i.e. there is no need to use SJASM to strip junk off the start of IS-DOS).


The only significant changes from the source code that I posted a few days ago, was to fix labels that were actually wrong, but worked OK with M80/L80 because the first 6 characters were correct.


I have included new builds of XCPM that use the full 64KB of Z80 memory, to take advantage of SLRNK1 not needing to leave $C000-$FFFF free for the linked program.

Online elmer

  • EP fan
  • *
  • Posts: 184
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #61 on: 2021.January.23. 16:27:32 »
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?


Code: [Select]
;******************************************************************************
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

Offline BruceTanner

  • EP lover
  • *
  • Posts: 557
  • Country: gb
  • OS:
  • Linux (Ubuntu) Linux (Ubuntu)
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #62 on: 2021.January.23. 18:49:07 »
Yes I think you're right... it's a binary number with leading 0s, but only 7 digitts! :oops: I think it is meant to be 10h, which resets the channels and devices. Having said that it seems unlikely that that piece of code has ever been executed, as it is only a final attempt at doing *something* if it is unable to open its normal channels.

And yes I think you need to reset SP after an EXOS reset. It is because EXOS switches to its own internal stack when you do an EXOS call (because... paging) but to allow re-entrant calls it keeps a re-entrancy count and only switches back to the user's stack when returning from the initial call. But the reset function has to reset the re-entrancy count.

I'm sure it says it somewhere, but I agree it is not in the obvious place in the kernel spec and I can't find it now!

Online elmer

  • EP fan
  • *
  • Posts: 184
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #63 on: 2021.January.23. 21:59:30 »
Yes I think you're right... it's a binary number with leading 0s, but only 7 digitts! :oops: I think it is meant to be 10h, which resets the channels and devices. Having said that it seems unlikely that that piece of code has ever been executed, as it is only a final attempt at doing *something* if it is unable to open its normal channels.

OK, thanks, I'll change it to 10h, which sounds like the right value.

I think that I have managed to get very *close* to triggering that piece of code while testing the latest IS-DOS changes on a 64KB Enterprise in EP128EMU.

Allocating a dedicated segment for IS-DOS means that there isn't enough memory left on an EP64 for an 80-column text screen, and that fallback code seems to be activating and switching to a 40-column text screen.  It is nice to know that you professionals at IS were programming so defensively!  ;-)


I'm sure it says it somewhere, but I agree it is not in the obvious place in the kernel spec and I can't find it now!

Thanks for the information, I'll be careful to remember that for the future. :)