• Please review our updated Terms and Rules here

CBIOS issues... adapting CP/M to own system

Svenska

Veteran Member
Joined
Mar 19, 2007
Messages
761
Location
Sweden
Hi,

I have designed a Z80 system, and I have a bit of trouble getting CP/M 2.2 to see files.
The system currently uses an AVR controller for initial bootstrap, serial and storage (using its embedded flash memory).

So, I have a ROM drive with 24 KiB in size, with a very simple hardware interface (write the 8-bit sector number to port 0x0F, then read 128 bytes from the same port). The geometry is defined as follows:
Code:
  DPB:          |  /etc/cpmtools/diskdefs:
    SPT = 1     |    diskdef romdisk
    BSH = 3     |      seclen    128
    BLM = 7     |      tracks    192
    EXM = 0     |      sectrk    1
    DSM = 16    |      blocksize 1024
    DRM = 31    |      maxdir    32
    AL0 = 128   |      skew      1
    AL1 = 0     |      boottrk   56
    CKS = 0     |      os 2.2
    OFS = 56    |    end

The system tracks contain a tiny first-stage loader (track 0), which only loads the CBIOS into memory, then CCP+BDOS (tracks 1 to 44), and finally the CBIOS (tracks 45 to 55). Additionally, the disk contains PIP.COM, STAT.COM and SURVEY.COM in the data area, which completely fills the disk.

The CBIOS correctly loads CCP+BDOS at WBOOT, and CP/M boots correctly. However, "DIR" only shows "NO FILE".

Both the first-stage loader and the CBIOS read data directly using the I/O port, so reading of data works fine.
At boot, CP/M reads sectors 56 to 63 (the directory), but when I do "DIR" it only reads the first directory sector.

The image itself is created as follows:
Code:
mkfs.cpm -f romdisk -bboot/romboot.bin -bcpm20.bin -bcbios/cbios.bin romdisk_data.bin
cpmcp -f romdisk romdisk_data.bin tools/survey.com tools/pip.com tools/stat.com 0:
and when inspecting the image file with "fsed.cpm -f romdisk romdisk_data.bin", everything seems in place.

The code called from CBIOS is decidedly simple:
Code:
ROMREAD:
        LD A, (TRACK)
        OUT (ROMPORT),A ; select sector=track

        LD HL, DMAAD    ; select destination
        LD C,  ROMPORT  ; disk data port
        LD B,  128      ; 128 bytes
        INIR            ; read

        LD A,  0
        RET             ; return no error

Is there something obvious I am missing?

Also, is it a smart idea to make A: a read-only drive?
I have never seen a real-world CP/M system, so I am rolling my own instead.

Best Regards,
Svenska
 
Last edited:
The DPB looks correct, although SPT=1 is certainly unusual for "real" disks. It is also not normal to set A: R/O, but you should still be able to DIR. Maybe trace your code and confirm what sector (track) is being accessed. The directory should start at track/sector 56. I'm not sure how the BDOS will handle SPT=1 and so you might want to print both track and sector numbers provided by BDOS.
 
Back
Top