• DRI deblocked HOME vs. actual implementations?

    From John D. Baker@jdbaker@consolidated.net to comp.os.cpm on Wed Sep 2 20:01:01 2026
    From Newsgroup: comp.os.cpm

    I've been reading through the archives on "deramp.com" gathering notions
    and ideas for improving my GIDE support on the Davidge DSB-4000 (rev. B).

    In the DRI CP/M 2.2 manual, appendix G, the blocking/deblocking algorithms,
    the sample HOME routine is given as:

    HOME: ;HOME THE SELECTED DISK
    LDA HSTWRT ;CHECK FOR PENDING WRITE
    ORA A
    JNZ HOMED
    STA HSTACT ;CLEAR HOST ACTIVE FLAG
    HOMED:
    RET

    Nearly all BIOS implementations I've read so far, simply set BC=0 and
    fall through to SETTRK. The only BIOS I've read that does anything
    similar to the DRI routine is for the PCPI AppliCard (and likely the
    CardZ180, but I don't have a copy of the CZ180 BIOS handy).

    So, it appears in the deblocking routines, HOME never actually "homes"
    the disk (or sets the track to 0). In a patch issued by DRI, which can
    be read here:

    https://deramp.com/downloads/digital_research/Software/CPM%202.2/CPM%20Patches/Patches/CPM22PAT.09

    There is a note at the label "homed:" to "Continue with the rest of
    the home routine."

    Since the HOME routine in my DSB-4/6 BIOS extension was essentially
    copied from the PCPI AppliCard BIOS, I wonder now whether its early
    exits (via rz, then rnz) shouln't have been branches to the common
    idiom of falling through to SETTRK w/BC=0.

    Comments? Insights?

    Thanks.
    --
    |/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
    |\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
    | X No HTML/proprietary data in email. BSD just sits there and works!
    |/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Schultz@david.schultz@earthlink.net to comp.os.cpm on Thu Sep 3 10:29:06 2026
    From Newsgroup: comp.os.cpm

    On 9/2/26 8:01 PM, John D. Baker wrote:

    Comments? Insights?
    CP/M-68K says: "If your controller does not have a special feature for
    finding track 00, you can translate the call to a SETTRK function with a parameter of 0."

    The WD2797 has a restore command but I didn't use it. At least not for
    the home call.
    --
    http://davesrocketworks.com
    David Schultz
    "It's just this little chromium switch here..."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From John D. Baker@jdbaker@consolidated.net to comp.os.cpm on Thu Sep 3 13:48:18 2026
    From Newsgroup: comp.os.cpm

    On Thu, 3 Sep 2026, David Schultz wrote:

    On 9/2/26 8:01 PM, John D. Baker wrote:

    Comments? Insights?
    CP/M-68K says: "If your controller does not have a special feature for finding
    track 00, you can translate the call to a SETTRK function with a parameter of 0."

    Yes, Ch. 6.6 of the CPM-2.2 manual says pretty-much the same thing for
    the HOME routine. It's the modification of that for the blocking/deblocking routines in Appendix G and the patch note mentioned before that I'm
    concerned with.

    The WD2797 has a restore command but I didn't use it. At least not for the home call.

    In the BIOSes I've read for machines using the WD FD[12]79? FDCs, I only
    ever see HOME implemented implemented as describe previously. The RESTORE command is usually used only during SELDSK when detecting disk presence
    or type/size, etc. depending on how the floppy-disk system was implemented. (The Davidge DSB-4/6 boards are very similar to the CCS2422 and the ROM
    even loads the boot sector in the same place as Disk MOSS v2.2. The
    disk formats it supports are identical to CCS (although they support
    40 and 80-track "mini-disks" rather than only 35-track like a stock
    CCS 2422 BIOS.))

    I'm just trying to reconcile the DRI example and the only implementation(s)
    of it I know to exist versus the vast majority of implementations. I
    can only conceive of the HOME routine being used in BDOS functions 0
    and 13 which ultimately call WBOOT. In the case of the AppliCard and
    CardZ180, a copy of CCP+BDOS+BIOS is kept in the Apple ][ RAM and is
    simply re-uploaded to the card on warm-boot or even system reset (by
    the reset button/key-combo), so A: need not contain a bootable disk
    once the system is up.
    --
    |/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
    |\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
    | X No HTML/proprietary data in email. BSD just sits there and works!
    |/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From David Schultz@david.schultz@earthlink.net to comp.os.cpm on Fri Sep 4 18:57:27 2026
    From Newsgroup: comp.os.cpm

    On 9/3/26 1:48 PM, John D. Baker wrote:
    The RESTORE
    command is usually used only during SELDSK when detecting disk presence
    or type/size, etc. depending on how the floppy-disk system was implemented.

    Digging up my old code, the restore command is issued after a read or
    write error. If it was a sector not found error and readid indicated a
    track mismatch.

    This pretty much never happened in practice. Except just after a system
    reset.

    There was a lot of different hardware used for CPM and a lot of
    programmers making different choices. Which mostly worked just fine.
    --
    http://davesrocketworks.com
    David Schultz
    "It's just this little chromium switch here..."
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From John D. Baker@jdbaker@consolidated.net to comp.os.cpm on Fri Sep 4 20:26:31 2026
    From Newsgroup: comp.os.cpm

    On Thu, 3 Sep 2026, John D. Baker wrote:

    I'm just trying to reconcile the DRI example and the only
    implementation(s) of it I know to exist versus the vast majority of implementations.

    I finally found one (additional) example. There are a couple of deblocked BIOSes for Tarbell FDCs (and hard disk controllers) That implement the
    HOME routine exactly as given in the DRI-issued patch:

    https://deramp.com/downloads/digital_research/Software/CPM%202.2/CPM%20Patches/Patches/CPM22PAT.09

    to wit:

    ;
    ;home - set up for home of drive to track 0
    ;
    HOME: LDA HSTWRT ;check for pending write
    ORA A
    JRNZ HOME1
    STA HSTACT ;host inactive
    HOME1: LXI B,0 ;restore
    ;
    ;settrk - select track 0 - 76
    ;
    SETTRK: SBCD SEKTRK
    RET


    The version implemented by the PCPI AppliCard BIOS does:

    HOME: LDA HSTACT
    ORA A
    RZ ;return if host not active
    LDA HSTWRT
    ORA A
    RNZ ;return if pending write
    STA HSTACT ;mark host inactive
    RET

    which is only a slight deviation from the code in DEBLOCK.ASM.

    The version I used in my GIDE BIOS extension for the Davidge DSB-4000
    does:

    Hhome: call chkhrd ;is it our disk?
    jr z,Fhome ;no, let stock BIOS handle it
    ;
    ld hl,hstact ;HL->host active flag
    ld a,(hl) ;in A
    or a ;set flagz
    rz ;return if host inactive
    inc hl ;bump to HSTWRT flag
    ld a,(hl) ;in A
    or a ;set flagz
    rnz ;return if pending write
    dec hl ;bump back to HSTACT
    ld (hl),a ;mark inactive
    ret ;and done

    Hence the DRI-issued patch which clarifies that the routine
    should continue with what you'd do in the non-deblocked case
    rather than just RETurn.

    Having seen these examples, I think I now should change it to:

    Hhome: call chkhrd ;is it our disk?
    jr z,Fhome ;no, let stock BIOS handle it
    ;
    ld hl,hstact ;HL->host active flag
    ld a,(hl) ;in A
    or a ;set flagz
    jr z,Hhomed ;brif host inactive
    inc hl ;bump to HSTWRT flag
    ld a,(hl) ;in A
    or a ;set flagz
    jr nz,Hhomed ;brif pending write
    dec hl ;bump back to HSTACT
    ld (hl),a ;mark inactive
    Hhomed:
    ld bc,0 ;track 0 in BC
    jr Hsttrk0 ;go set it

    Hsettrk:
    call chkhrd ;is it our disk?
    jr z,Fsettrk ;no, let stock BIOS handle it
    ;
    Hsttrk0:
    ld (sektrk),bc
    --
    |/"\ John D. Baker, KN5UKS NetBSD Darwin/MacOS X
    |\ / jdbaker[snail]consolidated[flyspeck]net OpenBSD FreeBSD
    | X No HTML/proprietary data in email. BSD just sits there and works!
    |/ \ GPGkeyID: D703 4A7E 479F 63F8 D3F4 BD99 9572 8F23 E4AD 1645
    --- Synchronet 3.22a-Linux NewsLink 1.2