From 0d29361f371f8087daeb8378360a2760871b36ab Mon Sep 17 00:00:00 2001 From: Philip Smart Date: Wed, 2 Sep 2020 12:03:01 +0100 Subject: [PATCH] Updates for v2.1 hardware. Will now create branches for v2.2 and v2.1 hardware --- CPLD/build/tranZPUterSW.qsf | 38 +++++---- CPLD/build/tranZPUterSW_constraints.sdc | 19 ++++- CPLD/tranZPUterSW.vhd | 89 +++++++++++++++++++--- CPLD/tranZPUterSW_Toplevel.vhd | 14 +++- software/asm/include/CPM_Definitions.asm | 47 ++++++------ software/asm/include/TZFS_Definitions.asm | 47 ++++++------ software/asm/tzfs.asm | 14 ++++ software/asm/tzfs_bank2.asm | 2 + software/roms/tzfs.rom | Bin 18432 -> 18432 bytes software/tools/assemble_roms.sh | 2 +- 10 files changed, 192 insertions(+), 80 deletions(-) diff --git a/CPLD/build/tranZPUterSW.qsf b/CPLD/build/tranZPUterSW.qsf index 3d0fb55..c151d46 100644 --- a/CPLD/build/tranZPUterSW.qsf +++ b/CPLD/build/tranZPUterSW.qsf @@ -90,10 +90,16 @@ set_location_assignment PIN_81 -to Z80_DATA[7] # Graphics extension address and control. # ======================================= -set_location_assignment PIN_5 -to VADDR[13] -set_location_assignment PIN_2 -to VADDR[12] -set_location_assignment PIN_1 -to VADDR[11] -set_location_assignment PIN_143 -to VMEM_CSn +#set_location_assignment PIN_5 -to VADDR[13] +#set_location_assignment PIN_2 -to VADDR[12] +#set_location_assignment PIN_1 -to VADDR[11] +#set_location_assignment PIN_143 -to VMEM_CSn +#set_location_assignment PIN_142 -to VIORQn +set_location_assignment PIN_5 -to OUTDATA[3] +set_location_assignment PIN_2 -to OUTDATA[2] +set_location_assignment PIN_1 -to OUTDATA[1] +set_location_assignment PIN_143 -to OUTDATA[0] +set_location_assignment PIN_142 -to INCLK # RAM control # =========== @@ -124,17 +130,19 @@ set_location_assignment PIN_39 -to Z80_MEM[0] set_location_assignment PIN_36 -to CFG_MZ80A set_location_assignment PIN_35 -to CFG_MZ700 # Spare connected pins to be assigned if needed. -#set_location_assignment PIN_30 -to TBA[0] -#set_location_assignment PIN_29 -to TBA[1] -#set_location_assignment PIN_28 -to TBA[2] -#set_location_assignment PIN_27 -to TBA[3] -#set_location_assignment PIN_26 -to TBA[4] -#set_location_assignment PIN_25 -to TBA[5] -#set_location_assignment PIN_23 -to TBA[6] -#set_location_assignment PIN_22 -to TBA[7] -#set_location_assignment PIN_21 -to TBA[8] -#set_location_assignment PIN_37 -to TBA[9] -#set_location_assignment PIN_34 -to TBA[10] +#set_location_assignment PIN_36 -to TBA[0] +#set_location_assignment PIN_25 -to TBA[1] +#set_location_assignment PIN_30 -to TBA[2] +#set_location_assignment PIN_29 -to TBA[3] +#set_location_assignment PIN_28 -to TBA[4] +#set_location_assignment PIN_27 -to TBA[5] +#set_location_assignment PIN_26 -to TBA[6] +#set_location_assignment PIN_25 -to TBA[7] +#set_location_assignment PIN_23 -to TBA[8] +#set_location_assignment PIN_22 -to TBA[9] +#set_location_assignment PIN_21 -to TBA[10] +#set_location_assignment PIN_34 -to TBA[11] +#set_location_assignment PIN_37 -to TBA[12] # Z80 Control signals. # ==================== diff --git a/CPLD/build/tranZPUterSW_constraints.sdc b/CPLD/build/tranZPUterSW_constraints.sdc index 9523b8a..b84a4f9 100644 --- a/CPLD/build/tranZPUterSW_constraints.sdc +++ b/CPLD/build/tranZPUterSW_constraints.sdc @@ -44,6 +44,9 @@ create_clock -name {SYSCLK} -period 500.000 -waveform { 0.000 250.000 } [get_por # For K64F create_clock -name {CTLCLK} -period 50.000 -waveform { 0.000 25.000 } [ get_ports { CTLCLK }] +# For the video module interconnect clock. +create_clock -name {INCLK} -period 62.500 -waveform { 0.000 31.250 } [ get_ports { INCLK }] + # For basic board with oscillator. #create_clock -name {CTLCLK} -period 20.000 -waveform { 0.000 10.000 } [ get_ports { CTLCLK }] #create_clock -name {cpld512:cpldl512Toplevel|CTLCLKi} -period 280.000 -waveform { 0.000 140.000 } [ get_keepers {cpld512:cpldl512Toplevel|CTLCLKi} ] @@ -127,10 +130,14 @@ set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {RAM set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {SVCREQn}] set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {SYSREQn}] set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {SYS_BUSACKn}] -set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[11]}] -set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[12]}] -set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[13]}] -set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VMEM_CSn}] +#set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[11]}] +#set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[12]}] +#set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VADDR[13]}] +#set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {VMEM_CSn}] +set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {OUTDATA[0]}] +set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {OUTDATA[1]}] +set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {OUTDATA[2]}] +set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {OUTDATA[3]}] set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {Z80_BUSRQn}] set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {Z80_DATA[0]}] set_output_delay -add_delay -clock [get_clocks {SYSCLK}] 5.000 [get_ports {Z80_DATA[1]}] @@ -208,6 +215,10 @@ set_false_path -from {cpld512:cpldl512Toplevel|MEM_MODE_LATCH[2]} -to {cpld512:c set_false_path -from {cpld512:cpldl512Toplevel|MEM_MODE_LATCH[1]} -to {cpld512:cpldl512Toplevel|CTLCLK_Q} set_false_path -from {cpld512:cpldl512Toplevel|MEM_MODE_LATCH[0]} -to {cpld512:cpldl512Toplevel|CTLCLK_Q} +# For the video module interconnect clock. +set_false_path -from [get_clocks {CTLCLK}] -to [get_clocks {INCLK}] +set_false_path -from [get_clocks {SYSCLK}] -to [get_clocks {INCLK}] + #************************************************************** # Set Multicycle Path diff --git a/CPLD/tranZPUterSW.vhd b/CPLD/tranZPUterSW.vhd index 8eae0eb..6d55794 100644 --- a/CPLD/tranZPUterSW.vhd +++ b/CPLD/tranZPUterSW.vhd @@ -61,7 +61,6 @@ entity cpld512 is Z80_HI_ADDR : out std_logic_vector(18 downto 15); Z80_ADDR : inout std_logic_vector(15 downto 0); Z80_DATA : inout std_logic_vector( 7 downto 0); - VADDR : out std_logic_vector(13 downto 11); -- Z80 Control signals. Z80_BUSRQn : out std_logic; @@ -101,7 +100,11 @@ entity cpld512 is RAM_WEn : out std_logic; -- Graphics Board I/O and Memory Select. - VMEM_CSn : out std_logic; + -- VMEM_CSn : out std_logic; + -- VADDR : out std_logic_vector(13 downto 11); + -- VIORQn : out std_logic; + INCLK : in std_logic; + OUTDATA : out std_logic_vector(3 downto 0); -- Clocks, system and K64F generated. SYSCLK : in std_logic; @@ -156,12 +159,19 @@ architecture rtl of cpld512 is signal CTLCLK_Q : std_logic; -- signal DISABLE_BUSn : std_logic; + signal SYS_BUSACKni : std_logic := '0'; -- CPU Frequency select logic based on Flip Flops and gates. signal SCK_CTLSELn : std_logic; signal Z80_CLKi : std_logic; signal CTLCLKi : std_logic; + -- Video module signals. + -- + signal VM_MEM_CSn : std_logic; + signal VM_IORQn : std_logic; + signal OUTBUF : std_logic_vector(11 downto 0); + -- Z80 Wait Insert generator when I/O ports in region > 0XE0 are accessed to give the K64F time to proces them. -- --signal REQ_WAITn : std_logic; @@ -601,6 +611,53 @@ begin end if; end process; + -- A Video Module signal serializer. Signals required by the Video Module but not accessible physically (without hardware hacks) are captured and serialised as a set of 4 x 4 blocks, clocked by the video module, + -- Reset synchronises the Video Module CPLD with the tranZPUter CPLD and the signals are sent during valid mainboard accesses. + -- + SIGNALSERIALIZER: process(INCLK, Z80_RESETn) + variable XMIT_CYCLE : integer range 0 to 3; + begin + if Z80_RESETn = '0' then + XMIT_CYCLE := 0; + + elsif (INCLK='1' and INCLK'event) then + + -- Tight loop, sending current signal status on each clock. There are 16 signals to send and 4 data lines, so we need 4 cycles per data set. + case XMIT_CYCLE is + when 0 => + -- If we are accessing the mainboard then send across a valid signal set else mark it as invalid. + -- + if SYSCLK_Q = '0' then + OUTDATA(3 downto 0) <= Z80_ADDR(3 downto 0); + OUTBUF <= VM_IORQn & VM_MEM_CSn & Z80_ADDR(13 downto 4); + else + OUTDATA(3 downto 0) <= (others => '0'); + OUTBUF <= (others => '0'); + end if; + XMIT_CYCLE := 1; + + when 1 => + OUTDATA(3 downto 0) <= OUTBUF(3 downto 0); + XMIT_CYCLE := 2; + + when 2 => + OUTDATA(3 downto 0) <= OUTBUF(7 downto 4); + XMIT_CYCLE := 3; + + when 3 => + -- Double check, if we started with a valid mainboard cycle but the clock switched, or we started with an invalid mainboard + -- cycle and the clock switched to mainboard, then invalidate this cycle, otherwise send the final signals as captured at the + -- start of the cycle. + if SYSCLK_Q = '0' and OUTBUF(11 downto 10) /= "00" then + OUTDATA(3 downto 0) <= OUTBUF(11 downto 8); + else + OUTDATA(3 downto 0) <= (others => '0'); + end if; + XMIT_CYCLE := 0; + end case; + end if; + end process; + -- Memory decoding, taken directly from the definitions coded into the flashcfg tool in v1.1. The CPLD adds greater flexibility and mapping down to the byte level where needed. -- @@ -635,8 +692,24 @@ begin -- 29 - All memory and IO are on the tranZPUter board, 64K block 5 selected. -- 30 - All memory and IO are on the tranZPUter board, 64K block 6 selected. -- 31 - All memory and IO are on the tranZPUter board, 64K block 7 selected. - MEMORYMGMT: process(Z80_ADDR, Z80_WRn, Z80_RDn, Z80_IORQn, Z80_MREQn, Z80_M1n, MEM_MODE_LATCH) + MEMORYMGMT: process(Z80_ADDR, Z80_WRn, Z80_RDn, Z80_IORQn, Z80_MREQn, Z80_M1n, MEM_MODE_LATCH, SYS_BUSACKni) begin + -- Video module, the address range C000:FFFF can be made available via the VMEM_CSn signal, memory mode dependent. + -- Basic open window is the VRAM, D000:D7FF, ARAM D800:DFFF and memory mapped registers E000:E7FF + if (Z80_ADDR(15 downto 12) = "1101" or Z80_ADDR(15 downto 11) = "11100") and Z80_MREQn = '0' and (Z80_RDn = '0' or Z80_WRn = '0') and SYS_BUSACKni = '1' then + VM_MEM_CSn <= '0'; + else + VM_MEM_CSn <= '1'; + end if; + + -- For the video card, additional address lines are needed to address the banked video memory. The CPLD is acting as a buffer for these lines. + -- VADDR <= Z80_ADDR(13 downto 11) when SYS_BUSACKni = '1' + -- else (others => 'Z'); + if Z80_IORQn = '0' and (Z80_RDn = '0' or Z80_WRn = '0') then + VM_IORQn <= '0'; + else + VM_IORQn <= '1'; + end if; -- Memory action according to the set memory mode. Not synchronous as we need to detect and act on address or signals long before a rising edge. -- @@ -651,6 +724,7 @@ begin RAM_WEni <= '1'; RAM_OEni <= '1'; + -- Whenever running in RAM ensure the mainboard is disabled to prevent decoder propagation delay glitches. when "00001" => RAM_CSni <= '0'; @@ -1062,10 +1136,11 @@ begin else 'Z'; -- Bus control logic. - SYS_BUSACKn <= '1' when Z80_BUSACKn = '0' and MB_BUSRQn = '0' + SYS_BUSACKni<= '1' when Z80_BUSACKn = '0' and MB_BUSRQn = '0' else '0' when DISABLE_BUSn = '0' or (KEY_SUBSTITUTE = '1' and Z80_MREQn = '0') or (Z80_BUSACKn = '0' and CTL_BUSACKn = '0') else '1'; + SYS_BUSACKn <= SYS_BUSACKni; Z80_BUSRQn <= '0' when SYS_BUSRQn = '0' or CTL_BUSRQn = '0' or MB_BUSRQn = '0' else '1'; @@ -1144,12 +1219,6 @@ begin RAM_WEn <= RAM_WEni when Z80_MREQn = '0' else '1'; - -- For the video card, additional address lines are needed to address the banked video memory. The CPLD is acting as a buffer for these lines. - VADDR <= Z80_ADDR(13 downto 11) when Z80_BUSACKn = '1' - else (others => 'Z'); - VMEM_CSn <= '0' when unsigned(Z80_ADDR(15 downto 0)) >= X"E000" and unsigned(Z80_ADDR(15 downto 0)) <= X"FFFF" and Z80_MREQn = '0' and Z80_RFSHn = '1' - else '1'; - -- Mainboard WAIT State Generator S-R latch 4. -- NB: V2.1 design doesnt need the wait state generator as the mapping is done in hardware. -- diff --git a/CPLD/tranZPUterSW_Toplevel.vhd b/CPLD/tranZPUterSW_Toplevel.vhd index 6a74155..d6f2bac 100644 --- a/CPLD/tranZPUterSW_Toplevel.vhd +++ b/CPLD/tranZPUterSW_Toplevel.vhd @@ -39,7 +39,6 @@ entity tranZPUterSW is Z80_HI_ADDR : out std_logic_vector(18 downto 15); Z80_ADDR : inout std_logic_vector(15 downto 0); Z80_DATA : inout std_logic_vector(7 downto 0); - VADDR : out std_logic_vector(13 downto 11); -- Z80 Control signals. Z80_BUSRQn : out std_logic; @@ -79,7 +78,11 @@ entity tranZPUterSW is RAM_WEn : out std_logic; -- Graphics Board I/O and Memory Select. - VMEM_CSn : out std_logic; + -- VMEM_CSn : out std_logic; + -- VADDR : out std_logic_vector(13 downto 11); + -- VIORQn : out std_logic; + INCLK : in std_logic; + OUTDATA : out std_logic_vector(3 downto 0); -- Clocks, system and K64F generated. SYSCLK : in std_logic; @@ -114,7 +117,6 @@ begin Z80_HI_ADDR => Z80_HI_ADDR, Z80_ADDR => Z80_ADDR, Z80_DATA => Z80_DATA, - VADDR => VADDR, -- Z80 Control signals. Z80_BUSRQn => Z80_BUSRQn, @@ -154,7 +156,11 @@ begin RAM_WEn => RAM_WEn, -- Graphics Board I/O and Memory Select. - VMEM_CSn => VMEM_CSn, + -- VMEM_CSn => VMEM_CSn, + -- VADDR => VADDR, + -- VIORQn => VIORQn, + INCLK => INCLK, + OUTDATA => OUTDATA, -- Clocks, system and K64F generated. SYSCLK => SYSCLK, diff --git a/software/asm/include/CPM_Definitions.asm b/software/asm/include/CPM_Definitions.asm index 90a37d2..5debe8f 100644 --- a/software/asm/include/CPM_Definitions.asm +++ b/software/asm/include/CPM_Definitions.asm @@ -314,29 +314,30 @@ TZSVC_FTYPE_BAS: EQU 2 ; File TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype. TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted. -TZSVC_CMD_READDIR: EQU 01H ; Service command to open a directory and return the first block of entries. -TZSVC_CMD_NEXTDIR: EQU 02H ; Service command to return the next block of an open directory. -TZSVC_CMD_READFILE: EQU 03H ; Service command to open a file and return the first block. -TZSVC_CMD_NEXTREADFILE: EQU 04H ; Service command to return the next block of an open file. -TZSVC_CMD_WRITEFILE: EQU 05H ; Service command to create a file and save the first block. -TZSVC_CMD_NEXTWRITEFILE:EQU 06H ; Service command to write the next block to the open file. -TZSVC_CMD_CLOSE: EQU 07H ; Service command to close any open file or directory. -TZSVC_CMD_LOADFILE: EQU 08H ; Service command to load a file directly into tranZPUter memory. -TZSVC_CMD_SAVEFILE: EQU 09H ; Service command to save a file directly from tranZPUter memory. -TZSVC_CMD_ERASEFILE: EQU 0aH ; Service command to erase a file on the SD card. -TZSVC_CMD_CHANGEDIR: EQU 0bH ; Service command to change the active directory on the SD card. -TZSVC_CMD_LOAD40BIOS: EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded. -TZSVC_CMD_LOAD80BIOS: EQU 21H ; Service command requesting that the 80 column version of the SA1510 BIOS is loaded. -TZSVC_CMD_LOAD700BIOS40:EQU 22H ; Service command requesting that the MZ700 1Z-013A 40 column BIOS is loaded. -TZSVC_CMD_LOAD700BIOS80:EQU 23H ; Service command requesting that the MZ700 1Z-013A 80 column patched BIOS is loaded. -TZSVC_CMD_LOAD80BIPL: EQU 24H ; Service command requesting the MZ-80B IPL is loaded. -TZSVC_CMD_LOADBDOS: EQU 30H ; Service command to reload CPM BDOS+CCP. -TZSVC_CMD_ADDSDDRIVE: EQU 31H ; Service command to attach a CPM disk to a drive number. -TZSVC_CMD_READSDDRIVE: EQU 32H ; Service command to read an attached SD file as a CPM disk drive. -TZSVC_CMD_WRITESDDRIVE: EQU 33H ; Service command to write to a CPM disk drive which is an attached SD file. +TZSVC_CMD_READDIR EQU 01H ; Service command to open a directory and return the first block of entries. +TZSVC_CMD_NEXTDIR EQU 02H ; Service command to return the next block of an open directory. +TZSVC_CMD_READFILE EQU 03H ; Service command to open a file and return the first block. +TZSVC_CMD_NEXTREADFILE EQU 04H ; Service command to return the next block of an open file. +TZSVC_CMD_WRITEFILE EQU 05H ; Service command to create a file and save the first block. +TZSVC_CMD_NEXTWRITEFILE EQU 06H ; Service command to write the next block to the open file. +TZSVC_CMD_CLOSE EQU 07H ; Service command to close any open file or directory. +TZSVC_CMD_LOADFILE EQU 08H ; Service command to load a file directly into tranZPUter memory. +TZSVC_CMD_SAVEFILE EQU 09H ; Service command to save a file directly from tranZPUter memory. +TZSVC_CMD_ERASEFILE EQU 0aH ; Service command to erase a file on the SD card. +TZSVC_CMD_CHANGEDIR EQU 0bH ; Service command to change the active directory on the SD card. +TZSVC_CMD_LOAD40BIOS EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded. +TZSVC_CMD_LOAD80BIOS EQU 21H ; Service command requesting that the 80 column version of the SA1510 BIOS is loaded. +TZSVC_CMD_LOAD700BIOS40 EQU 22H ; Service command requesting that the MZ700 1Z-013A 40 column BIOS is loaded. +TZSVC_CMD_LOAD700BIOS80 EQU 23H ; Service command requesting that the MZ700 1Z-013A 80 column patched BIOS is loaded. +TZSVC_CMD_LOAD80BIPL EQU 24H ; Service command requesting the MZ-80B IPL is loaded. +TZSVC_CMD_LOADBDOS EQU 30H ; Service command to reload CPM BDOS+CCP. +TZSVC_CMD_ADDSDDRIVE EQU 31H ; Service command to attach a CPM disk to a drive number. +TZSVC_CMD_READSDDRIVE EQU 32H ; Service command to read an attached SD file as a CPM disk drive. +TZSVC_CMD_WRITESDDRIVE EQU 33H ; Service command to write to a CPM disk drive which is an attached SD file. TZSVC_CMD_CPU_BASEFREQ EQU 40H ; Service command to switch to the mainboard frequency. TZSVC_CMD_CPU_ALTFREQ EQU 41H ; Service command to switch to the alternate frequency provided by the K64F. TZSVC_CMD_CPU_CHGFREQ EQU 42H ; Service command to set the alternate frequency in hertz. -TZSVC_STATUS_OK: EQU 000H ; Flag to indicate the K64F processing completed successfully. -TZSVC_STATUS_REQUEST: EQU 0FEH ; Flag to indicate the Z80 has made a request to the K64F. -TZSVC_STATUS_PROCESSING:EQU 0FFH ; Flag to indicate the K64F is processing a command. +TZSVC_CMD_EXIT EQU 07FH ; Service command to terminate TZFS and restart the machine in original mode. +TZSVC_STATUS_OK EQU 000H ; Flag to indicate the K64F processing completed successfully. +TZSVC_STATUS_REQUEST EQU 0FEH ; Flag to indicate the Z80 has made a request to the K64F. +TZSVC_STATUS_PROCESSING EQU 0FFH ; Flag to indicate the K64F is processing a command. diff --git a/software/asm/include/TZFS_Definitions.asm b/software/asm/include/TZFS_Definitions.asm index 94dd1b1..04b1e03 100644 --- a/software/asm/include/TZFS_Definitions.asm +++ b/software/asm/include/TZFS_Definitions.asm @@ -394,32 +394,33 @@ TZSVC_FILENAME: DS virtual TZSVCFILESZ ; Filen TZSVCWILDC: DS virtual TZSVCWILDSZ ; Directory wildcard for file pattern matching. TZSVCSECTOR: DS virtual TZSVCSECSIZE ; Service command sector - to store directory entries, file sector read or writes. -TZSVC_CMD_READDIR: EQU 01H ; Service command to open a directory and return the first block of entries. -TZSVC_CMD_NEXTDIR: EQU 02H ; Service command to return the next block of an open directory. -TZSVC_CMD_READFILE: EQU 03H ; Service command to open a file and return the first block. -TZSVC_CMD_NEXTREADFILE: EQU 04H ; Service command to return the next block of an open file. -TZSVC_CMD_WRITEFILE: EQU 05H ; Service command to create a file and save the first block. -TZSVC_CMD_NEXTWRITEFILE:EQU 06H ; Service command to write the next block to the open file. -TZSVC_CMD_CLOSE: EQU 07H ; Service command to close any open file or directory. -TZSVC_CMD_LOADFILE: EQU 08H ; Service command to load a file directly into tranZPUter memory. -TZSVC_CMD_SAVEFILE: EQU 09H ; Service command to save a file directly from tranZPUter memory. -TZSVC_CMD_ERASEFILE: EQU 0aH ; Service command to erase a file on the SD card. -TZSVC_CMD_CHANGEDIR: EQU 0bH ; Service command to change the active directory on the SD card. -TZSVC_CMD_LOAD40BIOS: EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded. -TZSVC_CMD_LOAD80BIOS: EQU 21H ; Service command requesting that the 80 column version of the SA1510 BIOS is loaded. -TZSVC_CMD_LOAD700BIOS40:EQU 22H ; Service command requesting that the MZ700 1Z-013A 40 column BIOS is loaded. -TZSVC_CMD_LOAD700BIOS80:EQU 23H ; Service command requesting that the MZ700 1Z-013A 80 column patched BIOS is loaded. -TZSVC_CMD_LOAD80BIPL: EQU 24H ; Service command requesting the MZ-80B IPL is loaded. -TZSVC_CMD_LOADBDOS: EQU 30H ; Service command to reload CPM BDOS+CCP. -TZSVC_CMD_ADDSDDRIVE: EQU 31H ; Service command to attach a CPM disk to a drive number. -TZSVC_CMD_READSDDRIVE: EQU 32H ; Service command to read an attached SD file as a CPM disk drive. -TZSVC_CMD_WRITESDDRIVE: EQU 33H ; Service command to write to a CPM disk drive which is an attached SD file. +TZSVC_CMD_READDIR EQU 01H ; Service command to open a directory and return the first block of entries. +TZSVC_CMD_NEXTDIR EQU 02H ; Service command to return the next block of an open directory. +TZSVC_CMD_READFILE EQU 03H ; Service command to open a file and return the first block. +TZSVC_CMD_NEXTREADFILE EQU 04H ; Service command to return the next block of an open file. +TZSVC_CMD_WRITEFILE EQU 05H ; Service command to create a file and save the first block. +TZSVC_CMD_NEXTWRITEFILE EQU 06H ; Service command to write the next block to the open file. +TZSVC_CMD_CLOSE EQU 07H ; Service command to close any open file or directory. +TZSVC_CMD_LOADFILE EQU 08H ; Service command to load a file directly into tranZPUter memory. +TZSVC_CMD_SAVEFILE EQU 09H ; Service command to save a file directly from tranZPUter memory. +TZSVC_CMD_ERASEFILE EQU 0aH ; Service command to erase a file on the SD card. +TZSVC_CMD_CHANGEDIR EQU 0bH ; Service command to change the active directory on the SD card. +TZSVC_CMD_LOAD40BIOS EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded. +TZSVC_CMD_LOAD80BIOS EQU 21H ; Service command requesting that the 80 column version of the SA1510 BIOS is loaded. +TZSVC_CMD_LOAD700BIOS40 EQU 22H ; Service command requesting that the MZ700 1Z-013A 40 column BIOS is loaded. +TZSVC_CMD_LOAD700BIOS80 EQU 23H ; Service command requesting that the MZ700 1Z-013A 80 column patched BIOS is loaded. +TZSVC_CMD_LOAD80BIPL EQU 24H ; Service command requesting the MZ-80B IPL is loaded. +TZSVC_CMD_LOADBDOS EQU 30H ; Service command to reload CPM BDOS+CCP. +TZSVC_CMD_ADDSDDRIVE EQU 31H ; Service command to attach a CPM disk to a drive number. +TZSVC_CMD_READSDDRIVE EQU 32H ; Service command to read an attached SD file as a CPM disk drive. +TZSVC_CMD_WRITESDDRIVE EQU 33H ; Service command to write to a CPM disk drive which is an attached SD file. TZSVC_CMD_CPU_BASEFREQ EQU 40H ; Service command to switch to the mainboard frequency. TZSVC_CMD_CPU_ALTFREQ EQU 41H ; Service command to switch to the alternate frequency provided by the K64F. TZSVC_CMD_CPU_CHGFREQ EQU 42H ; Service command to set the alternate frequency in hertz. -TZSVC_STATUS_OK: EQU 000H ; Flag to indicate the K64F processing completed successfully. -TZSVC_STATUS_REQUEST: EQU 0FEH ; Flag to indicate the Z80 has made a request to the K64F. -TZSVC_STATUS_PROCESSING:EQU 0FFH ; Flag to indicate the K64F is processing a command. +TZSVC_CMD_EXIT EQU 07FH ; Service command to terminate TZFS and restart the machine in original mode. +TZSVC_STATUS_OK EQU 000H ; Flag to indicate the K64F processing completed successfully. +TZSVC_STATUS_REQUEST EQU 0FEH ; Flag to indicate the Z80 has made a request to the K64F. +TZSVC_STATUS_PROCESSING EQU 0FFH ; Flag to indicate the K64F is processing a command. ; Quickdisk work area diff --git a/software/asm/tzfs.asm b/software/asm/tzfs.asm index e73495d..4b585c4 100644 --- a/software/asm/tzfs.asm +++ b/software/asm/tzfs.asm @@ -227,6 +227,9 @@ CMDTABLE: DB 000H | 000H | 000H | 001H ; Bit 2 DB 000H | 000H | 000H | 002H DB "EC" ; Erase file. DW ERASESD + DB 000H | 000H | 000H | 002H + DB "EX" ; Exit out of TZFS to original Monitor. + DW EXITTZFS DB 000H | 000H | 000H | 004H DB "FREQ" ; Set or change the CPU frequency. DW SETFREQ @@ -594,6 +597,17 @@ BADNUMERR: LD DE,MSGBADNUM BADNUM2: CALL ?PRINTMSG RET + ; Exit out of TZFS - This entails clearing the DRAM as it wont have been refreshed, switching memory mode and then branching to the monitor start entry point. + ; This is all done by the I/O processor as we need to be in memory mode 0 where all tranZPUter memory is paged out. + ; +EXITTZFS: LD A,TZSVC_CMD_EXIT ; Request the I/O processor restarts the host in original mode. + CALL SVC_CMD + OR A + JP Z,MONIT + LD DE,MSGFAILEXIT ; Print message if the I/O processor cant process the command. + CALL ?PRINTMSG + RET ; Return status to caller, 0 = success. + ; ; Memory correction ; command 'M' diff --git a/software/asm/tzfs_bank2.asm b/software/asm/tzfs_bank2.asm index 2cc3486..09abbe7 100644 --- a/software/asm/tzfs_bank2.asm +++ b/software/asm/tzfs_bank2.asm @@ -355,6 +355,7 @@ HELPSCR: ; "--------- 40 column width -------------" DB "CPM - Load CPM.", 00DH DB "DXXXX[YYYY] - dump mem XXXX to YYYY.", 00DH DB "EC[fn]- erase file, fn=No or Filename", 00DH + DB "EX - Exit TZFS, reset as original.", 00DH DB "F[x] - boot fd drive x.", 00DH DB "FREQ[n]-set CPU to nKHz, 0 for default.", 00DH DB "H - this help screen.", 00DH @@ -413,6 +414,7 @@ MSGSD2TERR: DB "Copy from SD to Tape Failed", MSGT2SDOK: DB "Success, Tape to SD done.", 00DH, 000H MSGSD2TOK: DB "Success, SD to Tape done.", 00DH, 000H MSGFAILBIOS:DB "Failed to load alternate BIOS!", 00DH, 000H +MSGFAILEXIT:DB "TZFS exit failed, I/O proc error!", 00DH, 000H MSGFREQERR: DB "Error, failed to change frequency!", 00DH, 000H MSGBADNUM: DB "Error, bad number supplied!", 00DH, 000H ; diff --git a/software/roms/tzfs.rom b/software/roms/tzfs.rom index 523ea60f64df2ec401eae9aaebff43382db9d267..d9f693f6f65df42f202fac9aa262e5a924340cb5 100644 GIT binary patch delta 1097 zcmZuwZ%i9y7{B*=E4!AJzL3GC+2-3?7Pb`!7l#$+1!(JJDX?(O!rX_6Pz}kllEPvo z#FZE)TVh0C#|MZXh%wPGo7xD=k}Wc`#G83d2$=z6vOgcDbUnwl(>5u+`raY)i}&I3 zd!Fa_-1B?>TyhE|r@)j7ZhidcQE(r>2z;)(oF#Cq3*R zJa{#&_aRW@()TqS*4=(TSxlprntk;7E+(v*elPVS@*v%`hb*R=Ek{8r$xT>lC(~;Z zBbM)q6B!8+ZEfK;!@y}=w>|jkqcrk*E~w+z5ht|?tkiCVQRVpcAEgcx0tK#?1Pd&c zNb(OwI=7WRZ`vf9ULg}{lE8TT2xkHtKllP~1l>$EU~Vjpz5T2`@y*SPnnKBb(Zj)D zmw_784i5_rw8vwGglFI|{(^7eidpyuzRUYT5eqgy+qQvwZ6ck@`?kF;pK9+ce1Aop z$w*~!HX{LX-AT@7e=TNPXEF;7PW2=Q$8^wC0hwx5<{crlFTKR%TjV#cL0j7EbGdhTYtI8 z2^_Uwz`DI#aOq?xlOR7>V7-B858KcjJfP#j%EQh!Gx#!%5-S5cb^LXu&))kl4-V+~ z_sXx>5gmWBV-&oHD;)0v4WDQKYg^LH=i~ z^j;=ai5HWqvGC2x|9!{?i$;B_k)_1hjN<;#RGOCTTN&L?#oC~-S#^s{e%4xNGYiN; zdI~1k246Q$Z13htS@WjTM&`37plSmp{I|0n%;Q~90{8Gq_`LO}4Vv*dbqVgQa&@%J zodMK{!m<8Av}wrgjfW03H{mal*GYe7gto%ez_(FXeW;K6s56up8by)UUXgt$9vz8} zqW%#Six0gubf*9GbE#T)m@}g&YVh9dA37Z!^r6m!J!m){8$i)`JQh!#s^9PV2R@b3 A`2YX_ delta 974 zcmZuvU1$_n7`=CPvT=X1yEh?qNMoGcMqR6=b|}d5!ac@D`5=V=06tAkgWeROc z)fC&}9lI*>LR*~Vahq!5_EQUZ2Z0}OP3@&D?z)r}lUuryLrY>(=}Js3;$-F--uXNW z3;0dk2(JtESb}EZ9bu{fJ%Um$CfhWR<1ihLCtW zty#NdTvcPOk8ZZYu^79m$qiNO`58Yb%{ujZUYFSuZBre)nr?7y!y|jk(kXG!_1YKO zEJaG`7iCbVGSg=#?jl55VC9NL>~~GBkDN3HuE`>8mIV5t-Io0W*Y4032V#|U7bO=N zDzem{D%-1N*nq}*;KGU?(E&A{eU0M<-VCEkj3%f1d*AT&eLK}}+T@rL5lN!mMp2_B zA`lzZMcjmW5UGW6PlGs@B>|ZC#PA$My)i*wf^M&Z--ol_wGCgIpHBRESvjZEk}{@K ztSp4s{_M|l*`{;)L^NdV7D>N_H^H%)uY&Nq!UbURUm3xQrTOGvq>vd`ZmP& zzRm%QKex@YY{7tQ9`-orGaA z1eUKux=>`*sE^%nk#B6o=O~lUlkbbL&%ZgOI?WGwm$?ynP=qV~jlReK@`zr9Km1<{ zg(8ere2o229yo$^7z#93jxKSt)7L4M=EL6^?kctwGJ!)Yc@$9>EvZd|2A`IEZnIPp zggwF4_MTEf$s^cfN(LE)^T88GUkZ*Joo?jFJY?LKQJ!PQ0Z64Kshs`KYWW{IVNj2f zGVJ7+Uw(Cwmt0)Fi0=*YG}Q1J$EikrFBBaw&3ehr|B~6H*)*n4$N|>5=zucfx4+ec z<(S-gr|4y0WgWoX&KKbC&>GwgwS?l+u$#Q=?k#Y|So$of4#I6Y0?*~`=>y^IV)~~w K>mod%-hTi+cCzgN diff --git a/software/tools/assemble_roms.sh b/software/tools/assemble_roms.sh index 7e7a083..4519f03 100755 --- a/software/tools/assemble_roms.sh +++ b/software/tools/assemble_roms.sh @@ -32,7 +32,7 @@ ROOTDIR=../../tranZPUter TOOLDIR=${ROOTDIR}/software/tools JARDIR=${ROOTDIR}/software/tools ASM=glass-0.5.jar -BUILDROMLIST="MZ80AFI monitor_SA1510 monitor_80c_SA1510 monitor_1Z-013A monitor_80c_1Z-013A monitor_1Z-013A-KM monitor_80c_1Z-013A-KM MZ80B_IPL" +BUILDROMLIST="MZ80AFI monitor_SA1510 monitor_80c_SA1510 monitor_1Z-013A monitor_80c_1Z-013A monitor_1Z-013A-KM monitor_80c_1Z-013A-KM MZ80B_IPL" #BUILDMZFLIST="hi-ramcheck sharpmz-test" BUILDMZFLIST="BASIC sharpmz-test" ASMDIR=${ROOTDIR}/software/asm