Date: Fri, 18 Sep 2026 05:38:32 -0500 (CDT) Subject: Re: Getting back on TRK00 > On Tue, Sep 15, 2026 at 8:41PM John D. Baker wrote: > > Until I fire up the Davidge again, I don't have much of my source code > > accessible, but I did have the original sources from my old web pages > > on hand, so I've been fixing them up and tweaking them. I started > > looking at my commented disassembly of the Davidge's CBIOS and my GIDE I had a copy of the assembler listing (.PRN file) for the Davidge BIOS from the last time I modified the source and assembled, so I converted it back into assembler source by 'cut'ting off the annotation fields (and the line numbers added during the transfer with 'PIP') and sending it through 'tr' to effectively "tolower()" the whole thing. Then edit in 'vi' to re-tabify it and "toupper()" things that shouldn't have been "tolower()ed". Given the similarity with the BIOS for the CCS 2422 FDC, I actually opened a copy of that and read the two in parallel. I then began adapting the CCS BIOS' label names to the Davidge BIOS. I was able to make more progress deciphering some of the deep disk-handling routines--nearly all the registers are outputs from some of them. I was running 'MAC' and 'PIP' and 'ZSID' under 'ntvcm'. In particular, after I'd assembled the BIOS segment, I wanted to compare it to the binary from which it was originally disassembled. I loaded "CPM64.BIN" with ZSID, filled memory from the base of TPA to the base of BIOS (1f7f) w/00, loaded "CBIOS64.HEX" with an offset of "1180h" so it would be loaded at 0180h then used the block-compare routine assembled at 0100h to see if they produced the same code. I found one byte that I failed to "toupper()" in my editing, but testing the output from assembling the corrected source was not working. It was still showing the same wrong byte in the same place. I guess 'ntvcm' couldn't tell that the file content changed out from under what it last read and it was just re-reading from buffer cache. Quitting 'ZSID' and restarting showed that I had, in fact, fixed things and my reconstructed BIOS assembled identical to the original. I learned this block-compare routine 30 years ago when I first began disassembling the Davidge CBIOS and I've used it in a number of places. With the original binary at 1f80 and my reassembled dissassembly at 0180, I just had to do (using ZSID's a)ssembler): ld hl,180 ld de,1f80 ld bc,980 ld a,(de) cpi jr nz,120 jp po,128 inc de jr 109 and put "FF" bytes (rst 38h instructions) at 120 and 128. If bytes don't match, it branches to 120 and I use the "x)amine" command to see where the difference was (although HL will be pointing one byte beyond the mismatch). If all bytes matched (BC=0000), then it jumps to 128. I re-remembered a couple of places the stock CBIOS needs patching when the GIDE BIOS is in use. The error path for floppy operations ultimately performs a jump to WBOOT depending on user response. This needs to be changed to WBOOTE (bios+3) so it goes through the (swapped) jump table instead of directly to the routine. ----- Date: Sun, 20 Sep 2026 14:55:38 -0500 (CDT) Subject: Re: Getting back on TRK00 On Fri, 18 Sep 2026, John D. Baker wrote: > Given the similarity with the BIOS for the CCS 2422 FDC, I actually > opened a copy of that and read the two in parallel. I then began adapting > the CCS BIOS' label names to the Davidge BIOS. I was able to make more > progress deciphering some of the deep disk-handling routines--nearly > all the registers are outputs from some of them. When the disk-handling routines got too tedious, I looked at the serial and parallel port handlers--more specifically the IOBYTE selection routines and ultimately the routine that reads status and reads/writes data from/to the port. While the stock CCS BIOS only has the 8250 UART on the 2810 CPU board, the DSB-4/6 has 2 Z80 SIO/0 chips for 4 full serial ports and a simplified parallel port constructed from an 8-bit line-driver/receiver pair. Rather than defaulting to the "TTY" assignment for all CP/M logical devices (and non-TTY assignments prompting an error message), the Davidge makes some reasonable assignments of each logical device to one of the physical devices. The logic generally follows that of the CCS BIOS otherwise. So, I grafted more of the CCS BIOS labels into the Davidge BIOS. While working in that area of the code, I believe I have found some dead code. Nothing refers to it and there are no code paths that lead to it. It's not big, but hey, 5 bytes is 5 bytes. I also noticed a couple of places where a register transfer (ld dr,sr or mov dr,sr) would be more convenient that loading an immediate constant (usually to put a 0 in a register). Specifically, taking advantage of the fact that B=0 immediately following the last iteration of "DJNZ". Editing CP/M text files with 'vi' is tedious when you're adding more lines. It's important to scan the file periodically for lines that have something other than "^M" at the end of a line. Otherwise, MAC runs lines w/o a into the following line and may spew errors or in once case, the only way I noticed a problem was when the end address was 2 bytes off. I should probably make a point of using 'dos2unix' before editing and 'unix2dos' afterwards. I should poke at 'nvi' (BSD's 'vi') to see if it can be convinced to use whatever line-ending sequence it finds rather than strictly '\n'. I known 'vim' can do that, but, well, it's 'vim'. ----- Date: Mon, 21 Sep 2026 23:44:25 -0500 (CDT) Subject: Re: Getting back on TRK00 On Tue, 15 Sep 2026, John D. Baker wrote: > The only place the IX register is initialized is in the cold boot > subroutine that converts the CP/M serial number from hex/binary to ASCII > decimal digits. Even then, it's only used to point to the portion of > the string where the ASCII representation of the digits are put for > printing. I think I found the actual bug. WBOOT calls SELDSK which sets up the pointer to the translation table--the first entry in the Disk Parameter Header--and returns HL=DPH[dskno](.XLTN). WBOOT then copies the XLTN address into DE, pushes it on the stack then pops it back into HL. The previously-saved retry count and disk number in BC is then popped off the stack and HL is reloaded with the CCP base address to read in the system from disk. So: [...] call seldsk ld e,(hl) inc hl ld d,(hl) ;DE->xlt table for disk in selected drive push de pop hl ;BUGBUG: should be "pop ix" pop bc ld hl,ccp [...] The translation tables are pairs of numbers: physical sectors/track, skew factor HL points to the sectors/track for the disk in the warm boot drive, but then is ignored. If the "pop hl" above were instead "pop ix", then IX would point to the physical sectors/track value for reading from track 1(,2 on 5.25" disk) and the "ld b,(ix+0)" would load valid data. I don't dare actually fix it until I have it fully commented and all auto-generated labels replaced with more meaningful ones. Until then, I need to make sure that my disassembly and commenting assembles to the same the binary I took it from. There are two routines left to re-label. One is the routine that determines the disk type, size, sidedness, etc. The other does the various waits needed for floppy operation (head-load, settling time, motor-on). If I can grok them in more fullness, comments may be edited to be less literal and more descriptive of what's being done. ----- Date: Wed, 23 Sep 2026 07:27:39 -0500 (CDT) Subject: Re: Getting back on TRK00 On Fri, 18 Sep 2026, John D. Baker wrote: > I re-remembered a couple of places the stock CBIOS needs patching when > the GIDE BIOS is in use. The error path for floppy operations ultimately > performs a jump to WBOOT depending on user response. This needs to be > changed to WBOOTE (bios+3) so it goes through the (swapped) jump table > instead of directly to the routine. I've managed to complete re-labeling of the disassembled CBIOS and added some convenience EQUates to locate code and data of interest so they can be referenced by the GIDE BIOS extension. (I'm currently only working with the original versions that run as the CCP turnkey command as that's the only source I have without setting the Davidge up again.) My convenience EQUates include the offsets to the two "JMP WBOOT" operand addresses, so I've added code to the GIDEBIOS "Hboot" cold boot routine to patch them to "JMP WBOOTE". Stupid Z80 tricks: "swpjptbl" swaps the stock BIOS jump table with our replacement. On exit, HL=address in base page of CBIOS, so we use this to our advantage: swpjptbl: [...] ;HL->last byte of CBIOS jump table ld c,h ;save bios base page in c ld b,2 ;2 locations to patch ld de,ofs0 ;the first jr patch patch0: ld de,ofs1 ;the second ld h,c ;bios base page in H patch: ld l,0 ;0 in L add hl,de ;make address ld (hl),3 ;offset of wboote inc hl ;bump to high byte ld (hl),c ;in bios base page djnz patch0 ;and do the other [...] Also a slight rework of the code to stuff a new turnkey command into the CCP cibuff so that if the length byte is 0, the copy is skipped, the length in the CIBUFF is reset to 0 and the jump to the CCP (via "jp (hl) [or "pchl" in 8080 mnemonics]) will act like a jump to CCP+3. ----- Date: Thu, 24 Sep 2026 14:02:59 -0500 (CDT) Subject: Re: Getting back on TRK00 On Wed, 23 Sep 2026, John D. Baker wrote: > I've managed to complete re-labeling of the disassembled CBIOS and added > some convenience EQUates to locate code and data of interest so they > can be referenced by the GIDE BIOS extension. (I'm currently only > working with the original versions that run as the CCP turnkey command > as that's the only source I have without setting the Davidge up again.) Since I had previously uploaded the contents of what I would consider a minimum viable system disk, I had the Davidge-customized "MOVCPM.COM" available. I just needed to defeat the S/N checks to run it under the 'RunCPM' emulator (since I needed to be able to 'SAVE 40 CPMxx.COM' afterwards). I told it to generate a baseline 20K system image, saved it, then made a copy of my commented, regenerated source code with "msize equ 20" and reassembled it. After a bit of faffing around, I got CPM20.BIN and CBIOS20.HEX loaded in the correct spots. I had previously written "BLKCMP.ASM" so I wouldn't have to type it in manually each time, so I loaded its .HEX file (at 0100h, of course) and it reported that the two blocks were identical. Yay! I put in conditional assembly for what I propose as bug fixes and/or optimizations, so I can test that I haven't broken anything if I poke around in other parts of the code. There are some utilities on "deramp.com" that will let me regenerate a fully-relocatable system from two system images for different memory sizes. That way, I could patch in the BIOS segment with my fixes and optimizations and still have it relocatable. It also includes options for boot sectors larger than 256 bytes, so I could patch in my IDE hard- disk boot sector as well. The ultimate goal is to fully integrate my hard disk support rather than having it tacked on and needing loaders or hacks to activate it. I'm quite a bit closer to that goal now. Need to read more BIOS sources for ideas... ----- Date: Thu, 24 Sep 2026 23:56:34 -0500 (CDT) Subject: Re: Getting back on TRK00 On Wed, 23 Sep 2026, John D. Baker wrote: > I put in conditional assembly for what I propose as bug fixes and/or > optimizations, so I can test that I haven't broken anything if I poke > around in other parts of the code. I realised there were two more places where one routine calls another that should go through the jump table. I made the changes in my conditionally-applied fixes, but I also captured their address offsets so they could be patched in the unmodified system. Now that there are 4 patches instead of two, I needed a proper table and routine to handle them, so in place of the stupid Z80 tricks, I did the following: ; ; patch two "jmp wboot" and calls to "seldsk" and "sectran" so they ; go through the BIOS jump table. ; wbpof0 equ 42eh wbpof1 equ 43ch sldpof equ 0eah sctrnof equ 2c3h ; ld c,h ;save BIOS base page in C ld b,nptchs ;number of patches to make ld hl,ptchtbl ;point at patch table patch: ld e,(hl) ;get offset inc hl ld d,(hl) ;in DE inc hl ld a,(hl) ;get replacement offset push hl ;save pointer ld l,0 ;HL=bios ld h,c add hl,de ;make address ld (hl),a ;install replacement offset inc hl ;bump to high byte ld (hl),c ;install replacement page pop hl ;restore patch table pointer inc hl ;bump to next djnz patch ;and go again ; [...] ; ; patch array to make CBIOS calls go through jump table. ; format: 2 bytes offset to patch, 1 byte of offset in jump table ptchtbl: dw wbpof0 db 3 ;offset of wboote in jmp tbl dw wbpof1 db 3 dw sldpof db 1bh ;offset of seldsk in jmp tbl dw sctrnof db 30h ;offset of sectran in jmp tbl nptchs equ ($-ptchtbl)/3 ----- Date: Fri, 25 Sep 2026 16:37:27 -0500 (CDT) Subject: Re: Getting back on TRK00 A friend asked: > When do you find time to do all of this? During the mid-day hours when it's too hot to work outside. During the midnight hours when I can't get back to sleep. The last bit of relabling was an attempt to reduce the number of "magic number" constants used in the code (despite the copious detailed comments. The macro libraries supplied with the system only provide a fraction of the definitions of bits in the various registers (particularly the floppy disk controller subsystem). I made some supplemental libraries to fill in the gaps, but for anyone assembling the unmodified BIOS code, they're unlikely to have more than what was supplied by Davidge. (Actually, now that I think about it, everyone but me probably doesn't have any orginal Davidge-supplied materials. So, given the extreme similarity of the DSB-4000 with the CCS 2422, I copy-pasta'd the relevant symbol definitions from Martin Eberhard's "MBIOS" (as found on "deramp.com") into the bios source directly. Of course, there followed the usual rounds of assemble and compare with the reference binary (mostly to make sure I didn't have a finger slip and delete or add something accidentally. And then comparing it to the binaries generated by the Davidge 'MOVCPM.COM' for various memory sizes. Satisfied that it was working as intended, I set "jdbfix" to "true" and assembled again and patched it into the appropriate "CPMxx.BIN" image. Then I started messing the Mike Douglas' ("deramp.com") "MAKEMOV.COM". There was some confusion when it claimed the memory size wasn't in the filename. Turns out the first filename must be an image for a 20K or larger system. The second can be for any size (I built the minimum allowed 16K system). Once I had the custom "BMOVCPM.COM", I had it generate 16K and 20K systems to compare with my hand-patched ones. They weren't the same. But where they differed was in the system log-on message. The ones produced by "BMOVCPM.COM" had garbage where the memory size should be. It took some poking and patching, but I finally got it working. The relocator code "CPMOVE.COM" as de-fanged by Mike Douglas looks for the string "K CP/M 2.2" in the system image and expects to patch the two bytes before it with the system memory size. Trouble is, the Davidge-OEM version of CPMOVE.COM (which is the first 200h bytes of MOVCPM.COM") looks for "k CP/M Vers 2.2", so the replacement CPMOVE.COM doesn't find the string and leaves those bytes at whatever value the relocator set them to rather than ASCII decimal digits. I edited and reassembled "CPMOVE.COM" and patched it into "MAKEMOV.COM", but that didn't help. In fact, the corrected string was getting trashed. CPMOVE tries to get the most out of the data, so the search string is also used as the message string. MAKEMOV prompts for 2 additional lines for CPMOVE to display when it generates the system and it had some hard-coded offsets for where the custom message was to be inserted-- overwriting my corrected log-on message string. So, with "MAKEMOV.COM loaded in 'ZSID' and reading the source in another window, I found where it loaded the address of the custom message and bumped it up to where it needed to be. After that the resulting "BMOVCPM" generates system images that are identical to my hand-patched versions. ----- Date: Mon, 28 Sep 2026 15:18:30 -0500 (CDT) Subject: Re: Getting back on TRK00 Since "better" is the enemy of "good", I've declared victory and made an hysteric return to t3h 1nt4rw3bz: http://bobdbob.com/~jdbaker/ Under the "computers" page, you can find all the Davidge-related stuff I've been working on.