• Please review our updated Terms and Rules here

Installing CP/M 3 (Plus?) on a home-built Z80 computer

I see the problem. conin depends on const returning with the ZR status bit indicating the result, but your "LD A,$FF" does not set ZR properly. This is why most code uses things like "XOR A,A/DEC A" instead.
 
Just beat me to it!

Remember - in the Z80 - a LD doesn't modify the flags. A logical operation does. This is different to other microprocessors. where a LD does modify the flags. Traps for the unwary in assembler...

Dave
 
Ahhh - dag nabbit! So what's the best way to make sure the Z flag isn't set?

Code:
XOR A
DEC A

as durgadas311 mentions? By my reckoning, that should zero A, then subtract 1 which would make it FF and set Z to zero accordingly?
 
Oooh... that works!!!

Okay. CCP is working - at least as far as DIR and some of my custom commands go.

I had a file before my drive was wiped yesterday that told me what version of CP/M I was running... no idea what it was called now. Any ideas? I just want to confirm that it's definitely CP/M Plus I'm running now! :D
 
LD A,$FF
OR A

Is the simplest way without resorting to complex mental arithmetic.

The only reason you needed the flags setting was not for CPM (it uses the VALUE in the A register) but for your own implementation of conin.

Dave
 
LD A,$FF
OR A

Is the simplest way without resorting to complex mental arithmetic.

The only reason you needed the flags setting was not for CPM (it uses the VALUE in the A register) but for your own implementation of conin.

Dave

Ah, fair enough. Well, I answered my own question above - it was SYSINFO.COM I was looking for:

Code:
A>sysinfo
Processor:   Z80
System:      CP/M 3.1
Top of TPA:  EF00
BIOS start:  F500
BDOS start:  EF00
Common base: C000
Drives:      A: B: C: D: E: F: G: H:

So yes, CP/M Plus is running. :) I just need to 'upgrade' the IO to the interrupt-driven format as that is a requirement for getting data from my support module (date and stuff like that). Once that's done and I can do everything in CP/M Plus that I can do in CP/M 2.2, I just need to work out how to get CP/M Plus to boot instead of 2.2 (i.e. I'm guessing place CPMLDR into Track 0?)
 
I would make sure everything else was working FIRST. Bringing interrupts anywhere near this thing will result in many crashes and sleepless nights I am sure...

Dave
 
Congrats!

As far as putting CPMLDR on track 0, you may want to think hard. For one, you need to have that code be able to execute where the boot ROM places it, or else take some special action to move it. It's unfortunate that you only have one bootable image in your disk layout, because that forces you into one or the other. If you commit to directly booting CP/M 3 then you run the risk of making a mistake sometime when regenerating CPM3.SYS and you'll not be able to boot anything anymore. Whatever you plan to do, make sure you have recovery strategies.
 
LD A,$FF
OR A

Is the simplest way without resorting to complex mental arithmetic.

The only reason you needed the flags setting was not for CPM (it uses the VALUE in the A register) but for your own implementation of conin.

OR $ff (F6 FF)

will do the same and be 1 byte shorter. ;)
 
Yeah okay, fair points. I've got it good at the moment as I have CP/M 2.2, from which I can switch to CP/M 3 if the mood takes me. Can't get much more flexible than that.

It's unfortunate that you only have one bootable image in your disk layout, because that forces you into one or the other.

That's an interesting observation. I wonder how difficult it would be to create a bootable CP/M 3 image on drive D, then have the option to boot from A or D in the ROM...? At the moment, you type 'cpm' and it loads sector 0 from drive A...
 
Can you remind me - what are you using for your disk?

Option at boot time for disk to boot from?

The concept of an 'if I screw up my configuration how do I recover' situation is well worth consideration from the outset.

We have this with our 'mainframes' at work - when making changes to the CLM_USER file, if you make an error you need a recovery disk to boot from! You can use the front panel to bypass the offending item - but even this can leave you with an unusable system.

Dave
 
Yeah okay, fair points. I've got it good at the moment as I have CP/M 2.2, from which I can switch to CP/M 3 if the mood takes me. Can't get much more flexible than that.



That's an interesting observation. I wonder how difficult it would be to create a bootable CP/M 3 image on drive D, then have the option to boot from A or D in the ROM...? At the moment, you type 'cpm' and it loads sector 0 from drive A...

This has been done many ways in the past. One hurdle you have now is that, in order to get more space for boot tracks you'll need to change the layout of the other disks and that impacts not only what is stored on those disks but every copy of CP/M that thinks it knows the layout (since that layout is hard-coded into every BIOS).

What MMS did for SASI disks on the H89 was to place a "pre-boot" loader, along with configuration info, starting at sector 0. That loader knew how to look at the config info (partitioning) along with options passed from the ROM boot command, and continue to boot CP/M from a specific partition. That way, if you had 3 partitions (for example) you could have three different boot images - and select them using options on the boot command string.
 
Can you remind me - what are you using for your disk?

I'm using a 64MB CompactFlash card connected to the system via an 8-bit IDE interface.

Option at boot time for disk to boot from?

The concept of an 'if I screw up my configuration how do I recover' situation is well worth consideration from the outset.

Yes, pretty much - I'd just make it so that 'cpm' boots from A, 'cpm3' boots from D, or something similar. I am now able to recover the system from scratch, or with a new blank CF card, if need be.

We have this with our 'mainframes' at work - when making changes to the CLM_USER file, if you make an error you need a recovery disk to boot from! You can use the front panel to bypass the offending item - but even this can leave you with an unusable system.

Dave

Well, I'm learning as I'm going as software engineering (and electronics) aren't my trades, just my hobbies! :rolleyes:
 
One way to implement a multi-boot option would be to keep the disk layout as-is, and make the CP/M 2.2 image on track 0 be the "loader" for any other OS. If you can pass the boot command to the CP/M 2.2 image, it could do some custom actions in the cold boot path, instead of starting CP/M 2.2.

One tricky area is the CP/M concept of "drive A:" vs. "partition 0" on the flash disk. Right now, your BIOS hard-codes drive A: to partition 0, etc. But for a multi-boot setup you'd want "drive A:" to be whichever partition is appropriate for the OS you are booting. If you solve this problem, then your CP/M 2.2 BIOS cold boot could do something like this:

1) check boot command, default is to jump to CP/M 2.2 normally, OTHERWISE:
2) select a CCP command based on boot command, for example "cpm3" might map to "D:CPMLDR".
3) Place that command into the CCP command buffer, which will cause CCP to execute it immediately on starting.
4) jump to CCP.

The D:CPMLDR.COM, as well as BIOS3 in CPM3.SYS, would have to "swizzle" the disk partition mapping such that "drive A:" was actually partition 3 (or wherever you want CP/M 3 to be). You could go further and modify CPMLDR to accept commandline options and then use those to swizzle drive mapping and pass those along to BIOS3 for the same.
 
One way to implement a multi-boot option would be to keep the disk layout as-is, and make the CP/M 2.2 image on track 0 be the "loader" for any other OS. If you can pass the boot command to the CP/M 2.2 image, it could do some custom actions in the cold boot path, instead of starting CP/M 2.2.

One tricky area is the CP/M concept of "drive A:" vs. "partition 0" on the flash disk. Right now, your BIOS hard-codes drive A: to partition 0, etc. But for a multi-boot setup you'd want "drive A:" to be whichever partition is appropriate for the OS you are booting. If you solve this problem, then your CP/M 2.2 BIOS cold boot could do something like this:

1) check boot command, default is to jump to CP/M 2.2 normally, OTHERWISE:
2) select a CCP command based on boot command, for example "cpm3" might map to "D:CPMLDR".
3) Place that command into the CCP command buffer, which will cause CCP to execute it immediately on starting.
4) jump to CCP.

The D:CPMLDR.COM, as well as BIOS3 in CPM3.SYS, would have to "swizzle" the disk partition mapping such that "drive A:" was actually partition 3 (or wherever you want CP/M 3 to be). You could go further and modify CPMLDR to accept commandline options and then use those to swizzle drive mapping and pass those along to BIOS3 for the same.

I have CPM 3 on CPM 2.2 as a file, launched via CPMLDR.COM. Wouldn't it be easier (if possible) to insert the command 'CPMLDR' into the CCP command buffer when launching CPM 2.2? Then the system would load CPM 2.2 and immediately go into CPM 3? Then I needn't worry about messing around with drive/partition mapping etc. That is, of course, assuming that inserting anything into the CCP command buffer is possible and even vaguely easy? I didn't know you could do it until you mentioned it, durgadas311! :)
 
Yes, you can force something like 'SUBMIT AUTOEXEC' into the CCP command buffer and you will get an automated start-up of commands.

What you have to be sure of (however) is that you don't automatically start CP/M 2.2 which then automatically starts CP/M 3 and then screws up every time!

You need your own MONITOR BOOT program to define whether you want CP/M 2.2 to just start on its own or run its start-up file to do whatever.

Whatever you do - you may want to consider making the CP/M 2.2 disk completely unavailable to other incarnations of CP/M that you may boot - this is perhaps where the drive mapping comes in?

Dave
 
The problem with not swizzling the drives is that the "system disk" is no longer A:. That can create some problems - although it may be possible to just set the default drive to D: for CP/M Plus (I forget whether CP/M 3 restricts booting to only drive A:), especially since CP/M 3 adds a lot more system config options. I'm working off the premise that you do not want your CP/M 2.2 system drive to be the same disk as used for the CP/M 3. first of all, you have a big mess of utilities, some for 2.2 and some for 3, all mixed together. Another is if you want to use the CP/M 3 extended directory structure (timestamps, passwords): while it's not incompatible with CP/M 2.2 it still is messy.

FYI, pre-loading a command into the CCP image was a common method for making "auto run" disks, and is even documented by DRI.
 
Another + for CP/M Plus was that you just created a file called 'PROFILE.SUB' and away it went at start-up. No hacking...

Dave
 
Good point, this CCP hack was for 2.2 (and older). CP/M 3 did not require you to resort to such tactics. I remember being involved in early access discussions with DRI, and they really were open to fixing nearly everything people thought was wrong with CP/M 2.2. You can even setup a search order that the CCP will use when searching for commands, that's in addition to being able to look on "User 0" of a drive (not that there was much use of user numbers, that I recal). I did organize my development system into different user numbers for different projects. It was a little crude, as chuckg has mentioned, but it was usable. PIP on CP/M 3 was greatly enhanced, especially in the area of user number handling, so that copying files around was not too bad.
 
Back
Top