bell equ 07h alf equ 0ah acr equ 0dh HEXFF EQU 0FFH DJNZ EQU 10H JR EQU 18H JRNZ EQU 20H JRZ EQU 28H JRNC EQU 30H JRC EQU 38H memdrv equ 2 maclib d1biosf5 maclib d1rdsym cout equ bios+(04*3) RDsetdrv equ bios+(09*3) settrk equ bios+(10*3) setsec equ bios+(11*3) setdma equ bios+(12*3) RDread equ bios+(13*3) RDwrite equ bios+(14*3) org 100h xra a sta coldwarm ;===================================================================== LXI B,80H ; Load the default DMA address.. CALL SETDMA ; ..and have BIOS set it LXI D,CCP ; Load second comparand address MVI C,MEMDRV ; Set drive.. CALL RDsetdrv ; ..to Ram-Disk LXI B,1 ; Set the RAM-Disk warm-boot starting... CALL SETTRK ; ..track (1), then decrement it (to 0) and.. DCX B ; ..pass it into the loop for sector address ; ; RAM-Disk starts at track 1 because of.. ; ; ..ideosyncracies of the Morrow Voodoo Gizmo MAJORLUP: PUSH B ; Save the sector address and.. PUSH D ; ..the second comparand address CALL SETSEC ; Set the sector CALL RDread ; Get a sector to be compared POP D ; Restore the second comparand address LXI H,80H ; Load DMA address (first comparand address) MOV B,L ; 80H is also the compare byte count MINORLUP: LDAX D ; Get byte from CCP/BDOS area to be compared CMP M ; Compare it to corresponding byte in DMA DB JRNZ,((REFRESH+HEXFF)-$) AND HEXFF ; Force refresh if.. INX D ; ..not equal. If equal, then bump.. INX H ; ..comparand addresses, decrement count and.. DB DJNZ,((MINORLUP+HEXFF)-$) AND HEXFF ; ..loop til count = 0 ; ; If entire sector equal, then loop on sector count PUSH D lxi h,MARKER call message POP D POP B ; Recover the sector address INX B ; Bump it MOV A,C ; Is sector address beyond.. CPI (BIOS-CCP)/128 ; ..the CCP/BDOS image? If not, loop on.. DB JRC,((MAJORLUP+HEXFF)-$) AND HEXFF ; ..counter until.. ; ; ..sector count = 0 JMP GOCPM rfrshmsg db acr,alf,'Formatting RAM-Disk!!' db acr,alf,0 MARKER DB '>',bell,0 REFRESH: ; Format the RAM-Disk directory and copy the CCP & BDOS image lxi h,rfrshmsg ;Prep for sending signon message call message ;Send the prompt LXI H,80H ; Recover the DMA address and.. MVI A,0E5H ; ..load the A-reg with the "format" byte LXI B,7fH ; Load length of fill>>>>>>>>>>>>>>>>>>>>>>> CALL FILLMEM ; Fill the DMA with the "format" byte LXI B,RDOFF ; Set directory starting track FRSHLUP1: PUSH B ; Save the track address>>>>>>>>>>>>>>>>>>>> CALL SETTRK ; Tell BIOS about it LXI B,SECPRTRK ; Set starting sector number FRSHLUP2: DCX B ; Decrement the sector number and loop until.. PUSH B ; Save the sector number and.. CALL SETSEC ; ..tell BIOS about it CALL RDwrite ; Write "format" bytes into directory sector PUSH D lxi h,MARKER call message POP D POP B ; Recover the sector number MOV A,C ; Have we formatted.. ORA A ; ..all the sectors in this track? DB JRNZ,((FRSHLUP2+HEXFF)-$) AND HEXFF ; No, loop til sector=0 POP B ; Recover track address INX B ; Bump to next track MOV A,C ; Have we reached the last.. CPI RDOFF+(BLKPRDIR/BLKPRTRK) ; track in the directory? DB JRC,((FRSHLUP1+HEXFF)-$) AND HEXFF ; If not, loop till yes RDCOLD: ; RAM-Disk Cold Boot routine copies CCP/BDOS image to RAM-Disk ; ; On entry: No values passed ; ; On exit: HL = RDwrite BIOS address ; ; All registers and flags are scratch ; LXI H,RDwrite ; Set HL-reg to point to BIOS output routine ; ; Go to RDBOOT routine to move CCP and.. JMP RDBOOT ; ..BDOS image from memory to RAM-Disk RDWARM: ; RAM-Disk Warm Boot routine ; ; On entry: No values passed ; ; On exit: HL = RDread BIOS address ; ; All registers and flags are scratch ; LXI H,RDread ; Set HL-reg to point to BIOS input routine ; ; Fall into RDBOOT routine to move CCP and.. ; ; ..BDOS image to memory from RAM-Disk RDBOOT: ; RAM-Disk Warm/Cold Boot routine.. ; ; ..(transfers CCP & BDOS image to and from RAM-Disk) ; ; On entry: HL = RDread or RDwrite, depending on.. ; ; ..whether called by RDwarm or RDcold ; ; On exit: CCP & BDOS moved from/to RAM-DISK ; ; All registers and flags are scratch ; SHLD RDIOSW ; Set I/O direction switch from HL-reg LXI H,1 ; Set work track.. SHLD WORKTRK ; ..to starting value (Track 1) DCX B ; Decrement to 0 and use to.. SHLD WORKSEC ; ..set work sector to start (Sector 0) MVI C,MEMDRV ; Set BIOS drive.. CALL RDsetdrv ; ..to RAM-Disk LXI H,CCP ; Set work DMA address.. SHLD WORKDMA ; ..to CCP start MVI A,(CBIOS-CCP)/128 ; Set # of CP/M sectors..>>>>>>>>>>>> STA WORKCNT ; ..to be read>>>>>>>>>>>>>>>>>>>>>> ; RDBOTLUP: LHLD WORKDMA ; Load current DMA address PUSH H ; Move current DMA address.. POP B ; ..into BC-reg CALL setdma ; Set BIOS DMA address LXI H,128 ; Bump the work DMA address.. DAD B ; ..by one CP/M sector SHLD WORKDMA ; Store new work DMA address.. ; LHLD WORKTRK ; Set BIOS track.. PUSH H ; Move current track address.. POP B ; ..into BC-reg CALL settrk ; Tell BIOS about it LHLD WORKSEC ; Load current sector.. PUSH H ; Move current sector address.. POP B ; ..into BC-reg CALL setsec ; Tell BIOS about it INX B ; Bump to next sector SHLD WORKSEC ; Save incremented value MOV A,C ; Has work sector exceeded the number of.. CPI SECPRTRK+1 ; ..RAM-Disk Sectors/Track? ;#99> JC RDBOOTIO ; No - go to do I/O DB JRC,((RDBOOTIO+HEXFF)-$) AND HEXFF LHLD WORKTRK ; Yes - Bump.. LXI D,1 ; ..work.. DAD D ; ..track.. SHLD WORKTRK ; Save result.. XCHG ; ..and reset.. DCX H ; ..work sector.. SHLD WORKSEC ; ..to start RDBOOTIO: CALL RDread ; Call RDread OR RDwrite to do I/O RDIOSW EQU $-2 ; Switch set by caller for output (cold boot) or ; ; ..input (warm boot) LDA WORKCNT ; Decrement.. DCR A ; ..sector.. STA WORKCNT ; ..count ; ; All sectors transferred? ;#99> JNZ RDBOTLUP ; No - Go to transfer next sector DB JRNZ,((RDBOTLUP+HEXFF)-$) AND HEXFF ;===================================================================== gocpm: lda coldwarm ora a DB JRNZ,((warmdone+HEXFF)-$) AND HEXFF dcr a sta coldwarm lxi h,donecold call message jmp rdwarm warmdone: lxi h,donewarm call message jmp 0 WORKTRK DW 0 WORKSEC DW 0 WORKDMA DW 0 WORKCNT DB 0 coldwarm db 0 donecold db acr,alf,alf,'cold boot complete!!',acr,alf,alf,0 donewarm db acr,alf,alf,'warm boot complete!!',acr,alf,alf,0 ;Fill Memory ;----------- ; The memory space indicated by the HL-reg is filled with.. ; ..the byte value contained in the A-reg, for.. ; ..the length indicated by the BC-reg fillmem: mov m,a push h pop d inx d dw 0b0edh ; Z-80 LDIR op-code ret ;Print a Message ;--------------- ;Utility routine to output the message pointed at by (hl) ;terminated with a null. ; message: mov a,m ;Get a character of the message inx h ;Bump text pointer ora a ;Test for end rz ;Return if done push h ;Save pointer to text mov c,a ;Output character in C call cout ;Output the character pop h ;Restore the pointer ;#99> jmp message ;Continue until null reached DB JR,((MESSAGE+HEXFF)-$) AND HEXFF end