Welcome, Guest. Please login or register.


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

Offline elmer

  • EP fan
  • *
  • Posts: 195
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
IS-DOS crash bug.
« on: 2021.January.04. 20:29:19 »
There is a crash bug in IS-DOS, probably introduced sometime between when the IS-DOS specification document was written, and the final IS-DOS version 1.0 was released.

The important difference is in the way that IS-DOS uses memory.

In the original specification, IS-DOS would always allocate 64KB of memory, and then its program code would stay in the same location all of the time, unless that location was changed with a "RELOCATE" command.

In the shipping version of IS-DOS, the program code moves itself automatically from the Page0 segment to a different segment, usually Page3, when a CP/M program is run ... and then it moves itself back to Page0 once the CP/M has finished.

This means that EXOS keeps more segments free for other things whenever IS-DOS doesn't actually need the memory in order to run a CP/M program.


The crash bug occurs whenever a CP/M file is loaded that is larger than the amount of memory that is available for a CP/M program (the TPA size).

IS-DOS detects this, and displays an "*** Insufficient memory" message ... but it does not move itself back to Page0, and it keeps all of its memory.

The next time that a CP/M program is run, IS-DOS get confused because it is not in Page0, and its memory allocation breaks, memory is leaked, and a crash occurs.


In practice, it is unlikely that anyone will ever encounter this problem in normal use, because it is something that only happens if memory is low (i.e. you run IS-DOS on an Enterprise with more that 64KB, but less than 112KB), or because you specifically try to run a program file that is larger than 51KB.


Now it isn't very difficult to patch IS-DOS to fix this bug, but I don't see it as being worthwhile unless someone is patching IS-DOS for other reasons.

Online gflorez

  • EP addict
  • *
  • Posts: 3127
  • Country: es
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #1 on: 2021.January.04. 23:51:11 »
It could be great to upgrade from 2.2 version to 3+, profiting from the Enterprise memory paging capabilities.

Offline geco

  • EP addict
  • *
  • Posts: 6090
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 78.0 Firefox 78.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #2 on: 2021.January.05. 09:24:28 »
It could be great to upgrade from 2.2 version to 3+, profiting from the Enterprise memory paging capabilities.
But i think it would be also a bigger task, hard to do by patching the code, the source code would be needed also for this action.

Online gflorez

  • EP addict
  • *
  • Posts: 3127
  • Country: es
  • 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 #3 on: 2021.January.05. 10:14:09 »
Yes, but "only" the ISDOS Enterprise code is needed, because the CP/M 3+ source is accessible here.

Offline elmer

  • EP fan
  • *
  • Posts: 195
  • 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 #4 on: 2021.January.05. 21:18:08 »
It could be great to upgrade from 2.2 version to 3+, profiting from the Enterprise memory paging capabilities.

But i think it would be also a bigger task, hard to do by patching the code, the source code would be needed also for this action.

It would be technically cool to have CP/M 3 compatibility on the Enterprise, but I agree with geco, the only way to sensibly achieve this would be to have the original IS-DOS source code to start from.

While I am able to do a certain amount of reverse-engineering to understand how a program is working, there is no substitute for seeing the original programmer's comments in the source code.


Apart from that, if we did have CP/M 3 compatibility on the Enterprise, would it actually be useful?

I cannot personally remember there being any high-quality CP/M 3 software that someone would want to run in modern times.

Do you know of any CP/M 3 programs from the Amstrad CPC or PCW that we would find useful on the Enterprise?


With my limited imagination, I suspect that the thing that might be most useful today would be to modify IS-DOS to have a larger (61KB?) TPA.

Another useful upgrade would be to add either MSX-DOS2 compatibility, and/or ZCPR3 compatibility.

Both MSX-DOS2 and ZCPR3 have improved "Environment" and "Batch File" capabilities that would be useful on the Enterprise, and MSX-DOS2 seems to support expanded memory in a fairly similar way to how the Enterprise already works.

Online gflorez

  • EP addict
  • *
  • Posts: 3127
  • Country: es
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #5 on: 2021.January.06. 00:08:15 »
Ok, it is true, upgrading to 3+ is an impossible task, but if you ask for interesting PCW programs, there are a lot of them here.

Offline elmer

  • EP fan
  • *
  • Posts: 195
  • 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 #6 on: 2021.January.06. 19:34:46 »
Ok, it is true, upgrading to 3+ is an impossible task

It is not actually an "impossible" task, just very, very difficult and time-consuming.

I have disassembled, and can modify, about 3KB of IS-DOS that relates to the fast video driver and CP/M program startup/exit, because those are the areas that I need to change in order to speed up the video driver so that VEDIT and WordStar are more pleasant to use, and don't look so slow when compared to the Amstrad CPC.

That still leaves almost 6KB of very dense and complex BDOS-emulation code that has a *lot* of complex interactions within it, that I do not even begin to understand.

Even if I did understand it well enough to patch the code, there still wouldn't be anywhere near enough free space within the current memory layout to add all of the new BDOS and BIOS functions from either CP/M3 or MSX-DOS2.

Having the original source code available would make things much less time-consuming and frustrating, especially the addition of MSX-DOS2 functionality, since IS-DOS is already compatible with MSX-DOS1, and both IS-DOS and MSX-DOS are designed to use MS-DOS format discs and not CP/M format discs.


but if you ask for interesting PCW programs, there are a lot of them here.

Yes, there were some very nice business/productivity programs written for the Amstrad PCW computers!

With a market of approx 8 million PCWs sold, nearly 3 times the number of Amstrad CPC sales, there was an incentive for developers to produce good business software for it.

But I think that you will find that most of those programs on that list are not pure CP/M3 programs, and that they rely on either the "GSX" RSX or, more often, the Amstrad XBIOS firmware routines.

Even then, I expect that the best of those programs would use the Amstrad PCW screen hardware directly for speed.

To get those programs running on the Enterprise would need a full PCW-emulator ... which might be  unusable in practice, since the PCW's screen is wider than the Enterprise can display.

See here for PCW hardware information.


What is interesting to see here is that the Amstrad's CP/M3 character set uses a similar method to the Enterprise (i.e. ISO-646) for displaying international characters.

Offline geco

  • EP addict
  • *
  • Posts: 6090
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 87.0.4280.101 Chrome 87.0.4280.101
    • View Profile
Re: IS-DOS crash bug.
« Reply #7 on: 2021.January.06. 21:01:26 »
I wonder , so much PCW were sold? 8 million sounds very much, it is close to the number of sold Speccies which is above 10 million if i know well, but none of them is close the number of sold Enterprises :ds_icon_cheesygrin: :ds_icon_cheesygrin:

Offline geco

  • EP addict
  • *
  • Posts: 6090
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 87.0.4280.101 Chrome 87.0.4280.101
    • View Profile
Re: IS-DOS crash bug.
« Reply #8 on: 2021.January.06. 21:17:49 »
I checked, only 5 million Speccy were sold,3 million CPC, 12,5-17 million C64, and 8 million PCW, i have never thought that.
Sorry for the off.

Offline BruceTanner

  • EP lover
  • *
  • Posts: 558
  • Country: gb
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
Re: IS-DOS crash bug.
« Reply #9 on: 2021.January.06. 21:29:22 »
I suspect that the thing that might be most useful today would be to modify IS-DOS to have a larger (61KB?) TPA.
On a ep128 you could theoretically have the bulk on the BDOS emulation code in a segment outside the TPA, all you'd need in the TPA would be the entry points and some paging code. Nearly 64Kb TPA!

Offline Zozosoft

  • EP addict
  • *
  • Posts: 13959
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 84.0 Firefox 84.0
    • View Profile
    • http://enterprise.iko.hu/
Re: IS-DOS crash bug.
« Reply #10 on: 2021.January.06. 21:50:17 »
But i think it would be also a bigger task, hard to do by patching the code, the source code would be needed also for this action.
Ok, there is it :ds_icon_cheesygrin:
I started to order it, but continously out of free time.. :oops:

Before patching anything, need to recreate the source configuration, which is result file bit-to-bit same with the released original version.
Need to find the right link order, and find differences if any exist then modify back. Don't know, but possible some files are later than the released version.
(I do same work for get a EXDOS 1.0, 1.1, 1.2, 1.3, 2.0, 2.1 sources, which are now enhaced to EXDOS 3)

Original sources using M80 and L80, possible to do the job under IS-DOS, but much faster to use XCPM utility from Lgb, which are run these CP/M programs under Windows (Linux version also exist).
Run M.BAT then L.BAT for do the job.
SJASM only used for add the 16 bytes EXOS header to the file.

IS-DOS.SYS are the original file. Note: the original file 13824 bytes, but in the header only 13680 lenght, then the total valuable data are 13696 bytes. This SYS file are the truncated version without the additional garbage.
IS-DOS.COM the result of the compile.

Have a good luck!

Offline elmer

  • EP fan
  • *
  • Posts: 195
  • 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 #11 on: 2021.January.06. 22:01:11 »
On a ep128 you could theoretically have the bulk on the BDOS emulation code in a segment outside the TPA, all you'd need in the TPA would be the entry points and some paging code. Nearly 64Kb TPA!

Yes, that is my thought, especially since IS-DOS already jumps through a number of unneccessary hoops to page its code in Page3 whenever a BDOS or BIOS function is called, and so it might not be too bad to have it page into a dedicated code segment.

The question seems to be whether IS-DOS would be better off as a mostly-compressed 11KB relocatable extension, or as a full 16KB absolute extension, which would then allow it to page in and run its code as needed.

Note ... there's a decent amount of self-modifying code in there, so it can't just run as a ROM.


As it is, my main interest is in *removing* some of that unnecessary page switching from the video driver so that it runs faster!

Well, that and adding some of the extra Heathkit/Zenith H-19 ESC codes that weren't in the video driver's more-limited VT-52 emulation. ;-)

Offline geco

  • EP addict
  • *
  • Posts: 6090
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 87.0.4280.101 Chrome 87.0.4280.101
    • View Profile
Re: IS-DOS crash bug.
« Reply #12 on: 2021.January.06. 22:07:01 »
Thank you very much Zozo, it really seems to be hard, I hope we could create to reproduce the source of the actual binary.

Offline elmer

  • EP fan
  • *
  • Posts: 195
  • 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 #13 on: 2021.January.06. 22:26:41 »
Ok, there is it :ds_icon_cheesygrin:
I started to order it, but continously out of free time.. :oops:

Thank you Zozo, these will be a huge help! :mrgreen:


Before patching anything, need to recreate the source configuration, which is result file bit-to-bit same with the released original version.
Need to find the right link order, and find differences if any exist then modify back. Don't know, but possible some files are later than the released version.
(I do same work for get a EXDOS 1.0, 1.1, 1.2, 1.3, 2.0, 2.1 sources, which are now enhaced to EXDOS 3)

I wondered how you were working on the EXDOS upgrades!

I think that I'm familiar enough with the IS-DOS internals at this point that figuring out the link order shouldn't be too hard. :)

It will be interesting to see how the source it written in order to build the final IS-DOS executable, which is comprised of three sections of code that run in totally different areas of memory, all put together in one file.

Offline geco

  • EP addict
  • *
  • Posts: 6090
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 87.0.4280.101 Chrome 87.0.4280.101
    • View Profile
Re: IS-DOS crash bug.
« Reply #14 on: 2021.January.06. 22:31:11 »
i will try to create one file from sources, i hope, it can be managed. Until now i could manage these kind of activities, and i hope it can be done for IS-DOS also.