Path: utzoo!mnetor!uunet!tektronix!zeus!dadla!donk From: donk@dadla.TEK.COM (Donald C. Kirkpatrick;6291236;92-716;LP=A;60rC) Newsgroups: comp.os.cpm Subject: Re: Fail to install P2DOS on Apple Message-ID: <3414@zeus.TEK.COM> Date: 20 Apr 88 16:56:07 GMT References: Sender: news@zeus.TEK.COM Reply-To: donk@dadla.UUCP (Donald C. Kirkpatrick) Organization: Tektronix, Inc., Beaverton, OR. Lines: 521 > I promised Don Kirkpatrick a full report of what I did. Here it comes: > - my configuration is an Apple ][+ with 64 K of RAM, for running CP/M > I have a Softcard 60K with a Z80 processor. > I run the Apple Softcard CP/M 2.23 (to coldstart). > - On my system disk there are two files to generate a startup disk, > nl. CPM56.COM and CPM60.COM, which are similar to the SYSGEN program. > The difference is that CPM60.COM has a copy of the CPM image inside > the com file and with a SYSGEN program one has to save it. > - I used the CPM60.COM to generate a new CP/M com file. > addresses in image file addresses in high memory > ======================= ======================== > CCP: F00h - 17FFh CCP: D300h > BDOS: 1800h - 26FFh BDOS: DC00h > BIOS: 2700h - 2CFFh BIOS: FA03h Actually, your bios starts at FA00h not FA03h but the warm boot is the second jump table entry. Not to worry, P2DOS calculates the bios from DOSSTRT. You didn't put in a P2BIOS equate did you? > > P.S.: This are the addresses which I think the CCP, BDOS and BIOS > probably begin ? If NOT correct please let me know, because > the whole installation procedure falls or stands with it ! > - In file P2DOS.MAC I filled the following values in : > DOSSTRT = DC00h > SE RI AL NU MB ER = BD 16 00 00 EC B8 > ORG = 100h > I assembled P2DOS.MAC with the M80 assembler. > B>a:m80 =p2dos (no errors were produced) > B>a:l80 p2dos,p2dos/x/n/e (to generate the p2dos.hex file) > - type p2dos.hex gives : > :20DC0000BD160000ECB8... > ---- ------------ > BDOS serialnumber Here is one thing I don't understand. When I did this with my M80/L80, the hex load file had 100H for the first load address. I think yours should too. The entry in the BDOS field above must have been 100H else the R command with offset 1700 would not have overlayed the zero-filled area. This address is controlled by the org statement. > > - Combined CPM60.COM with P2DOS.HEX using DDT: > B>DDT CPM60.COM > -f 1800 26FF 0 (to fill with zeroes) > -d 1800 (check if made zero) > -i p2dos.hex > -r 1700 > -d 1800 (check if p2dos is there) > -^C > B>save 44 P2DOS.COM (new CP/M image file) > B>P2DOS (on a fresh disk, writes system tracks) > - Switch Apple ON/OFF and insert new CP/M startup system disk. > RESULT= a lot of noice, and over and out. I sure don't see anything real obvious. One trap I fell into is to try to use M80/L80 and not use the phase pseudo op. I don't think it is possible to build a hex file properly without the org/phase statements as described. Every attempt without using org/phase resulted in hundreds of zero-filled records where I wanted nothing at all. Probably, you didn't delete any org/phase/aseg statement so it should work properly. One assumption made by the installation routine is that the disk-to-image program creates a contiguous image of the bdos. I tried for nearly a week on an old Northstar to get such an image, but I never figured out the track 0-1 skew factor. Every time I loaded in the reserve tracks, the bdos was fragmented all over the image. Let me offer a ray of hope. I am including a program that I almost included with the submital. It trys to load the image into memory starting at address 4000H. That starting address leaves room to load the image and execute DDT/ZSID so you never have to write a .com file to disk. All you have to do is load the image by running the program, run DDT to add the bdos image, then run the program again to write the image to disk. The program is self-documenting, so give it a try and let me know what happens. One word of caution, the program assumes that you have two drives, A and B. The source is always A, the destination B. It also assumes that the skew factor is the same on the reserve tracks as it is on the regular tracks. It trys to read the reserve tracks using the standard bdos calls. This program did not work on a northstar, but you might have better luck. One quick test is to let the program just copy the reserve tracks to a new disk and see if the new disk works. This SYSLOAD program also will calculate all your constants for you. Just type "SYSLOAD D" and it will tell you the values of the P2DOS equates. Question, did you turn off (set false) time stamps? Until the basic problem is solved, it might be wise to remove time stamp calls. IMPORTANT! While this is not your problem, one bug has been found in P2DOS. It occurs on write random with zero fill. (not my bug, I didn't change it) Please make the following change to P2DOS2.MAC: WRITS2: LD C,2 LD A,(FUNCT) SUB 40 JR NZ,WRTS6 PUSH DE LD HL,(DIRBUF) <------ ADD PARENTHESIS !!!!!!!!! LD B,128 WRITS3: Don Kirkpatrick ============================================================================= SYSLOAD Program ============================================================================= TITLE System Loader .Z80 ASEG ORG 100H ; ; This program loads the system from memory or from the disk's reserve tracks. ; Drive A is always the source drive and drive B is the destination drive. ; If the command line contains a "L", then the track image is only loaded ; from the A drive. If the command line contains a "S", then the image is ; assumed to be in memory and only the store to drive B occurs. If the ; command line contains a "C", then the reserve tracks on drive A are ; copied to drive B. ; ; The track image begins at 4000H. This permits one to load an image, ; run ZSID without overlaying the image, then store the image onto drive B. ; FRSTRC EQU 0 ; first record number on sys track SRCDRV EQU 0 ; always load from drive A DSTDRV EQU 1 ; always store to drive B ; BIOS EQU 0001H ; jump to bios address BDOS EQU 0005H ; jump to bdos address CMDBUF EQU 005CH ; default command line buffer FIRST EQU CMDBUF+1 ; first character in command buffer ; CR EQU 0DH LF EQU 0AH ; IMAGE EQU 4000H ; location of track image ; LD (STKSAV),SP ; save stack pointer LD SP,STACK ; and set to own CALL BUILD ; build bios calls LD A,(FIRST) ; valid option? CP 'C' ; copy? JP Z,BEGIN ; yes CP 'L' ; load? JP Z,BEGIN ; yes CP 'S' ; store? JP Z,STORE ; yes CP 'D' ; data? JP Z,DSKDAT ; yes LD C,9 ; not valid, print useage LD DE,USEAGE CALL BDOS JP LEND USEAGE: DEFB CR,LF DEFM "Useage:" DEFB CR,LF,CR,LF DEFM " SYSLOAD C -Copies reserve tracks from drive A to B." DEFB CR,LF DEFM " SYSLOAD L -Loads drive A's reserve tracks into memory." DEFB CR,LF DEFM " SYSLOAD S -Stores memory image onto drive B's reserve tracks." DEFB CR,LF DEFM " SYSLOAD D -Displays data about location of BDOS." DEFB CR,LF,'$' DSKDAT: LD C,9 ; bdos print string LD DE,ADRMSG CALL BDOS LD HL,(BIOS) ; get bios address LD DE,0E03H ; calculate bdos start AND A SBC HL,DE LD (BLOC),HL ; save for serial number CALL PRHL ; go print hl LD C,9 ; time for serial number LD DE,SERMSG CALL BDOS LD HL,(BLOC) ; get bdos loc LD B,6 ; six bytes JR DSP2 DSP1: PUSH HL PUSH BC LD C,9 ; print "H,0" LD DE,CMSG CALL BDOS POP BC POP HL DSP2: LD A,(HL) INC HL PUSH HL PUSH BC CALL PRHEX POP BC POP HL DJNZ DSP1 LD C,9 ; print search for msg LD DE,SMMSG CALL BDOS CALL LOADER ; load track LD DE,IMAGE ; start search at image address DSP3: LD HL,(BLOC) ; search for serial number PUSH DE ; save search address LD A,(DE) CP (HL) ; match byte 1? JR NZ,DSP4 ; no INC HL INC DE LD A,(DE) CP (HL) ; match byte 2? JR NZ,DSP4 INC HL INC DE LD A,(DE) CP (HL) ; match byte 3? JR NZ,DSP4 INC HL INC DE LD A,(DE) CP (HL) ; match byte 4? JR NZ,DSP4 INC HL INC DE LD A,(DE) CP (HL) ; match byte 5? JR NZ,DSP4 INC HL INC DE LD A,(DE) CP (HL) ; match byte 6? JR Z,DSP5 ; match! DSP4: LD HL,128 ; step to next possible loc POP DE ADD HL,DE EX DE,HL LD HL,(DMA) ; off end of buffer? AND A SBC HL,DE JR NZ,DSP3 ; no, go try again LD C,9 ; print not found LD DE,NFMSG CALL BDOS JP LEND DSP5: LD C,9 ; print image found loc LD DE,IMMSG CALL BDOS POP HL LD (IMLOC),HL ; save image location CALL PRHL ; print image address LD C,9 ; print high track address LD DE,HIMSG CALL BDOS LD HL,(DMA) DEC HL CALL PRHL LD C,9 ; print offset for R command LD DE,OF1MSG ; print 100h offset CALL BDOS LD HL,(IMLOC) LD DE,0100H AND A SBC HL,DE CALL PRHL LD C,9 LD DE,OF2MSG ; print org offset CALL BDOS LD HL,(BLOC) CALL PRHL LD C,9 LD DE,OF3MSG CALL BDOS LD HL,(IMLOC) LD DE,(BLOC) AND A SBC HL,DE CALL PRHL LD C,9 LD DE,HMSG CALL BDOS JP LEND ADRMSG: DEFB CR,LF DEFM "BDOS starting address............................0$" SERMSG: DEFB 'H',CR,LF DEFM "BDOS serial number........0$" CMSG: DEFM "H,0$" SMMSG: DEFB 'H',CR,LF DEFM "Searching for BDOS image location$" IMMSG: DEFB CR DEFM "Reserve track image starting address.............04000H" DEFB CR,LF DEFM "BDOS image location in reserve track image.......0$" HIMSG: DEFB 'H',CR,LF DEFM "Reserve track image ending address...............0$" OF1MSG: DEFB 'H',CR,LF DEFM "R command offset if hex load address is 0100H....0$" OF2MSG: DEFB 'H',CR,LF DEFM "R command offset if hex load address is 0$" OF3MSG: DEFM "H...0$" HMSG: DEFB 'H',CR,LF,'$' NFMSG: DEFB CR DEFM "BDOS image was not found on reserve track" DEFB CR,LF,'$' PRHL: LD A,L ; print hl reg as hex word PUSH AF LD A,H CALL PRHEX POP AF PRHEX: PUSH AF ; print acc as hex digit pair RRCA RRCA RRCA RRCA CALL PRHEX1 POP AF PRHEX1: AND 0FH ADD A,90H DAA ADC A,40H DAA LD C,2 ; console output byte LD E,A JP BDOS ; return via bdos BUILD: LD DE,(BIOS) ; build calls LD HL,WBOOT LD B,16 BUILD1: LD (HL),0C3H ; jp INC HL LD (HL),E ; adr lo INC HL LD (HL),D ; adr hi INC HL INC DE INC DE INC DE DJNZ BUILD1 RET LOADER: LD C,14 ; bdos select disk LD E,SRCDRV CALL BDOS LD C,31 ; bdos get disk parameters CALL BDOS LD E,(HL) ; get records/track INC HL LD D,(HL) LD (MAXREC),DE LD DE,12 ; get number of reserved tracks ADD HL,DE LD E,(HL) INC HL LD D,(HL) LD (RESRV),DE ; and save LD C,SRCDRV CALL SELDSK LD E,(HL) ; get translation table INC HL LD D,(HL) LD (TABLE),DE ; and save CALL HOME ; load track 0 LD HL,0 ; reset track counter LD (TRACK),HL LD HL,IMAGE ; set track image address LD (DMA),HL LTRACK: LD HL,FRSTRC ; start at first record LD (RECORD),HL LD BC,(TRACK) ; select track CALL SETTRK LOAD1: LD BC,(DMA) ; update dma address CALL SETDMA LD HL,(RECORD) ; translate record number LD B,H LD C,L LD DE,(TABLE) LD A,D ; any translate? OR E CALL NZ,SECTRN LD B,H ; select proper record LD C,L CALL SETSEC CALL READ ; read it LD HL,(DMA) ; update dma address LD DE,128 ADD HL,DE LD (DMA),HL LD HL,(RECORD) ; increment record number INC HL LD (RECORD),HL LD DE,(MAXREC) ; last record? AND A SBC HL,DE JR NZ,LOAD1 ; no LD HL,(TRACK) ; all tracks loaded? LD DE,(RESRV) INC HL LD (TRACK),HL ; update track counter AND A SBC HL,DE JR C,LTRACK ; more to do RET ; end of loader BEGIN: CALL LOADER ; load track image LD A,(FIRST) ; just load? CP 'L' JP Z,LEND ; yes STORE: LD C,14 ; bdos select disk LD E,DSTDRV CALL BDOS LD C,31 ; bdos get disk parameters CALL BDOS LD E,(HL) ; get records/track INC HL LD D,(HL) LD (MAXREC),DE LD DE,12 ; get number of reserved tracks ADD HL,DE LD E,(HL) INC HL LD D,(HL) LD (RESRV),DE ; and save LD C,DSTDRV CALL SELDSK LD E,(HL) ; get translation table INC HL LD D,(HL) LD (TABLE),DE ; and save CALL HOME ; load track 0 LD HL,0 LD (TRACK),HL LD HL,IMAGE LD (DMA),HL STRACK: LD HL,FRSTRC ; reset record counter LD (RECORD),HL LD BC,(TRACK) ; select proper track CALL SETTRK STORE1: LD BC,(DMA) ; set dma address CALL SETDMA LD HL,(RECORD) ; translate record LD B,H LD C,L LD DE,(TABLE) LD A,D OR E CALL NZ,SECTRN LD B,H ; select record LD C,L CALL SETSEC LD C,0 ; normal write CALL WRITE LD HL,(DMA) ; update dma pointer LD DE,128 ADD HL,DE LD (DMA),HL LD HL,(RECORD) ; increment record number INC HL LD (RECORD),HL LD DE,(MAXREC) ; last record? AND A SBC HL,DE JR NZ,STORE1 ; no LD HL,(TRACK) ; all tracks loaded? LD DE,(RESRV) INC HL LD (TRACK),HL AND A SBC HL,DE JR C,STRACK ; more to do LEND: LD SP,STKSAV ; restore stack RET RECORD: DEFS 2 ; current record TABLE: DEFS 2 ; translate table RESRV: DEFS 2 ; number of reserved tracks TRACK: DEFS 2 ; current track MAXREC: DEFS 2 ; number of records per track DMA: DEFS 2 ; dma address BLOC: DEFS 2 ; location of bdos serial number IMLOC: DEFS 2 ; location of bdos image STKSAV: DEFS 2 ; stack pointer save area DEFS 64 ; stack area (most generous) STACK EQU $ BOOT: DEFS 3 ; calls to bios WBOOT: DEFS 3 CONST: DEFS 3 CONIN: DEFS 3 CONOUT: DEFS 3 LIST: DEFS 3 PUNCH: DEFS 3 READER: DEFS 3 HOME: DEFS 3 SELDSK: DEFS 3 SETTRK: DEFS 3 SETSEC: DEFS 3 SETDMA: DEFS 3 READ: DEFS 3 WRITE: DEFS 3 LISTST: DEFS 3 SECTRN: DEFS 3 END