Making a CPM3 BIOS CPM3.SYS File

185 views
Skip to first unread message

John Monahan

unread,
Oct 23, 2021, 12:46:39 PM10/23/21
to
It's years ago since I made CPM3.SYS files for my hardware. I now need to relearn the build process for a new Disk Controller board BIOS.

The Digital Research supplied GENCPM submit file is great for taking all the drudgery out of building a CPM3 BIOS.

I'm stuck however at one point in the process for a banked system for
the "Enter memory segment table".....

I have Common memory base page C0
Number of memory segments 3

Gencpm comes back with (8B, 35, 00)
Enter memory segment table:
Base, size, bank (00,8B,00)?
Base, size, bank (0D,B3,02)?
Base, size, bank (00,C0,03)?

My question is where did the D3 and B3 come from
This user group does not allow me to post a picture but one can be seen here:-
https://groups.google.com/g/s100computers/c/KKAeRhJwQII

John

Douglas Miller

unread,
Oct 23, 2021, 1:23:53 PM10/23/21
to
Generically speaking, GENCPM has two basic modes. One is where GENCPM does nothing (little) more than assemble the system SPR files into a CPM3.SYS image. The other is where GENCPM is responsible for allocating buffers, etc, and needs to know the banked memory table. That depends on your BIOS. I forget how that is determined, aside from certain "magic" values in the DPH that indicate GENCPM must assign memory. The system I generate never asks for memory segment tables, presumably because the BIOS allocates the memory itself.

Douglas Miller

unread,
Oct 23, 2021, 1:35:06 PM10/23/21
to
Specifically to your question, bank 0 a.k.a. "(00,8B,00)" says the memory between 0000 and 8B00 (8AFF) is available (OS resides 8B00-C000), and bank 2 "(0D,B3,02)" says that memory between 0D00 and C000 is available (C000-0D00=B300), and bank 3 "(00,C0,03)" means 0000-C000 is available. I believe that GENCPM never uses 0000-0100 in any bank, though. Just a guess, but I would think that 0100-0D00 in bank 2 is reserved for the CCP.COM image (size is right for that).

I can't access your picture, perhaps it is not set to "public"?

John Monahan

unread,
Oct 23, 2021, 4:10:09 PM10/23/21
to
On Saturday, October 23, 2021 at 10:35:06 AM UTC-7, Douglas Miller wrote:
> Specifically to your question, bank 0 a.k.a. "(00,8B,00)" says the memory between 0000 and 8B00 (8AFF) is available (OS resides 8B00-C000), and bank 2 "(0D,B3,02)" says that memory between 0D00 and C000 is available (C000-0D00=B300), and bank 3 "(00,C0,03)" means 0000-C000 is available. I believe that GENCPM never uses 0000-0100 in any bank, though. Just a guess, but I would think that 0100-0D00 in bank 2 is reserved for the CCP.COM image (size is right for that).
>
> I can't access your picture, perhaps it is not set to "public"?

;----------------------------------------------------------------------------------------------------------------------------------
Thanks so much Douglas that's a big help.

I want to be sure I have it right. In my setup I have some 5 drives so a fairly large BIOS. I have the bank switching boundary set at 80 (8000H) rather than CO. and #3 segments.

During the build GENCPM comes back with
CP/M 3 Base,size,bank (3F,41,00)

so the memory between 0000 and 3F00 (2EFF) is available (OS resides 3F00-8000)
I should enter :- (00,3F,00) for bank 0, is this correct?

I don't understand how you calculate the second bank. The numbers were provide in the CPM Operating system Guide example. How are these numbers calculated. In other words how do you get (0D,B3,02) from the GENCPM provided (8B, 35, 00) and the bank boundary at C000H.

What for example would my second bank numbers be. Starting with
(3F,41,00) and the bank switch at 8000H

No problem with bank 3!

Thanks in advance
John
PS I'm writing all this up here:-
http://s100computers.com/Software%20Folder/FPGA_DC%20Board%20Software/FPGA_DC%20Software.htm#Booting%20CPM3%20Instructions
Hopefully I can explain the CPM3 Build for others better.

Douglas Miller

unread,
Oct 23, 2021, 4:19:21 PM10/23/21
to
So, the reason the example was confusing was that the BIOS is reserving space in bank 2 to store CCP.COM so that warm-boot is faster (not loading it off disk each time). I'm not sure where that was communicated to GENCPM, and you'd have to check your BIOS to see if you need that space and it is still in bank 2. Assuming "yes", then in your "common 80" case you'd want "(0d,73,02)" because 0000-0D00 is reserved for the CCP, then 0D00-8000 is left for GENCPM to allocate. 8000-0D00=7300. If your BIOS is not saving CCP in memory (it is loading off disk every warm boot), then bank 2 would be "(00,80,02)".

John Monahan

unread,
Oct 23, 2021, 4:52:14 PM10/23/21
to
On Saturday, October 23, 2021 at 1:19:21 PM UTC-7, Douglas Miller wrote:
> So, the reason the example was confusing was that the BIOS is reserving space in bank 2 to store CCP.COM so that warm-boot is faster (not loading it off disk each time). I'm not sure where that was communicated to GENCPM, and you'd have to check your BIOS to see if you need that space and it is still in bank 2. Assuming "yes", then in your "common 80" case you'd want "(0d,73,02)" because 0000-0D00 is reserved for the CCP, then 0D00-8000 is left for GENCPM to allocate. 8000-0D00=7300. If your BIOS is not saving CCP in memory (it is loading off disk every warm boot), then bank 2 would be "(00,80,02)".

OK I think I got it Douglas. Definitely I'm not reloading the CCP each time. I can rename it, work with files OK (of course renaming it back before a reboot).

So what is not explained by DR is that CCP resident essentially requirement in bank 2. I assume I can always assume then that it will occupy bank 2 and never be more than 0D00H. Is this correct.

Can I also assume nothing more will (ever) be required above 0D00H in bank 2.

John

John Monahan

unread,
Oct 23, 2021, 5:06:02 PM10/23/21
to
Douglas I'm still stuck! In the DR example above with the page boundary at C0
and the CP/M 3 Base,size,bank (8B, 35, 00)
where or what is the 35 used for?
You use the 8B for bank 0
you assume 0D00H for bank 2
where is the 35 used?


Douglas Miller

unread,
Oct 23, 2021, 5:06:49 PM10/23/21
to
On Saturday, October 23, 2021 at 3:52:14 PM UTC-5, monah...@gmail.com wrote:
>...
>
> So what is not explained by DR is that CCP resident essentially requirement in bank 2. I assume I can always assume then that it will occupy bank 2 and never be more than 0D00H. Is this correct.
>
> Can I also assume nothing more will (ever) be required above 0D00H in bank 2.
>
> John

The standard CCP.COM from DRI will be 25 records long, or 0C80 bytes. If your BIOS tolerates something using 0000-0100 in bank 2, then 0000-0C80 could be used for CCP, which - rounded up to pages - would be 0000-0D00.

The reason for mentioning 0000-0100 in each bank is that this area often contains interrupt vectors (for classic 8080/Z80 interrupt systems), and so you may need to replicate "page 0" into all banks so that an interrupt while an alternate bank is enabled won't crash the system. It may also be necessary to ensure that JMP vectors at 0000 and 0005 are initialized in all banks (I forget if that is required).

The assignment of which bank contains the CCP is up to the BIOS (which is responsible for copying it into bank 1 on warm boots). I don't know how that is communicated to GENCPM, but you'll want to confirm which bank your BIOS is using.

If you plan on running any custom CCP.COMs, that 0D00 may not be enough. One of the "enhancements" of CP/M 3 was to allow users/vendors to easily supply their own, custom, CCP.COM. Since it is now a simple COM program, it can easily be built and replaced on any system. So, theoretically, the size of CCP/COM could vary.

Douglas Miller

unread,
Oct 23, 2021, 5:11:04 PM10/23/21
to
On Saturday, October 23, 2021 at 4:06:02 PM UTC-5, monah...@gmail.com wrote:
>...
> Douglas I'm still stuck! In the DR example above with the page boundary at C0
> and the CP/M 3 Base,size,bank (8B, 35, 00)
> where or what is the 35 used for?
> You use the 8B for bank 0
> you assume 0D00H for bank 2
> where is the 35 used?

The 35 is the size (in pages) of the banked OS (in bank 0). The 8B is the starting page of the OS (in bank 0). So, 35+8B=C0 which is the common page boundary in that example. The OS in bank 0 runs from 8B00-C000, which is 3500 bytes (hex). I'm pretty sure GENCPM computes that (8B,35,00) for you, right? When you enter 80 for the common memory page, you should get numbers that are relative to 80.

John Monahan

unread,
Oct 23, 2021, 5:32:17 PM10/23/21
to
Indulge me one last time Douglas. Want to check I have it right....
From the GENCPM submit file with the switching RAM boundary at 8000H
......
Number of memory segments (#3) 3
CPM/ 3 base,size,bank (3F, 41,00) <-- provide by GENCPM

Enter memory segment table:
Base, size,bank (00,80,00) ? 00, 3F, 00
Base, size,bank (00,C0,02) ? 0E, 72, 02
Base, size,bank (00,C0,00) ? 00,80,03

CP/M 3 Sys 3F00H 4100H Bank 00
Memseg No, 00 0000H 3F00H bank 00
Memseg No, 01 0E00H 7200H bank 02
Memseg No, 02 0000H 8000H bank 03


It's interesting that in spite of the fact that I set the RAM boundary at 8000H GENCPM always defaults to C000H.

Douglas Miller

unread,
Oct 23, 2021, 9:45:04 PM10/23/21
to
On Saturday, October 23, 2021 at 4:32:17 PM UTC-5, monah...@gmail.com wrote:
>...
> Indulge me one last time Douglas. Want to check I have it right....
> From the GENCPM submit file with the switching RAM boundary at 8000H
> ......
> Number of memory segments (#3) 3
> CPM/ 3 base,size,bank (3F, 41,00) <-- provide by GENCPM
>
> Enter memory segment table:
> Base, size,bank (00,80,00) ? 00, 3F, 00
> Base, size,bank (00,C0,02) ? 0E, 72, 02
> Base, size,bank (00,C0,00) ? 00,80,03
>
> CP/M 3 Sys 3F00H 4100H Bank 00
> Memseg No, 00 0000H 3F00H bank 00
> Memseg No, 01 0E00H 7200H bank 02
> Memseg No, 02 0000H 8000H bank 03
>
>
> It's interesting that in spite of the fact that I set the RAM boundary at 8000H GENCPM always defaults to C000H.

Sorry, for the delay, I got side-tracked and wasn't reading e-mail.

Yes, what you have there looks correct to me, assuming you are reserving 14 pages for the CCP in bank 2.

As far as GENCPM defaults, I believe you have the option to have GENCPM read defaults from the .DAT file, although I forget exactly how that is done. You can invoke it as "GENCPM A D" to automatically generate CPM3.SYS from the .DAT file, without asking any questions. I suspect other combinations of command options will do something like read defaults from the .DAT file. There should be something on that in the HELP data on GENCPM.

John Monahan

unread,
Oct 23, 2021, 11:51:24 PM10/23/21
to
Thanks Douglas.

Yes if you type
GENCPM AUTO
it will work from the previous GENCPM.DAT file (the file that contains all the variables)
If you type
GENCPM AUTO DISPLAY it will also display the values it is using.
If you type
GENCPM it requires keyboard input for all the variables. It ask you if you wish to store them for the next time.

I posted the same question here:-
https://groups.google.com/g/s100computers/c/KKAeRhJwQII

Udo Munk had a slightly different logic.
"The banked part of the OS requires 35 pages and common memory starts at C0.
C0 - 35 = 8B
So in bank 0 you can use 00 - 8B."

In bank 2 you could use 00 - C0, same as in bank 3.
I tried 00,80,02 in Bank 2 (in my case) . It dis not work. So your 80-0E seems correct for bank 2.


Fritz

unread,
Oct 24, 2021, 3:29:34 AM10/24/21
to
This is an interesting question and as my mothers language is german the
DRI manuals are not easy to read. I'm not a programmer...

I let GENCPM calculate the segment table.

Example from my conitec Prof180


*** Bank 1 and Common are not included ***
*** in the memory segment table. ***

Number of memory segments (#2) ?

CP/M 3 Base,size,bank (9A,56,00)

Enter memory segment table:
Base,size,bank (10,87,00) ?
Base,size,bank (00,F0,02) ?

CP/M 3 Sys 9A00H 5600H Bank 00
Memseg No. 00 1000H 8700H Bank 00
Memseg No. 01 0000H F000H Bank 02


Accept new memory segment table entries (Y) ? n
Enter memory segment table:

######################################
### false table entry 10,99,00
######################################
Base,size,bank (10,87,00) ? 10,99,00


ERROR: Memory conflict - segment trimmed.
Base,size,bank (10,8A,00) ?
Base,size,bank (00,F0,02) ?

CP/M 3 Sys 9A00H 5600H Bank 00
Memseg No. 00 1000H 8A00H Bank 00
Memseg No. 01 0000H F000H Bank 02

Accept new memory segment table entries (Y) ?





--
-- Fritz

John Monahan

unread,
Oct 24, 2021, 1:52:49 PM10/24/21
to
In my hands Fritz you need to subtract 0E from the size of bank 2. By default GENCPM assumes it is present. See Douglas Miller posting above. The above 00,F0,02 would not work.

Udo Munk

unread,
Oct 24, 2021, 5:52:54 PM10/24/21
to
monah...@gmail.com schrieb am Sonntag, 24. Oktober 2021 um 19:52:49 UTC+2:
> In my hands Fritz you need to subtract 0E from the size of bank 2. By default GENCPM assumes it is present. See Douglas Miller posting above. The above 00,F0,02 would not work.

That will work fine, CP/M 3 will not store the CCP in bank 2 or anywhere by itself. If you want to
load the CCP from memory instead from disk this must be implemented in the BIOS, and then
the memory used to hold a copy of the CCP must be reserved in the memory map of course.

dxforth

unread,
Oct 25, 2021, 11:59:51 PM10/25/21
to
That sounds familiar. Below is a CP/M 3 BIOS listing for the Bondwell 14 which
held the CCP in banked memory. It may help others with their implementation.

https://pastebin.com/RrfERPpm
Reply all
Reply to author
Forward
0 new messages