Date: Thu, 12 Jun 2025 14:37:32 -0500 (CDT) Subject: Re: Getting back on TRK00 On Thu, 12 Jun 2025, John D. Baker wrote: > I dug around in my stash and found my Big Box O'EPROMs. There are loads > of 27x64/128/256/512, but precious few 2716 or 2732. I could wire up The first one I tried, a Motorola TMS2716C failed programming. The second was an intel 2716-1 and it successfully programmed and verified. I need to do some cleanup so I'll have space to take the machine back apart to try my new ROM--mostly recovering from digging out network and phone cabling junk to find the tools and parts I needed. The issue with FDGEN and other Davidge utilities seems not to be with my BIOS extension and the swapped jump tables but with similar patching done by the NZ-COM system to intercept BDOS and BIOS calls. Turning NZ-COM off restores stock DRI CP/M 2.2 and CCP (actually, I patched in "ZCPR-D&J" a long time ago, so it's not the stock CCP but quite enhanced and has all the usual (and more) resident commands). Looking at the Warm Boot address in 0001,2 show it pointing at the stock floppy-disk CBIOS's Warm Boot entry point (the contents of which were swapped with those of my extension when it was initialized.) I need to look at those utilities more closely to see how tied are they to the BIOS versus doing things internally. That is, if I tell it to operate on drive A, will it expect that to be the first floppy disk from the BIOS perspective or just assume it's disk 0 and operate on it directly? While hunting for my Big Box O'EPROMs, I found some more scavenged EPROMS (27256 and 27512) that need the old label adhesive cleaned off and contents erased... ----- Date: Thu, 12 Jun 2025 21:03:54 -0500 (CDT) Subject: Re: Getting back on TRK00 On Thu, 12 Jun 2025, John D. Baker wrote: > On Thu, 12 Jun 2025, John D. Baker wrote: > > > I dug around in my stash and found my Big Box O'EPROMs. There are loads > > of 27x64/128/256/512, but precious few 2716 or 2732. I could wire up > > The first one I tried, a Motorola TMS2716C failed programming. The > second was an intel 2716-1 and it successfully programmed and verified. > I need to do some cleanup so I'll have space to take the machine back > apart to try my new ROM--mostly recovering from digging out network and > phone cabling junk to find the tools and parts I needed. And I did have to seriously disassemble the case and internal supports in this old Leading Edge PC case I mounted the Davidge in so long ago. The ROM is right under the "bridge" that carries the power supply at the back and the floppy drives at the front. There are cutouts in the "deck", but the ROM is squarely under a solid portion. IT WORKS! It takes a while for the floppy code to decide it failed, but then the 'ideload' routine loads the boot sector and the boot sector loads the system and off we go! The only annoying thing is the floppy drive motor is left running until the first access completes. If the hard disk boot succeeded and you don't need to access that floppy, it will stay running indefinitely. Short of yet another ROM revision, I could probably put the relevant code to turn off the floppy motor in the hard disk boot sector. Also, booting from floppy still works, too. Both floppies and the IDE drive are tied to the same power harness, so disabling the hard disk means no floppies either--except the first floppy is a 3.5" drive and uses a connector adapter for power. So, I could power just the A: drive and test the monitor. Then unplug the single drive and re-plug the full harness to test booting from the monitor. Need to dig through my stash of IDE cables and get a 2-drive cable to see if the GIDE and CP-342 play nice with a CF adapter. While I only have 2 screws holding it together, I should do as much as I can before I have to put it back together. > While hunting for my Big Box O'EPROMs, I found some more scavenged > EPROMS (27256 and 27512) that need the old label adhesive cleaned off > and contents erased... Actually quite a few 2764s as well... That label adhesive is some tenacious stuff! My usual chemical of choice is paint thinner, but that barely softens the stuff. I don't know how the markings are applied to the ceramic capsules, so I didn't dare use anything harsher like acetone, brake cleaner, or carb cleaner. So with repeated applications of paint thinner, scraping with a letter-opener and buffing on a paper towel, I got all the goo off. I can only erase up to 7 28-pin EPROMs at a time in my eraser, so I had to run three batches. They all verified as erased. ----- Date: Fri, 13 Jun 2025 06:40:54 -0500 (CDT) Subject: Re: Getting back on TRK00 On Thu, 12 Jun 2025, John D. Baker wrote: > IT WORKS! > > The only annoying thing is the floppy drive motor > is left running until the first access completes. If the hard disk boot > succeeded and you don't need to access that floppy, it will stay running > indefinitely. Short of yet another ROM revision, I could probably put > the relevant code to turn off the floppy motor in the hard disk boot > sector. I think the main issue is that nothing ever de-selects the floppy (and they may be set to turn the motor on when selected). I patched the hard-disk boot sector to write a control byte to the floppy DCTRL1 register (external to the FDC) which explicitly turns the motor off and de-selects all drives. I think I will update my ROM to do likewise if a valid boot sector was sucessfully loaded from the hard disk. > So, I could > power just the A: drive and test the monitor. Then unplug the single > drive and re-plug the full harness to test booting from the monitor. Monitor seems to work OK although the P)ort examine/modify doesn't seem to work. I tried using it to send the motor-off/de-select-all byte to the DCTRL1 port, but it didn't work and subsequent reads of the port returned weird values. ----- Date: Fri, 13 Jun 2025 18:26:36 -0500 (CDT) Subject: Re: Getting back on TRK00 I've added the code to set "MOTOR OFF" and de-select all floppy drives to my ROM code. I also found a couple more unbalanced stack operations I hadn't caught before. Same solution, pop the old return address before jumping to the routine. "H)elp" just jumps back to the start of the monitor to re-display the command summary which pushes the address of the command processor. "B)oot" jumps back to the floppy/SASI(IDE) load routines. I found the bug with the "P)ort" command. Incomplete edit on my part. The original code (D3115ROM.ASM) didn't take advantage of some Z80 features, but "4000ROM.ASM" does. Namely, that register-indirect I/O can be done with _any_ general-purpose register. Since the byte to output was saved in B while A was used to check if the user pressed Carriage Return, the old code explicitly did: ld a,b out (c),a while the newer code simply did: out (c),b (or rather the Z80.LIB macro definition thereof). I missed that subtlety when I was grafting 4000ROM changes into the D3115ROM code. I also added a mechanism to explicitly drop to the monitor. If the user presses Ctrl-C while waiting for the floppy boot routine to fail, it will jump to the monitor. I had to slightly re-work the routines that read from the console so that checking input status was separate from reading a character. At least, that's the theory. I'll need to go through the whole dance of getting my code from the Davidge to the machine where my EPROM programmer runs... ----- Date: Sat, 14 Jun 2025 06:28:44 -0500 (CDT) Subject: Re: Getting back on TRK00 So, it's good that I switched on debug mode as I found more bugs. They're not mine this time. I don't see how the 4000ROM monitor code could have worked for the S)et and P)ort commands. The D3115ROM's ASCHEX routine to convert an ASCII character into a hexadecimal digit value was non-destructive unless the character represented a hexadecimal digit. It had a corner case though because if A='G' cp a,'G' doesn't carry, but it results in Z=0 which the routine uses to indicate that the byte returned in A represents a successful conversion. The 4000ROM's version of the ASCHEX routine is destructive to anything less than '0', and only partially restores the byte if it didn't represent a hexadecimal digit, but it handles the above corner case. I only needed to make a couple of changes that added 2 bytes to the routine but I got those 2 bytes back not having to re-add '0' to the value returned when a non-hex-digit character was passed in. It is also fully non-destructive for ASCII values between '9' and 'A' or greater than 'F'. The S)et and P)ort commands each contain an identical code sequence to collect and convert the second digit of a byte to be placed in memory or sent to a port. I finally figured out how to convert it into a subroutine and eliminate the duplicate copy. That's what led me to find the bug(s) in the ASCHEX routine. When you only needed a single-digit entry, the ASCHEX routine was returning 0DH-30H but the parsing code was comparing that to 0DH (carriage return) and bombing off to the error exit. Now that I think about it more, I may be able to de-duplicate more of the common code between S)et and P)ort. ----- Date: Sat, 14 Jun 2025 17:01:22 -0500 (CDT) Subject: Re: Getting back on TRK00 So after fixing the ASCHEX bugs and factoring out an even bigger block of code common to both the S)et and P)ort commands, I had quite a bit of space available for activities. So, instead of my hackish "catch a Ctrl-C after the floppy load fails", I implemented a simple boot menu with a 5-second countdown (for CPU busy-loop values of "second"). During the countdown, it checks for a character in the SIO receive buffer (since I already split status and input functions) and if any key is pressed, it checks: H-boot Hard Disk F-boot Floppy Disk M-drop to ROM Monitor If the countdown expires, it jumps to the standard sequence of trying the floppy, then the hard disk up to ten times each. Pressing anything other than [HFM] will abort the countdown and wait until one of the 3 valid options is pressed Still tinkering with some options such using string output rather than discrete calls to CHROUT for the countdown display. It works in the debugger. I suppose running the ROM Monitor under DDTZ is Debugger-ception... ----- Date: Sat, 14 Jun 2025 20:47:24 -0500 (CDT) Subject: Re: Getting back on TRK00 > On Sat, Jun 14, 2025 at 6:28AM John D. Baker > wrote: > > > It had a corner case though because if A='G' > > > > cp a,'G' > > > > doesn't carry, but it results in Z=0 which the routine uses to indicate > > that the byte returned in A represents a successful conversion. I got things backwards. It's Z=1 (operation result is zero). Doing silly string pointer tricks. Since I put my countdown string immediately after my bootmenu string, I just needed to bump HL past the NULL byte to point to the countdown string (00,08,00), load the display digit into the string directly: ld (hl),'5' and decrement it for the countdown: dec (hl) (or rather the Z80.LIB macro definition of those since that's what DRI's MAC macro assembler understands, so it's more like: mvi m,'5' and dcr m Just had to push HL before calling the print routine and pop it after it returned. I finally decided it was time to burn the next iteration of the boot ROM and getting the file from the Davidge to the NetBSD system was being challenging. I think the key is setting the terminal to 'raw' mode before starting the receiver ('lsz'). It's the first time I've had a Zmodem receive work. Once I got the file onto the machine running the EPROM programmer, it took a little longer to program as I had to use a GENERIC 2716 profile since no part by manufacturers with names starting with "F" matched the part I had. It's freakin' cool! ----- Date: Sun, 15 Jun 2025 10:53:45 -0500 (CDT) Subject: Re: Getting back on TRK00 For anyone curious about the Davidge DSB-4/6, there's actually some data at: https://bitsavers.computerhistory.org/pdf/davidge/dsb-4_6/ I don't know where the enclosure in the photos comes from because I got mine from a friend in a plywood and laminate case with a much-too-flexible, poorly-cut sheet of aluminum serving as a mount for the board, power supply and 2 8-inch SS floppy drives. The power was so sketchy that I didn't even know the board supported power-on RESET until I moved it to the reclaimed Leading Edge PC case. The "1538A.BIN" firmware appears to be an earlier version of the 4000ROM.ASM file. It contains the version string 1.0 while the files I have say 1.3. In the small bit I looked at, it's missing a few instructions compared to the file I have. Still has the same bugs, though. Perhaps when I can get everything together I can expand their collection--particularly in the firmware department. I have RESOURCE, ZESOURCE, and REZILOG, but I either don't have, can't find, or can't access the documentation (if it's on 8-inch floppy as I don't have one set up). T3h int4rw3bz are of little help. The closest I've come is a page on DASM which has been enhanced from Richard Conn's original v1.5 which is itself based on ZZSOURCE by Dave Barker which is based on RESOURCE by Ward Christiansen. The only documentation appears in the sources for the DASM H)elp display which apparently doesn't exist in the versions of the tools I have. ----- Date: Mon, 16 Jun 2025 21:13:20 -0500 (CDT) Subject: Re: Getting back on TRK00 So, I ultimately decided that it is bad form to have the ROM code write into the boot sector, even if it's a well-defined interface. Instead, I should follow the example of the floppy-disk ROM code and pass in the relevant information in registers. As the floppy code passes the control byte for selecting from which disk it loaded the boot sector in "A", I do likewise with the IDE ROM code and pass the SDH register value for the unit/head from which the boot sector was loaded. Fortunately, that scheme is compatible with the current ROM as "A" has the value it just stored in the last byte of the boot secotr right before the ROM jumps to it. The new hard disk boot sector code simply saves "A" in the same place, so it doesn't really matter. If I bother to re- burn an EPROM, it will not write into the boot sector. So then I returned to my IDEGEN utility which was languishing with unfinished revisions after my last debugging session left me rather disturbed due to the bizarre behavior of SAVE. I re-implemented a few things to make them smaller, or just because I thought they were a nifty way to do things (such as zero-ing a block of memory with the LDIR instruction). I added code to compute the number of host sectors the boot sector needs to load if the OS image was read from a file. If the computed result is the same or smaller than than what's already in the next-to-last byte in the boot sector, we replace it. Also, the routine to write the system tracks puts the SDH byte for the "disk" (really which head of the disk) in the boot sector before it writes the system tracks to disk. I need to find a utility to "trim" a file by one record. Since SAVE (and DDTZ's Write command) only save at page-size resolution, the system file is 1 record longer than it needs to be so my sector-count calculatons always end up 1 (host) sector longer than necessary. Fortunately, the calculations done when assembling the boot sector code result in the correct mininmum number of sectors. When I got to a good spot, I ran the assembler over the IDEGEN source, transferred a copy of the listing file to the *NIX host and printed a copy so I could properly grovel over it and be able to see multiple parts of the code at once. The goal was to make the return values for all functions compatible (A=0,Z=1 for error; A=FF,Z=0 for no error). I ended up replacing some spaghetti jumps/branches with conditional returns (ret z) and realizing that some stack gymnastics just weren't necessary (no need to pop a return address when the routine should be entered with JP instead of CALL). The utility is smaller than it was before yet with more features. With that finally finished, I wrote new system images to each of the "disks" (heads) and pressed the reset button. Nice. For completeness, I added head-cycling code to my chain-loading and hard-disk-loading floppy disk boot sectors, to mimic the ROM code's behavior. The chain-loader passes the the HD boot sector the SDH byte in A. ----- Date: Wed, 18 Jun 2025 10:12:05 -0500 (CDT) Subject: Re: Getting back on TRK00 On Mon, 16 Jun 2025, John D. Baker wrote: > I ended up replacing some spaghetti jumps/branches with conditional > returns (ret z) and realizing that some stack gymnastics just weren't > necessary (no need to pop a return address when the routine should be > entered with JP instead of CALL). In the not-leaving-well-enough-alone department, I realized the same applied to the ROM code. The error-exit routine pointed at the error string and jumped back to before the beginning of the Monitor's command-processing loop so it would call the message display routine and return to the beginning of the command processing loop. Since I had made sure to keep stack operations balanced, instead of POPping the return address and branching back to before the beginning, just jump directly to the message-display routine and it will return to the start of the Monitor's command-processing loop. Doesn't decrease code size since I have to use a jump rather than a branch, but I feel better about it. The only places where POPping the return address and jumping/branching to a routine are needed are for the H)elp display or to go back to the B)oot routines. ----- Date: Tue, 1 Jul 2025 18:15:16 -0500 (CDT) Subject: Switching between multiple hard disk partitions in CP/M? I've begun wrestling with an issue now that I'm poised to attach other storage (such as CF cards) to the Davidge DSB-4/6 w/GIDE interface. With the availability of HYOOGE! storage and the ability to interface it to our favorite small systems comes an interesting problem: how to use all that space within the constraints of CP/M? Sure, multiple partitions, but CP/M limits you to 8MB maximum/partition and only up to 16 drives (some of which should likely remain floppy drives). Way in the BBS era, I dialed up Houston N/W RCP/M Znode #45 in Jersey Village regularly. ISTR it was running on a TeleVideo machine and had more physical hard disks/partitions than it could address at any one time. It had a custom BIOS that would swap out one group of disks and/or partitions for another when a request was made for one that wasn't in the current active set. Normally, hard disks don't have any CSV space allocated as they're (usually) never changed. To make it possible to swap partitions in CP/M and have it do the right thing, perhaps a unique directory entry for a zero-length file guaranteed to be in the first directory block (like, say, a DISKLABEL? ;) and only enough CSV space for the first directory block (or maybe only the first N entries?) would be enough for CP/M to discern that a disk was swapped out without eating too much memory. If you're using ZDDOS or DateStamper, it wants the "!!!TIME&.DAT" file to be first in the directory, and the setup utility will move directory entries and file data accordingly. The ZNode #45 BIOS made the swap somewhat transparent to normal operations When one requested a drive/user combination that wasn't currently active, the system wrote a message to the (remote) console, swapped and logged in the alternate drive set and then you were logged into the requested drive/user. ISTR that the drive letters did change, if, say, A: and B: are the floppies, C: and D: are permanent hard disks or partitions, then one group of E:-H:, I:-L:, or M:-P: would be available and the others moved to offline status. My decision 30 years ago to operate each head of the hard disk as as separate drive/partition now shows how short-sighted and/or naive I was at the time, but I was (nearly) the first to implement a BIOS extension for the brand-new GIDE device that only appeared a few months before. I was reading web pages of others who've incorporated the GIDE logic if not the device itself into their system designs or expansions. I came across one guy who seems to have a really good scheme and I'm pondering adopting it. http://www.ardiehl.de/gide/ Perhaps keep 2 disk partitions as "permanent" and define groups of partitions that get swapped in/out when accessed and a utility to mark partitions as part of a particular group.