diff --git a/software/asm/cbios.asm b/software/asm/cbios.asm index 231bc3b..43d9e95 100644 --- a/software/asm/cbios.asm +++ b/software/asm/cbios.asm @@ -372,18 +372,17 @@ INIT3: LD A,(BNKCTRLRST) ; ; Initialise the SD Card subsystem (if connected). ; - CALL ?SDINIT + ; CALL ?SDINIT LD A,0 ; No drives yet detected so zero available mask. - JR NZ,STRT2 - SET 2,A ; Assume the SD Card is present. + ; JR NZ,STRT2 + SET 2,A ; Assume the SD Card is present if it initialised. ; LD DE,SDAVAIL - CALL PRTSTRTMSG + CALL PRTSTRTMSG ; Print message and store Drive Availability flag in A ; - ; Locate the CPM Image and store the Bank/Block to speed up warm boot. STRT2: LD (DRVAVAIL),A ; - ; Find the CPM binary in the ROM, used for Warm restart CCP/BDOS reload. + ; Locate the CPM binary Image in the ROM and store the Bank/Block to speed up warm boot.used for Warm restart CCP/BDOS reload. LD HL,CPMROMFNAME ; Name of CPM File in rom. CALL FINDMZF JP NZ,ROMFINDERR ; Failed to find CPM in the ROM! This shouldnt happen even if we boot from SD card, a copy needs to be in the ROM. @@ -395,7 +394,7 @@ STRT4: CALL ?DSKINIT ; Initi SET 0,A ; Indicate Floppy drives are available. LD DE,FDCAVAIL - CALL PRTSTRTMSG + CALL PRTSTRTMSG ; Print message and store Drive Availability flag in A ; STRT5: LD DE,CBIOSIGNEND ; Terminate the signon message which now includes list of drives detected. CALL MONPRTSTR @@ -920,19 +919,11 @@ ALLOC2: LD (RSFLAG), A ; rsfla SELUSRBNK: DI PUSH BC PUSH AF - ; Reset to a known state to allow for spurious read/writes to control area clocking the up counter. + ; Use a fixed number of reads to enable the control registers. LD B,16 -SELUSRBNK0: LD A,(BNKCTRLDIS) +SELUSRBNK0: LD A,(BNKCTRLRST) DJNZ SELUSRBNK0 - ; Now loop for the correct up counter required to enable the latches. - LD B,15 ; Set value to B for loop. - LD A,(BNKCTRL) - LD C,A -SELUSRBNK1: CP C - JR NZ,SELUSRBNK2 - LD A,(BNKCTRL) ; Read the latch and compare with sample. Either we reach the count limit or the read differs indicating latch control. - DJNZ SELUSRBNK1 -SELUSRBNK2: POP AF + POP AF POP BC LD (BNKSELUSER),A ; Select the required bank. LD A,(ROMCTL) @@ -942,6 +933,32 @@ SELUSRBNK2: POP AF SELUSRBNK3: EI RET +; EXX +; EX AF,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) ; Do a reset for the case where the above read enabled the latch, possible if external programs are reading/writing the latch area. +; LD A,(BNKCTRL) ; Sample latch at start to detect change. +; LD E,A +;SELUSRBNK1: LD A,(BNKCTRL) ; Read the latch and compare with sample. Either we reach the count limit or the read differs indicating latch control. +; CP E +; JR NZ,SELUSRBNK2 +; DJNZ SELUSRBNK1 +;SELUSRBNK2: LD A,C +; LD (BNKCTRL),A +; EX AF,AF' +; LD (BNKSELUSER),A ; Select the required bank. +; EXX +; JR C,SELUSRBNK3 ; 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. +;SELUSRBNK3: EI +; RET + ; Helper method to set up a Disk Parameter Block. ; Input: Drive Count = (CDIRBUF) diff --git a/software/asm/cbios_bank1.asm b/software/asm/cbios_bank1.asm index c730c56..51b8926 100644 --- a/software/asm/cbios_bank1.asm +++ b/software/asm/cbios_bank1.asm @@ -450,7 +450,7 @@ GETKY2: LD A,(KEYCOUNT) ; No ke ; END OF KEYBOARD FUNCTIONALITY ;------------------------------------------------------------------------------- - - - - ALIGN_NOPS UROMADDR + 0800h + ; Align to end of bank. + ALIGN UROMADDR + 07F8h + ORG UROMADDR + 07F8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/cbios_bank2.asm b/software/asm/cbios_bank2.asm index 8368f7e..2c2b8ee 100644 --- a/software/asm/cbios_bank2.asm +++ b/software/asm/cbios_bank2.asm @@ -1462,4 +1462,7 @@ RCP: LD HL,(CURSORPSAV) ; (curr ; END OF ANSI TERMINAL FUNCTIONALITY ;------------------------------------------------------------------------------- - ALIGN_NOPS UROMADDR + 0800h + ; Align to end of bank. + ALIGN UROMADDR + 07F8h + ORG UROMADDR + 07F8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/cbios_bank3.asm b/software/asm/cbios_bank3.asm index 9593b40..6b21e39 100644 --- a/software/asm/cbios_bank3.asm +++ b/software/asm/cbios_bank3.asm @@ -205,7 +205,8 @@ SD_INIT12: DEC BC ; 6T LD A,4 ; Exit code, failed to initialise v1 MMC card. JR SD_EXIT -SD_INIT13: LD A,CMD16 ; No response from the card for an ACMD41/CMD1 so try CMD16 with parameter 0x00000200 +SD_INIT13: POP BC + LD A,CMD16 ; No response from the card for an ACMD41/CMD1 so try CMD16 with parameter 0x00000200 LD HL,00000H ; NB. Important, HL should be coded as LH due to little endian and the way it is used in SDCMD. LD DE,00002H ; NB. Important, DE should be coded as ED due to little endian and the way it is used in SDCMD. CALL SDCMD @@ -215,6 +216,7 @@ SD_INIT13: LD A,CMD16 ; No re LD A,0 LD (SDCAP),A ; No capabilities on this unknown card. SD_INIT14: XOR A + JR SD_EXIT SD_EXIT: OR A ; Return value is in A. RET @@ -283,8 +285,10 @@ SDCMD4: POP HL INC HL POP BC ; Get back number of expected bytes. HL = place in buffer to store response. DJNZ SDCMD3 - LD A,DOUT_HIGH | CLOCK_LOW | CS_HIGH - OUT (SPI_OUT),A + IF HW_SPI_ENA = 0 + LD A,DOUT_HIGH | CLOCK_LOW | CS_HIGH + OUT (SPI_OUT),A + ENDIF RET ; Method to send an Application Command to the SD Card. This involves sending CMD55 followed by the required command. @@ -563,7 +567,8 @@ LBATOADDR: LD HL,(SDSTARTSEC+1) ; HL: Address where to store data read from sector. ; Output: A = 0 - All ok. A > 0 - error occurred. ; -?SD_READ: PUSH HL ; Store the load address. +?SD_READ: DI + PUSH HL ; Store the load address. LD A,000H CALL SPICS ; Set CS low (active). @@ -626,6 +631,7 @@ SD_READ5: PUSH AF LD A,0FFH ; Disable CS therefore deselecting the SD Card. CALL SPICS POP AF + EI RET SD_READ6: POP HL LD A,1 @@ -884,5 +890,8 @@ SDC_WRITE1: RET ; END OF SD CARD CONTROLLER FUNCTIONALITY ;------------------------------------------------------------------------------- + ; Align to end of bank. + ALIGN UROMADDR + 07F8h + ORG UROMADDR + 07F8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh - ALIGN_NOPS UROMADDR + 0800h diff --git a/software/asm/cbios_bank4.asm b/software/asm/cbios_bank4.asm index 0ddce5d..83edf04 100644 --- a/software/asm/cbios_bank4.asm +++ b/software/asm/cbios_bank4.asm @@ -103,6 +103,7 @@ CBIOS1_0: LD A,(BNKCTRLRST) ?SETDRVMAP: PUSH HL PUSH DE PUSH BC + ; Zero out the map. LD B,MAXDISKS LD HL,DISKMAP @@ -634,4 +635,7 @@ RETRIESMSG: DB "DISK ERROR - RETRIES", CR, NUL DATAOVRMSG: DB "DISK ERROR - DATA OVERRUN", CR, NUL CRCERRMSG: DB "DISK ERROR - CRC ERROR", CR, NUL - ALIGN_NOPS UROMADDR + 0800h + ; Align to end of bank. + ALIGN UROMADDR + 07F8h + ORG UROMADDR + 07F8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/include/CPM_Definitions.asm b/software/asm/include/CPM_Definitions.asm index 877dab3..c812af0 100644 --- a/software/asm/include/CPM_Definitions.asm +++ b/software/asm/include/CPM_Definitions.asm @@ -41,8 +41,8 @@ PP_SPI_ENA EQU 0 ; Set t ; Build time options, only set to '1' to build, '0' to disable, only 1 can be set to '1'. ; IF BUILD_VERSION = 0 -BUILD_80C EQU 1 ; Build for an MZ-80A with a 40/80 column card. -BUILD_40C EQU 0 ; Build for a standard 40 column MZ-80A. +BUILD_80C EQU 0 ; Build for an MZ-80A with a 40/80 column card. +BUILD_40C EQU 1 ; Build for a standard 40 column MZ-80A. ; ENDIF ; IF BUILD_VERSION = 1 ;BUILD_80C EQU 0 ; Build for an MZ-80A with a 40/80 column card. diff --git a/software/asm/include/RFS_Definitions.asm b/software/asm/include/RFS_Definitions.asm index 2a65c4c..2ca64f8 100644 --- a/software/asm/include/RFS_Definitions.asm +++ b/software/asm/include/RFS_Definitions.asm @@ -41,6 +41,9 @@ HW_SPI_ENA EQU 1 ; Set t SW_SPI_ENA EQU 0 ; Set to 1 if software SPI is present on the RFS PCB v2 board. PP_SPI_ENA EQU 0 ; Set to 1 if using the SPI interface via the Parallel Port, ie. for RFS PCB v1 which doesnt have SPI onboard. +; Debugging +ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable + ;----------------------------------------------- ; Entry/compilation start points. ;----------------------------------------------- @@ -161,9 +164,6 @@ GAP: EQU 0077AH WTAPE: EQU 00485H MSTOP: EQU 00700H -; Debugging -ENADEBUG EQU 1 ; Enable debugging logic, 1 = enable, 0 = disable - ;----------------------------------------------- ; Memory mapped ports in hardware. ;----------------------------------------------- diff --git a/software/asm/rfs.asm b/software/asm/rfs.asm index ccafca3..aea8c17 100644 --- a/software/asm/rfs.asm +++ b/software/asm/rfs.asm @@ -347,12 +347,12 @@ CMDTABLE: DB 000H | 000H | 000H | 002H ; Bit 2 DB 000H | 000H | 000H | 002H DB "80" ; 80 Char screen mode. DW SETMODE80 - DB 000H | 000H | 000H | 004H - DB "7008" ; Switch to 80 column MZ700 mode. - DW SETMODE7008 - DB 000H | 000H | 000H | 003H - DB "700" ; Switch to 40 column MZ700 mode. - DW SETMODE700 + ;DB 000H | 000H | 000H | 004H + ;DB "7008" ; Switch to 80 column MZ700 mode. + ;DW SETMODE7008 + ;DB 000H | 000H | 000H | 003H + ;DB "700" ; Switch to 40 column MZ700 mode. + ;DW SETMODE700 DB 000H | 000H | 000H | 005H DB "BASIC" ; Load and run BASIC SA-5510. DW LOADBASIC @@ -362,6 +362,9 @@ CMDTABLE: DB 000H | 000H | 000H | 002H ; Bit 2 DB 000H | 000H | 000H | 003H DB "CPM" ; Load and run CPM. DW LOADCPM + DB 000H | 000H | 018H | 002H + DB "CP" ; Copy Memory. + DW MCOPY DB 000H | 000H | 018H | 001H DB 'C' ; Clear Memory. DW INITMEMX @@ -530,34 +533,33 @@ SETCLR_1: LD (DE),A ; Command to switch to the MZ700 compatibility mode with 80 column display. ; -SETMODE7008:LD A,(TZPU) ; Check there is a tranZPUter card installed. - OR A - JR Z,NOTZPU - LD HL,DSPCTL ; Setup address of display control register latch. - LD A, 128 ; Setup for 80char display. - LD E,(HL) ; Dummy operation to enable latch write via multivibrator. - LD (HL), A - CALL SETMODECLR ; Set memory mode and clear variable area. - LD A,ROMBANK5 ; Select the 80 column version of the 1Z-013A ROM. -SETMODE_2: LD (ROMBK1),A - LD (BNKSELMROM),A - LD A,MODE_MZ700 ; Set the CPLD compatibility mode. -SETMODE_3: OUT (CPLDCFG),A - JP MONIT ; Cold start the monitor. +;SETMODE7008:LD A,(TZPU) ; Check there is a tranZPUter card installed. +; OR A +; JR Z,NOTZPU +; LD HL,DSPCTL ; Setup address of display control register latch. +; LD A, 128 ; Setup for 80char display. +; LD E,(HL) ; Dummy operation to enable latch write via multivibrator. +; LD (HL), A +; CALL SETMODECLR ; Set memory mode and clear variable area. +; LD A,ROMBANK5 ; Select the 80 column version of the 1Z-013A ROM. +;SETMODE_2: LD (ROMBK1),A +; LD (BNKSELMROM),A +; LD A,MODE_MZ700 ; Set the CPLD compatibility mode. +;SETMODE_3: OUT (CPLDCFG),A +; JP MONIT ; Cold start the monitor. ; Command to switch to the MZ700 compatibility mode with original 40 column display. ; -SETMODE700: LD A,(TZPU) ; Check there is a tranZPUter card installed. - OR A - JR Z,NOTZPU - LD HL,DSPCTL ; Setup address of display control register latch. - LD A, 0 ; Setup for 40char display. - LD E,(HL) ; Dummy operation to enable latch write via multivibrator. - LD (HL), A - CALL SETMODECLR ; Set memory mode and clear variable area. - LD A,ROMBANK4 ; Select the 40 column version of the 1Z-013A ROM. - JR SETMODE_2 - +;SETMODE700: LD A,(TZPU) ; Check there is a tranZPUter card installed. +; OR A +; JR Z,NOTZPU +; LD HL,DSPCTL ; Setup address of display control register latch. +; LD A, 0 ; Setup for 40char display. +; LD E,(HL) ; Dummy operation to enable latch write via multivibrator. +; LD (HL), A +; CALL SETMODECLR ; Set memory mode and clear variable area. +; LD A,ROMBANK4 ; Select the 40 column version of the 1Z-013A ROM. +; JR SETMODE_2 ;==================================== ; @@ -629,6 +631,8 @@ _PRTDBG: IF ENADEBUG = 1 CALL PRNT LD A, ' ' CALL PRNT + ; CALL NL + ; CALL GETKY LD A,(WRKROMBK1) LD (BNKSELMROM),A ; Set the MROM bank back to scanned bank. POP AF @@ -720,7 +724,7 @@ PRTMZF4: OR A ; Method to list the directory of the ROM devices. ; -DIRROM: DI ; Disable interrupts as we are switching out the main rom. +DIRROM: ;DI ; Disable interrupts as we are switching out the main rom. ; LD A,1 ; Account for the title. LD (TMPLINECNT),A @@ -739,7 +743,6 @@ DIRROM: DI ; Disab LD (WRKROMBK1),A LD (BNKSELMROM),A CALL DIRMROM - ; ; Scan MROM Bank ; B = Bank Page @@ -751,6 +754,7 @@ DIRROM: DI ; Disab DIRNXTPG: LD A,B LD (WRKROMBK1), A LD (BNKSELMROM),A ; Select bank. + PUSH BC ; Preserve bank count/block number. PUSH DE ; Preserve file numbering. LD A,C @@ -785,7 +789,7 @@ DIRNXTPG2: LD A,B DIRNXTPGX: LD A,(ROMBK1) LD (BNKSELMROM),A ; Set the MROM bank back to original. - EI ; No need to block interrupts now as MROM bank restored. + ;EI ; No need to block interrupts now as MROM bank restored. RET ; End of scan, return to monitor @@ -888,7 +892,7 @@ FINDMZFNO: PUSH AF LOADROMNX: LD L,0FFH JR LOADROM1 LOADROM: LD L,000H -LOADROM1: DI +LOADROM1: ;DI PUSH HL ; Preserve execute flag. EX DE,HL ; User ROM expects HL to have the filename pointer. @@ -931,7 +935,7 @@ LROMNTFND: POP HL ; Dont LD HL,PRINTMSG LD DE,MSGNOTFND ; Not found CALL BKSW0to6 -LOADROMEND: EI +LOADROMEND:;EI RET ; @@ -1036,7 +1040,7 @@ LROMLOAD5: POP HL ; Retri CP 0FFh JP Z,LROMLOAD9 ; Go back to monitor if it has been, else execute. LD HL,(EXADR) - EI ; No need to block interrupts now as MROM bank restored. + ;EI ; No need to block interrupts now as MROM bank restored. JP (HL) ; Execution address. LROMLOAD9: RET @@ -1320,8 +1324,9 @@ DEFAULTFNE: EQU $ ; ; Ensure we fill the entire 2K by padding with FF's. ; - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh MEND: diff --git a/software/asm/rfs_bank1.asm b/software/asm/rfs_bank1.asm index b2e293c..81ccd50 100644 --- a/software/asm/rfs_bank1.asm +++ b/software/asm/rfs_bank1.asm @@ -339,7 +339,7 @@ L01C0: CALL L0249 ; S PUSH IX ; Save 1008H LD IX, 0F3FEH ; As below. L03FE LD IY,L01DF ; Read sector into memory. - DI + ;DI LD A,094H ; Latest FDC command byte CALL L028A L01DB: LD B,000H @@ -493,7 +493,7 @@ L02D2: PUSH AF LD A,(0119CH) CP 0F0H JR NZ,L02DB ; (+001h) - EI + ;EI L02DB: POP AF RET @@ -531,5 +531,6 @@ PRMBLK: DB 000H, 000H, 000H, 000H, 001H, 000H, 0CEH, 000H, 000H, 000H, L03FE: JP (IY) - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank2.asm b/software/asm/rfs_bank2.asm index 590a5e7..846ca14 100644 --- a/software/asm/rfs_bank2.asm +++ b/software/asm/rfs_bank2.asm @@ -410,8 +410,10 @@ SDCMD4: POP HL INC HL POP BC ; Get back number of expected bytes. HL = place in buffer to store response. DJNZ SDCMD3 - LD A,DOUT_HIGH | CLOCK_LOW | CS_HIGH - OUT (SPI_OUT),A + IF HW_SPI_ENA = 0 + LD A,DOUT_HIGH | CLOCK_LOW | CS_HIGH + OUT (SPI_OUT),A + ENDIF RET ; Method to send an Application Command to the SD Card. This involves sending CMD55 followed by the required command. @@ -1017,9 +1019,9 @@ GETSDDIRENT:PUSH BC LD (SDLOADSIZE),BC LD HL,(SDLOADADDR) ; - DI + ;DI CALL SD_READ ; Read the sector. - EI + ;EI ; OR A JR NZ,DIRSDERR @@ -1086,9 +1088,9 @@ WRSDDIRENT: LD A,(DIRSECBUF) ; Get t LD HL,SECTORBUF ; Address of the sector. LD BC,SD_SECSIZE ; Set the size as one full sector. ; - DI + ;DI CALL SD_WRITE - EI + ;EI ; OR A JR NZ,DIRSDWERR @@ -1123,7 +1125,7 @@ DIRSDCARD: LD A,1 ; Setup ADD A,'0' DIRSDP: LD C,A ; C is printed as a character embedded in the message. LD DE,MSGCDIRLST ; Print out header. - CALL SDPRINT ; Print out the filename. + CALL SDPRINT ; Print out the header. ; DIRSD0: LD E,0 ; Directory entry number LD D,0 ; Directory file number (incr when a valid dirent is found). @@ -1373,9 +1375,9 @@ LOADSD11: LD A,(SDLOADSIZE+1) JR NC,LOADSD12 LD BC,(SDLOADSIZE) ; Get remaining bytes size. LOADSD12: LD HL,(SDLOADADDR) - DI + ;DI CALL SD_READ ; Read the sector. - EI + ;EI OR A RET NZ ; Failure to read a sector, abandon with error message. LD (SDLOADADDR),HL ; Save the updated address. @@ -1544,9 +1546,9 @@ SAVESD5: LD A,(SDLOADSIZE+1) JR NC,SAVESD6 LD BC,(SDLOADSIZE) ; Get remaining bytes size. SAVESD6: LD HL,(SDLOADADDR) - DI + ;DI CALL SD_WRITE ; Write the sector. - EI + ;EI OR A JR NZ,SAVESD9 ; Failure to read a sector, abandon with error message. LD (SDLOADADDR),HL ; Save the updated address. @@ -1598,5 +1600,6 @@ SAVESD9: LD DE,MSGSVFAIL ; Fail, ; ;-------------------------------------- - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank3.asm b/software/asm/rfs_bank3.asm index 939cdc7..958a31c 100644 --- a/software/asm/rfs_bank3.asm +++ b/software/asm/rfs_bank3.asm @@ -222,6 +222,27 @@ MCRX3: LD H,B ; memor LD L,C JR MCORX1 + ; Memory copy command 'CPY' + ; Parameters: XXXYYYZZZ - XXXX = Source, YYYY = Destination, ZZZZ = Size +MCOPY: CALL READ4HEX ; Source + JR C,MCOPYER1 + PUSH HL + CALL READ4HEX ; Destination + JR C,MCOPYER2 + PUSH HL + CALL READ4HEX ; Size + JR C,MCOPYER3 + PUSH HL + POP BC ; Size + POP DE ; Destination + POP HL ; Source + LDIR + RET + ; +MCOPYER3: POP HL +MCOPYER2: POP HL +MCOPYER1: RET + ; Dump method when called interbank as HL cannot be passed. ; @@ -391,7 +412,7 @@ READ4HEX: CALL HLHEX OR A ; Clear carry flag. RET READ4HEXERR:LD DE,MSGREAD4HEX ; Load up error message, print and exit. - LD HL,PRINTMSG +READ4HEXPRE:LD HL,PRINTMSG CALL BKSW1to6 SCF RET @@ -522,5 +543,6 @@ SLPT: DB 01H ; TEXT ; ;-------------------------------------- - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank4.asm b/software/asm/rfs_bank4.asm index f13a121..4ef6a13 100644 --- a/software/asm/rfs_bank4.asm +++ b/software/asm/rfs_bank4.asm @@ -210,7 +210,7 @@ LOADTAPE6: LD DE,MSGCMTDATA ; SA1510 Routine to write a tape header. Copied into the RFS and modified to merge better ; with the RFS interface. ; -CMTWRI: DI +CMTWRI: ;DI PUSH DE PUSH BC PUSH HL @@ -244,7 +244,7 @@ CMTWRI2: POP HL LD A,(TIMFG) CP 0F0H JR NZ,CMTWRI3 - EI + ;EI CMTWRI3: POP AF RET @@ -330,5 +330,6 @@ SGX: LD A,(SWRK) ; ;-------------------------------------- - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank5.asm b/software/asm/rfs_bank5.asm index c612791..a3718a6 100644 --- a/software/asm/rfs_bank5.asm +++ b/software/asm/rfs_bank5.asm @@ -205,6 +205,6 @@ SHARPTOASC: DB 000H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xEF DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xFF - - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank6.asm b/software/asm/rfs_bank6.asm index d9d7759..7ab5617 100644 --- a/software/asm/rfs_bank6.asm +++ b/software/asm/rfs_bank6.asm @@ -279,14 +279,17 @@ PRTSTRE: POP DE ; Help text. Use of lower case, due to Sharp's non standard character set, is not easy, you have to manually code each byte ; hence using upper case. + ; 1 40 HELPSCR: DB "0..9 - select RFS Drive.", 00DH DB "40 - 40 col mode.", 00DH DB "80 - 80 col mode.", 00DH - DB "700 - Select MZ-700 Mode.", 00DH - DB "7008 - Select MZ-700 80 col Mode.", 00DH + ;DB "700 - Select MZ-700 Mode.", 00DH + ;DB "7008 - Select MZ-700 80 col Mode.", 00DH DB "B - toggle keyboard bell.", 00DH DB "BASIC - Load BASIC SA-5510.", 00DH DB "C - clear memory $1200-$D000.", 00DH + DB "CPXXXXYYYYZZZZ - copy memory", 00DH + DB " XXXX=src,YYYY=dst,ZZZZ=size", 00DH DB "CPM - Load CPM.", 00DH DB "DXXXX[YYYY] - dump mem XXXX to YYYY.", 00DH DB "EC[FN]- erase file, FN=No, or Filename", 00DH @@ -457,12 +460,12 @@ MSGNOTFND: DB "Not Found", 00DH, 000H MSGRDIRLST: DB "ROM Directory:", 00DH, 000H MSGTRM: DB 00DH, 000H MSGBADCMD: DB "???", 00DH, 000H -MSGSDINITER:DB "SD Card Error ", 0F9H, 00DH, 000H +MSGSDINITER:DB "SD Card Error ", 0F9H, 00DH, 000H MSGCDIRLST: DB "SD Card Directory ",0F9H,":", 00DH, 000H -MSGSDRERR: DB "SD Read error, Sec:",0FBH, 000H -MSGSDWERR: DB "SD Write error, Sec:",0FBH, 000H -MSGSVFAIL: DB "SD Error, save failed.", 00DH, 000H -MSGERAFAIL: DB "SD Dir update failed.", 00DH, 000H +MSGSDRERR: DB "Read error, Sec:",0FBH, 000H +MSGSDWERR: DB "Write error, Sec:",0FBH, 000H +MSGSVFAIL: DB "Error, save failed.", 00DH, 000H +MSGERAFAIL: DB "Dir update failed.", 00DH, 000H MSGSVDIRENT:DB "Saving into dir entry:",0FBH, 00DH, 000H MSGERASEDIR:DB "Deleted dir entry:",0FBH, 000H MSGCMTDATA: DB "Load:",0FEH,",Exec:",0FFH, ",Size:",0FBH, 00DH, 000H @@ -487,7 +490,8 @@ MSGSD2TOK: DB "Success, SD to Tape done.", 00DH, 000H MSGNOTZINST:DB "No tranZPUter >=v2 card installed.", 00DH, 000H MSGNOCMTDIR:DB "CMT has no directory.", 00DH, 000H MSGINVDRV: DB "Invalid drive, SD=0..9 or C=CMT", 00DH, 000H -MSGNOVERIFY:DB "No Verify for SD drive.", 00DH, 000H +MSGNOVERIFY:DB "No Verify for SD!", 00DH, 000H - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_bank7.asm b/software/asm/rfs_bank7.asm index a69c2eb..5a17581 100644 --- a/software/asm/rfs_bank7.asm +++ b/software/asm/rfs_bank7.asm @@ -271,7 +271,7 @@ TIMERTST: CALL NL CALL TIMERTST1 NDE: JP NDE JP ST1X -TIMERTST1: DI +TIMERTST1: ;DI PUSH BC PUSH DE PUSH HL @@ -399,7 +399,7 @@ CDEF: POP DE LD (HL),07BH INC HL -L0336H: PUSH AF +L0336H: PUSH AF PUSH BC PUSH DE PUSH HL @@ -464,7 +464,7 @@ L0340: CALL DPCT POP HL POP DE POP BC - EI + ;EI RET ;------------------------------------------------------------------------------- ; END OF TIMER TEST FUNCTIONALITY @@ -491,5 +491,6 @@ MSG_TIMERVAL2: MSG_TIMERVAL3: DB "READ DONE.", 0Dh, 00h - ALIGN 0EFFFh - DB 0FFh + ALIGN 0EFF8h + ORG 0EFF8h + DB 0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh,0FFh diff --git a/software/asm/rfs_mrom.asm b/software/asm/rfs_mrom.asm index 80eeac4..92b67e8 100644 --- a/software/asm/rfs_mrom.asm +++ b/software/asm/rfs_mrom.asm @@ -288,56 +288,56 @@ INITBNK_1: LD A,(BNKCTRLRST) ; 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. ; +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 + POP AF + LD (BNKSELUSER),A ; Select the required bank. + 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. + RET + + ; 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. 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) +; ; Reset to a known state to allow for spurious read/writes to control area clocking the up counter. +; LD B,15 +;SEL1: LD A,(BNKCTRLDIS) +; DJNZ SEL1 +; ; Now loop for the correct up counter required to enable the latches. +; LD B,15 ; Set value to B for loop. +;SELUSRBNK1:LD A,(BNKCTRL) ; Read the latch and compare with sample. Either we reach the count limit or the read differs indicating latch control. ; DJNZ SELUSRBNK1 ; POP AF -; LD (BNKSELUSER),A ; Select the required bank. -; LD A,C ; POP BC -; JR NC,SELUSRBNK2 ; If Carry is set by caller then leave the control registers active. +; LD (BNKSELUSER),A ; Select the required bank. +; LD A,(ROMCTL) +; JR NC,SELUSRBNK2 ; 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. +;SELUSRBNK2:LD (BNKCTRL),A ; LD (BNKCTRLDIS),A ; Disable the control registers, value of A is not important. ; RET - ; 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. 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 - ; Reset to a known state to allow for spurious read/writes to control area clocking the up counter. - LD B,15 -SEL1: LD A,(BNKCTRLDIS) - DJNZ SEL1 - ; Now loop for the correct up counter required to enable the latches. - LD B,15 ; Set value to B for loop. -SELUSRBNK1: LD A,(BNKCTRL) ; Read the latch and compare with sample. Either we reach the count limit or the read differs indicating latch control. - DJNZ SELUSRBNK1 - POP AF - POP BC - LD (BNKSELUSER),A ; Select the required bank. - LD A,(ROMCTL) - JR NC,SELUSRBNK2 - 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 - LD (BNKCTRLDIS),A ; Disable the control registers, value of A is not important. - RET - ; HL contains address of block to check. ISMZF: PUSH BC diff --git a/software/roms/MROM_256.bin b/software/roms/MROM_256.bin deleted file mode 100644 index 006743f..0000000 Binary files a/software/roms/MROM_256.bin and /dev/null differ diff --git a/software/roms/USER_ROM_256.bin b/software/roms/USER_ROM_256.bin deleted file mode 100644 index eabc187..0000000 Binary files a/software/roms/USER_ROM_256.bin and /dev/null differ diff --git a/software/roms/cbios.rom b/software/roms/cbios.rom index 4a32a6c..95272da 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 ca90b79..124495f 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 787d806..e85348c 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 5078b48..d8c61d0 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 0e148d9..e195147 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 fe816fb..0c717d7 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 f96ea07..6e99f4d 100644 Binary files a/software/roms/rfs_mrom.rom and b/software/roms/rfs_mrom.rom differ