Read directory in CP/M - who knows the details.

73 views
Skip to first unread message

Laszlo Sz.

unread,
Jun 4, 2023, 1:47:17 PM6/4/23
to retro-comp
Hi,
I am having a hard time figuring out how directory access works in detail. I have a floppy DD DS 80 * 1024 * 5, no reserved tracks. The directory starts on Trk 0 head 0 sector 1. I managed to modify RomWbW  to read this type of sectors. I do not succeed in accessing the directory. See the attached log. When using a 1.2Mb HD disk, accessing the directory reads the first track, then moves on to the next track and displays the entries. At 1024 sectors, the system tries to read the 6th sector, not the next track. This is an error. Does anyone have an idea where to look for the cause? I am not sure if it is a problem with BDOS, CBIOS or HBIOS. Does anyone have any ideas?
I would be very grateful for any feedback.
Thanks a lot
Laszlo
dir_acc.txt

Douglas Miller

unread,
Jun 4, 2023, 2:21:52 PM6/4/23
to retro-comp
I'm not sure whether you're trying to access the directory and files from CP/M or some raw access program. For CP/M, you need to create a DPB that specifies how to access the disk, and this includes a sectors-per-track value which CP/M uses to compute track and sector numbers that are passed back to the BIOS for reading/writing the disk. The BIOS is responsible for providing the DPB to the BDOS. The BIOS is also responsible for taking the BDOS track and sector and computing side number and any other values required to access the disk. I believe that the RomWBW HBIOS is out of the way (for the most part) when CP/M takes over, aside from doing the raw disk accesses. So, I think what you need to do is get the CBIOS to provide the correct DPB, and to handle side selection as needed.

Laszlo Sz.

unread,
Jun 4, 2023, 4:04:22 PM6/4/23
to retro-comp
I am trying to access from cp/m and use the following settings:
HBIOS
;
;*************************** Robotron **********************
FCD_RO800
.DB 80 ; NUMBER OF CYLINDERS
.DB 2 ; NUMBER OF HEADS
.DB 5 ; NUMBER OF SECTORS
.DB 1 ; START OF TRACK (ID OF FIRST SECTOR, USUALLY 1)
.DB 5 ; SECTOR COUNT
.DW 1024 ; SECTOR SIZE IN BYTES
.DB 080H ; GAP LENGTH (R/W)
.DB 0F0H ; GAP LENGTH (FORMAT)
.DB (14 << 4) | 0 ; SRT = 4ms, HUT = 512ms
.DB (8 << 1) | 1 ; HLT = 50ms, ND = YES
.DB DOR_BR250 ; DOR
.DB DCR_BR250 ; DCR
.IF (($ - FCD_RO800) != FCD_LEN)
.ECHO "*** FCD_RO800 SIZE ERROR!!! ***\n"
.ENDIF
;***********************************************************
;
CBIOS
;__________________________________________________________________________________________________
;
; ROBOTRON 800kB 5.25" FLOPPY DRIVE, 80 TRKS, 5 SECS/TRK, 1024 BYTES/SEC
; BLOCKSIZE (BLS) = 2K, DIRECTORY ENTRIES = 192
;
.DW CKS_FD
.DW ALS_FD
.DB (2048 / 128) ; RECORDS PER BLOCK (BLS / 128)
DPB_RO800:
.DW 5*1024/128*2 ; SPT: SECTORS PER TRACK (5*1024/128)*2
.DB 4 ; BSH: BLOCK SHIFT FACTOR
.DB 15 ; BLM: BLOCK MASK (SECTORS/BLK -1) 2K BLOCK
.DB 0 ; EXM: EXTENT MASK
.DW 400-1 ; DSM: TOTAL STORAGE IN BLOCKS - 1
.DW 192-1 ; DRM: DIR ENTRIES - 1
.DB 11100000B ; AL0: DIR BLK BIT MAP, FIRST BYTE
.DB 0 ; AL1: DIR BLK BIT MAP, SECOND BYTE
.DW 48 ; CKS: DIRECTORY CHECK VECTOR SIZE = 256 / 4
.DW 0 ; OFF: RESERVED TRACKS


I just can't see where the bottleneck is.
It looks like the HBIOS is reading the sectors correctly.  However, the wrong ones.  Where is the calculation of the correct order done? BDOS or CBIOS? I am trying to debug the code with ZSID, but it crashes too often. Maybe it is not the right tool to debug BDOS and CBIOS. So I will probably focus on CBIOS. BDOS shouldn't care about sector size. Shouldn't it?
Thanks for your input!

Wayne Warthen

unread,
Jun 4, 2023, 5:23:05 PM6/4/23
to retro-comp
Assuming that you've got HBIOS working with 1024 byte sectors correctly, then the next question would be whether you have adjusted the deblocking code in CBIOS for the 1024 byte sectors.  You 
are correct that BDOS should not care -- it deals entirely with 128 byte (logical) sectors.

Thanks,

Wayne

Douglas Miller

unread,
Jun 4, 2023, 6:50:36 PM6/4/23
to retro-comp
Judging from your SPT value, you are using sectors 0-4 to mean side 0, and 5-9 to mean side 1 (or +1 if your sectors start at "1"). I'm not sure how you communicate the side number to RomWBW, but on legacy systems it would be up to the BIOS (CBIOS) to translate the sector number (0-9) into side (0-1) and sector (0-4).
Reply all
Reply to author
Forward
0 new messages