Solved CPM boot hang, uninitialised memory so now on cold boot all memory is initialised. Also added 320K ROM drive definitions.

This commit is contained in:
Philip Smart
2020-05-15 00:54:26 +01:00
parent e70a5414f8
commit aeb8c49ea2
21 changed files with 2157 additions and 439 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -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
@@ -1441,7 +1451,7 @@ 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.
@@ -1452,6 +1462,11 @@ FINDMZF: LD (TMPADR), HL ; Save name of program to load.
; D = File sequence number.
;
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
@@ -1493,18 +1508,36 @@ 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
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
;
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,6 +1545,19 @@ 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.
CALL SELUSRBNK
@@ -1555,7 +1601,7 @@ LROMLOAD2: LD A, B
CALL SELUSRBNK
LROMLOAD3: PUSH BC
LD HL, 0E800h
LD HL, UROMADDR
LD A, C
IF RFSSECTSZ >= 512
RLCA
@@ -1605,6 +1651,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,ROMBANK9
SCF ; Select the required user bank and Set carry so that the control registers remain enabled.
CALL SELUSRBNK
@@ -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
@@ -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.

View File

@@ -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..

View File

@@ -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

View File

@@ -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

View File

@@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -14,7 +14,8 @@
## Credits:
## Copyright: (c) 2020 Philip Smart <philip.smart@net2net.org>
##
## 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.
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.

View File

@@ -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
# 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
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
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