Is there a way to boot CP/M automatically on a RC2014?

450 views
Skip to first unread message

Nick Bolton

unread,
Jul 27, 2022, 8:58:58 AM7/27/22
to RC2014-Z80

Hello all,

I'm using the RC2014 (Z80), running CP/M. The "24886009" ROM chip (photo below) comes with 32k BASIC, 56k BASIC, SCM and CP/M for SIO/2 serial.

When you run CP/M from the RC2014 ROM, you're greeted with a bunch of prompts (screenshot below) that require input to actually start CP/M:

  1. Space
  2. X
  3. Y

Is there a way to automatically boot CP/M on the RC2014 rather than having to enter the 3 keystrokes?

Bonus question: Is there a way to automatically run a CP/M program already loaded on to the RC2014 CF card? (Similar to autoexec.bat on DOS)

CP/M via Tera Term

RC2014 ROM chip

Originally asked on:

Nick

Alan Cox

unread,
Jul 27, 2022, 10:49:47 AM7/27/22
to rc201...@googlegroups.com
> Is there a way to automatically boot CP/M on the RC2014 rather than having to enter the 3 keystrokes?
> Bonus question: Is there a way to automatically run a CP/M program already loaded on to the RC2014 CF card? (Similar to autoexec.bat on DOS)

The first seems to have been well covered by the linked answers

Traditional CP/M does not have an "autoexec.bat" mechanism. A lot of
CP/M BIOSes simply added support for doing so as it's not very hard.
The base RC2014 CP/M doesn't afaik have those modifications (basically
the BIOS just fakes typing in the needed command if the file is
present).

Good discussion here
https://forum.vcfed.org/index.php?threads/autoexec-bat-for-cpm.63383/

Nick Bolton

unread,
Jul 27, 2022, 10:58:11 AM7/27/22
to RC2014-Z80
From the answer:
> "other than modifying the initial loader program on ROM [..] I don't know of a way"

Looking at the comments, someone linked to:

I wonder if that'd be how to modify the initial loader? Does anyone know where might be a good place to start?

> "If you wish to create your own ROM, you will need 2 files; firstly monitorload.hex burned on to ROM, then 0x0100 bytes later, monitor.bin which can be found in the 68B50 ACIA folder. The ROM available from Tindie has these burned at 0x8000 and 0x8100 respectively."
> "The monitorload.hex is a very simple program that copies itself and the monitor from the low area of ROM up to RAM, then pages out the ROM (and therefore pages in the lower RAM), and then copies the monitor back down to run from 0x0000 from RAM."

So I guess I'd need to modify monitorload.hex? Or would I need to modify monitor.bin? Or both?

Nick

Steve Cousins

unread,
Jul 27, 2022, 11:37:19 AM7/27/22
to RC2014-Z80
Hi Nick,

That's an interesting question.

SCM includes a very simple ROM filing system which allows extra features to be added to the monitor. The CPM command is implemented this way. Each extra feature has a descriptor at the end of the ROM bank it is in. Here is an example from a 32k SCM ROM:

7FA0:  55 AA 43 50 4D 20 20 20  20 20 03 00 74 4D 44 00  U.CPM     ..tMD.
7FB0:  55 AA 43 50 4D 20 20 20  20 20 41 80 55 4C B4 00  U.CPM     A.UL..
7FC0:  55 AA 42 41 53 49 43 20  20 20 03 00 09 4D 6B 00  U.BASIC   ...Mk.
7FD0:  55 AA 57 42 41 53 49 43  20 20 01 00 03 30 52 1C  U.WBASIC  ...0R.
7FE0:  55 AA 42 41 53 49 43 20  20 20 01 00 00 30 55 1C  U.BASIC   ...0U.
7FF0:  55 AA 4D 6F 6E 69 74 6F  72 20 02 00 00 00 E6 22  U.Monitor ....."


Each feature has a number of flags in the descriptor which tell SCM what to do with it. One of those flags is AUTORUN. Setting this flag causes the feature to be executed during SCM initialisation.

In this case, setting bit 7 of location 0x7FBA will cause the SCM command to AUTORUN and thus load CP/M at reset. So change the value 0x41 to 0xC1. 

A 16k ROM bank will have this table ending at 0x3FFF.

This is all documented in the Small Computer Monitor User Guide.

Below is a terminal session from the modified ROM. 

Steve


The monitor starts up 'invisibly' before loading CPM:

 CP/M 2.2 Copyright 1979 (c) by Digital Research, BIOS-F (2022-03-23)

A>
A>

Starting up without a CF card enters the monitor but without the usual SCM startup message.:

 Compact flash not present
*
*

Nick Bolton

unread,
Jul 27, 2022, 12:44:51 PM7/27/22
to rc201...@googlegroups.com
Oh that's fantastic, nice! I'll give that a shot.

--

Nick Bolton

nick-p...@nbolton.com

LinkedIn | Twitter


Personal Assistant: Alex Butt (al...@nbolton.com)


Note: I have recently changed my personal email address to nick-p...@nbolton.com. I also have a shared mailbox to which my assistant has access (ni...@nbolton.com). Please update your address book and remove nick.bo...@gmail.com.



--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/UbuO28KVLyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/d87f0b9f-bc7e-4403-a3ce-60612d540843n%40googlegroups.com.

Nick Bolton

unread,
Jan 4, 2023, 6:29:33 AM1/4/23
to RC2014-Z80
Hi Steve,

> In this case, setting bit 7 of location 0x7FBA will cause the SCM command to AUTORUN and thus load CP/M at reset. So change the value 0x41 to 0xC1. 

Would this require me edit the image on my computer, and burn it to the ROM using and EEPROM burner? I'm new to this game, so you may need to state the obvious.

Thanks,
Nick

Steve Cousins

unread,
Jan 4, 2023, 3:30:53 PM1/4/23
to RC2014-Z80
Hi Nick,

Yes, to set the above mentioned bit in the ROM you would need an EPROM programmer. The software to drive the programmer will probably allow you to make simple changes to the image before programming the chip, so no need to recompile everything.

Unless the "ROM" you are using is actually a FLASH chip or other erasable technology you will need to get a new blank chip to create the required image. I think it is most likely you have a One Time Programmable EPROM so you would need a new chip.

Steve

Nick Bolton

unread,
Jan 4, 2023, 3:55:31 PM1/4/23
to rc201...@googlegroups.com
Thanks! Already used a hex editor to modify the image per your instructions, quite easy. 

Now waiting on the ROM chip… 

And the programmer…

Wish me luck!

--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/UbuO28KVLyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
--

Nick Bolton

unread,
Jan 14, 2023, 7:28:33 AM1/14/23
to RC2014-Z80
Hi Steve!

Exciting day. The T48 and ROM chip arrived. As a quick test, I was able to use Spencer's factory 24886009.BIN [1], which correctly loads SCM from ROM and after entering `CPM`, loads CPM from the compact flash card.

But... when I modified bit 7 of 7FB0, now I get a strange error...

    Compact flash not present
    *

Any ideas? I switched back to the original ROM image to make sure the compact flash was still working, and all is well with the original.

Does using the SCM Auto-run feature somehow require some other code to run in order to detect/use the compact flash?

Thanks,
Nick

Nick Bolton

unread,
Jan 14, 2023, 7:29:37 AM1/14/23
to RC2014-Z80
Forgot to mention, I documented my steps: https://retrocomputing.stackexchange.com/a/24897/11478

Nick Bolton

unread,
Jan 14, 2023, 7:45:53 AM1/14/23
to RC2014-Z80
Aha!!! So, at first power on, CP/M does boot automatically! Success!

However, big pit fall: if you press the reset button on the CPU card, you then see "Compact flash not present"

Pressing the reset button the backplane does not cause this error (CP/M boots).

I can live with that, but... I wonder why resetting the CPU does this? :-) 

Bill Shen

unread,
Jan 14, 2023, 8:24:32 AM1/14/23
to RC2014-Z80
Some CF disks take longer time to be ready than other.  I don't know what the spec requires, but I know some of mine can take nearly a second so the software need to wait more before declaring CF not present.  Now you have a EPROM programmer, you can experiment with delaying the CPU startup code  or dive into autostart portion of SCM's code--Steve's code is very well organized and documented so you should be able to modify it to your needs.
  Bill

Steve Cousins

unread,
Jan 14, 2023, 9:17:02 AM1/14/23
to RC2014-Z80
Bill is spot on as usual. Some cards take too long to initialise and thus are not ready in time to auto-start. 

SCM v1.3 tries to identify if a compact flash card is present at start-up and doing this created the same reliability problem you observed. The fix, as Bill says, is to add a delay. I did this in SCM 1.3 and it worked for all my cards. I didn't want to slow SCM's start-up and I couldn't be sure a modest delay would work with all cards. So, I then devised a different detection method that didn't require the card to finish initialising and thus didn't need the delay.

Not sure about the reset button issue.

Steve

Steve Cousins

unread,
Jan 14, 2023, 10:04:51 AM1/14/23
to RC2014-Z80
Hi Nick,
Sorry I forgot about the startup delay issue when suggesting you set the auto-run bit for the CP/M loader.
I've made a note to consider improving the CPM boot so that it retries after a delay.
Steve

Nick Bolton

unread,
Jan 14, 2023, 1:52:51 PM1/14/23
to RC2014-Z80
>  improving the CPM boot so that it retries after a delay

That would be a neat improvement! +1

Nick Bolton

unread,
Jan 14, 2023, 4:14:34 PM1/14/23
to RC2014-Z80
Hi Steve,

Actually, after further experimentation, the CF retry feature would be a very useful feature to me, because when resetting the RC2014 via the backplane reset button, most of the time it'll find the CF card, but maybe 1 in 5 times the CF card will be too slow and I'll get the "Compact flash not present" error (the workaround is to keep pressing the reset button until I get lucky with the timing).

In the meantime, I'll try adding a delay as Bill suggested. I guess I'd need to edit the SCM .asm code and recompile my own ROM image, right? If so, some pointers on how to do that would be much appreciated! If not, some pointers how to hack the ROM image with a hex editor would be super helpful (though I somehow doubt it's as easy as changing a couple of bytes).

Cheers,
Nick

Steve Cousins

unread,
Jan 14, 2023, 5:38:32 PM1/14/23
to RC2014-Z80
Actually, it might be that easy.

One of the first things that happens when SCM is reset is the selftest. This includes an LED display sequence. The sequence is software timed with a loop. This loop can be extended quite a bit by just changing one byte.

Here is the current version:

1F49: 21 50 C3      0119              LD   HL,50000       ;Set delay time (approx 15000 loops)
1F4C: 19            0121  @Delay1:    ADD  HL,DE          ;Delay loop increments HL until
1F4D: 30 FD         0122              JR   NC,@Delay1     ;  it reaches zero
1F4F: 07            0123              RLCA                ;Rotate LED bit left
1F50: 30 F5         0124              JR   NC,@Loop1      ;Repeat until last LED cleared


I think the byte sequence 19 30 FD 07 is common to all versions (hopefully). Its location will vary with different versions and configuration. 

Find this and edit the preceding LD HL instruction. The lower the value loaded in HL the longer the delay. I'd suggest changing the C3 value (above) to a much lower value, say 10.

If you want to edit the source and build a custom ROM, start here:
https://smallcomputercentral.com/small-computer-monitor/

Steve

Alan Cox

unread,
Jan 14, 2023, 6:23:29 PM1/14/23
to rc201...@googlegroups.com
On Sat, 14 Jan 2023 at 21:14, Nick Bolton <nick-p...@nbolton.com> wrote:
>
> Hi Steve,
>
> Actually, after further experimentation, the CF retry feature would be a very useful feature to me, because when resetting the RC2014 via the backplane reset button, most of the time it'll find the CF card, but maybe 1 in 5 times the CF card will be too slow and I'll get the "Compact flash not present" error (the workaround is to keep pressing the reset button until I get lucky with the timing).

The standard RC2014 reset signal is not very clean. It may be a
cleanness issue rather than a timing one. It depends a lot on the
board. Those with reset controllers usually have a much cleaner reset.

When the CF powers up it goes through a self test but it ought to be
too fast to matter. It is actually permitted to take upwards of 30
seconds (remember the world of big old 5.25" disks). Fortunately the
busy bit goes valid 400ns after reset is cleared, so providing RC2014
is checking the busy bit the disk will have busy in a stable set long
before the Z80 checks on it.

Nicolae Muntean

unread,
Apr 23, 2024, 4:01:20 PM4/23/24
to RC2014-Z80
Hello 
Is it also possible in ROMWBW?

Wayne Warthen

unread,
Apr 23, 2024, 4:30:11 PM4/23/24
to RC2014-Z80
Yes, but you will need to build a custom ROM (assuming you don't have a front panel with toggle switches which few people do).  You will need the RomWBW distribution archive (.zip) file which you can download from the RomWBW GitHub Releases Page.

In the RomWBW distribution, you will modify the file /Source/HBIOS/Config/rcz80_std.asm.  First, change this line:

#DEFINE BOOT_DEFAULT    "H"             ; DEFAULT BOOT LOADER CMD ON <CR> OR AUTO BOOT

to whatever command you want to auto-run.  If you want to start CP/M from ROM, you would use:

#DEFINE BOOT_DEFAULT    "C"             ; DEFAULT BOOT LOADER CMD ON <CR> OR AUTO BOOT

or if you want to boot CP/M from a disk, you would specify the disk unit and slice, for example:

#DEFINE BOOT_DEFAULT    "2.0"           ; DEFAULT BOOT LOADER CMD ON <CR> OR AUTO BOOT

Additionally, you would add a line like the following changing "5" to the number of seconds you want to pause before starting the automatic boot.  This line should be added at the end of the file.

BOOT_TIMEOUT    .SET    5               ; AUTO BOOT TIMEOUT IN SECONDS, -1 TO DISABLE, 0 FOR IMMEDIATE

Then you would generate a custom ROM using the instruction found in the file /Source/ReadMe.txt

Thanks, Wayne

ladislau szilagyi

unread,
Apr 24, 2024, 12:46:53 AM4/24/24
to RC2014-Z80
Hi,
I'm late to the party... but take a look at https://github.com/Laci1953/RC2014-CPM/tree/main/BOOT
You will find there .HEX images of ROMs configured to directly boot CP/M on all RC2014's configurations using: - Steve Cousins SC108, SC114, SC118, SC150, SC152 or - Phillip Stevens's 32KB ROM+128KB RAM memory module (MM) or - Spencer Owen's 512KB ROM + 512KB RAM memory board (M512) , provided with serial boards using SIO or KIO or ACIA ,

and 64/128MB CF's.

Ladislau
Reply all
Reply to author
Forward
0 new messages