avatar_JonB

Calling all PCW experts: Alternative cold boot sequence?

Started by JonB, 14:58, 18 October 17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JonB

Hi

The Amstrad PCW cold boot sequence is a bit odd. There is no boot ROM inside the machine to load up the CP/M Plus boot sector, as documented here: https://www.chiark.greenend.org.uk/~jacobn/cpm/pcwboot.html

Instead, the machine starts up in a special mode whereby memory reads are serviced by the printer controller chip, and this contains a short program to copy the boot code to RAM for execution. As a result, it does not look possible to amend it to boot from any device other than the first floppy disk. Yet we know that at least one manufacturer managed this feat; the Cirtech GEM drive, a hard disk for the PCW, was bootable.

So the question is: how does the Gem drive work, and can we work out a way to replicate it?

The reason I ask is that since I already produced the uIDE card for the PCW, I would like to make it directly bootable, bypassing the A: drive entirely.

Cheers
JonB


GeoffB17

Jon,


This would be very nice, but is it really necessary?   I guess you just need the challenge?


From the evidence regarding the GEM drive, it must be possible, and maybe it would be possible with your UIDE, but you'll need to find some way to read the UIDE _before_ your driver is loaded?


An alternative (??) might be to leave the bootstrap code alone, and just change the boot sector code on the floppy so than instead of reading A:*.EMS it reads C:*.EMS - although this still assumes that the C: drive can be accessed in some way.


Anyway, I have no problem at all with the present boot process, where all the 'extra' things (in PROFILE.SUB) that take up quite a bit of time are now accessing C: rather than A:.   Even this is such a massive improvement over the totally floppy based boot.


Geoff

JonB

A good idea, Geoff, which I hadn't considered.


Hmmm. The uIDE drive is available at all times, generally. I've written code to read the boot sector in BASIC, it's that easy. Look at the program on the wiki page that retrieves the FID file from a pre-populated DOM. It reads it from the very first sector and saves it to a FID.


However, my view is that uIDE isn't really complete until it boots. I'm not saying I'm capable of doing this, but if I don't try I won't know. I built uIDE for the same reason, but also because there's not enough people giving the PCW the attention it deserves. "It's just a word processor." Or so they say.


I beg to differ... and besides, if such a thing was easy, where'd be the fun in it?

robcfg

Hi Jon,


@Habi developed a clone of the PCW diagnostics board, which boots from a rom.


It may be what you're looking for.


Here's the link.


Best luck!

GeoffB17

Jon,


I may have one of the original Amstrad boards.   Mine is about the same size as illustrated, and has the edge connector in a similar situation, but component layout etc is totally different.


According to the instructions, you plug the board in, and ensure no disks are in.   Then, start up the computer, and the machine will boot up into the diagnostic s/w and do various things, tests, etc, which part way through do involve some tests of the floppy drives.


I've never tried to do anything with it!


From the instructions, though, this board will boot the machine into something, from the ROM on the board, and may therefore offer some info.   The 2 ROMs are in sockets, and may well NOT be the original ones (they have labels that do not have the same code on as referred to in the instructions, but I'd assume they are later versions??).


Jon, I'll never bother to try to do anything with this, if it's any use to you, I could sent it to you.   With the manual.


Maybe I should try to run it first, to check it still works??


Geoff

IanS

Quote from: JonB on 14:58, 18 October 17
So the question is: how does the Gem drive work, and can we work out a way to replicate it?
So there appears to be a ramdis signal on the expansion bus. From the PCW boot sequence doc it does a "OUT     (0F8h),A " when it starts running the bootstrap code.
You may be able to detect the OUT command, disable the internal ram and then map a rom over the bottom of memory with a IDE bootstrap code.

Does that sounds possible. I can't find a lot of info on the PCW expansion connector pins.

JonB

Quote from: GeoffB17 on 16:21, 19 October 17
Jon,


I may have one of the original Amstrad boards.   Mine is about the same size as illustrated, and has the edge connector in a similar situation, but component layout etc is totally different.


According to the instructions, you plug the board in, and ensure no disks are in.   Then, start up the computer, and the machine will boot up into the diagnostic s/w and do various things, tests, etc, which part way through do involve some tests of the floppy drives.


I've never tried to do anything with it!


From the instructions, though, this board will boot the machine into something, from the ROM on the board, and may therefore offer some info.   The 2 ROMs are in sockets, and may well NOT be the original ones (they have labels that do not have the same code on as referred to in the instructions, but I'd assume they are later versions??).


Jon, I'll never bother to try to do anything with this, if it's any use to you, I could sent it to you.   With the manual.


Maybe I should try to run it first, to check it still works??


Geoff


May as well send it. I'll PM you. If it's not working I can fix it.


Thanks!

JonB

Quote from: IanS on 18:11, 19 October 17
So there appears to be a ramdis signal on the expansion bus. From the PCW boot sequence doc it does a "OUT     (0F8h),A " when it starts running the bootstrap code.
You may be able to detect the OUT command, disable the internal ram and then map a rom over the bottom of memory with a IDE bootstrap code.

Does that sounds possible. I can't find a lot of info on the PCW expansion connector pins.


I think that is the problem. I do have the pinout, though, and with a uIDE PCW expansion card (which gives access to all the PCW specific pins via jumpers) I can have a play around.


robcfg

I think it must be using the same mechanism as Habi with the diagnostics boards.


In the link I posted before you'll find al info on the diagnostic boards.

JonB

Problem is I'm no good at CPLDs... I'm going to try and reverse engineer the Amstrad diagnostic board.

robcfg

Would you be so kind to scan both sides of both boards? 300 dpi should be good enough.

JonB

I wasn't planning on dismantling it... but happy to post pictures.

jamesots

Quote from: JonB on 19:15, 21 October 17
Problem is I'm no good at CPLDs... I'm going to try and reverse engineer the Amstrad diagnostic board.


The CPLD is just a bunch of logic gates and flip-flops — it should be fairly simple to do the same thing with discrete logic. Using a CPLD makes it easier to rewire the logic gates when I make a mistake (which happens quite often).


I'm just looking for an IO write to port F8 with value 0, which sets a flag which makes all memory reads in the range 0000-7FFF come from my ROM (MDIS goes low if these addresses are read from). When another port (B0 in my case) is written to (I don't care about the value), then it releases MDIS and lets the PCW read from normal memory again.


To be honest, I'm not sure I even need to wait for 0 on port F8 - I might be able to take over the memory bus immediately, which would be much simpler. (It would also prevent my boot ROM from being switched in at any other time if someone sends 0 to port F8 again for some reason). But I was guessing that in the special printer ROM boot mode the PCW might not honour MDIS properly. I haven't tried it yet though.


James Ots

IanS

Quote from: jamesots on 10:15, 25 October 17


To be honest, I'm not sure I even need to wait for 0 on port F8 - I might be able to take over the memory bus immediately, which would be much simpler. (It would also prevent my boot ROM from being switched in at any other time if someone sends 0 to port F8 again for some reason). But I was guessing that in the special printer ROM boot mode the PCW might not honour MDIS properly. I haven't tried it yet though.


James Ots

The advantage to waiting for the zero write to F8, is that you then know what the PC will be (0002?).

So the MDIS signal is an input to the PCW, to disable the internal RAM? Do you know of any documentation about this?

jamesots

Quote from: IanS on 11:34, 25 October 17
The advantage to waiting for the zero write to F8, is that you then know what the PC will be (0002?).

So the MDIS signal is an input to the PCW, to disable the internal RAM? Do you know of any documentation about this?


Ha, I knew there was another reason I was doing that!


I haven't seen any proper documentation about MDIS, but I did read somewhere that it disables the memory, which is why I tried using it.

JonB

It's right there at the start of the diagnostic ROM:


l0000:  RRA     
l0001:  LD      (BC),A
        NOP     
l0003:  INC     BC
        XOR     A
        OUT     (0F8H),A                       <---- here!
l0007:  OUT     (0F5H),A
        OUT     (0F6H),A
        LD      A,40H
        OUT     (0F7H),A
l000f:  LD      A,0EH
        OUT     (80H),A
        XOR     A
        OUT     (0F1H),A
        LD      HL,4000H
        LD      (HL),A
        LD      A,88H
        OUT     (0F2H),A
        LD      (8000H),A
l0021:  LD      A,(HL)
        OR      A
        LD      A,08H
        JR      NZ,L0069                ; (+42h)
        LD      A,90H
        OUT     (0F2H),A
        LD      (8000H),A
        LD      A,(HL)
        OR      A
        LD      A,10H
        JR      NZ,L0069                ; (+35h)
        LD      A,20H
        JR      L0069                   ; (+31h)
        EXX     
        JP      (HL)



I dunno what the rest of it does, though (yet!). I had a quick look at the board and it appears that MDIS is connected to the on-board PAL16L8ANC. I'm guessing it holds MDIS active at startup so that the ROM can be at 0000h.

JonB



jamesots

Quote from: JonB on 15:22, 01 November 17
Habi's already been here... http://www.habisoft.com/irmia/categoria.asp?cat_id=16   :)


Now that's where I found the description of the Sprinter before. I'll bookmark it this time :)

Powered by SMFPacks Menu Editor Mod