CP/M V2.2 Aplication Note 15, 12/22/82 Debugging a CP/M V2.2 BIOS Copyright 1982, 1983 by Digital Research CP/M is a registered trademark of Digital Research. DDT, MAC, and SID are trademarks of Digital Research. Compiled February 1983 You can easily customize the CP/M V2.2 operating system for a particular machine if you use the following steps when it is necessary to debug a BIOS. You must have a system running under CP/M with a minimum of 48K to implement this scheme. CP/M V1.4 is all right, and the system need work only well enough to load DDT or SID . (SID is preferable and should be used if available.) 1) Carefully do a thorough code walk-through. This should take about eight hours. Pay particular attention to the Disk Parameter Blocks and Disk Parameter Headers, especially if you hand-coded these items to assemble your BIOS instead of using the DISKDEF.LIB and MAC . A slight miscalculation in a DPB or DPH can cause a BIOS to perform most functions correctly but fails under obscure circumstances; or, BIOS performs one function properly and fails to perform all others. 2) Using your old CP/M system, create your new system and configure it to 20K. Ensure that the old system does not use location 38H, which is DDT's Restart7 location. 3) Load the new 20K system underneath DDT in the old 48K system's TPA with the command DDT CPM20.COM. Figure 1-1 illustrates this scheme. 48K BIOS 48K BDOS DDT or SID 4A00 20K BIOS 3C06 20K BDOS 3400 20K CCP 980 900 BOOT SYSGEN or MOVCPM 100 BASE PAGE Figure 1-1. Loading Your New System 4) At location 980 (A00h in some systems), you should find the base of the CCP, recognized by two jumps followed by the copyright message. Move the 20K system into its correct memory location using the DDT M (move) command. If DDT Š lists a next address of 2300, then this command is M980,2300,3400. 5) In the 20K BIOS jump vector at 4A00h, insert breakpoints with Restart7s, or, if you are using SID, insert passpoints. This should be restricted to the disk entry points unless you have a problem with console I/O. If the problem occurs only under certain conditions, place a RST7 initially only at the write entry point. When the conditions under which the problem occurs have been established, use a SAVE 1 xxx to return to the debugger you are using and to set additional breakpoints. 6) Run the 20K CP/M under the 48K CP/M's DDT. Issue the DDT command G4A00, which executes the new BIOS cold boot entry point. The cold boot initializes the base page for the 20K system and jumps to the CCP, which performs a BDOS Function 13 disk reset. The disk reset reads the directory sectors until it encounters a sector containing 0E5h in every byte. 7) If the problem you experienced fails to reappear when you begin single-cycling, it might have been a timing problem. If not timing then it is a logic or coding error, and you must continue to single-cycle the machine, examining the contents of registers and memory locations as you go. Pay particular attention to the following parameters: Track, Sector, Dmaad, Diskno, and the contents of Dirbuf. If you are using blocking/deblocking, also observe the contents of Sekdsk, Hstdsk, Sektrk, Hsttrk, Rsflag, Erflag, and the contents of the host buffer(s). Licensed users are granted the right to include these changes in CP/M software.