diff --git a/software/CPM/ROMRFS/RAW/CPM_RFS_1.RAW b/software/CPM/ROMRFS/RAW/CPM_RFS_1.RAW index 413309f..1d038f2 100644 Binary files a/software/CPM/ROMRFS/RAW/CPM_RFS_1.RAW and b/software/CPM/ROMRFS/RAW/CPM_RFS_1.RAW differ diff --git a/software/CPM/ROMRFS/RAW/CPM_RFS_2.RAW b/software/CPM/ROMRFS/RAW/CPM_RFS_2.RAW index 68e83a6..3236636 100644 Binary files a/software/CPM/ROMRFS/RAW/CPM_RFS_2.RAW and b/software/CPM/ROMRFS/RAW/CPM_RFS_2.RAW differ diff --git a/software/MZF/CPM_RFS_1.MZF b/software/MZF/CPM_RFS_1.MZF index c69434b..a51f161 100644 Binary files a/software/MZF/CPM_RFS_1.MZF and b/software/MZF/CPM_RFS_1.MZF differ diff --git a/software/MZF/CPM_RFS_2.MZF b/software/MZF/CPM_RFS_2.MZF index c8dfeba..6b43430 100644 Binary files a/software/MZF/CPM_RFS_2.MZF and b/software/MZF/CPM_RFS_2.MZF differ diff --git a/software/asm/cbios.asm b/software/asm/cbios.asm index 9cc7e0c..0595ac6 100644 --- a/software/asm/cbios.asm +++ b/software/asm/cbios.asm @@ -123,7 +123,10 @@ BKTOBKRET: PUSH AF ; Public methods for User Rom CBIOS Bank 1 - Utility functions. -?REBOOT: LD A,ROMBANK8 ; Method to exit CPM and return to the Sharp MZ80A Monitor. +?REBOOT: LD A,(ROMCTL) ; Make sure Flash RAM I is active. + AND 03FH + LD (ROMCTL),A + LD A,ROMBANK8 ; Method to exit CPM and return to the Sharp MZ80A Monitor. SCF CALL SELUSRBNK ; Ensure Rom Control is enabled JP QREBOOT ; Reboot has to take place from User ROM as the monitor ROM is swapped back to default position. @@ -243,13 +246,299 @@ BKTOBKRET: PUSH AF ; LD ($EFFD),A ; - Perform the bank switch. ; JP $C000 ; - Go to BOOT_ ;------------------------------------------------------------------------------- -BOOT_: LD SP,BIOSSTACK - CALL INIT ; Initialise CBIOS. +BOOT_: DI ; Disable Interrupts and sat mode. NB. Interrupts are physically disabled by 8255 Port C2 set to low. + IM 1 ; + LD SP,BIOSSTACK ; Setup to use local stack until CPM takes over. + ; + LD HL,VARSTART ; Start of variable area + LD BC,VAREND-VARSTART ; Size of variable area. + XOR A + LD D,A +INIT1: LD (HL),D ; Clear variable memory including stack space. + INC HL + DEC BC + LD A,B + OR C + JR NZ,INIT1 + LD HL,00000H + LD BC,CBASE +INIT2: LD (HL),D ; Clear TPA space. + INC HL + DEC BC + LD A,B + OR C + JR NZ,INIT2 + ; + CALL ?MODE ; Configure 8255 port C, set Motor Off, VGATE to 1 (off) and INTMSK to 0 (interrupts disabled). + LD A,016H + CALL ?PRNT + LD A,017H ; Blue background, white characters in colour mode. Bit 7 is set as a write to bit 7 @ DFFFH selects 80Char mode. + LD HL,ARAM + CALL CLR8 + LD A,004H + LD (TEMPW),A ; Setup the tempo for sound output. + + ; Initialise the Rom Paging Control Registers. + LD B,16 ; If we read the bank control reset register 16 times then this will enable bank control and the 16th read will reset all bank control registers to default. +INIT3: LD A,(BNKCTRLRST) + DJNZ INIT3 ; Apply the default number of coded latch reads to enable the bank control registers. + LD A,BNKCTRLDEF ; Set coded latch, SDCS high, BBMOSI to high and BBCLK to high which enables SDCLK. + LD (BNKCTRL),A + LD (ROMCTL),A ; Save to memory the value in the bank control register - this register is used for SPI etc so need to remember its setting. + LD A,ROMBANK9 ; Screen Bank. + LD (BNKSELUSER),A + ; + + ; Setup keyboard buffer control. + LD A,0 + LD (KEYCOUNT),A ; Set keyboard buffer to empty. + LD HL,KEYBUF + LD (KEYWRITE),HL ; Set write pointer to beginning of keyboard buffer. + LD (KEYREAD),HL ; Set read pointer to beginning of keyboard buffer. + + ; Setup keyboard rate control and set to CAPSLOCK mode. + ; (0 = Off, 1 = CAPSLOCK, 2 = SHIFTLOCK). + LD HL,00002H ; Initialise key repeater. + LD (KEYRPT),HL + LD A,001H + LD (SFTLK),A ; Setup shift lock, default = off. + + ; Setup the initial cursor, for CAPSLOCK this is a double underscore. + LD A,03EH + LD (FLSDT),A + LD A,080H ; Cursor on (Bit D7=1). + LD (FLASHCTL),A + + ; Change to 80 character mode. + LD A, 128 ; 80 char mode. + LD (DSPCTL), A + CALL ?MLDSP + CALL ?NL + LD DE,CBIOSSIGNON ; Start of sign on message, as devices are detected they are added to the sign on. + CALL MONPRTSTR + CALL ?BEL ; Beep to indicate startup - for cases where screen is slow to startup. + LD A,0FFH + LD (SWRK),A + + LD HL,NUMBERBUF + LD (NUMBERPOS),HL + ; + XOR A + LD (IOBYT),A + LD (CDISK),A + + ; + ; Initialise the SD Card subsystem (if connected). + ; + CALL ?SDINIT + LD A,0 ; No drives yet detected so zero available mask. + RES 2,A ; No SD Card is present. + JR NZ,STRT2 + SET 2,A ; Assume the SD Card is present. + ; + PUSH AF ; Output indicator that SDC drives are available. + LD DE,SDAVAIL + CALL MONPRTSTR + POP AF + SET 7,A + ; + ; Locate the CPM Image and store the Bank/Block to speed up warm boot. +STRT2: LD (DRVAVAIL),A + ; + LD HL,CPMROMFNAME ; Name of CPM File in rom. + CALL FINDMZF + JP NZ,ROMFINDERR ; Failed to find CPM in the ROM! This shouldnt happen as we boot from ROM. + LD (CPMROMLOC),BC + + ; Locate the ROMFS CPM Disk Image to be mapped as drive D. + LD HL,0FFFFh + LD (CPMROMDRV0),HL + LD (CPMROMDRV1),HL + LD HL,CPMRDRVFN0 ; Name of CPM Rom Drive File 0 in rom. + CALL FINDMZF + JR NZ,STRT3 ; Failed to find the drive image in the ROM! + LD (CPMROMDRV0),BC ; If found store the bank and page the image is located at. + LD A,(DRVAVAIL) + SET 1,A ; Indicate ROM drives are available. + ; + PUSH AF ; Output indicator that ROM 1 drive is available. + BIT 7,A + JR Z,STRT2A + LD A,',' + CALL ?PRNT +STRT2A: LD DE,ROM1AVAIL + CALL MONPRTSTR + POP AF + SET 7,A + LD (DRVAVAIL),A + ; +STRT3: LD HL,CPMRDRVFN1 ; Name of CPM Rom Drive File 1 in rom. + CALL FINDMZF + JR NZ,STRT4 ; Failed to find the drive image in the ROM! + LD (CPMROMDRV1),BC ; If found store the bank and page the image is located at. + LD A,(DRVAVAIL) + SET 1,A ; Indicate ROM drives are available. + ; + PUSH AF ; Output indicator that ROM 2 drive is available. + BIT 7,A + JR Z,STRT3A + LD A,',' + CALL ?PRNT +STRT3A: LD DE,ROM2AVAIL + CALL MONPRTSTR + POP AF + SET 7,A + LD (DRVAVAIL),A + ; +STRT4: CALL ?DSKINIT ; Initialise the disk subsystem. + JR NZ,STRT5 + LD A,(DRVAVAIL) + SET 0,A ; Indicate Floppy drives are available. + + PUSH AF ; Output indicator that FDC drives are available. + BIT 7,A + JR Z,STRT4A + LD A,',' + CALL ?PRNT +STRT4A: LD DE,FDCAVAIL + CALL MONPRTSTR + POP AF + SET 7,A + LD (DRVAVAIL),A + ; +STRT5: LD DE,CBIOSIGNEND ; Terminate the signon message which now includes list of drives detected. + CALL MONPRTSTR + CALL ?NL + ; + LD DE,DPBASE ; Base of parameter block. + LD A,0 ; Using scratch area, setup the disk count, pointer to ALV memory and pointer to CSV memory. + LD (CDIRBUF),A + LD HL,CSVALVMEM + LD (CDIRBUF+1),HL + ; + LD A,(DRVAVAIL) + BIT 1,A + JR Z,STRT7 ; No ROM drives available then skip. + ; + LD BC,64/4 ; 32/4 ; Setup CSV/ALV parameters for a ROM drive. + LD (CDIRBUF+3),BC + LD BC,20 ; 240/8 + 1 ; 240/8 + 1 for a 240K drive with 1024B block, 159/8 + 1 for a 320K drive with 2048B block. + LD (CDIRBUF+5),BC + LD BC,DPBLOCK1 + LD (CDIRBUF+7),BC ; Address of Disk Parameters + + LD A,(CPMROMDRV0) ; Drive 0 available? + CP 0FFH + JR Z,STRT6 + ; + CALL COPYDPB ; Copy and set parameters + +STRT6: LD A,(CPMROMDRV1) ; Drive 1 available? + CP 0FFH + JR Z,STRT7 + + LD BC,DPBLOCK2 + LD (CDIRBUF+7),BC ; Address of Disk Parameters + CALL COPYDPB + +STRT7: LD A,(DRVAVAIL) + BIT 0,A + JR Z,STRT8 ; No Floppy drives available then skip. + + LD BC,128/4 ; Setup CSV/ALV parameters for a 1.4MB Floppy drive. + LD (CDIRBUF+3),BC + LD BC,91 ; 720/8 + 1 + LD (CDIRBUF+5),BC + LD BC,DPBLOCK3 + LD (CDIRBUF+7),BC ; Address of Disk Parameters + + ; Floppy drive controller always has 2 drives so set them up. + CALL COPYDPB + CALL COPYDPB + +STRT8: LD A,(DRVAVAIL) + BIT 2,A + JR Z,STRT10 ; No SD Card drives available then skip. + + LD BC,0 ; Setup CSV/ALV parameters for a 16MB SD Card drive. + LD (CDIRBUF+3),BC + LD BC,257 ; 2048/8 + 1 + LD (CDIRBUF+5),BC + LD BC,DPBLOCK4 + LD (CDIRBUF+7),BC ; Address of Disk Parameters + + CALL COPYDPB ; Add in 2 SD drives by default. +STRT9: CALL COPYDPB + ; + LD BC,(CDIRBUF+1) + LD HL,CSVALVEND - 2048/8 + 1 ; Subtract the size of the ALV (CSV has no size for a fixed SD drive) + OR A + SBC HL,BC + JR C,STRT10 ; If there is no more space, exit. + JR STRT9 ; Add another, keep on adding until there is no more ALV Memory free. + +STRT10: LD A,(CDIRBUF) + LD (NDISKS),A ; Setup max number of system disks found on this boot up. + + ; Setup timer interrupts + LD IX,TIMIN ; Pass the interrupt service handler vector. + LD BC,00000H ; Time starts at 00:00:00 01/01/1980 on initialisation. + LD DE,00000H + LD HL,00000H + CALL ?TIMESET + + ; Signon message after all the hardware has been initialised. LD DE,CPMSIGNON CALL MONPRTSTR + + ; CP/M init +CPMINIT: LD A,(DRVAVAIL) + BIT 0,A + JR Z,CPMINIT1 ; - JP GOCPM + CALL ?DSKINIT ; Re-initialise the disk subsystem if available. + XOR A ; 0 to accumulator + LD (HSTACT),A ; Host buffer inactive + LD (UNACNT),A ; Clear unalloc count + ; +CPMINIT1: LD A, 0C3H ; C3 IS A JMP INSTRUCTION + LD (00000H), A ; FOR JMP TO WBOOT + LD HL,WBOOTE ; WBOOT ENTRY POINT + LD (00001H), HL ; SET ADDRESS FIELD FOR JMP AT 0 + LD (00005H), A ; FOR JMP TO BDOS + LD HL, CPMBDOS ; BDOS ENTRY POINT + LD (00006H), HL ; ADDRESS FIELD OF JUMP AT 5 TO BDOS + LD HL,TIMIN ; Re-install interrupt vector for RTC incase it was overwritten. + LD (00038H),A + LD (00039H),HL + LD BC,CPMUSERDMA + CALL SETDMA_ + ; + ; check if current disk is valid + LD A,(NDISKS) ; Get the dynamic disk count. + LD L,A + LD A, (CDISK) ; GET CURRENT USER/DISK NUMBER (UUUUDDDD) + AND 00FH ; Isolate the disk number. + CP L ; Drive number ok? + JR C, WBTDSKOK2 ; Yes, jump (Carry set if A < NDISKS) + LD A, (CDISK) ; No, set disk 0 (previous user) + AND 0F0H + LD (CDISK), A ; Save User/Disk +WBTDSKOK2: CALL ?SETDRVMAP ; Refresh the map of physical floppies to CPM drive number. + CALL ?SETDRVCFG + LD A,(DISKTYPE) + OR A + CALL Z,?SELDRIVE ; Select and start disk drive motor if floppy disk. + ; + LD A,05H ; Enable interrupts at hardware level. + LD (KEYPF),A + ; + LD A, (CDISK) + LD C, A ; C = current User/Disk for CCP jump (UUUUDDDD) + ; +GOCPM: EI + JP CCP ; Start the CCP. ;------------------------------------------------------------------------------- ; WBOOT @@ -281,9 +570,18 @@ BOOT_: LD SP,BIOSSTACK ; initialization. The WBOOT routine should read location 4 in memory, verify ; that is a legal drive, and pass it to the CCP in register C. ;------------------------------------------------------------------------------- -WBOOT_: LD SP,BIOSSTACK - CALL WINIT -GOCPM: JP CCP ; Start the CCP. +WBOOT_: DI + ; + LD SP,BIOSSTACK + + ; Reload the CCP and BDOS from ROM. + LD DE,CPMBIOS-CBASE ; Only want to load in CCP and BDOS. + LD BC,(CPMROMLOC) ; Load up the Bank and Page where the CPM Image can be found. + CALL UROMLOAD + LD A,ROMBANK9 ; Screen Bank. + LD (BNKSELUSER),A + ; + JP CPMINIT ; Initialise CPM and run. ;------------------------------------------------------------------------------- @@ -638,257 +936,28 @@ ALLOC2: LD (RSFLAG), A ; rsfla ; Function to select a User Bank. If Carry is clear upon entry, on exit the control registers will be disabled. If carry is set then the control registers are left active. ; During normal operations the control registers are enabled. When access is needed to the full User ROM space, ie for drive read/write then the registers are disabled after - ; setting the correct bank. + ; setting the correct bank. The upper bits of the User ROM address space (ie. bits 20:19 which select the device) are set to by the ROMCTL variable. ; SELUSRBNK: PUSH BC PUSH AF LD A,(ROMCTL) ; Get current setting for the coded latch, ie. number of reads needed to enable it. + LD C,A RRA RRA CPL AND 00FH ; Preserve bits 3-1, bit 0 is always 0 on the 74HCT191 latch. LD B,A ; Set value to B for loop. - LD A,(BNKCTRLDIS) SELUSRBNK1: LD A,(BNKSELUSER) DJNZ SELUSRBNK1 + LD A,C + LD (BNKCTRL),A POP AF - POP BC LD (BNKSELUSER),A ; Select the required bank. + POP BC JR C,SELUSRBNK2 ; If Carry is set by caller then leave the control registers active. LD (BNKCTRLDIS),A ; Disable the control registers, value of A is not important. SELUSRBNK2: RET - ;------------------------------------------------------------------------------- - ; INIT - ; - ; Cold start initialisation routine. Called on CPM first start. - ;------------------------------------------------------------------------------- -INIT: DI - IM 1 - ; - LD HL,VARSTART ; Start of variable area - LD BC,VAREND-VARSTART ; Size of variable area. - XOR A - CALL CLRMEM ; Clear memory. - CALL ?MODE - LD A,016H - CALL ?PRNT - LD A,017H ; Blue background, white characters in colour mode. Bit 7 is set as a write to bit 7 @ DFFFH selects 80Char mode. - LD HL,ARAM -STRT1: CALL CLR8 - LD A,004H - LD (TEMPW),A ; Setup the tempo for sound output. - - ; Initialise the Rom Paging Control Registers. - LD B,16 ; If we read the bank control reset register 16 times then this will enable bank control and the 16th read will reset all bank control registers to default. -INIT1: LD A,(BNKCTRLRST) - DJNZ INIT1 ; Apply the default number of coded latch reads to enable the bank control registers. - LD A,BNKCTRLDEF ; Set coded latch, SDCS high, BBMOSI to high and BBCLK to high which enables SDCLK. - LD (BNKCTRL),A - LD (ROMCTL),A ; Save to memory the value in the bank control register - this register is used for SPI etc so need to remember its setting. - LD A,ROMBANK9 ; Screen Bank. - LD (BNKSELUSER),A - ; - - ; Setup keyboard buffer control. - LD A,0 - LD (KEYCOUNT),A ; Set keyboard buffer to empty. - LD HL,KEYBUF - LD (KEYWRITE),HL ; Set write pointer to beginning of keyboard buffer. - LD (KEYREAD),HL ; Set read pointer to beginning of keyboard buffer. - - ; Setup keyboard rate control and set to CAPSLOCK mode. - ; (0 = Off, 1 = CAPSLOCK, 2 = SHIFTLOCK). - LD HL,00002H ; Initialise key repeater. - LD (KEYRPT),HL - LD A,001H - LD (SFTLK),A ; Setup shift lock, default = off. - - ; Setup the initial cursor, for CAPSLOCK this is a double underscore. - LD A,03EH - LD (FLSDT),A - LD A,080H ; Cursor on (Bit D7=1). - LD (FLASHCTL),A - - ; Change to 80 character mode. - LD A, 128 ; 80 char mode. - LD (DSPCTL), A - CALL ?MLDSP - CALL ?NL - LD DE,CBIOSSIGNON ; Start of sign on message, as devices are detected they are added to the sign on. - CALL MONPRTSTR - CALL ?BEL ; Beep to indicate startup - for cases where screen is slow to startup. - LD A,0FFH - LD (SWRK),A - - ; - ; Initialise the SD Card subsystem (if connected). - ; - CALL ?SDINIT - LD A,0 ; No drives yet detected so zero available mask. - RES 2,A ; No SD Card is present. - JR NZ,STRT2 - SET 2,A ; Assume the SD Card is present. - ; - PUSH AF ; Output indicator that SDC drives are available. - LD DE,SDAVAIL - CALL MONPRTSTR - POP AF - SET 7,A - ; - ; Locate the CPM Image and store the Bank/Block to speed up warm boot. -STRT2: LD (DRVAVAIL),A - ; - LD HL,CPMROMFNAME ; Name of CPM File in rom. - CALL FINDMZF - JP NZ,ROMFINDERR ; Failed to find CPM in the ROM! This shouldnt happen as we boot from ROM. - LD (CPMROMLOC),BC - - ; Locate the ROMFS CPM Disk Image to be mapped as drive D. - LD HL,0FFFFh - LD (CPMROMDRV0),HL - LD (CPMROMDRV1),HL - LD HL,CPMRDRVFN0 ; Name of CPM Rom Drive File 0 in rom. - CALL FINDMZF - JR NZ,STRT3 ; Failed to find the drive image in the ROM! - LD (CPMROMDRV0),BC ; If found store the bank and page the image is located at. - LD A,(DRVAVAIL) - SET 1,A ; Indicate ROM drives are available. - ; - PUSH AF ; Output indicator that ROM 1 drive is available. - BIT 7,A - JR Z,STRT2A - LD A,',' - CALL ?PRNT -STRT2A: LD DE,ROM1AVAIL - CALL MONPRTSTR - POP AF - SET 7,A - LD (DRVAVAIL),A - ; -STRT3: LD HL,CPMRDRVFN1 ; Name of CPM Rom Drive File 1 in rom. - CALL FINDMZF - JR NZ,STRT4 ; Failed to find the drive image in the ROM! - LD (CPMROMDRV1),BC ; If found store the bank and page the image is located at. - LD A,(DRVAVAIL) - SET 1,A ; Indicate ROM drives are available. - ; - PUSH AF ; Output indicator that ROM 2 drive is available. - BIT 7,A - JR Z,STRT3A - LD A,',' - CALL ?PRNT -STRT3A: LD DE,ROM2AVAIL - CALL MONPRTSTR - POP AF - SET 7,A - LD (DRVAVAIL),A - ; -STRT4: LD HL,NUMBERBUF - LD (NUMBERPOS),HL - ; - XOR A - LD (IOBYT),A - LD (CDISK),A - ; - CALL ?DSKINIT ; Initialise the disk subsystem. - JR NZ,STRT5 - LD A,(DRVAVAIL) - SET 0,A ; Indicate Floppy drives are available. - - PUSH AF ; Output indicator that FDC drives are available. - BIT 7,A - JR Z,STRT4A - LD A,',' - CALL ?PRNT -STRT4A: LD DE,FDCAVAIL - CALL MONPRTSTR - POP AF - SET 7,A - LD (DRVAVAIL),A - ; -STRT5: LD DE,CBIOSIGNEND ; Terminate the signon message which now includes list of drives detected. - CALL MONPRTSTR - CALL ?NL - ; - LD DE,DPBASE ; Base of parameter block. - LD A,0 ; Using scratch area, setup the disk count, pointer to ALV memory and pointer to CSV memory. - LD (CDIRBUF),A - LD HL,CSVALVMEM - LD (CDIRBUF+1),HL - ; - LD A,(DRVAVAIL) - BIT 1,A - JR Z,STRT7 ; No ROM drives available then skip. - ; - LD BC,32/4 ; Setup CSV/ALV parameters for a ROM drive. - LD (CDIRBUF+3),BC - LD BC,31 ; 240/8 + 1 - LD (CDIRBUF+5),BC - LD BC,DPBLOCK1 - LD (CDIRBUF+7),BC ; Address of Disk Parameters - - LD A,(CPMROMDRV0) ; Drive 0 available? - CP 0FFH - JR Z,STRT6 - ; - CALL COPYDPB ; Copy and set parameters - -STRT6: LD A,(CPMROMDRV1) ; Drive 1 available? - CP 0FFH - JR Z,STRT7 - - LD BC,DPBLOCK2 - LD (CDIRBUF+7),BC ; Address of Disk Parameters - CALL COPYDPB - -STRT7: LD A,(DRVAVAIL) - BIT 0,A - JR Z,STRT8 ; No Floppy drives available then skip. - - LD BC,128/4 ; Setup CSV/ALV parameters for a 1.4MB Floppy drive. - LD (CDIRBUF+3),BC - LD BC,91 ; 720/8 + 1 - LD (CDIRBUF+5),BC - LD BC,DPBLOCK3 - LD (CDIRBUF+7),BC ; Address of Disk Parameters - - ; Floppy drive controller always has 2 drives so set them up. - CALL COPYDPB - CALL COPYDPB - -STRT8: LD A,(DRVAVAIL) - BIT 2,A - JR Z,STRT10 ; No SD Card drives available then skip. - - LD BC,0 ; Setup CSV/ALV parameters for a 16MB SD Card drive. - LD (CDIRBUF+3),BC - LD BC,257 ; 2048/8 + 1 - LD (CDIRBUF+5),BC - LD BC,DPBLOCK4 - LD (CDIRBUF+7),BC ; Address of Disk Parameters - - CALL COPYDPB ; Add in 2 SD drives by default. -STRT9: CALL COPYDPB - ; - LD BC,(CDIRBUF+1) - LD HL,CSVALVEND - 2048/8 + 1 ; Subtract the size of the ALV (CSV has no size for a fixed SD drive) - OR A - SBC HL,BC - JR C,STRT10 ; If there is no more space, exit. - JR STRT9 ; Add another, keep on adding until there is no more ALV Memory free. - -STRT10: LD A,(CDIRBUF) - LD (NDISKS),A ; Setup max number of system disks found on this boot up. - - ; Setup timer interrupts - LD IX,TIMIN ; Pass the interrupt service handler vector. - LD BC,00000H ; Time starts at 00:00:00 01/01/1980 on initialisation. - LD DE,00000H - LD HL,00000H - CALL ?TIMESET - ; - JR CPMINIT ; Helper method to set up a Disk Parameter Block. ; Input: Drive Count = (CDIRBUF) @@ -928,65 +997,6 @@ COPYDPB1: LDI LD (CDIRBUF),A ; Update drive count. RET - ;------------------------------------------------------------------------------- - ; WINIT - ; - ; Warm start initialisation routine. Called whenever CPM is restarted by an - ; exitting TPA program or a simple warm start call to vector 00000h. - ; - ; Warm boot initialisation. Called by CPM when a warm restart is - ; required, reinitialise any needed hardware and reload CCP+BDOS. - ;------------------------------------------------------------------------------- -WINIT: DI - ; Reload the CCP and BDOS from ROM. - LD DE,CPMBIOS-CBASE ; Only want to load in CCP and BDOS. - LD BC,(CPMROMLOC) ; Load up the Bank and Page where the CPM Image can be found. - CALL UROMLOAD - LD A,ROMBANK9 ; Screen Bank. - LD (BNKSELUSER),A - ; -CPMINIT: LD A,(DRVAVAIL) - BIT 0,A - JR Z,CPMINIT1 - ; - CALL ?DSKINIT ; Re-initialise the disk subsystem if available. - XOR A ; 0 to accumulator - LD (HSTACT),A ; Host buffer inactive - LD (UNACNT),A ; Clear unalloc count - - ; CP/M init -CPMINIT1: LD A, 0C3H ; C3 IS A JMP INSTRUCTION - LD (00000H), A ; FOR JMP TO WBOOT - LD HL,WBOOTE ; WBOOT ENTRY POINT - LD (00001H), HL ; SET ADDRESS FIELD FOR JMP AT 0 - LD (00005H), A ; FOR JMP TO BDOS - LD HL, CPMBDOS ; BDOS ENTRY POINT - LD (00006H), HL ; ADDRESS FIELD OF JUMP AT 5 TO BDOS - LD HL,TIMIN ; Re-install interrupt vector for RTC incase it was overwritten. - LD (00038H),A - LD (00039H),HL - LD BC,CPMUSERDMA - CALL SETDMA_ - EI ; Interrupts on for the RTC. - ; check if current disk is valid - LD A,(NDISKS) ; Get the dynamic disk count. - LD L,A - LD A, (CDISK) ; GET CURRENT USER/DISK NUMBER (UUUUDDDD) - AND 00FH ; Isolate the disk number. - CP L ; Drive number ok? - JR C, WBTDSKOK2 ; Yes, jump (Carry set if A < NDISKS) - LD A, (CDISK) ; No, set disk 0 (previous user) - AND 0F0H - LD (CDISK), A ; Save User/Disk -WBTDSKOK2: CALL ?SETDRVMAP ; Refresh the map of physical floppies to CPM drive number. - CALL ?SETDRVCFG - LD A,(DISKTYPE) - OR A - CALL Z,?SELDRIVE ; Select and start disk drive motor if floppy disk. - LD A, (CDISK) - LD C, A ; C = current User/Disk for CCP jump (UUUUDDDD) - RET - ;------------------------------------------------------------------------------- ; TIMER INTERRUPT @@ -1378,28 +1388,28 @@ L09E8: LD (HL),D CMPSTRING: PUSH HL PUSH DE -CMPSTR1: LD A, (DE) ; Compare bytes. - CP 000h ; Check for end of string. +CMPSTR1: LD A, (DE) ; Compare bytes. + CP 000h ; Check for end of string. JR Z, CMPSTR3 CP 00Dh JR Z, CMPSTR3 - CPI ; Compare bytes. - JR NZ, CMPSTR2 ; If (HL) != (DE), abort. - INC DE ; Update pointer. - JP PE, CMPSTR1 ; Next byte if BC not zero. + CPI ; Compare bytes. + JR NZ, CMPSTR2 ; If (HL) != (DE), abort. + INC DE ; Update pointer. + JP PE, CMPSTR1 ; Next byte if BC not zero. CMPSTR2: DEC HL - CP (HL) ; Compare again to affect carry. + CP (HL) ; Compare again to affect carry. CMPSTR4: POP DE POP HL RET CMPSTR3: LD A, (HL) - CP 000h ; Check for end of string. + CP 000h ; Check for end of string. JR Z, CMPSTR4 CP 00Dh JR Z, CMPSTR4 - SCF ; String 1 greater than string 2 + SCF ; String 1 greater than string 2 JR CMPSTR4 ; HL contains address of block to check. @@ -1408,30 +1418,30 @@ ISMZF: PUSH BC PUSH HL ; LD A,(HL) - CP 001h ; Only interested in machine code images. + CP 001h ; Only interested in machine code images. JR NZ, ISMZFNOT ; INC HL - LD DE,NAME ; Checks to confirm this is an MZF header. - LD B,17 ; Maximum of 17 characters, including terminator in filename. + LD DE,NAME ; Checks to confirm this is an MZF header. + LD B,17 ; Maximum of 17 characters, including terminator in filename. ISMZFNXT: LD A,(HL) LD (DE),A - CP 00Dh ; If we find a terminator then this indicates potentially a valid name. + CP 00Dh ; If we find a terminator then this indicates potentially a valid name. JR Z, ISMZFVFY - CP 020h ; >= Space + CP 020h ; >= Space JR C, ISMZFNOT - CP 05Dh ; =< ] + CP 05Dh ; =< ] JR C, ISMZFNXT3 ISMZFNXT2: CP 091h - JR C, ISMZFNOT ; DEL or > 0x7F, cant be a valid filename so this is not an MZF header. + JR C, ISMZFNOT ; DEL or > 0x7F, cant be a valid filename so this is not an MZF header. ISMZFNXT3: INC DE INC HL DJNZ ISMZFNXT - JR ISMZFNOT ; No end of string terminator, this cant be a valid filename. + JR ISMZFNOT ; No end of string terminator, this cant be a valid filename. ISMZFVFY: LD A,B CP 17 - JR Z,ISMZFNOT ; If the filename has no length it cant be valid, so loop. -ISMZFYES: CP A ; Set zero flag to indicate match. + JR Z,ISMZFNOT ; If the filename has no length it cant be valid, so loop. +ISMZFYES: CP A ; Set zero flag to indicate match. ISMZFNOT: POP HL POP DE POP BC @@ -1441,25 +1451,30 @@ ISMZFNOT: POP HL ; HL = filename ; Out: ; B = Bank Page file found - ; C = Block where found. + ; C = 7:6 = Upper Bank address where file found, 5:0 = Block where found. ; D = File sequence number. ; Z set if found. -FINDMZF: LD (TMPADR), HL ; Save name of program to load. +FINDMZF: LD (TMPADR), HL ; Save name of program to load. ; ; Scan MROM Bank ; B = Bank Page ; C = Block in page ; D = File sequence number. ; -FINDMZF0: LD B,USRROMPAGES ; First 16 pages are reserved in User ROM bank. - LD C,0 ; Block in page. - LD D,0 ; File numbering start. +FINDMZF0: LD B,USRROMPAGES ; First 16 pages are reserved in User ROM bank. + ; + LD A,(ROMCTL) + AND 03FH ; Mask out the upper bank address lines so we start with Flash RAM I. + ; +FINDNXTDVC: LD (ROMCTL),A + LD C,0 ; Block in page. + LD D,0 ; File numbering start. FINDMZF1: LD A,B - OR A ; Select the required user bank and Clear carry so that the control registers are disabled. + OR A ; Select the required user bank and Clear carry so that the control registers are disabled. CALL SELUSRBNK -FINDMZF2: PUSH BC ; Preserve bank count/block number. - PUSH DE ; Preserve file numbering. - LD HL,0E800h + RFS_ATRB ; Add block offset to get the valid block. +FINDMZF2: PUSH BC ; Preserve bank count/block number. + PUSH DE ; Preserve file numbering. + LD HL,0E800h + RFS_ATRB ; Add block offset to get the valid block. LD A,C IF RFSSECTSZ >= 512 RLCA @@ -1470,41 +1485,59 @@ FINDMZF2: PUSH BC ; Preserve bank count/block numb LD B,A LD C,0 ADD HL,BC - CALL ISMZF ; Check to see if this looks like a header entry. + CALL ISMZF ; Check to see if this looks like a header entry. POP DE POP BC - JR NZ, FINDMZF4 ; Z set if we found an MZF record. - INC HL ; Save address of filename. + JR NZ, FINDMZF4 ; Z set if we found an MZF record. + INC HL ; Save address of filename. FINDMZF3: PUSH DE PUSH BC - LD DE,(TMPADR) ; Original DE put onto stack, original filename into DE + LD DE,(TMPADR) ; Original DE put onto stack, original filename into DE LD BC,17 CALL CMPSTRING POP BC POP DE JR Z, FINDMZFYES - INC D ; Next file sequence number. + INC D ; Next file sequence number. FINDMZF4: INC C LD A,C - CP UROMSIZE/RFSSECTSZ ; Max blocks per page reached? + CP UROMSIZE/RFSSECTSZ ; Max blocks per page reached? JR C, FINDMZF5 LD C,0 INC B FINDMZF5: LD A,B - CP 000h ; User ROM has 256 banks of 2K, so stop when we wrap around to zero. + CP 000h ; User ROM has 256 banks of 2K, so stop when we wrap around to zero. JR NZ, FINDMZF1 - INC B + ; + LD A,(ROMCTL) + ADD A, 64 + CP 0C0H ; If both upper address bits are set then we have come to the end. + JR C,FINDNXTDVC + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. + ; + INC B ; Clear Z flag. JR FINDMZFNO - -FINDMZFYES: ; Z Flag set by previous test. -FINDMZFNO: LD A,ROMBANK9 - SCF ; Select the required user bank and Set carry so that the control registers remain enabled. + ; +FINDMZFYES: LD A,(ROMCTL) + AND 0C0H ; Interested in the top two address bits 20:19 + OR C + LD C,A ; Place the top address bits into the Block as the upper two bits. + LD A,(ROMCTL) + AND 03FH + LD (ROMCTL),A ; Reset upper address bits to the User ROM I device. + XOR A ; Clear Z flag to indicate we found the file and BC points to it. + ; +FINDMZFNO: PUSH AF ; Preserve flags. + LD A,ROMBANK9 + SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK + POP AF RET ; Load Program from ROM - ; IN BC Bank and Block of MZF file. + ; IN BC Bank and Block of MZF file. C contains Block in bits 5:0 and upper bank address bits in 7:6. ; DE 0 - use file size in header, > 0 file size to load. ; OUT zero Set if file loaded, reset if an error occurred. ; @@ -1512,12 +1545,25 @@ FINDMZFNO: LD A,ROMBANK9 ; UROMLOAD: PUSH BC PUSH DE + ; + LD A,C ; Set upper address bits by masking out 7:6 and adding to ROMCTL variable. + AND 0C0H + LD L,A + LD A,(ROMCTL) + AND 03FH + OR L + LD (ROMCTL),A + ; + LD A,C ; Remove upper address bits from starting block. + AND 03FH + LD C,A + ; LD A,B - OR A ; Select the required user bank and Clear carry so that the control registers are disabled. + OR A ; Select the required user bank and Clear carry so that the control registers are disabled. CALL SELUSRBNK ; - LD DE, IBUFE ; Copy the header into the work area. - LD HL, 0E800h ; Add block offset to get the valid block. + LD DE, IBUFE ; Copy the header into the work area. + LD HL, 0E800h ; Add block offset to get the valid block. LD A,C IF RFSSECTSZ >= 512 RLCA @@ -1530,13 +1576,13 @@ UROMLOAD: PUSH BC ADD HL,BC LD BC, MZFHDRNCSZ LDIR - LD DE,MZFHDRSZ - MZFHDRNCSZ ; Account for the full MZF header (we only load the initial part to save RAM). + LD DE,MZFHDRSZ - MZFHDRNCSZ ; Account for the full MZF header (we only load the initial part to save RAM). ADD HL,DE POP DE - LD A,D ; Test DE, if 0 the use the size to load from header. - OR E ; if not 0, use size to load in DE. + LD A,D ; Test DE, if 0 the use the size to load from header. + OR E ; if not 0, use size to load in DE. JR Z,LROMLOAD1 - LD (SIZE),DE ; Overwrite the header size with the new size to load. + LD (SIZE),DE ; Overwrite the header size with the new size to load. LROMLOAD1: PUSH HL LD DE, (DTADR) @@ -1551,11 +1597,11 @@ LROMLOAD1: PUSH HL ; B = Bank ; C = Block LROMLOAD2: LD A, B - OR A ; Select the required user bank and Clear carry so that the control registers are disabled. + OR A ; Select the required user bank and Clear carry so that the control registers are disabled. CALL SELUSRBNK LROMLOAD3: PUSH BC - LD HL, 0E800h + LD HL, UROMADDR LD A, C IF RFSSECTSZ >= 512 RLCA @@ -1576,23 +1622,23 @@ LROMLOAD3: PUSH BC JR NC, LROMLOAD4 LD BC, (TMPSIZE) LD HL, 0 -LROMLOAD4: LD (TMPSIZE), HL ; HL contains remaining amount of bytes to load. +LROMLOAD4: LD (TMPSIZE), HL ; HL contains remaining amount of bytes to load. POP HL ; - LD A, B ; Pre check to ensure BC is not zero. + LD A, B ; Pre check to ensure BC is not zero. OR C JR Z, LROMLOAD8 LDIR LD BC, (TMPSIZE) - LD A, B ; Post check to ensure we still have bytes + LD A, B ; Post check to ensure we still have bytes OR C JR Z, LROMLOAD8 ; - LD (TMPADR),DE ; Address we are loading into. + LD (TMPADR),DE ; Address we are loading into. POP BC LROMLOAD6: INC C LD A, C - CP UROMSIZE/RFSSECTSZ ; Max blocks per page reached? + CP UROMSIZE/RFSSECTSZ ; Max blocks per page reached? JR C, LROMLOAD7 LD C, 0 INC B @@ -1605,8 +1651,11 @@ LROMLOAD7: LD A, B ; LROMLOAD8: POP BC LROMLOAD5: PUSH AF + LD A,(ROMCTL) + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. LD A,ROMBANK9 - SCF ; Select the required user bank and Set carry so that the control registers remain enabled. + SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK POP AF RET @@ -1614,6 +1663,11 @@ LROMLOAD5: PUSH AF ; Calculate offset into the ROM of the required sector. ; The sector size is 128 bytes due to the MZF header creating a 128 byte offset. Larger sector ; sizes will need to see the math enhanced to cater for the offset. + + ; Inputs: (HSTTRK) - 16bit track number. + ; (HSTSEK) - 8bit sector number. + ; (CDISK) - Disk drive number. + ; ROMREAD: LD DE,(HSTTRK) ; To cater for larger RFS images in the future we use the full 16bit track number. LD (TRACKNO),DE LD A, BANKSPERTRACK * SECTORSPERBANK @@ -1637,11 +1691,22 @@ ROMREAD3: DJNZ ROMREAD2 PUSH HL CALL ?GETMAPDSK AND 03FH ; Mask out the controller id bits. - JR NZ,ROMREAD3A ; Only 2 ROM drives, so it it isnt drive 0 then it must be drive 1. + JR NZ,ROMREAD3A ; Only 2 ROM drives, so if it isnt drive 0 then it must be drive 1. LD BC,(CPMROMDRV0) JR ROMREAD3B ROMREAD3A: LD BC,(CPMROMDRV1) -ROMREAD3B: LD A,C +ROMREAD3B: LD A,C ; Set upper address bits by masking out 7:6 and adding to ROMCTL variable. + AND 0C0H + LD D,A + LD A,(ROMCTL) + AND 03FH + OR D + LD (ROMCTL),A + ; + LD A,C ; Remove upper address bits from starting block. + AND 03FH + LD C,A + ; LD E,B ; Place number of banks offset and multiply into sectors. LD D,0 LD A,SECTORSPERBANK @@ -1655,8 +1720,8 @@ ROMREAD5: DJNZ ROMREAD4 ; HL co POP DE ADD HL,DE ; HL contains the sectors for the number of tracks plus the sectors for the offset to the drive image. - ; C contains current block number. - LD D,SECTORSPERBLOCK ; Calculate the sectors in the block offset (as RFS uses a different sector size). + ; C contains current block number. + LD D,SECTORSPERBLOCK ; Calculate the sectors in the block offset (as RFS uses a different sector size). LD B,8 ROMREAD6: XOR A RLCA @@ -1732,37 +1797,37 @@ ROMREAD14: LD (TMPSIZE), HL ; HL co ; LD A, B ; Pre check to ensure BC is not zero. OR C - JR Z, ROMREAD17 + JR Z, ROMREAD16 LDIR LD BC, (TMPSIZE) LD A, B ; Post check to ensure we still have bytes OR C - JR Z, ROMREAD17 + JR Z, ROMREAD16 ; LD (TMPADR),DE ; Address we are loading into. POP BC ROMREAD15: INC C LD A, C CP SECTORSPERBANK ; Max blocks per page reached? - JR C, ROMREAD16 + JR C, ROMREAD12 LD C, 0 INC B - ; -ROMREAD16: LD A, B + LD A, B CP 000h JR NZ, ROMREAD12 OR 1 - JR ROMREAD18 + JR ROMREAD17 ; -ROMREAD17: POP BC -ROMREAD18: PUSH AF +ROMREAD16: POP BC +ROMREAD17: PUSH AF + LD A,(ROMCTL) + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. LD A,ROMBANK9 ; Reselect utilities bank. SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK POP AF - POP HL ; HL/BC pushed onto stack in READHST, a jump was made this method not a call. - POP BC - RET + JP READHST3 ; HL/BC pushed onto stack in READHST, a jump was made this method not a call. ; Rom filing system error messages. ROMLOADERR: LD DE,ROMLDERRMSG @@ -2025,11 +2090,14 @@ WRITEHST4: LD A,1 ; Error ; Debug routine to print out all registers and dump a section of memory for analysis. ; DEBUG: IF ENADEBUG = 1 + LD (DBGSTACKP),SP + LD SP,DBGSTACK + ; PUSH AF PUSH BC PUSH DE PUSH HL - + ; PUSH AF PUSH HL PUSH DE @@ -2065,8 +2133,7 @@ DEBUG: IF ENADEBUG = 1 CALL ?PRTHX LD DE, INFOMSG5 CALL MONPRTSTR - LD HL,00000H - ADD HL,SP + LD HL,(DBGSTACKP) LD A,H CALL ?PRTHX LD A,L @@ -2170,6 +2237,8 @@ SKIPDUMP: POP HL POP DE POP BC POP AF + ; + LD SP,(DBGSTACKP) RET ; HL = Start @@ -2550,7 +2619,6 @@ SDAVAIL: DB "SD", ROM1AVAIL: DB "ROM1", NUL ROM2AVAIL: DB "ROM2", NUL FDCAVAIL: DB "FDC", NUL - ;------------------------------------------------------------------------------- ; END OF STATIC LOOKUP TABLES AND CONSTANTS ;------------------------------------------------------------------------------- @@ -2610,14 +2678,14 @@ DPB0: DW 64 ; SPT - ; Rom Filing System File Image acting as a drive. ; There are two definitions, 1 for each ROM drive, they can be identical but the CFG bit 5 will differ. DPB1: DW 128 ; SPT - 128 bytes sectors per track - DB 3 ; BSH - block shift factor - DB 7 ; BLM - block mask + DB 4 ; 3 ; BSH - block shift factor (Set to 3 for a 240K RomRFS Image). + DB 15 ; 7 ; BLM - block mask (Set to 7 for a 240K RomRFS Image). DB 0 ; EXM - Extent mask - DW 240 ; DSM - Storage size (blocks - 1) - DW 31 ; DRM - Number of directory entries - 1 + DW 159 ; 240 ; DSM - Storage size (blocks - 1) (Set to 240 for a 240K RomRFS Image). + DW 63 ; 31 ; DRM - Number of directory entries - 1 DB 128 ; AL0 - 1 bit set per directory block DB 0 ; AL1 - " - DW 8 ; CKS - DIR check vector size (DRM+1)/4 (0=fixed disk) + DW 16 ; CKS - DIR check vector size (DRM+1)/4 (0=fixed disk) DW 0 ; OFF - Reserved tracks DB 16 ; CFG - MZ80A Addition, configuration flag: ; Bit 1:0 = FDC: Sector Size, 00 = 128, 10 = 256, 11 = 512, 01 = Unused. @@ -2628,14 +2696,14 @@ DPB1: DW 128 ; SPT - ; Rom Filing System File Image acting as a drive. ; There are two definitions, 1 for each ROM drive, they can be identical but the CFG bit 5 will differ. DPB2: DW 128 ; SPT - 128 bytes sectors per track - DB 3 ; BSH - block shift factor - DB 7 ; BLM - block mask + DB 4 ; 3 ; BSH - block shift factor (Set to 3 for a 240K RomRFS Image). + DB 15 ; 7 ; BLM - block mask (Set to 7 for a 240K RomRFS Image). DB 0 ; EXM - Extent mask - DW 240 ; DSM - Storage size (blocks - 1) - DW 31 ; DRM - Number of directory entries - 1 + DW 159 ; 240 ; DSM - Storage size (blocks - 1) (Set to 240 for a 240K RomRFS Image). + DW 63 ; 31 ; DRM - Number of directory entries - 1 DB 128 ; AL0 - 1 bit set per directory block DB 0 ; AL1 - " - DW 8 ; CKS - DIR check vector size (DRM+1)/4 (0=fixed disk) + DW 16 ; CKS - DIR check vector size (DRM+1)/4 (0=fixed disk) DW 0 ; OFF - Reserved tracks DB 48 ; CFG - MZ80A Addition, configuration flag: ; Bit 1:0 = FDC: Sector Size, 00 = 128, 10 = 256, 11 = 512, 01 = Unused. diff --git a/software/asm/cbios_bank1.asm b/software/asm/cbios_bank1.asm index bcadce4..ac53b3d 100644 --- a/software/asm/cbios_bank1.asm +++ b/software/asm/cbios_bank1.asm @@ -326,9 +326,8 @@ OPTBL: DB 001H ; ; BC:DE:HL contains the time in milliseconds (100msec resolution) since 01/01/1980. In IX is held the interrupt service handler routine address for the RTC. ; HL contains lower 16 bits, DE contains middle 16 bits, BC contains upper 16bits, allows for a time from 00:00:00 to 23:59:59, for > 500000 days! -?TIMESET: DI - ; - LD (TIMESEC),HL ; Load lower 16 bits. + ; NB. Caller must disable interrupts before calling this method. +?TIMESET: LD (TIMESEC),HL ; Load lower 16 bits. EX DE,HL LD (TIMESEC+2),HL ; Load middle 16 bits. PUSH BC @@ -352,7 +351,6 @@ OPTBL: DB 001H LD A, 0C3H ; Install the interrupt vector for when interrupts are enabled. LD (00038H),A LD (00039H),IX - ;EI RET ; Time Read; @@ -375,9 +373,9 @@ OPTBL: DB 001H ?MODE: LD HL,KEYPF LD (HL),08AH - LD (HL),007H - LD (HL),005H - LD (HL),001H + LD (HL),007H ; Set Motor to Off. + LD (HL),004H ; Disable interrupts by setting INTMSK to 0. + LD (HL),001H ; Set VGATE to 1. RET ; Method to check if a key has been pressed and stored in buffer.. diff --git a/software/asm/include/CPM_Definitions.asm b/software/asm/include/CPM_Definitions.asm index 89e90f6..8a1989f 100644 --- a/software/asm/include/CPM_Definitions.asm +++ b/software/asm/include/CPM_Definitions.asm @@ -108,13 +108,14 @@ ROW: EQU 25 ; Numbe SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area. SCRLW: EQU COLW / 8 ; Number of 8 byte regions in a line for hardware scroll. MODE80C: EQU 1 +ROMDRVSIZE: EQU 320 ; Size in K of the Rom RFS Drive, currently 240 or 320 are coded. Please set value in make_cpmdisks.sh when changing this parameter. ; BIOS equates MAXDISKS EQU 7 ; Max number of Drives supported KEYBUFSIZE EQU 16 ; Ensure this is a power of 2, max size 256. ; Debugging -ENADEBUG EQU 1 ; Enable debugging logic, 1 = enable, 0 = disable +ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable ;------------------------------------------------------- ; Function entry points in the CBIOS ROMS @@ -207,7 +208,7 @@ BK2A20 EQU 128 ; User ; 1 0 = Flasm RAM 2 or Static RAM 0. ; 1 1 = Reserved. -BNKCTRLDEF EQU CDLTCH2+CDLTCH1+BBMOSI+SDCS+BBCLK ; Default on startup for the Bank Control register. +BNKCTRLDEF EQU BBMOSI+SDCS+BBCLK ; Default on startup for the Bank Control register. ;----------------------------------------------- ; IO ports in hardware and values. @@ -427,6 +428,7 @@ KEYLAST: DS virtual 1 ; KEY L KEYRPT: DS virtual 1 ; KEY REPEAT COUNTER USRBANKSAV: DS virtual 1 ; Save user bank number when calling another user bank. HLSAVE: DS virtual 2 ; Space to save HL register when manipulating stack. +ROMCTL DS virtual 1 ; Rom Paging control register contents. ; SPV: IBUFE: ; TAPE BUFFER (128 BYTES) @@ -475,7 +477,6 @@ TRK0FD2 DS virtual 1 ; FD 2 TRK0FD3 DS virtual 1 ; FD 3 IS AT TRACK 0 = BIT 0 set TRK0FD4 DS virtual 1 ; FD 4 IS AT TRACK 0 = BIT 0 set RETRIES DS virtual 2 ; DATA READ RETRIES -ROMCTL DS virtual 1 ; Rom Paging control register contents. TMPADR DS virtual 2 ; TEMPORARY ADDRESS STORAGE TMPSIZE DS virtual 2 ; TEMPORARY SIZE TMPCNT DS virtual 2 ; TEMPORARY COUNTER @@ -546,10 +547,15 @@ COLOUR EQU 0 SPSAVE: DS virtual 2 ; CPM Stack save. SPISRSAVE: DS virtual 2 -VAREND EQU $ ; End of variables ; Stack space for the CBIOS. MSGSTRBUF: DS virtual 128 ; Lower end of the stack space is for interbank message printing, ie.space for a string to print. BIOSSTACK EQU $ ; Stack space for the Interrupt Service Routine. DS virtual 16 ; Max 8 stack pushes. ISRSTACK EQU $ + +DBGSTACKP: DS virtual 2 + DS virtual 64 +DBGSTACK: EQU $ + +VAREND EQU $ ; End of variables diff --git a/software/asm/rfs.asm b/software/asm/rfs.asm index 2e6c1f2..6103bed 100644 --- a/software/asm/rfs.asm +++ b/software/asm/rfs.asm @@ -759,7 +759,8 @@ LOADROM1: DI CALL MFINDMZF ; Try and find the file in User ROM via MROM utility. JR NZ, LROMNTFND ; - PUSH BC + PUSH BC ; Preserve bank and block where MZF file found. + PUSH AF LD A,(ROMBK1) ; Page in monitor so we can print a message. LD (BNKSELMROM),A LD DE,MSGLOAD+1 ; Skip initial CR. @@ -768,8 +769,8 @@ LOADROM1: DI CALL BKSW0to6 LD A,(WRKROMBK1) ; Revert to MROM bank to load the application. LD (BNKSELMROM),A + POP AF POP BC - ; CALL MROMLOAD ; Load the file from User ROM via MROM utility. JP Z, LROMLOAD5 diff --git a/software/asm/rfs_mrom.asm b/software/asm/rfs_mrom.asm index 748ecf5..7285a3c 100644 --- a/software/asm/rfs_mrom.asm +++ b/software/asm/rfs_mrom.asm @@ -277,6 +277,7 @@ INITBNK_1: LD A,(BNKCTRLRST) SELUSRBNK: PUSH BC PUSH AF LD A,(ROMCTL) ; Get current setting for the coded latch, ie. number of reads needed to enable it. + LD C,A RRA RRA CPL @@ -286,11 +287,16 @@ SELUSRBNK: PUSH BC SELUSRBNK1:LD A,(BNKSELUSER) DJNZ SELUSRBNK1 POP AF - POP BC LD (BNKSELUSER),A ; Select the required bank. - JR C,SELUSRBNK2 ; If Carry is set by caller then leave the control registers active. + LD A,C + POP BC + JR NC,SELUSRBNK2 ; If Carry is set by caller then leave the control registers active. + AND 03FH ; When we leave the registers active, set upper bank bits to 0 to select Flash RAM I, the default. + LD (BNKCTRL),A + RET +SELUSRBNK2:LD (BNKCTRL),A ; Update the upper address lines according to in-memory value. LD (BNKCTRLDIS),A ; Disable the control registers, value of A is not important. -SELUSRBNK2:RET + RET ; HL contains address of block to check. @@ -339,6 +345,10 @@ _DIRMROM: PUSH BC ; D = File sequence number. ; LD B,USRROMPAGES ; First 16x2K pages are reserved in User bank. + LD A,(ROMCTL) + AND 03FH ; Mask out the upper bank address lines so we start with Flash RAM I. + ; +DIRNXTDVC: LD (ROMCTL),A LD C,0 ; Block in page. DIRNXTPG: LD A,B LD (WRKROMBK2), A @@ -373,6 +383,12 @@ DIRNOTMZF: INC C DIRNXTPG2: LD A,B CP 000h ; User rom has 256 banks of 2K, so stop when we wrap round to 0. JR NZ, DIRNXTPG + LD A,(ROMCTL) + ADD A, 64 + CP 0C0H ; If both upper address bits are set then we have come to the end. + JR C,DIRNXTDVC + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. LD A,(ROMBK2) SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK @@ -382,6 +398,7 @@ DIRNXTPG2: LD A,B ; Wrapper to call the User ROM function to display the MZF filename. + ; This function needs to manipulate the banks such that the calling bank is accessible. _PRTMZF: LD A,(ROMBK2) SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK @@ -414,10 +431,19 @@ _MFINDMZF: PUSH DE ; C = Block in page ; D = File sequence number. ; + ; Output: B = Bank where file found + ; C = Block within bank where page found. + ; A[7:6] = Upper bits of bank where page found. + ; FINDMZF0: POP DE ; Get file sequence number in D. LD B,USRROMPAGES ; First 8 pages are reserved in User ROM bank. - LD C,0 ; Block in page. ;LD D,0 ; File numbering start. + LD A,(ROMCTL) + AND 03FH ; Mask out the upper bank address lines so we start with Flash RAM I. + ; +FINDNXTDVC:LD (ROMCTL),A + LD C,0 ; Block in page. + ; FINDMZF1: LD A,B LD (WRKROMBK2), A OR A ; Select the required user bank and Clear carry so that the control registers are disabled. @@ -471,9 +497,16 @@ FINDMZF4: INC C FINDMZF5: LD A,B CP 000h ; User ROM has 256 banks of 2K, so stop when we wrap around to zero. JR NZ, FINDMZF1 + ; + LD A,(ROMCTL) + ADD A, 64 + CP 0C0H ; If both upper address bits are set then we have come to the end. + JR C,FINDNXTDVC + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. + ; INC B JR FINDMZFNO - FINDMZFYES: ; Flag set by previous test. FINDMZFNO: PUSH AF LD A,(ROMBK2) @@ -482,14 +515,27 @@ FINDMZFNO: PUSH AF POP AF RET + LD A,(ROMCTL) + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. ; Load Program from ROM - ; IN BC Bank and Block to of MZF file. - ; OUT zero Set if file loaded, reset if an error occurred. + ; Input: B = Bank of MZF File to load + ; C = Block within bank of start of MZF file. + ; A[7:6] = Upper bits of bank containing MZF File to load. + ; Output:Zero = Set if file loaded, reset if an error occurred. ; - ; Load program from RFS Bank 1 (MROM Bank) + ; Load program from User ROM Banks I, II or III ; _MROMLOAD: PUSH BC + ; + AND 0C0H ; Ensure only top two bits are used. + LD D,A + LD A,(ROMCTL) + AND 03FH ; Mask out the upper bank address lines so we can OR in the value given. + OR D + LD (ROMCTL),A + ; LD A,B LD (WRKROMBK2),A OR A ; Select the required user bank and Clear carry so that the control registers are disabled. @@ -577,6 +623,9 @@ LROMLOAD7: LD A, B ; LROMLOAD8: POP BC LROMLOAD5: PUSH AF + LD A,(ROMCTL) + AND 03FH + LD (ROMCTL),A ; Switch back to primary Flash RAM I device. LD A,(ROMBK2) SCF ; Select the required user bank and Set carry so that the control registers remain enabled. CALL SELUSRBNK diff --git a/software/config/diskdefs b/software/config/diskdefs index 87cb4b3..3af24bb 100644 --- a/software/config/diskdefs +++ b/software/config/diskdefs @@ -1,4 +1,3 @@ - # 320K Disk for the MZ80A - Same format as the MZ800 # but implements a cylinder in uniform manner (ie. 1 cyl # = 1 track x 2(heads) where as the MZ800 implements as @@ -50,6 +49,30 @@ diskdef MZ80A-RFS os 2.2 end +# A 320K Rom Filing System ROM Drive image. +diskdef MZ80A-RFS-320 + seclen 128 + tracks 20 + sectrk 128 + blocksize 2048 + maxdir 32 + skew 0 + boottrk 0 + os 2.2 +end + +# A 16Mb fixed disk SD Card Image. +diskdef MZ80A-SDC16M + seclen 512 + tracks 1024 + sectrk 32 + blocksize 8192 + maxdir 512 + skew 0 + boottrk 0 + os 2.2 +end + # Definition for the MZ800 CP/M Boot Disk. The reserved # track is in inverted data format but this is skipped in # CPM Tools. @@ -75,3 +98,1526 @@ diskdef MZ800-DATA boottrk 0 os 2.2 end + +diskdef hd0 + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 1 + os 2.2 +end + +diskdef multcomphd0 + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 1 + os 2.2 +end + +diskdef multcomphd1 + seclen 512 + tracks 1024 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 512 + os 2.2 +end + +diskdef multcomphd2 + seclen 512 + tracks 1536 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 1024 + os 2.2 +end + +diskdef multcomphd3 + seclen 512 + tracks 2048 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 1536 + os 2.2 +end + +diskdef multcomphd4 + seclen 512 + tracks 2560 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2048 + os 2.2 +end + +# Z20-MBC DISK 0 (TWO RESERVED TRACK FOR CP/M) +diskdef z80mbc-d0 + seclen 128 + tracks 32 + sectrk 32 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 2 + os 2.2 +end + +# Z20-MBC DISK 1 +diskdef z80mbc-d1 + seclen 128 + tracks 32 + sectrk 32 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 0 + os 2.2 +end + +# Z20-MBC2 CP/M 2.2 DISK 0 ONLY (ONE RESERVED TRACK FOR CP/M 2.2) +diskdef z80mbc2-d0 + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 1 + os 2.2 +end + +# Z20-MBC2 CP/M 2.2 DISK 1-15 +diskdef z80mbc2-d1 + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 0 + os 2.2 +end + +# Z20-MBC2 CP/M 3 (DISK 0-15) +diskdef z80mbc2-cpm3 + seclen 512 + tracks 512 + sectrk 32 + blocksize 4096 + maxdir 512 + skew 0 + boottrk 1 + os 3 +end + +diskdef ibm-3740 + seclen 128 + tracks 77 + sectrk 26 + blocksize 1024 + maxdir 64 + skew 6 + boottrk 2 + os 2.2 +end + +diskdef 4mb-hd + seclen 128 + tracks 1024 + sectrk 32 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 0 + os p2dos +end + +diskdef pcw + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 1 + os 3 + libdsk:format pcw180 +end + +diskdef pc1.2m + seclen 512 + tracks 80 + # this format uses 15 sectors per track, but 30 per cylinder + sectrk 30 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 0 + os 3 +end + +# CP/M 86 on 1.44MB floppies +diskdef cpm86-144feat + seclen 512 + tracks 160 + sectrk 18 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 3 + libdsk:format ibm1440 +end + +# CP/M 86 on 720KB floppies +diskdef cpm86-720 + seclen 512 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 2 + os 3 +end + +diskdef cf2dd + seclen 512 + tracks 160 + sectrk 9 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 1 + os 3 + libdsk:format pcw720 +end + +#amstrad: values are read from super block (special name hardcoded) + +# Royal alphatronic +# setfdprm /dev/fd1 dd ssize=256 cyl=40 sect=16 head=2 +diskdef alpha + seclen 256 + tracks 40 + sectrk 32 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Apple II CP/M skew o Apple II DOS 3.3 skew +diskdef apple-do + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skewtab 0,6,12,3,9,15,14,5,11,2,8,7,13,4,10,1 + boottrk 3 + os 2.2 +end + +# Apple II CP/M skew o Apple II PRODOS skew +diskdef apple-po + seclen 256 + tracks 35 + sectrk 16 + blocksize 1024 + maxdir 64 + skewtab 0,9,3,12,6,15,1,10,4,13,7,8,2,11,5,14 + boottrk 3 + os 2.2 +end + +# MYZ80 hard drive (only works with libdsk, because it has a 256-byte header) +diskdef myz80 + seclen 1024 + tracks 64 + sectrk 128 + blocksize 4096 + maxdir 1024 + skew 1 + boottrk 0 + os 3 + libdsk:format pcw720 +end + +# Despite being Amstrad formats, CPC System and CPC Data don't have an Amstrad +# superblock. You'll need to use libdsk to access them because the Linux +# and Windows kernel drivers won't touch them. +diskdef cpcsys + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 2 + os 3 + libdsk:format cpcsys +end +diskdef cpcdata + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 0 + os 3 + libdsk:format cpcdata +end + +# after being read in with no sector skew. +diskdef nigdos + seclen 512 + # NigDos double sided disk format, 42 tracks * 2 sides + tracks 84 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 0 + # this format wastes half of the directory entry + logicalextents 1 + os 3 +end + +diskdef epsqx10 + seclen 512 + tracks 40 + sectrk 20 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef ibm-8ss + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +diskdef ibm-8ds + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +diskdef electroglas + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 1 + os 3 +end + +# IBM CP/M-86 +# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 head=1 +diskdef ibmpc-514ss + seclen 512 + tracks 40 + sectrk 8 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 1 + os 2.2 + libdsk:format ibm160 +end + +# IBM CP/M-86 +# setfdprm /dev/fd1 sect=8 dtr=1 hd ssize=512 tpi=48 +diskdef ibmpc-514ds + seclen 512 + tracks 80 + sectrk 8 + blocksize 2048 + maxdir 64 + skew 0 + boottrk 2 + os 2.2 + libdsk:format ibm320 +end + +diskdef p112 + seclen 512 + tracks 160 + sectrk 18 + blocksize 2048 + maxdir 256 + skew 1 + boottrk 2 + os 3 +end + +diskdef p112-old + seclen 512 + tracks 160 + sectrk 18 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 1 + os 3 +end + +diskdef gide-cfa + seclen 512 + tracks 1000 + sectrk 16 + blocksize 4096 + maxdir 1024 + skew 0 + boottrk 2 + os 3 +end + +diskdef gide-cfb + seclen 512 + tracks 1000 + sectrk 16 + blocksize 4096 + maxdir 1024 + skew 0 + boottrk 0 +# Start of second partition + offset 1000trk + os 3 +end + +# AT&T/Olivetti Word Processor +diskdef attwp + seclen 256 + tracks 80 + sectrk 32 + blocksize 2048 + maxdir 128 + boottrk 1 + logicalextents 1 + skewtab 0,2,4,6,8,10,12,14,1,3,5,7,9,11,13,15,16,18,20,22,24,26,28,30,17,19,21,23,25,27,29,31 + os 2.2 +end + +# setfdprm /dev/fd0 zerobased SS DD ssize=512 cyl=40 sect=10 head=1 +# Kaypro II +diskdef kpii + seclen 512 + tracks 40 + sectrk 10 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +# setfdprm /dev/fd0 zerobased DS DD ssize=512 cyl=40 sect=10 head=2 +# Kayro IV +diskdef kpiv + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 64 + skew 0 + boottrk 1 + os 2.2 +end + +# setfdprm /dev/fd0 dd sect=10 +diskdef interak + seclen 512 + tracks 80 + sectrk 20 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 2.2 +end + +# Timex FDD3000 3" +diskdef fdd3000 + seclen 256 + tracks 40 + sectrk 16 + blocksize 1024 + maxdir 128 + boottrk 4 + os 2.2 + skew 7 +end + +# Timex FDD3000 3" +diskdef fdd3000_2 + seclen 256 + tracks 40 + sectrk 16 + blocksize 1024 + maxdir 128 + boottrk 2 + os 2.2 + skew 5 +end + +# Robotron 1715 +diskdef 1715 + seclen 1024 + tracks 40 + sectrk 5 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 3 + os 2.2 +end + +# Robotron 1715 with SCP3 +diskdef 17153 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 4 + os 3 +end + +#DDR +diskdef scp624 + seclen 256 + tracks 160 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef scp640 + seclen 256 + tracks 160 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 0 + os 2.2 +end + +diskdef scp780 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef scp800 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 0 + os 2.2 +end + +diskdef z9001 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 192 + skew 0 + boottrk 0 + os 2.2 +end + +# Visual Technology Visual 1050 computer +diskdef v1050 + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 3 +end + +# Microbee 40 track 5.25" disks +diskdef microbee40 + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skewtab 1,4,7,0,3,6,9,2,5,8 + boottrk 2 + os 2.2 +end + +diskdef dreamdisk40 + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skewtab 1,4,7,0,3,6,9,2,5,8 + boottrk 2 + os 2.2 +end + +diskdef dreamdisk80 + seclen 512 + tracks 160 + sectrk 10 + blocksize 2048 + maxdir 256 + skewtab 1,4,7,0,3,6,9,2,5,8 + boottrk 2 + os 2.2 +end + +diskdef rc759 + seclen 1024 + tracks 154 + sectrk 8 + blocksize 2048 + maxdir 512 + boottrk 4 + os 3 +end + +# ICL Comet: 40 track 5.25" Single Sided +# +diskdef icl-comet-525ss + seclen 512 + tracks 40 + sectrk 10 + blocksize 1024 + maxdir 64 + skewtab 0,3,6,9,2,5,8,1,4,7 + boottrk 2 + os 2.2 +end + +diskdef z80pack-hd + seclen 128 + tracks 255 + sectrk 128 + blocksize 2048 + maxdir 1024 + skew 0 + boottrk 0 + os 2.2 +end + +diskdef z80pack-hdb + seclen 128 + tracks 256 + sectrk 16384 + blocksize 16384 + maxdir 8192 + skew 0 + boottrk 0 + os 2.2 +end + +# Bondwell 12 and 14 disk images in IMD raw binary format +diskdef bw12 + seclen 256 + tracks 40 + sectrk 18 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +diskdef bw14 + seclen 256 + tracks 80 + sectrk 18 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +############################ +# north star cp/m disks +############################ + +#North Star floppy 360K + +diskdef nsfd + seclen 512 + tracks 70 + sectrk 10 + blocksize 2048 + maxdir 64 + skew 5 + boottrk 2 + os 2.2 +end + + +#North Star CP/M Virtual-Disk file on Hard Disk +# prepared with allocation factor = 4 +# as in "CR CPMB 4000 4" +# needs to be copied off hard drive before you can +# work on it with cpmtools + +diskdef nshd4 + seclen 512 + tracks 512 + sectrk 16 + blocksize 4096 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + + +#North Star CP/M Virtual-Disk file on Hard Disk +# prepared with allocation factor = 8 +# as in "CR CPMB 6000 8" +# needs to be copied off hard drive before you can +# work on it with cpmtools + +diskdef nshd8 + seclen 512 + tracks 1024 + sectrk 16 + blocksize 8192 + maxdir 256 + skew 0 + boottrk 0 + os 2.2 +end + +# Northstar Micro-Disk System MDS-A-D 175 +diskdef mdsad175 + seclen 512 + blocksize 1024 + tracks 35 + maxdir 64 + boottrk 2 + sectrk 10 + skew 5 + os 2.2 +end + + +# Northstar Micro-Disk System MDS-A-D 350 +diskdef mdsad350 + seclen 512 + blocksize 2048 + tracks 70 + maxdir 64 + boottrk 2 + sectrk 10 + skew 5 + os 2.2 +end + + +# Osborne 1 +diskdef osborne1 + seclen 1024 + tracks 40 + sectrk 5 + blocksize 1024 + maxdir 64 + boottrk 3 + os 2.2 +end + +# Osborne Nuevo/Vixen/4 +diskdef osborne4 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 2 + boottrk 2 + os 2.2 +end + +# Lobo Max-80 8" CP/M 2 +diskdef lobo2 + seclen 256 + tracks 77 + sectrk 30 + blocksize 2048 + maxdir 64 + skew 0 + boottrk 2 + os 2.2 +end + +#Lobo Max-80 8" CP/M 3 +diskdef lobo3 + seclen 512 + tracks 77 + sectrk 17 + blocksize 2048 + maxdir 64 + skew 0 + boottrk 2 + os 3 +end + +# PRO CP/M RZ50 DZ format (Perhaps only 79 tracks should be used?) +diskdef dec_pro + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 2 + boottrk 2 + os 2.2 +end + +# TDOS with DateStamper +diskdef tdos-ds + seclen 1024 + tracks 77 + sectrk 16 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 1 + os zsys +end + +# The following entires are tested and working +# Most of the images are either from Don Maslin's archive or from +# Dave Dunfield's site, but not all - they are noted as well as +# their size. + +# PMC Micromate +# Dave Dunfield's Imagedisk information from DSK conversion from IMD: +# IMageDisk Utility 1.18 / Mar 07 2012 +# IMD 1.14: 10/03/2007 11:13:27 +# PMC-101 MicroMate +# CP/M Plus +# System Master +# Assuming 1:1 for Binary output +# 0/0 250 kbps DD 5x1024 +# 80 tracks(40/40), 400 sectors (12 Compressed) +# Entry derived from above - image size = 409,600, from Dave Dunfield +diskdef pmc101 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 3 +end + +# BEGIN td143ssdd8 Turbo Dos 1.43 - SSDD 8" - 512 x 16 +# Test OK - image size = 630,784, from Don Maslin's archive +diskdef td143ssdd8 + seclen 512 + tracks 77 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 0 + boottrk 0 + os 2.2 +# DENSITY MFM ,LOW +end + +# BEGIN headsdd8 Heath H89, Magnolia CP/M - SSDD 8" - 512 x 16 +# Test OK - image size = 630,784, from Don Maslin's archive +diskdef heassdd8 + seclen 512 + tracks 77 + sectrk 16 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +# DENSITY MFM ,LOW +end + +# Morrow Designs Micro-Decision DOUBLE +# 64k CP/M Vers. 2.2 Rev.2.3 SIDED +# Copyright '76, '77, '78, '79, '80 +# Digital Research +# Copyright 1982,1983 Morrow Designs, Inc. +# Assuming 1:1 for Binary output +# 0/0 250 kbps DD 5x1024 +# 80 tracks(40/40), 400 sectors (128 Compressed) +# Entry derived from above data +# Test OK - image siae = 409600, from Dave Dunfield +diskdef mordsdd + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 3 + boottrk 2 + OS 2.2 +end + + +# BEGIN morsddd Morrow MD2 - SSDD 48 tpi 5.25" - 1024 x 5 +# Test OK - image size = 204,800, from Don Maslin's archive +# Also tested with image from Dave Dunfield +diskdef morsddd + seclen 1024 + tracks 40 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 3 + boottrk 2 + os 2.2 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 94 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN osb1sssd Osborne 1 - SSSD 48 tpi 5.25" - 256 x 10 +# Test OK - image size = 102,400, from Don Maslin's archive +diskdef osb1sssd + seclen 256 + tracks 40 + sectrk 10 + blocksize 2048 + maxdir 64 + skew 2 + boottrk 3 + os 2.2 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 45 DRM 63 AL0 080H AL1 0 OFS 3 +end + +# BEGIN ampdsdd Ampro - DSDD 48 tpi 5.25" - 512 x 10 +# Test OK - image size = 409,600, from Don Maslin's archive +diskdef ampdsdd + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 + libdsk:format ampro400d +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN ampdsdd80 Ampro - DSDD 96 tpi 5.25" - 512 x 10 +# Test OK - image size = 819,200, from Don Maslin's archive +diskdef ampdsdd80 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 + libdsk:format ampro800 +# DENSITY MFM ,LOW +# BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN altdsdd Altos - DSDD 5" - 512 x 9 +# Test OK - both CP/M and MP/M - image size = 737,280, from Dave Dunfield +diskdef altdsdd + seclen 512 + tracks 160 + sectrk 9 + blocksize 4096 + maxdir 177 + skew 0 + boottrk 2 + os 3 +# DENSITY MFM ,HIGH +# BSH 5 BLM 31 EXM 3 DSM 176 DRM 176 AL0 0C0H AL1 0 OFS 2 +end + +# BEGIN trsomsssd TRS-80 Model 1, Omikron CP/M - SSSD 48 tpi 5.25" - 128 x 18 +# Test OK - image size = 80,640, from TRS-80 Yahoo Group posting +diskdef trsomsssd + seclen 128 + tracks 35 + sectrk 18 + blocksize 1024 + maxdir 64 + skew 4 + boottrk 3 + os 2.2 +# DENSITY FM ,LOW +# BSH 3 BLM 7 EXM 0 DSM 71 DRM 63 AL0 0C0H AL1 0 OFS 3 +end + +# Memotech type 03, ie: 3.5" or 5.25", D/S, D/D, S/T +# 40 tracks, 2 sides, 16 sectors/track, 256 bytes/sector +# Bytes on the media = 2*40*16*256 = 327680 +# CP/M sees 26 128 byte records per track (similar to 8" disks). +# Tracks = 327680/(26*128) = 98 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = ((98-2)*26*128)/2048 = 156, which agrees with DPB + +diskdef memotech-type03 + seclen 128 + tracks 98 + sectrk 26 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 07, ie: 3.5" or 5.25", D/S, D/D, D/T +# 80 tracks, 2 sides, 16 sectors/track, 256 bytes/sector +# Bytes on the media = 2*80*16*256 = 655360 +# CP/M sees 26 128 byte records per track (similar to 8" disks). +# Tracks = 655360/(26*128) = 196 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = ((196-2)*26*128)/2048 = 315, which agrees with DPB + +diskdef memotech-type07 + seclen 128 + tracks 196 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 43, ie: 1MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 1048576/(26*128) = 315.07 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (1048576-2*26*128)/4096 = 254, which agrees with DPB +# Blocks = ((315-2)*26*128)/4096 = 254, so we don't need the 0.07 track +diskdef memotech-type43 + seclen 128 + tracks 315 + sectrk 26 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 47, ie: 2MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 2097152/(26*128) = 630.15 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (2097152-2*26*128)/4096 = 510, which agrees with DPB +# Blocks = ((630-2)*26*128)/4096 = 510, so we don't need the 0.15 track +diskdef memotech-type47 + seclen 128 + tracks 630 + sectrk 26 + blocksize 4096 + maxdir 256 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 4B, ie: 4MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 4194304/(26*128) = 1260.3 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (4194304-2*26*128)/4096 = 1022, which agrees with DPB +# Blocks = ((1260-2)*26*128)/4096 = 1022, so we don't need the 0.3 track +diskdef memotech-type4B + seclen 128 + tracks 1260 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 4F, ie: 8MB Silicon Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for Silicon Discs includes blocks on the last incomplete track +# Tracks = 8388608/(26*128) = 2520.61 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (8388608-2*26*128)/4096 = 2046, which agrees with DPB +# Blocks = ((2520-2)*26*128)/4096 = 2045, so we need the extra 0.61 track +diskdef memotech-type4F + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 18, ie: 8MB SD Card +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for SD Cards includes blocks on the last incomplete track +# Tracks = 8388608/(26*128) = 2520.61 +# Data is in 4096 byte blocks, on track 2 onwards +# Blocks = (8388608-2*26*128)/4096 = 2046, which agrees with DPB +# Blocks = ((2520-2)*26*128)/4096 = 2045, so we need the extra 0.61 track +diskdef memotech-type18 + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 19, ie: 8MB SD Card +diskdef memotech-type19 + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 8M +end + +# Memotech type 1A, ie: 8MB SD Card +diskdef memotech-type1A + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 16M +end + +# Memotech type 1B, ie: 8MB SD Card +diskdef memotech-type1B + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 24M +end + +# Memotech type 1C, ie: 8MB SD Card +diskdef memotech-type1C + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 32M +end + +# Memotech type 1D, ie: 8MB SD Card +diskdef memotech-type1D + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 40M +end + +# Memotech type 1E, ie: 8MB SD Card +diskdef memotech-type1E + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 48M +end + +# Memotech type 1F, ie: 8MB SD Card +diskdef memotech-type1F + seclen 128 + tracks 2521 + sectrk 26 + blocksize 4096 + maxdir 512 + skew 1 + boottrk 2 + os 2.2 + offset 56M +end + +# Memotech type 50, ie: 256KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 262144/(26*128) = 78.76 +# Data is in 1024 byte blocks, on track 2 onwards +# Blocks = (262144-2*26*128)/1024 = 249, which agrees with DPB +# Blocks = ((78-2)*26*128)/1024 = 247, so we need the extra 0.76 track +diskdef memotech-type50 + seclen 128 + tracks 79 + sectrk 26 + blocksize 1024 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, ie: 512KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 524288/(26*128) = 157.53 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (524288-2*26*128)/2048 = 252, which agrees with DPB +# Blocks = ((157-2)*26*128)/2048 = 251, so we need the extra 0.53 track +diskdef memotech-type51 + seclen 128 + tracks 158 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, as used in Italy, ie: 480KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 491520/(26*128) = 147.69 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (491520-2*26*128)/2048 = 236, which agrees with DPB +# Blocks = ((147-2)*26*128)/2048 = 235, so we need the extra 0.69 track +diskdef memotech-type51-italy + seclen 128 + tracks 148 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, after S2R64.COM, ie: 448KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 458752/(26*128) = 137.84 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (458752-2*26*128)/2048 = 220, which agrees with DPB, after S2R64.COM +# Blocks = ((137-2)*26*128)/2048 = 219, so we need the extra 0.84 track +diskdef memotech-type51-s2r64 + seclen 128 + tracks 138 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 51, after S2R.COM, ie: 144KB RAM Disc +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 147456/(26*128) = 44.3 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (147456-2*26*128)/2048 = 68, which agrees with DPB, after S2R.COM +# Blocks = ((44-2)*26*128)/2048 = 68, so we don't need the extra 0.3 track +diskdef memotech-type51-s2r + seclen 128 + tracks 44 + sectrk 26 + blocksize 2048 + maxdir 128 + skew 1 + boottrk 2 + os 2.2 +end + +# Memotech type 52, ie: 320KB RAM Disc +# Added for REMEMOTECH +# CP/M sees 26 128 byte records per track +# Note: Unlike common practice with real physical disks, with real geometry, +# the DPB for RAM Discs includes blocks on the last incomplete track +# Tracks = 327680/(26*128) = 98.46 +# Data is in 2048 byte blocks, on track 2 onwards +# Blocks = (327680-2*26*128)/2048 = 156 +# Blocks = ((98-2)*26*128)/2048 = 156, so we don't need the extra 0.46 track +# This type very deliberately and conveniently exactly matches type 03 +diskdef memotech-type52 + seclen 128 + tracks 98 + sectrk 26 + blocksize 2048 + maxdir 64 + skew 1 + boottrk 2 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Single Density" or "MDS" format. +# All tracks are formatted FM 16x128. +diskdef rm-sd + seclen 128 + tracks 40 + sectrk 16 + blocksize 1024 + maxdir 64 + skew 3 + boottrk 3 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Double Density" or "MD" format. +# Track 0 is formatted FM 16x128; 1+ are MFM 9x512. +# If you're working with an image file, make sure that track 0 is +# padded to be the same size as the other tracks. +diskdef rm-dd + seclen 512 + tracks 40 + sectrk 9 + blocksize 1024 + maxdir 64 + skew 5 + boottrk 3 + os 2.2 +end + +# Research Machines 380Z/480Z 5.25" "Quad Density" or "MQ" format. +# Track 0 is formatted FM 16x128; 1+ are MFM 9x512. +diskdef rm-qd + seclen 512 + tracks 80 + sectrk 9 + blocksize 2048 + maxdir 128 + skew 5 + boottrk 3 + os 2.2 +end + +# Ampro Little Board Z80 running CP/M 2.21 +# BEGIN AMP1 Ampro - SSDD 48 tpi 5.25" +# DENSITY MFM, LOW +# CYLINDERS 40 SIDES 1 SECTORS 10,512 SKEW 2 +# SIDE1 0 1,2,3,4,5,6,7,8,9,10 +# BSH 4 BLM 15 EXM 1 DSM 94 DRM 63 AL0 080H AL1 0 OFS 2 +# END + +diskdef amp1 + seclen 512 #= Sectors xx,512 + tracks 40 #= (Cylinders * Sides) = 40*1 = 40 + sectrk 10 #= Sectors 10,xxx + blocksize 2048 #= (128*(BLM+1)) = 2048 + maxdir 64 #(DRM+1) = 64 + skew 0 #= SKEW = 0 + boottrk 2 #= OFS = 2 + os 2.2 +end + +#BEGIN AMP2 Ampro - DSDD 48 tpi 5.25" +#DENSITY MFM, LOW +#CYLINDERS 40 SIDES 2 +#SECTORS 10,512 +#SKEW 2 +#SIDE1 0 17,18,19,20,21,22,23,24,25,26 +#SIDE2 1 17,18,19,20,21,22,23,24,25,26 +#ORDER SIDES +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=512 cyl=40 sect=10 head=2 +diskdef amp2 + seclen 512 + tracks 80 + sectrk 10 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP3 Ampro - SSDD 96 tpi 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 1 SECTORS 5,1024 SKEW 2 +#SIDE1 0 1,2,3,4,5 +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 SS DD ssize=1024 cyl=80 sect=5 head=1 +diskdef amp3 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP4 Ampro - DSDD 96 tpi 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 2 SECTORS 5,1024 SKEW 2 +#SIDE1 0 17,18,19,20,21 +#SIDE2 1 17,18,19,20,21 +#ORDER SIDES +#BSH 4 BLM 15 EXM 0 DSM 394 DRM 255 AL0 0F0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=1024 cyl=80 sect=5 head=2 +diskdef amp4 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP5 Ampro - SSDD 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 1 SECTORS 5,1024 SKEW 2 +#SIDE1 0 1,2,3,4,5 +#BSH 4 BLM 15 EXM 1 DSM 194 DRM 127 AL0 0C0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 SS DD ssize=1024 cyl=80 sect=5 head=1 +diskdef amp5 + seclen 1024 + tracks 80 + sectrk 5 + blocksize 2048 + maxdir 128 + skew 0 + boottrk 2 + os 2.2 +end + +#BEGIN AMP6 Ampro - DSDD 3.5" +#DENSITY MFM, LOW +#CYLINDERS 80 SIDES 2 SECTORS 5,1024 SKEW 2 +#SIDE1 0 17,18,19,20,21 +#SIDE2 1 17,18,19,20,21 +#ORDER SIDES +#BSH 4 BLM 15 EXM 0 DSM 394 DRM 255 AL0 0F0H AL1 0 OFS 2 +#END + +# setfdprm /dev/fd0 DS DD ssize=1024 cyl=80 sect=5 head=2 +diskdef amp6 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end + +diskdef ampro800 + seclen 1024 + tracks 160 + sectrk 5 + blocksize 2048 + maxdir 256 + skew 0 + boottrk 2 + os 2.2 +end diff --git a/software/roms/MROM_256.bin b/software/roms/MROM_256.bin index b7ccdfa..2bb70cf 100644 Binary files a/software/roms/MROM_256.bin and b/software/roms/MROM_256.bin differ diff --git a/software/roms/USER_ROM_256.bin b/software/roms/USER_ROM_256.bin index a1add12..bc6310b 100644 Binary files a/software/roms/USER_ROM_256.bin and b/software/roms/USER_ROM_256.bin differ diff --git a/software/roms/cbios.rom b/software/roms/cbios.rom index a8b0153..cbf8b49 100644 Binary files a/software/roms/cbios.rom and b/software/roms/cbios.rom differ diff --git a/software/roms/cbios_bank1.rom b/software/roms/cbios_bank1.rom index 36910b8..72e181e 100644 Binary files a/software/roms/cbios_bank1.rom and b/software/roms/cbios_bank1.rom differ diff --git a/software/roms/cbios_bank2.rom b/software/roms/cbios_bank2.rom index b3033ef..f5690b9 100644 Binary files a/software/roms/cbios_bank2.rom and b/software/roms/cbios_bank2.rom differ diff --git a/software/roms/cbios_bank3.rom b/software/roms/cbios_bank3.rom index 66b7312..c929615 100644 Binary files a/software/roms/cbios_bank3.rom and b/software/roms/cbios_bank3.rom differ diff --git a/software/roms/cbios_bank4.rom b/software/roms/cbios_bank4.rom index 975e888..e8b1810 100644 Binary files a/software/roms/cbios_bank4.rom and b/software/roms/cbios_bank4.rom differ diff --git a/software/roms/rfs.rom b/software/roms/rfs.rom index ead2c34..5ae796a 100644 Binary files a/software/roms/rfs.rom and b/software/roms/rfs.rom differ diff --git a/software/roms/rfs_mrom.rom b/software/roms/rfs_mrom.rom index b3263d4..97b29b4 100644 Binary files a/software/roms/rfs_mrom.rom and b/software/roms/rfs_mrom.rom differ diff --git a/software/tools/make_cpmdisks.sh b/software/tools/make_cpmdisks.sh index 7478aa9..e705dd2 100755 --- a/software/tools/make_cpmdisks.sh +++ b/software/tools/make_cpmdisks.sh @@ -14,7 +14,8 @@ ## Credits: ## Copyright: (c) 2020 Philip Smart ## -## History: January 2020 - Initial script written. +## History: Jan 2020 - Initial script written. +## May 2020 - Updated to allow 240/320K Rom RFS images to be built ## ######################################################################################################### ## This source file is free software: you can redistribute it and#or modify @@ -53,7 +54,7 @@ FD1M44_SECTORS=36 FD1M44_GAP3=78 FD1M44_INTERLEAVE=4 ROMRFS_PATH=${CPM_PATH}/ROMRFS -ROMRFS_CYLS=15 +ROMRFS_CYLS=20 # Set to 15 for a 240K disk, 20 for a 320K disk ROMRFS_HEADS=1 ROMRFS_SECTORS=128 ROMRFS_GAP3=78 @@ -88,10 +89,22 @@ echo "Creating CPM Disks from all the directories in:$CPM_PATH} matching this fi echo "Building ROM Drive:${src}...Size:`du -sh --apparent-size ${src} | cut -f1`, Dir Entries:`ls -l ${src} | wc -l`" # Copy a blank image to create the new disk. - cp ${CPM_PATH}/BLANKFD/BLANK_240K.RAW ${ROMRFS_PATH}/RAW/${src}.RAW; - - # Copy the CPM files from the linux filesystem into the CPM Disk under the CPM filesystem. - cpmcp -f MZ80A-RFS ${ROMRFS_PATH}/RAW/${src}.RAW ${CPM_PATH}/${src}/*.* 0: + if [[ ${ROMRFS_CYLS} == 15 ]]; then + echo "Creating 240K ROM RFS Drive Image..." + cp ${CPM_PATH}/BLANKFD/BLANK_240K.RAW ${ROMRFS_PATH}/RAW/${src}.RAW; + + # Copy the CPM files from the linux filesystem into the CPM Disk under the CPM filesystem. + cpmcp -f MZ80A-RFS ${ROMRFS_PATH}/RAW/${src}.RAW ${CPM_PATH}/${src}/*.* 0: + elif [[ ${ROMRFS_CYLS} == 20 ]]; then + echo "Creating 320K ROM RFS Drive Image..." + cp ${CPM_PATH}/BLANKFD/BLANK_320K.RAW ${ROMRFS_PATH}/RAW/${src}.RAW; + + # Copy the CPM files from the linux filesystem into the CPM Disk under the CPM filesystem. + cpmcp -f MZ80A-RFS-320 ${ROMRFS_PATH}/RAW/${src}.RAW ${CPM_PATH}/${src}/*.* 0: + else + echo "ROMRFS config error, ROMRFS_CYLS should = 15 or 20" + exit 1 + fi fi else # Place size of disk in the name, useful when using the Floppy Emulator. diff --git a/software/tools/make_roms.sh b/software/tools/make_roms.sh index a550151..3e75e42 100755 --- a/software/tools/make_roms.sh +++ b/software/tools/make_roms.sh @@ -34,6 +34,7 @@ ROOTDIR=../../MZ80A_RFS MZB_PATH=${ROOTDIR}/software/MZB ROM_PATH=${ROOTDIR}/software/roms/ SECTORSIZE=256 +CPMDISKMODE=SPLIT # Place the RFS rom into the User ROM at the beginning as it contains all the banked pages. echo "cat ${ROM_PATH}/rfs.rom ${ROM_PATH}/cbios_bank1.rom ${ROM_PATH}/cbios_bank2.rom ${ROM_PATH}/cbios_bank3.rom ${ROM_PATH}/cbios_bank4.rom > /tmp/user.rom" @@ -41,14 +42,31 @@ cat ${ROM_PATH}/rfs.rom ${ROM_PATH}/cbios_bank1.rom ${ROM_PATH}/cbios_bank2.rom ${ROM_PATH}/cbios_bank3.rom ${ROM_PATH}/cbios_bank4.rom \ > /tmp/user.rom -# CPM RFS Disks currently only in User ROM. -for f in 1 2 -do - if [ -f ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin ]; then - echo "cat ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin >> /tmp/user.rom" - cat ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin >> /tmp/user.rom +# User ROM 2 = empty. +> /tmp/user2.rom + +# According to flag set above, either put the CPM Disks in the first ROM, or place one in each ROM allowing for better write spread and larger disks. +# +if [ "${CPMDISKMODE}" != "SPLIT" ]; then + # CPM RFS Disks currently only in User ROM. + for f in 1 2 + do + if [ -f ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin ]; then + echo "cat ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin >> /tmp/user.rom" + cat ${MZB_PATH}/CPM_RFS_${f}.${SECTORSIZE}.bin >> /tmp/user.rom + fi + done +else + if [ -f ${MZB_PATH}/CPM_RFS_1.${SECTORSIZE}.bin ]; then + echo "cat ${MZB_PATH}/CPM_RFS_1.${SECTORSIZE}.bin >> /tmp/user.rom" + cat ${MZB_PATH}/CPM_RFS_1.${SECTORSIZE}.bin >> /tmp/user.rom fi -done + + if [ -f ${MZB_PATH}/CPM_RFS_2.${SECTORSIZE}.bin ]; then + echo "cat ${MZB_PATH}/CPM_RFS_2.${SECTORSIZE}.bin >> /tmp/user2.rom" + cat ${MZB_PATH}/CPM_RFS_2.${SECTORSIZE}.bin >> /tmp/user2.rom + fi +fi # Place the monitor roms into the MROM at the beginning for banked page usage. echo "cat ${ROM_PATH}/monitor_SA1510.rom ${ROM_PATH}/monitor_80c_SA1510.rom ${ROM_PATH}/cbios.rom ${ROM_PATH}/rfs_mrom.rom ${ROM_PATH}/blank_mrom.rom ${ROM_PATH}/blank_mrom.rom ${ROM_PATH}/blank_mrom.rom ${ROM_PATH}/blank_mrom.rom > /tmp/mrom.rom" @@ -61,6 +79,9 @@ GENROM=0 # Manually choose the programs you want installed into the ROMS. The files will be first placed into the USER ROM and when full into the # Monitor ROM. Thus order is important if you want a particular program in a particular ROM. +# +# NB: A Double Hash (##) indicates a program found not to work on the Sharp MZ-80A. +# ROM_INCLUDE= ROM_INCLUDE+="${MZB_PATH}/cpm22.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/sdtest.${SECTORSIZE}.bin:" @@ -78,7 +99,7 @@ ROM_INCLUDE+="${MZB_PATH}/6502_Betriebssys.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/A-BASIC_SA-5510.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/AIP_-_LOGO_xrr.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/APOLLO CHESS v2a.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/APOLLO_CHESS_v2a.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/APOLLO_CHESS_v2a.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/B880.A3_P6.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/B880 MASTER.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/B880_MASTER.${SECTORSIZE}.bin:" @@ -126,7 +147,7 @@ ROM_INCLUDE+="${MZB_PATH}/CONVERTER_A_700.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/COPIER.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/COSMO_BLASTER_MZ700.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/DCS MZ80A APPEND.${SECTORSIZE}.bin:" -##ROM_INCLUDE+="${MZB_PATH}/DCS_MZ80A_APPEND.${SECTORSIZE}.bin:" +#ROM_INCLUDE+="${MZB_PATH}/DCS_MZ80A_APPEND.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/DCS MZ80A RENUM.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/DCS_MZ80A_RENUM.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/DELETE.${SECTORSIZE}.bin:" @@ -139,11 +160,11 @@ ROM_INCLUDE+="${MZB_PATH}/DISKEDIT.A4B.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/DISKEDIT.A7_40T.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/diskutility.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/EXPRESS BAS_700.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/EXPRESS_BAS_700.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/EXPRESS_BAS_700.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/EXPRESS COMPILER.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/EXPRESS_COMPILER.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/EXPRESS_COMPILER.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/EXPRESS PLUS.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/EXPRESS_PLUS.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/EXPRESS_PLUS.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/EXT.BASIC_OM-500.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/FDCOPY.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/FD_Editor_MZ700.${SECTORSIZE}.bin:" @@ -154,7 +175,7 @@ ROM_INCLUDE+="${MZB_PATH}/fortransosz80.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/GALAXI_FORM.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/GALAXY_INVADERS.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/GDP9-BA.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/Greedy_Gremlins.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/Greedy_Gremlins.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Hardcopy.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/HP4TMZ7.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/HP4TMZ7L.${SECTORSIZE}.bin:" @@ -175,17 +196,17 @@ ROM_INCLUDE+="${MZB_PATH}/HU-BASIC.A2_80M.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/KNIFORTH.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/KUMA_INTERPR..${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/KuPTest.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/LAND_ESCAPE.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/Le_Mans.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/LAND_ESCAPE.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/Le_Mans.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/loader.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/MAGIC_PAINTBOX.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/MAN-HUNT.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/MAGIC_PAINTBOX.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/MAN-HUNT.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/m_c_Breakout_2.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/m_c_Hissing_Sid.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/m_c_Race_Chase.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/MEMORY_TEST.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/MINI_DATACARD..${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/minotaur.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/MINI_DATACARD..${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/minotaur.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/ML-SP_8002_BBG.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/monitor3.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/MONITOR6.${SECTORSIZE}.bin:" @@ -199,7 +220,7 @@ ROM_INCLUDE+="${MZB_PATH}/MZ-80A_GALACTIC.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Mzprint.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/NEW_INVADERS.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/OPENING_DATA.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/OTHELLO.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/OTHELLO.${SECTORSIZE}.bin:" ROM_INCLUDE+="${MZB_PATH}/PAC-MAN.${SECTORSIZE}.bin:" ##ROM_INCLUDE+="${MZB_PATH}/PAC-MAN3.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/PAINFUL_MAN.${SECTORSIZE}.bin:" @@ -237,7 +258,7 @@ ROM_INCLUDE+="${MZB_PATH}/SARGON_2.71.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/SP-4015.A1_S.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/SP-5060.A1_M.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/SP-5060.A1_S.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/SPACE_INVADERS.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/SPACE_INVADERS.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/SP-CONVERT.A1.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/STKEEPER2BAS700A.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/SUB-MONITOR-700.${SECTORSIZE}.bin:" @@ -263,15 +284,15 @@ ROM_INCLUDE+="${MZB_PATH}/Utility_2.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Utility_V_1.1.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Utility_V_2.0.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/WDPRO_2.37AT.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/WDPRO_2.37AT_C2.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/Wooky.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/WDPRO_2.37AT_C2.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/Wooky.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/XPATCH_5510_v2.2.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Z80_MACHINE.A1_M.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Z80_MACHINE.A1_S.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Z80_MACHINE.A2_M.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Z80MACHINE.A3_C2.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Z80_MACHINE.A3_S.${SECTORSIZE}.bin:" -#ROM_INCLUDE+="${MZB_PATH}/ZEN7E.A2.${SECTORSIZE}.bin:" +ROM_INCLUDE+="${MZB_PATH}/ZEN7E.A2.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/Zexas_MZ800.${SECTORSIZE}.bin:" #ROM_INCLUDE+="${MZB_PATH}/ZSP.${SECTORSIZE}.bin:" @@ -282,7 +303,7 @@ do cat /tmp/user.rom "${f}" > /tmp/tmp.size FILESIZE=$(stat -c%s "/tmp/tmp.size") if (( ${FILESIZE} < 524288 )); then - echo "Adding $f to User Rom" + echo "Adding $f to User I Rom" cat "${f}" >> /tmp/user.rom else GENROM=1 @@ -301,6 +322,17 @@ do fi if (( ${GENROM} == 2 )); then + cat /tmp/user2.rom "${f}" > /tmp/tmp.size + FILESIZE=$(stat -c%s "/tmp/tmp.size") + if (( ${FILESIZE} < 524288 )); then + echo "Adding $f to User II Rom" + cat "${f}" >> /tmp/user.rom + else + GENROM=3 + fi + fi + + if (( ${GENROM} == 3 )); then echo "Limit reached ROMS full, skipping from ${f}..." break fi @@ -311,7 +343,12 @@ done if [ -f /tmp/user.rom ]; then mv /tmp/user.rom ${ROM_PATH}/USER_ROM_${SECTORSIZE}.bin FILESIZE=$(stat -c%s "${ROM_PATH}USER_ROM_${SECTORSIZE}.bin") - echo "USER ROM SIZE (${ROM_PATH}USER_ROM_${SECTORSIZE}.bin) = ${FILESIZE} Bytes" + echo "USER ROM I SIZE (${ROM_PATH}USER_ROM_${SECTORSIZE}.bin) = ${FILESIZE} Bytes" +fi +if [ -f /tmp/user2.rom ]; then + mv /tmp/user2.rom ${ROM_PATH}/USER_ROM_II_${SECTORSIZE}.bin + FILESIZE=$(stat -c%s "${ROM_PATH}USER_ROM_II_${SECTORSIZE}.bin") + echo "USER ROM II SIZE (${ROM_PATH}USER_ROM_II_${SECTORSIZE}.bin) = ${FILESIZE} Bytes" fi if [ -f /tmp/mrom.rom ]; then mv /tmp/mrom.rom ${ROM_PATH}/MROM_${SECTORSIZE}.bin