Author Topic: Calling all PCW experts: Alternative cold boot sequence?  (Read 1743 times)

0 Members and 1 Guest are viewing this topic.

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
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

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #1 on: 17:04, 18 October 17 »
More info on the GEM drive courtesy of John Elliot.


http://www.seasip.info/Unix/Joyce/gemdrive.html

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 615
  • Country: gb
  • PCW since '85
  • Liked: 132
  • Likes Given: 7
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #2 on: 18:42, 18 October 17 »
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

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #3 on: 23:08, 18 October 17 »
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?
« Last Edit: 23:16, 18 October 17 by JonB »

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.279
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1015
  • Likes Given: 2384
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #4 on: 16:26, 19 October 17 »
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!

Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 615
  • Country: gb
  • PCW since '85
  • Liked: 132
  • Likes Given: 7
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #5 on: 18: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

Offline IanS

  • CPC6128
  • ****
  • Posts: 196
  • Country: gb
    • index.php?action=treasury
  • Liked: 49
  • Likes Given: 42
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #6 on: 20:11, 19 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.

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #7 on: 10:01, 20 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!

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #8 on: 10:06, 20 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.

Offline IanS

  • CPC6128
  • ****
  • Posts: 196
  • Country: gb
    • index.php?action=treasury
  • Liked: 49
  • Likes Given: 42

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.279
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1015
  • Likes Given: 2384
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #10 on: 18:17, 21 October 17 »
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.

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #11 on: 21:15, 21 October 17 »
Problem is I'm no good at CPLDs... I'm going to try and reverse engineer the Amstrad diagnostic board.

Offline robcfg

  • Supporter
  • 6128 Plus
  • *
  • Posts: 2.279
  • Country: se
  • 8-Bit Technomancer
    • index.php?action=treasury
  • Liked: 1015
  • Likes Given: 2384
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #12 on: 21:40, 21 October 17 »
Would you be so kind to scan both sides of both boards? 300 dpi should be good enough.

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #13 on: 08:59, 22 October 17 »
I wasn't planning on dismantling it... but happy to post pictures.

Offline jamesots

  • CPC464
  • **
  • Posts: 22
  • Country: gb
  • Liked: 31
  • Likes Given: 1
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #14 on: 12:15, 25 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

Offline IanS

  • CPC6128
  • ****
  • Posts: 196
  • Country: gb
    • index.php?action=treasury
  • Liked: 49
  • Likes Given: 42
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #15 on: 13:34, 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?

Offline jamesots

  • CPC464
  • **
  • Posts: 22
  • Country: gb
  • Liked: 31
  • Likes Given: 1
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #16 on: 00:44, 26 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.

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #17 on: 09:43, 31 October 17 »
It's right there at the start of the diagnostic ROM:


Code: [Select]
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.
« Last Edit: 09:44, 31 October 17 by JonB »

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #18 on: 13:32, 31 October 17 »
Diagnostic ROMs attached...


 [ Invalid Attachment ]

Offline JonB

  • 6128 Plus
  • ******
  • Posts: 752
  • Country: gb
  • Liked: 203
  • Likes Given: 48
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #19 on: 16:22, 01 November 17 »

Offline jamesots

  • CPC464
  • **
  • Posts: 22
  • Country: gb
  • Liked: 31
  • Likes Given: 1
Re: Calling all PCW experts: Alternative cold boot sequence?
« Reply #20 on: 10:43, 02 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 :)