PAGE DELCNT: EQU 5*1000 ;Delay count for 8 mhz CPU CR: EQU 0Dh LF: EQU 0Ah BELCHR: EQU 07 EOS: EQU 0 CLRSCR: EQU 1AH ;TeleVideo clear screen code K: EQU 1024 BDOSINT = 224 ;BDOS Interrupt number OPTS = 40h ;board option switches (by Boot) ORG 408h TICKH DS 2 ;Banger parameters OPTSH DS 1 ;OPT_SW ALIGN MACRO BITS ORG (*+(%1)-1) / (%1) * (%1) ENDM ; CP/M to host disk constants HSTSIZ: EQU 1024 ;Blocking/Deblocking buffer size CPMSIB: EQU 1024/128 ;Standard sectors in block FPYSIB: EQU 2048/128 ;Sectors in floppy disk block HMDSIB: EQU 2048/128 ;Sectors in Memory drive block HRDSIB: EQU 4096/128 ;Sectors in hard disk block ; CP/M disk control block equates which define the ; disk types and maximum storage capability of each ; disk type. DSKS1: EQU 0 ;Single density, single sided. DSKS2: EQU 1 ;Single density, double sided. DSKD1: EQU 2 ;Double density, single sided. DSKD2: EQU 3 ;Double density, double sided. DSKD3: EQU 4 ;Double density, single sided DSKD4: EQU 5 ;Double density, double sided DSKD5: EQU 6 ;Double density, single sided DSKD6: EQU 7 ;Double density, double sided MAXFTP: EQU DSKD6 ;Maximum floppy type HMDTYP: EQU 128 ;M-DRIVE/H type (always 128 for MFORM) if gbc20 DSK8F1: EQU 8 ;Fujitsu 20 megabyte first 8 megabytes DSK8F2: EQU 9 ;Fujitsu 20 megabyte second 8 megabytes DSK8F3: EQU 10 ;Fujitsu 20 megabytes last 4 megabytes endif if gbc10 DSK8M1: EQU 8 ;Fujitsu 10 megabyte first 8 megabytes DSK8M2: EQU 9 ;Fujitsu 10 megabyte second 8 megabytes ENDIF if gbc26 DSK4S1: EQU 8 ;Shugart 26 megabyte first 8 megabytes DSK4S2: EQU 9 ;Shugart 26 megabyte second 8 megabytes DSK4S3: EQU 10 ;Shugart 26 megabytes third 8 megabytes DSK4S4: EQU 11 ;Shugart 26 megabyte last 2 megabytes endif S1DSM: EQU ((77-2)*26)/CPMSIB S2DSM: EQU ((77-2)*2*26)/FPYSIB D1DSM: EQU ((77-2)*2*26)/FPYSIB D2DSM: EQU ((77-2)*2*2*26)/FPYSIB D3DSM: EQU ((77-2)*4*15)/FPYSIB D4DSM: EQU ((77-2)*2*4*15)/FPYSIB D5DSM: EQU ((77-2)*8*8)/FPYSIB D6DSM: EQU ((77-2)*2*8*8)/FPYSIB F81DSM: EQU (8*(94-1)*8*11)/HRDSIB F82DSM: EQU (8*(93-0)*8*11)/HRDSIB F83DSM: EQU (8*(57-0)*8*11)/HRDSIB M81DSM: EQU (4*(123-1)*8*11)/HRDSIB M82DSM: EQU (4*(121-0)*8*11)/HRDSIB S41DSM: EQU (8*(57-1)*8*16)/HRDSIB S42DSM: EQU (8*(56-0)*8*16)/HRDSIB S43DSM: EQU (8*(56-0)*8*16)/HRDSIB S44DSM: EQU (8*(33-0)*8*16)/HRDSIB HMDDSM: EQU ((512-4)*8)/HMDSIB ; BDOS constants on entry to write WRALL: EQU 0 ;write to allocated WRDIR: EQU 1 ;write to directory WRUAL: EQU 2 ;write to unallocated PAGE ; Macro for generating Control Blocks for disk drives ; The format of these disk control blocks are as follows: ; 16 bits = -> translation table. ; 48 bits = Work area for CP/M. ; 16 bits = -> DIRBUF. ; 16 bits = -> Parameter block. ; 16 bits = -> check vector. ; 16 bits = -> allocation vector. NDSK: SET 0 ;Number of disk drives NOHRD: SET 0 ;Number of hard disk drives NOFDD: SET 0 ;Number of floppy disk drives ngbc10 set 0 ;Number of 10 megabyte hard disks ngbc20 set 0 ;Number of 20 megabyte hard disks ngbc26 set 0 ;Number of 26 megabyte hard disks NOHMEM: SET 0 ;Number of up to 2 megabyte memory disks DPHNUM: SET 0 ALVS: SET 0 ;Allocation vector size CSVS: SET 0 ;Check vector size DPHGEN MACRO NUMBER,TYPE,XLATE,DIRBUF,DPBADR IF %2 <= MAXFTP DB NOFDD ELSE IF %2 < HMDTYP DB NOHRD / DRVTYP ELSE IF %2 = HMDTYP DB NOHMEM ENDIF ENDIF ENDIF NDSK: SET NDSK+1 DPHNUM: SET DPHNUM+1 DRV%1: SET DPHNUM DW %3 DW 0,0,0 DW %4 DW %5 DW CSV+CSVS DW ALV+ALVS .type IF %2 <= MAXFTP NOFDD: SET NOFDD+1 CSVS: SET CSVS+(256/4) ALVS: SET ALVS+((D6DSM+7)/8) .type else .type IF %2 < HMDTYP NOHRD: SET NOHRD+1 CSVS: SET CSVS+0 IF GBC20 IF %2 = DSK8F1 ngbc20 set ngbc20+1 ALVS: SET ALVS+((F81DSM+7)/8) ENDIF IF %2 = DSK8F2 ALVS: SET ALVS+((F82DSM+7)/8) ENDIF IF %2 = DSK8F3 ALVS: SET ALVS+((F83DSM+7)/8) ENDIF ENDIF IF GBC10 IF %2 = DSK8M1 ngbc10 set ngbc10+1 ALVS: SET ALVS+((M81DSM+7)/8) ENDIF IF %2 = DSK8M2 ALVS: SET ALVS+((M82DSM+7)/8) ENDIF ENDIF IF GBC26 IF %2 = DSK4S1 ngbc26 set ngbc26+1 ALVS: SET ALVS+((S41DSM+7)/8) ENDIF IF %2 = DSK4S2 ALVS: SET ALVS+((S42DSM+7)/8) ENDIF IF %2 = DSK4S3 ALVS: SET ALVS+((S43DSM+7)/8) ENDIF IF %2 = DSK4S4 ALVS: SET ALVS+((S44DSM+7)/8) ENDIF ENDIF .type else .type IF %2 = HMDTYP NOHMEM: SET NOHMEM+1 CSVS: SET CSVS+0 ALVS: SET ALVS+(((HMDDSM*8)+7)/8) .type ENDIF .type ENDIF .type ENDIF ENDM space 4,10 ; Macro for generating the Disk Parameter Blocks. ; ; Disk type definition blocks for each particular mode. ; The format of these areas are as follow: ; 8 bit = disk type code ; 16 bit = Sectors per track ; 8 bit = Block shift ; 8 bit = BS mask ; 8 bit = Extent mask ; 16 bit = Disk size/1024 - 1. ; 16 bit = Directory size. ; 16 bit = Allocation for directory. ; 16 bit = check area size. ; 16 bit = offset to first track. DPBGEN MACRO TYPE,SPT,BSH,BSM,EXM,DSM,DIRSIZ,ALVMSK,OFFSET DB %1 DW %2 DB %3,%4,%5 DW %6-1,%7-1,REV (%8) .hrd IF %1 <= MAXFTP DW (%7+3)/4 else DW 0 .hrd ENDIF DW %9 ENDM ; ; macro for generating the drive selection masks ; maskgen MACRO drvcnt,logphy ECHO %1 ECHO %2 db mask ENDM mask set mask+1 ENDM ENDM page ; CP/M86 memory organization: ; ; 0000: 0000 +-----------------------+ Absolute ; | Interrupt vectors | ; 0400 | Transfer area | ; 040F +-----------------------+ ; ; SysSeg: +-----------------------+ 410 nominal ; 0000 | | ; | CCP 88 | ; 0AFF | | ; +-----------------------+ ; 0B00 | | ; | BDOS 88 | ; 24FF | | ; +-----------------------+ ; 2500 | | ; | BIOS 88 | ; | | ; 2E00 +-----------------------+ ; | uninit storage | ; 3400 +-----------------------+ 3810 ; ; ; LdrSeg: +-----------------------+ 4000 normal ; 0000 | | ; | LdCpm | ; 03FF | | ; +-----------------------+ ; 0400 | | ; | LdBdos | ; 11FF | | ; +-----------------------+ ; 1200 | | ; | LdBios | ; | | ; 1B00 +-----------------------+ ; | uninit storage | ; 2200 +-----------------------+ 6200 ; ; ; FFFF: +-----------------------+ ; 0000 | jmpl 0400h,0 | ; +-----------------------+ ORG 0000h ;Zero segment ZSEG: EQU 0000h ; Interrupt 224 -- BDOS call interrupt vector. ORG 4*BDOSINT STRAP: DS 2 ;Offset STRPSG: DS 2 ;Paragraph space 4,10 ORG 0000h ;System segment CCP: DS L$CCP BDOS: DS L$DOS BDOSE: = BDOS+6 ;True entry point space 4,10 ; The following jump vector defines the entry points into ; the CBIOS for use by CP/M86; therefore the order of ; these jumps cannot be modified. BIOS: JMP CBOOT ;Cold boot JMP WBOOT ;Warm boot j.CST: JMP NOTHIN ;Console status (input) j.CIN JMP NOTHIN ;Console input j.COUT JMP NOTHIN ;Console output JMP NOTHIN ;List output JMP NOTHIN ;Punch output JMP NOTHIN ;Reader input JMP HOME ;Set track to zero JMP SELDSK ;Select disk unit JMP SETTRK ;Set track JMP SETSEC ;Set sector JMP SETDMA ;Set Disk Memory Address JMP READ ;Read from disk JMP WRITE ;Write onto disk J.LST: JMP NOTHIN ;List status (output) JMP SECTRN ;Translate sector number JMP SETXAD ;Set DMA segment address. JMP GETSGT ;Get segment table address JMP GETIOB ;Get IOBYTE JMP SETIOB ;SET IOBYTE ; What follows is not part of the formal interface ; to CP/m, however various CompuPro/Sorcim utilities ; will not operate properly if arbitrary alterations ; are made. Caveat moderator. j.CPM: JMPL 0,SysSeg ;(reserved) ; Floppy step rate. STEPMS: VFD 4\ SRT, 4\ 0 space 4,10 bauds db 7 ;Relative port for console db 0eeh ;Mode register 1 db 7eh ;Mode register 2 db 27h ;Command register db 4 ;Relative port for lst: db 0eeh ;Mode register 1 db 7eh ;Mode register 2 db 27h ;Command register db 5 ;Relative port for ul1: db 0eeh ;Mode register 1 db 7eh ;Mode register 2 db 27h ;Command register space 4,10 ; Board option switches. ; Boot stores switch settings into OPTS. ; CBios/CBoot copies into OPT_SW. ; 0= Normal. ; 1= Use BitBanger for console. ; 2= (reserved) ; 3= (available) OPT_SW: DB 0 space 4,10 ; IOBYTE -- not presently used by this CP/M86 BIOS. ; ; 7 6 5 4 3 2 1 0 ; +--------+-------+-------+--------+ ; | List | Punch | Reader| Console| ; +--------+-------+-------+--------+ IOBYTE: DB 0 space 4,10 ; Memory region descriptors. ; ; +---------------+ ; MRT: | region count | ; +---------------+---------------+ ; 0: | region base | ; +---- ----+ ; | region length | ; +-------------------------------+ ; | | ; . . . ; | | ; +---------------+---------------+ ; n: | region base | ; +---- ----+ ; | region length | ; +-------------------------------+ ; ; The region base is a paragraph and the length is ; in paragraphs. HiBase = 0F000h + (1000h - HIMEM) MRT: DB MRTCNT DW SYSEND, LOMEM-SYSEND IF HiMem <> 0 DW HiBase, HiMem-1 endif MRTCNT: = (*-MRT-1)/4 ECHO 8-MRTCNT DW 0, 0 ENDM