Section 1.B.1 of the Zebra Disk Drive Technical Manual describes the function of the 1K ROM contained in the controller. Whenever you power-up the controller or cold-boot it using the reset button, the ROM is activated. The ROM memory has a small program which reads sector 0 of track 0 of disk A into RAM, beginning at address 3F00h. This bootstrap ROM can be paged in or out by using bit 6 of controller port 0E0h. When this bit is set, the ROM is paged out and replaced by RAM. When reset, it is paged in.
By using bit 6 of port 0E0h in a CP/M controller, we can see for ourselves just what this bootstrap ROM program looks like. We will write a small Z80 assembly program, ROM.COM, to page in this ROM, copy the contents for later inspection and page normal RAM memory back in.
First, load up your favorite CP/M debugging tool. Since our controllers use the Z80A CPU, I’ll be using ZSID.COM, which used the Z80 mmemonics, for this demonstration.
We’ll load up ZSID.COM just by typing ZSID at the CP/M prompt A>. After it is loaded, use the assemble command A100 at the ZSID # prompt. This will allow us to type in the following short program.
0100 DI
0101 LD HL,0110
0104 LD DE,0A00
0107 LD BC,0020
010A LDIR
010C JP A000
010F NOP
0110 IN A,0E0
0112 RES 6,A
0114 OUT 0E0,A
0116 NOP
0117 NOP
0118 NOP
0119 LD HL,0000
011C LD DE,0B00
011F LD BC,0400
0122 LDIR
0124 IN A,0E0
0126 SET 6,A
0128 OUT 0E0,A
012A NOP
012C NOP
012D EI
012E LD HL,0B00
0131 LD DE,0100
0134 LD BC,0400
0137 LDIR
0139 CALL F6CC
013C RET
013d .
We exit from the assemble command by typing a control C(^C). This will let you leave ZSID and do a warm boot to restore the CCP module.
As soon as this is done, give the following command at the normal A> prompt: SAVE 1 ROM.COM.
This will put our program to disk. Now to run our program, just give the name of it at the normal CP/M A> prompt: ROM.
As soon as the program finishes running and gives you the familiar A> prompt, give the command: SAVE 4 BOOT.ROM
This will save the boot ROM to disk.
To examine this code, we one again use ZSID.COM at the A> prompt, but this time we use the name of our code file as part of the command: ZSID BOOT.COD.
We can now examine this code which we now have at address 0100h with the ZSID list command, L100. Don’t forget that this code normally starts at 0000h rather than 0100h, so be sure to mentally transcribe the addresses down by 100h.
HOW THE PROGRAM WORKS
When we page in the boot ROM, it will replace the RAM from 0000h to 03FFh, so we must first move the working part of our program to higher memory. The instructions at 0101h through 010Ah push the working code, which resides at 0119h through 013Ch, up to A000h. The next instruction jumps us to the code now located at A000h. The first thing we do there is to get the contents of the controller port, set bit 6 and load this back into port 0E0 to activate the boot ROM. I put NOP instructions just in case a small delay is needed to insure that the ROM is paged in before we continue with that program, since I had no information on the timing involved.
With the ROM now paged in, we relocate the contents to high memory at B000h. The next instructions undo the paging and restore the RAM. Since we want to save the ROM contents without having to save all of that high memory location, I relocated the contents down to 0100h. This is the location that the CCP SAVE command begings saving from. The call to location F6CC is a direct call to the warm boot routine which allows return to CP/M. I did it this way because I wasn’t sure if the prior contents of locations 0000 through 00FFh of RAM would be lost by paging in the boot ROM in their place. I decided a warm boot would be the safest exit.
After the warm boot is complete, we are left with our 1K boot file beginning at location 0100h and we save it to disk by using the SAVE command for later inspection.
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.