Add Z80 assembly sources, ROMs and build tools to repository

Un-ignore software/asm/, software/tools/, and software/roms/ so that
CI/CD builds on Jenkins can assemble Z80 ROMs, TZFS, and CP/M from
source. Previously these files were only available on the dev machine.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Philip Smart
2026-03-14 15:42:50 +00:00
parent e3771cdf9c
commit 066e049538
83 changed files with 98262 additions and 0 deletions

21
.gitignore vendored
View File

@@ -1743,3 +1743,24 @@ software/FusionX/src/z80drv/src/z80driver.c.bad
software/FusionX/src/z80drv/src/z80vhw_rfs.c.bad
CPLD/v1.0/MZ2000.old/
# Un-ignore files needed for CI/CD builds
!software/asm/
!software/asm/*.asm
!software/asm/include/
!software/asm/include/*.asm
!software/tools/
!software/tools/assemble_*.sh
!software/tools/copytosd.sh
!software/tools/make_cpmdisks.sh
!software/tools/glass*.jar
!software/tools/dz80
!software/tools/dz80_v20
!software/tools/nasconv
!software/tools/mzftool.pl
!software/tools/flashmmcfg
!software/tmp/
!software/roms/
!software/roms/*.rom
!software/roms/*.bin
!software/roms/*.BIN
!software/roms/*.ori

1
software/asm/1Z001M.asm Symbolic link
View File

@@ -0,0 +1 @@
/srv2/SharpSoft/MZ-2000/ASM/1Z001M.asm

3303
software/asm/1z-013a-km.asm Normal file

File diff suppressed because it is too large Load Diff

25545
software/asm/5z009-1b.asm Normal file

File diff suppressed because it is too large Load Diff

1658
software/asm/SFD700.asm Normal file

File diff suppressed because it is too large Load Diff

2298
software/asm/asm.asm Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1615
software/asm/cbios.asm Normal file

File diff suppressed because it is too large Load Diff

3908
software/asm/cbiosII.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: cpm22-bios.asm
;- Created: January 2020
;- Author(s): Philip Smart
;- Description: CPM BIOS for CPM v2.23 on the Sharp MZ80A with the Rom Filing System.
;- Most of the code is stored in the ROM based CBIOS which is part of the
;- Rom Filing System upgrade. Declarations in this file are for tables
;- which need to reside in RAM.
;-
;- Credits: Some of the comments and parts of the deblocking/blocking algorithm come from the
; Z80-MBC2 project, (C) SuperFabius.
;- Copyright: (c) 2020 Philip Smart <philip.smart@net2net.org>
;-
;- History: January 2020 - Initial creation.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
ORG CPMBIOS
; All CBIOS code, tables and variables are now stored in the cbios.asm and cbiosII.asm as a seperate assembled
; binary.

3764
software/asm/cpm22.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
BUILD_VERSION EQU 3

View File

@@ -0,0 +1 @@
BUILD_VERSION EQU 2

View File

@@ -0,0 +1,536 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: CPM_Definitions.asm
;- Created: January 2020
;- Author(s): Philip Smart
;- Description: Sharp MZ series CPM v2.23
;- Definitions for the Sharp MZ80A CPM v2.23 OS used in the RFS
;-
;- Credits:
;- Copyright: (c) 2019-21 Philip Smart <philip.smart@net2net.org>
;-
;- History: Jan 2020 - Initial version.
; May 2020 - Advent of the new RFS PCB v2.0, quite a few changes to accommodate the
; additional and different hardware. The SPI is now onboard the PCB and
; not using the printer interface card.
; May 2020 - Cut from the RFS version of CPM for the tranZPUter SW board.
;- Apr 2021 - Updates backported from the RFS version of CPM.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;-----------------------------------------------
; Features.
;-----------------------------------------------
; CPM for MZ-700 with with Video Module and 80 Columns display.
IF BUILD_VERSION = 0
BUILD_VIDEOMODULE EQU 1 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_MZ80A EQU 0 ; Build for the Sharp MZ-80A base hardware.
BUILD_MZ700 EQU 1 ; Build for the Sharp MZ-700 base hardware.
BUILD_80C EQU 1 ; Build for an 80 column (Video Module or 40/80 Colour Card) equipped machine, 0 = standard 40 column.
ENDIF
; CPM for MZ-80A with with Video Module (if not present expects 40/80 Colour Board) and 80 Columns display.
IF BUILD_VERSION = 1
BUILD_VIDEOMODULE EQU 1 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_MZ80A EQU 1 ; Build for the Sharp MZ-80A base hardware.
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_80C EQU 1 ; Build for an 80 column (Video Module or 40/80 Colour Card) equipped machine, 0 = standard 40 column.
ENDIF
; CPM for MZ-80A with with standard 40 column display.
IF BUILD_VERSION = 2
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_MZ80A EQU 1 ; Build for the Sharp MZ-80A base hardware.
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_80C EQU 0 ; Build for an 80 column (Video Module or 40/80 Colour Card) equipped machine, 0 = standard 40 column.
ENDIF
;-----------------------------------------------
; Configurable settings.
;-----------------------------------------------
MAXRDRETRY EQU 002h
MAXWRRETRY EQU 002h
BLKSIZ EQU 4096 ; CP/M allocation size
HSTSIZ EQU 512 ; host disk sector size
HSTSPT EQU 32 ; host disk sectors/trk
HSTBLK EQU HSTSIZ/128 ; CP/M sects/host buff
CPMSPT EQU HSTBLK * HSTSPT ; CP/M sectors/track
SECMSK EQU HSTBLK-1 ; sector mask
WRALL EQU 0 ; write to allocated
WRDIR EQU 1 ; write to directory
WRUAL EQU 2 ; write to unallocated
TMRTICKINTV EQU 5 ; Number of 0.010mSec ticks per interrupt, ie. resolution of RTC.
MTROFFMSECS EQU 100 ; Time from last access to motor being switched off in seconds in TMRTICKINTV ticks.
IF BUILD_80C = 1
COLW EQU 80 ; Width of the display screen (ie. columns).
ELSE
COLW EQU 40 ; Width of the display screen (ie. columns).
ENDIF
ROW EQU 25 ; Number of rows on display screen.
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.
; BIOS equates
MAXDISKS EQU 7 ; Max number of Drives supported
KEYBUFSIZE EQU 64 ; Ensure this is a power of 2, max size 256.
; Debugging
ENADEBUG EQU 1 ; Enable debugging logic, 1 = enable, 0 = disable
;-----------------------------------------------
; Entry/compilation start points.
;-----------------------------------------------
MROMADDR EQU 00000H ; Start of SA1510 Monitor ROM.
CBASE EQU 0DA00H
CPMCCP EQU CBASE ; CP/M System entry
CPMBDOS EQU CPMCCP + 0806H ; BDOS entry
CPMBIOS EQU CPMCCP + 01600H ; Original CPM22 BIOS entry
CBIOSSTART EQU CPMBIOS ; Start of the actual CBIOS code.
CPMCOPYRMSG EQU CBASE+8 ; Copyright message stored in CP/M binary.
BOOT EQU CBIOSSTART + 0
WBOOT EQU CBIOSSTART + 3
WBOOTE EQU CBIOSSTART + 3
CONST EQU CBIOSSTART + 6
CONIN EQU CBIOSSTART + 9
CONOUT EQU CBIOSSTART + 12
LIST EQU CBIOSSTART + 15
PUNCH EQU CBIOSSTART + 18
READER EQU CBIOSSTART + 21
HOME EQU CBIOSSTART + 24
SELDSK EQU CBIOSSTART + 27
SETTRK EQU CBIOSSTART + 30
SETSEC EQU CBIOSSTART + 33
SETDMA EQU CBIOSSTART + 36
READ EQU CBIOSSTART + 39
WRITE EQU CBIOSSTART + 42
FRSTAT EQU CBIOSSTART + 45
SECTRN EQU CBIOSSTART + 48
QDEBUG EQU CBIOSSTART + 51
CCP EQU CBASE
CCPCLRBUF EQU CBASE + 3
IOBYT EQU 00003H ; IOBYTE address
CDISK EQU 00004H ; Address of Current drive name and user number
CPMUSERDMA EQU 00080h ; Default CPM User DMA address.
DPSIZE EQU 16 ; Size of a Disk Parameter Block
; Old Flash RAM mapping
;FDCJMP1BLK EQU 0F3C0H ; The memory mapping FlashRAM only has 64byte granularity so we need to block 64 bytes per FDC vector.
;FDCJMP1 EQU 0F3FEH ; ROM paged vector 1.
;FDCJMP2BLK EQU 0F7C0H ; The memory mapping FlashRAM only has 64byte granularity so we need to block 64 bytes per FDC vector.
;FDCJMP2 EQU 0F7FEH ; ROM paged vector 2.
; New CPLD mapping
FDCJMP1BLK EQU 0F3FEH ; The memory mapping CPLD has 1byte granularity so we need to block just 2 bytes per FDC vector.
FDCJMP1 EQU 0F3FEH ; ROM paged vector 1.
FDCJMP2BLK EQU 0F7FEH ; The memory mapping CPLD has 1byte granularity so we need to block just 2 bytes per FDC vector.
FDCJMP2 EQU 0F7FEH ; ROM paged vector 2.
;-----------------------------------------------
; Memory mapped ports in hardware.
;-----------------------------------------------
SCRN: EQU 0D000H
ARAM: EQU 0D800H
DSPCTL: EQU 0DFFFH ; Screen 40/80 select register (bit 7)
KEYPA: EQU 0E000h
KEYPB: EQU 0E001h
KEYPC: EQU 0E002h
KEYPF: EQU 0E003h
CSTR: EQU 0E002h
CSTPT: EQU 0E003h
CONT0: EQU 0E004h
CONT1: EQU 0E005h
CONT2: EQU 0E006h
CONTF: EQU 0E007h
SUNDG: EQU 0E008h
TEMP: EQU 0E008h
MEMSW: EQU 0E00CH
MEMSWR: EQU 0E010H
INVDSP: EQU 0E014H
NRMDSP: EQU 0E015H
SCLDSP: EQU 0E200H
SCLBASE: EQU 0E2H
;-----------------------------------------------
; IO ports in hardware and values.
;-----------------------------------------------
MMCFG EQU 060H ; Memory management configuration latch.
SETXMHZ EQU 062H ; Select the alternate clock frequency.
SET2MHZ EQU 064H ; Select the system 2MHz clock frequency.
CLKSELRD EQU 066H ; Read clock selected setting, 0 = 2MHz, 1 = XMHz
SVCREQ EQU 068H ; I/O Processor service request.
CPLDSTATUS EQU 06BH ; Version 2.1 CPLD status register.
CPUCFG EQU 06CH ; Version 2.2 CPU configuration register.
CPUSTATUS EQU 06CH ; Version 2.2 CPU runtime status register.
CPUINFO EQU 06DH ; Version 2.2 CPU information register.
CPLDCFG EQU 06EH ; Version 2.1 CPLD configuration register.
CPLDINFO EQU 06FH ; Version 2.1 CPLD version information register.
VMPNUM EQU 0A0H ; Set the parameter number to update.
VMPLBYTE EQU 0A1H ; Update the lower selected parameter byte.
VMPUBYTE EQU 0A2H ; Update the upper selected parameter byte.
PALSLCTOFF EQU 0A3H ; set the palette slot Off position to be adjusted.
PALSLCTON EQU 0A4H ; set the palette slot On position to be adjusted.
PALSETRED EQU 0A5H ; set the red palette value according to the PALETTE_PARAM_SEL address.
PALSETGREEN EQU 0A6H ; set the green palette value according to the PALETTE_PARAM_SEL address.
PALSETBLUE EQU 0A7H ; set the blue palette value according to the PALETTE_PARAM_SEL address.
VMPALETTE EQU 0B0H ; Select Palette:
; 0xB0 sets the palette. The Video Module supports 4 bit per colour output but there is only enough RAM for 1 bit per colour so the pallette is used to change the colours output.
; Bits [7:0] defines the pallete number. This indexes a lookup table which contains the required 4bit output per 1bit input.
; GPU:
GPUPARAM EQU 0B2H ; 0xB2 set parameters. Store parameters in a long word to be used by the graphics command processor.
; The parameter word is 128 bit and each write to the parameter word shifts left by 8 bits and adds the new byte at bits 7:0.
GPUCMD EQU 0B3H ; 0xB3 set the graphics processor unit commands.
GPUSTATUS EQU 0B3H ; [7;1] - FSM state, [0] - 1 = busy, 0 = idle
; Bits [5:0] - 0 = Reset parameters.
; 1 = Clear to val. Start Location (16 bit), End Location (16 bit), Red Filter, Green Filter, Blue Filter
;
VMCTRL EQU 0B8H ; Video Module control register. [2:0] - 000 (default) = MZ80A, 001 = MZ-700, 010 = MZ800, 011 = MZ80B, 100 = MZ80K, 101 = MZ80C, 110 = MZ1200, 111 = MZ2000. [3] = 0 - 40 col, 1 - 80 col.
VMGRMODE EQU 0B9H ; Video Module graphics mode. 7/6 = Operator (00=OR,01=AND,10=NAND,11=XOR), 5=GRAM Output Enable, 4 = VRAM Output Enable, 3/2 = Write mode (00=Page 1:Red, 01=Page 2:Green, 10=Page 3:Blue, 11=Indirect), 1/0=Read mode (00=Page 1:Red, 01=Page2:Green, 10=Page 3:Blue, 11=Not used).
VMREDMASK EQU 0BAH ; Video Module Red bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMGREENMASK EQU 0BBH ; Video Module Green bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMBLUEMASK EQU 0BCH ; Video Module Blue bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMPAGE EQU 0BDH ; Video Module memory page register. [1:0] switches in 1 16Kb page (3 pages) of graphics ram to C000 - FFFF. Bits [1:0] = page, 00 = off, 01 = Red, 10 = Green, 11 = Blue. This overrides all MZ700/MZ80B page switching functions. [7] 0 - normal, 1 - switches in CGROM for upload at D000:DFFF.
VMVGATTR EQU 0BEH ; Select VGA Border colour and attributes. Bit 2 = Red, 1 = Green, 0 = Blue.
VMVGAMODE EQU 0BFH ; Select VGA output mode. Bits [3:0] - Output mode.
GDCRTC EQU 0CFH ; MZ-800 CRTC control register
GDCMD EQU 0CEH ; MZ-800 CRTC Mode register
GDGRF EQU 0CDH ; MZ-800 read format register
GDGWF EQU 0CCH ; MZ-800 write format register
MMIO0 EQU 0E0H ; MZ-700/MZ-800 Memory Management Set 0
MMIO1 EQU 0E1H ; MZ-700/MZ-800 Memory Management Set 1
MMIO2 EQU 0E2H ; MZ-700/MZ-800 Memory Management Set 2
MMIO3 EQU 0E3H ; MZ-700/MZ-800 Memory Management Set 3
MMIO4 EQU 0E4H ; MZ-700/MZ-800 Memory Management Set 4
MMIO5 EQU 0E5H ; MZ-700/MZ-800 Memory Management Set 5
MMIO6 EQU 0E6H ; MZ-700/MZ-800 Memory Management Set 6
MMIO7 EQU 0E7H ; MZ-700/MZ-800 Memory Management Set 7
SYSCTRL EQU 0F0H ; System board control register. [2:0] - 000 MZ80A Mode, 2MHz CPU/Bus, 001 MZ80B Mode, 4MHz CPU/Bus, 010 MZ700 Mode, 3.54MHz CPU/Bus.
GRAMMODE EQU 0F4H ; MZ80B Graphics mode. Bit 0 = 0, Write to Graphics RAM I, Bit 0 = 1, Write to Graphics RAM II. Bit 1 = 1, blend Graphics RAM I output on display, Bit 2 = 1, blend Graphics RAM II output on display.
;-----------------------------------------------
; IO Registers
;-----------------------------------------------
FDC EQU 0D8h ; MB8866 IO Region 0D8h - 0DBh
FDC_CR EQU FDC + 000h ; Command Register
FDC_STR EQU FDC + 000h ; Status Register
FDC_TR EQU FDC + 001h ; Track Register
FDC_SCR EQU FDC + 002h ; Sector Register
FDC_DR EQU FDC + 003h ; Data Register
FDC_MOTOR EQU FDC + 004h ; DS[0-3] and Motor control. 4 drives DS= BIT 0 -> Bit 2 = Drive number, 2=1,1=0,0=0 DS0, 2=1,1=0,0=1 DS1 etc
; bit 7 = 1 MOTOR ON LOW (Active)
FDC_SIDE EQU FDC + 005h ; Side select, Bit 0 when set = SIDE SELECT LOW
;-----------------------------------------------
; Common character definitions.
;-----------------------------------------------
SCROLL EQU 001H ;Set scroll direction UP.
BELL EQU 007H
SPACE EQU 020H
TAB EQU 009H ;TAB ACROSS (8 SPACES FOR SD-BOARD)
CR EQU 00DH
LF EQU 00AH
FF EQU 00CH
CS EQU 0CH ; Clear screen
DELETE EQU 07FH
BACKS EQU 008H
SOH EQU 1 ; For XModem etc.
EOT EQU 4
ACK EQU 6
NAK EQU 015H
NUL EQU 000H
NULL EQU 000H
CTRL_A EQU 001H
CTRL_B EQU 002H
CTRL_C EQU 003H
CTRL_D EQU 004H
CTRL_E EQU 005H
CTRL_F EQU 006H
CTRL_G EQU 007H
CTRL_H EQU 008H
CTRL_I EQU 009H
CTRL_J EQU 00AH
CTRL_K EQU 00BH
CTRL_L EQU 00CH
CTRL_M EQU 00DH
CTRL_N EQU 00EH
CTRL_O EQU 00FH
CTRL_P EQU 010H
CTRL_Q EQU 011H
CTRL_R EQU 012H
CTRL_S EQU 013H
CTRL_T EQU 014H
CTRL_U EQU 015H
CTRL_V EQU 016H
CTRL_W EQU 017H
CTRL_X EQU 018H
CTRL_Y EQU 019H
CTRL_Z EQU 01AH
ESC EQU 01BH
CTRL_SLASH EQU 01CH
CTRL_LB EQU 01BH
CTRL_RB EQU 01DH
CTRL_CAPPA EQU 01EH
CTRL_UNDSCR EQU 01FH
CTRL_AT EQU 000H
NOKEY EQU 0F0H
CURSRIGHT EQU 0F1H
CURSLEFT EQU 0F2H
CURSUP EQU 0F3H
CURSDOWN EQU 0F4H
DBLZERO EQU 0F5H
INSERT EQU 0F6H
CLRKEY EQU 0F7H
HOMEKEY EQU 0F8H
BREAKKEY EQU 0FBH
GRAPHKEY EQU 0FCH
ALPHAKEY EQU 0FDH
; MMC/SD command (SPI mode)
CMD0 EQU 64 + 0 ; GO_IDLE_STATE
CMD1 EQU 64 + 1 ; SEND_OP_COND
ACMD41 EQU 0x40+41 ; SEND_OP_COND (SDC)
CMD8 EQU 64 + 8 ; SEND_IF_COND
CMD9 EQU 64 + 9 ; SEND_CSD
CMD10 EQU 64 + 10 ; SEND_CID
CMD12 EQU 64 + 12 ; STOP_TRANSMISSION
CMD13 EQU 64 + 13 ; SEND_STATUS
ACMD13 EQU 0x40+13 ; SD_STATUS (SDC)
CMD16 EQU 64 + 16 ; SET_BLOCKLEN
CMD17 EQU 64 + 17 ; READ_SINGLE_BLOCK
CMD18 EQU 64 + 18 ; READ_MULTIPLE_BLOCK
CMD23 EQU 64 + 23 ; SET_BLOCK_COUNT
ACMD23 EQU 0x40+23 ; SET_WR_BLK_ERASE_COUNT (SDC)
CMD24 EQU 64 + 24 ; WRITE_BLOCK
CMD25 EQU 64 + 25 ; WRITE_MULTIPLE_BLOCK
CMD32 EQU 64 + 32 ; ERASE_ER_BLK_START
CMD33 EQU 64 + 33 ; ERASE_ER_BLK_END
CMD38 EQU 64 + 38 ; ERASE
CMD55 EQU 64 + 55 ; APP_CMD
CMD58 EQU 64 + 58 ; READ_OCR
SD_SECSIZE EQU 512 ; Default size of an SD Sector
SD_RETRIES EQU 00100H ; Number of retries before giving up.
; Card type flags (CardType)
CT_MMC EQU 001H ; MMC ver 3
CT_SD1 EQU 002H ; SD ver 1
CT_SD2 EQU 004H ; SD ver 2
CT_SDC EQU CT_SD1|CT_SD2 ; SD
CT_BLOCK EQU 008H ; Block addressing
; Disk types.
DSKTYP_FDC EQU 0 ; Type of disk is a Floppy disk and handled by the FDC controller.
;DSKTYP_ROM EQU 1 ; Type of disk is a ROM and handled by the ROM methods.
DSKTYP_SDC EQU 2 ; Type of disk is an SD Card and handled by the SD Card methods.
DSKTYP_RAM EQU 3 ; Type of disk is a RAM Drive handled by ROM/RAM methods.
;
;-----------------------------------------------
; CPLD Configuration constants.
;-----------------------------------------------
MODE_MZ80K EQU 0 ; Set to MZ-80K mode.
MODE_MZ80C EQU 1 ; Set to MZ-80C mode.
MODE_MZ1200 EQU 2 ; Set to MZ-1200 mode.
MODE_MZ80A EQU 3 ; Set to MZ-80A mode (base mode on MZ-80A hardware).
MODE_MZ700 EQU 4 ; Set to MZ-700 mode (base mode on MZ-700 hardware).
MODE_MZ800 EQU 5 ; Set to MZ-800 mode.
MODE_MZ80B EQU 6 ; Set to MZ-80B mode.
MODE_MZ2000 EQU 7 ; Set to MZ-2000 mode.
MODE_VIDEO_FPGA EQU 8 ; Bit flag (bit 3) to switch CPLD into using the new FPGA video hardware.
MODE_RESET_PRESERVE EQU 080H ; Preserve register configuration through reset.
;-----------------------------------------------
; CPLD Command Instruction constants.
;-----------------------------------------------
CPLD_RESET_HOST EQU 1 ; CPLD level command to reset the host system.
CPLD_HOLD_HOST_BUS EQU 2 ; CPLD command to hold the host bus.
CPLD_RELEASE_HOST_BUS EQU 3 ; CPLD command to release the host bus.
;-----------------------------------------------
; FPGA CPU enhancement control bits.
;-----------------------------------------------
CPUMODE_SET_Z80 EQU 000H ; Set the CPU to the hard Z80.
CPUMODE_SET_T80 EQU 001H ; Set the CPU to the soft T80.
CPUMODE_SET_ZPU_EVO EQU 002H ; Set the CPU to the soft ZPU Evolution.
CPUMODE_SET_AAA EQU 004H ; Place holder for a future soft CPU.
CPUMODE_SET_BBB EQU 008H ; Place holder for a future soft CPU.
CPUMODE_SET_CCC EQU 010H ; Place holder for a future soft CPU.
CPUMODE_SET_DDD EQU 020H ; Place holder for a future soft CPU.
CPUMODE_IS_Z80 EQU 000H ; Status value to indicate if the hard Z80 available.
CPUMODE_IS_T80 EQU 001H ; Status value to indicate if the soft T80 available.
CPUMODE_IS_ZPU_EVO EQU 002H ; Status value to indicate if the soft ZPU Evolution available.
CPUMODE_IS_AAA EQU 004H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_BBB EQU 008H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_CCC EQU 010H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_DDD EQU 020H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_RESET_CPU EQU 080H ; Reset the soft CPU. Active high, when high the CPU is held in RESET, when low the CPU runs.
CPUMODE_IS_SOFT_AVAIL EQU 040H ; Marker to indicate if the underlying FPGA can support soft CPU's.
CPUMODE_IS_SOFT_MASK EQU 0C0H ; Mask to filter out the Soft CPU availability flags.
CPUMODE_IS_CPU_MASK EQU 03FH ; Mask to filter out which soft CPU's are available.
;-----------------------------------------------
; Video Module control bits.
;-----------------------------------------------
MODE_80CHAR EQU 010H ; Enable 80 character display.
MODE_COLOUR EQU 020H ; Enable colour display.
SYSMODE_MZ80A EQU 000H ; System board mode MZ80A, 2MHz CPU/Bus.
SYSMODE_MZ80B EQU 020H ; System board mode MZ80B, 4MHz CPU/Bus.
SYSMODE_MZ2000 EQU 020H ; System board mode MZ2000, 4MHz CPU/Bus.
SYSMODE_MZ700 EQU 042H ; System board mode MZ700, 3.54MHz CPU/Bus.
VMMODE_MZ80K EQU 000H ; Video mode = MZ80K
VMMODE_MZ80C EQU 001H ; Video mode = MZ80C
VMMODE_MZ1200 EQU 002H ; Video mode = MZ1200
VMMODE_MZ80A EQU 003H ; Video mode = MZ80A
VMMODE_MZ700 EQU 004H ; Video mode = MZ700
VMMODE_MZ800 EQU 005H ; Video mode = MZ800
VMMODE_MZ1500 EQU 006H ; Video mode = MZ1500
VMMODE_MZ80B EQU 007H ; Video mode = MZ80B
VMMODE_MZ2000 EQU 008H ; Video mode = MZ2000
VMMODE_MZ2200 EQU 009H ; Video mode = MZ2200
VMMODE_MZ2500 EQU 00AH ; Video mode = MZ2500
VMMODE_PCGRAM EQU 020H ; Enable PCG RAM.
VMMODE_VGA_OFF EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT50 EQU 001H ; Set VGA mode off, external monitor is driven by standard internal 50Hz signals.
VMMODE_VGA_640x480 EQU 002H ; Set external monitor to VGA 640x480 @ 60Hz mode.
VMMODE_VGA_800x600 EQU 003H ; Set external monitor to VGA 800x600 @ 60Hz mode.
;-----------------------------------------------
; GPU commands.
;-----------------------------------------------
GPUCLEARVRAM EQU 001H ; Clear the VRAM without updating attributes.
GPUCLEARVRAMCA EQU 002H ; Clear the VRAM/ARAM with given attribute byte,
GPUCLEARVRAMP EQU 003H ; Clear the VRAM/ARAM with parameters.
GPUCLEARGRAM EQU 081H ; Clear the entire Framebuffer.
GPUCLEARGRAMP EQU 082H ; Clear the Framebuffer according to parameters.
GPURESET EQU 0FFH ; Reset the GPU, return to idle state.
;-----------------------------------------------
; tranZPUter SW Memory Management modes
;-----------------------------------------------
TZMM_ENIOWAIT EQU 020H ; Memory management IO Wait State enable - insert a wait state when an IO operation to E0-FF is executed.
TZMM_ORIG EQU 000H ; Original Sharp MZ80A mode, no tranZPUter features are selected except the I/O control registers (default: 0x60-063).
TZMM_BOOT EQU 001H ; Original mode but E800-EFFF is mapped to tranZPUter RAM so TZFS can be booted.
TZMM_TZFS EQU 002H ; TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-FFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected.
TZMM_TZFS2 EQU 003H ; TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 1.
TZMM_TZFS3 EQU 004H ; TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 2.
TZMM_TZFS4 EQU 005H ; TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 3.
TZMM_CPM EQU 006H ; TZMM_ENIOWAIT ; CPM main memory configuration, all memory on the tranZPUter board, 64K block 4 selected. Special case for F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_CPM2 EQU 007H ; TZMM_ENIOWAIT ; CPM main memory configuration, F000-FFFF are on the tranZPUter board in block 4, 0040-CFFF and E800-EFFF are in block 5, mainboard for D000-DFFF (video), E000-E800 (Memory control) selected.
; Special case for 0000:003F (interrupt vectors) which resides in block 4, F3FE:F3FF & F7FE:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_COMPAT EQU 008H ; TZMM_ENIOWAIT ; Original mode but with main DRAM in Bank 0 to allow bootstrapping of programs from other machines such as the MZ700.
TZMM_HOSTACCESS EQU 009H ; TZMM_ENIOWAIT ; Mode to allow code running in Bank 0, address E800:FFFF to access host memory. Monitor ROM 0000-0FFF and Main DRAM 0x1000-0xD000, video and memory mapped I/O are on the host machine, User/Floppy ROM E800-FFFF are in tranZPUter memory.
TZMM_MZ700_0 EQU 00AH ; TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the mainboard.
TZMM_MZ700_1 EQU 00BH ; TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_2 EQU 00CH ; TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_3 EQU 00DH ; TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ700_4 EQU 00EH ; TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ800 EQU 00FH ; TZMM_ENIOWAIT ; MZ800 Mode - Tracks original hardware mode offering MZ700/MZ800 configurations.
TZMM_MZ2000 EQU 010H + TZMM_ENIOWAIT; ; MZ2000 Mode - Running on MZ2000 hardware, configuration set according to runtime configuration registers.
TZMM_FPGA EQU 015H ; TZMM_ENIOWAIT ; Open up access for the K64F to the FPGA resources such as memory. All other access to RAM or mainboard is blocked.
TZMM_TZPUM EQU 016H ; TZMM_ENIOWAIT ; Everything in on mainboard, no access to tranZPUter memory.
TZMM_TZPU EQU 017H ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU0 EQU 018H ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU1 EQU 019H ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 1 is selected.
;TZMM_TZPU2 EQU 01AH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 2 is selected.
;TZMM_TZPU3 EQU 01BH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 3 is selected.
;TZMM_TZPU4 EQU 01CH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 4 is selected.
;TZMM_TZPU5 EQU 01DH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 5 is selected.
;TZMM_TZPU6 EQU 01EH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 6 is selected.
;TZMM_TZPU7 EQU 01FH ; TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 7 is selected.
;-----------------------------------------------
; TZ File System Header (MZF)
;-----------------------------------------------
TZFS_ATRB: EQU 00000h ; Code Type, 01 = Machine Code.
TZFS_NAME: EQU 00001h ; Title/Name (17 bytes).
TZFS_SIZE: EQU 00012h ; Size of program.
TZFS_DTADR: EQU 00014h ; Load address of program.
TZFS_EXADR: EQU 00016h ; Exec address of program.
TZFS_COMNT: EQU 00018h ; Comment
TZFS_MZFLEN: EQU 128 ; Length of the MZF header.
TZFS_CMTLEN: EQU 104 ; Length of the comment field
;
; CPM constants
;
CPM_SD_SEC EQU 32
CPM_SD_TRK EQU 1024
CPM_SD_IMGSZ EQU CPM_SD_TRK * CPM_SD_SEC * SD_SECSIZE
;-----------------------------------------------
; BIOS WORK AREA (MZ80A)
;-----------------------------------------------
TZVARMEM: EQU 0F4A0H
TZSVCMEM: EQU 0F560H ; Start of a memory structure used to communicate with the K64F I/O processor for services such as disk access.
TZSVCSIZE: EQU 00280H ;
TZSVCDIRSZ: EQU 20 ; Size of the directory/file name.
TZSVCFILESZ: EQU 17 ; Size of a Sharp filename.
TZSVCLONGFILESZ: EQU 31 ; Size of a standard filename.
TZSVCLONGFMTSZ: EQU 20 ; Size of a formatted standard filename for use in directory listings.
TZSVCWILDSZ: EQU 20 ; Size of the wildcard.
TZSVCSECSIZE: EQU 512
TZSVCDIR_ENTSZ: EQU 32 ; Size of a directory entry.
TZSVCWAITIORETRIES: EQU 500 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
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_LOAD40ABIOS EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded.
TZSVC_CMD_LOAD80ABIOS 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_LOAD800BIOS EQU 25H ; Service command requesting that the MZ800 9Z-504M BIOS is loaded.
TZSVC_CMD_LOAD2000IPL EQU 26H ; Service command requesting the MZ-2000 IPL is loaded.
TZSVC_CMD_LOADTZFS EQU 2FH ; Service command requesting the loading of TZFS. This service is for machines which normally dont have a monitor BIOS. ie. MZ-80B/MZ-2000 and manually request TZFS.
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_CMD_CPU_SETZ80 EQU 50H ; Service command to switch to the external Z80 hard cpu.
TZSVC_CMD_CPU_SETT80 EQU 51H ; Service command to switch to the internal T80 soft cpu.
TZSVC_CMD_CPU_SETZPUEVO EQU 52H ; Service command to switch to the internal ZPU Evolution soft cpu.
TZSVC_CMD_EMU_SETMZ80K EQU 53H ; Service command to switch to the internal Sharp MZ Series Emulation of the MZ80K.
TZSVC_CMD_EMU_SETMZ80C EQU 54H ; "" "" "" MZ80C.
TZSVC_CMD_EMU_SETMZ1200 EQU 55H ; "" "" "" MZ1200.
TZSVC_CMD_EMU_SETMZ80A EQU 56H ; "" "" "" MZ80A.
TZSVC_CMD_EMU_SETMZ700 EQU 57H ; "" "" "" MZ700.
TZSVC_CMD_EMU_SETMZ800 EQU 58H ; "" "" "" MZ800.
TZSVC_CMD_EMU_SETMZ1500 EQU 59H ; "" "" "" MZ1500.
TZSVC_CMD_EMU_SETMZ80B EQU 5AH ; "" "" "" MZ80B.
TZSVC_CMD_EMU_SETMZ2000 EQU 5BH ; "" "" "" MZ2000.
TZSVC_CMD_EMU_SETMZ2200 EQU 5CH ; "" "" "" MZ2200.
TZSVC_CMD_EMU_SETMZ2500 EQU 5DH ; "" "" "" MZ2500.
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.

View File

@@ -0,0 +1,152 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: Macros.asm
;- Created: July 2019
;- Author(s): Philip Smart
;- Description: Z80 Assembler Macros Library
;- This is an aassembly language macro source file containing resusable code in the form
; of Macros for the various Z80 projects under development.
;- Credits:
;- Copyright: (c) 2018-2020 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
; the following is only to get the original length of 2048 bytes
ALIGN: MACRO ?boundary
DS ?boundary - 1 - ($ + ?boundary - 1) % ?boundary, 0FFh
ENDM
; the following is only to get the original length of 2048 bytes
ALIGN_NOPS: MACRO ?boundary
DS ?boundary - 1 - ($ + ?boundary - 1) % ?boundary, 000h
ENDM
;
; Pads up to a certain address.
; Gives an error message if that address is already exceeded.
;
PAD: MACRO ?address
IF $ > ?address
ERROR "Alignment exceeds %s"; % ?address
ENDIF
DS ?address - $
ENDM
;
; Pads up to the next multiple of the specified address.
;
;ALIGN: MACRO ?boundary
; ds ?boundary - 1 - ($ + ?boundary - 1) % ?boundary
; ENDM
;
; Pads to ensure a section of the given size does not cross a 100H boundary.
;
ALIGN_FIT8: MACRO ?size
DS (($ + ?size - 1) >> 8) != ($ >> 8) && (100H - ($ & 0FFH)) || 0
ENDM
; Macro to create a Jump table entry point for a Bank to Bank function call.
; The address of the real function in the required page is given as ?addr
; and the bank in which it will reside is given in ?bank. The logic then takes
; care of stack and memory mode manipulation to call the method and return to the
; caller with all registers unaffected going to the called function and returning from
; the called function. This allows any method to be placed in a bank as space dictates.
CALLBNK: MACRO ?addr, ?bank
EXX
EX AF,AF'
LD HL,?addr ; Real function to call.
LD A,?bank ; Bank in which the function resides.
JP BANKTOBANK_
ENDM
; As above but just jump to the required location in the alternate bank, no return.
JMPBNK: MACRO ?addr, ?bank
EX AF,AF'
LD A,?bank ; Bank in which the function resides.
LD (MMCFGVAL),A ; Store the value in a memory variable as we cant read the latch once programmed.
OUT (MMCFG),A ; Switch to the TZFS memory mode, SA1510 is now in RAM at 0000H
EX AF,AF'
LD HL,?addr ; Real function to jump to.
JP (HL)
ENDM
; Method to allow one bank to call a routine in another bank with all registers preserved in and out and
; reentrant so banks can call banks. It is costly in processing time and should only be
; used infrequently.
;
; Input: A = Memory mode to switch into.
; (HLSAVE)= Original HL to pass to caller.
; HL = Address to call.
; AF = Stored on stack to pass to called function.
; All other registers passed to called function.
; All registers are passed untouched to the caller.
; Stack; BKTOBKRET:AF (original memory mode) : Caller return address.
; Output: All registers and flags returned to caller.
;
JMPTOBNK: MACRO
LD (FNADDR),HL ; Save the function to call address stored in HL
LD L,A ; Save A to retrieve the old Memory mode and push it on the stack so it can be restored after return.
LD A,(MMCFGVAL)
PUSH AF
LD A,L
; NB. Dont disable interrupts, goes to mode 7 then returns to MMCFGVAL,so apart from a double switch there should be no race state.
LD (MMCFGVAL),A ; Store the value in a memory variable as we cant read the latch once programmed.
OUT (MMCFG),A ; Switch to the TZFS memory mode, SA1510 is now in RAM at 0000H
LD HL,BKTOBKRET ; Store the return address which must come back to this functionality before original caller.
PUSH HL
LD HL,(FNADDR) ; Push the address of the function to call onto the stack.
PUSH HL
EXX
EX AF,AF'
RET ; Call the required function by popping address off stack.
BKTOBKRET: EX (SP),HL ; Retrieve original memory mode from stack.
EX AF,AF'
LD A,H
LD (MMCFGVAL),A ; Store the value in a memory variable as we cant read the latch once programmed.
OUT (MMCFG),A ; Switch to the TZFS memory mode, SA1510 is now in RAM at 0000H
EX AF,AF'
POP HL ; Restore HL.
RET
ENDM
; Alternate version which preserves caller stack and creates local stack, used in CPM where the caller (CPM) has a tiny stack
; and the CBIOS needs more space. This version isnt reentrant, it is only used one way, CPM -> CBIOS.
JMPTOBNK2: MACRO
LD (STKSAVE),SP
LD SP,CBIOSSTACK
LD (FNADDR),HL ; Save the function to call address stored in HL
; NB. Dont disable interrupts, goes to mode 7 then returns to MMCFGVAL,so apart from a double switch there should be no race state.
LD A,TZMM_CPM2
LD (MMCFGVAL),A ; Store the value in a memory variable as we cant read the latch once programmed.
OUT (MMCFG),A ; Switch to the TZFS memory mode, SA1510 is now in RAM at 0000H
LD HL,BKTOBKRET2 ; Store the return address which must come back to this functionality before original caller.
PUSH HL
LD HL,(FNADDR) ; Push the address of the function to call onto the stack.
PUSH HL
EXX
EX AF,AF'
RET ; Call the required function by popping address off stack.
BKTOBKRET2: EX AF,AF'
LD A,TZMM_CPM
LD (MMCFGVAL),A ; Store the value in a memory variable as we cant read the latch once programmed.
OUT (MMCFG),A ; Switch to the TZFS memory mode, SA1510 is now in RAM at 0000H
EX AF,AF'
LD SP,(STKSAVE)
RET
ENDM

View File

@@ -0,0 +1 @@
BUILD_VERSION EQU 3

View File

@@ -0,0 +1,534 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: MSBASIC_Definitions.asm
;- Created: June 2020
;- Author(s): Philip Smart
;- Description: Sharp MZ series CPM v2.23
;- Definitions for the Sharp MZ80A CPM v2.23 OS used in the RFS
;-
;- Credits:
;- Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
;-
;- History: Jan 2020 - Initial version.
; May 2020 - Advent of the new RFS PCB v2.0, quite a few changes to accommodate the
; additional and different hardware. The SPI is now onboard the PCB and
; not using the printer interface card.
; Jun 2020 - Copied and strpped from TZFS for BASIC.
; Mar 2021 - Updates to backport changes from the RFS version after v2.1 hw changes.
;
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;-----------------------------------------------
; Features.
;-----------------------------------------------
;-----------------------------------------------
;-----------------------------------------------
; Configurable settings.
;-----------------------------------------------
; Build options. Set just one to '1' the rest to '0'.
; NB: As there are now 4 versions and 1 or more need to be built, ie. MZ-80A and RFS version for RFS, a flag is set in the file
; BASIC_build.asm which configures the equates below for the correct build.
; MZ-80A Standard Machine Configuration.
IF BUILD_VERSION = 0
BUILD_MZ80A EQU 1 ; Build for the standard Sharp MZ80A, no lower memory. Manually change MAXMEM above.
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 0 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
ENDIF
; MZ-700 Standard Machine Configuration.
IF BUILD_VERSION = 1
BUILD_MZ80A EQU 0
BUILD_MZ700 EQU 1 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 0 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
ENDIF
; TZFS Enhanced MZ-80A/MZ-700 with no video card upgrade.
IF BUILD_VERSION = 2
BUILD_MZ80A EQU 0
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 1 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 0 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 0
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
ENDIF
; TZFS Enhanced MZ-80A/MZ-700 with VideoModule (or 40/80 Colour Board on MZ-80A).
IF BUILD_VERSION = 3
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ80A EQU 0
BUILD_MZ80A_TZFS EQU 0 ; Build for TZFS running on an MZ-80A where extended memory is available.
BUILD_MZ700_TZFS EQU 1 ; Build for TZFS running on an MZ-700 where extended memory is available.
BUILD_VIDEOMODULE EQU 1 ; Build for the Video Module v2 board (=1) otherwise build for the 80Char Colour Board v1.0
BUILD_80C EQU 1
INCLUDE_ANSITERM EQU 1 ; Include the Ansi terminal emulation processor in the build.
ENDIF
IF BUILD_80C = 1
COLW: EQU 80 ; Width of the display screen (ie. columns).
ELSE
COLW: EQU 40 ; Width of the display screen (ie. columns).
ENDIF
TMRTICKINTV EQU 5 ; Number of 0.010mSec ticks per interrupt, ie. resolution of RTC.
ROW: EQU 25 ; Number of rows on display screen.
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.
; BIOS equates
KEYBUFSIZE EQU 64 ; Ensure this is a power of 2, max size 256.
IF BUILD_MZ80A = 1
MAXMEM EQU 0CFFFH ; Top of RAM on a standard Sharp MZ80A.
ELSE
MAXMEM EQU 10000H - TZSVCSIZE ; Top of RAM on the tranZPUter
ENDIF
; Tape load/save modes. Used as a flag to enable common code.
TAPELOAD EQU 1
CTAPELOAD EQU 2
TAPESAVE EQU 3
CTAPESAVE EQU 4
; Debugging
ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable
;-----------------------------------------------
; CMT Object types.
;-----------------------------------------------
ATR_OBJ EQU 1
ATR_BASIC_PROG EQU 2
ATR_BASIC_DATA EQU 3
ATR_SRC_FILE EQU 4
ATR_RELOC_FILE EQU 5
ATR_BASIC_MSCAS EQU 07EH
ATR_BASIC_MSTXT EQU 07FH
ATR_PASCAL_PROG EQU 0A0H
ATR_PASCAL_DATA EQU 0A1H
CMTATRB EQU 010F0H
CMTNAME EQU 010F1H
;-------------------------------------------------------
; Function entry points in the standard SA-1510 Monitor.
;-------------------------------------------------------
QWRI EQU 00021h
QWRD EQU 00024h
QRDI EQU 00027h
QRDD EQU 0002Ah
QVRFY EQU 0002Dh
;-----------------------------------------------
; BASIC ERROR CODE VALUES
;-----------------------------------------------
NF EQU 00H ; NEXT without FOR
SN EQU 02H ; Syntax error
RG EQU 04H ; RETURN without GOSUB
OD EQU 06H ; Out of DATA
FC EQU 08H ; Function call error
OV EQU 0AH ; Overflow
OM EQU 0CH ; Out of memory
UL EQU 0EH ; Undefined line number
BS EQU 10H ; Bad subscript
DDA EQU 12H ; Re-DIMensioned array
DZ EQU 14H ; Division by zero (/0)
ID EQU 16H ; Illegal direct
TM EQU 18H ; Type miss-match
OS EQU 1AH ; Out of string space
LS EQU 1CH ; String too long
ST EQU 1EH ; String formula too complex
CN EQU 20H ; Can't CONTinue
UF EQU 22H ; UnDEFined FN function
MO EQU 24H ; Missing operand
HX EQU 26H ; HEX error
BN EQU 28H ; BIN error
BV EQU 2AH ; Bad Value error
IO EQU 2CH ; IO error
;-----------------------------------------------
; Memory mapped ports in hardware.
;-----------------------------------------------
SCRN: EQU 0D000H
ARAM: EQU 0D800H
DSPCTL: EQU 0DFFFH ; Screen 40/80 select register (bit 7)
KEYPA: EQU 0E000h
KEYPB: EQU 0E001h
KEYPC: EQU 0E002h
KEYPF: EQU 0E003h
CSTR: EQU 0E002h
CSTPT: EQU 0E003h
CONT0: EQU 0E004h
CONT1: EQU 0E005h
CONT2: EQU 0E006h
CONTF: EQU 0E007h
SUNDG: EQU 0E008h
TEMP: EQU 0E008h
MEMSW: EQU 0E00CH
MEMSWR: EQU 0E010H
INVDSP: EQU 0E014H
NRMDSP: EQU 0E015H
SCLDSP: EQU 0E200H
SCLBASE: EQU 0E2H
;-----------------------------------------------
; IO Registers
;-----------------------------------------------
FDC EQU 0D8h ; MB8866 IO Region 0D8h - 0DBh
FDC_CR EQU FDC + 000h ; Command Register
FDC_STR EQU FDC + 000h ; Status Register
FDC_TR EQU FDC + 001h ; Track Register
FDC_SCR EQU FDC + 002h ; Sector Register
FDC_DR EQU FDC + 003h ; Data Register
FDC_MOTOR EQU FDC + 004h ; DS[0-3] and Motor control. 4 drives DS= BIT 0 -> Bit 2 = Drive number, 2=1,1=0,0=0 DS0, 2=1,1=0,0=1 DS1 etc
; bit 7 = 1 MOTOR ON LOW (Active)
FDC_SIDE EQU FDC + 005h ; Side select, Bit 0 when set = SIDE SELECT LOW
;-----------------------------------------------
; Common character definitions.
;-----------------------------------------------
SCROLL EQU 001H ;Set scroll direction UP.
BELL EQU 007H
SPACE EQU 020H
TAB EQU 009H ;TAB ACROSS (8 SPACES FOR SD-BOARD)
CR EQU 00DH
LF EQU 00AH
FF EQU 00CH
CS EQU 0CH ; Clear screen
DELETE EQU 07FH
BACKS EQU 008H
SOH EQU 1 ; For XModem etc.
EOT EQU 4
ACK EQU 6
NAK EQU 015H
NUL EQU 000H
;NULL EQU 000H
CTRL_A EQU 001H
CTRL_B EQU 002H
CTRL_C EQU 003H
CTRL_D EQU 004H
CTRL_E EQU 005H
CTRL_F EQU 006H
CTRL_G EQU 007H
CTRL_H EQU 008H
CTRL_I EQU 009H
CTRL_J EQU 00AH
CTRL_K EQU 00BH
CTRL_L EQU 00CH
CTRL_M EQU 00DH
CTRL_N EQU 00EH
CTRL_O EQU 00FH
CTRL_P EQU 010H
CTRL_Q EQU 011H
CTRL_R EQU 012H
CTRL_S EQU 013H
CTRL_T EQU 014H
CTRL_U EQU 015H
CTRL_V EQU 016H
CTRL_W EQU 017H
CTRL_X EQU 018H
CTRL_Y EQU 019H
CTRL_Z EQU 01AH
ESC EQU 01BH
CTRL_SLASH EQU 01CH
CTRL_LB EQU 01BH
CTRL_RB EQU 01DH
CTRL_CAPPA EQU 01EH
CTRL_UNDSCR EQU 01FH
CTRL_AT EQU 000H
NOKEY EQU 0F0H
CURSRIGHT EQU 0F1H
CURSLEFT EQU 0F2H
CURSUP EQU 0F3H
CURSDOWN EQU 0F4H
DBLZERO EQU 0F5H
INSERT EQU 0F6H
CLRKEY EQU 0F7H
HOMEKEY EQU 0F8H
BREAKKEY EQU 0FBH
GRAPHKEY EQU 0FCH
ALPHAKEY EQU 0FDH
;-----------------------------------------------
; IO ports in hardware and values.
;-----------------------------------------------
MMCFG EQU 060H ; Memory management configuration latch.
SETXMHZ EQU 062H ; Select the alternate clock frequency.
SET2MHZ EQU 064H ; Select the system 2MHz clock frequency.
CLKSELRD EQU 066H ; Read clock selected setting, 0 = 2MHz, 1 = XMHz
SVCREQ EQU 068H ; I/O Processor service request.
CPLDSTATUS EQU 06BH ; Version 2.1 CPLD status register.
CPUCFG EQU 06CH ; Version 2.2 CPU configuration register.
CPUSTATUS EQU 06CH ; Version 2.2 CPU runtime status register.
CPUINFO EQU 06DH ; Version 2.2 CPU information register.
CPLDCFG EQU 06EH ; Version 2.1 CPLD configuration register.
CPLDINFO EQU 06FH ; Version 2.1 CPLD version information register.
VMPNUM EQU 0A0H ; Set the parameter number to update.
VMPLBYTE EQU 0A1H ; Update the lower selected parameter byte.
VMPUBYTE EQU 0A2H ; Update the upper selected parameter byte.
PALSLCTOFF EQU 0A3H ; set the palette slot Off position to be adjusted.
PALSLCTON EQU 0A4H ; set the palette slot On position to be adjusted.
PALSETRED EQU 0A5H ; set the red palette value according to the PALETTE_PARAM_SEL address.
PALSETGREEN EQU 0A6H ; set the green palette value according to the PALETTE_PARAM_SEL address.
PALSETBLUE EQU 0A7H ; set the blue palette value according to the PALETTE_PARAM_SEL address.
VMPALETTE EQU 0B0H ; Select Palette:
; 0xB0 sets the palette. The Video Module supports 4 bit per colour output but there is only enough RAM for 1 bit per colour so the pallette is used to change the colours output.
; Bits [7:0] defines the pallete number. This indexes a lookup table which contains the required 4bit output per 1bit input.
; GPU:
GPUPARAM EQU 0B2H ; 0xB2 set parameters. Store parameters in a long word to be used by the graphics command processor.
; The parameter word is 128 bit and each write to the parameter word shifts left by 8 bits and adds the new byte at bits 7:0.
GPUCMD EQU 0B3H ; 0xB3 set the graphics processor unit commands.
GPUSTATUS EQU 0B3H ; [7;1] - FSM state, [0] - 1 = busy, 0 = idle
; Bits [5:0] - 0 = Reset parameters.
; 1 = Clear to val. Start Location (16 bit), End Location (16 bit), Red Filter, Green Filter, Blue Filter
;
VMCTRL EQU 0B8H ; Video Module control register. [2:0] - 000 (default) = MZ80A, 001 = MZ-700, 010 = MZ800, 011 = MZ80B, 100 = MZ80K, 101 = MZ80C, 110 = MZ1200, 111 = MZ2000. [3] = 0 - 40 col, 1 - 80 col.
VMGRMODE EQU 0B9H ; Video Module graphics mode. 7/6 = Operator (00=OR,01=AND,10=NAND,11=XOR), 5=GRAM Output Enable, 4 = VRAM Output Enable, 3/2 = Write mode (00=Page 1:Red, 01=Page 2:Green, 10=Page 3:Blue, 11=Indirect), 1/0=Read mode (00=Page 1:Red, 01=Page2:Green, 10=Page 3:Blue, 11=Not used).
VMREDMASK EQU 0BAH ; Video Module Red bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMGREENMASK EQU 0BBH ; Video Module Green bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMBLUEMASK EQU 0BCH ; Video Module Blue bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMPAGE EQU 0BDH ; Video Module memory page register. [1:0] switches in 1 16Kb page (3 pages) of graphics ram to C000 - FFFF. Bits [1:0] = page, 00 = off, 01 = Red, 10 = Green, 11 = Blue. This overrides all MZ700/MZ80B page switching functions. [7] 0 - normal, 1 - switches in CGROM for upload at D000:DFFF.
VMVGATTR EQU 0BEH ; Select VGA Border colour and attributes. Bit 2 = Red, 1 = Green, 0 = Blue.
VMVGAMODE EQU 0BFH ; Select VGA output mode. Bits [3:0] - Output mode.
GDCRTC EQU 0CFH ; MZ-800 CRTC control register
GDCMD EQU 0CEH ; MZ-800 CRTC Mode register
GDGRF EQU 0CDH ; MZ-800 read format register
GDGWF EQU 0CCH ; MZ-800 write format register
MMIO0 EQU 0E0H ; MZ-700/MZ-800 Memory Management Set 0
MMIO1 EQU 0E1H ; MZ-700/MZ-800 Memory Management Set 1
MMIO2 EQU 0E2H ; MZ-700/MZ-800 Memory Management Set 2
MMIO3 EQU 0E3H ; MZ-700/MZ-800 Memory Management Set 3
MMIO4 EQU 0E4H ; MZ-700/MZ-800 Memory Management Set 4
MMIO5 EQU 0E5H ; MZ-700/MZ-800 Memory Management Set 5
MMIO6 EQU 0E6H ; MZ-700/MZ-800 Memory Management Set 6
MMIO7 EQU 0E7H ; MZ-700/MZ-800 Memory Management Set 7
SYSCTRL EQU 0F0H ; System board control register. [2:0] - 000 MZ80A Mode, 2MHz CPU/Bus, 001 MZ80B Mode, 4MHz CPU/Bus, 010 MZ700 Mode, 3.54MHz CPU/Bus.
GRAMMODE EQU 0F4H ; MZ80B Graphics mode. Bit 0 = 0, Write to Graphics RAM I, Bit 0 = 1, Write to Graphics RAM II. Bit 1 = 1, blend Graphics RAM I output on display, Bit 2 = 1, blend Graphics RAM II output on display.
;-----------------------------------------------
; CPLD Configuration constants.
;-----------------------------------------------
MODE_MZ80K EQU 0 ; Set to MZ-80K mode.
MODE_MZ80C EQU 1 ; Set to MZ-80C mode.
MODE_MZ1200 EQU 2 ; Set to MZ-1200 mode.
MODE_MZ80A EQU 3 ; Set to MZ-80A mode (base mode on MZ-80A hardware).
MODE_MZ700 EQU 4 ; Set to MZ-700 mode (base mode on MZ-700 hardware).
MODE_MZ800 EQU 5 ; Set to MZ-800 mode.
MODE_MZ80B EQU 6 ; Set to MZ-80B mode.
MODE_MZ2000 EQU 7 ; Set to MZ-2000 mode.
MODE_VIDEO_FPGA EQU 8 ; Bit flag (bit 3) to switch CPLD into using the new FPGA video hardware.
MODE_RESET_PRESERVE EQU 080H ; Preserve register configuration through reset.
;-----------------------------------------------
; CPLD Command Instruction constants.
;-----------------------------------------------
CPLD_RESET_HOST EQU 1 ; CPLD level command to reset the host system.
CPLD_HOLD_HOST_BUS EQU 2 ; CPLD command to hold the host bus.
CPLD_RELEASE_HOST_BUS EQU 3 ; CPLD command to release the host bus.
;-----------------------------------------------
; FPGA CPU enhancement control bits.
;-----------------------------------------------
CPUMODE_SET_Z80 EQU 000H ; Set the CPU to the hard Z80.
CPUMODE_SET_T80 EQU 001H ; Set the CPU to the soft T80.
CPUMODE_SET_ZPU_EVO EQU 002H ; Set the CPU to the soft ZPU Evolution.
CPUMODE_SET_AAA EQU 004H ; Place holder for a future soft CPU.
CPUMODE_SET_BBB EQU 008H ; Place holder for a future soft CPU.
CPUMODE_SET_CCC EQU 010H ; Place holder for a future soft CPU.
CPUMODE_SET_DDD EQU 020H ; Place holder for a future soft CPU.
CPUMODE_IS_Z80 EQU 000H ; Status value to indicate if the hard Z80 available.
CPUMODE_IS_T80 EQU 001H ; Status value to indicate if the soft T80 available.
CPUMODE_IS_ZPU_EVO EQU 002H ; Status value to indicate if the soft ZPU Evolution available.
CPUMODE_IS_AAA EQU 004H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_BBB EQU 008H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_CCC EQU 010H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_DDD EQU 020H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_RESET_CPU EQU 080H ; Reset the soft CPU. Active high, when high the CPU is held in RESET, when low the CPU runs.
CPUMODE_IS_SOFT_AVAIL EQU 040H ; Marker to indicate if the underlying FPGA can support soft CPU's.
CPUMODE_IS_SOFT_MASK EQU 0C0H ; Mask to filter out the Soft CPU availability flags.
CPUMODE_IS_CPU_MASK EQU 03FH ; Mask to filter out which soft CPU's are available.
;-----------------------------------------------
; Video Module control bits.
;-----------------------------------------------
MODE_80CHAR EQU 010H ; Enable 80 character display.
MODE_COLOUR EQU 020H ; Enable colour display.
SYSMODE_MZ80A EQU 000H ; System board mode MZ80A, 2MHz CPU/Bus.
SYSMODE_MZ80B EQU 020H ; System board mode MZ80B, 4MHz CPU/Bus.
SYSMODE_MZ2000 EQU 020H ; System board mode MZ2000, 4MHz CPU/Bus.
SYSMODE_MZ700 EQU 042H ; System board mode MZ700, 3.54MHz CPU/Bus.
VMMODE_MZ80K EQU 000H ; Video mode = MZ80K
VMMODE_MZ80C EQU 001H ; Video mode = MZ80C
VMMODE_MZ1200 EQU 002H ; Video mode = MZ1200
VMMODE_MZ80A EQU 003H ; Video mode = MZ80A
VMMODE_MZ700 EQU 004H ; Video mode = MZ700
VMMODE_MZ800 EQU 005H ; Video mode = MZ800
VMMODE_MZ1500 EQU 006H ; Video mode = MZ1500
VMMODE_MZ80B EQU 007H ; Video mode = MZ80B
VMMODE_MZ2000 EQU 008H ; Video mode = MZ2000
VMMODE_MZ2200 EQU 009H ; Video mode = MZ2200
VMMODE_MZ2500 EQU 00AH ; Video mode = MZ2500
VMMODE_PCGRAM EQU 020H ; Enable PCG RAM.
VMMODE_VGA_OFF EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT50 EQU 001H ; Set VGA mode off, external monitor is driven by standard internal 50Hz signals.
VMMODE_VGA_640x480 EQU 002H ; Set external monitor to VGA 640x480 @ 60Hz mode.
VMMODE_VGA_800x600 EQU 003H ; Set external monitor to VGA 800x600 @ 60Hz mode.
;-----------------------------------------------
; GPU commands.
;-----------------------------------------------
GPUCLEARVRAM EQU 001H ; Clear the VRAM without updating attributes.
GPUCLEARVRAMCA EQU 002H ; Clear the VRAM/ARAM with given attribute byte,
GPUCLEARVRAMP EQU 003H ; Clear the VRAM/ARAM with parameters.
GPUCLEARGRAM EQU 081H ; Clear the entire Framebuffer.
GPUCLEARGRAMP EQU 082H ; Clear the Framebuffer according to parameters.
GPURESET EQU 0FFH ; Reset the GPU, return to idle state.
;-----------------------------------------------
; tranZPUter SW Memory Management modes
;-----------------------------------------------
TZMM_ENIOWAIT EQU 020H ; Memory management IO Wait State enable - insert a wait state when an IO operation to E0-FF is executed.
TZMM_ORIG EQU 000H ; Original Sharp MZ80A mode, no tranZPUter features are selected except the I/O control registers (default: 0x60-063).
TZMM_BOOT EQU 001H ; Original mode but E800-EFFF is mapped to tranZPUter RAM so TZFS can be booted.
TZMM_TZFS EQU 002H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-FFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected.
TZMM_TZFS2 EQU 003H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 1.
TZMM_TZFS3 EQU 004H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 2.
TZMM_TZFS4 EQU 005H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 3.
TZMM_CPM EQU 006H + TZMM_ENIOWAIT ; CPM main memory configuration, all memory on the tranZPUter board, 64K block 4 selected. Special case for F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_CPM2 EQU 007H + TZMM_ENIOWAIT ; CPM main memory configuration, F000-FFFF are on the tranZPUter board in block 4, 0040-CFFF and E800-EFFF are in block 5, mainboard for D000-DFFF (video), E000-E800 (Memory control) selected.
; Special case for 0000:003F (interrupt vectors) which resides in block 4, F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_COMPAT EQU 008H + TZMM_ENIOWAIT ; Original mode but with main DRAM in Bank 0 to allow bootstrapping of programs from other machines such as the MZ700.
TZMM_HOSTACCESS EQU 009H + TZMM_ENIOWAIT ; Mode to allow code running in Bank 0, address E800:FFFF to access host memory. Monitor ROM 0000-0FFF and Main DRAM 0x1000-0xD000, video and memory mapped I/O are on the host machine, User/Floppy ROM E800-FFFF are in tranZPUter memory.
TZMM_MZ700_0 EQU 00AH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the mainboard.
TZMM_MZ700_1 EQU 00BH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_2 EQU 00CH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_3 EQU 00DH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ700_4 EQU 00EH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ800 EQU 00FH + TZMM_ENIOWAIT ; MZ800 Mode - Tracks original hardware mode offering MZ700/MZ800 configurations.
TZMM_MZ2000 EQU 010H + TZMM_ENIOWAIT; ; MZ2000 Mode - Running on MZ2000 hardware, configuration set according to runtime configuration registers.
TZMM_FPGA EQU 015H + TZMM_ENIOWAIT ; Open up access for the K64F to the FPGA resources such as memory. All other access to RAM or mainboard is blocked.
TZMM_TZPUM EQU 016H + TZMM_ENIOWAIT ; Everything in on mainboard, no access to tranZPUter memory.
TZMM_TZPU EQU 017H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU0 EQU 018H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU1 EQU 019H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 1 is selected.
;TZMM_TZPU2 EQU 01AH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 2 is selected.
;TZMM_TZPU3 EQU 01BH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 3 is selected.
;TZMM_TZPU4 EQU 01CH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 4 is selected.
;TZMM_TZPU5 EQU 01DH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 5 is selected.
;TZMM_TZPU6 EQU 01EH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 6 is selected.
;TZMM_TZPU7 EQU 01FH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 7 is selected.
;-----------------------------------------------
; TZ File System Header (MZF)
;-----------------------------------------------
TZFS_ATRB: EQU 00000h ; Code Type, 01 = Machine Code.
TZFS_NAME: EQU 00001h ; Title/Name (17 bytes).
TZFS_SIZE: EQU 00012h ; Size of program.
TZFS_DTADR: EQU 00014h ; Load address of program.
TZFS_EXADR: EQU 00016h ; Exec address of program.
TZFS_COMNT: EQU 00018h ; Comment
TZFS_MZFLEN: EQU 128 ; Length of the MZF header.
TZFS_CMTLEN: EQU 104 ; Length of the comment field
;-----------------------------------------------
; BIOS WORK AREA (MZ80A)
;-----------------------------------------------
; Variables and control structure used by the I/O processor for service calls and requests.
ORG TZSVCMEM
TZSVCMEM: EQU 0FD80H ; Start of a memory structure used to communicate with the K64F I/O processor for services such as disk access.
TZSVCSIZE: EQU 00280H ;
TZSVCDIRSZ: EQU 20 ; Size of the directory/file name.
TZSVCFILESZ: EQU 17 ; Size of a Sharp filename.
TZSVCLONGFILESZ: EQU 31 ; Size of a standard filename.
TZSVCLONGFMTSZ: EQU 20 ; Size of a formatted standard filename for use in directory listings.
TZSVCWILDSZ: EQU 20 ; Size of the wildcard.
TZSVCSECSIZE: EQU 512
TZSVCDIR_ENTSZ: EQU 32 ; Size of a directory entry.
TZSVCWAITIORETRIES: EQU 500 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype.
TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted.
TZSVCCMD: DS virtual 1 ; Service command.
TZSVCRESULT: DS virtual 1 ; Service command result.
TZSVCDIRSEC: DS virtual 1 ; Storage for the directory sector number.
TZSVC_FILE_SEC: EQU TZSVCDIRSEC ; Union of the file and directory sector as only one can be used at a time.
TZSVC_TRACK_NO: DS virtual 2 ; Storage for the virtual drive track number.
TZSVC_SECTOR_NO: DS virtual 2 ; Storage for the virtual drive sector number.
TZSVC_FILE_NO: DS virtual 1 ; File number to be opened in a file service command.
TZSVC_FILE_TYPE: DS virtual 1 ; Type of file being accessed to differentiate between Sharp MZF files and other handled files.
TZSVC_LOADADDR: DS virtual 2 ; Dynamic load address for rom/images.
TZSVC_SAVEADDR: EQU TZSVC_LOADADDR ; Union of the load address and the cpu frequency change value, the address of data to be saved.
TZSVC_CPU_FREQ: EQU TZSVC_LOADADDR ; Union of the load address and the save address value, only one can be used at a time.
TZSVC_LOADSIZE: DS virtual 2 ; Size of image to load.
TZSVC_SAVESIZE: EQU TZSVC_LOADSIZE ; Size of image to be saved.
TZSVC_DIRNAME: DS virtual TZSVCDIRSZ ; Service directory/file name.
TZSVC_FILENAME: DS virtual TZSVCFILESZ ; Filename to be opened/created.
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_LOAD40ABIOS EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded.
TZSVC_CMD_LOAD80ABIOS 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_LOAD800BIOS EQU 25H ; Service command requesting that the MZ800 9Z-504M BIOS is loaded.
TZSVC_CMD_LOAD2000IPL EQU 26H ; Service command requesting the MZ-2000 IPL is loaded.
TZSVC_CMD_LOADTZFS EQU 2FH ; Service command requesting the loading of TZFS. This service is for machines which normally dont have a monitor BIOS. ie. MZ-80B/MZ-2000 and manually request TZFS.
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_CMD_CPU_SETZ80 EQU 50H ; Service command to switch to the external Z80 hard cpu.
TZSVC_CMD_CPU_SETT80 EQU 51H ; Service command to switch to the internal T80 soft cpu.
TZSVC_CMD_CPU_SETZPUEVO EQU 52H ; Service command to switch to the internal ZPU Evolution soft cpu.
TZSVC_CMD_EMU_SETMZ80K EQU 53H ; Service command to switch to the internal Sharp MZ Series Emulation of the MZ80K.
TZSVC_CMD_EMU_SETMZ80C EQU 54H ; "" "" "" MZ80C.
TZSVC_CMD_EMU_SETMZ1200 EQU 55H ; "" "" "" MZ1200.
TZSVC_CMD_EMU_SETMZ80A EQU 56H ; "" "" "" MZ80A.
TZSVC_CMD_EMU_SETMZ700 EQU 57H ; "" "" "" MZ700.
TZSVC_CMD_EMU_SETMZ800 EQU 58H ; "" "" "" MZ800.
TZSVC_CMD_EMU_SETMZ1500 EQU 59H ; "" "" "" MZ1500.
TZSVC_CMD_EMU_SETMZ80B EQU 5AH ; "" "" "" MZ80B.
TZSVC_CMD_EMU_SETMZ2000 EQU 5BH ; "" "" "" MZ2000.
TZSVC_CMD_EMU_SETMZ2200 EQU 5CH ; "" "" "" MZ2200.
TZSVC_CMD_EMU_SETMZ2500 EQU 5DH ; "" "" "" MZ2500.
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.

View File

@@ -0,0 +1,316 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: TESTTZ_Definitions.asm
;- Created: June 2020
;- Author(s): Philip Smart
;- Description: tranZPUter tester program
;- A small program to exercise parts of the tranZPUter to aid in problem resolution.
;-
;- Credits:
;- Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
;-
;- History: Jun 2020 - Initial version.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;-----------------------------------------------
; Features.
;-----------------------------------------------
;-----------------------------------------------
; Configurable settings.
;-----------------------------------------------
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
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
; Debugging
ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable
;-----------------------------------------------
; Memory mapped ports in hardware.
;-----------------------------------------------
SCRN: EQU 0D000H
ARAM: EQU 0D800H
DSPCTL: EQU 0DFFFH ; Screen 40/80 select register (bit 7)
KEYPA: EQU 0E000h
KEYPB: EQU 0E001h
KEYPC: EQU 0E002h
KEYPF: EQU 0E003h
CSTR: EQU 0E002h
CSTPT: EQU 0E003h
CONT0: EQU 0E004h
CONT1: EQU 0E005h
CONT2: EQU 0E006h
CONTF: EQU 0E007h
SUNDG: EQU 0E008h
TEMP: EQU 0E008h
MEMSW: EQU 0E00CH
MEMSWR: EQU 0E010H
INVDSP: EQU 0E014H
NRMDSP: EQU 0E015H
SCLDSP: EQU 0E200H
SCLBASE: EQU 0E2H
;-----------------------------------------------
; Common character definitions.
;-----------------------------------------------
SCROLL EQU 001H ;Set scroll direction UP.
BELL EQU 007H
SPACE EQU 020H
TAB EQU 009H ;TAB ACROSS (8 SPACES FOR SD-BOARD)
CR EQU 00DH
LF EQU 00AH
FF EQU 00CH
DELETE EQU 07FH
BACKS EQU 008H
SOH EQU 1 ; For XModem etc.
EOT EQU 4
ACK EQU 6
NAK EQU 015H
NUL EQU 000H
NULL EQU 000H
CTRL_A EQU 001H
CTRL_B EQU 002H
CTRL_C EQU 003H
CTRL_D EQU 004H
CTRL_E EQU 005H
CTRL_F EQU 006H
CTRL_G EQU 007H
CTRL_H EQU 008H
CTRL_I EQU 009H
CTRL_J EQU 00AH
CTRL_K EQU 00BH
CTRL_L EQU 00CH
CTRL_M EQU 00DH
CTRL_N EQU 00EH
CTRL_O EQU 00FH
CTRL_P EQU 010H
CTRL_Q EQU 011H
CTRL_R EQU 012H
CTRL_S EQU 013H
CTRL_T EQU 014H
CTRL_U EQU 015H
CTRL_V EQU 016H
CTRL_W EQU 017H
CTRL_X EQU 018H
CTRL_Y EQU 019H
CTRL_Z EQU 01AH
ESC EQU 01BH
CTRL_SLASH EQU 01CH
CTRL_RB EQU 01DH
CTRL_CAPPA EQU 01EH
CTRL_UNDSCR EQU 01FH
CTRL_AT EQU 000H
NOKEY EQU 0F0H
CURSRIGHT EQU 0F1H
CURSLEFT EQU 0F2H
CURSUP EQU 0F3H
CURSDOWN EQU 0F4H
DBLZERO EQU 0F5H
INSERT EQU 0F6H
CLRKEY EQU 0F7H
HOMEKEY EQU 0F8H
BREAKKEY EQU 0FBH
;-----------------------------------------------
; IO ports in hardware and values.
;-----------------------------------------------
MMCFG EQU 060H ; Memory management configuration latch.
SETXMHZ EQU 062H ; Select the alternate clock frequency.
SET2MHZ EQU 064H ; Select the system 2MHz clock frequency.
CLKSELRD EQU 066H ; Read clock selected setting, 0 = 2MHz, 1 = XMHz
SVCREQ EQU 068H ; I/O Processor service request.
CPLDSTATUS EQU 06BH ; Version 2.1 CPLD status register.
CPUCFG EQU 06CH ; Version 2.2 CPU configuration register.
CPUSTATUS EQU 06CH ; Version 2.2 CPU runtime status register.
CPUINFO EQU 06DH ; Version 2.2 CPU information register.
CPLDCFG EQU 06EH ; Version 2.1 CPLD configuration register.
CPLDINFO EQU 06FH ; Version 2.1 CPLD version information register.
VMPNUM EQU 0A0H ; Set the parameter number to update.
VMPLBYTE EQU 0A1H ; Update the lower selected parameter byte.
VMPUBYTE EQU 0A2H ; Update the upper selected parameter byte.
PALSLCTOFF EQU 0A3H ; set the palette slot Off position to be adjusted.
PALSLCTON EQU 0A4H ; set the palette slot On position to be adjusted.
PALSETRED EQU 0A5H ; set the red palette value according to the PALETTE_PARAM_SEL address.
PALSETGREEN EQU 0A6H ; set the green palette value according to the PALETTE_PARAM_SEL address.
PALSETBLUE EQU 0A7H ; set the blue palette value according to the PALETTE_PARAM_SEL address.
VMPALETTE EQU 0B0H ; Select Palette:
; 0xB0 sets the palette. The Video Module supports 4 bit per colour output but there is only enough RAM for 1 bit per colour so the pallette is used to change the colours output.
; Bits [7:0] defines the pallete number. This indexes a lookup table which contains the required 4bit output per 1bit input.
; GPU:
GPUPARAM EQU 0B2H ; 0xB2 set parameters. Store parameters in a long word to be used by the graphics command processor.
; The parameter word is 128 bit and each write to the parameter word shifts left by 8 bits and adds the new byte at bits 7:0.
GPUCMD EQU 0B3H ; 0xB3 set the graphics processor unit commands.
GPUSTATUS EQU 0B3H ; [7;1] - FSM state, [0] - 1 = busy, 0 = idle
; Bits [5:0] - 0 = Reset parameters.
; 1 = Clear to val. Start Location (16 bit), End Location (16 bit), Red Filter, Green Filter, Blue Filter
;
VMCTRL EQU 0B8H ; Video Module control register. [2:0] - 000 (default) = MZ80A, 001 = MZ-700, 010 = MZ800, 011 = MZ80B, 100 = MZ80K, 101 = MZ80C, 110 = MZ1200, 111 = MZ2000. [3] = 0 - 40 col, 1 - 80 col.
VMGRMODE EQU 0B9H ; Video Module graphics mode. 7/6 = Operator (00=OR,01=AND,10=NAND,11=XOR), 5=GRAM Output Enable, 4 = VRAM Output Enable, 3/2 = Write mode (00=Page 1:Red, 01=Page 2:Green, 10=Page 3:Blue, 11=Indirect), 1/0=Read mode (00=Page 1:Red, 01=Page2:Green, 10=Page 3:Blue, 11=Not used).
VMREDMASK EQU 0BAH ; Video Module Red bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMGREENMASK EQU 0BBH ; Video Module Green bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMBLUEMASK EQU 0BCH ; Video Module Blue bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMPAGE EQU 0BDH ; Video Module memory page register. [1:0] switches in 1 16Kb page (3 pages) of graphics ram to C000 - FFFF. Bits [1:0] = page, 00 = off, 01 = Red, 10 = Green, 11 = Blue. This overrides all MZ700/MZ80B page switching functions. [7] 0 - normal, 1 - switches in CGROM for upload at D000:DFFF.
VMVGATTR EQU 0BEH ; Select VGA Border colour and attributes. Bit 2 = Red, 1 = Green, 0 = Blue.
VMVGAMODE EQU 0BFH ; Select VGA output mode. Bits [3:0] - Output mode.
GDCRTC EQU 0CFH ; MZ-800 CRTC control register
GDCMD EQU 0CEH ; MZ-800 CRTC Mode register
GDGRF EQU 0CDH ; MZ-800 read format register
GDGWF EQU 0CCH ; MZ-800 write format register
MMIO0 EQU 0E0H ; MZ-700/MZ-800 Memory Management Set 0
MMIO1 EQU 0E1H ; MZ-700/MZ-800 Memory Management Set 1
MMIO2 EQU 0E2H ; MZ-700/MZ-800 Memory Management Set 2
MMIO3 EQU 0E3H ; MZ-700/MZ-800 Memory Management Set 3
MMIO4 EQU 0E4H ; MZ-700/MZ-800 Memory Management Set 4
MMIO5 EQU 0E5H ; MZ-700/MZ-800 Memory Management Set 5
MMIO6 EQU 0E6H ; MZ-700/MZ-800 Memory Management Set 6
MMIO7 EQU 0E7H ; MZ-700/MZ-800 Memory Management Set 7
SYSCTRL EQU 0F0H ; System board control register. [2:0] - 000 MZ80A Mode, 2MHz CPU/Bus, 001 MZ80B Mode, 4MHz CPU/Bus, 010 MZ700 Mode, 3.54MHz CPU/Bus.
GRAMMODE EQU 0F4H ; MZ80B Graphics mode. Bit 0 = 0, Write to Graphics RAM I, Bit 0 = 1, Write to Graphics RAM II. Bit 1 = 1, blend Graphics RAM I output on display, Bit 2 = 1, blend Graphics RAM II output on display.
;-----------------------------------------------
; CPLD Configuration constants.
;-----------------------------------------------
MODE_MZ80K EQU 0 ; Set to MZ-80K mode.
MODE_MZ80C EQU 1 ; Set to MZ-80C mode.
MODE_MZ1200 EQU 2 ; Set to MZ-1200 mode.
MODE_MZ80A EQU 3 ; Set to MZ-80A mode (base mode on MZ-80A hardware).
MODE_MZ700 EQU 4 ; Set to MZ-700 mode (base mode on MZ-700 hardware).
MODE_MZ800 EQU 5 ; Set to MZ-800 mode.
MODE_MZ80B EQU 6 ; Set to MZ-80B mode.
MODE_MZ2000 EQU 7 ; Set to MZ-2000 mode.
MODE_VIDEO_FPGA EQU 8 ; Bit flag (bit 3) to switch CPLD into using the new FPGA video hardware.
MODE_RESET_PRESERVE EQU 080H ; Preserve register configuration through reset.
;-----------------------------------------------
; CPLD Command Instruction constants.
;-----------------------------------------------
CPLD_RESET_HOST EQU 1 ; CPLD level command to reset the host system.
CPLD_HOLD_HOST_BUS EQU 2 ; CPLD command to hold the host bus.
CPLD_RELEASE_HOST_BUS EQU 3 ; CPLD command to release the host bus.
;-----------------------------------------------
; FPGA CPU enhancement control bits.
;-----------------------------------------------
CPUMODE_SET_Z80 EQU 000H ; Set the CPU to the hard Z80.
CPUMODE_SET_T80 EQU 001H ; Set the CPU to the soft T80.
CPUMODE_SET_ZPU_EVO EQU 002H ; Set the CPU to the soft ZPU Evolution.
CPUMODE_SET_EMU_MZ EQU 004H ; Set the hardware to enable the Sharp MZ Series emulations.
CPUMODE_SET_BBB EQU 008H ; Place holder for a future soft CPU.
CPUMODE_SET_CCC EQU 010H ; Place holder for a future soft CPU.
CPUMODE_SET_DDD EQU 020H ; Place holder for a future soft CPU.
CPUMODE_IS_Z80 EQU 000H ; Status value to indicate if the hard Z80 available.
CPUMODE_IS_T80 EQU 001H ; Status value to indicate if the soft T80 available.
CPUMODE_IS_ZPU_EVO EQU 002H ; Status value to indicate if the soft ZPU Evolution available.
CPUMODE_IS_EMU_MZ EQU 004H ; Status value to indicate the Sharp MZ Series Hardware Emulation logic is available.
CPUMODE_IS_BBB EQU 008H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_CCC EQU 010H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_DDD EQU 020H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_RESET_CPU EQU 080H ; Reset the soft CPU. Active high, when high the CPU is held in RESET, when low the CPU runs.
CPUMODE_IS_SOFT_AVAIL EQU 040H ; Marker to indicate if the underlying FPGA can support soft CPU's.
CPUMODE_IS_SOFT_MASK EQU 0C0H ; Mask to filter out the Soft CPU availability flags.
CPUMODE_IS_CPU_MASK EQU 03FH ; Mask to filter out which soft CPU's are available.
;-----------------------------------------------
; Video Module control bits.
;-----------------------------------------------
MODE_80CHAR EQU 010H ; Enable 80 character display.
MODE_COLOUR EQU 020H ; Enable colour display.
SYSMODE_MZ80A EQU 000H ; System board mode MZ80A, 2MHz CPU/Bus.
SYSMODE_MZ80B EQU 020H ; System board mode MZ80B, 4MHz CPU/Bus.
SYSMODE_MZ2000 EQU 020H ; System board mode MZ2000, 4MHz CPU/Bus.
SYSMODE_MZ700 EQU 042H ; System board mode MZ700, 3.54MHz CPU/Bus.
VMMODE_MZ80K EQU 000H ; Video mode = MZ80K
VMMODE_MZ80C EQU 001H ; Video mode = MZ80C
VMMODE_MZ1200 EQU 002H ; Video mode = MZ1200
VMMODE_MZ80A EQU 003H ; Video mode = MZ80A
VMMODE_MZ700 EQU 004H ; Video mode = MZ700
VMMODE_MZ800 EQU 005H ; Video mode = MZ800
VMMODE_MZ1500 EQU 006H ; Video mode = MZ1500
VMMODE_MZ80B EQU 007H ; Video mode = MZ80B
VMMODE_MZ2000 EQU 008H ; Video mode = MZ2000
VMMODE_MZ2200 EQU 009H ; Video mode = MZ2200
VMMODE_MZ2500 EQU 00AH ; Video mode = MZ2500
VMMODE_PCGRAM EQU 020H ; Enable PCG RAM.
VMMODE_VGA_OFF EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT50 EQU 001H ; Set VGA mode off, external monitor is driven by standard internal 50Hz signals.
VMMODE_VGA_640x480 EQU 002H ; Set external monitor to VGA 640x480 @ 60Hz mode.
VMMODE_VGA_800x600 EQU 003H ; Set external monitor to VGA 800x600 @ 60Hz mode.
;-----------------------------------------------
; GPU commands.
;-----------------------------------------------
GPUCLEARVRAM EQU 001H ; Clear the VRAM without updating attributes.
GPUCLEARVRAMCA EQU 002H ; Clear the VRAM/ARAM with given attribute byte,
GPUCLEARVRAMP EQU 003H ; Clear the VRAM/ARAM with parameters.
GPUCLEARGRAM EQU 081H ; Clear the entire Framebuffer.
GPUCLEARGRAMP EQU 082H ; Clear the Framebuffer according to parameters.
GPURESET EQU 0FFH ; Reset the GPU, return to idle state.
;-----------------------------------------------
; tranZPUter SW Memory Management modes
;-----------------------------------------------
TZMM_ORIG EQU 000H ; Original Sharp MZ80A mode, no tranZPUter features are selected except the I/O control registers (default: 0x60-063).
TZMM_BOOT EQU 001H ; Original mode but E800-EFFF is mapped to tranZPUter RAM so TZFS can be booted.
TZMM_TZFS EQU 002H ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-FFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected.
TZMM_TZFS2 EQU 003H ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 1.
TZMM_TZFS3 EQU 004H ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 2.
TZMM_TZFS4 EQU 005H ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 3.
TZMM_CPM EQU 006H ; CPM main memory configuration, all memory on the tranZPUter board, 64K block 4 selected. Special case for F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_CPM2 EQU 007H ; CPM main memory configuration, F000-FFFF are on the tranZPUter board in block 4, 0040-CFFF and E800-EFFF are in block 5, mainboard for D000-DFFF (video), E000-E800 (Memory control) selected.
; Special case for 0000:003F (interrupt vectors) which resides in block 4, F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_COMPAT EQU 008H + TZMM_ENIOWAIT ; Original mode but with main DRAM in Bank 0 to allow bootstrapping of programs from other machines such as the MZ700.
TZMM_HOSTACCESS EQU 009H + TZMM_ENIOWAIT ; Mode to allow code running in Bank 0, address E800:FFFF to access host memory. Monitor ROM 0000-0FFF and Main DRAM 0x1000-0xD000, video and memory mapped I/O are on the host machine, User/Floppy ROM E800-FFFF are in tranZPUter memory.
TZMM_MZ700_0 EQU 00AH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the mainboard.
TZMM_MZ700_1 EQU 00BH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_2 EQU 00CH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_3 EQU 00DH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ700_4 EQU 00EH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ800 EQU 00FH + TZMM_ENIOWAIT ; MZ800 Mode - Tracks original hardware mode offering MZ700/MZ800 configurations.
TZMM_MZ2000 EQU 010H + TZMM_ENIOWAIT; ; MZ2000 Mode - Running on MZ2000 hardware, configuration set according to runtime configuration registers.
TZMM_FPGA EQU 015H + TZMM_ENIOWAIT ; Open up access for the K64F to the FPGA resources such as memory. All other access to RAM or mainboard is blocked.
TZMM_TZPUM EQU 016H + TZMM_ENIOWAIT ; Everything in on mainboard, no access to tranZPUter memory.
TZMM_TZPU EQU 017H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU0 EQU 018H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU1 EQU 019H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 1 is selected.
;TZMM_TZPU2 EQU 01AH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 2 is selected.
;TZMM_TZPU3 EQU 01BH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 3 is selected.
;TZMM_TZPU4 EQU 01CH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 4 is selected.
;TZMM_TZPU5 EQU 01DH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 5 is selected.
;TZMM_TZPU6 EQU 01EH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 6 is selected.
;TZMM_TZPU7 EQU 01FH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 7 is selected.
;-----------------------------------------------
; TZ File System Header (MZF)
;-----------------------------------------------
TZFS_ATRB: EQU 00000h ; Code Type, 01 = Machine Code.
TZFS_NAME: EQU 00001h ; Title/Name (17 bytes).
TZFS_SIZE: EQU 00012h ; Size of program.
TZFS_DTADR: EQU 00014h ; Load address of program.
TZFS_EXADR: EQU 00016h ; Exec address of program.
TZFS_COMNT: EQU 00018h ; Comment
TZFS_MZFLEN: EQU 128 ; Length of the MZF header.
TZFS_CMTLEN: EQU 104 ; Length of the comment field
;-----------------------------------------------
; BIOS WORK AREA (MZ80A)
;-----------------------------------------------

View File

@@ -0,0 +1,362 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: TZFS_Definitions.asm
;- Created: September 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- Credits:
;- Copyright: (c) 2019-21 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- July 2020 - Updates to accommodate v2.1 of the tranZPUter board.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;-----------------------------------------------
; Features.
;-----------------------------------------------
BUILD_MZ80A EQU 0 ; Build for the standard Sharp MZ80A, no lower memory.
BUILD_MZ700 EQU 0 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ2000 EQU 1 ; Build for the Sharp MZ-2000 base hardware.
; Debugging
ENADEBUG EQU 0 ; Enable debugging logic, 1 = enable, 0 = disable
;-----------------------------------------------
; Entry/compilation start points.
;-----------------------------------------------
MROMADDR EQU 00000H ; Start of SA1510 Monitor ROM.
UROMADDR EQU 0E800H ; Start of User ROM Address space.
UROMBSTBL EQU UROMADDR + 020H ; Entry point to the bank switching table.
TZFSJMPTABLE EQU UROMADDR + 00080H ; Start of jump table.
BANKRAMADDR EQU 0F000H ; Start address of the banked RAM used for TZFS functionality.
FDCROMADDR EQU 0F000H
FDCJMP1 EQU 0F3FEH ; ROM paged vector 1.
FDCJMP2 EQU 0F7FEH ; ROM paged vector 2.
FDCJMP3 EQU 0F7FEH ; ROM paged vector 3.
FDCJMP4 EQU 0F7FEH ; ROM paged vector 4.
PRGBOOTJMP EQU 0CF00H ; Location to load bootstrap for original host program.
;-----------------------------------------------
; Common character definitions.
;-----------------------------------------------
SCROLL EQU 001H ;Set scroll direction UP.
BELL EQU 007H
SPACE EQU 020H
TAB EQU 009H ;TAB ACROSS (8 SPACES FOR SD-BOARD)
CR EQU 00DH
LF EQU 00AH
FF EQU 00CH
CS EQU 0CH ; Clear screen
DELETE EQU 07FH
BACKS EQU 008H
SOH EQU 1 ; For XModem etc.
EOT EQU 4
ACK EQU 6
NAK EQU 015H
NUL EQU 000H
NULL EQU 000H
CTRL_A EQU 001H
CTRL_B EQU 002H
CTRL_C EQU 003H
CTRL_D EQU 004H
CTRL_E EQU 005H
CTRL_F EQU 006H
CTRL_G EQU 007H
CTRL_H EQU 008H
CTRL_I EQU 009H
CTRL_J EQU 00AH
CTRL_K EQU 00BH
CTRL_L EQU 00CH
CTRL_M EQU 00DH
CTRL_N EQU 00EH
CTRL_O EQU 00FH
CTRL_P EQU 010H
CTRL_Q EQU 011H
CTRL_R EQU 012H
CTRL_S EQU 013H
CTRL_T EQU 014H
CTRL_U EQU 015H
CTRL_V EQU 016H
CTRL_W EQU 017H
CTRL_X EQU 018H
CTRL_Y EQU 019H
CTRL_Z EQU 01AH
ESC EQU 01BH
CTRL_SLASH EQU 01CH
CTRL_LB EQU 01BH
CTRL_RB EQU 01DH
CTRL_CAPPA EQU 01EH
CTRL_UNDSCR EQU 01FH
CTRL_AT EQU 000H
NOKEY EQU 0F0H
CURSRIGHT EQU 0F1H
CURSLEFT EQU 0F2H
CURSUP EQU 0F3H
CURSDOWN EQU 0F4H
DBLZERO EQU 0F5H
INSERT EQU 0F6H
CLRKEY EQU 0F7H
HOMEKEY EQU 0F8H
BREAKKEY EQU 0FBH
GRAPHKEY EQU 0FCH
ALPHAKEY EQU 0FDH
;-----------------------------------------------
; Memory mapped ports in hardware.
;-----------------------------------------------
SCRN: EQU 0D000H
ARAM: EQU 0D800H
DSPCTL: EQU 0DFFFH ; Screen 40/80 select register (bit 7)
KEYPA: EQU 0E000h
KEYPB: EQU 0E001h
KEYPC: EQU 0E002h
KEYPF: EQU 0E003h
CSTR: EQU 0E002h
CSTPT: EQU 0E003h
CONT0: EQU 0E004h
CONT1: EQU 0E005h
CONT2: EQU 0E006h
CONTF: EQU 0E007h
SUNDG: EQU 0E008h
TEMP: EQU 0E008h
MEMSW: EQU 0E00CH
MEMSWR: EQU 0E010H
INVDSP: EQU 0E014H
NRMDSP: EQU 0E015H
SCLDSP: EQU 0E200H
SCLBASE: EQU 0E2H
;-----------------------------------------------
; IO ports in hardware and values.
;-----------------------------------------------
MMCFG EQU 060H ; Memory management configuration latch.
SETXMHZ EQU 062H ; Select the alternate clock frequency.
SET2MHZ EQU 064H ; Select the system 2MHz clock frequency.
CLKSELRD EQU 066H ; Read clock selected setting, 0 = 2MHz, 1 = XMHz
SVCREQ EQU 068H ; I/O Processor service request.
CPLDSTATUS EQU 06BH ; Version 2.1 CPLD status register.
CPUCFG EQU 06CH ; Version 2.2 CPU configuration register.
CPUSTATUS EQU 06CH ; Version 2.2 CPU runtime status register.
CPUINFO EQU 06DH ; Version 2.2 CPU information register.
CPLDCFG EQU 06EH ; Version 2.1 CPLD configuration register.
CPLDINFO EQU 06FH ; Version 2.1 CPLD version information register.
VMPNUM EQU 0A0H ; Set the parameter number to update.
VMPLBYTE EQU 0A1H ; Update the lower selected parameter byte.
VMPUBYTE EQU 0A2H ; Update the upper selected parameter byte.
PALSLCTOFF EQU 0A3H ; set the palette slot Off position to be adjusted.
PALSLCTON EQU 0A4H ; set the palette slot On position to be adjusted.
PALSETRED EQU 0A5H ; set the red palette value according to the PALETTE_PARAM_SEL address.
PALSETGREEN EQU 0A6H ; set the green palette value according to the PALETTE_PARAM_SEL address.
PALSETBLUE EQU 0A7H ; set the blue palette value according to the PALETTE_PARAM_SEL address.
VMPALETTE EQU 0B0H ; Select Palette:
; 0xB0 sets the palette. The Video Module supports 4 bit per colour output but there is only enough RAM for 1 bit per colour so the pallette is used to change the colours output.
; Bits [7:0] defines the pallete number. This indexes a lookup table which contains the required 4bit output per 1bit input.
; GPU:
GPUPARAM EQU 0B2H ; 0xB2 set parameters. Store parameters in a long word to be used by the graphics command processor.
; The parameter word is 128 bit and each write to the parameter word shifts left by 8 bits and adds the new byte at bits 7:0.
GPUCMD EQU 0B3H ; 0xB3 set the graphics processor unit commands.
GPUSTATUS EQU 0B3H ; [7;1] - FSM state, [0] - 1 = busy, 0 = idle
; Bits [5:0] - 0 = Reset parameters.
; 1 = Clear to val. Start Location (16 bit), End Location (16 bit), Red Filter, Green Filter, Blue Filter
;
VMCTRL EQU 0B8H ; Video Module control register. [2:0] - 000 (default) = MZ80A, 001 = MZ-700, 010 = MZ800, 011 = MZ80B, 100 = MZ80K, 101 = MZ80C, 110 = MZ1200, 111 = MZ2000. [3] = 0 - 40 col, 1 - 80 col.
VMGRMODE EQU 0B9H ; Video Module graphics mode. 7/6 = Operator (00=OR,01=AND,10=NAND,11=XOR), 5=GRAM Output Enable, 4 = VRAM Output Enable, 3/2 = Write mode (00=Page 1:Red, 01=Page 2:Green, 10=Page 3:Blue, 11=Indirect), 1/0=Read mode (00=Page 1:Red, 01=Page2:Green, 10=Page 3:Blue, 11=Not used).
VMREDMASK EQU 0BAH ; Video Module Red bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMGREENMASK EQU 0BBH ; Video Module Green bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMBLUEMASK EQU 0BCH ; Video Module Blue bit mask (1 bit = 1 pixel, 8 pixels per byte).
VMPAGE EQU 0BDH ; Video Module memory page register. [1:0] switches in 1 16Kb page (3 pages) of graphics ram to C000 - FFFF. Bits [1:0] = page, 00 = off, 01 = Red, 10 = Green, 11 = Blue. This overrides all MZ700/MZ80B page switching functions. [7] 0 - normal, 1 - switches in CGROM for upload at D000:DFFF.
VMVGATTR EQU 0BEH ; Select VGA Border colour and attributes. Bit 2 = Red, 1 = Green, 0 = Blue.
VMVGAMODE EQU 0BFH ; Select VGA output mode. Bits [3:0] - Output mode.
GDCRTC EQU 0CFH ; MZ-800 CRTC control register
GDCMD EQU 0CEH ; MZ-800 CRTC Mode register
GDGRF EQU 0CDH ; MZ-800 read format register
GDGWF EQU 0CCH ; MZ-800 write format register
MMIO0 EQU 0E0H ; MZ-700/MZ-800 Memory Management Set 0
MMIO1 EQU 0E1H ; MZ-700/MZ-800 Memory Management Set 1
MMIO2 EQU 0E2H ; MZ-700/MZ-800 Memory Management Set 2
MMIO3 EQU 0E3H ; MZ-700/MZ-800 Memory Management Set 3
MMIO4 EQU 0E4H ; MZ-700/MZ-800 Memory Management Set 4
MMIO5 EQU 0E5H ; MZ-700/MZ-800 Memory Management Set 5
MMIO6 EQU 0E6H ; MZ-700/MZ-800 Memory Management Set 6
MMIO7 EQU 0E7H ; MZ-700/MZ-800 Memory Management Set 7
SYSCTRL EQU 0F0H ; System board control register. [2:0] - 000 MZ80A Mode, 2MHz CPU/Bus, 001 MZ80B Mode, 4MHz CPU/Bus, 010 MZ700 Mode, 3.54MHz CPU/Bus.
GRAMMODE EQU 0F4H ; MZ80B Graphics mode. Bit 0 = 0, Write to Graphics RAM I, Bit 0 = 1, Write to Graphics RAM II. Bit 1 = 1, blend Graphics RAM I output on display, Bit 2 = 1, blend Graphics RAM II output on display.
;-----------------------------------------------
; CPLD Configuration constants.
;-----------------------------------------------
MODE_MZ80K EQU 0 ; Set to MZ-80K mode.
MODE_MZ80C EQU 1 ; Set to MZ-80C mode.
MODE_MZ1200 EQU 2 ; Set to MZ-1200 mode.
MODE_MZ80A EQU 3 ; Set to MZ-80A mode (base mode on MZ-80A hardware).
MODE_MZ700 EQU 4 ; Set to MZ-700 mode (base mode on MZ-700 hardware).
MODE_MZ800 EQU 5 ; Set to MZ-800 mode.
MODE_MZ80B EQU 6 ; Set to MZ-80B mode.
MODE_MZ2000 EQU 7 ; Set to MZ-2000 mode.
MODE_VIDEO_FPGA EQU 8 ; Bit flag (bit 3) to switch CPLD into using the new FPGA video hardware.
MODE_RESET_PRESERVE EQU 080H ; Preserve register configuration through reset.
;-----------------------------------------------
; CPLD Command Instruction constants.
;-----------------------------------------------
CPLD_RESET_HOST EQU 1 ; CPLD level command to reset the host system.
CPLD_HOLD_HOST_BUS EQU 2 ; CPLD command to hold the host bus.
CPLD_RELEASE_HOST_BUS EQU 3 ; CPLD command to release the host bus.
;-----------------------------------------------
; FPGA CPU enhancement control bits.
;-----------------------------------------------
CPUMODE_SET_Z80 EQU 000H ; Set the CPU to the hard Z80.
CPUMODE_SET_T80 EQU 001H ; Set the CPU to the soft T80.
CPUMODE_SET_ZPU_EVO EQU 002H ; Set the CPU to the soft ZPU Evolution.
CPUMODE_SET_EMU_MZ EQU 004H ; Set the hardware to enable the Sharp MZ Series emulations.
CPUMODE_SET_BBB EQU 008H ; Place holder for a future soft CPU.
CPUMODE_SET_CCC EQU 010H ; Place holder for a future soft CPU.
CPUMODE_SET_DDD EQU 020H ; Place holder for a future soft CPU.
CPUMODE_IS_Z80 EQU 000H ; Status value to indicate if the hard Z80 available.
CPUMODE_IS_T80 EQU 001H ; Status value to indicate if the soft T80 available.
CPUMODE_IS_ZPU_EVO EQU 002H ; Status value to indicate if the soft ZPU Evolution available.
CPUMODE_IS_EMU_MZ EQU 004H ; Status value to indicate the Sharp MZ Series Hardware Emulation logic is available.
CPUMODE_IS_BBB EQU 008H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_CCC EQU 010H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_IS_DDD EQU 020H ; Place holder to indicate if a future soft CPU is available.
CPUMODE_RESET_CPU EQU 080H ; Reset the soft CPU. Active high, when high the CPU is held in RESET, when low the CPU runs.
CPUMODE_IS_SOFT_AVAIL EQU 040H ; Marker to indicate if the underlying FPGA can support soft CPU's.
CPUMODE_IS_SOFT_MASK EQU 0C0H ; Mask to filter out the Soft CPU availability flags.
CPUMODE_IS_CPU_MASK EQU 03FH ; Mask to filter out which soft CPU's are available.
;-----------------------------------------------
; Video Module control bits.
;-----------------------------------------------
MODE_80CHAR EQU 010H ; Enable 80 character display.
MODE_COLOUR EQU 020H ; Enable colour display.
SYSMODE_MZ80A EQU 000H ; System board mode MZ80A, 2MHz CPU/Bus.
SYSMODE_MZ80B EQU 020H ; System board mode MZ80B, 4MHz CPU/Bus.
SYSMODE_MZ2000 EQU 020H ; System board mode MZ2000, 4MHz CPU/Bus.
SYSMODE_MZ700 EQU 042H ; System board mode MZ700, 3.54MHz CPU/Bus.
VMMODE_MZ80K EQU 000H ; Video mode = MZ80K
VMMODE_MZ80C EQU 001H ; Video mode = MZ80C
VMMODE_MZ1200 EQU 002H ; Video mode = MZ1200
VMMODE_MZ80A EQU 003H ; Video mode = MZ80A
VMMODE_MZ700 EQU 004H ; Video mode = MZ700
VMMODE_MZ800 EQU 005H ; Video mode = MZ800
VMMODE_MZ1500 EQU 006H ; Video mode = MZ1500
VMMODE_MZ80B EQU 007H ; Video mode = MZ80B
VMMODE_MZ2000 EQU 008H ; Video mode = MZ2000
VMMODE_MZ2200 EQU 009H ; Video mode = MZ2200
VMMODE_MZ2500 EQU 00AH ; Video mode = MZ2500
VMMODE_PCGRAM EQU 020H ; Enable PCG RAM.
VMMODE_VGA_OFF EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT EQU 000H ; Set VGA mode off, external monitor is driven by standard internal 60Hz signals.
VMMODE_VGA_INT50 EQU 001H ; Set VGA mode off, external monitor is driven by standard internal 50Hz signals.
VMMODE_VGA_640x480 EQU 002H ; Set external monitor to VGA 640x480 @ 60Hz mode.
VMMODE_VGA_800x600 EQU 003H ; Set external monitor to VGA 800x600 @ 60Hz mode.
;-----------------------------------------------
; GPU commands.
;-----------------------------------------------
GPUCLEARVRAM EQU 001H ; Clear the VRAM without updating attributes.
GPUCLEARVRAMCA EQU 002H ; Clear the VRAM/ARAM with given attribute byte,
GPUCLEARVRAMP EQU 003H ; Clear the VRAM/ARAM with parameters.
GPUCLEARGRAM EQU 081H ; Clear the entire Framebuffer.
GPUCLEARGRAMP EQU 082H ; Clear the Framebuffer according to parameters.
GPURESET EQU 0FFH ; Reset the GPU, return to idle state.
;-----------------------------------------------
; tranZPUter SW Memory Management modes
;-----------------------------------------------
TZMM_ENIOWAIT EQU 020H ; Memory management IO Wait State enable - insert a wait state when an IO operation to E0-FF is executed.
TZMM_ORIG EQU 000H ; Original Sharp MZ80A mode, no tranZPUter features are selected except the I/O control registers (default: 0x60-063).
TZMM_BOOT EQU 001H ; Original mode but E800-EFFF is mapped to tranZPUter RAM so TZFS can be booted.
TZMM_TZFS EQU 002H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-FFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected.
TZMM_TZFS2 EQU 003H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 1.
TZMM_TZFS3 EQU 004H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 2.
TZMM_TZFS4 EQU 005H + TZMM_ENIOWAIT ; TZFS main memory configuration. all memory is in tranZPUter RAM, E800-EFFF is used by TZFS, SA1510 is at 0000-1000 and RAM is 1000-CFFF, 64K Block 0 selected, F000-FFFF is in 64K Block 3.
TZMM_CPM EQU 006H + TZMM_ENIOWAIT ; CPM main memory configuration, all memory on the tranZPUter board, 64K block 4 selected. Special case for F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_CPM2 EQU 007H + TZMM_ENIOWAIT ; CPM main memory configuration, F000-FFFF are on the tranZPUter board in block 4, 0040-CFFF and E800-EFFF are in block 5, mainboard for D000-DFFF (video), E000-E800 (Memory control) selected.
; Special case for 0000:003F (interrupt vectors) which resides in block 4, F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard.
TZMM_COMPAT EQU 008H + TZMM_ENIOWAIT ; Original mode but with main DRAM in Bank 0 to allow bootstrapping of programs from other machines such as the MZ700.
TZMM_HOSTACCESS EQU 009H + TZMM_ENIOWAIT ; Mode to allow code running in Bank 0, address E800:FFFF to access host memory. Monitor ROM 0000-0FFF and Main DRAM 0x1000-0xD000, video and memory mapped I/O are on the host machine, User/Floppy ROM E800-FFFF are in tranZPUter memory.
TZMM_MZ700_0 EQU 00AH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the mainboard.
TZMM_MZ700_1 EQU 00BH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_2 EQU 00CH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is on the tranZPUter in block 6.
TZMM_MZ700_3 EQU 00DH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 0, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ700_4 EQU 00EH + TZMM_ENIOWAIT ; MZ700 Mode - 0000:0FFF is on the tranZPUter board in block 6, 1000:CFFF is on the tranZPUter board in block 0, D000:FFFF is inaccessible.
TZMM_MZ800 EQU 00FH + TZMM_ENIOWAIT ; MZ800 Mode - Tracks original hardware mode offering MZ700/MZ800 configurations.
TZMM_MZ2000 EQU 010H + TZMM_ENIOWAIT; ; MZ2000 Mode - Running on MZ2000 hardware, configuration set according to runtime configuration registers.
TZMM_FPGA EQU 015H + TZMM_ENIOWAIT ; Open up access for the K64F to the FPGA resources such as memory. All other access to RAM or mainboard is blocked.
TZMM_TZPUM EQU 016H + TZMM_ENIOWAIT ; Everything in on mainboard, no access to tranZPUter memory.
TZMM_TZPU EQU 017H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU0 EQU 018H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 0 is selected.
;TZMM_TZPU1 EQU 019H + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 1 is selected.
;TZMM_TZPU2 EQU 01AH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 2 is selected.
;TZMM_TZPU3 EQU 01BH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 3 is selected.
;TZMM_TZPU4 EQU 01CH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 4 is selected.
;TZMM_TZPU5 EQU 01DH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 5 is selected.
;TZMM_TZPU6 EQU 01EH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 6 is selected.
;TZMM_TZPU7 EQU 01FH + TZMM_ENIOWAIT ; Everything is in tranZPUter domain, no access to underlying Sharp mainboard unless memory management mode is switched. tranZPUter RAM 64K block 7 is selected.
;-----------------------------------------------
; TZ File System Header (MZF)
;-----------------------------------------------
TZFS_ATRB: EQU 00000h ; Code Type, 01 = Machine Code.
TZFS_NAME: EQU 00001h ; Title/Name (17 bytes).
TZFS_SIZE: EQU 00012h ; Size of program.
TZFS_DTADR: EQU 00014h ; Load address of program.
TZFS_EXADR: EQU 00016h ; Exec address of program.
TZFS_COMNT: EQU 00018h ; Comment
TZFS_MZFLEN: EQU 128 ; Length of the MZF header.
TZFS_CMTLEN: EQU 104 ; Length of the comment field
;-----------------------------------------------
; Entry/compilation start points.
;-----------------------------------------------
TPSTART: EQU 010F0h
MEMSTART: EQU 01200h
MSTART: EQU 0E900h
MZFHDRSZ EQU 128
TZFSSECTSZ EQU 256
MROMSIZE EQU 4096
UROMSIZE EQU 2048
FNSIZE EQU 17
;-----------------------------------------------
; RAM Banks, 0-3 are reserved for TZFS code in
; the User/Floppy ROM bank area.
;-----------------------------------------------
USRROMPAGES EQU 3 ; User ROM
ROMBANK0 EQU 0 ; TZFS Bank 0 - Main RFS Entry point and functions.
ROMBANK1 EQU 1 ; TZFS Bank 1 -
ROMBANK2 EQU 2 ; TZFS Bank 2 -
ROMBANK3 EQU 3 ; TZFS Bank 3 -
OBJCD EQU 001H ; MZF contains a binary object.
BTX1CD EQU 002H ; MZF contains a BASIC program.
BTX2CD EQU 005H ; MZF contains a BASIC program.
TZOBJCD0 EQU 0F8H ; MZF contains a TZFS binary object for page 0.
TZOBJCD1 EQU 0F9H
TZOBJCD2 EQU 0FAH
TZOBJCD3 EQU 0FBH
TZOBJCD4 EQU 0FCH
TZOBJCD5 EQU 0FDH
TZOBJCD6 EQU 0FEH
TZOBJCD7 EQU 0FFH ; MZF contains a TZFS binary object for page 7.

View File

@@ -0,0 +1,193 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: tzfs_mondef.asm
;- Created: September 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- This file contains the SA-1510/1Z-013A monitor specific definitions.
;-
;- Credits:
;- Copyright: (c) 2019-21 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- July 2020 - Updates to accommodate v2.1 of the tranZPUter board.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;-------------------------------------------------------
; Function entry points in the standard SA-1510 Monitor.
;-------------------------------------------------------
GETL: EQU 00003h
LETNL: EQU 00006h
NL: EQU 00009h
PRNTS: EQU 0000Ch
PRNT: EQU 00012h
MSG: EQU 00015h
MSGX: EQU 00018h
GETKY EQU 0001Bh
BRKEY EQU 0001Eh
?WRI EQU 00021h
?WRD EQU 00024h
?RDI EQU 00027h
?RDD EQU 0002Ah
?VRFY EQU 0002Dh
MELDY EQU 00030h
?TMST EQU 00033h
MONIT: EQU 00000h
;SS: EQU 00089h
;ST1: EQU 00095h
HLHEX EQU 00410h
_2HEX EQU 0041Fh
;?MODE: EQU 0074DH
;?KEY EQU 008CAh
PRNT3 EQU 0096Ch
?ADCN EQU 00BB9h
?DACN EQU 00BCEh
?DSP: EQU 00DB5H
?BLNK EQU 00DA6h
?DPCT EQU 00DDCh
PRTHL: EQU 003BAh
PRTHX: EQU 003C3h
HEX: EQU 003F9h
DPCT: EQU 00DDCh
;DLY12: EQU 00DA7h
;DLY12A: EQU 00DAAh
?RSTR1: EQU 00EE6h
;MOTOR: EQU 006A3H
CKSUM: EQU 0071AH
GAP: EQU 0077AH
;WTAPE: EQU 00485H
MSTOP: EQU 00700H
; ROM location differences between the MZ80A and MZ-700.
IF BUILD_MZ80A > 0
SS: EQU 00089h
ST1: EQU 00095h
WTAPE: EQU 00485H
MOTOR: EQU 006A3H
?MODE: EQU 0074DH
?KEY EQU 008CAh
DLY12: EQU 00DA7h
DLY12A: EQU 00DAAh
ELSE
SS: EQU 000A2H
ST1: EQU 000ADH
WTAPE: EQU 0048AH
MOTOR: EQU 0069FH
?MODE: EQU 0073EH
?KEY EQU 009B3H
DLY12: EQU 00996H
ENDIF
;-----------------------------------------------
; SA-1510 MONITOR WORK AREA (MZ80A)
;-----------------------------------------------
STACK: EQU 010F0H
;
ORG STACK
;
SPV:
IBUFE: ; TAPE BUFFER (128 BYTES)
ATRB: DS virtual 1 ; ATTRIBUTE
NAME: DS virtual FNSIZE ; FILE NAME
SIZE: DS virtual 2 ; BYTESIZE
DTADR: DS virtual 2 ; DATA ADDRESS
EXADR: DS virtual 2 ; EXECUTION ADDRESS
COMNT: DS virtual 92 ; COMMENT
SWPW: DS virtual 10 ; SWEEP WORK
KDATW: DS virtual 2 ; KEY WORK
KANAF: DS virtual 1 ; KANA FLAG (01=GRAPHIC MODE)
DSPXY: DS virtual 2 ; DISPLAY COORDINATES
MANG: DS virtual 6 ; COLUMN MANAGEMENT
MANGE: DS virtual 1 ; COLUMN MANAGEMENT END
PBIAS: DS virtual 1 ; PAGE BIAS
ROLTOP: DS virtual 1 ; ROLL TOP BIAS
MGPNT: DS virtual 1 ; COLUMN MANAG. POINTER
PAGETP: DS virtual 2 ; PAGE TOP
ROLEND: DS virtual 1 ; ROLL END
DS virtual 14 ; BIAS
FLASH: DS virtual 1 ; FLASHING DATA
SFTLK: DS virtual 1 ; SHIFT LOCK
REVFLG: DS virtual 1 ; REVERSE FLAG
SPAGE: DS virtual 1 ; PAGE CHANGE
FLSDT: DS virtual 1 ; CURSOR DATA
STRGF: DS virtual 1 ; STRING FLAG
DPRNT: DS virtual 1 ; TAB COUNTER
TMCNT: DS virtual 2 ; TAPE MARK COUNTER
SUMDT: DS virtual 2 ; CHECK SUM DATA
CSMDT: DS virtual 2 ; FOR COMPARE SUM DATA
AMPM: DS virtual 1 ; AMPM DATA
TIMFG: DS virtual 1 ; TIME FLAG
SWRK: DS virtual 1 ; KEY SOUND FLAG
TEMPW: DS virtual 1 ; TEMPO WORK
ONTYO: DS virtual 1 ; ONTYO WORK
OCTV: DS virtual 1 ; OCTAVE WORK
RATIO: DS virtual 2 ; ONPU RATIO
BUFER: DS virtual 81 ; GET LINE BUFFER
; Quickdisk work area
;QDPA EQU 01130h ; QD code 1
;QDPB EQU 01131h ; QD code 2
;QDPC EQU 01132h ; QD header startaddress
;QDPE EQU 01134h ; QD header length
;QDCPA EQU 0113Bh ; QD error flag
;HDPT EQU 0113Ch ; QD new headpoint possition
;HDPT0 EQU 0113Dh ; QD actual headpoint possition
;FNUPS EQU 0113Eh
;FNUPF EQU 01140h
;FNA EQU 01141h ; File Number A (actual file number)
;FNB EQU 01142h ; File Number B (next file number)
;MTF EQU 01143h ; QD motor flag
;RTYF EQU 01144h
;SYNCF EQU 01146h ; SyncFlags
;RETSP EQU 01147h
;BUFER EQU 011A3h
;QDIRBF EQU 0CD90h
;SPV:
;IBUFE: ; TAPE BUFFER (128 BYTES)
;ATRB: DS virtual 1 ; Code Type, 01 = Machine Code.
;NAME: DS virtual 17 ; Title/Name (17 bytes).
;SIZE: DS virtual 2 ; Size of program.
;DTADR: DS virtual 2 ; Load address of program.
;EXADR: DS virtual 2 ; Exec address of program.
;COMNT: DS virtual 104 ; COMMENT
;KANAF: DS virtual 1 ; KANA FLAG (01=GRAPHIC MODE)
;DSPXY: DS virtual 2 ; DISPLAY COORDINATES
;MANG: DS virtual 27 ; COLUMN MANAGEMENT
;FLASH: DS virtual 1 ; FLASHING DATA
;FLPST: DS virtual 2 ; FLASHING POSITION
;FLSST: DS virtual 1 ; FLASHING STATUS
;FLSDT: DS virtual 1 ; CURSOR DATA
;STRGF: DS virtual 1 ; STRING FLAG
;DPRNT: DS virtual 1 ; TAB COUNTER
;TMCNT: DS virtual 2 ; TAPE MARK COUNTER
;SUMDT: DS virtual 2 ; CHECK SUM DATA
;CSMDT: DS virtual 2 ; FOR COMPARE SUM DATA
;AMPM: DS virtual 1 ; AMPM DATA
;TIMFG: DS virtual 1 ; TIME FLAG
;SWRK: DS virtual 1 ; KEY SOUND FLAG
;TEMPW: DS virtual 1 ; TEMPO WORK
;ONTYO: DS virtual 1 ; ONTYO WORK
;OCTV: DS virtual 1 ; OCTAVE WORK
;RATIO: DS virtual 2 ; ONPU RATIO

View File

@@ -0,0 +1,123 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: tzfs_svcstruct.asm
;- Created: September 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- This file holds the TZFS service structure definition.
;-
;- Credits:
;- Copyright: (c) 2019-21 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- July 2020 - Updates to accommodate v2.1 of the tranZPUter board.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
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_LOAD40ABIOS EQU 20H ; Service command requesting that the 40 column version of the SA1510 BIOS is loaded.
TZSVC_CMD_LOAD80ABIOS 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_LOAD800BIOS EQU 25H ; Service command requesting that the MZ800 9Z-504M BIOS is loaded.
TZSVC_CMD_LOAD2KIPL EQU 26H ; Service command requesting the MZ-2000 IPL is loaded.
TZSVC_CMD_LOAD2KBASIC1 EQU 27H ; Service command to load BASIC 1Z-001 for the MZ-2000.
TZSVC_CMD_LOAD2KBASIC2 EQU 28H ; Service command to load BASIC 1Z-002 for the MZ-2000.
TZSVC_CMD_LOAD2KMON EQU 29H ; Service command to load Monitor 1Z001M for the MZ-2000 IPL.
TZSVC_CMD_LOADTZFS EQU 2FH ; Service command requesting the loading of TZFS. This service is for machines which normally dont have a monitor BIOS. ie. MZ-80B/MZ-2000 and manually request TZFS.
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_CMD_CPU_SETZ80 EQU 50H ; Service command to switch to the external Z80 hard cpu.
TZSVC_CMD_CPU_SETT80 EQU 51H ; Service command to switch to the internal T80 soft cpu.
TZSVC_CMD_CPU_SETZPUEVO EQU 52H ; Service command to switch to the internal ZPU Evolution soft cpu.
TZSVC_CMD_EMU_SETMZ80K EQU 53H ; Service command to switch to the internal Sharp MZ Series Emulation of the MZ80K.
TZSVC_CMD_EMU_SETMZ80C EQU 54H ; "" "" "" MZ80C.
TZSVC_CMD_EMU_SETMZ1200 EQU 55H ; "" "" "" MZ1200.
TZSVC_CMD_EMU_SETMZ80A EQU 56H ; "" "" "" MZ80A.
TZSVC_CMD_EMU_SETMZ700 EQU 57H ; "" "" "" MZ700.
TZSVC_CMD_EMU_SETMZ800 EQU 58H ; "" "" "" MZ800.
TZSVC_CMD_EMU_SETMZ1500 EQU 59H ; "" "" "" MZ1500.
TZSVC_CMD_EMU_SETMZ80B EQU 5AH ; "" "" "" MZ80B.
TZSVC_CMD_EMU_SETMZ2000 EQU 5BH ; "" "" "" MZ2000.
TZSVC_CMD_EMU_SETMZ2200 EQU 5CH ; "" "" "" MZ2200.
TZSVC_CMD_EMU_SETMZ2500 EQU 5DH ; "" "" "" MZ2500.
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.
; Variables and control structure used by the I/O processor for service calls and requests.
ORG TZSVCMEM
;TZSVCMEM: EQU 0ED80H ; Start of a memory structure used to communicate with the K64F I/O processor for services such as disk access.
TZSVCSIZE: EQU 00280H ;
TZSVCDIRSZ: EQU 20 ; Size of the directory/file name.
TZSVCFILESZ: EQU 17 ; Size of a Sharp filename.
TZSVCLONGFILESZ: EQU 31 ; Size of a standard filename.
TZSVCLONGFMTSZ: EQU 20 ; Size of a formatted standard filename for use in directory listings.
TZSVCWILDSZ: EQU 20 ; Size of the wildcard.
TZSVCSECSIZE: EQU 512
TZSVCDIR_ENTSZ: EQU 32 ; Size of a directory entry.
TZSVCWAITIORETRIES: EQU 5 ; Wait retries for IO response.
TZSVCWAITCOUNT: EQU 65535 ; Wait retries for IO request response.
TZSVC_FTYPE_MZF: EQU 0 ; File type being handled is an MZF
TZSVC_FTYPE_MZFHDR: EQU 1 ; File type being handled is an MZF Header.
TZSVC_FTYPE_CAS: EQU 2 ; File type being handled is an CASsette BASIC script.
TZSVC_FTYPE_BAS: EQU 3 ; File type being handled is an BASic script
TZSVC_FTYPE_ALL: EQU 10 ; Handle any filetype.
TZSVC_FTYPE_ALLFMT: EQU 11 ; Special case for directory listings, all files but truncated and formatted.
TZSVCCMD: DS virtual 1 ; Service command.
TZSVCRESULT: DS virtual 1 ; Service command result.
TZSVCDIRSEC: DS virtual 1 ; Storage for the directory sector number.
TZSVC_FILE_SEC: EQU TZSVCDIRSEC ; Union of the file and directory sector as only one can be used at a time.
TZSVC_TRACK_NO: DS virtual 2 ; Storage for the virtual drive track number.
TZSVC_SECTOR_NO: DS virtual 2 ; Storage for the virtual drive sector number.
TZSVC_SECTOR_LBA: EQU TZSVC_TRACK_NO ; Sector in 32bit LBA format.
TZSVC_MEM_TARGET: EQU TZSVC_TRACK_NO ; Memory command should target, 0 = tranZPUter, 1 = mainboard.
TZSVC_FILE_NO: DS virtual 1 ; File number to be opened in a file service command.
TZSVC_FILE_TYPE: DS virtual 1 ; Type of file being accessed to differentiate between Sharp MZF files and other handled files.
TZSVC_LOADADDR: DS virtual 2 ; Dynamic load address for rom/images.
TZSVC_SAVEADDR: EQU TZSVC_LOADADDR ; Union of the load address and the cpu frequency change value, the address of data to be saved.
TZSVC_CPU_FREQ: EQU TZSVC_LOADADDR ; Union of the load address and the save address value, only one can be used at a time.
TZSVC_LOADSIZE: DS virtual 2 ; Size of image to load.
TZSVC_SAVESIZE: EQU TZSVC_LOADSIZE ; Size of image to be saved.
TZSVC_DIRNAME: DS virtual TZSVCDIRSZ ; Service directory/file name.
TZSVC_FILENAME: DS virtual TZSVCFILESZ ; Filename to be opened/created.
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.

View File

@@ -0,0 +1,498 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: RFS_Utilities.asm
;- Created: September 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- Credits:
;- Copyright: (c) 2019-20 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
; Comparing Strings
; IN HL Address of string1.
; DE Address of string2.
; BC Max bytes to compare, 0x00 or 0x0d will early terminate.
; OUT zero Set if string1 = string2, reset if string1 != string2.
; carry Set if string1 > string2, reset if string1 <= string2.
CMPSTRING: IF USE_CMPSTRING = 1
PUSH HL
PUSH DE
CMPSTR1: LD A, (DE) ; Compare bytes.
CP 000h ; Check for end of string.
JR Z, CMPSTR3
CP 00Dh
JR Z, CMPSTR3
CPI ; Compare bytes.
JR NZ, CMPSTR2 ; If (HL) != (DE), abort.
INC DE ; Update pointer.
JP PE, CMPSTR1 ; Next byte if BC not zero.
CMPSTR2: DEC HL
CP (HL) ; Compare again to affect carry.
CMPSTR4: POP DE
POP HL
RET
CMPSTR3: LD A, (HL)
CP 000h ; Check for end of string.
JR Z, CMPSTR4
CP 00Dh
JR Z, CMPSTR4
SCF ; String 1 greater than string 2
JR CMPSTR4
ENDIF
; IN HL Address of source string, length-prefixed.
; DE Address of destination string, length-prefixed.
; B Start index. 1 = first character.
; C Length of substring to return.
;
; OUT carry Set if an error condition happened:
; If B is zero, then uses index of 1.
; If index > source length, an empty string is returned.
; If index + return length > source length, returns all
; characters from index to end-of-string.
SUBSTRING: IF USE_SUBSTRING = 1
PUSH DE ; It would be convenient to keep DE pointing to
; the start of the destination string
OR A ; Boolean OR resets carry
PUSH AF ; Save carry
LD A, B ; Is index beyond source length?
CP (HL)
DEC A ; Decrement A so NC can be used
JR NC,SUBST3
ADD A, C ; If index+len is > 255, error
JR C, SUBST1
INC A ; Increment A so C can be used
CP (HL) ; If index+len is beyond source length, then error
JR C, SUBST2
SUBST1: POP AF ; Set carry flag
SCF
PUSH AF
LD A, (HL) ; Get source length
SUB B ; Subtract start index
INC A ; Compensate
LD C, A ; New size of string
SUBST2: LD A, C ; Size of sting to get
LD (DE), A ; Save length index
INC DE ; To body of string
LD A, B ; Get index
LD B, 0 ; Zero-extend BC for LDIR
ADD A, L ; This is a sneaky way to add A to HL
LD L, A ; without using up another 16-bit register
ADC A, H ;
SUB L ;
LD H, A ;
LDIR ; Copy substring over
POP AF ; Restore flags
POP DE ; Restore destination
RET
SUBST3: XOR A ; Set a length index of zero
LD (DE), A
POP AF ; Clean off stack and set carry
POP DE
SCF
RET
ENDIF
; IN HL Address of string to look in, length prefixed.
; DE Address of string to find, length prefixed.
;
; OUT
; If found:
; A Offset into look-up string where the target string was found.
; The first byte (ignoring length prefix) is offset 1.
; carry Reset.
;
; If not found:
; A = 0
; carry Set.
INDEX: IF USE_INDEX = 1
LD A, (DE) ; Abort if string to find is too big
CP (HL)
INC A
JR NC, IDXABORT
DEC A ; Save length of string to find
LD IXL, A
LD B, 0 ; Put length of string to search in BC
LD C, (HL)
INC HL ; Advance pointers
INC DE
PUSH HL ; Save start of search string
IDXRST: PUSH DE ; Save start of key string
LD A, IXL ; Initialize matched characters counter
LD IXH, A
LD A, (DE) ; Get a character to match
CPIR ; Look for it
JR NZ, IDXNF ; Abort if not found
IDXLOOP: DEC IXH ; Update counter and see if done
JR Z, IDXFOUND
INC DE ; Get next character in key string
LD A, (DE)
CPI ; See if it matches next char in master
JR Z, IDXLOOP
JP PO, IDXNF ; Abort if we ran out of characters
POP DE ; If a mismatch, restart from the beginning
JR IDXRST
IDXNF: POP DE ; Clean stack
POP HL
IDXABORT: XOR A ; Report failure
SCF
RET
IDXFOUND: POP DE
POP BC ; BC = address of master
XOR A ; Put size of key string in DE
LD D, A
LD E, IXL
SBC HL, DE ; Find index
SBC HL, BC
LD A, L
INC A
RET
ENDIF
; IN HL Address of string to be inserted
; DE Address of string to receive insertion
; C Index. Start of string is 0
; OUT
; If successful:
; carry Reset
; HL Input DE
; If unsuccessful:
; carry Set. If new string length is > 255.
;
; Notes If index > string length, string is appended.
; Data after the string is destroyed.
STRINSERT: IF USE_STRINSERT = 1
LD A, (DE)
LD B, A
INC A
CP C
JR NC, STRINSERT1
LD C, B
STRINSERT1:DEC A
ADD A, (HL)
RET C
LD (DE), A ; Update length
PUSH DE ; Make room
PUSH HL
LD A, (HL)
INC C
LD H, 0
LD L, C
ADD HL, DE
LD D, H
LD E, L
PUSH AF
ADD A, E
LD E, A
ADC A, D
SUB E
LD D, A
POP AF
LD B, 0
LD C, A
PUSH HL
LDIR
POP DE ; Copy string over
POP HL
LD C, (HL)
INC HL
LDIR
POP HL
RET
ENDIF
; IN HL Address of string.
; B Index of first character to delete. First character is 0.
; C Number of characters to kill.
; OUT
; If successful:
; carry Reset
; If unsuccessful:
; carry Set
;
; Notes If B > string length, then error.
; If B + C > string length, deletion
; stops at end of string.
STRDELETE: IF USE_STRDELETE = 1
LD A, B ; See if index is too big
CP (HL)
CCF ; Flip for error
RET C
ADD A, C ; See if too many chars on chopping block
CP (HL)
JR C, STRDELETE1
INC B ; Set index as length
LD (HL), B
RET
STRDELETE1:PUSH HL
LD A, (HL)
SUB C
LD (HL), A
INC HL
LD E, C
LD C, B
LD B, 0
ADD HL, BC
SUB C
LD C, E
LD D, H
LD E, L
ADD HL, BC
LD C, A
LDIR
POP HL
RET
ENDIF
; IN HL Address of first string.
; DE Address of second string.
; OUT
; If successful:
; carry Reset
; If unsuccessful:
; carry Set
;
; Notes If new string lenght is > 255, error.
; HL is saved.
CONCAT: IF USE_CONCAT = 1
LD A, (DE) ; Combine lengths
ADD A, (HL)
RET C
LD C, (HL)
LD (HL), A
LD B, 0
INC C
PUSH HL
ADD HL, BC
EX DE, HL
LD C, (HL)
INC HL
LDIR
POP HL
RET
ENDIF
; Utility: Convert character to upper case
; On entry: A = Character in either case
; On exit: A = Character in upper case
; BC DE HL IX IY I AF' BC' DE' HL' preserved
ConvertCharToUCase: IF USE_CNVUPPER = 1
CP 'a' ;Character less than 'a'?
RET C ;Yes, so finished
CP 'z'+1 ;Character greater than 'z'?
RET NC ;Yes, so finished
SUB 'a'-'A' ;Convert case
RET
ENDIF
;
; Utility: Convert character to numberic value
; On entry: A = ASCII character (0-9 or A-F)
; On exit: If character is a valid hex digit:
; A = Numberic value (0 to 15) and Z flagged
; If character is not a valid hex digit:
; A = 0xFF and NZ flagged
; BC DE HL IX IY I AF' BC' DE' HL' preserved
; Interrupts not enabled
ConvertCharToNumber: IF USE_CNVCHRTONUM = 1
CALL ConvertCharToUCase
CP '0' ;Character < '0'?
JR C,@Bad ;Yes, so no hex character
CP '9'+1 ;Character <= '9'?
JR C,@OK ;Yes, got hex character
CP 'A' ;Character < 'A'
JR C,@Bad ;Yes, so not hex character
CP 'F'+1 ;Character <= 'F'
JR C,@OK ;No, not hex
; Character is not a hex digit so return
@Bad: LD A,0FFh ;Return status: not hex character
OR A ; A = 0xFF and NZ flagged
RET
; Character is a hex digit so adjust from ASCII to number
@OK: SUB '0' ;Subtract '0'
CP 00Ah ;Number < 10 ?
JR C,@Finished ;Yes, so finished
SUB 007h ;Adjust for 'A' to 'F'
@Finished: CP A ;Return A = number (0 to 15) and Z flagged to
RET ; indicate character is a valid hex digital
ENDIF
; Utility: Is character numeric?
; On entry: A = ASCII character
; On exit: Carry flag set if character is numeric (0 to 9)
; A BC DE HL IX IY I AF' BC' DE' HL' preserved
IsCharNumeric: IF USE_ISNUMERIC = 1
CP '0' ;Less than '0'?
JR C,@Not2 ;Yes, so go return NOT numeric
CP '9'+1 ;Less than or equal to '9'?
RET C ;Yes, so numeric (C flagged)
@Not2: OR A ;No, so NOT numeric (NC flagged)
RET
ENDIF
; Utility: Convert hexadecimal or decimal text to number
; On entry: DE = Pointer to start of ASCII string
; On exit: If valid number found:
; A = 0 and Z flagged
; HL = Number found
; If valid number not found:
; A != 0 and NZ flagged
; HL = Not specified
; DE = Not specified
; HL = Number
; BC DE IX IY I AF' BC' DE' HL' preserved
; Hexadecmal numbers can be prefixed with either "$" or "0x"
; Decimal numbers must be prefixed with "+"
; A number without a prefix is assumed to be hexadecimal
; Hexadecimal number without a prefix must start with "0" to "9"
; ... this is to stop the assembler getting confused between
; ... register names and constants which could be fixed by
; ... re-ordering the (dis)assebmer's instruction table
; Numbers can be terminated with ")", space, null or control code
; Negative numbers, preceded with "-", are not supported
; Text must be terminated with ')', space or control char.
ConvertStringToNumber: IF USE_CNVSTRTONUM = 1
PUSH BC
LD HL,0 ;Build result here
LD A,(DE) ;Get character from string
CP '+' ;Does string start with '+' ?
JR Z,@Decimal ;Yes, so its decimal
CP '$' ;Does string start with '$' ?
JR Z,@Hdecimal ;Yes, so its hexadecimal
CP 39 ;Does string start with apostrophe?
JR Z,@Char ;Yes, so its a character
CP '"' ;Does string start with '"' ?
JR Z,@Char ;Yes, so its a character
; CALL IsCharNumeric ;Is first character '0' to '9' ?
; JR NC,@Failure ;No, so invalid number
; CALL IsCharHex ;Is first character hexadecimal ?
; JR NC,@Failure ;No, so invalid hex character
CP '0' ;Is first character '0' ?
; JR NZ,@HexNext ;No, so default to hexadecimal
JR NZ,@DecNext ;No, so default to decimal
INC DE ;Point to next character in string
LD A,(DE) ;Get character from string
CALL ConvertCharToUCase
CP 'X' ;Is second character 'x' ?
JR NZ,@HexNext ;No, so must be default format
; JR NZ,@DecNext ;No, so must be default format
; Hexadecimal number...
@Hdecimal: INC DE ;Point to next character in string
@HexNext: LD A,(DE) ;Get character from string
CP ')' ;Terminated with a bracket?
JR Z,@Success ;yes, so success
CP 32+1 ;Space or control character?
JR C,@Success ;Yes, so successld hl
CALL ConvertCharToNumber ;Convert character to number
JR NZ,@Failure ;Return if failure (NZ flagged)
INC DE ;Point to next character in string
ADD HL,HL ;Current result = 16 * current result..
ADD HL,HL
ADD HL,HL
ADD HL,HL
OR L ;Add new number (0 to 15)..
LD L,A
JR @HexNext
; Decimal number...
@Decimal: INC DE ;Point to next character in string
@DecNext: LD A,(DE) ;Get character from string
CP ')' ;Terminated with a bracket?
JR Z,@Success ;yes, so success
CP 32+1 ;Space or control character?
JR C,@Success ;Yes, so success
CALL IsCharNumeric ;Is first character '0' to '9' ?
JR NC,@Failure ;No, so invalid number
CALL ConvertCharToNumber ;Convert character to number
JR NZ,@Failure ;Return if failure (NZ flagged)
INC DE ;Point to next character in string
PUSH DE
LD B,9 ;Current result = 10 * current result..
LD D,H
LD E,L
@DecLoop: ADD HL,DE ;Add result to itself 9 times
DJNZ @DecLoop
POP DE
ADD A,L ;Add new number (0 to 15)..
LD L,A
JR NC,@DecNext
INC H
JR @DecNext
; Character...
@Char: INC DE ;Point to next character in string
LD A,(DE) ;Get ASCII character
LD L,A ;Store ASCII value as result
LD H,0
; JR @Success
; Return result...
@Success: POP BC
XOR A ;Return success with A = 0 and Z flagged
RET
@Failure: POP BC
LD A,0FFh ;Return failure with A != 0
OR A ; and NZ flagged
RET
ENDIF

View File

@@ -0,0 +1,77 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: tzfs_variales.asm
;- Created: September 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- This file holds the TZFS variable definitions.
;-
;- Credits:
;- Copyright: (c) 2019-21 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- July 2020 - Updates to accommodate v2.1 of the tranZPUter board.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
; Starting EC80H - variables used by the filing system.
ORG TZVARMEM
;TZVARMEM: EQU 0EC80H
;TZVARSIZE: EQU 00100H
WARMSTART: DS virtual 1 ; Warm start mode, 0 = cold start, 1 = warm start.
SCRNMODE: DS virtual 1 ; Mode of screen, [0] = 0 - 40 char, 1 - 80 char, [1] = 0 - Mainboard video, 1 - FPGA Video, [2] = 1 set VGA mode, 0 = standard, [7:4] Video mode.
SCRNMODE2: DS virtual 1 ; Mode of screen, [3:0] - VGA mode.
MMCFGVAL: DS virtual 1 ; Current memory model value.
HLSAVE: DS virtual 2 ; Storage for HL during bank switch manipulation.
AFSAVE: DS virtual 2 ; Storage for AF during bank switch manipulation.
FNADDR: DS virtual 2 ; Function to be called address.
TMPADR: DS virtual 2 ; TEMPORARY ADDRESS STORAGE
TMPSIZE: DS virtual 2 ; TEMPORARY SIZE
TMPCNT: DS virtual 2 ; TEMPORARY COUNTER
TMPLINECNT: DS virtual 2 ; Temporary counter for displayed lines.
TMPSTACKP: DS virtual 2 ; Temporary stack pointer save.
DUMPADDR: DS virtual 2 ; Address used by the D(ump) command so that calls without parameters go onto the next block.
CMTLOLOAD: DS virtual 1 ; Flag to indicate that a tape program is loaded into hi memory then shifted to low memory after ROM pageout.
CMTCOPY: DS virtual 1 ; Flag to indicate that a CMT copy operation is taking place.
CMTAUTOEXEC: DS virtual 1 ; Auto execution flag, run CMT program when loaded if flag clear.
DTADRSTORE: DS virtual 2 ; Backup for load address if actual load shifts to lo memory or to 0x1200 for copy.
SDCOPY: DS virtual 1 ; Flag to indicate an SD copy is taking place, either CMT->SD or SD->CMT.
RESULT: DS virtual 1 ; Result variable needed for interbank calls when a result is needed.
SDAUTOEXEC: DS virtual 1 ; Flag to indicate if a loaded file should be automatically executed.
FDCCMD: DS virtual 1 ; Floppy disk command storage.
MOTON: DS virtual 1 ; Motor on flag.
TRK0FD1: DS virtual 1 ; Floppy Disk 1 track 0 indicator.
TRK0FD2: DS virtual 1 ; Floppy Disk 2 track 0 indicator.
TRK0FD3: DS virtual 1 ; Floppy Disk 3 track 0 indicator.
TRK0FD4: DS virtual 1 ; Floppy Disk 4 track 0 indicator.
RETRIES: DS virtual 1 ; Retries count for a command.
BPARA: DS virtual 1
CMTINACTIVE: DS virtual 1 ; Flag to indicate if the CMT is inactive (1)/SD active (0) for the CMT wrapper handlers.
CMTFILENO: DS virtual 1 ; Sequential file access file number. Used when no filename is given, uses the directory entry number for the set wildcard,
HWMODEL: DS virtual 1 ; Model of machine to tailor code execution
CMTSAMPLECNT: DS virtual 1 ; Delay count for bit sampling.
CMTDLY1CNTM: DS virtual 1 ; Short pulse delay count MARK
CMTDLY1CNTS: DS virtual 1 ; Short pulse delay count SPACE
CMTDLY2CNTM: DS virtual 1 ; Long pulse delay count MARK
CMTDLY2CNTS: DS virtual 1 ; Long pulse delay count SPACE
DS virtual (TZVARMEM + TZVARSIZE) - $ ; Top of variable area downwards is used as the working stack, SA1510 space isnt used.
TZSTACK: EQU TZVARMEM + TZVARSIZE

View File

@@ -0,0 +1,8 @@
; Configurable parameters.
COLW: EQU 40 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
MODE80C:EQU 0 ; Monitor is being built for an 80 column display.
MODE2K: EQU 1 ; Monitor is being built for an MZ-2000 machine.
INCLUDE "1z-013a.asm"

View File

@@ -0,0 +1,8 @@
; Configurable parameters.
COLW: EQU 40 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
MODE80C:EQU 0 ; Monitor is being built for an 80 column display.
MODE2K: EQU 0 ; Monitor is being built for an MZ-2000 machine.
INCLUDE "1z-013a-km.asm"

View File

@@ -0,0 +1,8 @@
; Configurable parameters.
COLW: EQU 40 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
MODE80C:EQU 0 ; Monitor is being built for an 80 column display.
MODE2K: EQU 0 ; Monitor is being built for an MZ-2000 machine.
INCLUDE "1z-013a.asm"

View File

@@ -0,0 +1,8 @@
; Configurable parameters.
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
MODE80C:EQU 1 ; Monitor is being built for an 80 column display.
MODE2K: EQU 0 ; Monitor is being built for an MZ-2000 machine.
INCLUDE "1z-013a-km.asm"

View File

@@ -0,0 +1,8 @@
; Configurable parameters.
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
SCRNSZ: EQU COLW * ROW ; Total size, in bytes, of the screen display area.
MODE80C:EQU 1 ; Monitor is being built for an 80 column display.
MODE2K: EQU 0 ; Monitor is being built for an MZ-2000 machine.
INCLUDE "1z-013a.asm"

View File

@@ -0,0 +1,9 @@
; Configurable parameters.
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
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
KUMA: EQU 0
INCLUDE "sa1510.asm"

View File

@@ -0,0 +1,9 @@
; Configurable parameters.
COLW: EQU 80 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
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 0
KUMA: EQU 1
INCLUDE "sa1510.asm"

View File

@@ -0,0 +1,9 @@
; Configurable parameters.
COLW: EQU 40 ; Width of the display screen (ie. columns).
ROW: EQU 25 ; Number of rows on display screen.
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 0
KUMA: EQU 0
INCLUDE "sa1510.asm"

9699
software/asm/msbasic.asm Normal file

File diff suppressed because it is too large Load Diff

617
software/asm/mz-1e05.asm Normal file
View File

@@ -0,0 +1,617 @@
; V1.10
;
; To compile use:
;
; AS80 [1.31] - Assembler for 8080/8085/Z80 microprocessor.
;
; Available from:
; - http://www.falstaff.demon.co.uk/cross.html
; - ftp://ftp.simtel.net/pub/simtelnet/msdos/crossasm/as80_131.zip
; - and many Simtel mirrors.
;
; as80 -i -l -n -x2 -v -z mz-1e05.asm
;
;----< MFM Minifloppy control >----
;
;
; Call condition
;
; Case of disk initialize
; Drive N = IX+0 (0 - 3)
;
;
; Case of sequential read & write
; Drive N = IX+0 (0 - 3)
;
; Sector addrs = IX+1,2 (0 - $045F) H C S
; (0 - 1119) -> 70 x 16 sectors -> 2 x 35 x 16
; Byte size = IX+3,4
; Address = IX+5,6
; Next track = IX+7
; Next sector = IX+8
; Start track = IX+9
; Start sector = IX+10
;
;
; I/O Port address
;
CR EQU $D8 ; CommandRegister
TR EQU $D9 ; TrackRegister
SCR EQU $DA ; SeCtorRegister
DR EQU $DB ; DataRegister
DM EQU $DC ; DriveMotor
HS EQU $DD ; HeadSelect
TIMST EQU $0033
;
; Subroutine work
;
BPRO EQU $CF00
BUF EQU $11A3
BPARA EQU BPRO - 23 ; BootPARAmeter
CMD EQU BPARA + 11 ; CoMmanD
MTFG EQU CMD + 1 ; MoTorFlaG
CLBF0 EQU MTFG + 1
CLBF1 EQU CLBF0 + 1
CLBF2 EQU CLBF1 + 1
CLBF3 EQU CLBF2 + 1
VRFCNT EQU CLBF3 + 1 ; VeRiFyCouNT
STAFG EQU VRFCNT + 1 ; STAtusFlaG
;
;
;--------< Ercode map >--------
;
; 50 : Not ready
; 41 : Data error
; Track 80 err
; Write protect err
; Seek err
; CRC err
; Lost data
; 54 : Unformat
; Recode not found
; 56 : Invalid data
;
;
ORG $F000
MZ_1E05:
NOP
LD HL,$00AD
JR L_F007
FDX:
EX (SP),HL
L_F007:
LD (BPARA + 21),HL
XOR A
LD DE,0
CALL TIMST
CALL FDCC ; FD i/o check
JP NZ,NOTIO
LD DE,BPARA ; destination address
LD HL,BOOT ; source address
LD BC,11 ; 11 bytes
LDIR ; copy
SJP:
LD IX,BPARA
CALL BREAD ; read from drive 0, sector 0,
;
LD HL,BPRO ; compare this address
LD DE,IPLMC ; with the IPL MasterCode
LD B,7 ; this are 7 bytes : 3,'IPLPRO'
MCHECK:
LD C,(HL)
LD A,(DE)
CP C
JP NZ,MASTE ; not equal than MasterError
INC HL
INC DE
DJNZ MCHECK
; else Master was found
LD DE,IPLM0 ; 'IPL IS LOADING'
RST $18
LD DE,BPRO + 7 ; NAME
RST $18
LD HL,(BPRO + $16) ; TARGETADDRESS from BootBlock
LD A,H
OR L
JR NZ,L_F051 ; if it is != 0 than normal file
LD HL,(BPRO + $18) ; TARGETADDRESS from BootBlock
LD A,H
OR L
JR Z,L_F057 ; if it is also 0 than ROM replace file
L_F051:
XOR A ; else normal file,
LD HL,(BPRO + $18) ; TARGETADDRESS from BootBlock
JR L_F05C
L_F057:
LD A,$FF ; target is at $0000, bankswitching is needed
LD HL,$1200 ; for now use temporary buffer at $1200
L_F05C:
LD ($CEFD),A
LD (IX + 5),L ; set the TargetAddress
LD (IX + 6),H
LD HL,(BPRO + $14) ; BYTE SIZE from BootBlock
LD (IX + 3),L
LD (IX + 4),H
LD HL,(BPRO + $1E) ; START SECTOR from BootBlock
LD (IX + 1),L
LD (IX + 2),H
;
CALL BREAD
CALL MOFF
LD A,($CEFD)
CP $FF
JR NZ,L_F093
OUT ($E0),A
LD HL,$1200 ; SourceAddress
LD DE,(BPRO + $16) ; TargetAddress
LD BC,(BPRO + $14) ; ByteCounter
LDIR ; copy
L_F093:
LD BC,$0200 ; Default code
LD HL,(BPRO + $18) ; TARGET/EXECUTION ADDRESS from BootBlock
JP (HL)
MASTE:
CALL MOFF
LD DE,ERRM1 ; 'NOT MASTER'
JR ERRTR1
ERRTRT:
CP 50
NOTIO:
LD DE,IPLM3 ; 'MAKE READY FD'
JR Z,ERRTR1
LD DE,ERRM0 ; 'FD:LOADING ERROR'
ERRTR1:
CALL $0009
RST $18
LD SP,$10EE
LD HL,(BPARA + 21)
EX (SP),HL
RET
;
;
; PARAMETER SETTING
;
IPLMC:
DB $03 ; IPL MASTER FLAG
DB 'IPLPRO'
BOOT:
DB $00 ; DRIVE NO.
DW $0000 ; SECTOR ADDR.
DW $0100 ; IFM BYTE SIZE
DW BPRO ; IFM LOADING ADDR.
DW $0000 ; IX+7,8 (track 0, sector 0)
ERRM1:
DB 'FD:NOT MASTER',$0D
IPLM0:
DB 'IPL IS LOADING ',$0D
IPLM3:
DB 'MAKE READY FD',$0D
ERRM0:
DB 'FD:LOADING ERROR',$0D
FDCC:
LD A,$A5
LD B,A
OUT (TR),A
CALL DLY80U
IN A,(TR)
CP B
RET
L_F111:
DB $00, $00
;
;
; READY CHECK
;
READY:
LD A,(MTFG)
RRCA
CALL NC,MTON
LD A,(IX + 0) ; DRIVE NO SET
OR $84
OUT (DM),A ; DRIVE SELECT MOTON
XOR A
LD (CMD),A
CALL DLY60M
LD HL,0
REDY0:
DEC HL
LD A,H
OR L
JR Z,REDY1
IN A,(CR) ; STATUS GET
CPL
RLCA
JR C,REDY0
LD C,(IX + 0)
LD HL,CLBF0
LD B,$00
ADD HL,BC
BIT 0,(HL)
JR NZ,REDY2
CALL RCLB
SET 0,(HL)
REDY2:
RET
REDY1:
LD A,$32
JP ERJMP
;
;
; MOTOR ON
;
MTON:
LD A,$80
OUT (DM),A
LD B,16
MTD1:
CALL DLY60M
DJNZ MTD1
LD A,1
LD (MTFG),A
RET
;
;
; SEEK TREATMENT
;
SEEK:
LD A,$1B ; 1x = SEEK,
CALL CMDOT1 ; load head, no verify, max stepping rate
AND $99
RET
;
;
; MOTOR OFF
;
MOFF:
PUSH AF
CALL DLY1M ; 1000 US DELAY
XOR A
OUT (DM),A
LD (CLBF0),A
LD (CLBF1),A
LD (CLBF2),A
LD (CLBF3),A
LD (MTFG),A
POP AF
RET
;
;
; RECALIBRATION
;
RCLB:
LD A,$0B ; 0x = RESTORE (seek track 0)
CALL CMDOT1 ; load head, no verify, max stepping rate
AND $85
XOR $04
RET Z
L_F189:
JP ERROR
;
;
; COMMAND OUT ROUTINE
;
CMDOT1:
LD (CMD),A
CPL
OUT (CR),A
CALL BSYON
CALL DLY60M
IN A,(CR)
CPL
LD (STAFG),A
RET
;
;
; BUSY AND WAIT
;
BSYON:
PUSH DE
PUSH HL
CALL BSY0
BSYON2:
LD HL,$0000
BSYON0:
DEC HL
LD A,H
OR L
JR Z,BSYON1
IN A,(CR)
RRCA
JR NC,BSYON0
POP HL
POP DE
RET
;
BSYON1:
DEC E
JR NZ,BSYON2
BSYONE:
LD A,$29
POP HL
POP DE
JP ERJMP
;
BSYOFF:
PUSH DE
PUSH HL
CALL BSY0
BSYOF2:
LD HL,$0000
BSYOF0:
DEC HL
LD A,H
OR L
JR Z,BSYOF1
IN A,(CR) ; Status Register
RRCA
JR C,BSYOF0
POP HL
POP DE
RET
;
BSYOF1:
DEC E
JR NZ,BSYOF2
JR BSYONE
;
BSY0:
CALL DLY80U
LD E,$07
RET
;
;
; SEQUENTIAL READ
;
BREAD:
CALL CNVRT
CALL PARST1 ; HL = IX + 5,6 (TargetAddress)
RE8:
CALL SIDST
CALL SEEK
JP NZ,ERJMP
CALL PARST2 ; C = DataRegister
DI ; disable interrupts
LD A,$94 ; 9x = READ SECTOR, multiple records
CALL CMDOT2 ; compare for side 0, 15ms delay,
RE6: ; disable side select compare
LD B,0 ; ByteCounter = 0, to load 256 bytes of the sector
RE4:
IN A,(CR)
RRCA
JR C,RE3
RRCA
JR C,RE4
INI ; (HL) = in(C), B = B - 1 , HL = HL + 1
JR NZ,RE4
INC (IX + 8) ; NextSector = NextSector + 1
LD A,(IX + 8)
CP $11 ; if NextSector = 17
JR Z,L_F213 ; than end
DEC D ; else SectorCounter = SectorCounter - 1
JR NZ,RE6 ; if SectorCounter = 0
JR L_F214 ; than end
L_F213:
DEC D
L_F214:
CALL INTER
RE3:
EI ; enable interrupts
IN A,(CR)
CPL
LD (STAFG),A
AND $FF
JR NZ,ERROR
CALL ADJ ; adjust sector and track
JP Z,REND
LD A,(IX + 7) ; track
JR RE8
REND:
LD A,$80
OUT (DM),A ; motor on
RET
;
;
; PARAMETER SET
;
;
PARST1:
CALL READY
LD D,(IX + 4) ; D = bytes to read (highbyte) (256 bytes)
LD A,(IX + 3) ; A = bytes to read (lowbyte)
OR A ; if A = 0
JR Z,L_F23F ; than it's ok
INC D ; else read 256 bytes more (1 sector)
L_F23F:
LD A,(IX + 10) ; NextSector = StartSector
LD (IX + 8),A
LD A,(IX + 9) ; NextTrack = StartTrack
LD (IX + 7),A
LD L,(IX + 5) ; HL = TargetAddress
LD H,(IX + 6)
RET
;
;
; SIZE SEEK SET
;
SIDST:
SRL A
CPL
OUT (DR),A
JR NC,L_F25D ; NC than Head 0
LD A,1 ; else Head 1
JR L_F25E
L_F25D:
XOR A
L_F25E:
CPL
OUT (HS),A ; set HeadSelect
RET
;
;
; TRACK & SECTOR SET
;
PARST2:
LD C,DR
LD A,(IX + 7) ; A = NextTrack
SRL A
CPL
OUT (TR),A
LD A,(IX + 8) ; A = NextSector
CPL
OUT (SCR),A
RET
;
;
; ADJUST SECT & TRACK
;
ADJ:
LD A,(IX + 8) ; A = NextSector
CP 17 ; if NextSector = 17
JR NZ,L_F282 ; than the border is not reached
LD A,$01 ; else
LD (IX + 8),A ; NextSector = 1
INC (IX + 7) ; NextTrack = NextTrack + 1
L_F282:
LD A,D
OR A
RET
;
;
; COMMAND OUT & WAIT
;
CMDOT2:
LD (CMD),A
CPL
OUT (CR),A
CALL BSYOFF
RET
;
;
; FORCE INTERRUPT
;
INTER:
LD A,$D8
CPL
OUT (CR),A
CALL BSYON
RET
;
;
; STATUS CHECK
;
ERROR:
LD A,(CMD)
CP $0B ; Restore (seek track 0)
JR Z,ERCK1
CP $1B ; Seek
JR Z,ERCK1
CP $F4 ; Write track
JR Z,ERCK1
LD A,(STAFG)
BIT 7,A
JR NZ,ERRET
BIT 6,A
JR NZ,ERRET1
BIT 4,A
LD A,54
JR NZ,ERJMP
JR ERRET1
ERCK1:
LD A,(STAFG)
BIT 7,A
JR NZ,ERRET
ERRET1:
LD A,41
JR ERJMP
ERRET:
LD A,50
ERJMP:
CALL MOFF
JP ERRTRT
;
;
; SECTOR TO TRACK & SECTOR CONVERT
;
CNVRT:
LD B,0 ; TrackCounter = 0
LD DE,16 ; 16 sectors per track
LD L,(IX + 1) ; HL = SectorAddress
LD H,(IX + 2)
XOR A
TRANS0:
SBC HL,DE ; SectorAddress - SectorPerTrack
JR C,TRANS1 ; if < 0 than ready
INC B ; else TrackCounter = TrackCounter + 1
JR TRANS0 ; next try
TRANS1:
ADD HL,DE ; undo the last substraction
LD H,B
INC L ; adjust sector (sector is 1..16 and not 0..15)
LD (IX + 9),H ; set StartTrack
LD (IX + 10),L ; set StartSector
RET
;
;
; TIME DELAY ( 1m & 60m & 80u )
;
DLY80U:
PUSH DE
LD DE,15
JP DLYT
DLY1M:
PUSH DE
LD DE,160
JP DLYT
DLY60M:
PUSH DE
LD DE,8230
DLYT:
DEC DE
LD A,E
OR D
JR NZ,DLYT
POP DE
RET
ORG $FFF0
DB ' 84.03.14 V1.0A'

1739
software/asm/mz2000_ipl.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
; Configurable parameters.
;BUILDVERSION EQU 0 ; Build original IPL ROM.
;BUILDVERSION EQU 1 ; Build enhanced tranZPUter IPL ROM.
BUILDVERSION EQU 2 ; Build enhanced for FusionX IPL ROM.
INCLUDE "mz2000_ipl.asm"

View File

@@ -0,0 +1,5 @@
; Configurable parameters.
BUILDVERSION EQU 0 ; Build original IPL ROM.
;BUILDVERSION EQU 1 ; Build enhanced tranZPUter IPL ROM.
INCLUDE "mz2000_ipl.asm"

View File

@@ -0,0 +1,5 @@
; Configurable parameters.
;BUILDVERSION EQU 0 ; Build original IPL ROM.
BUILDVERSION EQU 1 ; Build enhanced tranZPUter IPL ROM.
INCLUDE "mz2000_ipl.asm"

View File

@@ -0,0 +1,4 @@
; Configurable parameters.
BUILDVERSION EQU 2 ; Build enhanced tranZPUter IPL ROM.
INCLUDE "1Z001M.asm"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1613
software/asm/mz800_iocs.asm Normal file

File diff suppressed because it is too large Load Diff

372
software/asm/mz80afi.asm Normal file
View File

@@ -0,0 +1,372 @@
; Disassembly of the file "D:\MZ80AFI.BIN"
;
; CPU Type: Z80
;
; Using the opcode map file "D:\DZ80-INI.MAP"
; ; Created with dZ80 2.0
;
; on Thursday, 06 of February 2020 at 01:38 PM
;
i ; Bring in additional resources.
INCLUDE "tzfs_definitions.asm"
INCLUDE "tzfs_mondef.asm"
INCLUDE "macros.asm"
;======================================
;
; Floppy Disk Interface
;
;======================================
ORG 0E800H
FLOPPY: NOP
LD DE,01008H
LD HL,PRMBLK
LD BC,0000BH
LDIR
CALL L0151
L000F: CALL NL
LD DE,BOOTDRV
CALL MSG
LD DE,011A3H
CALL GETL
LD A,(DE)
CP 01BH
JP Z,SS
LD HL,0000CH
ADD HL,DE
LD A,(HL)
CP 00DH
JR Z,L003A ; (+00dh)
CALL 03F9H
JR C,L000F ; (-023h)
DEC A
CP 004H
JR NC,L000F ; (-028h)
LD (01008H),A
L003A: LD IX,01008H
CALL L01BA
LD HL,0CE00H
LD DE,DSKID
LD B,007H
L0049: LD C,(HL)
LD A,(DE)
CP C
JP NZ,L008C
INC HL
INC DE
DJNZ L0049 ; (-00ah)
CALL NL
LD DE,IPLLOAD
CALL MSG
LD DE,0CE07H
CALL MSG
LD HL,(0CE16H)
LD (IX+005H),L
LD (IX+006H),H
LD HL,(0CE14H)
LD (IX+003H),L
LD (IX+004H),H
LD HL,(0CE1EH)
LD (IX+001H),L
LD (IX+002H),H
CALL L01BA
CALL L0151
LD HL,(0CE18H)
JP (HL)
L0087: LD DE,LOADERR
JR L008F ; (+003h)
L008C: LD DE,DSKNOTMST
L008F: CALL NL
CALL MSG
CALL NL
LD DE,DSKDAT
CALL MELDY
JP SS
BOOTDRV: DB "BOOY DRIVE ?", 00DH
LOADERR: DB "LOADING ERROR", 00DH
IPLLOAD: DB "IPL IS LOADING ", 00DH
DSKID: DB 002H, "IPLPRO"
DSKDAT: DB "A0", 0D7H, "ARA", 0D7H, "AR", 00DH
PRMBLK: DB 000H, 000H, 000H, 000H, 001H, 000H, 0CEH, 000H, 000H, 000H, 000H
DSKNOTMST: DB "THIS DISKETTE IS NOT MASTER", 00Dh
L0104: LD A,(01001H)
RRCA
CALL NC,L0138
LD A,(IX+000H)
OR 084H
OUT (0DCH),A
XOR A
LD (01000H),A
LD HL,00000H
L0119: DEC HL
LD A,H
OR L
JP Z,L029D
IN A,(0D8H)
CPL
RLCA
JR C,L0119 ; (-00ch)
LD C,(IX+000H)
LD HL,01002H
LD B,000H
ADD HL,BC
BIT 0,(HL)
JR NZ,L0137 ; (+005h)
CALL L0164
SET 0,(HL)
L0137: RET
L0138: LD A,080H
OUT (0DCH),A
LD B,010H
L013E: CALL L02C7
DJNZ L013E ; (-005h)
LD A,001H
LD (01001H),A
RET
L0149: LD A,01BH
CALL L0171
AND 099H
RET
L0151: XOR A
OUT (0DCH),A
LD (01002H),A
LD (01003H),A
LD (01004H),A
LD (01005H),A
LD (01001H),A
RET
L0164: LD A,00BH
CALL L0171
AND 085H
XOR 004H
RET Z
JP L029D
L0171: LD (01000H),A
CPL
OUT (0D8H),A
CALL L017E
IN A,(0D8H)
CPL
RET
L017E: PUSH DE
PUSH HL
CALL L02C0
LD E,007H
L0185: LD HL,00000H
L0188: DEC HL
LD A,H
OR L
JR Z,L0196 ; (+009h)
IN A,(0D8H)
CPL
RRCA
JR C,L0188 ; (-00bh)
POP HL
POP DE
RET
L0196: DEC E
JR NZ,L0185 ; (-014h)
JP L029D
L019C: PUSH DE
PUSH HL
CALL L02C0
LD E,007H
L01A3: LD HL,00000H
L01A6: DEC HL
LD A,H
OR L
JR Z,L01B4 ; (+009h)
IN A,(0D8H)
CPL
RRCA
JR NC,L01A6 ; (-00bh)
POP HL
POP DE
RET
L01B4: DEC E
JR NZ,L01A3 ; (-014h)
JP L029D
L01BA: CALL L0220
L01BD: CALL L0229
L01C0: CALL L0249
CALL L0149
JR NZ,L0216 ; (+04eh)
CALL L0259
PUSH IX
LD IX,L03FE
LD IY,L01DF
DI
LD A,094H
CALL L028A
L01DB: LD B,000H
JP (IX)
L01DF: INI
JP NZ,L03FE
POP IX
INC (IX+008H)
LD A,(IX+008H)
PUSH IX
LD IX,L03FE
CP 011H
JR Z,L01FB ; (+005h)
DEC D
JR NZ,L01DB ; (-01eh)
JR L01FC ; (+001h)
L01FB: DEC D
L01FC: CALL L0294
CALL L02D2
POP IX
IN A,(0D8H)
CPL
AND 0FFH
JR NZ,L0216 ; (+00bh)
CALL L0278
JP Z,L021B
LD A,(IX+007H)
JR L01C0 ; (-056h)
L0216: CALL L026A
JR L01BD ; (-05eh)
L021B: LD A,080H
OUT (0DCH),A
RET
L0220: CALL L02A3
LD A,00AH
LD (01006H),A
RET
L0229: CALL L0104
LD D,(IX+004H)
LD A,(IX+003H)
OR A
JR Z,L0236 ; (+001h)
INC D
L0236: LD A,(IX+00AH)
LD (IX+008H),A
LD A,(IX+009H)
LD (IX+007H),A
LD L,(IX+005H)
LD H,(IX+006H)
RET
L0249: SRL A
CPL
OUT (0DBH),A
JR NC,L0254 ; (+004h)
LD A,001H
JR L0255 ; (+001h)
L0254: XOR A
L0255: CPL
OUT (0DDH),A
RET
L0259: LD C,0DBH
LD A,(IX+007H)
SRL A
CPL
OUT (0D9H),A
LD A,(IX+008H)
CPL
OUT (0DAH),A
RET
L026A: LD A,(01006H)
DEC A
LD (01006H),A
JP Z,L029D
CALL L0164
RET
L0278: LD A,(IX+008H)
CP 011H
JR NZ,L0287 ; (+008h)
LD A,001H
LD (IX+008H),A
INC (IX+007H)
L0287: LD A,D
OR A
RET
L028A: LD (01000H),A
CPL
OUT (0D8H),A
CALL L019C
RET
L0294: LD A,0D8H
CPL
OUT (0D8H),A
CALL L017E
RET
L029D: CALL L0151
JP L0087
L02A3: LD B,000H
LD DE,00010H
LD L,(IX+001H)
LD H,(IX+002H)
XOR A
L02AF: SBC HL,DE
JR C,L02B6 ; (+003h)
INC B
JR L02AF ; (-007h)
L02B6: ADD HL,DE
LD H,B
INC L
LD (IX+009H),H
LD (IX+00AH),L
RET
L02C0: PUSH DE
LD DE,00007H
JP L02CB
L02C7: PUSH DE
LD DE,01013H
L02CB: DEC DE
LD A,E
OR D
JR NZ,L02CB ; (-005h)
POP DE
RET
L02D2: PUSH AF
LD A,(0119CH)
CP 0F0H
JR NZ,L02DB ; (+001h)
EI
L02DB: POP AF
RET
ALIGN 0EBFDh
DB 0FFh
L03FE: JP (IY)
;DB 0DDH
; DB 0E9H
; Ensure we fill the entire 1K by padding with FF's.
ALIGN 0EFFDh
DB 0FFh
LF7FE: DB 0fDH
DB 0E9H

904
software/asm/mz80b_ipl.asm Normal file
View File

@@ -0,0 +1,904 @@
ORG 0000H
;****************************************************************
;
; Personal Computer
; MZ-80B
;
; Initial Program Loader
;****************************************************************
;
JR START
;
; NST RESET
;
NST: LD A,03H
OUT (PPICTL),A ;Set PC1 NST=1
;
START: LD A,82H ;8255 A=OUT B=IN C=OUT
OUT (PPICTL),A
LD A,0FH ;PIO A=OUT
OUT (PIOCTLA),A
LD A,0CFH ;PIO B=IN
OUT (PIOCTLB),A
LD A,0FFH
OUT (PIOCTLB),A
LD A,58H ;BST=1 NST=0 OPEN=1 WRITE=1
OUT (PPIC),A
LD A,12H
OUT (PPIA),A
XOR A
OUT (GRPHCTL),A ;Set Graphics VRAM to default, input to GRPH I, no output.
LD SP,0FFE0H
LD HL,0D000H
LD A,0B3H
OUT (PIOA),A
CLEAR: LD (HL),00H ;DISPLAY CLEAR
INC HL
LD A,H
OR L
JR NZ,CLEAR
LD A,13H
OUT (PIOA),A
XOR A
LD (DRINO),A
LD (MTFG),A
KEYIN: CALL KEYS1
BIT 3,A ;C - Cassette.
JR Z,CMT
BIT 0,A ;/ - Boot external rom.
JP Z,EXROMT
JR NKIN ;No selection, so standard startup, try FDC then CMT.
;
KEYS1: LD B,14H ;Preserve A4-A7, set A4 to prevent all strobes low, the select line 5 (0-4).
KEYS: IN A,(PIOA)
AND 0F0H
OR B
OUT (PIOA),A
IN A,(PIOB) ;Read the strobed key.
RET
;
;
NKIN: CALL FDCC
JP Z,FD
JR CMT
;
FDCC: LD A,0A5H
LD B,A
OUT (0D9H),A
CALL DLY80U
IN A,(0D9H)
CP B
RET
;
; ;
; CMT CONTROL ;
; ;
;
CMT: CALL MSTOP
CALL DEL6
CALL KYEMES
CALL ?RDI
JR C,ST1
CALL LDMSG
LD HL,NAME
LD E,010H
LD C,010H
CALL DISP2
LD A,(ATRB)
CP 01H
JR NZ,MISMCH
CALL ?RDD
ST1: PUSH AF
CALL DEL6
CALL REW
POP AF
JP C,TRYAG
JP NST
;
MISMCH: LD HL,MES16
LD E,0AH
LD C,0FH
CALL DISP
CALL MSTOP
SCF
JR ST1
;
;READ INFORMATION
; CF=1:ERROR
RDINF:
?RDI: DI
LD D,04H
LD BC,0080H
LD HL,IBUFE
RD1: CALL MOTOR
JR C,STPEIR
CALL TMARK
JR C,STPEIR
CALL RTAPE
JR C,STPEIR
RET2S: BIT 3,D
JR Z,EIRTN
STPEIR: CALL MSTOP
EIRTN: EI
RET
;
;
;READ DATA
RDDAT:
?RDD: DI
LD D,08H
LD BC,(SIZE)
LD HL,8000H
JR RD1
;
;
;READ TAPE
; BC=SIZE
; DE=LOAD ADDRSS
RTAPE: PUSH DE
PUSH BC
PUSH HL
LD H,02H
RTP2: CALL SPDIN
JR C,TRTN1 ;BREAK
JR Z,RTP2
LD D,H
LD HL,0000H
LD (SUMDT),HL
POP HL
POP BC
PUSH BC
PUSH HL
RTP3: CALL RBYTE
JR C,TRTN1
LD (HL),A
INC HL
DEC BC
LD A,B
OR C
JR NZ,RTP3
LD HL,(SUMDT)
CALL RBYTE
JR C,TRTN1
LD E,A
CALL RBYTE
JR C,TRTN1
CP L
JR NZ,RTP5
LD A,E
CP H
JR Z,TRTN1
RTP5: DEC D
JR Z,RTP6
LD H,D
JR RTP2
RTP6: CALL BOOTER
SCF
TRTN1: POP HL
POP BC
POP DE
RET
;EDGE
EDGE: IN A,(PPIB)
CPL
RLCA
RET C ;BREAK
RLCA
JR NC,EDGE ;WAIT ON LOW
EDGE1: IN A,(PPIB)
CPL
RLCA
RET C ;BREAK
RLCA
JR C,EDGE1 ;WAIT ON HIGH
RET
; 1 BYTE READ
; DATA=A
; SUMDT STORE
RBYTE: PUSH HL
LD HL,0800H ; 8 BITS
RBY1: CALL SPDIN
JR C,RBY3 ;BREAK
JR Z,RBY2 ;BIT=0
PUSH HL
LD HL,(SUMDT) ;CHECKSUM
INC HL
LD (SUMDT),HL
POP HL
SCF
RBY2: RL L
DEC H
JR NZ,RBY1
CALL EDGE
LD A,L
RBY3: POP HL
RET
;TAPE MARK DETECT
; E=L:INFORMATION
; E=S:DATA
TMARK: PUSH HL
LD HL,1414H
BIT 3,D
JR NZ,TM0
ADD HL,HL
TM0: LD (TMCNT),HL
TM1: LD HL,(TMCNT)
TM2: CALL SPDIN
JR C,RBY3
JR Z,TM1
DEC H
JR NZ,TM2
TM3: CALL SPDIN
JR C,RBY3
JR NZ,TM1
DEC L
JR NZ,TM3
CALL EDGE
JR RBY3
;READ 1 BIT
SPDIN: CALL EDGE ;WAIT ON HIGH
RET C ;BREAK
CALL DLY2
IN A,(PPIB) ;READ BIT
AND 40H
RET
;
;
;MOTOR ON
MOTOR: PUSH DE
PUSH BC
PUSH HL
IN A,(PPIB)
AND 20H
JR Z,MOTRD
LD HL,MES6
LD E,0AH
LD C,0EH
CALL DISP
CALL OPEN
MOT1: IN A,(PIOB)
CPL
RLCA
JR C,MOTR
IN A,(PPIB)
AND 20H
JR NZ,MOT1
CALL KYEMES
CALL DEL1M
MOTRD: CALL PLAY
MOTR: POP HL
POP BC
POP DE
RET
;
;
;MOTOR STOP
MSTOP: LD A,0DH
OUT (PPICTL),A ;Set PC6 - READ MODE
LD A,1AH
OUT (PPIA),A
CALL DEL6
JR BLK3
;EJECT
OPEN: LD A,08H ;Reset PC4 - EJECT activate
OUT (PPICTL),A
CALL DEL6
LD A,09H
OUT (PPICTL),A ;Set PC4 - Deactivate EJECT
RET
;
;
KYEMES: LD HL,MES3
LD E,04H
LD C,1CH
CALL DISP
RET
;
;PLAY
PLAY: CALL FR
CALL DEL6
LD A,16H
OUT (PPIA),A
JR BLK3
BLK1: CALL DEL6
CALL BLK3
LD A,13H
BLK2: OUT (PPIA),A
BLK3: LD A,12H
OUT (PPIA),A
RET
;
;
FR: LD A,12H
FR1: OUT (PPIA),A
CALL DEL6
LD A,0BH
OUT (PPICTL),A ;Set PC5
CALL DEL6
LD A,0AH
OUT (PPICTL),A ;Reset PC5
RET
RRW: LD A,010H
JR FR1
;REWIND
REW: CALL RRW
JR BLK1
;
;TIMING DEL
DM1: PUSH AF
L0211: XOR A
L0212: DEC A
JR NZ,L0212
DEC BC
LD A,B
OR C
JR NZ,L0211
POP AF
POP BC
RET
DEL6: PUSH BC
LD BC,00E9H ;233D
JR DM1
DEL1M: PUSH BC
LD BC,060FH ;1551D
JR DM1
;
;TAPE DELAY TIMING
;
;
; CALL - 17 T-states
; LD - 7 T-states
; DEC - 4 T-states
; JP cc- 10 T-states
; RET - 10 T-states
; 17 + 7 + ((4+10)*49) + 10 = 720 * 1/4000000 = 180uS
DLY2: LD A,31H
L022B: DEC A
JP NZ,L022B
RET
;
;
;
LDMSG: LD HL,MES1
LD E,00H
LD C,0EH
JR DISP
;
DISP2: LD A,93H
OUT (PIOA),A
JR DISP1
;
BOOTER: LD HL,MES8
LD E,0AH
LD C,0DH
;
DISP: LD A,93H
OUT (PIOA),A
EXX
LD HL,0D000H
DISP3: LD (HL),00H
INC HL
LD A,H
OR L
JR NZ,DISP3
EXX
DISP1: XOR A
LD B,A
LD D,0D0H
LDIR
LD A,13H
OUT (PIOA),A
RET
;
;
MES1: DB "IPL is loading"
MES3: DB "IPL is looking for a program"
MES6: DB "Make ready CMT"
MES8: DB "Loading error"
MES9: DB "Make ready FD"
MES10: DB "Press F or C"
MES11: DB "F:Floppy diskette"
MES12: DB "C:Cassette tape"
MES13: DB "Drive No? (1-4)"
MES14: DB "This diskette is not master"
MES15: DB "Pressing S key starts the CMT"
MES16: DB "File mode error"
;
IPLMC: DB 01H
DB "IPLPRO"
;
;
;FD
FD: LD IX,IBADR1
XOR A
LD (0CF1EH),A
LD (0CF1FH),A
LD IY,0FFE0H
LD HL,0100H
LD (IY+2),L
LD (IY+3),H
CALL BREAD ;INFORMATION INPUT
LD HL,0CF00H ;MASTER CHECK
LD DE,IPLMC
LD B,06H
MCHECK: LD C,(HL)
LD A,(DE)
CP C
JP NZ,NMASTE
INC HL
INC DE
DJNZ MCHECK
CALL LDMSG
LD HL,0CF07H
LD E,010H
LD C,0AH
CALL DISP2
LD IX,IBADR2
LD HL,(0CF14H)
LD (IY+2),L
LD (IY+3),H
CALL BREAD
CALL MOFF
JP NST
;
;
NODISK: LD HL,MES9
LD E,0AH
LD C,0DH
CALL DISP
JP ERR1
;
; READY CHECK
;
READY: LD A,(MTFG)
RRCA
CALL NC,MTON
LD A,(DRINO) ;DRIVE NO GET
OR 84H
OUT (DM),A ;DRIVE SELECT MOTON
XOR A
CALL DLY60M
LD HL,0000H
REDY0: DEC HL
LD A,H
OR L
JR Z,NODISK
IN A,(CR) ;STATUS GET
CPL
RLCA
JR C,REDY0
LD A,(DRINO)
LD C,A
LD HL,CLBF0
LD B,00H
ADD HL,BC
BIT 0,(HL)
RET NZ
CALL RCLB
SET 0,(HL)
RET
;
; MOTOR ON
;
MTON: LD A,80H
OUT (DM),A
LD B,0AH ;1SEC DELAY
MTD1: LD HL,3C19H
MTD2: DEC HL
LD A,L
OR H
JR NZ,MTD2
DJNZ MTD1
LD A,01H
LD (MTFG),A
RET
;
;SEEK TREATMENT
;
SEEK: LD A,1BH
CPL
OUT (CR),A
CALL BUSY
CALL DLY60M
IN A,(CR)
CPL
AND 99H
RET
;
;MOTOR OFF
;
MOFF: CALL DLY1M
XOR A
OUT (DM),A
LD (CLBF0),A
LD (CLBF1),A
LD (CLBF2),A
LD (CLBF3),A
LD (MTFG),A
RET
;
;RECALIBRATION
;
RCLB: PUSH HL
LD A,0BH
CPL
OUT (CR),A
CALL BUSY
CALL DLY60M
IN A,(CR)
CPL
AND 85H
XOR 04H
POP HL
RET Z
JP ERR
;
;BUSY AND WAIT
;
BUSY: PUSH DE
PUSH HL
CALL DLY80U
LD E,07H
BUSY2: LD HL,0000H
BUSY0: DEC HL
LD A,H
OR L
JR Z,BUSY1
IN A,(CR)
CPL
RRCA
JR C,BUSY0
POP HL
POP DE
RET
;
BUSY1: DEC E
JR NZ,BUSY2
JP ERR
;
;DATA CHECK
;
CONVRT: LD B,00H
LD DE,0010H
LD HL,(0CF1EH)
XOR A
TRANS: SBC HL,DE
JR C,TRANS1
INC B
JR TRANS
TRANS1: ADD HL,DE
LD H,B
INC L
LD (IY+4),H
LD (IY+5),L
DCHK: LD A,(DRINO)
CP 04H
JR NC,DTCK1
LD A,(IY+4)
CP 46H ;70D
JR NC,DTCK1
LD A,(IY+5)
OR A
JR Z,DTCK1
CP 11H ;17D
JR NC,DTCK1
LD A,(IY+2)
OR (IY+3)
RET NZ
DTCK1: JP ERR
;
;SEQUENTIAL READ
;
BREAD: DI
CALL CONVRT
LD A,0AH
LD (RETRY),A
READ1: CALL READY
LD D,(IY+3)
LD A,(IY+2)
OR A
JR Z,RE0
INC D
RE0: LD A,(IY+5)
LD (IY+1),A
LD A,(IY+4)
LD (IY+0),A
PUSH IX
POP HL
RE8: SRL A
CPL
OUT (DR),A
JR NC,RE1
LD A,01H
JR RE2
RE1: LD A,00H
RE2: CPL
OUT (HS),A
CALL SEEK
JR NZ,REE
LD C,0DBH
LD A,(IY+0)
SRL A
CPL
OUT (TR),A
LD A,(IY+1)
CPL
OUT (SCR),A
EXX
LD HL,RE3
PUSH HL
EXX
LD A,94H
CPL
OUT (CR),A
CALL WAIT
RE6: LD B,00H
RE4: IN A,(CR)
RRCA
RET C
RRCA
JR C,RE4
INI
JR NZ,RE4
INC (IY+1)
LD A,(IY+1)
CP 11H ;17D
JR Z,RETS
DEC D
JR NZ,RE6
JR RE5
RETS: DEC D
RE5: LD A,0D8H ;FORCE INTERRUPT
CPL
OUT (CR),A
CALL BUSY
RE3: IN A,(CR)
CPL
AND 0FFH
JR NZ,REE
EXX
POP HL
EXX
LD A,(IY+1)
CP 11H ;17D
JR NZ,REX
LD A,01H
LD (IY+1),A
INC (IY+0)
REX: LD A,D
OR A
JR NZ,RE7
LD A,80H
OUT (DM),A
RET
RE7: LD A,(IY+0)
JR RE8
REE: LD A,(RETRY)
DEC A
LD (RETRY),A
JR Z,ERR
CALL RCLB
JP READ1
;
; WAIT AND BUSY OFF
;
WAIT: PUSH DE
PUSH HL
CALL DLY80U
LD E,08H
WAIT2: LD HL,0000H
WAIT0: DEC HL
LD A,H
OR L
JR Z,WAIT1
IN A,(CR)
CPL
RRCA
JR NC,WAIT0
POP HL
POP DE
RET
WAIT1: DEC E
JR NZ,WAIT2
JR ERR
;
NMASTE: LD HL,MES14
LD E,07H
LD C,1BH ;27D
CALL DISP
JR ERR1
;
; ;
; ERRROR OR BREAK ;
; ;
;
ERR: CALL BOOTER
ERR1: CALL MOFF
TRYAG2: LD SP,0FFE0H
;
;TRYAG
;
TRYAG: CALL FDCC
JR NZ,TRYAG3
LD HL,MES10
LD E,5AH
LD C,0CH ;12D
CALL DISP2
LD E,0ABH
LD C,11H ;17D
CALL DISP2
LD E,0D3H
LD C,0FH ;15D
CALL DISP2
TRYAG1: CALL KEYS1
BIT 3,A
JP Z,CMT
BIT 6,A
JR Z,DNO
JR TRYAG1
DNO: LD HL,MES13 ;DRIVE NO SELECT
LD E,0AH
LD C,0FH
CALL DISP
DNO10: LD D,12H
CALL DNO0
JR NC,DNO3
LD D,18H
CALL DNO0
JR NC,DNO3
JR DNO10
DNO3: LD A,B
LD (DRINO),A
JP FD
;
TRYAG3: LD HL,MES15
LD E,54H
LD C,1DH ;29D
CALL DISP2
TRYAG4: LD B,06H
TRYAG5: CALL KEYS
BIT 3,A
JP Z,CMT
JR TRYAG5
;
DNO0: IN A,(PIOA)
AND 0F0H
OR D
OUT (PIOA),A
IN A,(PIOB)
LD B,00H
LD C,04H
RRCA
DNO1: RRCA
RET NC
INC B
DEC C
JR NZ,DNO1
RET
;
; TIME DELAY (1M &60M &80U )
;
DLY80U: PUSH DE
LD DE,000DH ;13D
JP DLYT
DLY1M: PUSH DE
LD DE,0082H ;130D
JP DLYT
DLY60M: PUSH DE
LD DE,1A2CH ;6700D
DLYT: DEC DE
LD A,E
OR D
JR NZ,DLYT
POP DE
RET
;
;
; ;
; INTRAM EXROM ;
; ;
;
EXROMT: LD HL,8000H
LD IX,EROM1
JR SEROMA
EROM1: IN A,(0F9H)
CP 00H
JP NZ,NKIN
LD IX,EROM2
ERMT1: JR SEROMA
EROM2: IN A,(0F9H)
LD (HL),A
INC HL
LD A,L
OR H
JR NZ,ERMT1
OUT (0F8H),A
JP NST
;
SEROMA: LD A,H
OUT (0F8H),A
LD A,L
OUT (0F9H),A
LD D,04H
SEROMD: DEC D
JR NZ,SEROMD
JP (IX)
; Align to ROM size.
DS 0800H - 1 - ($ + 0800H - 1) % 0800H, 0FFh
;----------------------------------------------------------
; Variables/Work area
;----------------------------------------------------------
IBUFE: EQU 0CF00H
ATRB: EQU 0CF00H
NAME: EQU 0CF01H
SIZE: EQU 0CF12H
DTADR: EQU 0CF14H
SUMDT: EQU 0FFE0H
TMCNT: EQU 0FFE2H
;
;
;INPUT BUFFER ADDRESS
;
IBADR1: EQU 0CF00H
IBADR2: EQU 8000H
;
; SUBROUTINE WORK
;
NTRACK: EQU 0FFE0H
NSECT: EQU 0FFE1H
BSIZE: EQU 0FFE2H
STTR: EQU 0FFE4H
STSE: EQU 0FFE5H
MTFG: EQU 0FFE6H
CLBF0: EQU 0FFE7H
CLBF1: EQU 0FFE8H
CLBF2: EQU 0FFE9H
CLBF3: EQU 0FFEAH
RETRY: EQU 0FFEBH
DRINO: EQU 0FFECH
;
;
;
;
;
; MFM MINIFLOPPY CONTROL
;
;
;
; CASE OF DISK INITIALIZE
; DRIVE NO=DRINO (0-3)
;
; CASE OF SEQUENTIAL READ
; DRIVE NO=DRINO (0-3)
; BYTE SIZE =IY+2,3
; ADDRESS =IX+0,1
; NEXT TRACK =IY+0
; NEXT SECTOR =IY+1
; START TRACK =IY+4
; START SECTOR =IY+5
;
;
; I/O PORT ADDRESS
;
CR: EQU 0D8H ;STATUS/COMMAND PORT
TR: EQU 0D9H ;TRACK REG PORT
SCR: EQU 0DAH ;SECTOR REG PORT
DR: EQU 0DBH ;DATA REG PORT
DM: EQU 0DCH ;MOTOR/DRIVE PORT
HS: EQU 0DDH ;HEAD SIDE SELECT PORT
PPIA: EQU 0E0H
PPIB: EQU 0E1H
PPIC: EQU 0E2H
PPICTL: EQU 0E3H
PIOA: EQU 0E8H
PIOCTLA:EQU 0E9H
PIOB: EQU 0EAH
PIOCTLB:EQU 0EBH
GRPHCTL:EQU 0F4H

661
software/asm/mz80kfdif.asm Normal file
View File

@@ -0,0 +1,661 @@
;
; MZ-80K FDC ROM
;
ORG F000H
F000 00 NOP
F001 F3 DI
F002 AF XOR A
F003 329C11 LD (#119C),A ;clock off
F006 3EC3 LD A,#C3 ;JP code for error trap
F008 320B10 LD (#100B),A
F00B 215AF0 LD HL,#F05A ;error can't boot
F00E 220C10 LD (#100C),HL ;error trap
F011 11F09F LD DE,#9FF0 ;transfer 9 bytes from
F014 2187F0 LD HL,#F087 ;ROM to RAM for use
;
;IBT1
;
F017 010900 IBT1: LD BC,#0009 ;by (IX+D) in reader
F01A EDB0 LDIR
F01C CD0900 CALL CRLF ;NL
F01F 117AF0 LD DE,MESS1
F022 CD1500 CALL MESSAGE ;msg "BOOT DRIVE ?"
F025 11009F LD DE,BUFF2
F028 CD0300 CALL USER ;get line
F02B 210C00 LD HL,#000C
F02E 19 ADD HL,DE ;skip around msg
F02F 7E LD A,(HL) ;pickup answer to prompt
F030 FE0D CP #0D ;CR ?
F032 2002 JR NZ,#F036 ;Z=CR assume drive 1
F034 3E31 LD A,#31 ;ASCII for 1
;
;IBT2
;
F036 47 IBT2: LD B,A ;save driveno
F037 E6F0 AND #F0 ;take ASCII and convert
F039 FE30 CP #30 ;to numeric having
F03B 20DF JR NZ,IBT1 ;checked >1 & <=4
F03D 78 LD A,B ;get driveno
F03E E60F AND #0F ;mask
F040 3D DEC A ;-1 00-03
F041 FE04 CP #04
F043 30D7 JR NC,IBT1 ;dud key, >=4, try again
F045 32F09F LD (#9FF0),A ;save drive no
F048 321110 LD (#1011),A ;save drive no
F04B DD21F09F LD IX,#9FF0 ;IX pointer to fdc parameters at 9FF0
;ready for disk read
F04F CD3BF1 CALL READER ;get boot records
F052 3A0098 LD A,(#9800) ;1st byte of input buffer of boot records
F055 FEC3 CP #C3 ;jump cmd?
F057 CA0098 JP Z,#9800 ;yes, execute to 9800
;
;IBT3
;
F05A 31F010 IBT3: LD SP,#10F0 ;no, reset stack
F05D CD0900 CALL CRLF ;NL
F060 116CF0 LD DE,MESS2 ;msg can't boot
F063 CD1500 CALL MESSAGE
F066 CDA7F0 CALL MOTOFF ;motor off
F069 C38200 JP MAINLP ;warm start, ret to monitor
;
;MESS2
;
F06C 45523A43 MESS2: DB "ER:CAN'T BOOT"
F070 414E2754
F074 20424F4F
F078 54
F079 0D DB 0DH
;
;MESS1
;
F07A 424F4F54 DB "BOOT DRIVE ?"
F07E 20445249
F082 5645203F
F086 0D DB 0DH
;
;DDATA
;fdc parameters
;
F087 00 DB 00H ;drive no-1
F088 00 DB 00H ;trk*2 remainder = head
F089 01 DB 01H ;sector no (range: 01 - 10)
F08A 00 DB 00H ;$80 = add 1 record to read to (F08B)
F08B 0700 DB 07H ;07H = 07*2 = 14 sectors to read, add 1 if (F08A = $80)
F08D 0098 DB 00H,98H ;9800H = load addr.
F08F 00 DB 00H ;no meaning
;
;MOTON
;
F090 C5 MOTON: PUSH BC ;starts motors
F091 01F808 LD BC,#08F8
F094 ED78 IN A,(C) ;start motor
F096 010000 LD BC,#0000
;
;WAIT1
;
F099 0B WAIT1: DEC BC ;wait for motor to
F09A 00 NOP ;get up to speed
F09B 00 NOP
F09C 78 LD A,B
F09D B1 OR C
F09E 20F9 JR NZ,WAIT1
F0A0 3E01 LD A,#01
F0A2 320210 LD (MOTFLG),A ;01=on 00=off
F0A5 C1 POP BC
F0A6 C9 RET
;
;MOTOFF
;
F0A7 C5 MOTOFF: PUSH BC ;stop motors
F0A8 CDAEF1 CALL LNGDEL ;timed wait
F0AB 01F800 LD BC,#00F8
F0AE ED78 IN A,(C)
F0B0 C1 POP BC
F0B1 C9 RET
;
;SKZERO
;
F0B2 CDBDF0 SKZERO: CALL DREADY ;seek track 0
F0B5 AF XOR A
F0B6 D3F9 OUT (#F9),A ;clear track reg
F0B8 320010 LD (#1000),A
F0BB D3FA OUT (#FA),A ;send seek zero code
;
;DREADY
;
F0BD C5 DREADY: PUSH BC
F0BE 010000 LD BC,#0000
;
;DRY1
;
F0C1 DBF9 DRY1: IN A,(#F9) ;get DRDY, CRDY, RQM
F0C3 E603 AND #03 ;leave DRDY, CRDY
;
;DRY2
;
F0C5 FE02 DRY2: CP #02 ;wait for DRDY & CRDY
F0C7 2002 JR NZ,WAIT2 ;no, =03
F0C9 C1 POP BC ;yes, =02
F0CA C9 RET
;
;WAIT2
;
F0CB 0B WAIT2: DEC BC
F0CC 78 LD A,B
F0CD B1 OR C
F0CE 20F1 JR NZ,DRY1
F0D0 C1 POP BC
F0D1 3E32 LD A,#32
F0D3 320810 LD (#1008),A ;error 40 (not found)
F0D6 C30B10 JP #100B ;error can't boot
;
;STATUS
;
F0D9 DBFA STATUS: IN A,(#FA) ;read status
F0DB E6F0 AND #F0
F0DD 07 RLCA
F0DE 30F9 JR NC,STATUS ;wait for CRDY
F0E0 E6F0 AND #F0 ;mask leave CRDY, S1, S2, S3
F0E2 0F RRCA ;move right until S§
F0E3 0F RRCA ;is in B0
F0E4 0F RRCA
F0E5 0F RRCA
F0E6 B7 OR A ;clear flags
F0E7 C8 RET Z ;Z=ok
F0E8 FE0C CP #0C ;0C=drive not ready etc.
F0EA 2004 JR NZ,STS1
F0EC 3E32 LD A,#32 ;error code 40 (not found)
F0EE 180A JR STS3
;
STS1
;
F0F0 FE04 STS1: CP #04 ;04=ID not found
F0F2 2004 JR NZ,STS2
F0F4 3E36 LD A,#36 ;error code 54 (unformat error)
F0F6 1802 JR STS3
;
;STS2
;
F0F8 3E29 STS2: LD A,#29
F0FA 320810 LD (#1008),A ;error code 41 disk hw error
F0FD 37 SCF
F0FE C9 RET
;
;PRMDRV
;
F0FF C5 PRMDRV: PUSH BC ;prime drive
F100 E5 PUSH HL
F101 CD90F0 CALL MOTON
F104 DD7E00 LD A,(IX+#00) ;get drive no-1
F107 E603 AND #03 ;form drive code
F109 F61C OR #1C ;set TND, MOTOR, SELECT BIT
F10B 320110 LD (#1001),A ;keep drive code
F10E E60F AND #0F ;mask out TND
F110 47 LD B,A
F111 0EF8 LD C,#F8
F113 ED60 IN H,(C) ;select drive
F115 3E32 LD A,#32
;
;PRM1
;
F117 CDAEF1 PRM1: CALL LNGDEL ;wait for head
F11A 3D DEC A :to load
F11B 20FA JR NZ,PRM1
F11D 010000 LD BC,#0000
;
;PRM2
;
F120 DBF9 PRM2: IN A,(#F9) ;get DRDY, CRDY, RQM
F122 E607 AND #07 ;mask out RUBBISH
F124 FE06 CP #06 ;DRDY & CRDY ?
F126 2006 JR NZ,PRM3 ;NZ=no, keep trying
F128 CDB2F0 CALL SKZERO
F12B E1 POP HL
F12C C1 POP BC
F12D C9 RET ;correct exit
;
;PRM3
;
F12E 0B PRM3: DEC BC
F12F 78 LD A,B
F130 B1 OR C
F131 20ED JR NZ,PRM2
F133 3E32 LD A,#32
F135 320810 LD (#1008),A ;error 40 (not found)
F138 C30B10 JP #100B ;abort; error can't boot
;
;READER
;
F13B 3E0A READER: LD A,#0A ;no. of tries
F13D 320710 LD (#1007),A
;
;RDR1
;
F140 CDFFF0 RDR1: CALL PRMDRV
F143 3A0110 LD A,(#1001) ;keep drive in use
F146 47 LD B,A
F147 0EF8 LD C,#F8
F149 D9 EXX ;save all regs
F14A 0EFB LD C,#FB ;port fb??
F14C DD5E03 LD E,(IX+#03) ;no meaning
F14F DD5604 LD D,(IX+#04) ;get half of numbers to read (7)
F152 CB13 RL E ;B7 to carry
F154 CB12 RL D ;double number of sectors (14), add carry
F156 1E03 LD E,#03 ;no meaning
F158 DD6E05 LD L,(IX+#05) ;get loading address lo
F15B DD6606 LD H,(IX+#06) ;hi into HL
F15E CDBDF0 CALL DREADY
F161 AF XOR A ;no meaning
F162 DD7E01 LD A,(IX+#01) ;get track to read
F165 1F RRA ;divide by 2, remainder to carry = head no.
F166 D3F9 OUT (#F9),A ;send track to FDC
F168 DD7E02 LD A,(IX+#02) ;sector number
F16B 3002 JR NC,RDR2
F16D F680 OR #80 ;odds/evens for side code
;
;RDR2
;
F16F D3F8 RDR2: OUT (#F8),A ;send sect+side
F171 CDA6F1 CALL SHTDEL ;short delay
F174 3E70 LD A,#70 ;seek & read code
F176 320010 LD (#1000),A ;keep it
F179 F3 DI
F17A D3FA OUT (#FA),A ;send seek & read code to FDC
;
;RDR3
;
F17C 0680 RDR3: LD B,#80 ;128 bytes/sector
;
;RDR4
;
F17E DBF9 RDR4: IN A,(#F9) ;get DRDY, CRDY, RQM
F180 A3 AND E ;mask with 03
F181 28FB JR Z,RDR4 ;wait for either CRDY/RQM
F183 0F RRCA ;RQM into carry
F184 300C JR NC,RDR5 ;NC=no RQM
F186 EDA2 INI ;get data. port FB to (HL), B=B-1
F188 C27EF1 JP NZ,RDR4 ;do whole sector
F18B 15 DEC D ;dec sector counter
F18C C27CF1 JP NZ,RDR3 ;NZ=more to do
F18F D9 EXX ;restore all regs
F190 ED78 IN A,(C) ;send TND high
;
;RDR5
;
F192 CDD9F0 RDR5: CALL STATUS
F195 D0 RET NC ;NC=good read
F196 3A0710 LD A,(#1007)
F199 3D DEC A ;A try gone
F19A 320710 LD (#1007),A ;counter 10times
F19D CA0B10 JP Z,#100B ;can't read at all abort
F1A0 CDB2F0 CALL SKZERO
F1A3 C340F1 JP RDR1
;
;SHTDEL
;
F1A6 F5 SHTDEL: PUSH AF
F1A7 3E0A LD A,#0A
;
;SDY1
;
F1A9 3D SDY1: DEC A
F1AA 20FD JR NZ,SDY1
F1AC F1 POP AF
F1AD C9 RET
;
;LNGDEL
;
F1AE F5 LNGDEL: PUSH AF ;long delay
F1AF 3E0A LD A,#0A
;
;LDY1
;
F1B1 CDA6F1 LDY1: CALL SHTDEL
F1B4 3D DEC A
F1B5 20FA JR NZ,LDY1
F1B7 F1 POP AF
F1B8 C9 RET
CRLF: EQU 00009H
MESSAGE: EQU 00015H
BUFF2: EQU 9F00H
USER: EQU 00003H
MAINLP: EQU 00082H
MOTFLG: EQU 1002H
END
;
;no meaning !!
;
F1B9 13 INC DE
F1BA 1B DEC DE
F1BB 72 LD (HL),D
F1BC DE42 SBC A,#42
F1BE FB EI
F1BF 2F CPL
F1C0 58 LD E,B
F1C1 43 LD B,E
F1C2 7C LD A,H
F1C3 52 LD D,D
F1C4 3023 JR NC,#F1E9 ; (35)
F1C6 71 LD (HL),C
F1C7 42 LD B,D
F1C8 1020 DJNZ #F1EA ; (32)
F1CA 74 LD (HL),H
F1CB 40 LD B,B
F1CC 43 LD B,E
F1CD 03 INC BC
F1CE 51 LD D,C
F1CF 00 NOP
F1D0 3C INC A
F1D1 42 LD B,D
F1D2 D8 RET C
F1D3 60 LD H,B
F1D4 FB EI
F1D5 09 ADD HL,BC
F1D6 FC402C CALL M,#2C40
F1D9 80 ADD A,B
F1DA 79 LD A,C
F1DB 2A4940 LD HL,(#4049)
F1DE 4D LD C,L
F1DF EE3E XOR #3E
F1E1 B2 OR D
F1E2 1EA2 LD E,#A2
F1E4 58 LD E,B
F1E5 02 LD (BC),A
F1E6 58 LD E,B
F1E7 12 LD (DE),A
F1E8 02 LD (BC),A
F1E9 43 LD B,E
F1EA 02 LD (BC),A
F1EB 220002 LD (#0200),HL
F1EE 2D DEC L
F1EF 4B LD C,E
F1F0 5A LD E,D
F1F1 0A LD A,(BC)
F1F2 40 LD B,B
F1F3 4A LD C,D
F1F4 13 INC DE
F1F5 42 LD B,D
F1F6 45 LD B,L
F1F7 0A LD A,(BC)
F1F8 5B LD E,E
F1F9 6E LD L,(HL)
F1FA 6A LD L,D
F1FB 4E LD C,(HL)
F1FC 4E LD C,(HL)
F1FD 4E LD C,(HL)
F1FE 5D LD E,L
F1FF 7E LD A,(HL)
F200 3011 JR NC,#F213 ; (17)
F202 DD300E JR NC,#F213 ; (14)
F205 067E LD B,#7E
F207 FE3A CP #3A
F209 CAC221 JP Z,#21C2
F20C 12 LD (DE),A
F20D 23 INC HL
F20E 13 INC DE
F20F 0D DEC C
F210 C20622 JP NZ,#2206
F213 C3C221 JP #21C2
F216 3AB830 LD A,(#30B8)
F219 FEB1 CP #B1
F21B CA4522 JP Z,#2245
F21E 2A5030 LD HL,(#3050)
F221 CD1E20 CALL #201E
F224 7E LD A,(HL)
F225 FE27 CP #27
F227 CA5722 JP Z,#2257
F22A 3E84 LD A,#84
F22C 327630 LD (#3076),A
F22F 3E02 LD A,#02
F231 327730 LD (#3077),A
F234 CDCA13 CALL #13CA
F237 D24A22 JP NC,#224A
F23A 2E00 LD L,#00
F23C 3EB2 LD A,#B2
F23E 32C830 LD (#30C8),A
F241 7D LD A,L
F242 326F30 LD (#306F),A
F245 3E01 LD A,#01
F247 C3C321 JP #21C3
F24A 3ABE30 LD A,(#30BE)
F24D FEC5 CP #C5
F24F C23C22 JP NZ,#223C
F252 3EB0 LD A,#B0
F254 C33E22 JP #223E
F257 23 INC HL
F258 7E LD A,(HL)
F259 E67F AND #7F
F25B 6F LD L,A
F25C C33C22 JP #223C
F25F 3AB830 LD A,(#30B8)
F262 FEB1 CP #B1
F264 CA9022 JP Z,#2290
F267 2A5030 LD HL,(#3050)
F26A CD1E20 CALL #201E
F26D 3E80 LD A,#80
F26F 327630 LD (#3076),A
F272 3E01 LD A,#01
F274 327730 LD (#3077),A
F277 CDCA13 CALL #13CA
F27A D29522 JP NC,#2295
F27D 210000 LD HL,#0000
F280 3E82 LD A,#82
F282 32C830 LD (#30C8),A
F285 226330 LD (#3063),HL
F288 116F30 LD DE,#306F
F28B 7C LD A,H
F28C 12 LD (DE),A
F28D 13 INC DE
F28E 7D LD A,L
F28F 12 LD (DE),A
F290 3E02 LD A,#02
F292 C3C321 JP #21C3
F295 3ABE30 LD A,(#30BE)
F298 FEC5 CP #C5
F29A C2A222 JP NZ,#22A2
F29D 3EB1 LD A,#B1
F29F C38222 JP #2282
F2A2 CDEA1A CALL #1AEA
F2A5 C38222 JP #2282
F2A8 2A5030 LD HL,(#3050)
F2AB CD1E20 CALL #201E
F2AE 116F30 LD DE,#306F
F2B1 0600 LD B,#00
F2B3 0E04 LD C,#04
F2B5 7E LD A,(HL)
F2B6 23 INC HL
F2B7 FE27 CP #27
F2B9 C2F822 JP NZ,#22F8
F2BC 7E LD A,(HL)
F2BD FE27 CP #27
F2BF C2DE22 JP NZ,#22DE
F2C2 3AB830 LD A,(#30B8)
F2C5 FEB1 CP #B1
F2C7 CAD522 JP Z,#22D5
F2CA AF XOR A
F2CB 21C830 LD HL,#30C8
F2CE B8 CP B
F2CF CAD922 JP Z,#22D9
F2D2 3EB3 LD A,#B3
F2D4 77 LD (HL),A
F2D5 78 LD A,B
F2D6 C3C321 JP #21C3
F2D9 3EB4 LD A,#B4
F2DB C3D422 JP #22D4
F2DE FE8D CP #8D
F2E0 CAF822 JP Z,#22F8
F2E3 FE0A CP #0A
F2E5 CAF822 JP Z,#22F8
F2E8 E67F AND #7F
F2EA 12 LD (DE),A
F2EB 23 INC HL
F2EC 13 INC DE
F2ED 04 INC B
F2EE 0D DEC C
F2EF C2BC22 JP NZ,#22BC
F2F2 117A30 LD DE,#307A
F2F5 C3BC22 JP #22BC
F2F8 3E53 LD A,#53
F2FA CD111C CALL #1C11
F2FD C3C222 JP #22C2
F300 CDE511 CALL #11E5
F303 CD0C20 CALL #200C
F306 FE3A CP #3A
F308 C26423 JP NZ,#2364
F30B 2A5030 LD HL,(#3050)
F30E CD1E20 CALL #201E
F311 3E80 LD A,#80
F313 327630 LD (#3076),A
F316 3E02 LD A,#02
F318 327730 LD (#3077),A
F31B CDCA13 CALL #13CA
F31E DA2E23 JP C,#232E
F321 3ACC30 LD A,(#30CC)
F324 FE01 CP #01
F326 C23123 JP NZ,#2331
F329 3ECC LD A,#CC
F32B CD111C CALL #1C11
F32E 210000 LD HL,#0000
F331 3AB830 LD A,(#30B8)
F334 FEB1 CP #B1
F336 CA6E23 JP Z,#236E
F339 FEB2 CP #B2
F33B CAC221 JP Z,#21C2
F33E 226330 LD (#3063),HL
F341 3EA2 LD A,#A2
F343 32C830 LD (#30C8),A
F346 CDB51D CALL #1DB5
F349 06DD LD B,#DD
F34B 30CD JR NC,#F31A ; (-51)
F34D E5 PUSH HL
F34E 1111DD LD DE,#DD11
F351 300E JR NC,#F361 ; (14)
F353 067E LD B,#7E
F355 FE3A CP #3A
F357 CAC221 JP Z,#21C2
F35A 12 LD (DE),A
F35B 23 INC HL
F35C 13 INC DE
F35D 0D DEC C
F35E C25423 JP NZ,#2354
F361 C3C221 JP #21C2
F364 3E4E LD A,#4E
F366 CD111C CALL #1C11
F369 3EB4 LD A,#B4
F36B C3BF21 JP #21BF
F36E EB EX DE,HL
F36F 2A4D31 LD HL,(#314D)
F372 2B DEC HL
F373 2B DEC HL
F374 2B DEC HL
F375 72 LD (HL),D
F376 23 INC HL
F377 73 LD (HL),E
F378 23 INC HL
F379 3680 LD (HL),#80
F37B C3C221 JP #21C2
F37E CC44A0 CALL Z,#A044
F381 41 LD B,C
F382 AC XOR H
F383 2842 JR Z,#F3C7 ; (66)
F385 C3A9F1 JP #F1A9
F388 0A LD A,(BC)
F389 CC44A0 CALL Z,#A044
F38C 41 LD B,C
F38D AC XOR H
F38E 2844 JR Z,#F3D4 ; (68)
F390 C5 PUSH BC
F391 A9 XOR C
F392 F1 POP AF
F393 1A LD A,(DE)
F394 CC44A0 CALL Z,#A044
F397 2842 JR Z,#F3DB ; (66)
F399 C3A9AC JP #ACA9
F39C 41 LD B,C
F39D F1 POP AF
F39E 02 LD (BC),A
F39F CC44A0 CALL Z,#A044
F3A2 2844 JR Z,#F3E8 ; (68)
F3A4 C5 PUSH BC
F3A5 A9 XOR C
F3A6 AC XOR H
F3A7 41 LD B,C
F3A8 F1 POP AF
F3A9 12 LD (DE),A
F3AA CC44A0 CALL Z,#A044
F3AD 41 LD B,C
F3AE AC XOR H
F3AF C9 RET
F3B0 F2ED57 JP P,#57ED
F3B3 CC44A0 CALL Z,#A044
F3B6 41 LD B,C
F3B7 AC XOR H
F3B8 D2F2ED JP NC,#EDF2
F3BB 5F LD E,A
F3BC CC44A0 CALL Z,#A044
F3BF C9 RET
F3C0 AC XOR H
F3C1 41 LD B,C
F3C2 F2ED47 JP P,#47ED
F3C5 CC44A0 CALL Z,#A044
F3C8 D2AC41 JP NC,#41AC
F3CB F2ED4F JP P,#4FED
F3CE CC44A0 CALL Z,#A044
F3D1 53 LD D,E
F3D2 50 LD D,B
F3D3 AC XOR H
F3D4 48 LD C,B
F3D5 CCF1F9 CALL Z,#F9F1
F3D8 CC44A0 CALL Z,#A044
F3DB 53 LD D,E
F3DC 50 LD D,B
F3DD AC XOR H
F3DE C9 RET
F3DF D8 RET C
F3E0 F2DDF9 JP P,#F9DD
F3E3 CC44A0 CALL Z,#A044
F3E6 53 LD D,E
F3E7 50 LD D,B
F3E8 AC XOR H
F3E9 C9 RET
F3EA 59 LD E,C
F3EB F2FDF9 JP P,#F9FD
F3EE 50 LD D,B
F3EF 55 LD D,L
F3F0 53 LD D,E
F3F1 48 LD C,B
F3F2 A0 AND B
F3F3 42 LD B,D
F3F4 C3F1C5 JP #C5F1
F3F7 50 LD D,B
F3F8 55 LD D,L
F3F9 53 LD D,E
F3FA 48 LD C,B
F3FB A0 AND B
F3FC 44 LD B,H
F3FD C5 PUSH BC
F3FE F1 POP AF
F3FF D5 PUSH DE

4853
software/asm/nascombasic.asm Normal file

File diff suppressed because it is too large Load Diff

155
software/asm/ramcheck.asm Normal file
View File

@@ -0,0 +1,155 @@
LETNL: EQU 0006h
PRNTS: EQU 000Ch
PRNT: EQU 0012h
MSG: EQU 0015h
MONIT: EQU 0086h
PRTHL: EQU 03BAh
PRTHX: EQU 03C3h
DPCT: EQU 0DDCh
MSTART: EQU 1200h
ORG 10F0h
DB 01h ; Code Type, 01 = Machine Code.
DB "RAM TEST V1.0", 0Dh, 00h, 00h ; Title/Name (17 bytes).
DW MSTART - START ; Size of program.
DW START ; Load address of program.
DW START ; Exec address of program.
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h ; Comment (104 bytes).
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
DB 00h, 00h, 00h, 00h, 00h, 00h, 00h, 00h
ORG 01200h
START: LD DE,TITLE
CALL MSG
CALL LETNL
LD B, 20 ; Number of loops
LOOP: LD HL,MSTART ; Start of checked memory,
LD D,0CEh ; End memory check CE00
LOOP1: LD A,000h
CP L
JR NZ,LOOP1b
CALL PRTHL ; Print HL as 4digit hex.
LD A,0C4h ; Move cursor left.
LD E,004h ; 4 times.
LOOP1a: CALL DPCT
DEC E
JR NZ,LOOP1a
LOOP1b: INC HL
LD A,H
CP D ; Have we reached end of memory.
JR Z,LOOP3 ; Yes, exit.
LD A,(HL) ; Read memory location under test, ie. 0.
CPL ; Subtract, ie. FF - A, ie FF - 0 = FF.
LD (HL),A ; Write it back, ie. FF.
SUB (HL) ; Subtract written memory value from A, ie. should be 0.
JR NZ,LOOP2 ; Not zero, we have an error.
LD A,(HL) ; Reread memory location, ie. FF
CPL ; Subtract FF - FF
LD (HL),A ; Write 0
SUB (HL) ; Subtract 0
JR Z,LOOP1 ; Loop if the same, ie. 0
LOOP2: LD A,16h
CALL PRNT ; Print A
CALL PRTHX ; Print HL as 4 digit hex.
CALL PRNTS ; Print space.
XOR A
LD (HL),A
LD A,(HL) ; Get into A the failing bits.
CALL PRTHX ; Print A as 2 digit hex.
CALL PRNTS ; Print space.
LD A,0FFh ; Repeat but first load FF into memory
LD (HL),A
LD A,(HL)
CALL PRTHX ; Print A as 2 digit hex.
NOP
JR LOOP4
LOOP3: LD DE,OKCHECK
CALL MSG ; Print check message in DE
LD A,B ; Print loop count.
CALL PRTHX
LD DE,OKMSG
CALL MSG ; Print ok message in DE
DEC B
JR NZ,LOOP
LD DE,DONEMSG
CALL MSG ; Print check message in DE
JP MONIT
OKCHECK: DB 11h
DB "CHECK: ", 0Dh
OKMSG: DB "OK.", 0Dh
DONEMSG: DB 11h
DB "RAM TEST COMPLETE.", 0Dh
LOOP4: LD B,09h
CALL PRNTS ; Print space.
XOR A ; Zero A
SCF ; Set Carry
LOOP5: PUSH AF ; Store A and Flags
LD (HL),A ; Store 0 to bad location.
LD A,(HL) ; Read back
CALL PRTHX ; Print A as 2 digit hex.
CALL PRNTS ; Print space
POP AF ; Get back A (ie. 0 + C)
RLA ; Rotate left A. Bit LSB becomes Carry (ie. 1 first instance), Carry becomes MSB
DJNZ LOOP5 ; Loop if not zero, ie. print out all bit locations written and read to memory to locate bad bit.
XOR A ; Zero A, clears flags.
LD A,80h
LD B,08h
LOOP6: PUSH AF ; Repeat above but AND memory location with original A (ie. 80)
LD C,A ; Basically walk through all the bits to find which one is stuck.
LD (HL),A
LD A,(HL)
AND C
NOP
JR Z,LOOP8 ; If zero then print out the bit number
NOP
NOP
LD A,C
CPL
LD (HL),A
LD A,(HL)
AND C
JR NZ,LOOP8 ; As above, if the compliment doesnt yield zero, print out the bit number.
LOOP7: POP AF
RRCA
NOP
DJNZ LOOP6
JP MONIT
LOOP8: CALL LETNL ; New line.
LD DE,BITMSG ; BIT message
CALL MSG ; Print message in DE
LD A,B
DEC A
CALL PRTHX ; Print A as 2 digit hex, ie. BIT number.
CALL LETNL ; New line
LD DE,BANKMSG ; BANK message
CALL MSG ; Print message in DE
LD A,H
CP 50h ; 'P'
JR NC,LOOP9 ; Work out bank number, 1, 2 or 3.
LD A,01h
JR LOOP11
LOOP9: CP 90h
JR NC,LOOP10
LD A,02h
JR LOOP11
LOOP10: LD A,03h
LOOP11: CALL PRTHX ; Print A as 2 digit hex, ie. BANK number.
JR LOOP7
BITMSG: DB " BIT: ", 0Dh
BANKMSG: DB " BANK: ", 0Dh
TITLE: DB "SHARPMZ RAM TEST (C) P. SMART 2018", 0Dh, 00h

File diff suppressed because it is too large Load Diff

1658
software/asm/sfd700.asm Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2254
software/asm/testtz.asm Normal file

File diff suppressed because it is too large Load Diff

2522
software/asm/tzfs.asm Normal file

File diff suppressed because it is too large Load Diff

553
software/asm/tzfs_bank2.asm Normal file
View File

@@ -0,0 +1,553 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: tzfs_bank2.asm
;- Created: July 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- Bank 2 - F000:FFFF - Help and messages
;-
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- Credits:
;- Copyright: (c) 2018-2020 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- Dec 2020 - Updates to accommodate v1.3 of the tranZPUter SW-700 board where soft
;- CPU's now become possible.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;============================================================
;
; TZFS BANK 2 - Help and message functions.
;
;============================================================
ORG BANKRAMADDR
;-------------------------------------------------------------------------------
; START OF PRINT ROUTINE METHODS
;-------------------------------------------------------------------------------
; Method to print out a true ASCII character, not the Sharp values. This is done using the mapping table ATBL for the
; range 0..127, 128.. call the original Sharp routine.
; Input: A = Ascii character.
PRINTASCII: PUSH HL
PUSH BC
CP 080H ; Anything above 080H isnt ascii so call original routine.
JR NC,PRINTASCII1
CP 00DH ; Carriage Return? Dont map just execute via original Sharp call.
JR Z,PRINTASCII1
LD HL,ATBL
LD C,A
LD B,0
ADD HL,BC
LD A,(HL)
CALL ?DSP
PRINTASCII0:POP BC
POP HL
RET
PRINTASCII1:CALL PRNT
JR PRINTASCII0
; Method to print out a string residing in this bank.
;
; As string messages take up space and banks are limited, it makes sense to locate all strings in one
; bank and print them out from here, hence this method.
;
; Also, as strings often require embedded values to be printed (aka printf), a basic mechanism for printing out stack
; parameters is provided. A PUSH before calling this method followed by an embedded marker (ie. 0xFF) will see the stack
; value printed in hex at the point in the string where the marker appears.
;
; Input: DE = Address, in this bank or any other location EXCEPT another bank.
; BC = Value to print with marker 0xFB if needed.
; Upto 4 stack values accessed by markers 0xFF, 0xFE, 0xFD, 0xFC
PRINTMSG: LD A,(DE)
CP 000H ; End of string?
RET Z
CP 0FFH ; Marker to print out first stack parameter.
JR Z,PRINTMSG3
CP 0FEH ; Marker to print out second stack parameter.
JR Z,PRINTMSG6
CP 0FDH ; Marker to print out third stack parameter.
JR Z,PRINTMSG7
CP 0FCH ; Marker to print out fourth stack parameter.
JR Z,PRINTMSG8
CP 0FBH ; Marker to print out BC.
JR Z,PRINTMSG9
CP 0FAH ; Marker to print out a filename with filename address stored in BC.
JR Z,PRINTMSG10
CALL PRINTASCII
PRINTMSG2: INC DE
JR PRINTMSG
PRINTMSG3: LD HL,6+0 ; Get first stack parameter, there are 2 pushes on the stack plus return address before the parameters.
PRINTMSG4: ADD HL,SP
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
PRINTMSG5: CALL PRTHL
JR PRINTMSG2
PRINTMSG6: LD HL,6+2
JR PRINTMSG4
PRINTMSG7: LD HL,6+4
JR PRINTMSG4
PRINTMSG8: LD HL,6+6
JR PRINTMSG4
PRINTMSG9: PUSH BC ; Print out contents of BC as 4 digit hex.
POP HL
JR PRINTMSG5
PRINTMSG10: PUSH DE ; Print out a filename with pointer stored in BC.
PUSH BC
POP DE
CALL PRTFN
POP DE
JR PRINTMSG2
; Method to print out the filename within an MZF header or SD Card header.
; The name may not be terminated as the full 17 chars are used, so this needs
; to be checked. Also, the filename uses Sharp Ascii so call the original Sharp
; print routine.
;
; Input: DE = Address of filename.
;
PRTFN: PUSH BC
LD B,FNSIZE ; Maximum size of filename.
PRTMSG: LD A,(DE)
INC DE
CP 000H ; If there is a valid terminator, exit.
JR Z,PRTMSGE
CP 00DH
JR Z,PRTMSGE
CALL PRNT
DJNZ PRTMSG ; Else print until 17 chars have been processed.
CALL NL
PRTMSGE: POP BC
RET
; A modified print string routine with full screen pause to print out the help screen text. The routine prints out true ascii
; as opposed to Sharp modified ascii.
; A string is NULL terminated.
PRTSTR: PUSH AF
PUSH BC
PUSH DE
LD A,0
LD (TMPLINECNT),A
PRTSTR1: LD A,(DE)
CP 000H ; NULL terminates the string.
JR Z,PRTSTRE
CP 00DH ; As does CR.
JR Z,PRTSTR3
PRTSTR2: CALL PRINTASCII
INC DE
JR PRTSTR1
PRTSTR3: PUSH AF
LD A,(TMPLINECNT)
CP 23 ; Check to see if a page of output has been displayed, if it has, pause.
JR Z,PRTSTR5
INC A
PRTSTR4: LD (TMPLINECNT),A
POP AF
JR PRTSTR2
PRTSTR5: CALL GETKY
CP ' '
JR NZ,PRTSTR5
XOR A
JR PRTSTR4
PRTSTRE: POP DE
POP BC
POP AF
RET
; Method to convert a string with Sharp ASCII codes into standard ASCII codes via map lookup.
; Inputs: DE = pointer to string for conversion.
; B = Maximum number of characters to convert if string not terminated.
;
CNVSTR_SA: PUSH HL
PUSH DE
PUSH BC
CNVSTRSA1: LD A,(DE) ; Get character for conversion.
OR A ; Exit at End of String (NULL, CR)
JR Z,CNVSTRSAEX
CP 00DH
JR Z,CNVSTRSAEX
CP 020H ; No point mapping control characters.
JR C,CNVSTRSA2
;
LD HL,SHARPTOASC ; Start of mapping table.
PUSH BC
LD C,A
LD B,0
ADD HL,BC ; Add in character offset.
POP BC
LD A,(HL)
LD (DE),A ; Map character.
CNVSTRSA2: INC DE
DJNZ CNVSTRSA1
CNVSTRSAEX: POP BC ; Restore all registers used except AF.
POP DE
POP HL
RET
; Method to convert a string with standard ASCII into Sharp ASCII codes via scan lookup in the mapping table.
; Inputs: DE = pointer to string for conversion.
; B = Maximum number of characters to convert if string not terminated.
CNVSTR_AS: PUSH HL
PUSH DE
PUSH BC
CNVSTRAS1: LD A,(DE) ; Get character for conversion.
OR A ; Exit at End of String (NULL, CR)
JR Z,CNVSTRSAEX
CP 00DH
JR Z,CNVSTRSAEX
CP 020H ; No point mapping control characters.
JR C,CNVSTRAS5
LD HL,SHARPTOASC + 020H
PUSH BC
LD B, 0100H - 020H
CNVSTRAS2: CP (HL) ; Go through table looking for a match.
JR Z,CNVSTRAS3
INC HL
DJNZ CNVSTRAS2
JR CNVSTRAS4 ; No match then dont convert.
CNVSTRAS3: LD BC,SHARPTOASC ; On match or expiration of BC subtract table starting point to arrive at index.
OR A
SBC HL,BC
LD A,L ; Index is used as the converted character.
CNVSTRAS4: LD (DE),A
POP BC
CNVSTRAS5: INC DE
DJNZ CNVSTRAS1
JR CNVSTRSAEX
; TRUE ASCII TO DISPLAY CODE TABLE
;
ATBL: DB 0CCH ; NUL '\0' (null character)
DB 0E0H ; SOH (start of heading)
DB 0F2H ; STX (start of text)
DB 0F3H ; ETX (end of text)
DB 0CEH ; EOT (end of transmission)
DB 0CFH ; ENQ (enquiry)
DB 0F6H ; ACK (acknowledge)
DB 0F7H ; BEL '\a' (bell)
DB 0F8H ; BS '\b' (backspace)
DB 0F9H ; HT '\t' (horizontal tab)
DB 0FAH ; LF '\n' (new line)
DB 0FBH ; VT '\v' (vertical tab)
DB 0FCH ; FF '\f' (form feed)
DB 0FDH ; CR '\r' (carriage ret)
DB 0FEH ; SO (shift out)
DB 0FFH ; SI (shift in)
DB 0E1H ; DLE (data link escape)
DB 0C1H ; DC1 (device control 1)
DB 0C2H ; DC2 (device control 2)
DB 0C3H ; DC3 (device control 3)
DB 0C4H ; DC4 (device control 4)
DB 0C5H ; NAK (negative ack.)
DB 0C6H ; SYN (synchronous idle)
DB 0E2H ; ETB (end of trans. blk)
DB 0E3H ; CAN (cancel)
DB 0E4H ; EM (end of medium)
DB 0E5H ; SUB (substitute)
DB 0E6H ; ESC (escape)
DB 0EBH ; FS (file separator)
DB 0EEH ; GS (group separator)
DB 0EFH ; RS (record separator)
DB 0F4H ; US (unit separator)
DB 000H ; SPACE
DB 061H ; !
DB 062H ; "
DB 063H ; #
DB 064H ; $
DB 065H ; %
DB 066H ; &
DB 067H ; '
DB 068H ; (
DB 069H ; )
DB 06BH ; *
DB 06AH ; +
DB 02FH ; ,
DB 02AH ; -
DB 02EH ; .
DB 02DH ; /
DB 020H ; 0
DB 021H ; 1
DB 022H ; 2
DB 023H ; 3
DB 024H ; 4
DB 025H ; 5
DB 026H ; 6
DB 027H ; 7
DB 028H ; 8
DB 029H ; 9
DB 04FH ; :
DB 02CH ; ;
DB 051H ; <
DB 02BH ; =
DB 057H ; >
DB 049H ; ?
DB 055H ; @
DB 001H ; A
DB 002H ; B
DB 003H ; C
DB 004H ; D
DB 005H ; E
DB 006H ; F
DB 007H ; G
DB 008H ; H
DB 009H ; I
DB 00AH ; J
DB 00BH ; K
DB 00CH ; L
DB 00DH ; M
DB 00EH ; N
DB 00FH ; O
DB 010H ; P
DB 011H ; Q
DB 012H ; R
DB 013H ; S
DB 014H ; T
DB 015H ; U
DB 016H ; V
DB 017H ; W
DB 018H ; X
DB 019H ; Y
DB 01AH ; Z
DB 052H ; [
DB 059H ; \ '\\'
DB 054H ; ]
DB 0BEH ; ^
DB 03CH ; _
DB 0C7H ; `
DB 081H ; a
DB 082H ; b
DB 083H ; c
DB 084H ; d
DB 085H ; e
DB 086H ; f
DB 087H ; g
DB 088H ; h
DB 089H ; i
DB 08AH ; j
DB 08BH ; k
DB 08CH ; l
DB 08DH ; m
DB 08EH ; n
DB 08FH ; o
DB 090H ; p
DB 091H ; q
DB 092H ; r
DB 093H ; s
DB 094H ; t
DB 095H ; u
DB 096H ; v
DB 097H ; w
DB 098H ; x
DB 099H ; y
DB 09AH ; z
DB 0BCH ; {
DB 080H ; |
DB 040H ; }
DB 0A5H ; ~
DB 0C0H ; DEL
ATBLE: EQU $
; Mapping table to convert between Sharp ASCII and standard ASCII.
; Sharp -> ASCII : Index with Sharp value into table to obtain conversion.
; ASCII -> Sharp : Scan into table looking for value, on match the idx is the conversion. NB 0x20 = 0x20.
SHARPTOASC: DB 000H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 000H, 020H, 020H ; 0x0F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x1F
DB 020H, 021H, 022H, 023H, 024H, 025H, 026H, 027H, 028H, 029H, 02AH, 02BH, 02CH, 02DH, 02EH, 02FH ; 0x2F
DB 030H, 031H, 032H, 033H, 034H, 035H, 036H, 037H, 038H, 039H, 03AH, 03BH, 03CH, 03DH, 03EH, 03FH ; 0x3F
DB 040H, 041H, 042H, 043H, 044H, 045H, 046H, 047H, 048H, 049H, 04AH, 04BH, 04CH, 04DH, 04EH, 04FH ; 0x4F
DB 050H, 051H, 052H, 053H, 054H, 055H, 056H, 057H, 058H, 059H, 05AH, 05BH, 05CH, 05DH, 05EH, 05FH ; 0x5F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x6F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x7F
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0x8F
DB 020H, 020H, 065H, 020H, 020H, 020H, 074H, 067H, 068H, 020H, 062H, 078H, 064H, 072H, 070H, 063H ; 0x9F
DB 071H, 061H, 07AH, 077H, 073H, 075H, 069H, 020H, 04FH, 06BH, 066H, 076H, 020H, 075H, 042H, 06AH ; 0xAF
DB 06EH, 020H, 055H, 06DH, 020H, 020H, 020H, 06FH, 06CH, 041H, 06FH, 061H, 020H, 079H, 020H, 020H ; 0xBF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xCF
DB 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H ; 0xDF
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
;-------------------------------------------------------------------------------
; END OF PRINT ROUTINE METHODS
;-------------------------------------------------------------------------------
; The FDC controller uses it's busy/wait signal as a ROM address line input, this
; causes a jump in the code dependent on the signal status. It gets around the 2MHz Z80 not being quick
; enough to process the signal by polling.
ALIGN_NOPS FDCJMP1
ORG FDCJMP1
FDCJMPL2: JP (IX)
;-------------------------------------------------------------------------------
;
; Message table
;
;-------------------------------------------------------------------------------
; 0 + <- 39
; -----------------------------------------
MSGSON: DB "+ TZFS v1.6 ", NULL ; Version 1.0-> first split from RFS v2.0
MSGSONEND: DB " **", CR, NULL ; Signon banner termination.
MSGSONT80: DB "(T80)", NULL ; T80 CPU detected.
MSGNOTFND: DB "Not Found", CR, NULL
MSGBADCMD: DB "???", CR, NULL
MSGSDRERR: DB "SD Read error, Sec:",0FBH, NULL
MSGSVFAIL: DB "Save failed.", CR, NULL
MSGERAFAIL: DB "Erase failed.", CR, NULL
MSGCDFAIL: DB "Directory invalid.", CR, NULL
MSGERASEDIR:DB "Deleted dir entry:",0FBH, NULL
MSGCMTDATA: DB "Load:",0FEH,",Exec:",0FFH, ",Size:", 0FBH, CR, NULL
MSGNOTBIN: DB "Not binary", CR, NULL
MSGLOAD: DB CR, "Loading ",'"',0FAH,'"', CR, NULL
MSGSAVE: DB CR, "Filename: ", NULL
MSGE1: DB CR, "Check sum error!", CR, NULL ; Check sum error.
MSGCMTWRITE:DB CR, "Writing ", '"',0FAH,'"', CR, NULL
MSGOK: DB CR, "OK!", CR, NULL
MSGSAVEOK: DB "Tape image saved.", CR, NULL
MSGBOOTDRV: DB CR, "Floppy boot drive ?", NULL
MSGLOADERR: DB CR, "Disk loading error", CR, NULL
MSGIPLLOAD: DB CR, "Disk loading ", NULL
MSGDSKNOTMST:DB CR, "This is not a boot disk", CR, NULL
MSGINITM: DB "Init memory", CR, NULL
MSGREAD4HEX:DB "Bad hex number", CR, NULL
MSGT2SDERR: DB "Copy from Tape to SD Failed", CR, NULL
MSGSD2TERR: DB "Copy from SD to Tape Failed", CR, NULL
MSGT2SDOK: DB "Success, Tape to SD done.", CR, NULL
MSGSD2TOK: DB "Success, SD to Tape done.", CR, NULL
MSGUNKNHW: DB "Unknown hardware, cannot change!", CR, NULL
MSGFAILBIOS:DB "Failed to load alternate BIOS!", CR, NULL
MSGFAILEXIT:DB "TZFS exit failed, I/O proc error!", CR, NULL
MSGFREQERR: DB "Error, failed to change frequency!", CR, NULL
MSGBADNUM: DB "Error, bad number supplied!", CR, NULL
MSGNOFPGA: DB "Error, no FPGA video module!", CR, NULL
MSGT80ERR: DB "Error, failed to switch to T80 CPU!", CR, NULL
MSGZ80ERR: DB "Error, failed to switch to Z80 CPU!", CR, NULL
MSGZPUERR: DB "Error, failed to switch to ZPU CPU!", CR, NULL
MSGNOSOFTCPU:DB "No soft cpu hardware!", CR, NULL
MSGNOT80CPU:DB "T80 not available!", CR, NULL
MSGNOEMU: DB "No Sharp MZ Series Emu hardware!", CR, NULL
;
OKCHECK: DB ", CHECK: ", CR, NULL
OKMSG: DB " OK.", CR, NULL
DONEMSG: DB 11h
DB "RAM TEST COMPLETE.", CR, NULL
BITMSG: DB " BIT: ", CR, NULL
BANKMSG: DB " BANK: ", CR, NULL
MSG_TIMERTST:DB "8253 TIMER TEST", CR, NULL
MSG_TIMERVAL:DB "READ VALUE 1: ", CR, NULL
MSG_TIMERVAL2:DB "READ VALUE 2: ", CR, NULL
MSG_TIMERVAL3:DB "READ DONE.", CR, NULL
; The FDC controller uses it's busy/wait signal as a ROM address line input, this
; causes a jump in the code dependent on the signal status. It gets around the 2MHz Z80 not being quick
; enough to process the signal by polling.
ALIGN_NOPS FDCJMP2
ORG FDCJMP2
FDCJMPH2: JP (IY)
; Continuation of messages after the Floppy Disk controller fixed location.
MSGNOZPUCPU:DB "ZPU Evo not available!", CR, NULL
MSGNOCMTDIR:DB "CMT has no directory.", CR, NULL
MSGNOVERIFY:DB "No Verify for SD drive.", CR, NULL
SVCRESPERR: DB "I/O Response Error, time out!", CR, NULL
SVCIOERR: DB "I/O Error, time out!", CR, NULL
;TESTMSG: DB "HL is:",0FBH, 00DH, 000H
;TESTMSG2: DB "DE is:",0FBH, 00DH, 000H
;TESTMSG3: DB "BC is:",0FBH, 00DH, 000H
;TESTMSG4: DB "4 is:",0FBH, 00DH, 000H
;-------------------------------------------------------------------------------
; START OF HELP SCREEN FUNCTIONALITY
;-------------------------------------------------------------------------------
; Simple help screen to display commands.
HELP: ;CALL NL
LD DE, HELPSCR
CALL PRTSTR
RET
; 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.
HELPSCR: ; "--------- 40 column width -------------"
DB "4 40 col mode.", 00DH
DB "8 80 col mode.", 00DH
;DB "40A select MZ-80A 40col Mode.", 00DH
;DB "80A select MZ-80A 80col Mode.", 00DH
;DB "80B select MZ-80B Mode.", 00DH
;DB "700 select MZ-700 40col Mode.", 00DH
;DB "7008 select MZ-700 80col Mode.", 00DH
DB "B toggle keyboard bell.", 00DH
DB "BASIC load BASIC SA-5510.", 00DH
DB "C[b] clear memory $1200-$D000.", 00DH
DB "CD[d] switch to SD directory [d].", 00DH
DB "CPM load CPM.", 00DH
DB "DXXXX[YYYY] dump mem XXXX to YYYY.", 00DH
DB "DIR[wc] SD dir listing, wc=wildcard.", 00DH
DB "ECfn erase file, fn=No or Filename", 00DH
DB "EX exit TZFS, reset as original.", 00DH
DB "Fx boot fd drive x.", 00DH
DB "FREQn set CPU to nKHz, 0 default.", 00DH
DB "H this help screen.", 00DH
DB "JXXXX jump to location XXXX.", 00DH
DB "LTfn[,M] load tape, fn=Filename", 00DH
DB " M = HW Mode, K=80K,C=80C,1=1200", 00DH
DB " A=80A,7=700,8=800,B=80B,2=2000", 00DH
DB "LCfn[,M] load from SD, fn=No or FileN", 00DH
DB " add NX for no exec, ie.LCNX.", 00DH
DB "MXXXX edit memory starting at XXXX.", 00DH
DB "MZmc activate hardware emulation.", 00DH
DB " mc =80K,80C,1200,80A,700,800,80B,2000", 00DH
DB "P test printer.", 00DH
DB "R test dram memory.", 00DH
DB "SDDd change to SD directory {d}.", 00DH
DB "SD2Tfn[,M] copy SD to tape.", 00DH
DB "STXXXXYYYYZZZZ[,M] save mem to tape.", 00DH
DB "SCXXXXYYYYZZZZ save mem to card.", 00DH
DB " XXXX=start, YYYY=end, ZZZZ=exec", 00DH
DB "T test timer.", 00DH
DB "T2SD[B][,M] copy tape to SD, B=Bulk", 00DH
DB "T80 switch to soft T80 CPU.", 00DH
DB "V verify tape save.", 00DH
DB "VBORDERn set vga border colour.", 00DH
DB "VMODEn set video mode.", 00DH
DB "VGAn set VGA mode.", 00DH
DB "Z80 switch to hard Z80 CPU.", 00DH
DB "ZPU switch to ZPU Evo CPU / zOS.", 00DH
; "--------- 40 column width -------------"
DB 000H
;-------------------------------------------------------------------------------
; END OF HELP SCREEN FUNCTIONALITY
;-------------------------------------------------------------------------------
;
; Ensure we fill the entire 4K by padding with FF's.
;
ALIGN_NOPS 10000H

1169
software/asm/tzfs_bank3.asm Normal file

File diff suppressed because it is too large Load Diff

344
software/asm/tzfs_bank4.asm Normal file
View File

@@ -0,0 +1,344 @@
;--------------------------------------------------------------------------------------------------------
;-
;- Name: tzfs_bank4.asm
;- Created: July 2019
;- Author(s): Philip Smart
;- Description: Sharp MZ series tzfs (tranZPUter Filing System).
;- Bank 4 - F000:FFFF -
;-
;- This assembly language program is a branch from the original RFS written for the
;- MZ80A_RFS upgrade board. It is adapted to work within the similar yet different
;- environment of the tranZPUter SW which has a large RAM capacity (512K) and an
;- I/O processor in the K64F/ZPU.
;-
;- Credits:
;- Copyright: (c) 2018-2020 Philip Smart <philip.smart@net2net.org>
;-
;- History: May 2020 - Branch taken from RFS v2.0 and adapted for the tranZPUter SW.
;- Dec 2020 - Updates to accommodate v1.3 of the tranZPUter SW-700 board where soft
;- CPU's now become possible.
;-
;--------------------------------------------------------------------------------------------------------
;- This source file is free software: you can redistribute it and-or modify
;- it under the terms of the GNU General Public License as published
;- by the Free Software Foundation, either version 3 of the License, or
;- (at your option) any later version.
;-
;- This source file is distributed in the hope that it will be useful,
;- but WITHOUT ANY WARRANTY; without even the implied warranty of
;- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;- GNU General Public License for more details.
;-
;- You should have received a copy of the GNU General Public License
;- along with this program. If not, see <http://www.gnu.org/licenses/>.
;--------------------------------------------------------------------------------------------------------
;============================================================
;
; TZFS BANK 4 - TZFS commands
;
;============================================================
ORG BANKRAMADDR
;-------------------------------------------------------------------------------
; START OF ADDITIONAL TZFS COMMANDS
;-------------------------------------------------------------------------------
; Method to set the video mode.
; Param: 0 - Enable FPGA and set to MZ-80K mode.
; 1 - Enable FPGA and set to MZ-80C mode.
; 2 - Enable FPGA and set to MZ-1200 mode.
; 3 - Enable FPGA and set to MZ-80A mode (base mode on MZ-80A hardware).
; 4 - Enable FPGA and set to MZ-700 mode (base mode on MZ-700 hardware).
; 5 - Enable FPGA and set to MZ-1500 mode.
; 6 - Enable FPGA and set to MZ-800 mode.
; 7 - Enable FPGA and set to MZ-80B mode.
; 8 - Enable FPGA and set to MZ-2000 mode.
; 9 - Enable FPGA and set to MZ-2200 mode.
; 10 - Enable FPGA and set to MZ-2500 mode.
; O - Turn off FPGA Video, turn on mainboard video.
SETVMODE: IN A,(CPLDINFO) ; Get configuration of hardware.
BIT 3,A
JP Z,NOFPGAERR ; No hardware so cannot change mode.
PUSH DE ; Preserve DE in case no number given.
POP BC
CALL ConvertStringToNumber ; Convert the input into 0 (disable) or frequency in KHz.
JR NZ,SETVMODEOFF
LD A,H
CP 0
JP NZ,BADNUMERR ; Check that the given mode is in range 0 - 7.
LD A,L
CP 10
JP NC,BADNUMERR
;
SETVMODE0: IN A,(CPLDCFG)
OR MODE_VIDEO_FPGA ; Set the tranZPUter CPLD hardware to enable the FPGA video mode.
OUT (CPLDCFG),A
;
IN A,(VMCTRL) ; Get current setting.
AND 0F0H ; Clear old mode setting.
OR L ; Add in new setting.
OUT (VMCTRL),A
RLC L ; Shift mode to position for SCRNMODE storage.
RLC L
RLC L
RLC L
LD A,(SCRNMODE) ; Repeat for the screen mode variable, used when resetting or changing display settings.
AND 007H ; Clear video mode setting.
OR L ; Add in new setting.
SET 2, A ; Set flag to indicate video mode override - ie, dont use base machine mode.
SETVMODECLR:SET 1, A ; Ensure flag set so on restart the FPGA video mode is selected.
LD (SCRNMODE),A
LD A, 016H ; Clear the screen so we start from a known position.
CALL PRNT
LD A,071H ; Blue background and white characters.
LD HL,ARAM
CALL CLR8
RET
SETVMODEOFF:LD A,(DE)
CP 'O'
JR Z,SETVMODE1
CP 'o'
JP NZ,BADNUMERR
SETVMODE1: LD A,(SCRNMODE) ; Disable flag to enable FPGA on restart.
RES 1,A
LD (SCRNMODE),A
IN A,(CPLDCFG)
AND ~MODE_VIDEO_FPGA ; Set the tranZPUter CPLD hardware to disable the FPGA video mode.
OUT (CPLDCFG),A
RET
; Method to set the VGA output mode of the external display.
SETVGAMODE: IN A,(CPLDINFO) ; Get configuration of hardware.
BIT 3,A
JP Z,NOFPGAERR ; No hardware so cannot change mode.
CALL ConvertStringToNumber ; Convert the input into 0-3, 0 = off, 1 = 640x480, 2=1024x768, 3=800x600.
JP NZ,BADNUMERR
LD A,H
CP 0
JP NZ,BADNUMERR ; Check that the given mode is in range 0 - 15.
LD A,L
CP 15
JP NC,BADNUMERR
;
;RRC L
;RRC L ; Value to top 2 bits ready to be applied to VGA mode register.
;
SETVGAMODE1:IN A,(CPLDCFG)
OR MODE_VIDEO_FPGA ; Set the tranZPUter CPLD hardware to enable the FPGA video mode.
OUT (CPLDCFG),A
;
LD A, L ; Add in new setting.
OUT (VMVGAMODE),A
LD (SCRNMODE2), A
JP SETVMODECLR
; Method to set the VGA border colour on the external display.
SETVBORDER: IN A,(CPLDINFO) ; Get configuration of hardware.
BIT 3,A
JP Z,NOFPGAERR ; No hardware so cannot change mode.
CALL ConvertStringToNumber ; Convert the input into 0 - 7, bit 2 = Red, 1 = Green, 0 = Blue.
JP NZ,BADNUMERR
LD A,H
CP 0
JP NZ,BADNUMERR ; Check that the given mode is in range 0 - 7.
LD A,L
CP 7
JP NC,BADNUMERR
;
IN A,(CPLDCFG)
OR MODE_VIDEO_FPGA ; Set the tranZPUter CPLD hardware to enable the FPGA video mode.
OUT (CPLDCFG),A
;
LD A,L
OUT (VMVGATTR),A
RET
; Method to enable/disable the alternate CPU frequency and change it's values.
;
SETFREQ: CALL ConvertStringToNumber ; Convert the input into 0 (disable) or frequency in KHz.
JP NZ,BADNUMERR
LD (TZSVC_CPU_FREQ),HL ; Set the required frequency in the service structure.
LD A,H
CP L
JR NZ,SETFREQ1
LD A, TZSVC_CMD_CPU_BASEFREQ ; Switch to the base frequency.
JR SETFREQ2
SETFREQ1: LD A, TZSVC_CMD_CPU_ALTFREQ ; Switch to the alternate frequency.
SETFREQ2: CALL SVC_CMD
OR A
JP NZ,SETFREQERR
LD A,H
CP L
RET Z ; If we are disabling the alternate cpu frequency (ie. = 0) exit.
LD A, TZSVC_CMD_CPU_CHGFREQ ; Switch to the base frequency.
CALL SVC_CMD
OR A
JP NZ,SETFREQERR
RET
; Method to configure the hardware to use the T80 CPU instantiated in the FPGA.
;
SETT80: IN A,(CPUINFO)
LD C,A
AND CPUMODE_IS_SOFT_MASK
CP CPUMODE_IS_SOFT_AVAIL
JP NZ,SOFTCPUERR
LD A,C
AND CPUMODE_IS_T80
JP Z,NOT80ERR
;LD L,VMMODE_VGA_640x480 ; Enable VGA mode for a better display.
;CALL SETVGAMODE1
LD A, TZSVC_CMD_CPU_SETT80 ; We need to ask the K64F to switch to the T80 as it may involve loading of ROMS.
CALL SVC_CMD
OR A
JP NZ,SETT80ERR
RET
; Method to configure the hardware to use the original Z80 CPU installed on the tranZPUter board.
;
SETZ80: IN A,(CPUINFO)
AND CPUMODE_IS_SOFT_MASK
CP CPUMODE_IS_SOFT_AVAIL
JP NZ,SOFTCPUERR
CALL SETVMODE1 ; Turn off VGA mode, return to default MZ video.
LD A, TZSVC_CMD_CPU_SETZ80
CALL SVC_CMD
OR A
JP NZ,SETZ80ERR
RET
; Method to configure the hardware to use the ZPU Evolution CPU instantiated in the FPGA.
;
SETZPUEVO: IN A,(CPUINFO)
LD C,A
AND CPUMODE_IS_SOFT_MASK
CP CPUMODE_IS_SOFT_AVAIL
JP NZ,SOFTCPUERR
LD A,C
AND CPUMODE_IS_ZPU_EVO
JP Z,NOZPUERR
LD L,VMMODE_VGA_640x480 ; Enable VGA mode for a better display.
CALL SETVGAMODE1
LD A, TZSVC_CMD_CPU_SETZPUEVO ; We need to ask the K64F to switch to the ZPU Evo as it may involve loading of ROMS.
CALL SVC_CMD
OR A
JP NZ,SETZPUERR
HALT ; ZPU will take over so stop the Z80 from further processing.
;----------------------------------------------
; Hardware Emulation Mode Activation Routines.
;----------------------------------------------
SETMZ80K: LD D, TZSVC_CMD_EMU_SETMZ80K ; We need to ask the K64F to switch to the Sharp MZ80K emulation as it involves loading ROMS.
JR SETEMUMZ
SETMZ80C: LD D, TZSVC_CMD_EMU_SETMZ80C
JR SETEMUMZ
SETMZ1200: LD D, TZSVC_CMD_EMU_SETMZ1200
JR SETEMUMZ
SETMZ80A: LD D, TZSVC_CMD_EMU_SETMZ80A
JR SETEMUMZ
SETMZ700: LD D, TZSVC_CMD_EMU_SETMZ700
JR SETEMUMZ
SETMZ1500: LD D, TZSVC_CMD_EMU_SETMZ1500
JR SETEMUMZ
SETMZ800: LD D, TZSVC_CMD_EMU_SETMZ800
JR SETEMUMZ
SETMZ80B: LD D, TZSVC_CMD_EMU_SETMZ80B
JR SETEMUMZ
SETMZ2000: LD D, TZSVC_CMD_EMU_SETMZ2000
JR SETEMUMZ
SETMZ2200: LD D, TZSVC_CMD_EMU_SETMZ2200
JR SETEMUMZ
SETMZ2500: LD D, TZSVC_CMD_EMU_SETMZ2500
JR SETEMUMZ
;
; General function to determine if the emulator MZ hardware is present and activate it. Activation requires making a request to the
; I/O processor as it needs to load up the correct BIOS etc prior to activating the emulation.
;
SETEMUMZ: IN A,(CPUINFO) ; Verify that the FPGA has emuMZ capabilities.
LD C,A
AND CPUMODE_IS_SOFT_MASK
CP CPUMODE_IS_SOFT_AVAIL
JR NZ,SOFTCPUERR
LD A,C
AND CPUMODE_IS_EMU_MZ
JR Z,NOEMUERR
LD L,VMMODE_VGA_640x480 ; Enable VGA mode for a better display.
CALL SETVGAMODE1
;
PUSH DE ; Setup the initial video mode based on the required emulation.
LD A,D
SUB TZSVC_CMD_EMU_SETMZ80K
LD L,A
LD H,0
CALL SETVMODE0
POP DE
;
LD A, D ; Load up the required emulation mode.
CALL SVC_CMD
OR A
JR NZ,SETT80ERR
HALT
; Simple routine to clear screen or attributes.
CLR8: LD BC,00800H
PUSH DE
LD D,A
CLR8_1: LD (HL),D
INC HL
DEC BC
LD A,B
OR C
JR NZ,CLR8_1
POP DE
RET
;
; Message addresses are in Bank2.
;
NOFPGAERR: LD DE,MSGNOFPGA
JR BADNUM2
SETFREQERR: LD DE,MSGFREQERR
JR BADNUM2
SETT80ERR: LD DE,MSGT80ERR
JR BADNUM2
SETZ80ERR: LD DE,MSGZ80ERR
JR BADNUM2
SETZPUERR: LD DE,MSGZPUERR
JR BADNUM2
SOFTCPUERR: LD DE,MSGNOSOFTCPU
JR BADNUM2
NOT80ERR: LD DE,MSGNOT80CPU
JR BADNUM2
NOZPUERR: LD DE,MSGNOZPUCPU
JR BADNUM2
NOEMUERR: LD DE,MSGNOEMU
JR BADNUM2
BADNUMERR: LD DE,MSGBADNUM
BADNUM2: CALL ?PRINTMSG
RET
;-------------------------------------------------------------------------------
; END OF ADDITIONAL TZFS COMMANDS
;-------------------------------------------------------------------------------
; The FDC controller uses it's busy/wait signal as a ROM address line input, this
; causes a jump in the code dependent on the signal status. It gets around the 2MHz Z80 not being quick
; enough to process the signal by polling.
ALIGN_NOPS FDCJMP1
ORG FDCJMP1
FDCJMPL4: JP (IX)
; The FDC controller uses it's busy/wait signal as a ROM address line input, this
; causes a jump in the code dependent on the signal status. It gets around the 2MHz Z80 not being quick
; enough to process the signal by polling.
ALIGN_NOPS FDCJMP2
ORG FDCJMP2
FDCJMPH4: JP (IY)
; Ensure we fill the entire 4K by padding with FF's.
;
ALIGN_NOPS 10000H

BIN
software/roms/1Z001M.rom vendored Normal file

Binary file not shown.

BIN
software/roms/KUMA80.BIN vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_1z-013a-km.rom vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_1z-013a.rom vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_80c_1z-013a-km.rom vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_80c_1z-013a.rom vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_80c_sa1510.rom vendored Normal file

Binary file not shown.

BIN
software/roms/monitor_sa1510.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz2000_basic_1z001.rom vendored Executable file

Binary file not shown.

BIN
software/roms/mz2000_basic_1z002.rom vendored Executable file

Binary file not shown.

BIN
software/roms/mz2000_ipl_fusionx.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz2000_ipl_original.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz2000_ipl_tzpu.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz2000_mon_1z001m.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz800_1z_013b.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz800_9z_504m.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz800_iocs.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz800_ipl.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz80afi.rom vendored Normal file

Binary file not shown.

BIN
software/roms/mz80b_ipl.rom vendored Normal file

Binary file not shown.

BIN
software/roms/tzfs_mz2000_fusionx.rom vendored Normal file

Binary file not shown.

BIN
software/roms/tzfs_mz700_fusionx.rom vendored Normal file

Binary file not shown.

BIN
software/roms/tzfs_mz80a_fusionx.rom vendored Normal file

Binary file not shown.

75
software/tools/assemble_cpm.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash -x
#########################################################################################################
##
## Name: assemble_cpm.sh
## Created: August 2018
## Author(s): Philip Smart
## Description: Sharp MZ series CPM assembly tool
## This script builds a CPM version compatible with the MZ-80A RFS system.
##
## Credits:
## Copyright: (c) 2020 Philip Smart <philip.smart@net2net.org>
##
## History: January 2020 - Initial script written.
##
#########################################################################################################
## This source file is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This source file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################################################
ROOTDIR=../../tranZPUter
TOOLDIR=${ROOTDIR}/software/tools
JARDIR=${ROOTDIR}/software/tools
ASM=glass.jar
BUILDROMLIST="cbios cpm22"
ASMDIR=${ROOTDIR}/software/asm
ASMTMPDIR=${ROOTDIR}/software/tmp
INCDIR=${ROOTDIR}/software/asm/include
ROMDIR=${ROOTDIR}/software/roms # Compiled or source ROM files.
HDRDIR=${ROOTDIR}/software/hdr # MZF headers directory.
MZFDIR=${ROOTDIR}/software/MZF/Common # MZF Format source files.
CPMVERSIONS="mz700_80c:0 mz80a_80c:1 mz80a_std:2"
# As the tranZPUter project has eveolved different variants of CP/M are needed, so this loop along with the CPMVERSIONS string builds the versions as needed.
for ver in ${CPMVERSIONS}
do
# Setup the version to be built.
FILEEXT=`echo ${ver} |cut -d: -f1`
BUILDVER=`echo ${ver}|cut -d: -f2`
echo "BUILD_VERSION EQU ${BUILDVER}" > ${INCDIR}/cpm_buildversion.asm
# Go through list and build images.
#
for f in ${BUILDROMLIST}
do
echo "Assembling: $f..."
# Assemble the source.
echo "java -jar ${JARDIR}/${ASM} ${ASMDIR}/${f}.asm ${ASMTMPDIR}/${f}.obj ${ASMTMPDIR}/${f}.sym"
java -jar ${JARDIR}/${ASM} ${ASMDIR}/${f}.asm ${ASMTMPDIR}/${f}.obj ${ASMTMPDIR}/${f}.sym -I ${INCDIR}
# On successful compile, perform post actions else go onto next build.
#
if [ $? = 0 ]
then
# The object file is binary, no need to link, copy according to build group.
echo "Copy ${ASMDIR}/${f}.obj to ${ROMDIR}/${f}.bin"
cp ${ASMTMPDIR}/${f}.obj ${ROMDIR}/${f}.bin
fi
done
# Manual tinkering to produce the loadable MZF file...
#
cat ${ROMDIR}/cpm22.bin ${ROMDIR}/cbios.bin > ${ROMDIR}/cpm223_${FILEEXT}.bin
cat ${HDRDIR}/cpm22_${FILEEXT}.hdr ${ROMDIR}/cpm223_${FILEEXT}.bin > ${MZFDIR}/cpm223_${FILEEXT}.mzf
done

112
software/tools/assemble_roms.sh Executable file
View File

@@ -0,0 +1,112 @@
#!/bin/bash
#########################################################################################################
##
## Name: assemble_roms.sh
## Created: August 2018
## Author(s): Philip Smart
## Description: Sharp MZ series ROM assembly tool
## This script takes Sharp MZ ROMS in assembler format and compiles/assembles them
## into a ROM file using the GLASS Z80 assembler.
##
## Credits:
## Copyright: (c) 2018-23 Philip Smart <philip.smart@net2net.org>
##
## History: August 2018 - Initial script written.
## March 2021 - Added MZ-800 IPL
## March 2021 - Updated to compile different versions of Microsoft BASIC.
## April 2023 - Updated to compile for FusionX.
##
#########################################################################################################
## This source file is free software: you can redistribute it and#or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This source file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################################################
ROOTDIR=../../FusionX
TOOLDIR=${ROOTDIR}/software/tools
JARDIR=${ROOTDIR}/software/tools
ASM=glass-0.5.jar
#BUILDROMLIST="1Z001M"
#BUILDMZFLIST=""
#BUILDMZFLIST="hi-ramcheck sharpmz-test"
#BUILDMZFLIST="basic_sp-5025 5z009-1b sa-5510_tzfs msbasic_mz80a msbasic_mz700 msbasic_tz40 msbasic_tz80 sharpmz-test"
BUILDROMLIST="mz2000_mon_1z001m mz2000_ipl_original mz2000_ipl_tzpu mz2000_ipl_fusionx mz800_1z_013b mz800_9z_504m mz800_iocs 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="5z009-1b sa-5510_tzfs msbasic_mz80a msbasic_mz700 msbasic_tz40 msbasic_tz80 sharpmz-test"
ASMDIR=${ROOTDIR}/software/asm
ASMTMPDIR=${ROOTDIR}/software/tmp
INCDIR=${ROOTDIR}/software/asm/include
ROMDIR=${ROOTDIR}/software/roms
MZFDIR=${ROOTDIR}/software/MZF/Common
# Go through list and build image.
#
for f in ${BUILDROMLIST} ${BUILDMZFLIST}
do
echo "Assembling: $f..."
SRCNAME=${f}
ASMNAME=${f}.asm
OBJNAME=${f}.obj
SYMNAME=${f}.sym
ROMNAME=${f}.rom
MZFNAME=${f}.mzf
# Special handling for the 4 version of MS BASIC.
if [[ ${SRCNAME} = "msbasic_mz80a" ]]; then
ASMNAME="msbasic.asm"
echo "BUILD_VERSION EQU 0" > ${INCDIR}/MSBASIC_BuildVersion.asm
elif [[ ${SRCNAME} = "msbasic_mz700" ]]; then
ASMNAME="msbasic.asm"
echo "BUILD_VERSION EQU 1" > ${INCDIR}/MSBASIC_BuildVersion.asm
elif [[ ${SRCNAME} = "msbasic_tz40" ]]; then
ASMNAME="msbasic.asm"
echo "BUILD_VERSION EQU 2" > ${INCDIR}/MSBASIC_BuildVersion.asm
elif [[ ${SRCNAME} = "msbasic_tz80" ]]; then
ASMNAME="msbasic.asm"
echo "BUILD_VERSION EQU 3" > ${INCDIR}/MSBASIC_BuildVersion.asm
fi
# Assemble the source.
echo "java -jar ${JARDIR}/${ASM} ${ASMDIR}/${ASMNAME} ${ASMTMPDIR}/${OBJNAME} ${ASMTMPDIR}/${SYMNAME}"
java -jar ${JARDIR}/${ASM} ${ASMDIR}/${ASMNAME} ${ASMTMPDIR}/${OBJNAME} ${ASMTMPDIR}/${SYMNAME} -I ${INCDIR}
# On successful compile, perform post actions else go onto next build.
#
if [ $? = 0 ]
then
# The object file is binary, no need to link, copy according to build group.
if [[ ${BUILDROMLIST} = *"${SRCNAME}"* ]]; then
echo "Copy ${ASMTMPDIR}/${OBJNAME} to ${ROMDIR}/${ROMNAME}"
cp ${ASMTMPDIR}/${OBJNAME} ${ROMDIR}/${ROMNAME}
else
# Build standard MZF files for inclusion in the SD Drive.
echo "Copy ${ASMTMPDIR}/${OBJNAME} to ${MZFDIR}/${MZFNAME}"
cp ${ASMTMPDIR}/${OBJNAME} ${MZFDIR}/${MZFNAME}
# Create sectored versions of file for inclusion into the ROM Drives.
for BLOCKSIZE in ${BLOCKSIZELIST}
do
FILESIZE=$(stat -c%s "${ASMTMPDIR}/${OBJNAME}")
if [ $((${FILESIZE} % ${BLOCKSIZE})) -ne 0 ]; then
FILESIZE=$(( ((${FILESIZE} / ${BLOCKSIZE})+1 ) * ${BLOCKSIZE} ))
fi
dd if=/dev/zero ibs=1 count=${FILESIZE} 2>/dev/null | tr "\000" "\377" > "${MZBDIR}/${SRCNAME}.${BLOCKSIZE}.bin"
dd if="${ASMTMPDIR}/${OBJNAME}" of="${MZBDIR}/${SRCNAME}.${BLOCKSIZE}.bin" conv=notrunc 2>/dev/null
done
fi
fi
done
# Manual tinkering to build the MZ800 Rom.
cat ${ROMDIR}/mz800_1z_013b.rom ${ROMDIR}/mz800_cgrom.ori ${ROMDIR}/mz800_9z_504m.rom ${ROMDIR}/mz800_iocs.rom > ${ROMDIR}/mz800_ipl.rom

72
software/tools/assemble_tzfs.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
#########################################################################################################
##
## Name: assemble_tzfs.sh
## Created: August 2018
## Author(s): Philip Smart
## Description: Sharp MZ series TZFS assembly tool
## This script takes Sharp MZ TZFS assembler and compiles/assembles them into a file
## using the GLASS Z80 assembler. The file can then be loaded by zOS into the
## tranZPUter SW memory as a User ROM application.
##
## Credits:
## Copyright: (c) 2018-2020 Philip Smart <philip.smart@net2net.org>
##
## History: August 2018 - Initial script written.
## May 2020 - Branch taken from RFS v2.0 to be used for TZFS on the tranZPUter.
##
#########################################################################################################
## This source file is free software: you can redistribute it and#or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This source file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################################################
ROOTDIR=../../tranZPUter
TOOLDIR=${ROOTDIR}/software/tools
JARDIR=${ROOTDIR}/software/tools
ASM=glass.jar
BUILDROMLIST="tzfs"
BUILDMZFLIST="testtz"
ASMDIR=${ROOTDIR}/software/asm
ASMTMPDIR=${ROOTDIR}/software/tmp
INCDIR=${ROOTDIR}/software/asm/include
ROMDIR=${ROOTDIR}/software/roms
MZFDIR=${ROOTDIR}/software/MZF/Common
# Go through list and build image.
#
for f in ${BUILDROMLIST} ${BUILDMZFLIST}
do
echo "Assembling: $f..."
# Assemble the source.
echo "java -jar ${JARDIR}/${ASM} ${ASMDIR}/${f}.asm ${ASMTMPDIR}/${f}.obj ${ASMTMPDIR}/${f}.sym"
java -jar ${JARDIR}/${ASM} ${ASMDIR}/${f}.asm ${ASMTMPDIR}/${f}.obj ${ASMTMPDIR}/${f}.sym -I ${INCDIR}
# On successful compile, perform post actions else go onto next build.
#
if [ $? = 0 ]
then
# The object file is binary, no need to link, copy according to build group.
if [[ ${BUILDROMLIST} = *"${f}"* ]]; then
echo "Copy ${ASMDIR}/${f}.obj to ${ROMDIR}/${f}.rom"
cp ${ASMTMPDIR}/${f}.obj ${ROMDIR}/${f}.rom
# BUG in GLASS 0.5, wont assemble to 0xFFFF so add a padding byte at end.
# Uncomment if your not using my modified version 0.5.1 which fixes the bug
# echo -n -e '\xff' >> ${ROMDIR}/${f}.rom
else
echo "Copy ${ASMDIR}/${f}.obj to ${MZFDIR}/${f}.mzf"
cp ${ASMTMPDIR}/${f}.obj ${MZFDIR}/${f}.mzf
fi
fi
done

304
software/tools/copytosd.sh Executable file
View File

@@ -0,0 +1,304 @@
#!/bin/bash
#========================================================================================================
# NAME
# copytosd.sh - Shell script to copy necessary TZFS, CPM and host program files to SD card for the
# tranZPUter SW K64F processor.
#
# SYNOPSIS
# copytosd.sh [-cdxDMt]
#
# DESCRIPTION
#
# OPTIONS
# -D<root path> = Absolute path to root of tranZPUter project dir.
# -M<mediapath> = Path to mounted SD card.
# -t<targethost>= Target host, MZ-80K, MZ-80A, MZ-700, MZ-800, MZ-1500, MZ-2000
# -d = Debug mode.
# -x = Shell trace mode.
# -h = This help screen.
#
# EXAMPLES
# copytosd.sh -D/projects/github -M/media/guest/7764-2389 -tMZ-700
#
# EXIT STATUS
# 0 The command ran successfully
#
# >0 An error ocurred.
#
#EndOfUsage <- do not remove this line
#========================================================================================================
# History:
# v1.00 : Initial version (C) P. Smart January 2020.
# v1.10 : Updated to cater for different targets, copying selected files accordingly.
#========================================================================================================
# This source file is free software: you can redistribute it and#or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This source file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#========================================================================================================
PROG=${0##*/}
#PARAMS="`basename ${PROG} '.sh'`.params"
ARGS=$*
##############################################################################
# Load program specific variables
##############################################################################
# VERSION of this RELEASE.
#
VERSION="1.10"
# Temporary files.
TMP_DIR=/tmp
TMP_OUTPUT_FILE=${TMP_DIR}/tmpoutput_$$.log
TMP_STDERR_FILE=${TMP_DIR}/tmperror_$$.log
# Log mechanism setup.
#
LOG="/tmp/${PROG}_`date +"%Y_%m_%d"`.log"
LOGTIMEWIDTH=40
LOGMODULE="MAIN"
# Mutex's - prevent multiple threads entering a sensitive block at the same time.
#
MUTEXDIR="/var/tmp"
##############################################################################
# Utility procedures
##############################################################################
# Function to output Usage instructions, which is soley a copy of this script header.
#
function Usage
{
# Output the lines at the start of this script from NAME to EndOfUsage
cat $0 | nawk 'BEGIN {s=0} /EndOfUsage/ { exit } /NAME/ {s=1} { if (s==1) print substr( $0, 3 ) }'
exit 1
}
# Function to output a message in Log format, ie. includes date, time and issuing module.
#
function Log
{
DATESTR=`date "+%d/%m/%Y %H:%M:%S"`
PADLEN=`expr ${LOGTIMEWIDTH} + -${#DATESTR} + -1 + -${#LOGMODULE} + -15`
printf "%s %-${PADLEN}s %s\n" "${DATESTR} [$LOGMODULE]" " " "$*"
}
# Function to terminate the script after logging an error message.
#
function Fatal
{
Log "ERROR: $*"
Log "$PROG aborted"
exit 2
}
# Function to output the Usage, then invoke Fatal to exit with a terminal message.
#
function FatalUsage
{
# Output the lines at the start of this script from NAME to EndOfUsage
cat $0 | nawk 'BEGIN {s=0} /EndOfUsage/ { exit } /NAME/ {s=1} { if (s==1) print substr( $0, 3 ) }'
echo " "
echo "ERROR: $*"
echo "$PROG aborted"
exit 3
}
# Function to output a message if DEBUG mode is enabled. Primarily to see debug messages should a
# problem occur.
#
function Debug
{
if [ $DEBUGMODE -eq 1 ]; then
Log "$*"
fi
}
# Function to output a file if DEBUG mode is enabled.
#
function DebugFile
{
if [ $DEBUGMODE -eq 1 ]; then
cat $1
fi
}
# Setup default media location.
#media=/media/psmart/A6F4-14E8;
#media=/media/psmart/1DBB-7404;
#media=/media/psmart/1BC8-C12D/;
#media=/media/psmart/6B92-7702;
media=/media/psmart/K64F/;
# Setup default target.
target=MZ-80A
#target=MZ-700
#target=MZ-800
#target=MZ-2000
#target=MZ-80B
# Setup root directory.
rootdir=/dvlp/Projects/
# Directory where software is held in root.
softwaredir=tranZPUter/software
# Process parameters, loading up variables as necessary.
#
if [ $# -gt 0 ]; then
while getopts ":dhM:t:D:x" opt; do
case $opt in
d) DEBUGMODE=1;;
D) rootdir=${OPTARG};;
M) media=${OPTARG};;
t) target=${OPTARG};;
x) set -x; TRACEMODE=1;;
h) Usage;;
\?) FatalUsage "Unknown option: -${OPTARG}";;
esac
done
shift $(($OPTIND - 1 ))
fi
# Sanity checks.
if [ ! -d "${rootdir}/${softwaredir}" ]; then
Fatal "-D < root path > is invalid, this should be the directory where the tranZPUter project directory is located."
fi
if [ ! -d "${rootdir}/${softwaredir}/MZF/${target}" ]; then
Fatal "-t < target host> is invalid, this should be one of: MZ-80K, MZ-80A, MZ-700, MZ-800, MZ-1500, MZ-2000"
fi
if [ ! -d "${media}" ]; then
Fatal "-M < media path > is invalid, this should be the mounted SD card directory."
fi
# Create necessary directories on the SD card and clean them out.
#for dir in TZFS MZF MZ80K MZ80A MZ80B MZ700 MZ800 MZ1500 MZ2000 CPM MSBAS MSCAS
for dir in BASIC MSBAS MSCAS CPM DSK MZF TZFS
do
# Clean out the directories to avoid old files being used.
if [[ "${media}x" != "x" ]]; then
mkdir -p $media/${dir}/;
if [ -d $media/${dir} ]; then
rm -fr $media/${dir}/*;
fi
fi
if [[ "${dir}" = "DSK" ]] || [[ "${dir}" = "MZF" ]]; then
for subdir in MZ80K MZ80C MZ1200 MZ80A MZ700 MZ700-2 MZ1500 MZ800 MZ80B MZ2000 MZ2200 MZ2500
do
# Clean out the directories to avoid old files being used.
if [[ "${media}x" != "x" ]]; then
mkdir -p $media/${dir}/${subdir}/;
if [ -d $media/${dir}/${subdir} ]; then
rm -f $media/${dir}/${subdir}/*;
fi
fi
done
fi
done
# Manually copy required files.
cp -fup ${rootdir}/${softwaredir}/roms/tzfs.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/sp1002.rom $media/TZFS/sp1002.rom;
cp -fup ${rootdir}/${softwaredir}/roms/sp1002Jp.rom $media/TZFS/sp1002.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_sa1510.rom $media/TZFS/sa1510.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_80c_sa1510.rom $media/TZFS/sa1510-8.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_1z-013a.rom $media/TZFS/1z-013a.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_80c_1z-013a.rom $media/TZFS/1z-013a-8.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_1z-013a-km.rom $media/TZFS/1z-013a-km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/monitor_80c_1z-013a-km.rom $media/TZFS/1z-013a-km-8.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz80a_*.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz80b_ipl.rom $media/TZFS/mz80b_ipl.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz80b_cgrom.rom $media/TZFS/mz80b_cgrom.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz80k_*.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz80ktc.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz80k_jp_cgrom.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz80kfdif.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/700_80K_km.rom $media/TZFS/700_80K_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_80C_km.rom $media/TZFS/700_80C_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_1200_km.rom $media/TZFS/700_1200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_80A_km.rom $media/TZFS/700_80A_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_700_km.rom $media/TZFS/700_700_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_800_km.rom $media/TZFS/700_800_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_1500_km.rom $media/TZFS/700_1500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_80B_km.rom $media/TZFS/700_80B_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_2000_km.rom $media/TZFS/700_2000_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_2200_km.rom $media/TZFS/700_2200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/700_2500_km.rom $media/TZFS/700_2500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_80K_km.rom $media/TZFS/80A_80K_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_80C_km.rom $media/TZFS/80A_80C_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_1200_km.rom $media/TZFS/80A_1200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_80A_km.rom $media/TZFS/80A_80A_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_700_km.rom $media/TZFS/80A_700_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_800_km.rom $media/TZFS/80A_800_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_1500_km.rom $media/TZFS/80A_1500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_80B_km.rom $media/TZFS/80A_80B_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_2000_km.rom $media/TZFS/80A_2000_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_2200_km.rom $media/TZFS/80A_2200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/80A_2500_km.rom $media/TZFS/80A_2500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_80K_km.rom $media/TZFS/2000_80K_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_80C_km.rom $media/TZFS/2000_80C_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_1200_km.rom $media/TZFS/2000_1200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_80A_km.rom $media/TZFS/2000_80A_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_700_km.rom $media/TZFS/2000_700_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_800_km.rom $media/TZFS/2000_800_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_1500_km.rom $media/TZFS/2000_1500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_80B_km.rom $media/TZFS/2000_80B_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_2000_km.rom $media/TZFS/2000_2000_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_2200_km.rom $media/TZFS/2000_2200_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/2000_2500_km.rom $media/TZFS/2000_2500_km.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz700_* $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz-1e05.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz-1e14.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/sfd700.rom $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz800_* $media/TZFS/;
cp -fup ${rootdir}/${softwaredir}/roms/mz1500_ipl.rom $media/TZFS/mz1500_ipl.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz2000_ipl_original.rom $media/TZFS/mz2000_ipl.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz2000_ipl_tzpu.rom $media/TZFS/mz2000_ipl_tzpu.rom;
cp -fup ${rootdir}/${softwaredir}/roms/mz2000_cgrom.rom $media/TZFS/mz2000_cgrom.rom;
cp -fup ${rootdir}/${softwaredir}/roms/cpm22.bin $media/CPM/;
cp -fup ${rootdir}/${softwaredir}/CPM/SDC16M/RAW/* $media/CPM/;
cp -fup ${rootdir}/${softwaredir}/MZF/Common/* $media/MZF/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-80K/* $media/MZF/MZ80K/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-80A/* $media/MZF/MZ80A/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-80B/* $media/MZF/MZ80B/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-80C/* $media/MZF/MZ80C/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-700/* $media/MZF/MZ700/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-700-2/* $media/MZF/MZ700-2/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-800/* $media/MZF/MZ800/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-1200/* $media/MZF/MZ1200/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-1500/* $media/MZF/MZ1500/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-2000/* $media/MZF/MZ2000/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-2200/* $media/MZF/MZ2200/;
cp -fup ${rootdir}/${softwaredir}/MZF/MZ-2500/* $media/MZF/MZ2500/;
cp -fup ${rootdir}/${softwaredir}/BAS/* $media/MSBAS/;
cp -fup ${rootdir}/${softwaredir}/CAS/* $media/MSCAS/
cp -fup ${rootdir}/${softwaredir}/Basic/* $media/BASIC/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-80K/* $media/DSK/MZ80K/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-80A/* $media/DSK/MZ80A/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-80B/* $media/DSK/MZ80B/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-80C/* $media/DSK/MZ80C/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-700/* $media/DSK/MZ700/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-800/* $media/DSK/MZ800/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-1200/* $media/DSK/MZ1200/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-1500/* $media/DSK/MZ1500/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-2000/* $media/DSK/MZ2000/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-2200/* $media/DSK/MZ2200/;
cp -fup ${rootdir}/${softwaredir}/DSK/MZ-2500/* $media/DSK/MZ2500/;
echo "Done, TZFS, CPM and host programs copied to SD card."
exit 0

205
software/tools/make_cpmdisks.sh Executable file
View File

@@ -0,0 +1,205 @@
#!/bin/bash
#########################################################################################################
##
## Name: make_cpmdisks.sh
## Created: January 2020
## Author(s): Philip Smart
## Description: Script to build CPM Disks for the MZ80A
## This is a very basic script to assemble all the CPM source disks into a format
## which can be read by the MZ80A tranZPUter version of CPM.
## The source is composed of directories of actual original CPM disk contents which have
## been assembled or copied from original floppies by people on the internet.
## Credit goes to Grant Searle for the CPM_MC series of disks which can be found on his
## multicomputer project and to the various CPM archives on the net.
## Credits:
## Copyright: (c) 2020 Philip Smart <philip.smart@net2net.org>
##
## 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
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This source file is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
#########################################################################################################
# These two variables configure which CPM images and disks to build. If only 1 CPM_RFS ROM Drive is needed,
# remove it fro the lists.
#BUILDCPMLIST="cpm22"
#SOURCEDIRS="CPM_RFS_[1] CPM[0-9][0-9]_* CPM_MC_5 CPM_MC_C? CPM_MC_D? CPM_MC_E? CPM_MC_F? CPM[0-9][0-9]_MZ800*"
SOURCEDIRS="CPM_RFS_[1-2] CPM[0-9][0-9]_* CPM_MC_5 CPM_MC_C? CPM_MC_D? CPM_MC_E? CPM_MC_F? CPM[0-9][0-9]_MZ800*"
ROOTDIR=`realpath ../../tranZPUter`
CPM_PATH=${ROOTDIR}/software/CPM
ROMDIR=${ROOTDIR}/software/roms # Compiled or source ROM files.
MZFDIR=${ROOTDIR}/software/MZF/Common # MZF Format source files.
HDRDIR=${ROOTDIR}/software/hdr # MZF Header directory for building images.
DISKSDIR=${ROOTDIR}/software/disks # MZF Binary sectored output files to go into ROMS.
FD1M44_PATH=${CPM_PATH}/1M44
FD1M44_CYLS=80
FD1M44_HEADS=2
FD1M44_SECTORS=36
FD1M44_GAP3=78
FD1M44_INTERLEAVE=4
SDC16M_PATH=${CPM_PATH}/SDC16M
SDC16M_CYLS=1024
SDC16M_HEADS=1
SDC16M_SECTORS=32
SDC16M_GAP3=78
SDC16M_INTERLEAVE=1
echo "Creating CPM Disks from all the directories in:$CPM_PATH} matching this filter:${SOURCEDIRS}.."
(cd ${CPM_PATH}
rm -f ${FD1M44_PATH}/RAW/*.RAW
rm -f ${FD1M44_PATH}/DSK/*.DSK
rm -f ${SDC16M_PATH}/RAW/*.RAW
rm -f ${SDC16M_PATH}/DSK/*.DSK
for src in ${SOURCEDIRS}
do
# Place size of disk in the name, useful when using the Floppy Emulator.
NEWDSKNAME=`echo ${src} | sed 's/_/_1M44_/'`
# Copy a blank image to create the new disk.
cp ${CPM_PATH}/BLANKFD/BLANK_1M44.RAW ${FD1M44_PATH}/RAW/${NEWDSKNAME}.RAW;
# Copy the CPM files from the linux filesystem into the CPM Disk under the CPM filesystem.
cpmcp -f MZ80A-1440 ${FD1M44_PATH}/RAW/${NEWDSKNAME}.RAW ${CPM_PATH}/${src}/*.* 0:
# Convert the raw image into an Extended DSK format suitable for writing to a Floppy or using with the Lotharek HxC Floppy Emulator.
samdisk copy ${FD1M44_PATH}/RAW/${NEWDSKNAME}.RAW ${FD1M44_PATH}/DSK/${NEWDSKNAME}.DSK --cyls=${FD1M44_CYLS} --head=${FD1M44_HEADS} --gap3=${FD1M44_GAP3} --sectors=${FD1M44_SECTORS} --interleave=${FD1M44_INTERLEAVE}
done
# Build the SD Card drive images, these images differ as they are larger and combine more programs in one disk under different user numbers.
# Copy the CPM files from the linux filesystem into the CPM Disk under the CPM filesystem.
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK00.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM00_SYSTEM/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM01_TURBOP/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM02_HI_C/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM03_FORTRAN80/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM04_MBASIC/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM05_COBOL80_v13/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM06_COBOL80_v20/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM07_COBOL80/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM08_Z80FORTH/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM09_CPMTEX/*.* 9:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM10_DISKUTILFUNC5/*.* 10:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM11_MAC80/*.* 11:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM29_ZSID_v14/*.* 12:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM32_ZCPR3/*.* 13:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK00.RAW ${CPM_PATH}/CPM33_ZCPR3_COMMON/*.* 14:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK01.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM12_PASCALMTP_v561/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM26_TPASCAL_v300a/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM13_MTPUG_01/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM14_MTPUG_02/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM15_MTPUG_03/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM16_MTPUG_04/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM17_MTPUG_05/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM18_MTPUG_06/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM19_MTPUG_07/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM20_MTPUG_08/*.* 9:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM21_MTPUG_09/*.* 10:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK01.RAW ${CPM_PATH}/CPM22_MTPUG_10/*.* 11:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK02.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM23_PLI/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM24_PLI80_v13/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM25_PLI80_v14/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM28_PLM80/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM27_WORDSTAR_v30/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM31_WORDSTAR_v330/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK02.RAW ${CPM_PATH}/CPM30_WORDSTAR_v400/*.* 6:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK03.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C0/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C1/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C2/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C3/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C4/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C5/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C6/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C7/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C8/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK03.RAW ${CPM_PATH}/CPM_MC_C9/*.* 9:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK04.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D0/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D1/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D2/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D3/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D4/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D5/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D6/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D7/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D8/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D9/*.* 9:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK04.RAW ${CPM_PATH}/CPM_MC_D9/*.* 9:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK05.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E0/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E1/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E2/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E3/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E4/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E5/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E6/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E7/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E8/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK05.RAW ${CPM_PATH}/CPM_MC_E9/*.* 9:
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK06.RAW;
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F0/*.* 0:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F1/*.* 1:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F2/*.* 2:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F3/*.* 3:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F4/*.* 4:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F5/*.* 5:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F6/*.* 6:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F7/*.* 7:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F8/*.* 8:
cpmcp -f MZ80A-SDC16M ${SDC16M_PATH}/RAW/CPMDSK06.RAW ${CPM_PATH}/CPM_MC_F9/*.* 9:
# Copy a blank image to create the new blank disk.
cp ${CPM_PATH}/BLANKFD/BLANK_16M.RAW ${SDC16M_PATH}/RAW/CPMDSK07.RAW;
)
# Create the CPM boot image and Drive images.
echo "Building CPM images..."
> /tmp/filelist
for f in ${BUILDCPMLIST}
do
if [ -f "${ROMDIR}/${f}.bin" ]; then
CPMIMAGE="${ROMDIR}/${f}.bin"
elif [ -f "${ROMDIR}/${f}.rom" ]; then
CPMIMAGE="${ROMDIR}/${f}.rom"
elif [ -f "${DISKSDIR}/${f}.RAW" ]; then
CPMIMAGE="${DISKSDIR}/${f}.RAW"
else
CPMIMAGE=""
echo "ALERT! ALERT! Couldnt find CPM image:${f}.raw, not creating MZF file!"
fi
if [ "${CPMIMAGE}" != "" ]; then
# Building is just a matter of concatenating together the heaader and the rom image.
cat "${HDRDIR}/${f}.hdr" "${CPMIMAGE}" > "${MZFDIR}/${f}.mzf"
# Place the name of the file into the MZF list so that we create an MZF format binary from this image.
(cd ${MZFDIR}; ls -l ${f}.mzf ${f}.mzf 2>/dev/null | sed 's/ / /g' | sed 's/ / /g' | cut -d' ' -f5,9- >> /tmp/filelist 2>/dev/null)
fi
done
ls ${FD1M44_PATH}/DSK/ ${SDC16M_PATH}/RAW/
echo "Done, all EDSK images can be found in: ${FD1M44_PATH} & ${SDC16M_PATH}."
exit 0

1146
software/tools/mzftool.pl Executable file

File diff suppressed because it is too large Load Diff