; Compiles online at https://www.asm80.com/ ; Hex bytes checked against Byte Mag listing. ; Untested as of 2026-08-27. .CPU 8080 ;************************************************************** ; CP/M BIOS- BUBBLE DRIVER LINKAGE ; Copyright (C) 1983 Louis E. Wheeler ; ; The modifications presented here are intended as an example only. ; They demonstrate how a typical CP/M BIOS can be modified to use ; the BUBBLE MEMORY DRIVER PACKAGE (separate listing). ; ; To incorporate these changes, the BIOS jump table must be ; located, along with free space to store the added code. ; Then the modified BIOS should be installed in the system following ; the instructions given in the appropriate CP/M manual. ; ; This listing is divided into two sections: ; (1) Patches. ; (2) Added Code. ; All patch addresses shown are for a 32K СРМ ; configured by Centa for a Micropolis disk system. ; ; *************************************************************** ; PATCHES ; *************************************************************** ; ; This section revises the existing BIOS Jump table ; to go to the added code routines listed below. ; The actual location of the jump table ; and address of the patches is dependent of ; the existing BIOS. ; Each system is different. ; The ORGS ; shown in this assembly are for ; a CP/M configured by Centa Systems ; for Micropolis disk systems. ; BIOS EQU 7500H ; CP/M BIOS Base Address ; ; ORG BIOS+24 ; Location of Jump Table + 24 ; ; JMP BHOME ; Patch for HOME ORG BIOS+36 ; Jump table + 36 ; JMP BSETDMA ; Patch for SETDMA JMP BREAD ; Patch for RERD JMP BWRITE ; Patch for write ; ORG BIOS+42 ; Jump table + 42 ; JMP BSECTRAN ; Patch for SECTRAN ; ; The following equates taken from existing BIOS jump table. ; HOME EQU BIOS+327H ; *** Depends on existing BIU5 *** SETDMA EQU BIOS+301H ; *** Depends on existing BIOS *** READ EQU BIOS+352H ; *** Depends on existing BIOS *** WRITE EQU BIOS+3FDH ; *** Depends on existing BIOS *** SECTRAN EQU BIOS+2E9H ; *** Depends on existing BIU5 *** GOCPM EQU BIOS+214H ; *** Depends on existing BIOS *** ; ORG GOCPM JMP BGOCPM ; GO INIT BUBBLE MEMORY ; ; The followins changes the number of sustem disks from 2 to 4. ; Exactly how this patch is made is dependent on the specific systen. ; ORG BIOS+38H ; *** Depends on existing BIOS *** DB 02H ; Increase DISK's to 3. DB 03H ; Increase DISK's to 4. ; ; ; ; The following changes the disk size parameter in DPBLK2. ; Note: This change may only be applicable to Micropolis disk systems. ; The Centa Systems version of the BIOS has two DPBLK's, one each for ; the two models of Micropolis disk drives (Mod I and Mod II). ORG BIOS+0D8H ; *** Depends on existing BIOS *** DB 3CH ; Change (DMS) disk size (DPBLK2) ; to reflect bubble memory capacity ; ; ADDED CODE ; NDISKS EQU 3 ; NUMBER OF DISKS (0,1,2 & BUBBLE SECTRK EQU 32 ; CP/M 128-BYTE SECTORS/TRACK SECSZE EQU 128 ; CP/M SECTOR SIZE ; DISKNO EQU BIOS+549H ; *** Dерends on existing BIOS *** TRACK EQU BIOS+54AH ; *** Deperids on existing BIOS *** DMAAD EQU BIOS+54DH ; *** Depends on existing BIOS *** ;.if 1 SBLKLEN EQU 0002H ; BLOCK LENGTH = 2 PAGES = 128 BYTES SCANALS EQU 01H ; NUMBER OF FSA CHANLS = 2 SENABLE EQU 20H ; ENABLE BYTE = RCD & HI-SPD SBEGADR EQU 0000H ; BEGIN ADDR = PAGE 0 SMEMSEL EQU 00H ; BUBBLE NUM SELECT = FIRST ; ; The following equates link these modifications to ; the BUBBLE MEMORY DRIVER routines. ; The addresses shown equate to a JP table ; in an EEPROM pointing to the drivers, ; also located in EEPROM. ; The actual location will depend on the system. ;; BMINIT EQU 0F018H ; BUBBLE MEMORY INITIALIZE BMREAD EQU 0F01BH ; BUBBLE MEMORY READ BMWRIT EQU 0F01EH ; BUBBLE MEMORY WRITE ; The following PARAMETER BLOCK can be ORG'd to any convenient ; area in read/write memory. If the BIOS are not in PROM. The ; PARAMETER BLOCK can be located within the BIOS. ; ORG BIOS+0E2H ; *** Depends on existing BIOS *** ; PARAMBLK EQU $ ; BUBBLE MEMORY PARAMETER BLOCK ; BLKLEN: DW 0000H ; BLOCK LENGTH (PAGES) CANALS: DB 00H ; NUMBER OF FSA CHANNELS ENABLE: DB 00H ; ENABLE/CONTROL BYTE BEGADR: DW 0000H ; BEGINNING PAGE NUMBER MBMSEL: DB 00H ; BUBBLE BANK BUFADR: DW 0000H ; USER BUFFER ADDRESS STATUS: DB 00H ; RETURN STATUS ;.endif ;************************************************************** ; The following equates determine where the patches ; below are to be stored in the BIOS area of CP/M. ; The actual locations are dependent on the specific BIOS. ; AREA1 EQU BIOS+0B00H ; Where to put GOCPM Patch. AREA2 EQU 0 ; Where to put HOME patch. AREA3 EQU 0 ; Where to put SETDMA patch. AREA4 EQU 0 ; Where to put SECTRAN patch. AREA5 EQU 0 ; Where to put READ Patch. AREA6 EQU 0 ; Where to put WRITE Patch. ; ; GOCPM- System hardware initialization. ; ORG AREA1 ; *** Depends on existing BIOS *** ; BGOCPM: LXI H, SBLKLEN ; SET BLOCK LENGTH SHLD BLKLEN MVI A, SCANALS ; SET NUMBER FSA CHANNELS STA CANALS MVI A, SENABLE ; SET ENABLE BYTE STA ENABLE LXI H, SBEGADR ; SET BEGINNING PAGE NO. SHLD BEGADR XRA A ; SET BM BANK SELELT STA MBMSEL LXI H, PARAMBLK ; FWH PARAMBLK TO HL CALL BMINIT ; GO INITIALIZE BM ERROR: JC ERROR ; HANG OR DO SOMETHING IF ERR ; MVI A,0C3H ; *** Restore existing BIOS code*** STA 0000 JMP GOCPM+3 ;** replaced by JMP instruction ; RETURN TO EXISTING BIOS+3 ;-> Continue with existing BIOS code. ;HOME - Move to track 00 position of current drive ; ORG $ ; AREA2 ; BHOME: LDA DISKNO ; GET DISK NUMBER CPI NDISKS ; CHECK FOR BUBBLE MEMORY RZ ; RETURN IF BUBBLE (NO ACTION) JMP HOME ; ; Continue with existing BIOS code. ; SELDSK - Select disk siven by register C ; No modification required. ;************************ ; SETTRK - Set track diven by register C ; -> No modification required unless your BIOS actually ; -> Positions the disk head to the selected track. ; -> If this is the case, perform the test shown for HOME. ; SETSEC - Set sector given by register C ; -> No modification required. ;****************************************************** ; SETDMA - Set DMA address given by registers B and C ORG $ ; AREA3 *** BSETDMA: MOV L,C ; LOW ORDER ADDRESS MOV H,B ; HIGH ORDER ADDRESS SHLD DMAAD ; SAVE THE ADDRESS SHLD BUFADR ; FOR BUBBLE TOO. ; ; -> Include any additional code your system may require, ; -> probably none. ; ***** RET ; No add'l code req'd for Micropolis. ;************************* ; SECTRAN - Translate the sector number given by B and C ;************************* ORG $ ; AREA4 *** ; BSECTRAN: LDA DISKNO ; GET DISK NUMBER CPI NDISKS ; CHECK FOR BUBBLE MEMORY JNZ SECTRAN ; IF NOT, GO DO DISK. PUSH B ; SAVE SECTOR LXI D,0000H ; CLEAR DE LHLD TRACK ; TRACK # TO HL MOV H,D ; CLEAR H. L=TRACK XCHG MVI A,SECTRK ; GET SECTORS PER TRACK ADD A ; MULTIPLY BY 2 BMPY: DAD D ; BEG TRK ADR = DCR A ; TRK * SELTRK * 2 JNZ BMPY ; LOOP TO MULTIPLY. MOV A,C ; GET SECTOR NUMBER ADD A ; MPY BY 2 MOV C,A ; PUT IT BACK DAD B ; ADD IT TO BEG TRK ADR SHLD BEGADR ; SAVE IN BEGADR. POP H ; PUT SECTOR IN HL RET ; BUBBLE ; EXIT. ;************************* ; READ READ SELECTED CP/M SECTOR ;************************* ORG $ ; AREA5 *** BREAD: LDA DISKNO ; GET DISK NUMBER CPI NDISKS ; CHECK FOR BUBBLE JNZ READ ; NO, GO READ DISK DI ; KILL INTERRUPTS. LXI H, PARAMBLK ; FWA PARAMBLK TO HL CALL BMREAD ; GO READ BUBBLE DATA JMP BRWEX ; GO TAKE COMMON EXIT. ;************************* ; WRITE - WRITE SELECTED CP/M SECTOR ;************************* ORG $ ; AREA6 *** ; BWRITE: LDA DISKNO ; GET DISK NUMBER CPI NDISKS ; CHECK FOR BUBBLE JNZ WRITE ; NO, GO WRITE DISK ; DI ; KILL INTERRUPTS. LXI H,PARAMBLK ; FWA PARAMBLK TO HL CALL BMWRIT ; GO WRITE BUBBLE DATA ; BRWEX: EI ; OMIT THIS INSTRUCTION ; IF YOUR SYSTEM DOES ; NOT USE INTERRUPTS. MVI A,0 ; CLEAR A-REG RNC ; NO PROBLEM EXIT. INR A RET ; ERROR EXIT. ; ;