• Please review our updated Terms and Rules here

Autoexec.bat for cpm?

CP/M 3 would run PROFILE.SUB at bootup. Insert whatever commands you need into PROFILE.SUB and that should give the desired result.
 
On earlier versions of CP/M you could insert a command into the command line buffer and (when loaded) that command would be executed. The usual command was to execute a SUBMIT file.

In some cases, the machine supplier would provide some kind of CP/M utility to perform this magic automatically. If not, the patches to do it yourself were published.

Dave
 
Here’s a video describing more about automatically running a command line on cold and/or warm boot in CP/M 2.2. The concepts are applicable to most any CP/M 2.2, but note that the addresses shown are specific to CP/M on the Altair.

https://m.youtube.com/watch?v=RxrPmbsmyBs&feature=youtu.be

The video shows running MOVCPM to get the CP/M image to modify, but you can also get the CP/M image by running SYSGEN, selecting the boot drive as the source, and then pressing return to exit to CP/M. At this point, save the image to a file with the SAVE command to then turn around and load the image for patching using DDT as shown in the video.

Finding the location of the MODE byte to patch is a bit more work, but not too difficult. Unfortunately, it’s not going to be the same address as the Altair CP/M example.

I can help you find the mode byte location for your CP/M and patch one of the auto-run configuration programs to work on your machine if you need.

Mike
 
Last edited:
Note that the CP/M 2.2 CCP has two entry points (two JMPs at the beginning). While not well documented, the first is the "cold start" one and will execute any command in the command buffer (as described previously), while the second entry is the "warm start" and will ignore any command pre-initialized in the buffer. This was the intended method of handling such setups, so that the BIOS simply chooses to jump to "CCP" or "CCP+3" depending on the context.

The command buffer normally starts immediately after these two JMPs. The byte at CCP+6 should be 7FH to indicate the total length of the command buffer, next the default distro has 00H to indicate no command in the buffer. You change CCP+7 to indicate the total length of the command, and then put the command characters starting at CCP+8.

Some vendors did make their own custom CCP, although DRI did recommend not changing this part of the CCP image. Also, some vendors did not place the CCP in the boot tracks, so if you go examining the disk sectors directly you may not find what you expect. As deramp5113 mentions, SYSGEN is usually the easiest way to handle this, although it takes more steps. But, some (most?) vendors customized SYSGEN as well, so you may have to hunt around for the CCP. A conforming CCP should have those two JMPs, then (usually) 07FH, then 00H, then a copyright message like "Copyright 1979 (c) by Digital Research" (although it might have been customized to include the vendor). It's not a terribly unique pattern, but can be helpful. The BDOS and BIOS will not look like that.
 
Great job on the video Mike

The copy of cpm I want to modify is the one Grant Searle did for his minimalist cpm on a breadboard machine.

Not sure if you have seen my microtv clock... For anyone but me it's a lot of work to get running.

http://www.chronworks.com/TvClock/

Right now I have a little terminal built in that I plug in a keyboard and monitor to bring up cpm and start the clock. The cf card is partitioned into 8 drives. I have the clock sw on e: I can put the software on the a: drive if necessary. Can I assume that it's possible to run a program from any drive with e:clock as the atart up command?

Anywho, that's a bit of background for you.

Cheers,

Len
 
Can I assume that it's possible to run a program from any drive with e:clock as the atart up command?

Yes, the command will be interpreted exactly like any command you type at the CCP prompt. As long as it does not have any prerequisites (i.e. you will be running that command on a cold boot, so something like "SAVE xx file" doesn't really do anything useful)
 
Great job on the video Mike

The copy of cpm I want to modify is the one Grant Searle did for his minimalist cpm on a breadboard machine.

Not sure if you have seen my microtv clock... For anyone but me it's a lot of work to get running.

http://www.chronworks.com/TvClock/

Right now I have a little terminal built in that I plug in a keyboard and monitor to bring up cpm and start the clock. The cf card is partitioned into 8 drives. I have the clock sw on e: I can put the software on the a: drive if necessary. Can I assume that it's possible to run a program from any drive with e:clock as the atart up command?

Anywho, that's a bit of background for you.

Cheers,

Len

Looks like Grant's BIOS jumps to the first jump in the CCP when entering CP/M (both cold and warm boot) which WILL run a command line. His BIOS has no flags for controlling options for executing or not, or for selectively running for cold and/or warm boot.

In Grant's CP/M implementation, the CCP is at D000h in memory. To do what you want, follow "Part 2 Putsys" in the "Installing CP/M" section on Grant's website. Then, before running PUTSYS, put your command string ("e:clock") into memory starting at D008h. Follow the ASCII string with a zero byte. Put the length of the string (7) at location D007. Then run PUTSYS. Upon rebooting (both cold and warm), e:clock will be run.

Let me know how it goes.

Mike
 
Looks like Grant's BIOS jumps to the first jump in the CCP when entering CP/M (both cold and warm boot) which WILL run a command line. His BIOS has no flags for controlling options for executing or not, or for selectively running for cold and/or warm boot.

In Grant's CP/M implementation, the CCP is at D000h in memory. To do what you want, follow "Part 2 Putsys" in the "Installing CP/M" section on Grant's website. Then, before running PUTSYS, put your command string ("e:clock") into memory starting at D008h. Follow the ASCII string with a zero byte. Put the length of the string (7) at location D007. Then run PUTSYS. Upon rebooting (both cold and warm), e:clock will be run.

Let me know how it goes.

Mike


Thanks Mike,

Tomorrow I will make a back up of my cf card and give it a try.

So what you are telling me is that one I make the change I wont be able to warm boot back to a cpm prompt?

Len
 
If Grant's BIOS doesn't differentiate between warm and cold start, then you are stuck - sort of. Most CP/M BIOSes, and I think Grant's also, reload the CCP from disk each warm boot. They really have to, since CP/M programs are free to use the memory normally occupied by the CCP. So, if your CCP image on disk contains this command, and your BIOS doesn't jump to CCP+3 on warm start, then you're kinda stuck. But, if you make a simple modification to the BIOS so that warm boot jumps to CCP+3 (and leave cold boot to jump to CCP+0), then you should have the flexibility to enter and exit clock mode as desired.
 
If Grant's BIOS doesn't differentiate between warm and cold start, then you are stuck - sort of. Most CP/M BIOSes, and I think Grant's also, reload the CCP from disk each warm boot. They really have to, since CP/M programs are free to use the memory normally occupied by the CCP. So, if your CCP image on disk contains this command, and your BIOS doesn't jump to CCP+3 on warm start, then you're kinda stuck. But, if you make a simple modification to the BIOS so that warm boot jumps to CCP+3 (and leave cold boot to jump to CCP+0), then you should have the flexibility to enter and exit clock mode as desired.

Can the bios be modified on the system in-flight? Or do I need to assemble that elsewhere? I supose I'm at the edge of the RTFM area...

Len
 
Thanks Mike,

Tomorrow I will make a back up of my cf card and give it a try.

So what you are telling me is that one I make the change I wont be able to warm boot back to a cpm prompt?

Len

How does your program exit? If it exits with a jump to zero (i.e., warm boot), then you are correct, you won’t be able to exit to a CP/M prompt. If it exits with a RET instruction to the CCP, then you will get a prompt.

In either case, you are better off patching the BIOS to jump to the 2nd CCP entry for warm start. Shouldn’t be hard to patch in memory as long as there are a few bytes of spare space at the end of the BIOS to put the patch.

Mike
 
How does your program exit? If it exits with a jump to zero (i.e., warm boot), then you are correct, you won’t be able to exit to a CP/M prompt. If it exits with a RET instruction to the CCP, then you will get a prompt.

In either case, you are better off patching the BIOS to jump to the 2nd CCP entry for warm start. Shouldn’t be hard to patch in memory as long as there are a few bytes of spare space at the end of the BIOS to put the patch.

Mike

Not sure how it exits, the code was generated using a c compiler. I'd have to dissassemble something simple to see.

I'm currently reading the cpm 2.2 manual trying to see how this all works, lotsa fun! I have my second system about ready to run. I will see where I can get to tomorrow.

Thanks for all the help. This is fun.

Len
 
Can the bios be modified on the system in-flight? Or do I need to assemble that elsewhere? I supose I'm at the edge of the RTFM area...

Len

Did you pick up a binary BIOS image to flash on to disk? Or compile from assembler source code? If you can point me at what you used I could patch it for you.
 
Did you pick up a binary BIOS image to flash on to disk? Or compile from assembler source code? If you can point me at what you used I could patch it for you.

All the source files are here:

http://searle.hostei.com/grant/cpm/

Specifically:

http://searle.hostei.com/grant/cpm/z80sbcFiles.zip

I have to do some mods to the monitor as well so it doesn't hang waiting for the <space> <X> and <Y> to boot CPM. There is a monitor of basic you can choose from. I was thinking a time out and then default to a CPM boot whould be good.

I've got my second system up and running the same CF image that my clock runs. I built two CPM SBC's originally. If anyone is interested the PCB layouts are available, I can also post gerbers. It's a cute little machine.

len
 
I'm not sure what all is required to build a system image, but here's updated source (ASM) files for CBIOS, along with LST and HEX files. I also added a "diffs" file to show what I changed. I went for minimal changes rather than elegance, etc. I used ZMAC, so the HEX files are in traditional 16-byte lines instead of 24. I also had to change the 'list' symbol in CBIOS because that's a reserved word.

View attachment ccp_wboot_patch.zip

I don't have anyplace to test it, but I think someone can look at the diffs and/or code and see if looks right. Hope this helps.
 
I'm not sure what all is required to build a system image, but here's updated source (ASM) files for CBIOS, along with LST and HEX files. I also added a "diffs" file to show what I changed. I went for minimal changes rather than elegance, etc. I used ZMAC, so the HEX files are in traditional 16-byte lines instead of 24. I also had to change the 'list' symbol in CBIOS because that's a reserved word.

View attachment 44229

I don't have anyplace to test it, but I think someone can look at the diffs and/or code and see if looks right. Hope this helps.

Looks good to me. You can simply choose your modified cbios.hex file in step 2 of Part 2 PUTSYS.

Mike
 
Back
Top