TZFS repository created from software component of the tranZPUter repository branch v2.2-tranZPUter-SW-HW_700_v1.3

This commit is contained in:
Philip Smart
2023-02-22 21:19:35 +00:00
commit e2f454fbe4
1311 changed files with 3237245 additions and 0 deletions

203
.gitignore vendored Normal file
View File

@@ -0,0 +1,203 @@
*.i
*.s
*.ii
*.tmp
*.bak
*.hex
*.save
*.d
*.swn
*.swm
*.orig
.metadata
.dm
.gradle
/Releases
/.nb-gradle/
*.bin
*.dmp
*.elf
*.lss
*.map
*.rpt
*.srec
*.swp
*.zpu
*.log
*.done
*.smsg
*.summary
*.jdi
*.pin
*.out.sdc
*.sof
*.sld
*.rbf
*.qws
*.sav
*.pof
*.qdf
*.srf
*.swo
old/
*/old/
*/*/old/
*/*/*/old/
nohup.out
*.o
Manuals/
asm/CPM22-BIOS.asm
asm/MZ80AFI.asm.bak
asm/cpm22.mzf
asm/dz80.ini
asm/old/
howto
roms/MZ80AFI.BIN
roms/MZ80AFI.rom
roms/bios.rom
roms/cpm22.rom
tmp/
src/FatFS
src/sav
asm/cbios.asm.bak
asm/sav/
rfs_bank2.asm.1703.2200
roms/cbios_bank5.rom
roms/cbios_bank6.rom
roms/cbios_bank7.rom
roms/cbios_bank8.rom
src/sdtest.c
CPM/tools/
asm/rfs_bank2.prewriteread
roms/SHARP_MZ80A_RFS_CPM_IMAGE_1.img
roms/SHARP_MZ80A_RFS_IMAGE_1.img
roms/cmp
tools/Master0.z80
tools/Master1.z80
tools/assemble_rfs.sh
src/tools/.flashmmcfg.c.swo
src/tools/x
CPM/1M44/DSK/CPM_1M44_RFS_1.DSK
CPM/1M44/DSK/CPM_1M44_RFS_2.DSK
CPM/1M44/RAW/CPM_1M44_RFS_1.RAW
CPM/1M44/RAW/CPM_1M44_RFS_2.RAW
CPM/SDC16M/
CPM/cpm3/on2
asm/.cbiosII.asm.swo
roms/SA1510.orig
asm/include/Definitions.asm.swo
tools/Mars4_5.jar
mif/monitor_SA1510.mif.bak
mif/monitor_SA1510.mif.tst
SD/
NASCAS
CAS
MZF
BAS
CPM/CPM00_MZ800
CPM/CPM00_SYSTEM
CPM/CPM01_TURBOP
CPM/CPM02_HI_C
CPM/CPM03_FORTRAN80
CPM/CPM04_MBASIC
CPM/CPM05_COBOL80_v13
CPM/CPM06_COBOL80_v20
CPM/CPM07_COBOL80
CPM/CPM08_Z80FORTH
CPM/CPM09_CPMTEX
CPM/CPM10_DISKUTILFUNC5
CPM/CPM11_MAC80
CPM/CPM12_PASCALMTP_v561
CPM/CPM13_MTPUG_01
CPM/CPM14_MTPUG_02
CPM/CPM15_MTPUG_03
CPM/CPM16_MTPUG_04
CPM/CPM17_MTPUG_05
CPM/CPM18_MTPUG_06
CPM/CPM19_MTPUG_07
CPM/CPM20_MTPUG_08
CPM/CPM21_MTPUG_09
CPM/CPM22_MTPUG_10
CPM/CPM23_PLI
CPM/CPM24_PLI80_v13
CPM/CPM25_PLI80_v14
CPM/CPM26_TPASCAL_v300a
CPM/CPM27_WORDSTAR_v30
CPM/CPM28_PLM80
CPM/CPM29_ZSID_v14
CPM/CPM30_WORDSTAR_v400
CPM/CPM31_WORDSTAR_v330
CPM/CPM32_ZCPR3
CPM/CPM33_ZCPR3_COMMON
CPM/CPM_MC_5
CPM/CPM_MC_C0
CPM/CPM_MC_C1
CPM/CPM_MC_C2
CPM/CPM_MC_C3
CPM/CPM_MC_C4
CPM/CPM_MC_C5
CPM/CPM_MC_C6
CPM/CPM_MC_C7
CPM/CPM_MC_C8
CPM/CPM_MC_C9
CPM/CPM_MC_D0
CPM/CPM_MC_D1
CPM/CPM_MC_D2
CPM/CPM_MC_D3
CPM/CPM_MC_D4
CPM/CPM_MC_D5
CPM/CPM_MC_D6
CPM/CPM_MC_D7
CPM/CPM_MC_D8
CPM/CPM_MC_D9
CPM/CPM_MC_E0
CPM/CPM_MC_E1
CPM/CPM_MC_E2
CPM/CPM_MC_E3
CPM/CPM_MC_E4
CPM/CPM_MC_E5
CPM/CPM_MC_E6
CPM/CPM_MC_E7
CPM/CPM_MC_E8
CPM/CPM_MC_E9
CPM/CPM_MC_F0
CPM/CPM_MC_F1
CPM/CPM_MC_F2
CPM/CPM_MC_F3
CPM/CPM_MC_F4
CPM/CPM_MC_F5
CPM/CPM_MC_F6
CPM/CPM_MC_F7
CPM/CPM_MC_F8
CPM/CPM_MC_F9
CPM/CPM_RFS_1
CPM/CPM_RFS_2
CPM/PLM80
CPM/tosort
MZB
CPM/320K/DSK
CPM/320K/RAW
CPM/720K/DSK
CPM/720K/RAW
CPM/1M44/DSK
CPM/1M44/RAW
CPM/CPM_MULTICOMP_contents.txt
disks
CPM
DSK
MZ800_IOCS.ref
asm/new/
asm/savit
dz80.ini
full.asm
software.bak/
roms/data
roms/fill
roms/keymap_readme.txt
roms/split
roms/x
x/
dz80.ini
full.asm
full.bin
MZ800_IOCS.ref

1
Basic Symbolic link
View File

@@ -0,0 +1 @@
/dvlp/Projects/SharpSoft/Basic

855
README.md Normal file
View File

@@ -0,0 +1,855 @@
### *T*ran*Z*puter *F*iling *S*ystem
The TranZputer Filing System is a port of the [Rom Filing System](/sharpmz-upgrades-rfs/) used on the RFS hardware upgrade board. It reuses much of the same software functionality and consequently provides the same services,
the differences lie in the use of a different memory model. It's purpose is to provide methods to manipulate files stored on the SD card and provide an extended command line interface, the TZFS Monitor. The command set includes
SD file manipulation and backup along with a number of commands found on the MZ700/800 computers.
<div style="text-align: justify">
The advent of the tranZPUter FusionX with it's virtual I/O processor prompted the seperation of this software out of the tranZPUter repository into a standalone module. TZFS runs on all the
tranZPUter range, include the newer tzpuFusionX and tzpuFusion devices.
<br><br>
The SD card and ROM's are managed by the K64F I/O processor. A service request API has been written where by a common shared memory block (640byte) is used in conjunction with a physical I/O request to pass commands and data between the
Z80 and the K64F. ie. When the Z80 wants to read an SD file, it creates a request to open a file in the memory block, makes a physical I/O operation which the K64F detects via interrupt, it opens the file and passes the data back to
the Z80 one sector at a time in the shared memory.
</div>
Under RFS the software had to be split into many ROM pages and accessed via paging as necessary, the same is true for TZFS but the pages are larger and thus less pages are needed.
The following files form the TranZputer Filing System:
| Module | Target Location | Size | Bank | Description |
|-------------------------|-----------------|------|------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| tzfs.asm | 0xE800:0xFFFF | 6K | 0 | Primary TranZputer Filing System and MZ700/MZ800 Monitor tools. |
| tzfs_bank2.asm | 0xF000:0xFFFF | 4K | 1 | Message printing routines, static messages, ascii conversion and help screen. |
| tzfs_bank3.asm | 0xF000:0xFFFF | 4K | 2 | Unused. |
| tzfs_bank4.asm | 0xF000:0xFFFF | 4K | 3 | Unused. |
| monitor_SA1510.asm | 0x00000:0x01000 | 4K | 0 | Original SA1510 Monitor for 40 character display loaded into 64K Bank 0 of tranZPUter memory. |
| monitor_80c_SA1510.asm | 0x00000:0x01000 | 4K | 0 | Original SA1510 Monitor patched for 80 character display loaded upon demand into 64K Bank 0 of tranZPUter memory. |
| monitor_1Z-013A.asm | 0x00000:0x01000 | 4K | 0 | Original 1Z-013A Monitor for the Sharp MZ-700 patched to use the MZ-80A keybaord and attribute RAM colours. |
| monitor_80c_1Z-013A.asm | 0x00000:0x01000 | 4K | 0 | Original 1Z-013A Monitor for the Sharp MZ-700 patched to use the MZ-80A keybaord, attribute RAM colours and 80 column mode. |
| MZ80B_IPL.asm | 0x00000:0x01000 | 4K | 0 | Original Sharp MZ-80B IPL firmware to bootstrap MZ-80B programs. |
In addition there are several shell scripts to aid in the building of TZFS software, namely:
| Script | Description |
|------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| assemble_tzfs.sh | A bash script to build the TranZputer Filing System binary images. |
| assemble_roms.sh | A bash script to build all the standard MZ80A ROMS, such as the SA-1510 monitor ROM needed by TZFS. |
| flashmmcfg | A binary program to generate the decoding map file for the tranZPUter SW FlashRAM decoder. |
| glass-0.5.1.jar | A bug fixed version of Glass release 0.5. 0.5 refused to fill to 0xFFFF leaving 1 byte missing, hence the bug fix. |
### CP/M
<div style="text-align: justify">
CPM v2.23 has been ported to the tranZPUter from the RFS project and enhanced to utilise the full 64K memory available as opposed to 48K under RFS. The Custom BIOS makes use of the tranZPUter memory and saves valuable CP/M TPA space
by relocating logic into another memory bank.
</div>
The following files form the CBIOS and CP/M Operating System:
| Module | Target Location | Size | Bank | Description |
|------------------------|-----------------|------|------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| cbios.asm | 0xF000:0xFFFF | 4K | 0 | CPM CBIOS stubs, interrupt service routines (RTC, keyboard etc) and CP/M disk description tables, buffers etc. |
| cbiosII.asm | 0x0000:0xCFFF | 48K | 1 | CPM CBIOS, I/O Processor Service API, SD Card Controller functions, Floppy Disk Controller functions, Screen and ANSI Terminal functions, Utilities and Audio functions.|
| | 0xE800:0xEFFF | 2K | 1 | Additional space for CBIOSII, currently not used. |
| cpm22.asm | 0xDA00:0xEFFF | 5K | 0 | The CP/M operating system comprised of the CCP (Console Command Processor) and the BDOS (Basic Disk Operating System). These components can be overwritten by applications that dont need CPM services and are reloaded when an application terminates. |
| cpm22-bios.asm | | | 0 | The Custom Bios is self contained and this stub no longer contains code. |
Additionally there are several shell scripts to aid in the building of the CP/M software, namely:
| Script | Description |
|------------------ | ------------------------------------------------------------------------------------------------------------------------ |
| assemble_cpm.sh | A shell script to build the CPM binary in the MZF format application for loading via TZFS. |
| make_cpmdisks.sh | A bash script to build a set of CPM disks, created as binary files for use on the FAT32 formatted SD Card. CPC Extended Disk Formats for use in a Floppy disk emulator or copying to physical medium are also created. |
| glass-0.5.1.jar | A bug fixed version of Glass release 0.5. 0.5 refused to fill to 0xFFFF leaving 1 byte missing, hence the bug fix. |
Please refer to the [CP/M](/sharpmz-upgrades-cpm/) section for more details,
--------------------------------------------------------------------------------------------------------
### TZFS Monitor
<div style="text-align: justify">
On power up of the Sharp MZ-700, a command line interface called the monitor is presented to the user to enable basic actions such as bootstrapping a tape or manual execution of preloaded software. The TZFS monitor is an extension
to the basic monitor and once the tranZPUter SW card has been inserted into the Z80 socket on the mainboard, entering the following command at the monitor prompt '*' will start TZFS:
</div>
``
JE800<cr>
``
It is possible to automate the startup of the computer directly into TZFS. To do this create an empty file in the root directory of the SD card called:
``
'TZFSBOOT.FLG'
``
<div style="text-align: justify">
On startup of the K64F processor, it will boot zOS and then if zOS detects this file it will perform the necessary tasks to ensure TZFS is automatically started on the Sharp MZ-700.
<br><br>
Once TZFS has booted, the typical 1Z-013A monitor signon banner will appear and be appended with "+ TZFS" postfix if all works well. The usual '*' prompt appears and you can then issue any of the original 1Z-013A commands along with a set of enhanced
commands, some of which were seen on the MZ80A/ MZ700/ MZ800 range and others are custom. The full set of commands are listed in the table below:
<br><br>
</div>
| Command | Parameters | Description |
|--------- |-------------------------------------------------------------|------------------------------------------------------------------------------------|
| 4 | n/a | Switch to 40 Character mode\. |
| 8 | n/a | Switch to 80 Character mode\. |
| 40A | n/a | Switch to Sharp MZ-80A 40 column BIOS and mode\. |
| 80A | n/a | Switch to Sharp MZ-80A 80 column BIOS and mode\. |
| <s>80B</s> | <s>n/a</s> | <s>Switch to Sharp MZ-80B compatible mode.</s> |
| 700 | n/a | Switch to Sharp MZ-700 40 column BIOS and mode\. |
| 7008 | n/a | Switch to Sharp MZ-700 80 column BIOS and mode\. |
| B | n/a | Enable/Disable key entry beep\. |
| BASIC | n/a | Locates the first BASIC interpreter on the SD card, loads and runs it\. |
| C | \[\<8 bit value\>\] | Initialise memory from 0x1200 to Top of RAM with 0x00 or provided value\. |
| CD | \[\<directory>\] | Switch to given SD card directory \<directory>. If no directory given, reset to \MZF which is the default. After a directory change the DIR command may take a few seconds to output information as the I/O processor caches the directory contents. |
| CPM | n/a | Locates CP/M 2.23 on the SD card, loads and runs it. |
| D | \<address>\[\<address2>\] | Dump memory from \<address> to \<address2> (or 20 lines) in hex and ascii. When a screen is full, the output is paused until a key is pressed\. <br><br>Subsequent 'D' commands without an address value continue on from last displayed address\.<br><br> Recognised keys during paging are:<br> 'D' - page down, 'U' - page up, 'X' - exit, all other keys list another screen of data\.|
| DIR | \<wild card\> | Listing of the files stored on the SD Card\. Each file title is preceded with a hex number which can be used to identify the file\.<br>A wildcard pattern can be given to filter the results, ie. '\*BASIC\*' will list all files with BASIC in their name.<br>Output is in the form HH&#60;seperator&#62;FileName, where &#60;seperator&#62; identifies the type of file:<br>'.' = Machine code, '-' = BASIC MZ80K/C/A, '<-' = BASIC MZ-700/800, '+' = Other. |
| EC | \<name> or <br>\<file number> | Erase file from SD Card\. The SD Card is searched for a file with \<name> or \<file number> and if found, erased\. |
| EX | n/a | Exit from TZFS and return machine to original state, I/O processor will be disabled\. |
| F | \[\<drive number\>\] | Boot from the given Floppy Disk, if no disk number is given, you will be prompted to enter one\. |
| FREQ | \<frequency in KHz\> | Change the CPU frequency to the value given, 0 for default\. Any frequency is possible, the CPU is the limiting factor. On the installed 20MHz Z80 CPU frequencies upto 24MHz have been verified\. |
| H | n/a | Help screen of all these commands\. |
| J | \<address> | Jump \(start execution\) at location \<address>\. |
| L \| LT | [,\<hardware mode\>] | Load file into memory from Tape and execute\. <br><br>\<hardware mode\> specifies the machine cassette system to be used for the command, ie. MZ-80B uses 1800 baud data rate and selecting this machine will read MZ-80B/MZ-2000 cassettes.<br><br>Hardware option flags:<br>K - MZ-80K, C - MZ-80C. 1 = MZ-1200, A - MZ-80A,<br>7 - MZ-700, 8 - MZ-800, B - MZ-80B, 2 - MZ-2000 |
| LTNX | [,\<hardware mode\>] | Load file into memory from Tape, dont execute\. <br>\<hardware mode\> is described in LT above. |
| LC | \<name> or <br>\<file number>[,\<target model\>] | Load file into memory from SD Card\. The SD Card is searched for a file with \<name> or \<file number> and if found, loaded and executed\.<br>Option argument \<target model\> allows setting the target under which the loaded software should run. This argument is intended for machines such as the MZ-800 where the default is to execute as an MZ-800 but specifying this flag you can force the MZ-700 compatibility mode. The flag is also used to target and run software into the original machine memory. Current flags:<br>8 - Force MZ-800 mode on an MZ-800 host.<br>7 - Force MZ-700 mode on an MZ-800 host.<br>O - Load into the host memory and run as original. |
| LCNX | \<name> or <br>\<file number>[,\<target model\>] | Load file into memory from SD Card\. The SD Card is searched for a file with \<name> or \<file number> and if found, loaded and not executed\.<br>\<target model\> as per LC above.|
| M | \<address> | Edit and change memory locations starting at \<address>\. |
| MZ | [\<machine\>] | Start the Sharp MZ Series hardware emulator. This reconfigures the host MZ-700 to emulate another MZ Series machine, ie. MZ-80B.<br><br> \<machine\> is an optional parameter and specifies the initial startup machine. Without this option the initial machine will be the MZ-80K and can be changed by the OSD menus. The OSD Menu is invoked by pressing SHIFT+BLANK and closed by pressing the same keys again.<br><br>Machine selection:<br>MZ80K, MZ80C, MZ1200, MZ80A, MZ700, MZ800, MZ80B, MZ2000.
| P | n/a | Run a test on connected printer\. |
| R | n/a | Run a memory test on main memory\. |
| S | \<start addr> \<end addr> \<exec addr>[,\<hardware mode\>] | Save a block of memory to tape\. You will be prompted to enter the filename\. <br><br>Ie\. S120020001203 - Save starting at 0x1200 up until 0x2000 and set execution address to 0x1203\.<br><br>\<hardware mode\> is described in LT above. |
| SC | \<start addr> \<end addr> \<exec addr>[,\<hardware mode\>] | Save a block of memory to the SD Card as an MZF file\. You will be prompted to enter the filename which will be used as the name the file is created under on the SD card\.<br><br>\<hardware mode\> is described in LT above. |
| SD2T | \<name> or <br>\<file number>[,\<hardware mode\>] | Copy a file from SD Card to Tape\. The SD Card is searched for a file with \<name> or \<file number> and if found, copied to a tape in the CMT\.<br><br>\<hardware mode\> is described in LT above. |
| T | n/a | Test the 8253 timer\. |
| T2SD[B] | [,\<hardware mode\>] | Copy a file from Tape onto the SD Card. A program is loaded from Tape and written to a free position in the SD Card. Adding B onto the end of the command invokes Batch mode where the command enters a loop converting all programs on 1 or more cassettes, only stops if BREAK key is pressed or an error occurs\.<br><br>\<hardware mode\> is described in LT above. |
| T80 | n/a | Switch to the soft T80 CPU disabling the hard Z80. |
| V | n/a | Verify a file just written to tape with the original data stored in memory |
| VBORDER | \<colour> | Set a VGA border colour.<br>0 = Black<br>1 = Green<br>2 = Blue<br>3 = Cyan<br>4 = Red<br>5 = Yellow<br>6 = Magenta<br>7 = White.\. |
| VMODE | \<video mode> | Select a video mode using the enhanced FPGA video module. The FPGA reconfigures itself to emulate the video hardware of the chosen machine.<br>0 = MZ-80K<br>1 = MZ-80C<br>2 = MZ- 1200<br>3 = MZ-80A<br>4 = MZ-700<br>5 = MZ-800<br>6 = MZ-80B<br>7 = MZ-2000<br>OFF = Revert to original video hardware\. |
| VGA | \<vga mode> | Select a VGA compatible output mode.<br>0 = Original Sharp mode<br>1 = 640x480 @ 60Hz<br>2 = 800x600 @ 60Hz\. |
| Z80 | n/a | switch to the original hard Z80 processor installed on the tranZPUter board. |
| ZPU | n/a | switch to the ZPU EVOlution processor in the FPGA and boot into the zOS Operating System. |
For the directory listing commands, 4 columns of output will be shown when in 80 column mode.
#### Tape Commands
It is now possible to read and write all of the Sharp MZ Series tape formats through TZFS commands. This is a very useful feature if you own other MZ machines such as an MZ-80B where cassettes are not in plentiful supply yet the software programs are available as binary MZF images.
<u>Tape Load</u>
To load a tape into the MZ-700 memory, you can use the commands L, LT or LTNX. L and LT are identical, LTNX loads a program but doesnt execute it, rather reporting the load, size and execution address on completion.
To specify the machine of the source tape, use the \<hardware mode\> option after the command (default, if not present, is MZ-700).<br><br>
ie. Loading a tape using the MZ-80B standard 1800 baud system you would issue the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp;L,B
<u>Tape Save</u>
To save a tape from MZ-700 memory onto the MZ-700 CMT unit you can use the S or identical ST commands. You specify, as a continous command, the starting address (the location in MZ-700 memory your program resides), the end address (last address of your program) and the execution address. Currently you cannot specify the attribute which defaults to OBJCD or executable.
On issuing the command you are prompted for a filename and the MZF header is then created and the program saved to tape.
To specify the machine of the target tape, use the \<hardware mode\> option after the command (default, if not present, is MZ-700).<br><br>
ie. Saving a program at starting address $1200, ending at $3035 and execution address is $1200 generating a tape to be used on an MZ-80B you would issue the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp;ST120030351200,B
<u>Copy SD File To Tape</u>
To copy an MZF file stored on the SD card onto a tape you would use the SD2T command. You would typically use the CD and DIR commands to locate the necessary file and then provide its unique number as an argument to the command.
To specify the machine of the target tape, use the \<hardware mode\> option after the command (default, if not present, is MZ-700).<br>
ie. Assuming you wanted to copy BASIC MZ-1Z001 to tape for an MZ-2000 machine and the file had the SD card id '0C', you would place a tape into the cassette drive, and issue the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp;SD2T0C,2
<u>Copy Tape To SD File</u>
To copy a tape program onto an SD card you would use the T2SD command. You would typically use the CD commands to switch to the desired directory where the image will be stored (maximum file limit of 255 per directory) and execute this command. The command will then search the tape, load the first program found and save it to SD card using the filename of the tape image.
To specify the machine of the target tape, use the \<hardware mode\> option after the command (default, if not present, is MZ-700).<br>
ie. Assuming you wanted to save an MZ-800 based program to SD card, you would load the tape into the drive and issue the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp;T2SD,8<br>
On completion the file details and SD card Id will be reported.
<u>Bulk Copy Entire Tapes To SD</u>
If you have a tape with multiple files stored or multiple tapes and you need to store them on SD, you would use the T2SDB command. This command is identical to the T2SD command above except it enters a loop reading from tape and saving to SD. Pressing BREAK at any time exits the command.
To specify the machine of the target tape, use the \<hardware mode\> option after the command (default, if not present, is MZ-700).<br>
ie. Assuming you wanted to save an entire MZ-800 tape to SD card, you would load the tape into the drive and issue the command:<br>
&nbsp;&nbsp;&nbsp;&nbsp;T2SDB,8<br>
As each file is read and saved the command will output the start, size and exec addresses along with the stored filename.
--------------------------------------------------------------------------------------------------------
### Sharp BASIC SA-5510
<div style="text-align: justify">
During further development of the Rom Filing System I disassembled the SA-5510 BASIC interpreter (which is standard for an MZ-80A) to make it compatible with an SD card under RFS. As this interpreter is compatible with a Sharp MZ-700/800 I decided to port it to TZFS.
<br><br>
The Byte location of the interpreter is critical as some programs are written to expect functions at known locations so disassembly had to be accurate and modifications/enhancements made outside of the main program. Luckily there is a block of self replication within the interpreter
that isnt needed for TZFS so this area was used for additional functionality.
<br><br>
Unlike RFS where I could embed a drive specification into the LOAD/SAVE command, TZFS is more powerful and thus required seperate commands to specify SD card directories and wildcards. In addition TZFS has several useful features such as CPU clock thus requiring further command additions.
<br><br>
The table below lists the command extensions with a brief description.
</div>
| Command | Parameter | Description |
| ------- | --------- | ----------- |
| LOAD | "[\<filename\>]" | Look for the program "\<filename\>" in the current SD card directory or CMT (cassette). If \<filename\> isnt given, load the next sequential file.<br>You can also use TZFS index designators instead of a filename, ie. LOAD "1E" would load the program stored in location HEX 1E on the SD card. |
| SAVE | "[\<filename\>]" | Save the program in memory to the current SD card directory or CMT (cassette) under the name "\<filename\>". <br>If \<filename\> isnt given, save with the name 'DEFAULT\<number\>' where \<number\> is a sequential number starting from 0. |
| DIR | "[\<wildcard\>]" | List out the current SD card directory in TZFS format applying any given \<wildcard\> filter, ie. DIR M* to list all programs beginning with M. |
| CD | [\<path\>] | Change the active SD directory to \<path\>. If no \<path\> given change to root directory. If path = C, ie. CDC then switch to CMT (cassette), all other arguments switch to SD card. |
| FREQ | [\<freq\>] | Change CPU to the give frequency \<freq\>. \<freq\> is specified in KHz, ie. 10000 = 10MHz. If no \<freq\> given revert to original mainboard frequency. |
<font size="2">
<div style="text-align: left">
To LOAD or SAVE to the builtin cassette drive, use the commands:<br>
&nbsp;&nbsp;&nbsp;&nbsp;CDC<br>
&nbsp;&nbsp;&nbsp;&nbsp;LOAD<br>
or
<br>
&nbsp;&nbsp;&nbsp;&nbsp;CDC<br>
&nbsp;&nbsp;&nbsp;&nbsp;SAVE "EXAMPLE"
<br>
</div>
</font>
The new version of BASIC SA-5510 is named "BASIC SA-5510-TZ".
NB: I havent yet fully implemented the random file read/write BASIC operations as I dont fully understand the logic. Once I get a suitable program I can analyse I will adapt TZFS so that it works according to the CMT specification.
--------------------------------------------------------------------------------------------------------
### Microsoft BASIC
<div style="text-align: justify">
The Sharp machines have several versions of BASIC available to use, on cassette or floppy, although they have limited compatibility with each other (ie. MZ80A SA5510 differs to the MZ-700 S-BASIC). Each machine can have
several variants, ie. SA-6510 for disk drive use or third party versions such as OM-500. Most of these BASIC interpreters run well under TZFS so long as they were intended for use on a Sharp MZ80K/A/700 albeit they are limited to CMT (cassette) or Floppy storage only.
<br><br>
One drawback of the existing BASIC interpreters is availability of source code to update them with TZFS extensions. Unless you disassemble the binary or edit the binary directly adding TZFS commands is not possible. I came across this same issue during the
development of RFS and needing a version of BASIC to aid in the more complicated tranZPUter hardware debugging I settled on using a version of Microsoft Basic where the source code was freely available, ie. the NASCOM v4.7b version of BASIC from Microsoft.
This version of Basic has quite a large following in the retro world and consequently a plethora of existing BASIC programs. It is also fairly simple to extend with additional commands.
</div>
There are two versions of the NASCOM 4.7b source code available on the internet, either the original or a version stripped of several hardware dependent commands such as LOAD /SAVE /SCREEN but tweaked to add binary/hex variables by [Grant Searle](http://searle.wales/) for his
[multicomp project](http://searle.x10host.com/Multicomp/index.html). I took both versions to make a third, writing and expanding on available commands including the missing tape commands.
<div style="text-align: justify">
As the projects developed, Microsoft BASIC needed to support a variety of configurations, 5 under RFS and 4 under TZFS. Not counting the RFS versions, on the tranZPUter running TZFS the following are available:
</div>
* MS-BASIC(MZ-80A) - Original 48K hardware which can be booted from cassette.
* MS-BASIC(MZ-700) - Original 64K hardware which can be booted from cassette.
* MS-BASIC(TZFS40) - TZFS upgrade with no video upgrade hardware installed.
* MS-BASIC(TZFS80) - TZFS upgrade with a video module FPGA upgrade installed offering 80 column display.
Each appears on the TZFS drive and should be used according to hardware and need. The original [NASCOM Basic Manual](../docs/Nascom_Basic_Manual.pdf) should be consulted for the standard set of commands and functions. The table below outlines additions which I have added to better
suite the MZ-80A / RFS hardware.
| Command | Parameters | Description |
|--------- |-------------------------------------|------------------------------------------------------------------------------------|
| CLOAD | "\<filename\>" | Load a cassette image from SD card, ie. tokenised BASIC program\. |
| CSAVE | "\<filename\>" | Save current BASIC program to SD card in tokenised cassette image format\. |
| LOAD | "\<filename\>" | Load a standard ASCII text BASIC program from SD card\. |
| SAVE | "\<filename\>" | Save current BASIC program to SD card in ASCII text format\. |
| DIR | \<wildcard\> | List out the current directory using any given wildcard\. |
| CD | \<FAT32 PATH\> | Change the working directory to the path given. All commands will now use this directory\. On startup, CLOAD/CSAVE default to 0:\CAS and LOAD/SAVE default to 0:\BAS, this command unifies them to use the given directory\. To return to using the defaults, type CD without a path\. |
| FREQ | \<frequency in KHz\> | Set the CPU to the given KHz frequency, use 0 to switch to the default mainboard frequency\. Tested ranges 100KHz to 24MHz, dependent on Z80 in use. Will overclock if Z80 is capable\. |
| ANSITERM | 0 = Off, 1 = On | Disable or enable (default) the inbuilt Ansi Terminal processor which recognises ANSI escape sequences and converts them into screen actions. This allows for use of portable BASIC programs which dont depend on specialised screen commands. FYI: The Star Trek V2 BASIC program uses ANSI escape sequences\. |
##### NASCOM Cassette Image Converter Tool
<div style="text-align: justify">
NASCOM BASIC programs can be found on the internet as Cassette image files. These files contain all the tape formatting data with embedded tokenised BASIC code. In order to be able to use these files I wrote a converter program which strips out the tape formatting data and reconstructs the BASIC code. In
addition, as this version of BASIC has been enhanced to support new commands, the token values have changed and so this program will automatically update the token value during conversion.
</div>
The converter is designed to run on the command line and it's synopsis is:
```bash
NASCONV v1.0
Required:-
-i | --image <file> Image file to be converted.
-o | --output <file> Target destination file for converted data.
Options:-
-l | --loadaddr <addr> MZ80A basic start address. NASCOM address is used to set correct MZ80A address.
-n | --nasaddr <addr> Original NASCOM basic start address.
-h | --help This help test.
-v | --verbose Output more messages.
Examples:
nasconv --image 3dnc.cas --output 3dnc.bas --nasaddr 0x10fa --loadaddr 0x4341 Convert the file 3dnc.cas from NASCOM cassette format.
```
--------------------------------------------------------------------------------------------------------
## Design Detail
<div style="text-align: justify">
This section provides internal design information for understanding how the tranZPUter SW-700 functions and its interactions with the Host (the original computer).
</div>
### K64F Z80 Host API
<div style="text-align: justify">
The API is based on a common block of RAM within the 64K memory space of the Z80 through which interprocessor communications take place. On the K64F this is declared
in C as a structure and on the Z80 as an assembler reference to memory variables.
<br>
</div>
```c
// Structure to contain inter CPU communications memory for command service processing and results.
// Typically the z80 places a command into the structure in it's memory space and asserts an I/O request,
// the K64F detects the request and reads the lower portion of the struct from z80 memory space,
// determines the command and then either reads the remainder or writes to the remainder. This struct
// exists in both the z80 and K64F domains and data is sync'd between them as needed.
//
typedef struct __attribute__((__packed__)) {
uint8_t cmd; // Command request.
uint8_t result; // Result code. 0xFE - set by Z80, command available, 0xFE - set by K64F, command ack and processing. 0x00-0xF0 = cmd complete and result of processing.
union {
uint8_t dirSector; // Virtual directory sector number.
uint8_t fileSector; // Sector within open file to read/write.
uint8_t vDriveNo; // Virtual or physical SD card drive number.
};
union {
struct {
uint16_t trackNo; // For virtual drives with track and sector this is the track number
uint16_t sectorNo; // For virtual drives with track and sector this is the sector number. NB For LBA access, this is 32bit and overwrites fileNo/fileType which arent used during raw SD access.
};
uint32_t sectorLBA; // For LBA access, this is 32bit and used during raw SD access.
struct {
uint8_t memTarget; // Target memory for operation, 0 = tranZPUter, 1 = mainboard.
uint8_t spare1; // Unused variable.
uint16_t spare2; // Unused variable.
};
};
uint8_t fileNo; // File number of a file within the last directory listing to open/update.
uint8_t fileType; // Type of file being processed.
union {
uint16_t loadAddr; // Load address for ROM/File images which need to be dynamic.
uint16_t saveAddr; // Save address for ROM/File images which need to be dynamic.
uint16_t cpuFreq; // CPU Frequency in KHz - used for setting of the alternate CPU clock frequency.
};
union {
uint16_t loadSize; // Size for ROM/File to be loaded.
uint16_t saveSize; // Size for ROM/File to be saved.
};
uint8_t directory[TZSVC_DIRNAME_SIZE]; // Directory in which to look for a file. If no directory is given default to MZF.
uint8_t filename[TZSVC_FILENAME_SIZE]; // File to open or create.
uint8_t wildcard[TZSVC_WILDCARD_SIZE]; // A basic wildcard pattern match filter to be applied to a directory search.
uint8_t sector[TZSVC_SECTOR_SIZE]; // Sector buffer generally for disk read/write.
} t_svcControl;
```
<div style="text-align: justify"><br>
Communications are all instigated by the Z80. When it needs a service, it will write a command into the svcControl.cmd field and set the svcControl.result field to
REQUEST. The Z80 then writes to an output port (configurable but generally 0x68) which in turn sends an interrupt to the K64F. The K64F reads the command and sets the
svcControl.result to PROCESSING - the Z80 waits for this handshake, if it doesnt see it after a timeout period it will resend the command. The Z80 then waits for a valid
result, again if it doesnt get a result in a reasonable time period it retries the sequence and after a number of attempts gives up with an error.
<br><br>
Once the K64F has processed the command (ie. read directory) and stored any necessary data into the structure, it sets the svcControl.result to a valid result (success,
fail or error code) to complete the transaction.
</div>
**API Command List**
| Command | Cmd# | Description |
| ------------------------- | -------- | ------------------------------------------------------------- |
| TZSVC_CMD_READDIR | 0x01 | Open a directory and return the first block of entries. |
| TZSVC_CMD_NEXTDIR | 0x02 | Return the next block in an open directory. |
| TZSVC_CMD_READFILE | 0x03 | Open a file and return the first block. |
| TZSVC_CMD_NEXTREADFILE | 0x04 | Return the next block in an open file. |
| TZSVC_CMD_WRITEFILE | 0x05 | Create a file and save the first block. |
| TZSVC_CMD_NEXTWRITEFILE | 0x06 | Write the next block to the open file. |
| TZSVC_CMD_CLOSE | 0x07 | Close any open file or directory. |
| TZSVC_CMD_LOADFILE | 0x08 | Load a file directly into tranZPUter memory. |
| TZSVC_CMD_SAVEFILE | 0x09 | Save a file directly from tranZPUter memory. |
| TZSVC_CMD_ERASEFILE | 0x0a | Erase a file on the SD card. |
| TZSVC_CMD_CHANGEDIR | 0x0b | Change active directory on the SD card. |
| TZSVC_CMD_LOAD40ABIOS | 0x20 | Request 40 column version of the SA1510 BIOS to be loaded, change frequency to match the Sharp MZ-80A. |
| TZSVC_CMD_LOAD80ABIOS | 0x21 | Request 80 column version of the SA1510 BIOS to be loaded, change frequency to match the Sharp MZ-80A. |
| TZSVC_CMD_LOAD700BIOS40 | 0x22 | Request 40 column version of the 1Z-013A MZ-700 BIOS to be loaded, change frequency to match the Sharp MZ-700 and action memory page commands. |
| TZSVC_CMD_LOAD700BIOS80 | 0x23 | Request 80 column version of the 1Z-013A MZ-700 BIOS to be loaded, change frequency to match the Sharp MZ-700 and action memory page commands. |
| TZSVC_CMD_LOAD80BIPL | 0x24 | Request the loading of the MZ-80B IPL, switch frequency and enable Sharp MZ-80B compatible mode. |
| TZSVC_CMD_LOAD800BIOS | 0x25 | Service command requesting that the MZ800 9Z-504M BIOS is loaded. |
| TZSVC_CMD_LOAD2000IPL | 0x26 | Service command requesting the MZ-2000 IPL is loaded. |
| TZSVC_CMD_LOADTZFS | 0x2F | 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 | 0x30 | Reload CPM BDOS+CCP. |
| TZSVC_CMD_ADDSDDRIVE | 0x31 | Attach a CPM disk to a drive number. |
| TZSVC_CMD_READSDDRIVE | 0x32 | Read an attached SD file as a CPM disk drive. |
| TZSVC_CMD_WRITESDDRIVE | 0x33 | Write to a CPM disk drive which is an attached SD file. |
| TZSVC_CMD_CPU_BASEFREQ | 0x40 | Set the tranZPUter to use the mainboard frequency for the Z80. |
| TZSVC_CMD_CPU_ALTFREQ | 0x41 | Switch the Z80 to use the K64F generated clock, ie. alternative frequency. |
| TZSVC_CMD_CPU_CHGFREQ | 0x42 | Change the Z80 frequency generated by the K64F to the Hertz value given in svcControl.cpuFreq, the Z80 will be clocked at the nearest timer resolution of this frequency. |
| TZSVC_CMD_CPU_SETZ80 | 0x50 | Switch to the external Z80 hard cpu. |
| TZSVC_CMD_CPU_SETT80 | 0x51 | Switch to the internal T80 soft cpu. |
| TZSVC_CMD_CPU_SETZPUEVO | 0x52 | Switch to the internal ZPU Evolution cpu. |
| TZSVC_CMD_EMU_SETMZ80K | 0x53 | Service command to switch to the internal Sharp MZ Series Emulation of the MZ80K. |
| TZSVC_CMD_EMU_SETMZ80C | 0x54 | "" "" "" MZ80C. |
| TZSVC_CMD_EMU_SETMZ1200 | 0x55 | "" "" "" MZ1200. |
| TZSVC_CMD_EMU_SETMZ80A | 0x56 | "" "" "" MZ80A. |
| TZSVC_CMD_EMU_SETMZ700 | 0x57 | "" "" "" MZ700. |
| TZSVC_CMD_EMU_SETMZ800 | 0x58 | "" "" "" MZ800. |
| TZSVC_CMD_EMU_SETMZ80B | 0x59 | "" "" "" MZ80B. |
| TZSVC_CMD_EMU_SETMZ2000 | 0x5A | "" "" "" MZ2000. |
| TZSVC_CMD_SD_DISKINIT | 0x60 | Initialise and provide raw access to the underlying SD card. |
| TZSVC_CMD_SD_READSECTOR | 0x61 | Provide raw read access to the underlying SD card. |
| TZSVC_CMD_SD_WRITESECTOR | 0x62 | Provide raw write access to the underlying SD card. |
| TZSVC_CMD_EXIT | 0x7F | Terminate TZFS and restart the machine in original mode. |
**API Result List**
| Command | Result# | Description |
| ------------------------- | -------- | ------------------------------------------------------------- |
| TZSVC_STATUS_OK | 0x00 | The K64F processing completed successfully. |
| TZSVC_STATUS_FILE_ERROR | 0x01 | A file or directory error. |
| TZSVC_STATUS_BAD_CMD | 0x02 | Bad service command was requested. |
| TZSVC_STATUS_BAD_REQ | 0x03 | Bad request was made, the service status request flag was not set. |
| TZSVC_STATUS_REQUEST | 0xFE | Z80 has posted a request. |
| TZSVC_STATUS_PROCESSING | 0xFF | K64F is processing a command. |
--------------------------------------------------------------------------------------------------------
### Z80 Memory Modes
<div style="text-align: justify">
One of the features of the tranZPUter SW-700 hardware design is the ability to create memory maps freely within the 512 macro cell CPLD. Any conceivable memory map within Z80 address space (or any soft-cpu address space upto 18 bits wide)
utilising the 512K Static RAM, 64K mainboard RAM, Video RAM, I/O can be constructed using a boolean equation and then assigned to a Memory Mode, The memory mode is then selected by Z80 software as required, ie. this ability is put to good
use in order to realise TZFS, CP/M and the compatible modes of the Sharp MZ-700 and MZ-80B.
<br><br>
The basis of the memory modes came from version 1 of the tranZPUter SW project where the decoder was based on a Flash RAM. All foreseen memory models required at that time, such as MZ-700, CP/M etc where devised. These modes have been enhanced in later designs
within the CPLD to cater for new features such as the Video Module and no doubt will be further enhanced in the future.
<br><br>
Modes which have been defined are in the table below leaving a few available slots for future expansion.
</div>
| Mode | Target | Range | Block&nbsp;&nbsp; | Function | DRAM Refresh | Description |
|------|-------------|---------------|-------|----------------|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0 | Original | 0000:0FFF | Main | MROM | Yes | Default, normal host (ie. Sharp MZ80A/MZ-700) operating mode, all memory and IO (except tranZPUter controlled I/O block) are on the mainboard |
| | | 1000:CFFF | Main | D-RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | Main | MM I/O | | |
| | | E800:EFFF | Main | User ROM | | |
| | | F000:FFFF | Main | FDC ROM | | |
| 1 | Orig+ UROM | 0000:0FFF | Main | MROM | Yes | As 0 except User ROM is mapped to tranZPUter RAM and used for loadable BIOS images. |
| | | 1000:CFFF | Main | D-RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | Main | MM I/O | | |
| | | E800:EFFF | RAM 0 | User ROM | | |
| | | F000:FFFF | Main | FDC ROM | | |
| 2 | TZFS | 0000:0FFF | RAM 0 | MROM | No | Boot mode for TZFS or any other software requiring use of the tranZPUter RAM. User ROM appears as ROM to the Monitor so it will call the entry point at 0xE800 as part of it's normal startup procedure. The software stored at 0xE800 can switch out the mainboard and run in tranZPUter RAM as required. Two small holes at F3FE and F7FE exist for the Floppy disk controller (which have to be 2 bytes wude), these locations need to be on the mainboard. The floppy disk controller uses them as part of its data read/write as the Z80 isnt fast enough to poll the FDC. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | RAM 0 | MM I/O | | |
| | | E800:EFFF | RAM 0 | User ROM | | |
| | | F000:FFFF | RAM 0 | FDC ROM | | |
| 3 | TZFS | 0000:0FFF | RAM 0 | MROM | No | Page mode for TZFS, all RAM in tranZPUter Block 0 except F000:FFFF which is in Block 1, this is page bank2 of TZFS. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | RAM 0 | VRAM | | |
| | | D800:DFFF | RAM 0 | ARAM | | |
| | | E000:E7FF | RAM 0 | MM I/O | | |
| | | E800:EFFF | RAM 0 | User ROM | | |
| | | F000:FFFF | RAM 1 | FDC ROM | | |
| 4 | TZFS | 0000:0FFF | RAM 0 | MROM | No | As mode 3 but F000:FFFF is in Block 2, this is page bank3 of TZFS. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | RAM 0 | VRAM | | |
| | | D800:DFFF | RAM 0 | ARAM | | |
| | | E000:E7FF | RAM 0 | MM I/O | | |
| | | E800:EFFF | RAM 0 | User ROM | | |
| | | F000:FFFF | RAM 2 | FDC ROM | | |
| 5 | TZFS | 0000:0FFF | RAM 0 | MROM | No | As mode 3 but F000:FFFF is in Block 3, this is page bank4 of TZFS. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | RAM 0 | VRAM | | |
| | | D800:DFFF | RAM 0 | ARAM | | |
| | | E000:E7FF | RAM 0 | MM I/O | | |
| | | E800:EFFF | RAM 0 | User ROM | | |
| | | F000:FFFF | RAM 3 | FDC ROM | | |
| 6 | CP/M | 0000:FFFF | RAM 4 | Main RAM | No | CP/M, all memory on the tranZPUter board. Special case for F3C0:F3FF & F7C0:F7FF (floppy disk paging vectors) which resides on the mainboard. |
| 7 | CP/M | 0000:0100 | RAM 4 | CP/M Vectors | No | CP/M main CBIOS area, 48K + 2K available for the CBIOS and direct access to mainboard hardware. F000:FFFF remains in bank 4 and used as the gateway between this memory mode and mode 6. |
| | | 0100:CFFF | RAM 5 | Main RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | Main | MM I/O | | |
| | | E800:EFFF | RAM 5 | User ROM | | |
| | | F000:FFFF | RAM 4 | FDC ROM | | |
| 8 | Orig+ Emu | 0000:0FFF | Main | MROM | Yes | Original mode but with the main RAM in the tranZPUter bank 0. This mode is used to bootstrap programs such as MZ-700 programs which bank change on startup and expect the loaded program to be within the main memory which is within a tranZPUter RAM bank. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | Main | MM I/O | | |
| | | E800:EFFF | Main | User ROM | | |
| | | F000:FFFF | Main | FDC ROM | | |
| 10 | MZ-700 | 0000:0FFF | RAM 6 | Main RAM | No | MZ-700 mode (OUT $E0) - Monitor RAM replaced with Main RAM |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | Main | VRAM | | |
| | | D800:DFFF | Main | ARAM | | |
| | | E000:E7FF | Main | MM I/O | | |
| | | E800:EFFF | Main | User ROM | | |
| | | F000:FFFF | Main | FDC ROM | | |
| 11 | MZ-700 | 0000:0FFF | RAM 0 | MROM | No | MZ-700 mode (OUT $E0 + $E1) - I/O and Video block replaced with Main RAM |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | RAM 6 | VRAM | | |
| | | D800:DFFF | RAM 6 | ARAM | | |
| | | E000:E7FF | RAM 6 | MM I/O | | |
| | | E800:EFFF | RAM 6 | User ROM | | |
| | | F000:FFFF | RAM 6 | FDC ROM | | |
| 12 | MZ-700 | 0000:0FFF | RAM 6 | Main RAM | No | MZ-700 mode (OUT $E1 + $E2) - Monitor RAM replaced with RAM and I/O and Video block replaced with Main RAM |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:D7FF | RAM 6 | VRAM | | |
| | | D800:DFFF | RAM 6 | ARAM | | |
| | | E000:E7FF | RAM 6 | MM I/O | | |
| | | E800:EFFF | RAM 6 | User ROM | | |
| | | F000:FFFF | RAM 6 | FDC ROM | | |
| 13 | MZ-700 | 0000:0FFF | RAM 0 | MROM | No | MZ-700 mode (OUT $E5) - Upper memory locked out, Monitor ROM paged in. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:FFFF | n/a | Undefined | | |
| 14 | MZ-700 | 0000:0FFF | RAM 6 | Main RAM | No | MZ-700 mode (OUT $E6) - Monitor RAM replaced with RAM and Upper memory locked out. |
| | | 1000:CFFF | RAM 0 | Main RAM | | |
| | | D000:FFFF | n/a | Undefined | | |
| 15 | MZ-800/MZ-700 | | | | | See table below. Memory mode is as per the MZ-800. |
| 16 | MZ2000 | 0000:7FFF | RAM 0 | IPL ROM | No | MZ2000 hardware mode, configuration set according to the MZ2000 runtime configuration registers. |
| | | 8000:FFFF | RAM 6 | Lower 32K RAM | | During IPL mode, lower 32K RAM mapped to upper 32K address. |
| | | 0000:FFFF | RAM 6 | Main RAM | | During RUN mode, full 64K RAM mapped into Z80 address space. |
| | | D000:DFFF | Main | VRAM | | Video RAM mapped into Z80 address space when PIO Port A Bit 7 set, Bit 6 clear. |
| | | C000:FFFF | Main | GRAM | | Graphics RAM mapped into Z80 address space when PIO Port A Bit 7 set, Bit 6 set. |
| 21 | K64F Access | 000000:FFFFFF | n/a | FPGA Resources | No | Access the FPGA memory by passing through the full 24bit Z80 address, typically from the K64F. |
| 22 | FPGA Access | 0000:FFFF | n/a | Host Resources | Yes | Access to the host mainboard 64K address space only. |
| 23 | K64F Access | 000000:FFFFFF | RAM | Main RAM | No | Access all memory and IO on the tranZPUter board with the K64F addressing the full 512K RAM. |
| 24 | K64F Access | 0000:FFFF | RAM 0 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 0 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 25 | K64F Access | 0000:FFFF | RAM 1 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 1 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 26 | K64F Access | 0000:FFFF | RAM 2 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 2 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 27 | K64F Access | 0000:FFFF | RAM 3 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 3 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 28 | K64F Access | 0000:FFFF | RAM 4 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 4 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 29 | K64F Access | 0000:FFFF | RAM 5 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 5 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 30 | K64F Access | 0000:FFFF | RAM 6 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 6 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
| 31 | K64F Access | 0000:FFFF | RAM 7 | Main RAM | Yes/No | All memory and IO are on the tranZPUter board, 64K block 7 selected. Mainboard DRAM is refreshed by the tranZPUter library when using this mode. |
<font size="2">
<div style="text-align: left">
Key:<br>
MROM = Monitor ROM, the original boot firmware ie. SA-1510 <br>
D-RAM = Dynamic RAM on the mainboard. <br>
VRAM = Video RAM on the mainboard. <br>
ARAM = Colour Attribute RAM on the mainboard. <br>
MM I/O = Memory Mapped I/O controllers on the mainboard. <br>
RAM 0 .. 7 = 64K RAM Block number within the 512K Static RAM chip. <br>
Main = Host computer mainboard, ie the Sharp MZ-80A mainboard. <br>
</div>
</font>
##### MZ700/MZ800 Memory Mode
| MZ-700 ||||| | MZ-800 |
| Register |0000:0FFF|1000:1FFF|1000:CFFF|C000:CFFF|D000:FFFF |0000:7FFF|1000:1FFF|2000:7FFF|8000:BFFF|C000:CFFF|C000:DFFF|E000:FFFF |
| ---------- |---------|---------|---------|---------|--------- |---------|---------|---------|---------|---------|---------|--------- |
| OUT 0xE0 |DRAM | | | | |DRAM | | | | | | |
| OUT 0xE1 | | | | |DRAM | | | | | | |DRAM |
| OUT 0xE2 |MONITOR | | | | |MONITOR | | | | | | |
| OUT 0xE3 | | | | |Memory Mapped I/O | | | | | | |Upper MONITOR ROM |
| OUT 0xE4 |MONITOR | |DRAM | |Memory Mapped I/O |MONITOR |CGROM |DRAM |VRAM | |DRAM |Upper MONITOR ROM |
| OUT 0xE5 | | | | |Inhibit | | | | | | |Inhibit |
| OUT 0xE6 | | | | |<return> | | | | | | |<return> |
| IN 0xE0 | |CGROM* | |VRAM* | | |CGROM | |VRAM | | | |
| IN 0xE1 | |DRAM | |DRAM | | |<return> | |DRAM | | | |
<font size="2">
<div style="text-align: left">
Key:<br>
&lt;return&gt; = Return to the state prior to the complimentary command being invoked.<br>
&#42; = MZ-800 host only.<br>
</div>
</font>
--------------------------------------------------------------------------------------------------------
### Z80 CPU Frequency Switching
<div style="text-align: justify">
In order to make the tranZPUter SW-700 compatible with other machines it is necessary to clock the CPU at the speed of that machine. It is also desirable to clock the CPU as fast as possible when using software such
as CP/M for maximum performance.
<br><br>
One of the main issues with frequency switching is that the underlying host cannot have its frequency changed, the host is generally generating the clock and it's circuits have been designed to operate within it's clock
tolerances. The tranZPUter SW-700 overcomes this limitation as described below.
<br><br>
To fulfil the requirement to have a switchable Z80 CPU frequency a positive edge triggered frequency switch has been implemented which takes the host frequency as one input and a square wave generator from the K64F as its second input.
The switching mechanism is tied to the bus control logic and so any access to the host will see the frequency of the CPU being changed to that of the host which ensures continued reliable operation. Under startup conditions, the Z80 is
always clocked by the host clock to ensure original specifications of the machine are met.
<br><br>
A second frequency can be selected if the K64F is present as it has the ability using its onboard timers to generate a programmable square wave output. The K64F sets the frequency of this second clock source
and the Z80 can select it via an I/O OUT command. This gives the software running on the Z80 the opportunity to change it's own frequency, albeit to a fixed set one. An extension to the K64F Host API allows the Z80 to make a request
of the K64F to set the Z80 CPU frequency to any possible value, this is useful in TZFS or CP/M so a user can select their own frequency.
<br><br>
Current testing on a CMOS Z84C0020 20MHz CPU has the following observations:
</div>
* tranZPUter reliable in the range 1Hz to 24MHz for all functionality.
* When the mainboard is accessed the frequency slows to 3.54MHz (ie. the system clock) and returns to the higher frequency after the mainboard access has completed.
<div style="text-align: justify"><br>
It is also possible to slow down the CPU for training or debugging purposes albeit access to the host circuitry will always run at the host clock frequency,
<br><br>
On an application running under the Z80, the following table outlines the I/O ports to which it must read/write in order to switch frequencies.
<br></div>
##### <u>Z80 CPU Frequency Switching Ports</u>
| Port | Dir | Function |
| ---- | --- | -------- |
| 0x62 | W | Switch Z80 CPU frequency to the second source, ie. the frequency generated by the K64F or external oscillator. |
| 0x64 | W | Switch Z80 CPU frequency to default host source. This is the default on RESET. |
| 0x66 | R | Bit [0] - Clock Selected, 0 = Host Clock, 1 = second clock source (K64F or external oscillator). |
--------------------------------------------------------------------------------------------------------
## Building tranZPUter SW-700 Software
The tranZPUter SW-700 board requires several software components to function:
<ul>
<li style="margin: 1px 0"><b>zOS embedded</b> - the integral operating system running on the K64F I/O processor</li>
<li style="margin: 1px 0"><b>zOS user</b> - the operating system for a ZPU Evo running as the Sharp MZ-700 main host processor</li>
<li style="margin: 1px 0"><b>TZFS</b> - the Z80 based operating or filing system running on the Sharp MZ-700</li>
<li style="margin: 1px 0"><b>CP/M</b> - A real operating system for Microcomputers which I ported to the Sharp MZ-700 and it benefits from a plethora of applications.</li>
</ul>
Building the software requires different procedures and these are described in the sections below.
--------------------------------------------------------------------------------------------------------
### Paths
For ease of reading, the following shortnames refer to the corresponding path in this document. The repository can be found at [TZFS](https://github.com/pdsmart/TZFS).
*tranZPUter Repository*
| Short Name | Path | Description |
|------------------|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| \<cpu\> | \[\<ABS PATH>\]/tranZPUter/cpu | ZPU VHDL definition files. |
| \<build\> | \[\<ABS PATH>\]/tranZPUter/build | Build files for developing and tesing of the ZPU based tranZPUter board. |
| \<devices\> | \[\<ABS PATH>\]/tranZPUter/devices | RTL definitions of hardware devices used in the ZPU development or tranZPUter development. |
| \<docs\> | \[\<ABS PATH>\]/tranZPUter/docs | Any relevant documentation for the project. |
| \<pcb\> | \[\<ABS PATH>\]/tranZPUter/pcb | Gerber files, each tranZPUter version (SW, SW-700 and tranZPUter) within it's own sub-directory. |
| \<schematics\> | \[\<ABS PATH>\]/tranZPUter/schematics | Kicad schematics and PCB design files including component library definitions. |
| \<software\> | \[\<ABS PATH>\]/tranZPUter/software | Root directory for software used in the project. |
| \<tools\> | \[\<ABS PATH>\]/tranZPUter/software/tools | Tools to aid in the compilation and creation of target files. |
| \<asm\> | \[\<ABS PATH>\]/tranZPUter/software/asm | Z80 assembler files for TZFS, CP/M and various original monitor ROMS. |
| \<roms\> | \[\<ABS PATH>\]/tranZPUter/software/roms | ROM files created by assembling the Z80 source. |
| \<srctools\> | \[\<ABS PATH>\]/tranZPUter/software/src/tools | tranZPUter v1 Flash RAM memory map decoder file creation tool and NASCOM Basic converter tool. |
| \<cpm\> | \[\<ABS PATH>\]/tranZPUter/software/CPM | Original CPM software, grouped according to application including generated Floppy Disk and SD Card images. |
| \<mzf\> | \[\<ABS PATH>\]/tranZPUter/software/MZF | Original Sharp MZF format applications which will be added into any generated SD Card image. |
| \<bas\> | \[\<ABS PATH>\]/tranZPUter/software/BAS | A collection of converted NASCOM Basic programs in readable text format. These are added to generated SD Card images. |
| \<cas\> | \[\<ABS PATH>\]/tranZPUter/software/CAS | A collection of NASCOM Basic tokenized tape programs converted from the NASCOM tape images. These are added to generated SD Card images. |
| \<cas\> | \[\<ABS PATH>\]/tranZPUter/software/NASCAS | A collection of original NASCOM cassette images which havent been converted. Use the nasconv tool to convert. |
| \<config\> | \[\<ABS PATH>\]/tranZPUter/software/config | Configuration files for tools. Currently the disk definition description file for generation of CP/M images. |
--------------------------------------------------------------------------------------------------------
### Tools
<div style="text-align: justify"><br>
All development has been made under Linux, specifically Debian/Ubuntu. I use Windows for the GUI version of CP/M Tools but havent dedicated any time into building TZFS under Windows. I will in due course
create a Docker image with all necessary tools installed, but in the meantime, in order to assemble the Z80 code, the C programs and to work with the CP/M software and CP/M disk images, you will need to obtain and install the following tools.
</div>
NB: For the K64F, the ARM compatible toolchain is currently stored in the repo within the build tree.
| | |
| --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
[ZPU GCC ToolChain](https://github.com/zylin/zpugcc) | The GCC toolchain for ZPU development. Install into */opt* or similar common area. |
[Arduino](https://www.arduino.cc/en/main/software) | The Arduino development environment, not really needed unless adding features to the K64F version of zOS from the extensive Arduino library. Not really needed, more for reference. |
[Teensyduino](https://www.pjrc.com/teensy/td_download.html) | The Teensy3 Arduino extensions to work with the Teensy3.5 board at the Arduino level. Not really needed, more for reference. |
[Z80 Glass Assembler](http://www.grauw.nl/blog/entry/740/) | A Z80 Assembler for converting Assembly files into machine code. I have had to fix a bug in the 0.5 release as it wouldnt create a byte at location 0xFFFF, this fixed version is stored in the \<tools\> directory in the repository. |
[samdisk](https://simonowen.com/samdisk/) | A multi-os command line based low level disk manipulation tool. |
[cpmtools](https://www.cpm8680.com/cpmtools/) | A multi-os command line CP/M disk manipulation tool. |
[CPMToolsGUI](http://star.gmobb.jp/koji/cgi/wiki.cgi?page=CpmtoolsGUI) | A Windows based GUI CP/M disk manipulation tool. |
[z88dk](https://www.z88dk.org/forum/) | An excellent C development kit for the Z80 CPU. |
[sdcc](http://sdcc.sourceforge.net/) | Another excellent Small Device C compiler, the Z80 being one of its targets. z88dk provides an enhanced (for the Z80) version of this tool within its package. |
--------------------------------------------------------------------------------------------------------
### Build TZFS
Building the software and final load image can be done by cloning the [repository](https://github.com/pdsmart/tranZPUter.git) and running some of the shell scripts and binaries provided.
TZFS is built as follows:
1. Make the TZFS binary using \<tools\>/assemble_tzfs.sh, this creates a ROM image \<roms\>/tzfs.rom which contains all the main and banked code.
2. Make the original MZ80A/MZ-700 monitor roms using \<tools\>/assemble_roms.sh, this creates \<roms\>/monitor_SA1510.rom, \<roms\>/monitor_80c_SA1510.rom, \<roms\>/monitor_1Z-013A.rom and \<roms\>/monitor_80c_1Z-013A.rom.
3. Copy and/or delete any required Sharp MZF files into/from the MZF directory.
4. Copy files to the SD card.
See [below](/sharpmz-upgrades-tranzputer-sw/#a-typical-build) for the typical build stages.
--------------------------------------------------------------------------------------------------------
### Build CPM
To build CP/M please refer to the [CP/M build section](/sharpmz-upgrades-cpm/#building-cpm) for additional information.
The CP/M version for the tranZPUter is slightly simpler to build as it doesnt involve preparing a special SD card or compacted ROM images.
The CP/M system is built in 4 parts,
1. the cpm22.bin which contains the CCP, BDOS and a CBIOS stub.
2. the banked CBIOS which has its primary source in a 4K page located at 0xF000:FFFF and a
larger, upto 48K page, located in a seperate 64K RAM block.
3. the concatenation of 1 + 2 + MZF Header into an MZF format file which TZFS can load.
4. creation of the CPM disk drives which are stored as 16MB FAT32 files on the K64F SD card.
All of the above are encoded into 2 bash scripts, namely 'assemble_cpm.sh' and 'make_cpmdisks.sh' which can be executed as follows:
```bash
cd <software>
tools/assemble_cpm.sh
tools/make_cpmdisks.sh
```
The CPM disk images can be found in \<cpm\>/1M44/RAW for the raw images or \<cpm\>/1M44/DSK for the CPC Extended format disk images. These images are built from the directories in
\<cpm\>, each directory starting with CPM* is packaged into one 1.44MB drive image. NB. In addition, the directories are also packaged into all the other supported disks as
images in a corresponding directory, ie \<cpm\>/SDC16M for the 16MB SD Card drive image.
The CPM disks which exist as files on the SD Card are stored in \<CPM\>/SDC16M/RAW and have the format CPMDSK\<number\>.RAW, where \<number\> is 00, 01 ... n and corresponds to the
disk drive under CP/M to which they are attached (ie. standard boot, 00 = drive A, 01 = drive B etc. If the Floppy Disk Controller has priority then 00 = drive C, 01 = drive D).
Under a typical run of CP/M upto 6 disks will be attached (the attachment is dynamic but limited to available memory).
--------------------------------------------------------------------------------------------------------
### A Typical Build
A quick start to building the software, creating the SD card and installing it has been
summarized below.
````bash
# Obtain an SD Card and partition into 2 DOS FAT32 formatted partitions, mount them as <SD CARD P1> and <SD CARD P2>. The partition size should be at least 512Mb each.
# The first partition will host the software to run on the K64F I/O processor AND all the Sharp MZ software to be accessed by the Sharp MZ-700.
# The second partition will host the software to run on the ZPU Evo processor when it acts as the main Sharp MZ-700 processor.
# Build zOS (embedded)
cd <zsoft>
./build.sh -C K64F -O zos -N 0x10000 -d -T
# Flash <z-zOS>/main.hex into the K64F processor via USB or OpenSDA.
cp -r build/SD/* <SD CARD P1>/
# Build zOS (user)
./build.sh -C EVO -O zos -o 0 -M 0x1FD80 -B 0x0000 -S 0x3D80 -N 0x4000 -A 0x100000 -a 0x80000 -n 0x0000 -s 0x0000 -d -Z
cp -r build/SD/* <SD CARD P2>/
# Ensure that the ZPU zOS kernel is copied to the K64F partition as it will be used for loading into the ZPU Evo on reset.
cp -rbuild/SD/ZOS/* <SD CARD P1>/ZOS/
# Build TZFS
cd <software>
tools/assemble_tzfs.sh
# Build the required host (Sharp) ROMS.
tools/assemble_roms.sh
# Build CPM
tools/assemble_cpm.sh
# Build the CPM disks.
tools/make_cpmdisks.sh
# Create the target directories on the SD card 1st partition and copy all the necessary applications and roms.
mkdir -p <SD CARD P1>/TZFS/
mkdir -p <SD CARD P1>/MZF/
mkdir -p <SD CARD P1>/CPM/
mkdir -p <SD CARD P1>/BAS
mkdir -p <SD CARD P1>/CAS
cp <software>/roms/tzfs.rom <SD CARD P1>/TZFS/
cp <software>/roms/monitor_SA1510.rom <SD CARD P1>/TZFS/SA1510.rom
cp <software>/roms/monitor_80c_SA1510.rom <SD CARD P1>/TZFS/SA1510-8.rom
cp <software>/roms/monitor_1Z-013A.rom <SD CARD P1>/TZFS/1Z-013A.rom
cp <software>/roms/monitor_80c_1Z-013A.rom <SD CARD P1>/TZFS/1Z-013A-8.rom
cp <software>/roms/monitor_1Z-013A-KM.rom <SD CARD P1>/TZFS/1Z-013A-KM.rom
cp <software>/roms/monitor_80c_1Z-013A-KM.rom <SD CARD P1>/TZFS/1Z-013A-KM-8.rom
cp <software>/roms/MZ80B_IPL.rom <SD CARD P1>/TZFS/MZ80B_IPL.rom
cp <software>/MZF/CPM223.MZF <SD CARD P1>/MZF/
cp <software>/roms/cpm22.bin <SD CARD P1>/CPM/
cp <software>/CPM/SDC16M/RAW/* <SD CARD P1>/CPM/
cp <software>/MZF/* <SD CARD P1>/MZF/
cp <software>/BAS/* <SD CARD P1>/BAS/
cp <software>/CAS/* <SD CARD P1>/CAS/
# If you want TZFS to autostart, create an empty flag file as follows.
> <SD CARD P1>/TZFSBOOT.FLG
# If you want to run TZFS commands on each boot, create an autoexec.bat file and place required commands into the file.
> <SD CARD P1>/AUTOEXEC.BAT
# Eject the card and insert it into the SD Card reader on the tranZPUter board.
# Remove the Z80 from the Sharp MZ machine and install the tranZPUter board into the Z80 socket.
# Power on. If the autostart flag has been created, you should see the familiar monitor
# signon message followed by +TZFS. If the autostart flag hasnt been created, enter the command
# JE800 into the monitor to initialise TZFS.
````
To aid in building and preparing an SD card, I use a quick and dirty script \<zSoft\>/buildall which can be used but you would need to change the ROOT_DIR and disable the RSYNC (I use a remote computer to compile zOS and upload into the K64F).
Any errors and the script will abort with a suitable error message.
--------------------------------------------------------------------------------------------------------
## Credits
Where I have used or based any component on a 3rd parties design I have included the original authors copyright notice. All 3rd party software, to my knowledge and research, is open source and freely useable, if there is found to be any component with licensing restrictions, it will be removed from this repository and a suitable link/config provided.
--------------------------------------------------------------------------------------------------------
## Licenses
This design, hardware and software, is licensed under the GNU Public Licence v3.
### The Gnu Public License v3
<div style="text-align: justify">
The source and binary files in this project marked as GPL v3 are 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.
<br><br>
The source files are 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.
<br><br>
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
</div>

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

File diff suppressed because it is too large Load Diff

3690
asm/1z-013a.asm Normal file

File diff suppressed because it is too large Load Diff

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

File diff suppressed because it is too large Load Diff

1658
asm/SFD700.asm Normal file

File diff suppressed because it is too large Load Diff

2298
asm/asm.asm Normal file

File diff suppressed because it is too large Load Diff

5908
asm/basic_sp-5025.asm Normal file

File diff suppressed because it is too large Load Diff

1615
asm/cbios.asm Normal file

File diff suppressed because it is too large Load Diff

3912
asm/cbiosII.asm Normal file

File diff suppressed because it is too large Load Diff

35
asm/cpm22-bios.asm Normal file
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
asm/cpm22.asm Normal file

File diff suppressed because it is too large Load Diff

12
asm/delaytest.asm Normal file
View File

@@ -0,0 +1,12 @@
ORG 1200H
DELAY2: LD BC,62086
DELAY: LD A,15H ; 7
LOOP: DEC A ; 4
JR NZ, LOOP ; 7 = 378
DEC BC ; 6
LD A,B ; 4
OR C ; 4
JR NZ,DELAY ; 7 = 399
JP 00000H

BIN
asm/delaytest.obj Normal file

Binary file not shown.

3
asm/delaytest.sym Normal file
View File

@@ -0,0 +1,3 @@
DELAY: equ 1203H
DELAY2: equ 1200H
LOOP: equ 1205H

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.

152
asm/include/macros.asm Normal file
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 1 ; Build for the Sharp MZ-700 base hardware.
BUILD_MZ2000 EQU 0 ; 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.

193
asm/include/tzfs_mondef.asm Normal file
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,120 @@
;--------------------------------------------------------------------------------------------------------
;-
;- 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_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.
; 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"

8
asm/monitor_1z-013a.asm Normal file
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,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.
SCRLW: EQU COLW / 8 ; Number of 8 byte regions in a line for hardware scroll.
MODE80C:EQU 1
INCLUDE "sa1510.asm"

8
asm/monitor_sa1510.asm Normal file
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.
SCRLW: EQU COLW / 8 ; Number of 8 byte regions in a line for hardware scroll.
MODE80C:EQU 0
INCLUDE "sa1510.asm"

9699
asm/msbasic.asm Normal file

File diff suppressed because it is too large Load Diff

617
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'

2568
asm/mz-xz009/BASIC.ASM Normal file

File diff suppressed because it is too large Load Diff

1514
asm/mz-xz009/CONV.ASM Normal file

File diff suppressed because it is too large Load Diff

546
asm/mz-xz009/EDIT.ASM Normal file
View File

@@ -0,0 +1,546 @@
; ------------------------------------
; MZ-800 BASIC Interm.code conversion
; FI:EDIT ver 1.0A 7.18.84
; Programed by T.Miho
; ------------------------------------
;
INCLD MACRO
;
CVIMTX: ENT
PUSH DE
PUSH BC
LD C,0
DEC DE
CVIM10: INC DE
CVIM12: CALL IMSPACE
OR A
JR Z,IMEND
CP FFH
JR Z,IMPAI
CP 80H
JP NC,ER01
CP 20H
JR C,CVIM10
LD IX,CVIM12
PUSH IX
CP '"'
JR Z,IMSTR
CP "'"
JR Z,IMREM
CP "?"
JR Z,IMPRT
CP "."
JP Z,IMFLT
CP "$"
JP Z,IMHEX
CALL TSTNUM
JR C,IMRSV
JP IMNUM
;
IMEND: LD M,A
POP BC
POP DE
RET
;
IMPAI: LD M,E4H
CALL IM3R
JR CVIM12
;
IMPRT: LD A,8FH
CALL IM3RS
JR IMRSV6
;
IMREM: LD M,":"
CALL IM3R
LD M,"'"
CALL IM3RH
JP IMDATA
SKP H
;
IMSTR: LD M,A
CALL IM3R
IMSTR2: LD A,(DE)
OR A
RET Z
CP '"'
JR NZ,IMSTR
IM3RS: LD M,A
IM3R: INC DE
IM3RH: INC HL
IM3RC: INC C
RET NZ
JP ER08 ;LINE LENGTH
;
IMVAR: POP BC
LD A,(DE)
CALL TSTVAR
JR C,IM3RS
IMVAR2: CALL IM3RS
LD A,(DE)
CP "$"
JR Z,IM3RS
CALL TSTNUM
RET C
JR IMVAR2
;
IMRSV: PUSH BC
LD BC,CTBL1
CALL IMSER
JR NC,IMRSV4
LD BC,GTABL
CALL IMSER
LD C,FEH
JR NC,IMRSV2
LD BC,CTBL2
CALL IMSER
LD C,FFH
JR C,IMVAR
IMRSV2: LD M,C
INC HL
LD M,A
POP BC
CALL IM3RC
CALL IM3RH
CP B4H ; ERL ******
RET NZ
CALL IMSPACE
CP "="
RET NZ
LD M,F4H ; = ******
CALL IM3R
JR IMLNO
SKP H
;
IMRSV4: POP BC
CALL IM3RH
IMRSV6: CP 97H ; REM
JR Z,IMDATA
CP 94H ; DATA
JR Z,IMDATA
CP C2H ; ELSE
JR Z,IMELSE
CP E2H ; THEN
JR Z,IMLNO
CP E0H
RET NC
PUSH AF
CALL IMSPACE
CP "/"
JR NZ,IMRSV7
LD M,FBH ;/
CALL IM3R
CALL SKPDE
CALL IM3RS
JR IMRSV8
IMRSV7: CP "#"
JR NZ,IMRSV8
CALL IM3RS
CALL SKPDE
CALL TSTNUM
CALL NC,IMNUM
IMRSV8: POP AF
CP 8DH ; FOR
RET NC
;
IMLNO: CALL IMSPACE
CP '"'
JR NZ,IMLNO2
CALL IMSTR
JR IMLNO
IMLNO2: CP 2CH
RET C
CP 2FH
JR C,IMLNO4 ;",-."
CALL TSTNUM
RET C
CALL IMINT
JR IMLNO
IMLNO4: CALL IM3RS
JR IMLNO
;
IMELSE: DEC HL
LD M,":"
INC HL
LD M,A
CALL IM3RH
JR IMLNO
;
IMDATA: LD A,(DE)
CALL ENDCK0
RET Z
CALL IM3RS
CP '"'
CALL Z,IMSTR2
JR IMDATA
;
;
IMSER: PUSH HL ;Search in tabale
PUSH DE
LD HL,BC
LD B,7FH
IMSER2: POP DE
PUSH DE
INC B
LD A,M
CP FFH
JR NZ,IMSER3
POP DE ;Table end
POP HL
SCF
RET
;
IMSER3: CP "."
JR NZ,IMSER4
INC HL ;AND OR XOR NOT
DEC DE
LD A,(DE)
INC DE
CALL TSTVAR
JR NC,IMSER6
IMSER4: LD A,(DE)
CP " "
JR NZ,IMSER5
LD A,M
AND 7FH
SUB "A"
CP 26
JR C,IMSER6
CALL SKPDI
IMSER5: LD C,M
INC HL
INC DE
CP "."
JR Z,IMSER8
SUB C
JR Z,IMSER4
CP 80H
JR Z,IMSER9
IMSER6: DEC HL ;Not match
BIT 7,M
INC HL
JR Z,-3
JR IMSER2
IMSER8: LD A,B
CP E8H ;operator
JR NC,IMSER6
CCF
IMSER9: POP HL ;Found
POP HL
LD M,B
LD A,B
RET
;
IMSPACE:LD A,(DE)
CP " "
RET NZ
LD M,A
CALL IM3R
JR IMSPACE
SKP H
;
IMNUM: EX AF,AF'
PUSH DE
CALL SKPDI
POP DE
CALL TSTNUM ;check if one-digit
JR NC,IMFLT
CP "."
JR Z,IMFLT
CP "E"
JR Z,IMFLT
EX AF,AF'
SUB "0"-1
JP IMFLT ;ok, JP IM3RS
;
IMFLT: PUSH BC
LD M,15H
INC HL
PUSH HL
CALL CVFLAS
POP HL
LD BC,5
ADD HL,BC
LD A,6
JR BCKSPS
;
IMINT: PUSH BC
CALL CVBCAS
LD M,0BH
INC HL
JR PPOLNO
;
IMHEX: LD M,A
INC DE
LD A,(DE)
SVC .CKHEX
RST 3
DEFB .CKHEX
ENDM
JP C,IM3RH
PUSH BC
LD M,11H
INC HL
PUSH HL
EX DE,HL
SVC .DEHEX
RST 3
DEFB .DEHEX
ENDM
LD BC,DE
EX DE,HL
POP HL
PPOLNO: LD A,3
LD M,C
INC HL
LD M,B
INC HL
BCKSPS: POP BC
ADD A,C
JP C,ER08 ;LINE LENGTH
LD C,A
BCKSKP: DEC DE
LD A,(DE)
CP " "
JR Z,-4
INC DE
RET
SKP H
;
CVTXIM: ENT
PUSH HL
PUSH DE
PUSH BC
EXX
LD B,0
EXX
LD C,0
CVTX10: LD A,M
OR A
JR Z,TXEND
LD BC,CVTX10
PUSH BC
CP "'"
JR Z,TXDAT2
INC HL
LD BC,CTBL1
CP 20H
JR C,TXNUM
CP '"'
JR Z,TXSTR
CP ":"
JR Z,TX3AH
CP 97H ;REM
JR Z,TXDATA
CP 94H ;DATA
JR Z,TXDATA
CP E4H ;PI
JR Z,TXPAI
CP FEH
JR NC,TXRSV0
CP 80H
JP NC,TXRSV
JP STRDE
;
TXEND: LD (DE),A
POP BC
POP DE
POP HL
RET
;
TXPAI: LD A,FFH
JP STRDE
;
TXRSV0: LD BC,CTBL2
JR NZ,+5
LD BC,GTABL
LD A,M
INC HL
JR TXRSV
;
TXDATA: CALL TXRSV
RET Z
TXDAT2: LD A,M
CALL ENDCK0
RET Z
CALL STRDE
LD A,M
INC HL
CP '"'
CALL Z,TXSTR2
JR TXDAT2
;
TXSTR: CALL STRDE
TXSTR2: LD A,M
OR A
RET Z
INC HL
CP '"'
JR NZ,TXSTR
JR STRDE
;
TX3AH: LD (DE),A
LD A,M
CP C2H ; ELSE
RET Z
CP "'"
RET Z
JR STRDE'
;
TXNUM: CP 15H
JR Z,TXFLT
CP 0BH
JR NC,TXINT
DEC A
OR 30H
JR STRDE
;
TXINT: PUSH DE
LD E,M
INC HL
LD D,M
INC HL
PUSH HL
CP 12H
JR Z,TXINT2
CP 0CH
JR C,TXINT2
JR NZ,TXHEX
EX DE,HL
INC HL
INC HL
LD E,M
INC HL
LD D,M
TXINT2: EX DE,HL
CALL ASCFIV
LD BC,DE
POP HL
POP DE
TXINT4: LD A,(BC)
OR A
RET Z
CALL STRDE
INC BC
JR TXINT4
;
TXFLT: PUSH HL
PUSH DE
CALL CVASFL
LD BC,DE
POP DE
POP HL
REP5 INC,HL
INC HL
INC HL
INC HL
INC HL
INC HL
ENDM
JR TXINT4
;
TXRSV: CP 80H
JR Z,TXRSV4
EX AF,AF'
TXRSV2: LD A,(BC)
RLCA
INC BC
JR NC,TXRSV2
EX AF,AF'
DEC A
JR TXRSV
TXRSV4: LD A,(BC)
BIT 7,A
JR NZ,STRDES
CP "."
CALL NZ,STRDE
INC BC
JR TXRSV4
;
STRDES: AND 7FH
STRDE: LD (DE),A
OR A
RET Z
STRDE': INC DE
EXX
INC B
EXX
RET NZ
XOR A
LD (DE),A
DEC DE
EXX
DEC B
EXX
RET
;
TXHEX: LD A,"$"
EX AF,AF'
EX DE,HL
CALL HEXHL
LD BC,DE
POP HL
POP DE
EX AF,AF'
CALL STRDE
JR TXINT4
;
HEXHL: ENT
LD DE,DGBF12
PUSH DE
LD A,H
CALL HEXACC
LD A,L
CALL HEXACC
XOR A
LD (DE),A
POP DE
LD B,3
;
ZRSUP: LD A,(DE)
CP "0"
RET NZ
INC DE
DJNZ ZRSUP
RET
;
HEXACC: ENT
PUSH AF
RRCA
RRCA
RRCA
RRCA
AND 0FH
CALL HEXAC2
POP AF
AND 0FH
HEXAC2: ADD A,30H
CP 3AH
JR C,+4
ADD A,7
LD (DE),A
INC DE
RET
;
CVBCAS: ENT
PUSH HL
EX DE,HL
SVC .DEASC
RST 3
DEFB .DEASC
ENDM
LD BC,DE
EX DE,HL
POP HL
JP BCKSKP
;
END

2038
asm/mz-xz009/EXPR.ASM Normal file

File diff suppressed because it is too large Load Diff

1945
asm/mz-xz009/FLOAT.ASM Normal file

File diff suppressed because it is too large Load Diff

716
asm/mz-xz009/GRPH.ASM Normal file
View File

@@ -0,0 +1,716 @@
; -----------------------------
; MZ-800 BASIC Graphic command
; FI:GRPH ver 1.0B 9.21.84
; Programed by T.Miho
; -----------------------------
;
INCLD MACRO
;
BITFU2: DEFB 0 ;Default W0/W1
COL: ENT ;Color code
DEFB 03H
;
;;;;;;;;;;;;;;;
;
; SET/RESET [c,w]x,y
;
SET: ENT
DEFB F6H
RESET: ENT
XOR A
PUSH AF
CALL COORD0
SVC .POSSV
RST 3
DEFB .POSSV
ENDM
POP AF ;SET/RESET
PUSH HL
EXX
SVC .PSET
RST 3
DEFB .PSET
ENDM
POP HL
RET
;
;;;;;;;;;;;;;;;;;;
;
; LINE/BLINE [c,w] x0,y0,x1,y1,.....
;
LINE: ENT
DEFB F6H
BLINE: ENT
XOR A
LD (LINE4+1),A
CALL COORD0
CALL HCH2CH
LINE2: EXX
PUSH HL ;YS
PUSH DE ;XS
EXX
CALL COORD
POP DE ;XS
EX (SP),HL ;YS,Text
EXX
LINE4: LD A,0 ;LINE/BLINE
SVC .LINE
RST 3
DEFB .LINE
ENDM
POP HL
TEST1 ","
CALL TEST1
DEFB ","
ENDM
JR Z,LINE2
SVC .POSSV
RST 3
DEFB .POSSV
ENDM
RET
SKP H
;
;;;;;;;;;;;;;;;;;;;;;;;;
;
; PATTERN [C,W] N,X$
;
PATTER: ENT
CALL COLCON
CALL IDEEXP
XOR A
BIT 7,D
JR Z,GRDSP4
PUSH HL
LD H,A
LD L,A
SBC HL,DE
EX DE,HL
POP HL
LD A,1
GRDSP4: EX AF,AF'
LD A,D
OR A
JR NZ,ER03A
LD A,E
PUSH AF
EX AF,AF'
PUSH AF
CALL HCH2CH
CALL STREXP
POP AF
LD C,A
POP AF
PUSH HL
LD H,C
SVC .PATTR
RST 3
DEFB .PATTR
ENDM
POP HL
CALL ENDCHK
JR NZ,PATTER
RET
SKP H
;;;;;;;;;;;;;;;;;;;
;
; POSITION x,y
;
POSITI: ENT
CALL COORD
SVC .POSSV
RST 3
DEFB .POSSV
ENDM
RET
;
; Get X-Y coordinate
;
COORD0: CALL COLCON
COORD: CALL COORD1 ;Get x,y coordinate
PUSH DE
TEST1 ','
CALL TEST1
DEFB ','
ENDM
CALL COORD1
PUSH DE
EXX
POP HL
POP DE
EXX
RET
;
;
COORD1: CALL IDEEXP
LD A,D ;0000 ... 3FFF
ADD A,40H ;C000 ... FFFF
RET P
ER03A: JP ER03
SKP H
;;;;;;;;;;;;;;;;;;;;;;;
;
; color palette
;
PALET: ENT
CALL ENDCHK
JP Z,ER01
CALL PALRD
CALL COLCK2
AND 03H
PUSH AF
LD A,(PALBK)
LD D,E
SRL D
SRL D
CP D
JP NZ,ER22
TESTX ','
CALL TESTX
DEFB ','
ENDM
CALL PALRD
LD B,A
POP AF
SVC .DPLST
RST 3
DEFB .DPLST
ENDM
RET
;
PALRD: CALL IBYTE
CP 16 ;0 .. 15 check
JR NC,ER03A
RET
;
SKP H
;;;;;;;;;;;;;;;;;;;;
;
; BOX [c,w] xs,ys,xe,ye
BOX: ENT
CALL COORD0
EXX
PUSH HL ;YS
PUSH DE ;XS
EXX
CALL HCH2CH
CALL COORD
EXX
PUSH HL ;YE
PUSH DE ;XE
EXX
CALL ENDCHK
JR Z,BOX9
CALL CH2CH
CALL ENDCHK
LD A,(COL)
CALL NZ,COLCHK
SCF
BOX9: EXX
POP DE
POP HL
EXX
POP DE
EX (SP),HL
SVC .BOX
RST 3
DEFB .BOX
ENDM
POP HL
RET
SKP H
;
;;;;;;;;;;;;;;;;;;
;
; COLOR c,w
;
COLOR: ENT
CALL COLSUB
LD A,(COL)
SVC .DCOL
RST 3
DEFB .DCOL
ENDM
LD (SELCOL),A
LD A,(PWMODE)
LD (BITFU2),A
CALL ENDZ
RET
;
;;;;;;;;;;;;;;;;
;
; COLOR CONTROL EXP
;
COLCON: ENT
TEST1 ","
CALL TEST1
DEFB ","
ENDM
TEST1 "["
CALL TEST1
DEFB "["
ENDM
JR NZ,COLCN1
CALL COLSUB
LD A,(COL)
SVC .DGCOL
RST 3
DEFB .DGCOL
ENDM
TESTX "]"
CALL TESTX
DEFB "]"
ENDM
TEST1 ","
CALL TEST1
DEFB ","
ENDM
RET
;
COLCN1: LD A,(SELCOL)
LD (COL),A
SVC .DGCOL
RST 3
DEFB .DGCOL
ENDM
COLCN2: LD A,(BITFU2)
LD (PWMODE),A
RET
;
COLSUB: TEST1 ","
CALL TEST1
DEFB ","
ENDM
JR Z,COLC8
CALL COLCHK
LD (COL),A
TEST1 ','
CALL TEST1
DEFB ','
ENDM
JR NZ,COLCN2
COLC9: CALL IBYTE
CP 2
JR NC,ER03B
LD (PWMODE),A
RET
;
COLC8: LD A,(SELCOL)
LD (COL),A
JR COLC9
;
COLCHK: ENT
PUSH BC
CALL IBYTE
POP BC
COLCK2: LD A,(CRTMD1)
RRA
JR C,CMD1
RRA
JR C,CMD2
RRA
JR C,CMD3
CMD1: LD A,E
CP 4
JR NC,ER03B
RET
CMD2: LD A,E
CP 16
JR NC,ER03B
RET
CMD3: LD A,E
CP 2
RET C
ER03B: JP ER03
;
SKP H
;;;;;;;;;;;;;;;;;;;;
;
;PAINT COMMAND
;
PAINT: ENT
CALL COLCON
CALL POSITI
LD B,0
LD DE,PAINTB
PUSH DE
CALL ENDCHK
JR Z,PAINT3
PAINT1: CALL CH2CH
PUSH DE
CALL COLCHK
POP DE
LD (DE),A
INC DE
INC B
LD A,B
CP 16
JP Z,ER01
CALL ENDCHK
JR NZ,PAINT1
PAINT2: EX (SP),HL ;data adrs
PUSH HL
LD HL,-527
ADD HL,SP
LD (PAIWED),HL
POP HL
SVC .PAINT
RST 3
DEFB .PAINT
ENDM
JP C,ER06
POP HL
RET
;
PAINT3: LD A,(COL)
LD (DE),A
INC B ; data count
JR PAINT2
PAINTB: DEFS 16
SKP H
;;;;;;;;;;;;;;;;;;;;
;
;CIRCLE COMMAND
;
CIRCLE: ENT
PUSH HL
LD HL,0
LD (CW.H+1),HL
LD (CW.XS+1),HL
LD (CW.YS+1),HL
LD (CW.XE+1),HL
LD (CW.YE+1),HL
LD HL,KK
CALL CLRFAC
LD HL,FLT2PI
LD DE,SK ;\<5C>mßám\l=2PAI
CALL LDIR5
POP HL
;\s\ºl yÝ-Ä
CALL COORD0
SVC .POSSV
RST 3
DEFB .POSSV
ENDM
CALL HCH2CH
CALL IDEEXP
PUSH HL
LD A,D
AND C0H
JP NZ,ER03
EX DE,HL
LD (CW.R+2),HL ;ÞÙZs
LD (CW.XS+1),HL
LD (CW.XE+1),HL
LD HL,(INTFAC)
LD DE,CIR.R
CALL LDIR5
POP HL
CALL ENDCHK
JP Z,CW
CALL CH2CH
TEST1 ','
CALL TEST1
DEFB ','
ENDM
JR Z,CIRCL2
CALL HIRIT
CALL ENDCHK
JP Z,CW
CALL CH2CH
CIRCL2: TEST1 ','
CALL TEST1
DEFB ','
ENDM
JR Z,CIRCL8
LD IX,CW.XS+1
LD IY,KK
CALL STX
CALL ENDCHK
JP Z,CW
CALL CH2CH
CIRCL8: TEST1 ','
CALL TEST1
DEFB ','
ENDM
JR Z,CIRCL4
LD IX,CW.XE+1
LD IY,SK
CALL STX
CALL ENDCHK
JP Z,CW
CALL CH2CH
CIRCL4: TESTX 'O'
CALL TESTX
DEFB 'O'
ENDM
SCF
JR +3
CW: XOR A
PUSH HL
PUSH AF
LD HL,KK
LD DE,SK
CALL SUB
CALL LDIR5
LD A,(KK)
OR A
LD B,0
JR Z,CW2 ;KK=SK
LD HL,KK+1
RES 7,M
DEC HL ;HL:= ABS(KK-SK)
LD DE,FLTPAI
CALL CMP
LD B,1
JR C,CW2 ; ABS() < PI
LD DE,FLT2PI
CALL CMP
LD B,2
JR C,CW2 ; PI <= ABS() < 2*PI
LD B,3 ;2*PI <= ABS()
CW2: LD A,(SK+1)
AND 80H
OR B
LD B,A
POP AF ;CF='O'
LD A,B
EXX
CW.XS: LD DE,0 ;Start X
CW.YS: LD HL,0 ;Start Y
CW.H: LD BC,0 ;HIRITU
EXX
CW.XE: LD DE,0 ;End X
CW.YE: LD HL,0 ;End Y
CW.R: LD IX,0 ;R
SVC .CIRCL
RST 3
DEFB .CIRCL
ENDM
POP HL
OR A
RET
;
HIRIT: CALL IDEEXP
CALL PUSHR
LD HL,(INTFAC)
INC HL
BIT 7,M
JP NZ,ER03
DEC HL
LD DE,FLONE
CALL CMP
RET Z
LD A,1
JR C,HI
LD HL,FLONE
LD DE,CIRW3
PUSH DE
CALL LDIR5
POP HL
LD DE,(INTFAC)
CALL DIV
LD A,2
HI: LD (CW.H+1),A
LD DE,256DT
CALL MUL
LD DE,0.5DT
CALL ADD
CALL HLFLT
LD A,L
LD (CW.H+2),A
BIT 0,H
RET Z
XOR A
LD (CW.H+1),A
RET
;
STX: PUSH IX
PUSH IY
CALL IDEEXP
POP DE ;KK/SK
POP IX
PUSH HL
PUSH IX
LD HL,(INTFAC)
CALL LDIR5
LD HL,(INTFAC)
LD DE,HL
REP5 INC,DE
INC DE
INC DE
INC DE
INC DE
INC DE
ENDM
CALL LDIR5
CALL COS ;HL=(INTFAC)+5
LD DE,CIR.R
CALL MUL
CALL STXSUB
LD HL,(INTFAC)
CALL SIN
LD DE,CIR.R
CALL MUL
CALL NEG
CALL STXSUB
POP IX
POP HL
RET
;
STXSUB: INC HL
BIT 7,M
PUSH AF
RES 7,M
DEC HL
LD DE,0.5DT
CALL ADD
POP AF
INC HL
JR Z,+4
SET 7,M
DEC HL
CALL HLFLT
EX DE,HL
POP HL ;RET ADRS
EX (SP),HL ;Save coordinate
LD M,E
INC HL
LD M,D
INC HL
INC HL
EX (SP),HL
JP (HL)
;
;
;CIRCLE WORK AREA PART-2
;
CIR.R: DEFS 5
;
CIRW3: DEFS 5
;
256DT: DEF5 89,00,00,00,00
DEFW 0089H
DEFW 0000H
DEFB 00H
ENDM
0.5DT: DEF5 80,00,00,A7,C6
DEFW 0080H
DEFW A700H
DEFB C6H
ENDM
;
KK: DEFS 5
SK: DEFS 5
;
; SYMBOL command
;
DIRARE: EQU 27D0H
;
SMBOL: ENT
CALL COORD0 ;position load
SVC .POSSV ;position input
RST 3
DEFB .POSSV
ENDM
CALL HCH2CH
;string pointer load
CALL STREXP
;string zero check
LD A,B
OR A
PUSH BC
PUSH HL
LD C,B
LD B,0
LD HL,DIRARE
EX DE,HL
JR Z,SMBL2
LDIR ;string data xfer
SMBL2: POP HL
CALL HCH2CH
CALL IBYTE ;yoko bairitsu
LD A,D
OR E
JR Z,ERJP3 ;zero error
PUSH DE
CALL HCH2CH
CALL IBYTE ;tate bairitsu
LD A,D
OR E
ERJP3: JP Z,ER03 ;zero error
LD A,E
POP DE
LD D,A
CALL ENDCHK ;end check
PUSH DE
JR Z,SMBL1
CALL HCH2CH
CALL IBYTE ;angle load
LD A,3
CP E
JP C,ER03
LD A,E
DEFB 06H
SMBL1: XOR A
POP DE
POP BC
LD C,A ;angle push
LD A,B ;string length
OR A
RET Z ;zero return
LD A,C ;angle pop
PUSH HL
EX DE,HL
LD DE,DIRARE
SVC .SYMBL
RST 3
DEFB .SYMBL
ENDM
POP HL
RET
;
SKP H
;
;;;;;;;;;;;;;;
;
; HCOPY 1/2/3
; CLS 1/2/3
;
HCOPY: ENT
CALL ENDZ
PUSH HL
LD A,00H ;ASAHI modify
SVC .HCPY
RST 3
DEFB .HCPY
ENDM
POP HL
RET
;
CLS: ENT
CALL ENDZ
PUSH HL
SVC .CLS
RST 3
DEFB .CLS
ENDM
POP HL
RET
;
END

910
asm/mz-xz009/H-CMT.ASM Normal file
View File

@@ -0,0 +1,910 @@
; -----------------------------
; PLE-monitor CMT-driver
; FI:M-CMT ver 0.1 6.05.84
; -----------------------------
;
INCLD MACRO
;
$CMT: ENT
DEFW $RS ;###diff Lx
DEFM "CMT"
DEFB 0
DEFB 5FH ;Seq, W, R
$CMTF2: DEFB C0H ;CMT, 1OPN
DEFB 0
DEFW CTINI ;INIT
DEFW CTRINF ;RO
DEFW CTWINF ;WO
DEFW .RET ;START
DEFW 256 ;Block/byte
DEFW CTRDAT ;INP
DEFW CTWDAT ;OUT
DEFW 0 ;DELETE
DEFW 0 ;WDIR
DEFW ER59 ;FREE
;
CTINI: TEST1 "T" ; Change EOF process
CALL TEST1
DEFB "T"
ENDM
LD HL,$CMTF2
SET ##EOFE,M ; Tape BASIC mode
RET Z
RES ##EOFE,M ; Disk BASIC mode
OR A
RET
;
CTWINF: CALL PUSHR
LD DE,IBUFE
LD A,M
LD C,5
CP 2 ; BTX 2 ==> 5
JR Z,CTWF2
LD C,4
CP 3 ; BSD 3 ==> 4
JR Z,CTWF2
LD C,A
;
CTWF2: LD A,C
LD (DE),A
INC HL
INC DE
LD BC,17
LDIR
INC HL
INC HL
LD BC,6
LDIR
LD B,128-24
CALL ?CLRDE
LD HL,IBUFE
LD BC,128
CALL SAVE1
JR CTWD9
;
CTWDAT: CALL SAVE2
;
CTWD9: JP C,BREAKX ; break!
RET ; ok!
;-------------------------------
;
; read inf
; ent HL:adrs
;-------------------------------
CTRINF: LD A,37H ; SCF
LD (CTRDAT),A
PUSH HL
LD HL,IBUFE
LD BC,128
CALL LOAD1
JR C,CTERR ; error or break
LD DE,FINMES ; "Found"
CALL FNMPRT ; ? file name
POP DE
LD A,(ZLOG)
OR A ; ROPEN or LOAD?
LD A,M
JP NZ,CTRI1 ; R
LD C,2 ; L BTX 5 ==> 2
CP 5
JR Z,CTRI2
CTRI1: LD C,3 ; BSD 4 ==> 3
CP 4
JR Z,CTRI2
LD C,A
SUB 2
CP 2
JP C,ER61 ; file mode error!
;
CTRI2: LD A,C
LD (DE),A
INC HL
INC DE
LD BC,17
LDIR
XOR A
LD B,2
CALL ?CLRDE
LD BC,6
LDIR
LD B,32-18-2-6
JP ?CLRDE
;----------------------------------
;
; read data
; ent HL:adrs
; BC:byte size
;----------------------------------
CTRDAT: XOR A ; XOR A / SCF
JR NC,CTRD2
LD A,AFH ;XOR A
LD (CTRDAT),A
PUSH HL ; first time only
LD HL,ELMD
LD DE,LDNGMS ; "Loading"
CALL FNMPRT ; ? file name
POP HL
;
CTRD2: CALL LOAD2
RET NC ; ok!
;
CTERR: CP 2
JP NZ,BREAKX ; break!
LD A,70+80H
JP ERRORJ ; error!
;-----------------------------------
;
; CMT SAVE
;
;-----------------------------------
SAVE1: ENT ; Inf.
LD A,CCH
JR SAVE3
;
SAVE2: ENT ; Data
LD A,53H
;
SAVE3: LD (SPSV+1),SP ;;;
LD SP,IBUFE ;;;
PUSH DE
LD E,A
LD D,D7H ; 'W'=Dreg.
LD A,B
OR C
JR Z,RET1
CALL CKSUM ; check sum set
CALL MOTOR ; motor on
JR C,WRI3 ; break!
LD A,E
CP CCH
JR NZ,WRI2 ; write Data
PUSH DE
LD DE,WRTMES ; "Writing"
CALL FNMPRT ; ? file name
POP DE
;
WRI2: DI
CALL GAP ; write gap
CALL NC,WTAPE ; write Inf. or Data
;
WRI3: DI
CALL MSTOP ; motor off
;
RET1: POP DE
;
SPSV: LD SP,0 ;xxx
PUSH AF
SVC .EI
RST 3
DEFB .EI
ENDM
POP AF
RET
;--------------------------------
;
; CMT LOAD
;
;--------------------------------
LOAD1: ENT ; Inf.
LD A,CCH
JR LOAD3
;
LOAD2: ENT ; Data
LD A,53H
LOAD3: LD (SPSV+1),SP ;;;
LD SP,IBUFE ;;;
PUSH DE
LD D,D2H ; 'L'->Dreg
LD E,A
LD A,B
OR C
JR Z,RET1
CALL MOTOR ; motor on
DI
CALL NC,TMARK ; read gap & tape mark
CALL NC,RTAPE ; read Inf. or Data
JR WRI3
;-------------------------------------
;
; CMT VERIFY
;
;-------------------------------------
CMTVRF: ENT ; Data
PUSH HL
LD DE,VFNGMS ; "Verifying"
LD HL,ELMD
CALL FNMPRT ; ? file name
POP HL
CALL LOAD?2
RET NC ; ok!
CP 2
JP NZ,BREAKX ; break!
LD A,3+80H
JP ERRORJ ; error!
;
LOAD?2: ENT
LD (SPSV+1),SP ;;;
LD SP,IBUFE ;;;
PUSH DE
LD D,D2H
LD E,53H
LD A,B
OR C
JR Z,RET1
CALL CKSUM ; check sum set
CALL MOTOR ; motor on
DI
;
CALL NC,TMARK ; read gap & tape mark
CALL NC,TVRFY ; verify
JR WRI3
;----------------------------------------
; motor on
; exit CF=0:ok
; CF=1:break
;----------------------------------------
MOTOR: CALL PUSHR
SVC .DI
RST 3
DEFB .DI
ENDM
LD A,F8H
OUT (LSD0),A ; break set
LD B,10
;
MOT1: IN A,(LSD2)
AND 10H
JR Z,MOT4
;
MOT2: LD B,FFH ; 2sec delay
;
MOT3: CALL DLY7 ; 7ms delay
DJNZ MOT3 ; motor entry adjust
XOR A ; CF=0
RET
;
MOT4: LD A,6
OUT (LSD3),A
INC A
OUT (LSD3),A
DJNZ MOT1
LD A,(CMTMSG)
OR A
JR NZ,MOT6
SVC .CR2
RST 3
DEFB .CR2
ENDM
LD A,7FH ; Play mark
SVC .CRT1X
RST 3
DEFB .CRT1X
ENDM
LD A," "
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
LD A,D
CP D7H ; 'W'
LD DE,RECMES ; "RECORD."
JR Z,MOT5 ; write
LD DE,PLYMES ; "PLAY"
;
MOT5: SVC .CRTMS
RST 3
DEFB .CRTMS
ENDM
SVC .CR2
RST 3
DEFB .CR2
ENDM
;
MOT6: IN A,(LSD2)
AND 10H
JR NZ,MOT2
IN A,(LSD1)
AND 80H
JR NZ,MOT6
SCF ; CF=1,break!
RET
;-----------------------------------
;
; write tape
;
; in BC=byte size
; HL=adr.
;
; exit CF=0:ok.
; CF=1:break
;-----------------------------------
WTAPE: PUSH DE
PUSH BC
PUSH HL
LD D,2 ; repeat set
LD A,F8H
OUT (LSD0),A ; break set
;
WTAP1: LD A,M
CALL WBYTE ; 1 byte write
IN A,(LSD1)
AND 80H ; break check
SCF
JR Z,RTP5 ; break!
INC HL
DEC BC
LD A,B
OR C
JR NZ,WTAP1
LD HL,(SUMDT) ; check sum write
LD A,H
CALL WBYTE ; high
LD A,L
CALL WBYTE ; low
CALL LONG
XOR A
DEC D
JR Z,RTP5 ; ok!
LD B,A ; Breg=256
;
WTAP2: CALL SHORT ; write short 256
DJNZ WTAP2
POP HL
POP BC
PUSH BC
PUSH HL
JR WTAP1 ; repeat
;-------------------------------------
;
; read tape
;
; in BC=byte size
; HL=load adr.
;
; exit CF=0:ok
; CF=1,Acc=2:error
; else:break
;-------------------------------------
RTAPE: PUSH DE
PUSH BC
PUSH HL
LD D,2 ; repeat set
;
RTP1: CALL EDGE ; edge search:(49c)
JR C,RTP5 ; break!:7c
; reading point search
CALL DLY3 ; 17c (1232c)
IN A,(LSD2)
AND 20H
JR Z,RTP1 ; again
LD HL,0
LD (SUMDT),HL
POP HL
POP BC
PUSH BC
PUSH HL
;
RTP3: CALL RBYTE ; 1 byte read
JR C,RTP5 ; error!
LD M,A ; data->(mem.)
INC HL
DEC BC
LD A,B
OR C
JR NZ,RTP3
LD HL,(SUMDT) ; check sum
CALL RBYTE ; high
JR C,RTP5 ; error!
CP H
JR NZ,RTP6 ; error!
CALL RBYTE ; low
JR C,RTP5 ; error!
CP L
JR NZ,RTP6 ; error!
;
RTP4: XOR A
;
RTP5: POP HL
POP BC
POP DE
RET
;
RTP6: DEC D
JR NZ,RTP1 ; repeat
;
VFERR: LD A,2 ; error
SCF
JR RTP5
;-------------------------------------
;
; verify tape
;
; in BC=byte size
; HL=adr.
;
; exit CF=0:ok
; CF=1,Acc=2:error
; else:break
;-------------------------------------
TVRFY: PUSH DE
PUSH BC
PUSH HL
LD D,2 ; repeat set
;
TVF1: CALL EDGE ; edge search:(49c)
JR C,RTP5 ; break!:7c
; reading point search
CALL DLY3 ; 17c (1232c)
IN A,(LSD2)
AND 20H
JR Z,TVF1 ; again
POP HL
POP BC
PUSH BC
PUSH HL
;
TVF2: CALL RBYTE ; 1 byte read
JR C,RTP5 ; error!
CP M ; CP A.(mem.)
JR NZ,VFERR ; verify error!
INC HL
DEC BC
LD A,B
OR C
JR NZ,TVF2
LD HL,(CSMDT) ; Check sum.
CALL RBYTE ; high
JR C,RTP5 ; error!
CP H
JR NZ,VFERR ; error!
CALL RBYTE ; low
JR C,RTP5 ; error!
CP L
JR NZ,VFERR ; error!
DEC D
JR NZ,TVF1 ; repeat
JR RTP4 ; ok!
;
RECMES: DEFM 'RECORD.'
PLYMES: DEFM 'PLAY'
DEFB 0
;--------------------------------------
;
; file name print
;--------------------------------------
FNMPRT: LD A,(CMTMSG)
OR A
RET NZ
SVC .CR2
RST 3
DEFB .CR2
ENDM
SVC .CRTMS
RST 3
DEFB .CRTMS
ENDM
PUSH HL
INC HL
LD A,'"'
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
LD D,16
;
FNMLP: LD A,M
CP 0DH
JR Z,FNMLE
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
INC HL
DEC D
JR NZ,FNMLP
;
FNMLE: LD A,'"'
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
SVC .CR2
RST 3
DEFB .CR2
ENDM
POP HL
RET
;
WRTMES: DEFM 'WRITING '
DEFB 0
FINMES: DEFM 'FOUND '
DEFB 0
LDNGMS: DEFM 'LOADING '
DEFB 0
VFNGMS: DEFM 'VERIFYING '
DEFB 0
;
;
;-----------------------------------------
;
; tape format
;
; <LONG> <SHORT>
; <460us><496us><240us> <264us>
; b b b b b b
; gxxxxxx° gxx° gxx° g
; xxxxxt b hxxxxxxt hxxt hxxt
; b b b b
; b b b b
; / / / / / /
; ! ! Read point! ! Read point
; ! 368us ! 368us
; Read edge Read edge
;
;-----------------------------------------
;
; Information format : Data format
; :
; * gap : * gap
; short 10 sec : short 5 sec
; (22000) : (11000)
; * tape mark : * tape mark
; long 40 : long 20
; short 40 : short 20
; * long 1 : * long 1
; * Information : * Data
; block : block
; (128 bytes) : (???? bytes)
; * check sum : * check sum
; (2 bytes) : (2 bytes)
; * long 1 : * long 1
; * short 256 : * short 256
; * Information : * Data
; block : block
; (128 bytes) : (???? bytes)
; * check sum : * check sum
; (2 bytes) : (2 bytes)
; * long 1 : * long 1
;
;-----------------------------------------
;
;
; EDGE (tape data edge search)
; (85c+111c)/4= 49 clock
;
; exit CF=0:ok
; CF=1:break
;
EDGE: LD A,F8H
OUT (LSD0),A ; break set
NOP
;
EDG1: IN A,(LSD1)
AND 81H ; shift & break
JR NZ,EDG2
SCF
RET
;
EDG2: IN A,(LSD2) ; 11c
AND 20H ; 7c
JR NZ,EDG1 ; CSTR D5=0: 7c/12c
;
EDG3: IN A,(LSD1) ; 11c
AND 81H ; 7c
JR NZ,EDG4 ; 7c/12c
SCF
RET
;
EDG4: IN A,(LSD2) ; 7c
AND 20H ; 7c
JR Z,EDG3 ; CSTR D5=1: 7c/12c
RET ; 10c
;--------------------------------------
;
; 1 byte read
;
; exit SUMDT=Store
; CF=1:break
; CF=0:data=Acc
;--------------------------------------
RBYTE: PUSH DE
PUSH BC
PUSH HL
LD HL,0800H ; 8 repeat set
;
RBY1: CALL EDGE ; edge search:(49c)
JP C,TM4 ; break!:7c
; reading point search:17c(1232c)
CALL DLY3 ; 17c (1232c)
IN A,(LSD2) ; data read
AND 20H ; CF=0
JP Z,RBY2 ; again
PUSH HL
LD HL,(SUMDT) ; check sum set
INC HL
LD (SUMDT),HL
POP HL
SCF ; CF=1
;
RBY2: LD A,L
RLA ; rotate left
LD L,A
DEC H
JP NZ,RBY1 ; repeat
CALL EDGE
LD A,L
JR TM4 ; ok!
;-------------------------------------
;
; 1 byte write
; in Acc=data
;-------------------------------------
WBYTE: PUSH BC
LD B,8 ; 8 repeat set
CALL LONG ; write long
;
WBY1: RLCA ; rotate left
CALL C,LONG ; 'H' long
CALL NC,SHORT ; 'L' short
DEC B
JP NZ,WBY1 ; repeat
POP BC
RET
;-------------------------------------
;
; tape mark read
;
; in E=CCH:Inf. long40,short40
; else:Data long20,short20
;
; exit CF=0:ok
; CF=1:break
;
;-------------------------------------
TMARK: CALL GAPCK
;
PUSH DE
PUSH BC
PUSH HL
LD HL,2828H ; H=40,L=40
LD A,E
CP CCH ;'L'
JR Z,TM0
LD HL,1414H ; H=20,L=20
;
TM0: LD (TMCNT),HL
;
TM1: LD HL,(TMCNT)
;
TM2: CALL EDGE ; edge search:(49c)
JR C,TM4 ; break!:7c
; reading point search:17c(1232c)
CALL DLY3 ; 17c (1232c)
IN A,(LSD2)
AND 20H
JR Z,TM1 ; again
DEC H
JR NZ,TM2
;
TM3: CALL EDGE ; edge search:(49c)
JR C,TM4 ; break!:7c
; reading point search:17c(1232c)
CALL DLY3 ; 17c (1232c)
IN A,(LSD2)
AND 20H
JR NZ,TM1 ; again
DEC L
JR NZ,TM3
CALL EDGE
;
TM4: POP HL
;
TM5: POP BC
POP DE
RET
;------------------------------------
;
; check sum set
;
; in BC=byte size
; HL=adr.
;
; exit SUMDT=store
; CSMDT=store
;------------------------------------
CKSUM: PUSH DE
PUSH BC
PUSH HL
LD DE,0
;
CKS1: LD A,B
OR C
JR NZ,CKS2
EX DE,HL
LD (SUMDT),HL
LD (CSMDT),HL
JR TM4 ; ret
;
CKS2: LD A,(HL)
PUSH BC
LD B,8 ; 8 bits
;
CKS3: RLCA ; rotate left
JR NC,CKS4
INC DE
;
CKS4: DJNZ CKS3
POP BC
INC HL
DEC BC
JR CKS1
;--------------------------------------
;
; gap + tape mark
;
; in E=CCH:short gap (10 sec)
; else:short GAP ( 5 sec)
;--------------------------------------
GAP: PUSH DE
PUSH BC
LD A,E
LD BC,55F0H ; Inf. 22000(10 sec)
LD DE,2828H ; short40,long40
CP CCH ;'L'
JP Z,GAP1
LD BC,2AF8H ; Data 11000( 5 sec)
LD DE,1414H ;short20,long20
;
GAP1: CALL SHORT ; write short
DEC BC
LD A,B
OR C
JR NZ,GAP1
;
GAP2: CALL LONG ; write long
DEC D
JR NZ,GAP2
;
GAP3: CALL SHORT ; write short
DEC E
JR NZ,GAP3
CALL LONG
JR TM5
;-----------------------------------------
;
; GAP check
; (long100 search)
;-----------------------------------------
GAPCK: PUSH DE
PUSH BC
PUSH HL
;
GAPCK1: LD H,100 ; 100 repeat set
;
GAPCK2: CALL EDGE ; edge search:(49c)
JR C,TM4 ; error!:7c
CALL DLY3 ; reading point search:17c(1232c)
IN A,(LSD2)
AND 20H
JR NZ,GAPCK1 ; again
DEC H
JR NZ,GAPCK2
JR TM4
;----------------------------------------
;
; SHORT AND LONG PULSE FOR 1 BIT WRITE
;----------------------------------------
SHORT: PUSH AF ; 11c
LD A,03H ; 7c
OUT (LSD3),A ; 11c
CALL DLY1 ; 17c (408c)
CALL DLY1 ; 17c (408c)
LD A,02H ; 7c
OUT (LSD3),A ; 11c
CALL DLY1 ; 17c (408c)
CALL DLY1 ; 17c (408c)
POP AF ; 10c
RET ; 10c
;
;
LONG: PUSH AF ; 11c
LD A,03H ; 7c
OUT (LSD3),A ; 11c
CALL DLY4 ; 17c (1704c)
LD A,02H ; 7c
OUT (LSD3),A ; 11c
CALL DLY4 ; 17c (1704c)
POP AF ; 10c
RET ; 10c
;----------------------------------------
;
; MOTOR STOP
;----------------------------------------
MSTOP: PUSH AF
PUSH BC
PUSH DE
LD B,10
;
MST1: IN A,(LSD2) ; motor check
AND 10H
JR Z,MST3 ; ok
LD A,06H ; motor off
OUT (LSD3),A
INC A
OUT (LSD3),A
DJNZ MST1
;
MST3: POP DE
POP BC
POP AF
RET
;-------------------------------------------
;
; 7.046 ms delay ... 24989c
;-------------------------------------------
DLY7: ENT
PUSH BC ; 11c
LD B,20 ; 7c
;
DLY.7: CALL DLY3 ; 17*19+17 (23332c)
CALL DLY0 ; 17*19+17 ( 226c)
DJNZ DLY.7 ; 13*19+8
POP BC ; 10c
RET ; 10c
;-------------------------------------------
;
; 14 clock delay
;-------------------------------------------
DLY0: NOP ; 4c
RET ; 10c
;-------------------------------------------
;
; 347.4 us delay ... 1232c
;-------------------------------------------
DLY3: NOP ; 4c
LD A,76 ; 7c
;
DLYA: DEC A ; 4*XX+4
JR NZ,DLYA ; 12*XX+7
RET ; 10c
;-----------------------------------
;
; Delay for short.
; 115.0 us delay ... 408c
;-----------------------------------
DLY1: ENT
LD A,24 ; 7c
JR DLYA ; 12c
;-----------------------------------
;
; Delay for long.
; 480.4 us delay ... 1704c
;-----------------------------------
DLY4: ENT
LD A,105 ; 7c
JR DLYA ; 12c
;
END

74
asm/mz-xz009/H-FD.ASM Normal file
View File

@@ -0,0 +1,74 @@
; ----------------------------
; PL-monitor FD dummy
; FI:DMY-FD ver 003 3.28.84
; ----------------------------
;
INCLD MACRO
;
;
$FD: ENT
DEFW $QD
DEFB 0
;
CLX: ENT ;dummy routines
DUST: ENT
FLOFF: ENT
FREEX: ENT
INREC: ENT
INX1B: ENT
LD.DIR: ENT
LDX: ENT
LOPX: ENT
OPX: ENT
PRREC: ENT
PRX1B: ENT
RECST: ENT
SVX: ENT
OR A
RET
;
FLOCK: ENT
FSWAP: ENT
JP ER59
SKP H
;
; SVC .DELET
;
FDELET: ENT
CALL PUSHR
LD HL,(ZDELT) ;SEQ
LD A,L
OR H
JR Z,FREN2
PUSH HL
SVC .LOPEN
RST 3
DEFB .LOPEN
ENDM
LD A,2
LD (ZRWX),A
CALL ?OPEND
JR FREN4
;
; SVC .RENAM
;
FRENAM: ENT
CALL PUSHR
LD HL,(ZWDIR)
LD A,L
OR H
FREN2: JP Z,ER59
PUSH HL
SVC .LOPEN
RST 3
DEFB .LOPEN
ENDM
LD HL,ELMD
CALL SETFNAM
LD HL,200H
LD (ZLOG),HL
CALL SERFLW ;check already exist
FREN4: POP IX
JP IOCALL
END

1410
asm/mz-xz009/H-QD.ASM Normal file

File diff suppressed because it is too large Load Diff

39
asm/mz-xz009/HLA Normal file
View File

@@ -0,0 +1,39 @@
# This viminfo file was generated by Vim 8.0.
# You may edit it if you are careful!
# Viminfo version
|1,4
# Value of 'encoding' when this file was written
*encoding=utf-8
# hlsearch on (H) or off (h):
~h
# Command Line History (newest to oldest):
:q
|2,0,1616620341,,"q"
# Search String History (newest to oldest):
# Expression History (newest to oldest):
# Input Line History (newest to oldest):
# Debug Line History (newest to oldest):
# Registers:
# File marks:
'0 1 0 /srv/dvlp/Projects/dev/github/tranZPUter/software/asm/MZ-XZ009/fgrep
|4,48,1,0,1616620341,"/srv/dvlp/Projects/dev/github/tranZPUter/software/asm/MZ-XZ009/fgrep"
# Jumplist (newest first):
-' 1 0 /srv/dvlp/Projects/dev/github/tranZPUter/software/asm/MZ-XZ009/fgrep
|4,39,1,0,1616620341,"/srv/dvlp/Projects/dev/github/tranZPUter/software/asm/MZ-XZ009/fgrep"
# History of marks within files (newest to oldest):
> /srv/dvlp/Projects/dev/github/tranZPUter/software/asm/MZ-XZ009/fgrep
* 1616620340 0
" 1 0

1643
asm/mz-xz009/IOCS.ASM Normal file

File diff suppressed because it is too large Load Diff

83
asm/mz-xz009/MACRO.ASM Normal file
View File

@@ -0,0 +1,83 @@
; ---------------------------
; MZ-800 Macro define
; FI:MACRO ver 1.0 7.26.84
; ---------------------------
;
;
MACRO SVC
RST 3
DEFB @1
ENDM
;
MACRO IOCALL
LD IX,(@1)
CALL IOCALL
ENDM
;
MACRO TEST1
CALL TEST1
DEFB @1
ENDM
;
MACRO TESTX
CALL TESTX
DEFB @1
ENDM
;
MACRO DEF8
DEFW @2@1H
DEFW @4@3H
DEFW @6@5H
DEFW @8@7H
ENDM
;
MACRO DEF5
DEFW @2@1H
DEFW @4@3H
DEFB @5H
ENDM
;
MACRO REP5
@1 @2
@1 @2
@1 @2
@1 @2
@1 @2
ENDM
;
MACRO SVCT
@2: EQU @1H
DEFW @3
ENDM
END
MACRO TBL
DEFM "@1"
DEFB "@2"+80H
ENDM
MACRO ENTRY
ER@1: ENT
LD A,@1
DEFB 21H
ENDM
MACRO FKEY
DEFB FNB@1E-FNB@1S
FNB@1S: DEFM @2
IFD @3
DEFB @3
ENDIF
FNB@1E: DEFS FNB@1S+15-FNB@1E
ENDM
MACRO ERENT
ER@1: ENT
IFD @2
LD A,@1+80H
ENDIF
IFU @2
LD A,@1
ENDIF
DEFB 21H
ENDM

439
asm/mz-xz009/MON-EMM.ASM Normal file
View File

@@ -0,0 +1,439 @@
; ----------------------------
; Lx-monitor EMM driver
; FI:MON-EMM ver 005 4.27.84
; ----------------------------
;
INCLD MACRO
;
$RAM: ENT
DEFW $FD
DEFM "RAM"
DEFB 0
DEFB 5FH
DEFB 20H ;1WOPN
DEFB 32 ;Max dir
DEFW EMINI ;INIT
DEFW EMRINF
DEFW EMWINF
DEFW EMON
DEFW 1024
DEFW EMRDAT
DEFW EMWDAT
DEFW EMDEL
DEFW EMWDIR
DEFW EMFRKB
;
EMFRKB: CALL EMFRB
LD C,H
LD B,0 ;/256
SRL C ;/512
SRL C ;/1024
OR A
RET
;
EMFRB: PUSH DE
LD HL,0 ;free area(bytes)
CALL EMLD2 ;max
PUSH DE
INC HL
INC HL
CALL EMLD2 ;use
POP HL
SBC HL,DE
JP C,ER41 ;I/O ERR
POP DE
RET
;
;
EMCLR: LD DE,10H
EMSETU: LD HL,2
CALL EMSV2 ;Set used mem
EX DE,HL
LD DE,0
JP EMSV2 ;File end mark
SKP H
;
EMINI: RET C
LD A,(EMFLG)
OR A
JP Z,ER50
CALL OKYN
TEST1 ","
CALL TEST1
DEFB ","
ENDM
PUSH HL
CALL EMCLR
POP HL
TEST1 0
CALL TEST1
DEFB 0
ENDM
RET Z ;INIT "EM:"
SVC .DEASC ;INIT "EM:$hhhh"
RST 3
DEFB .DEASC
ENDM
EMINI2: LD HL,0
DI
LD B,1
LD A,D
AND FCH
CP FCH
LD HL,FFFFH
JR Z,EMINI3 ;if >=FC00 then FFFF
LD B,3
LD A,D
OR A
LD HL,20H
JR NZ,+3 ;if <=00FF then 0020
EMINI3: EX DE,HL
LD A,B
LD (EMFLG),A
LD HL,0
CALL EMSV2 ;Set max mem
CALL PBCCLR
EI
RET
SKP H
;
; EMM power on routine
;
EMMPWR: ENT
LD HL,8
LD B,L
LD C,0
EMPWR2: CALL EMLD1
SUB L
OR C
LD C,A
LD A,L
CALL EMSV1
INC L
DJNZ EMPWR2
LD A,C
OR A
JR NZ,EMPWR4
LD HL,0 ;already initialized
CALL EMLD2
LD A,2
INC D
JR Z,+3
INC A
LD (EMFLG),A
JP PBCCLR
EMPWR4: CALL EMCLR
LD HL,0 ;check EMM installed?
LD A,5AH
CALL EMSV1
CALL EMLD1
SUB 5AH
LD DE,C000H ;Initial set 48KB
JR Z,EMINI2
XOR A
LD (EMFLG),A
RET
SKP H
;
; Dir search start
;
EMON: LD A,(EMFLG)
OR A
JP Z,ER50
LD HL,10H
LD (EMPTR),HL
RET
;
; Read inf
; ent HL:adrs
;
EMRINF: LD BC,HL
LD HL,(EMPTR)
CALL EMLD2
LD A,D
OR E
SCF
RET Z
INC HL
INC HL
PUSH HL
ADD HL,DE
JP C,ER41 ;I/O ERR
LD (EMPTR),HL
POP HL
INC HL
INC HL
INC HL
LD DE,BC
LD BC,32-2
CALL EMLDD
LD BC,32+2
ADD HL,BC
EX DE,HL
LD M,E ;Save data area adrs
INC HL
LD M,D
OR A
RET
;
; Read data
; ent HL:buffer adrs
; BC:byte size
;
EMRDAT: EX DE,HL
LD L,(IY+30)
LD H,(IY+31)
INC HL
INC HL
INC HL
CALL EMLDD
LD (IY+30),L
LD (IY+31),H
OR A
RET
SKP H
;
; Write file
; HL:inf adrs
;
EMWINF: PUSH AF
CALL SERFLW
PUSH HL
LD HL,2
CALL EMLD2
LD (EMWP0),DE
PUSH DE
LD HL,64+7
ADD HL,DE
CALL EMFRE? ;Check file space
POP DE
INC DE
INC DE
POP HL ;inf adrs
LD BC,64
POP AF
CALL EMSVB
LD (EMWP1),DE
RET
SKP H
;
; Write data
; HL:data adrs
; BC:data bytes
; A0:close flag
;
;
EMWDAT: PUSH AF
PUSH HL
PUSH BC
LD HL,(EMWP1)
INC BC
INC BC
INC BC
ADD HL,BC
CALL EMFRE?
POP BC
POP HL
LD DE,(EMWP1)
POP AF
PUSH AF
OR 01H ;data block
CALL EMSVB
LD (EMWP1),DE
POP AF
BIT 2,A ;close ?
RET Z ;no
PUSH DE ;yes
CALL EMSETU
POP HL
LD DE,(EMWP0)
DEC HL
DEC HL
OR A
SBC HL,DE
EX DE,HL
JP EMSV2
;
;
EMFRE?: JR C,ER53A
PUSH HL
LD HL,0
CALL EMLD2
OR A
POP HL
SBC HL,DE
RET C
ER53A: JP ER53 ;No file pace
SKP H
;
; delete file
;
EMDEL: LD HL,(ELMD30)
LD DE,-64-5
ADD HL,DE ;HL:=move destination
CALL EMLD2 ;DE:=delete size - 2
EX DE,HL ;DE:=move destination
ADD HL,DE
INC HL
INC HL ;HL:=move source
PUSH DE
PUSH HL
LD HL,2
CALL EMLD2
EX DE,HL ;HL:=last use
POP DE ;DE:=move source
PUSH DE
OR A
SBC HL,DE
INC HL
INC HL
LD BC,HL ;BC:=move bytes
POP HL ;HL:=move source
POP DE ;DE:=move destination
CALL EMLDIR
DEC DE
DEC DE ;DE:=new last-use
LD HL,2
JP EMSV2
;
; write dir
;
EMWDIR: LD HL,(ELMD30)
LD DE,-64
ADD HL,DE
EX DE,HL
LD HL,ELMD
LD BC,32
JP EMSVD
SKP H
;
EM.P0: EQU EAH
EM.P1: EQU EBH
;
; EMM 1 Byte Write
; ent A: data
; HL:EMM adrs
;
EMSV1: ENT
PUSH BC
LD C,EM.P1
LD B,H
OUT (C),L
OUT (EM.P0),A
POP BC
OR A
RET
;
; EMM 1 Byte Read
; ent HL:EMM adrs
; ext A: dat
;
EMLD1: ENT
PUSH BC
LD C,EM.P1
LD B,H
OUT (C),L
IN A,(EM.P0)
POP BC
OR A
RET
;
; EMM 2 Byte Write
; ent DE:data
; HL:EMM adrs
;
EMSV2: ENT
LD A,E
CALL EMSV1
INC HL
LD A,D
CALL EMSV1
DEC HL
RET
;
; EMM 2 Byte Read
; ent HL:EMM adrs
; DE:data
;
EMLD2: ENT
CALL EMLD1
LD E,A
INC HL
CALL EMLD1
LD D,A
DEC HL
RET
SKP H
;
; EMM write block
; ent HL :data Top
; DE :EMM Adrs
; BC :byte Size
; A :block flag
;
EMSVB: EX DE,HL
CALL EMSV1
INC HL
LD A,C
CALL EMSV1
INC HL
LD A,B
CALL EMSV1
INC HL
EX DE,HL
EMSVD: ENT
EX DE,HL
EMSVE: LD A,(DE)
CALL EMSV1
INC HL
INC DE
DEC BC
LD A,B
OR C
JR NZ,EMSVE
EX DE,HL
RET
;
; EMM BC Byte Read
; ent DE :Store Top
; HL :EMM Adrs
; BC :Byte Size
;
EMLDD: ENT
CALL EMLD1
LD (DE),A
INC HL
INC DE
DEC BC
LD A,B
OR C
RET Z
JR EMLDD
;
; EMM BC Byte LDIR
; ent HL :EMM source top
; DE :EMM destination top
; BC :Byte Size
;
EMLDIR: ENT
CALL EMLD1 ;EMM (HL) Data => Acc
EX DE,HL
CALL EMSV1 ;Acc => (DE) EMM
EX DE,HL
INC HL
INC DE
DEC BC
LD A,B
OR C
RET Z ;End
JR EMLDIR
END

2983
asm/mz-xz009/MON-GRPH.ASM Normal file

File diff suppressed because it is too large Load Diff

1535
asm/mz-xz009/MON-IOCS.ASM Normal file

File diff suppressed because it is too large Load Diff

1067
asm/mz-xz009/MON-PSG.ASM Normal file

File diff suppressed because it is too large Load Diff

469
asm/mz-xz009/MON-RS.ASM Normal file
View File

@@ -0,0 +1,469 @@
; ----------------------------
; MZ-800 RS-232C driver
; FI:MON-RS ver 001 8.02.84
; ----------------------------
;
INCLD MACRO
RSYS: EQU 1 ;0 700,1500
; 1 800
IF RSYS
RMCH: EQU 3
ENDIF
;
IF RSYS-1
RMCH: EQU 1
ENDIF
;
;
$RS: ENT
DEFW $RAM
DEFM "RS"
DEFW 0
DEFB 8FH ;Streem, O1C, I1C, W, R
DEFB RMCH ;ch.
DEFB 0
DEFW RSINI ;INIT
DEFW RSRO ;ROPEN
DEFW RSWO ;WOPEN
DEFW RSCL ;CLOSE
DEFW RSKL ;KILL
DEFW RSINP ;INP1C
DEFW RSOUT ;OUT1C
DEFW .RET ;POS
;
RSINI: RET C
PUSH IY
CALL SETIY
CALL RSINT0
CALL RSPARM
JR RETIY
;
RSINT0: SVC .DEASC
RST 3
DEFB .DEASC
ENDM
LD (IY+#MONIT),E
TEST1 ","
CALL TEST1
DEFB ","
ENDM
JP NZ,ER03
SVC .DEASC
RST 3
DEFB .DEASC
ENDM
LD (IY+#INIT),E
TEST1 0
CALL TEST1
DEFB 0
ENDM
RET Z
TEST1 ","
CALL TEST1
DEFB ","
ENDM
JP NZ,ER03
SVC .DEASC
RST 3
DEFB .DEASC
ENDM
LD (IY+#CRLF),E
RET
SKP H
;
RSRO:
RSWO: PUSH IY
CALL SETIY
LD A,(IY+#STAT)
INC (IY+#STAT)
OR A
CALL Z,RSOPEN
JR RETIY
;
;
RSCL:
RSKL: PUSH IY
CALL SETIY
DEC (IY+#STAT)
LD A,(IY+#STAT)
OR A
CALL Z,RCLOSE
JR RETIY2
;
;
;
RSINP: PUSH IY
CALL SETIY
CALL RSINP0
JP C,IOERR
CP (IY+#CRLF)
JR NZ,+4
LD A,0DH
RETIY2: OR A
RETIY: POP IY
RET
;
RSINP0: BIT 6,(IY+#INIT)
JP Z,GET1C
LD IX,GET1C
LD HL,IY
LD DE,#JISR
ADD HL,DE
JP JISR
;
RSOUT: PUSH IY
CALL SETIY
CP 0DH
JR NZ,+5
LD A,(IY+#CRLF)
CALL RSOUT0
JR RETIY
;
RSOUT0: BIT 6,(IY+#INIT)
JP Z,PUT1C
LD IX,PUT1C
LD HL,IY
LD DE,#JISX
ADD HL,DE
LD DE,(DISPX)
JP JISX
SKP H
;
SETIY: PUSH AF
PUSH DE
LD A,(ZCH)
INC A
LD IY,$A-TBLN
LD DE,TBLN
SETIY2: ADD IY,DE
DEC A
JR NZ,SETIY2
LD C,(IY+0)
POP DE
POP AF
RET
;
;
;*** PORT ADDRESS EQU ***
;
CHADT: EQU B0H
CHACT: EQU B1H
CHBDT: EQU B2H
CHBCT: EQU B3H
;
;
CHCDT: EQU D0H
CHCCT: EQU D1H
CHDDT: EQU D2H
CHDCT: EQU D3H
;
#CRLF: EQU -8
#JISX: EQU -7
#JISR: EQU -5
#MONIT: EQU -3
#INIT: EQU -2
#STAT: EQU -1
SKP H
;
;
DEFS 1 ;CR or LF
DEFS 2 ;for JISX
DEFS 2 ;for JISR
DEFS 1 ;monitor
DEFS 1 ;init code
DEFS 1 ;status
$A: DEFB CHACT ;0
DEFB CHADT ;1
DEFS 1 ;2 Mask Pattern
DEFW 1010H ;3,4
DEFW 4004H ;5,6 WR4
DEFW C003H ;7,8 WR3
DEFW 6005H ;9,10 WR5
DEFB 30H
DEFB 3
;
;
DEFS 8
$B: DEFB CHBCT
DEFB CHBDT
DEFS 1
DEFW 1010H
DEFW 4004H
DEFW C003H
DEFW 6005H
DEFB 30H
DEFB 3
;
;
IF RSYS
DEFS 8
$C: DEFB CHCCT ;0
DEFB CHCDT ;1
DEFS 1 ;2 Mask Pattern
DEFW 1010H ;3,4
DEFW 4004H ;5,6 WR4
DEFW C003H ;7,8 WR3
DEFW 6005H ;9,10 WR5
DEFB 30H
DEFB 3
;
;
DEFS 8
$D: DEFB CHDCT
DEFB CHDDT
DEFS 1
DEFW 1010H
DEFW 4004H
DEFW C003H
DEFW 6005H
DEFB 30H
DEFB 3
ENDIF
;
TBLN: EQU $B-$A
;
SKP H
;
;
; Break Check
;
BRK: CALL BRKCHK
RET NZ
JP BREAKZ
;
; sio parameter set
;
;
;
RSPARM:
LD A,18H ;channel reset
OUT (C),A
LD A,30H ;err reset
OUT (C),A
LD A,(IY+#INIT) ;inital bit
AND 0CH ;stop bit
JR NZ,RSP0
SET 2,(IY+#INIT) ;1 bit/chr
RSP0: LD A,(IY+#INIT) ;initial bit
LD B,A ;B=init code
AND 0FH ;mask
OR 40H ;clock rate *16
LD (IY+6),A ;wr4
LD A,B
AND 80H ;rx disable d7 bit/chr
OR 40H
LD (IY+8),A ;wr3
RRA
AND 7FH ;dtroff
OR 0AH ;tx enable rtson dtroff
LD (IY+10),A ;wr5
LD A,B
OR 7FH
LD (IY+2),A ;bit mask
CALL RSSUB
RSTBUF:
IN A,(C)
RRCA
RET NC
DEC C
IN A,(C)
INC C
LD A,1
OUT (C),A
IN A,(C)
AND 70H
JR Z,RSTBUF
RET
;
;
;
;
; SIO close
;
;
RCLOSE: RES 0,(IY+8) ;rx disable
RES 7,(IY+10) ;rdy off
LD (IY+#STAT),0
RSSUB: LD B,10
PUSH IY
POP HL
LD DE,3
ADD HL,DE
OTIR
RET
;
;
; SIO open
;
;
RSOPEN: LD A,30H
OUT (C),A ;err reset
RET
SKP H
;
;
; in IY=channel data
; C=channel control port
;
;
;
RSEN: SET 0,(IY+8) ;wr3 RX enable
LD A,13H
OUT (C),A ;ext/int reset
LD A,(IY+8) ;wr3
OUT (C),A ;wr5
LD A,35H ;err reset
OUT (C),A
LD A,(IY+10) ;wr5
OR 88H ;dtr,rts on tx enable
LD (IY+10),A ;wr5
OUT (C),A
RET
;
;
RSDIS: LD A,3
OUT (C),A
RES 0,(IY+8) ;wr3 RX disenable
LD A,(IY+8) ;wr3
OUT (C),A
;
RDYOF: RES 7,(IY+10) ;wr5 dtr reset
JR WR5OUT
;
;
RTSON: SET 1,(IY+10) ;wr5 rts set
JR WR5OUT
;
;
RTSOFF: RES 1,(IY+10) ;wr5 rts reset
JR WR5OUT
;
;
RDYON: SET 7,(IY+10) ;wr5 dtr set
WR5OUT: LD A,5
OUT (C),A
LD A,(IY+10) ;wr5
OUT (C),A
OR A
RET
SKP H
;
;
; Receive 1 char
;
;
GET1C: CALL PUSHR
LD C,(IY+0)
GET1: CALL BRK
CALL DRCKR
JR C,GET1
CALL RSEN
CHIN: CALL BRK
IN A,(C)
RRCA
JR NC,CHIN ;skip if no data
DEC C
IN A,(C) ;data input
INC C
AND (IY+2) ;mask
PUSH AF
LD A,1
OUT (C),A
IN A,(C)
AND 70H
JR NZ,RSER ;skip if err
CALL RDYOF
POP AF
RET
;
;
;
RSER: LD B,A
POP AF
PUSH BC
CALL RSPARM
POP BC
LD A,29 ;framing err
RLC B
RLC B
RET C
INC A ;overrun err
RLC B
RET C
INC A ;parity err
SCF
RET
SKP H
;
;
; Send 1 char
;
;
PUT1C: CALL PUSHR
LD C,(IY+0)
LD D,A
CALL RTSON
PUT1: CALL BRK
CALL DRCKS
CALL NC,CTSCK
JR C,PUT1
IN A,(C)
BIT 2,A ;tx buf empty ?
JR Z,PUT1
BIT 7,(IY+#MONIT) ;all chr send?
JR Z,PUT2
LD A,1
OUT (C),A
IN A,(C)
RRCA
JR NC,PUT1
PUT2: DEC C
OUT (C),D ;data out
INC C
BIT 6,(IY+#MONIT) ;rts on/off?
JR Z,PUT3
CALL RTSOFF
PUT3: OR A
RET
;
; DCD check
;
DRCKR: OR A
BIT 0,(IY+#MONIT) ;moniter dr ?
JR DRCK1
;
DRCKS: OR A ;carry clear
BIT 1,(IY+#MONIT) ;moniter dr ?
DRCK1: RET Z
LD A,10H ;ext/int reset
OUT (C),A
IN A,(C)
AND 8
RET NZ ;cy=0
SCF
RET
;
; CTS check
;
CTSCK: OR A
BIT 2,(IY+#MONIT) ;moniter cts ?
RET Z
LD A,10H
OUT (C),A
IN A,(C)
AND 20H
RET NZ
SCF
RET
;
END

3737
asm/mz-xz009/MON1.ASM Normal file

File diff suppressed because it is too large Load Diff

640
asm/mz-xz009/MON2.ASM Normal file
View File

@@ -0,0 +1,640 @@
; -------------------------
; MZ-800 monitor Work area
; FI:MON2 ver 1.0A 9.05.84
; -------------------------
;
INCLD MACRO
INCLD XCRTEQU
;
;
; Interrupt vector
;
;
ORG 0FF0H
DEFS 12 ;interrupt reserve
;
ORG 0FFCH
DEFW PSGINT ;PSG(timer) interrupt
DEFW LPTINT ;Printer intrrupt
;
; Directry entry
;
ORG 1000H
ELMD: ENT ;file mode
DEFS 1
ELMD1: ENT ;file name
DEFS 17
ELMD18: ENT ;protection, type
DEFS 2
ELMD20: ENT ;size
DEFS 2
ELMD22: ENT ;adrs
DEFS 2
ELMD24: ENT ;exec
DEFS 2
ELMD26: ENT
DEFS 4
ELMD30: ENT
DEFS 2
ELMD32: ENT
DEFS 32
;
; LU table entry
;
ZTOP: ENT ;LU block top
DEFW 2
ZLOG: ENT ;LU#
DEFB 0
ZRWX: ENT ;1:R, 2:W, 3:X
DEFB 0
ZEQT: ENT ;Address of EQTBL
DEFW 0
ZCH: ENT ;CH#
DEFB 0
ZEOF: ENT ;EOF?
DEFB 0
ZWRK1: ENT ;Work 1
DEFB 0
ZWRK2: ENT ;Work 2
DEFB 0
;
SKP H
;
; EQT table entry
;
ZNXT: ENT ;STRM SQR RND
DEFW 0
ZDEVNM: ENT ;-- device name --
DEFS 4
ZFLAG1: ENT ;----- flag 1 ----
DEFB 1
ZFLAG2: ENT ;----- flag 2 ----
DEFB 0
ZDIRMX: ENT ;---- max dir ----
DEFB 0
ZINIT: ENT ;--- initialize --
DEFW 0
ZRO: ENT ;ROPEN RDINF
ZMAPS: ENT ; Map.start
DEFW 0
ZWO: ENT ;WOPEN WRFIL
ZMAPB: ENT ; Map.bytes
DEFW 0
ZCL: ENT ;CLOSE
ZSTRT: ENT ; START
ZDIRS: ENT ; Dir.start
DEFW 0
ZKL: ENT ;KILL
ZBLK: ENT ; - Block/byte -
DEFW 0
ZINP: ENT ;INP RDDAT BREAD
DEFW 0
ZOUT: ENT ;OUT WRDAT BWRIT
DEFW 0
ZPOS: ENT ;Position
ZDELT: ENT ; DELETE
DEFW 0
ZWDIR: ENT ; WR DIR
DEFW 0
ZFREE: ENT ; - free bytes -
DEFW 0
;
ZBYTES: EQU ZFREE+2-ZNXT ;Z-area bytes
;
DEFS 2
;
DCHAN: ENT ;default channel
DEFS 1
DDEV: ENT ;default device
DEFS 2
;
;
.$CRT: ENT
DEFW $CRT
.$LPT: ENT
DEFW $LPT
;
SKP H
;
; Work area pointers
;
TEXTST: ENT ;Text starat
DEFS 2
TEXTED: ENT
POOL: ENT ;I/O work
DEFS 2
POOLED: ENT
VARST: ENT ;Variable start
DEFS 2
STRST: ENT ;String start
DEFS 2
VARED: ENT ;Var & string end
DEFS 2
TMPEND: ENT ;Temporaly end
DEFS 2
INTFAC: ENT ;Initial FAC
DEFS 2
MEMLMT: ENT ;LIMIT command
DEFS 2
MEMMAX: ENT ;Last avairable memory
DEFW FF00H
;
;
; cursor / position work
;
;
;
CURXY: ENT ;cursor position
CURX: ENT
DEFB 0
CURY: ENT
DEFB 0
POSADR: ENT ;text buf addr
DEFW 2000H
BITADR: ENT ;bitmap mem addr
DEFW 8000H
;
POINTX: ENT ;Graphic x-coordinate
DEFS 2
POINTY: ENT ;Graphic y-coordinate
DEFS 2
;
CURFLG: ENT ;0:off 1:on
DEFB 0
CURMAK: ENT ;cursor mark 0=normal
DEFB 0 ; 1=sftlock
; 2=graph
SKP H
;
; CRT/LPT work
;
CMTMSG: ENT ;if =0 disp cmt-msg
DEFS 1
INPFLG: ENT ;0=plot off 1=plot on
DEFB 0
DISPX: ENT ;0=MSG 1=MSGX
DEFS 1
FILOUT: ENT ;0=CRT 1=LPT
DEFB 0
PSEL: ENT ;Printer select
DEFB 1
PCRLF: ENT ;LPT CRLF CODE
DEFB 0DH
LPT.TM: ENT ;LPT wait time
DEFB 14
LPOSB: ENT ;LPT position
DEFB 0
PSMAL: ENT ;LPT small/capital
DEFB 0
PNMODE: ENT ;LPT mode
DEFB 1 ; 1..text, 2..graph
;
;
; crt dispmode work
;
;
DMD: ENT ;disp mode 0 320 4 col
DEFB 0 ; 2 320 16 col
; 4 640 2 col
; 6 640 4 col
MEMOP: ENT ;option mem exit
DEFB 0 ;0= off 1= on
PWMODE: ENT ;graphic operation mode
DEFB 0
CMODE: ENT ;color mode
DEFB 3
CPLANE: ENT ;curent active plane
DEFB 3
MAXCF: ENT ;maximum plane data
DEFB 4
PMASK: ENT ;mask plane data
DEFB FFH
GMODE: ENT ;graphic color mode
DEFB 3
;
DEFS 50H ;10A0 -- 10EF monitor stack
;
;
;
IBUFE: ENT ;CMT work
DEFS 128
;
DEFS 34
DEFB EFH ;FLSDT
DEFS 2 ;STRFG, DPRNT
TMCNT: ENT
DEFS 2
SUMDT: ENT
DEFS 2 ;SUMDT
CSMDT: ENT
DEFS 2 ;CSMDT
DEFS 2 ;AMPM, TIMFG
DEFB 1 ;SWRK
TEMPW: ENT
DEFB 4 ;TEMPW
DEFB 5 ;ONTYO
DEFS 3 ;OCTV, RATIO
;
KEYBM1: ENT
DEFS 1
KEYBUF: ENT
DEFS 262
KEY262: ENT
DEFS 2
KEY264: ENT
DEFS 2
KEY266: ENT
DEFS 4
;
FUNBUF: ENT
FKEY 1,"RUN ",0DH
DEFB FNB1E-FNB1S
FNB1S: DEFM "RUN "
IFD 0DH
DEFB 0DH
ENDIF
FNB1E: DEFS FNB1S+15-FNB1E
ENDM
FKEY 2,"LIST "
DEFB FNB2E-FNB2S
FNB2S: DEFM "LIST "
IFD @3
ENDIF
FNB2E: DEFS FNB2S+15-FNB2E
ENDM
FKEY 3,"AUTO "
DEFB FNB3E-FNB3S
FNB3S: DEFM "AUTO "
IFD @3
ENDIF
FNB3E: DEFS FNB3S+15-FNB3E
ENDM
FKEY 4,"RENUM "
DEFB FNB4E-FNB4S
FNB4S: DEFM "RENUM "
IFD @3
ENDIF
FNB4E: DEFS FNB4S+15-FNB4E
ENDM
FKEY 5,"COLOR " ;QD FD ->"DIR "
DEFB FNB5E-FNB5S
FNB5S: DEFM "COLOR "
IFD @3
ENDIF
FNB5E: DEFS FNB5S+15-FNB5E
ENDM
FKEY 6,"CHR$("
DEFB FNB6E-FNB6S
FNB6S: DEFM "CHR$("
IFD @3
ENDIF
FNB6E: DEFS FNB6S+15-FNB6E
ENDM
FKEY 7,"DEF KEY("
DEFB FNB7E-FNB7S
FNB7S: DEFM "DEF KEY("
IFD @3
ENDIF
FNB7E: DEFS FNB7S+15-FNB7E
ENDM
FKEY 8,"CONT"
DEFB FNB8E-FNB8S
FNB8S: DEFM "CONT"
IFD @3
ENDIF
FNB8E: DEFS FNB8S+15-FNB8E
ENDM
FKEY 9,"SAVE "
DEFB FNB9E-FNB9S
FNB9S: DEFM "SAVE "
IFD @3
ENDIF
FNB9E: DEFS FNB9S+15-FNB9E
ENDM
FKEY 10,"LOAD "
DEFB FNB10E-FNB10S
FNB10S: DEFM "LOAD "
IFD @3
ENDIF
FNB10E: DEFS FNB10S+15-FNB10E
ENDM
;
INBUFC: ENT ;INBUF counter
DEFB 0
INBUFL: ENT ;INBUF length
DEFB 0
INBUF: ENT ;pending key 16
DEFS 16
;
LINLIM: ENT ;getline buffer limit
DEFB 255 ;const
KEYDAT: ENT
DEFB 0
;
; timer work
;
AMPM: ENT
DEFB 0
SECD: ENT
DEFW 0
;
; scrool work
;
XS: ENT ;console X start const=0
DEFB 0
XE: ENT ;console X end
DEFB 39
CWIDTH: ENT ;console width
DEFW 40 ;cwidth=xe+1
CSIZE: ENT ;csize=cwidth*8
DEFW 320
YS: ENT ;console Y start
DEFB 0
YE: ENT ;console Y end
DEFB 24
YW: ENT ;console Y width
DEFB 25 ;yw=ye-ys+1
;
; scrool custom data
;
SOF: ENT ;scrool offset
DEFW 0
SW: ENT ;scrool width
DEFB 7DH ;sw = yw*5
SSA: ENT ;scrool start
DEFB 0 ;ssa = ys*5
SEA: ENT ;scrool end
DEFB 7DH ;sea =(ye+1)*5
SSW: ENT ;scrool offset limit
DEFW 3E8H ;ssw = sw *8
;
; crt work (basic used)
;
CRTMD1: ENT ;crt bit data
DEFB 1
CRTMD2: ENT ;crt mode no. data
DEFB 1
SELCOL: ENT ;default color
DEFB 3
PAIWED: ENT
DEFW 0 ;paint stack end
;
;
;
; palette work
;
PALBK: ENT ;palette block number
DEFB 0
PALAD: ENT ;palette init addr
DEFW PAL4T
PALTBL: ENT ;palette data table
DEFS 4
;
;
; palette init data table
;
PAL2T: ENT ;palette
DEFB 00H ;PAL 0 black
DEFB 1FH ;PAL 1 white
DEFB 2FH ;PAL 2 white
DEFB 3FH ;PAL 3 white
;
PAL4T: ENT ;palette
DEFB 00H ;PAL 0 black
DEFB 11H ;PAL 1 blue
DEFB 22H ;PAL 2 red
DEFB 3FH ;PAL 3 white
;
PAL16T: ENT ;palette
DEFB 00H ;PAL 0 black
DEFB 11H ;PAL 1 blue
DEFB 22H ;PAL 2 red
DEFB 33H ;PAL 3 purple
;
;
; cursor init data table
;
CURDT1: ENT ;cursor normal
DEFB FFH ;0
DEFB FFH ;1
DEFB FFH ;2
DEFB FFH ;3
DEFB FFH ;4
DEFB FFH ;5
DEFB FFH ;6
DEFB FFH ;7
;
CURDT2: ENT ;cursor sftlock
DEFB 7EH ;0
DEFB FFH ;1
DEFB FFH ;2
DEFB FFH ;3
DEFB FFH ;4
DEFB FFH ;5
DEFB FFH ;6
DEFB 7EH ;7
;
CURDT3: ENT ;cursor graph
DEFB 00H ;0
DEFB 00H ;1
DEFB 00H ;2
DEFB 00H ;3
DEFB 00H ;4
DEFB 00H ;5
DEFB 00H ;6
DEFB FFH ;7
;
; screen management buffer
;
SCRNT0: ENT
DEFS 25
SCRNTE: DEFB 0
;
;
; emm work
;
;
EMFLG: ENT
DEFS 1
EMPTR: ENT
DEFS 2
EMWP0: ENT
DEFS 2
EMWP1: ENT
DEFS 2
SKP H
; ------------------------------
;
; lpt work
;
; ------------------------------
;
WPULSE: DEFB 0
WSTROB: DEFB 0
PBCMAW: DEFW 3FF0H
PBCN: ENT
DEFW 0 ;
PBCIP: DEFW C000H ;FIFO inp pointer
PBCOP: DEFW C000H ;FIFO out pointer
PBCTOP: DEFW C000H ;buffer top
SPLFLG: DEFB 0 ;spool on/stop/off
OUTIMF: DEFB 0 ;output image flag
HPCOUN: DEFB 4 ;printer counter
HERRF: ENT
DEFB 0 ;ROM error flag
;
;
;---------------------------------
;
;
; code translation table
;
;---------------------------------
;
CTABLE: ENT
DEFW CTABL1 ;change table address
;
;
CTABL1: DEFB 39 ;change number
;
;
DEFB 023H ;#
DEFB 023H
;
DEFB 040H ;@
DEFB 040H
;
DEFB 05BH ;[
DEFB 05BH
;
DEFB 05CH ;\
DEFB 05CH
;
DEFB 05DH ;]
DEFB 05DH
;
DEFB 08BH ;^
DEFB 05EH
;
DEFB 090H ;under_
DEFB 05FH
;
DEFB 093H ;'
DEFB 060H
;
DEFB 0A1H ;a
DEFB 061H
;
DEFB 09AH ;b
DEFB 062H
;
DEFB 09FH ;c
DEFB 063H
;
DEFB 09CH ;d
DEFB 064H
;
DEFB 092H ;e
DEFB 065H
;
DEFB 0AAH ;f
DEFB 066H
;
DEFB 097H ;g
DEFB 067H
;
DEFB 098H ;h
DEFB 068H
;
DEFB 0A6H ;i
DEFB 069H
;
DEFB 0AFH ;j
DEFB 06AH
;
DEFB 0A9H ;k
DEFB 06BH
;
DEFB 0B8H ;l
DEFB 6CH
;
DEFB 0B3H ;m
DEFB 6DH
;
DEFB 0B0H ;n
DEFB 6EH
;
DEFB 0B7H ;o
DEFB 6FH
;
DEFB 09EH ;p
DEFB 70H
;
DEFB 0A0H ;q
DEFB 71H
;
DEFB 09DH ;r
DEFB 72H
;
DEFB 0A4H ;s
DEFB 73H
;
DEFB 096H ;t
DEFB 74H
;
DEFB 0A5H ;u
DEFB 75H
;
DEFB 0ABH ;v
DEFB 76H
;
DEFB 0A3H ;w
DEFB 77H
;
DEFB 09BH ;x
DEFB 78H
;
DEFB 0BDH ;y
DEFB 79H
;
DEFB 0A2H ;z
DEFB 7AH
;
DEFB 0BEH ;{
DEFB 7BH
;
DEFB 0C0H
DEFB 7CH
;
DEFB 080H ;}
DEFB 7DH
;
DEFB 094H ;~
DEFB 7EH
;
DEFB 07FH ;
DEFB 7FH
;
;
END

941
asm/mz-xz009/MON3.ASM Normal file
View File

@@ -0,0 +1,941 @@
INCLD MACRO
LIST
INCLD XMON-ROM
;
;---------------------------------
; XMON-ROM 8.30.84
;
; JISX MZ-800 --> ASC
; ent A :data
; IX :output sub
; (HL) :tab counter
; E :DISPX
;
;---------------------------------
;
;
JISX: ENT
CP 0DH
JR Z,JISXCR
CP 0AH
JR Z,JISXCR
CALL AJISX ;code change
CP 20H
JR NC,.IX
BIT 0,E ;print/p ?
JR Z,.IX ;no
LD A," "
.IX: JP (IX)
;
JISXCR: CALL .IX
LD M,0
RET
;
AJISX: PUSH BC
LD C,0
CALL AJISX1
POP BC
RET
;
;
AJISX1: CALL PUSHR
LD HL,(CTABLE)
LD B,(HL) ;code counter set
INC HL ;HL=MZ-800
LD D,H ;DE=JIS
LD E,L
INC DE
BIT 0,C ;MZ-800 --> JIS ?
JR Z,AJISX2 ;yes
EX DE,HL
AJISX2: CP (HL)
JR Z,AJISX3 ;code match
INC HL
INC HL
INC DE
INC DE
DJNZ AJISX2
RET
;
AJISX3: LD A,(DE)
RET
;
;
;---------------------------------
;
;
; JISR ASC --> MZ-800
; ent (A) :data
; IX :input sub
;
;---------------------------------
;
;
JISR: ENT
CALL .IX ;input sub :A set
RET C
;
PUSH BC
LD C,1
CALL AJISX1
POP BC
OR A
RET
;---------------------------------
;
$LPT: ENT
DEFW $CMT
DEFM "LPT"
DEFB 0
DEFB 8AH ;Streem, O1C, W
DEFW 0
DEFW LPTINI
DEFW ER59 ;ROPEN
DEFW .RET ;WOPEN
DEFW .RET ;CLOSE
DEFW .RET ;KILL
DEFW 0 ;INP
DEFW LPT1C?
DEFW LPTPOS
;
;
PIO.AC: EQU FCH ;Port-A control
PIO.AD: EQU FEH ;Port-A data
PIO.BC: EQU FDH ;Port-B control
PIO.BD: EQU FFH ;Port-B data
;
P.PLT: EQU 0 ;1P01, 1P09
P.KP5: EQU 1 ;KP5
P.JIS: EQU 2 ;JIS code
P.THRU: EQU 3 ;thrue
;
;
LPTPOS: LD A,(INPFLG)
OR A
LD A,(LPOSB)
RET Z
LD A,(CURX)
RET
;
;
;
;----------------------------------
;
; PL ROM CALL
;
;----------------------------------
ROMST: EQU 03H ;F403H
ROMST1: EQU F400H
;
;
TIMST: ENT
CALL ROMJP2
DEFB ROMST
;
TIMRD: ENT
CALL ROMJP2
DEFB ROMST+3
;
STICK: ENT
CALL ROMJP2
DEFB ROMST+6
;
STRIG: ENT
CALL ROMJP2
DEFB ROMST+9
;
HCPY: ENT
CALL ROMJP
DEFB ROMST+12
;
LPT1C?: ENT
LD HL,DISPX
BIT 0,M
JR NZ,LPT1CX
;
LPT1C: ENT
PUSH IY
EX AF,AF'
LD A,3+15 ;F003+15
LD (APL1CD),A
LD A,.CRT1C
APL1CF: LD (APL1CE),A
EX AF,AF'
CALL APL1C
POP IY
PUSH BC
LD B,A
LD A,(INPFLG)
OR A
LD A,B
POP BC
RET Z
RST 3
APL1CE: DEFB .CRT1C
RET
APL1C: LD IY,JISX
CALL ROMJP
APL1CD: DEFB ROMST+15
;
LPT1CX: ENT
PUSH IY
EX AF,AF'
LD A,3+18 ;F003+18
LD (APL1CD),A
LD A,.CRT1CX
JR APL1CF
;
LPTINI: ENT
CALL ROMJP
DEFB ROMST+21
;
LPTOUT: ENT
CALL ROMJP
DEFB ROMST+24
;
PBCCLR: ENT
CALL ROMJP
DEFB ROMST+27
;
SPLOFF: ENT
CALL ROMJP
DEFB ROMST+30
;
SPLON: ENT
CALL ROMJP
DEFB ROMST+33
;
SPLSW: ENT
CALL ROMJP
DEFB ROMST+36
;
LPTM02: ENT
CALL ROMJP
DEFB ROMST+39
;
;---------------------------
;
;
;
ROMJP: EX AF,AF'
LD A,(PSEL)
BIT P.KP5,A
JR Z,ROMJP1
;
PUSH BC
LD B,3
SVC .MCTRL
RST 3
DEFB .MCTRL
ENDM
POP BC
;
ROMJP1: EX AF,AF'
ROMJP2: EX AF,AF'
XOR A
LD (KEY266),HL
LD (HERRF),A
EX AF,AF'
DI
LD (KEY264),SP
EX (SP),HL ;HL=call stored address
LD SP,HL ;
POP HL ;HL=call address
OUT (LSE3),A
LD SP,KEY262
CALL HLJP
OUT (LSE1),A
LD SP,(KEY264)
EX (SP),HL
INC SP
INC SP
EI
EX AF,AF'
LD A,(HERRF)
OR A
JR NZ,ROMERR
EX AF,AF'
RET
HLJP: LD H,0F4H ;HL=F4??H
JP (HL)
;
;
ROMERR:
LD B,A ;B=0
EX AF,AF'
DEC B ;B=1
JP Z,BREAKZ
DEC B ;B=2
JP NZ,ERRORJ
ROMER1: LD HL,(PBCN) ;INIT M2
LD A,H
OR L
JR Z,LPTM02
CALL SPLON
SVC .BREAK
RST 3
DEFB .BREAK
ENDM
JP Z,BREAKZ
JR ROMER1
;
;
LPTINT: ENT
DI
PUSH AF
PUSH HL
PUSH BC
LD (WKLINT),SP
LD SP,WKLINT
OUT (LSE3),A
CALL ROMST1
OUT (LSE1),A
LD SP,(WKLINT)
POP BC
POP HL
POP AF
EI
RETI
DEFS 8
WKLINT: DEFW 0
;
END
SKP H
INCLD MONOP
; ---------------------------
; MZ-800 Monitor command
; FI:MONOP ver 1.0A 8.04.84
; ---------------------------
;
MONOP: ENT
PUSH HL
LD DE,(ERRORP)
PUSH DE
LD DE,MONERR
LD (ERRORP),DE ;error ret adr set
LD A,(LINLIM)
PUSH AF
LD A,100 ;getline max set
LD (LINLIM),A
LD (MONSP+1),SP ;stack pointer push
XOR A
LD (FILOUT),A ;crt mode
MONCLD: LD SP,0000H ;stack initize
MONHOT: LD BC,MONHOT
PUSH BC ;last return addrs set
SVC .CR2 ;linefeed & cr
RST 3
DEFB .CR2
ENDM
LD A,"*" ;prompt disp
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
CALL MONEDT ;memory corretion ?
JR NC,-3
LD A,(DE)
CP "*"
RET NZ ;prompt check
INC DE
LD A,(DE) ;acc=next interpret data
INC DE ;next interpret data addr
;
;
; moniter tabel command jump
;
EXX ;parameter push
LD HL,MNCMTB
LD B,10 ;commands counter
MNCMCP: CP M
INC HL
JR Z,MNCMOK ;skip if just command
INC HL ;next search
INC HL
DJNZ MNCMCP
EXX
RET
;
MONERR: LD C,A
AND 7FH
JR Z,MONCLD ;Break
LD A,C ;acc=errcode
SVC .ERRX ;display error messege
RST 3
DEFB .ERRX
ENDM
SVC .ERCVR ;error recover fd/qd
RST 3
DEFB .ERCVR
ENDM
JR MONCLD
;
;
MNCMOK: LD E,M
INC HL
LD D,M
PUSH DE ;commnd addr set
EXX ;parameter pop
RET
;
MNCMTB: DEFM 'D'
DEFW MONDMP
DEFM 'M'
DEFW MONSET
DEFM 'P'
DEFW MONPRT
DEFM 'G'
DEFW MONGOT
DEFM 'F'
DEFW MONSCH
DEFM 'R'
DEFW MONSP
DEFM 'S'
DEFW MONSAV
DEFM 'L'
DEFW MONLOD
DEFM 'V'
DEFW MONVRY
DEFM 'T'
DEFW MONTRN
;
MONPRT: LD A,(FILOUT) ;lpt/crt
XOR 1
LD (FILOUT),A
RET
;---------------------------------
;
; moniter save commnd
;
;---------------------------------
MONSAV: CALL SAVTRN ;set addrs
RET C
EXX
CALL FNMST ;file name set
EXX
LD (ELMD20),BC ;bytes
LD (ELMD22),DE ;data adrs
LD (ELMD24),HL ;exec adrs
SVC .SAVEF ;save file
RST 3
DEFB .SAVEF
ENDM
RET
;---------------------------------
;
; moniter load command
;
;---------------------------------
MONLOD: CALL HLSET ;load addr set
PUSH HL ;hl=load addrs
PUSH AF
CALL LOAVRY ;filename set & open
POP AF
POP HL
JR NC,+5 ;user load addr set ??
LD HL,(ELMD22)
SVC .LOADF ;load file
RST 3
DEFB .LOADF
ENDM
RET
;---------------------------------
;
; filename set & open
;
;---------------------------------
LOAVRY: CALL FNMST ;file name set
SVC .LOPEN ;ropen
RST 3
DEFB .LOPEN
ENDM
CP 1
RET Z
JP ER61 ;File mode error
;---------------------------------
;
; moniter verify command
;
;---------------------------------
MONVRY: CALL LOAVRY ;filename set
LD HL,(ELMD22)
SVC .VRFYF ;file verify
RST 3
DEFB .VRFYF
ENDM
RET
;---------------------------------
;
; moniter rerturn command
;
; to BASIC
;---------------------------------
MONSP: LD SP,0000H
POP AF
LD (LINLIM),A
POP HL
LD (ERRORP),HL
POP HL
RET
;---------------------------------
;
; moniter operation
;
;---------------------------------
MONEDT: LD DE,FF00H ;moniter work
SVC .GETL
RST 3
DEFB .GETL
ENDM
JR C,MONEDE
;
; check ':xxxx='
;
LD A,(DE)
CP ":" ;mem correct ??
SCF
RET NZ
;
INC DE
CALL HLSET ;addrs input ?
RET C
LD A,(DE)
INC DE
XOR 3DH ;"=" input ?
RET NZ
;
;
NEXTAC: CALL ACSET ;data read
CCF
RET NC
LD M,A ;mem correction !
INC HL ;next pointer
JR NEXTAC
;
;
MONEDE: LD (DE),A ;error
RET
;----------------------------------
;
; 4 ascii to binary (word)
;
; ent. de=ascii data pointer
; ext hl=xxxxH
;
;----------------------------------
HLSET: PUSH HL
CALL SPCTAC ;separater search
PUSH DE
CALL ACSETH ;2 ascii to binary
JR C,HLSETE
LD H,A
CALL ACSETH ;2 ascii to binary
JR C,HLSETE
LD L,A
POP AF
POP AF
XOR A
RET
;
HLSETE: POP DE
POP HL
SCF
RET
;----------------------------------
;
; separater search
;
;----------------------------------
SPCTA2: INC DE
SPCTAC: LD A,(DE)
CP 20H
JR Z,SPCTA2
RET
;---------------------------------
;
; 1 ascii to binary (nible)
;
; ent. de=ascii data pointer
; ext acc= 0xH
;
;---------------------------------
ACSETS: LD A,(DE)
SVC .CKHEX ;0-9 a-f check
RST 3
DEFB .CKHEX
ENDM
INC DE ;next pointer
RET
;---------------------------------
;
; 2 ascii to binary (byte)
;
; ent. de=ascii data pointer
; ext acc= xxH
;
;---------------------------------
ACSET: CALL SPCTAC ;separeter search
CP ";"
JR Z,SEMIOK ;skip if ascii input
ACSETH:
PUSH BC
PUSH DE
CALL ACSETS ;1 ascii to binary(nible)
JR C,ACSTER
LD C,A ;high nible
CALL ACSETS ;1 ascii to binary(nible)
JR C,ACSTER
LD B,A ;low nible
LD A,C
RLCA
RLCA
RLCA
RLCA
ADD A,B
LD C,A
LD A,C
POP BC
POP BC
OR A
RET
;
ACSTER: POP DE
POP BC
SCF
RET
;----------------------------------
;
; ascii code input mode
;
;----------------------------------
SEMIOK: INC DE
LD A,(DE)
INC DE
OR A ;¯¯JR ACSETO
RET ;¯¯
;----------------------------------
;
; moniter jump commnd
;
;----------------------------------
MONGOT: CALL HLSET ;addrs set
RET C
JP (HL)
;----------------------------------
;
; moniter dump commnd
;
;----------------------------------
MONDMP: CALL HLSET ;top addrs set
JR C,MONDP1 ;skip if 'd' only
PUSH HL
CALL HLSET ;end addrs set
JR C,MONDP2 ;skip if top addrs only
POP DE
EX DE,HL
JR MONDP3
;
;
;
MONDP2: POP HL ;
MONDP1: EX DE,HL
LD HL,80H
ADD HL,DE ;last addrs calc
EX DE,HL
MONDP3: LD C,8 ;counter set
CALL MONDPS ;dump list disp
RET C
PUSH HL
SBC HL,DE ;dump end calc
POP HL
RET NC
JR MONDP3
;
MONDPS: CALL HLHXPR ;addrs disp
LD B,C
PUSH HL
MONDP4: LD A,M ;data read
CALL ACHXPR ;1 byte disp
INC HL
LD A,20H ;space disp
SVC .&1C
RST 3
DEFB .&1C
ENDM
DJNZ MONDP4
POP HL
;
LD A,"/" ;separater disp
SVC .&1C
RST 3
DEFB .&1C
ENDM
LD B,C
MONDP5: LD A,M ;data read
CP 20H ;contol code
JR NC,+4
LD A,"." ;yes, control code
SVC .&1C
RST 3
DEFB .&1C
ENDM
INC HL ;next pointer
DJNZ MONDP5
;
SVC .&CR ;
RST 3
DEFB .&CR
ENDM
SVC .HALT ;braek & stop
RST 3
DEFB .HALT
ENDM
OR A
RET
;--------------------------------
;
; disp addrs
;
; ent. hl=addrs
; ':xxxx='
;
;--------------------------------
HLHXPR: LD A,":"
SVC .&1C
RST 3
DEFB .&1C
ENDM
LD A,H
CALL ACHXPR ;acc disp
LD A,L
CALL ACHXPR ;acc disp
LD A,"="
SVC .&1C
RST 3
DEFB .&1C
ENDM
RET
;--------------------------------
;
; acc disp
;
; ent. acc = disp data
;
;--------------------------------
ACHXPR: PUSH AF
RLCA
RLCA
RLCA
RLCA
CALL AC1HXP ;nible disp
POP AF
AC1HXP: AND 0FH ;ascii trans
ADD A,30H
CP ":"
JR C,+4
ADD A,7
SVC .&1C ;disp acc(nible)
RST 3
DEFB .&1C
ENDM
RET
;---------------------------------
;
; moniter mem correction comd
;
;---------------------------------
MONSET: CALL HLSET ;
LD A,(FILOUT) ;lpt/crt switch
PUSH AF
XOR A
LD (FILOUT),A ;crt mode
MONSTL: SVC .CR2
RST 3
DEFB .CR2
ENDM
CALL HLHXPR ;addrs disp
LD A,M ;data read
CALL ACHXPR ;data disp
LD A,20 ;back space
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
CALL MONEDT ;moniter operation
JR NC,MONSTL
POP AF
LD (FILOUT),A
RET
;--------------------------------
;
; moniter search command
;
;--------------------------------
MONSCH: CALL HLSET ;start addrs
RET C
PUSH HL
CALL HLSET ;end addrs
POP BC
RET C
PUSH HL ;hl end addr
PUSH BC ;bc start addr
LD HL,FF00H ;check data read
CALL NEXTAC ;(hl)<--data
LD DE,FF00H
OR A
SBC HL,DE ;check data bytes
LD C,L
POP HL
PUSH HL
EXX
POP HL ;hl start addr
POP DE ;de end addr
EXX
RET Z
MNSHLP: CALL HLDECK ;de=FF00h
JR NZ,SKPSCH ;de check databuf
CALL MONDPS ;data disp
RET C
SKPSCH: SVC .BREAK
RST 3
DEFB .BREAK
ENDM
RET Z
EXX
INC HL ;next check pointer
PUSH HL
SCF
SBC HL,DE ;end check ?
POP HL
RET NC
PUSH HL
EXX
POP HL ;next check pointer
JR MNSHLP
;----------------------------------
;
; 3 pointer data interpret
;
; ent de=ascii data top addr
;
; ext de=first data
; bc=(second-first) data
; hl=last data
;
; used save,xfer commnd
;
; command : save : xfer
;
; de : start: source
; bc : bytes: bytes
; hl : end : destination
;----------------------------------
SAVTRN: CALL HLSET ;first
PUSH HL
CALL NC,HLSET ;second
POP BC ;first
RET C
SBC HL,BC ;calc bytes
INC HL
PUSH HL ;bytes
PUSH BC ;first
CALL HLSET ;last
PUSH HL ;last
EXX
POP HL ;last
POP DE ;first
POP BC ;bytes
RET
;-------------------------------
;
; moniter xfer command
;
;-------------------------------
MONTRN: CALL SAVTRN ;
RET C
EX DE,HL
PUSH HL
SBC HL,DE ;direction check
POP HL
JR C,LDDRTR
LDIR
RET
LDDRTR: ADD HL,BC ;last addrs calc
DEC HL
EX DE,HL
ADD HL,BC
DEC HL
EX DE,HL
LDDR
RET
;----------------------------------
;
; filename set
;
;----------------------------------
FNMST: LD A,(DE)
OR A
JR Z,FNMST2
INC DE
CP ":" ;demiliter seach
JR NZ,FNMST
FNMST2: SVC .COUNT ;count string length
RST 3
DEFB .COUNT
ENDM
SVC .DEVFN ;interpret dev. file name
RST 3
DEFB .DEVFN
ENDM
LD A,1
LD (ELMD),A ;.OBJ atribut
RET
;---------------------------------
;
; check (de) (hl) ?
;
; hl,de check data point
; c counter
;
;---------------------------------
HLDECK: LD A,(DE)
CP M
RET NZ
PUSH BC
PUSH DE
PUSH HL
LD B,C
HLDEC1: LD A,(DE)
CP M
JR NZ,HLDEC2
INC DE
INC HL
DJNZ HLDEC1
XOR A
HLDEC2: POP HL
POP DE
POP BC
RET
;
END
END

83
asm/mz-xz009/MON4.ASM Normal file
View File

@@ -0,0 +1,83 @@
ORG 3C00H
INCLD MACRO
LIST
INCLD XROM
;----------------------------------
;
; ascii display code trans
;
;----------------------------------
?ADCN: ENT
CP 10H ;EX only
JR C,?AD3 ; <10H ==> F0H
CP 80H
JR Z,?AD7 ; 80H ==> 40H
CP C0H
JR Z,?AD7 ; C0H ==> 80H
DI
OUT (LSE2),A
CALL 0BB9H
OUT (LSE0),A
EI
RET
?AD3: LD A,F0H
RET
?AD7: SUB 40H
RET
;
?DACN: ENT
CP F0H
JR NC,?DA3
CP 73H
JR Z,?AD3 ; 73H ==> F0H
CP 40H ;EX only
JR Z,?DA7 ; 40H ==> 80H
CP 80H
JR Z,?DA7 ; 80H ==> C0H
DI
OUT (LSE2),A
CALL 0BCEH
OUT (LSE0),A
EI
CP F0H
RET NZ
?DA3: LD A," "
RET
?DA7: ADD A,40H
RET
;
;
;
?KYTBL: ENT
PUSH AF
LD A,L
SUB 8
JR C,?KY0
SUB 48
JR C,?KY1
?KY0: ADD A,10
LD L,A
ADD HL,BC
LD C,M
POP AF
RET
?KY1: LD A,(BC)
PUSH AF
INC BC
LD A,(BC)
LD B,A
POP AF
LD C,A ;BC=ROM adrs
ADD HL,BC
DI
OUT (LSE2),A
LD A,M
OUT (LSE0),A
EI
CALL ?DACN
LD C,A
POP AF
RET
END
END

356
asm/mz-xz009/MONEQU.ASM Normal file
View File

@@ -0,0 +1,356 @@
LIST
INCLD XE1
IOOUT: EQU 0104H
DEASC: EQU 029EH
PATCH: EQU 0531H
INKEY0: EQU 0BA1H
IOERR: EQU 00EBH
TEST1: EQU 0164H
ERRX: EQU 0340H
COLS: EQU 049CH
HCLSW: EQU 061DH
PONT: EQU 0963H
INKEY1: EQU 0B21H
$KB: EQU 0DF6H
.HL: EQU 00A7H
PUSHR: EQU 00C7H
SETDFL: EQU 0314H
BINPUT: EQU 0A67H
PUSHRA: EQU 00BAH
CKHEX: EQU 02E9H
DCOLOR: EQU 048AH
PONTB: EQU 097AH
ERRORJ: EQU 00EDH
?CLRHL: EQU 0137H
?SETDE: EQU 013EH
INDRCT: EQU 0151H
INCHLF: EQU 015DH
IOCALL: EQU 0247H
DWIDTH: EQU 04EFH
ACCDI: EQU 05ADH
LBOUND: EQU 05F9H
PONTC: EQU 0960H
INKEY$: EQU 0B1AH
BRKCHK: EQU 001EH
DEVASC: EQU 010DH
DWIND: EQU 04AEH
PONTCB: EQU 0977H
INKEYF: EQU 0B8BH
SYSSTA: EQU 004DH
PUSHW: EQU 0671H
HCUROF: EQU 093BH
TESTX: EQU 016EH
PALOFF: EQU 0441H
DPALST: EQU 0476H
PRNTT: EQU 0A58H
EQTBL: EQU 0DDDH
$TEMPO: EQU 0041H
.RET: EQU 00B2H
?CLRDE: EQU 013DH
HLFTCH: EQU 015EH
HALT: EQU 02F8H
ADDP0: EQU 031CH
DGCOL: EQU 0493H
TBCALC: EQU 0615H
ERRORP: EQU 004FH
LDDEMD: EQU 0132H
ADDP1: EQU 0323H
HCLS: EQU 0652H
.NOP: EQU 00A6H
ASCHL: EQU 025EH
ADDP2: EQU 032AH
SETDNM: EQU 0397H
PLTOTX: EQU 0EB3H
DSMODE: EQU 03BEH
CURMOV: EQU 094DH
GETL: EQU 0A84H
BREAKX: EQU 00E6H
CHKACC: EQU 011BH
LDDEHL: EQU 0143H
LDHLDE: EQU 014AH
BITMAP: EQU 05CEH
BRKEY: EQU 0D22H
$CRT: EQU 0DDDH
CRT1C: EQU 0E61H
ADDHLA: EQU 0158H
DEHEX: EQU 02CEH
DPALBK: EQU 044FH
FLASH: EQU 0945H
$USR: EQU 0F7FH
BREAKZ: EQU 00E8H
LDDEMI: EQU 012DH
?SETHL: EQU 0138H
HCURON: EQU 092BH
LSPAL: EQU 00F0H
LSFC: EQU 00FCH
LSE0: EQU 00E0H
LSE1: EQU 00E1H
LSE2: EQU 00E2H
LSE3: EQU 00E3H
LSE4: EQU 00E4H
LSE5: EQU 00E5H
LSE6: EQU 00E6H
LSD0: EQU 00D0H
LSD1: EQU 00D1H
LSD2: EQU 00D2H
LSD3: EQU 00D3H
LSWF: EQU 00CCH
LSRF: EQU 00CDH
LSDMD: EQU 00CEH
LSSCR: EQU 00CFH
TEXTBF: EQU 2000H
BITBUF: EQU 8000H
FONTBF: EQU 1000H
ERRTXT: EQU FDA0H
.IOSVC: EQU 0003H
.MONOP: EQU 0000H
.CR1: EQU 0001H
.CR2: EQU 0002H
.CRT1C: EQU 0003H
.CRT1X: EQU 0004H
.CRTMS: EQU 0005H
.LPTOT: EQU 0006H
.LPT1C: EQU 0007H
.&CR: EQU 0008H
.&1C: EQU 0009H
.&1CX: EQU 000AH
.&MSG: EQU 000BH
.GETL: EQU 000CH
.INKEY: EQU 000DH
.BREAK: EQU 000EH
.HALT: EQU 000FH
.DI: EQU 0010H
.EI: EQU 0011H
.CURMV: EQU 0012H
.DEASC: EQU 0013H
.DEHEX: EQU 0014H
.CKHEX: EQU 0015H
.ASCHL: EQU 0016H
.COUNT: EQU 0017H
.ADDP0: EQU 0018H
.ADDP1: EQU 0019H
.ADDP2: EQU 001AH
.ERRX: EQU 001BH
.?DACN: EQU 001CH
.?ADCN: EQU 001DH
.STICK: EQU 001EH
.STRIG: EQU 001FH
.BELL: EQU 0020H
.PLAY: EQU 0021H
.SOUND: EQU 0022H
.MCTRL: EQU 0023H
.IOOUT: EQU 0024H
.TIMRD: EQU 0025H
.TIMST: EQU 0026H
.INP1C: EQU 0027H
.CLRIO: EQU 0028H
.SEGAD: EQU 0029H
.OPSEG: EQU 002AH
.DLSEG: EQU 002BH
.DEVNM: EQU 002CH
.DEVFN: EQU 002DH
.LUCHK: EQU 002EH
.LOPEN: EQU 002FH
.LOADF: EQU 0030H
.SAVEF: EQU 0031H
.VRFYF: EQU 0032H
.RWOPN: EQU 0033H
.INSTT: EQU 0034H
.INMSG: EQU 0035H
.INDAT: EQU 0036H
.PRSTR: EQU 0037H
.CLKL: EQU 0038H
.DIR: EQU 0039H
.SETDF: EQU 003AH
.LSALL: EQU 003BH
.FINIT: EQU 003CH
.DELET: EQU 003DH
.RENAM: EQU 003EH
.LOCK: EQU 003FH
.RECST: EQU 0040H
.INREC: EQU 0041H
.PRREC: EQU 0042H
.ERCVR: EQU 0043H
.SWAP: EQU 0044H
.CLS: EQU 0045H
.POSCK: EQU 0046H
.POSSV: EQU 0047H
.PSET: EQU 0048H
.LINE: EQU 0049H
.PATTR: EQU 004AH
.BOX: EQU 004BH
.PAINT: EQU 004CH
.CIRCL: EQU 004DH
.POINT: EQU 004EH
.HCPY: EQU 004FH
.DSMOD: EQU 0050H
.DPLBK: EQU 0051H
.DPLST: EQU 0052H
.DWIND: EQU 0053H
.DCOL: EQU 0054H
.DGCOL: EQU 0055H
.ICRT: EQU 0056H
.SYMBL: EQU 0057H
END
INCLD XE2
ZWRK2: EQU 1049H
ZWO: EQU 1057H
ZWDIR: EQU 1063H
VARST: EQU 1074H
STRST: EQU 1076H
INPFLG: EQU 108FH
LPOSB: EQU 1095H
INBUFL: EQU 1353H
YW: EQU 1371H
ZKL: EQU 105BH
ZINP: EQU 105DH
ELMD: EQU 1000H
ZOUT: EQU 105FH
.$LPT: EQU 106EH
VARED: EQU 1078H
CURX: EQU 1082H
POINTX: EQU 1088H
KEYDAT: EQU 1365H
SELCOL: EQU 137BH
PALAD: EQU 137FH
ELMD1: EQU 1001H
ZBLK: EQU 105BH
ZDELT: EQU 1061H
DDEV: EQU 106AH
POOLED: EQU 1074H
CURY: EQU 1083H
POINTY: EQU 108AH
CURFLG: EQU 108CH
CURMAK: EQU 108DH
FILOUT: EQU 1091H
PNMODE: EQU 1097H
CPLANE: EQU 109CH
KEY262: EQU 12AAH
CWIDTH: EQU 136BH
PAL2T: EQU 1385H
CURDT1: EQU 1391H
PBCN: EQU 13CEH
ELMD20: EQU 1014H
ZEQT: EQU 1044H
ZEOF: EQU 1047H
ZNXT: EQU 104AH
ZDEVNM: EQU 104CH
PSEL: EQU 1092H
INBUF: EQU 1354H
CURDT2: EQU 1399H
ELMD30: EQU 101EH
ZCH: EQU 1046H
ZFLAG1: EQU 1050H
INTFAC: EQU 107CH
MEMMAX: EQU 1080H
DMD: EQU 1098H
KEY264: EQU 12ACH
LINLIM: EQU 1364H
PAL4T: EQU 1389H
CURDT3: EQU 13A1H
ELMD22: EQU 1016H
ZFLAG2: EQU 1051H
BITADR: EQU 1086H
TMCNT: EQU 1195H
KEYBUF: EQU 11A4H
FUNBUF: EQU 12B2H
ELMD32: EQU 1020H
ZSTRT: EQU 1059H
PCRLF: EQU 1093H
KEY266: EQU 12AEH
INBUFC: EQU 1352H
SSA: EQU 1375H
HERRF: EQU 13D9H
ELMD24: EQU 1018H
TMPEND: EQU 107AH
DISPX: EQU 1090H
CMODE: EQU 109BH
SOF: EQU 1372H
PAL16T: EQU 138DH
EMPTR: EQU 13C4H
ZCL: EQU 1059H
POSADR: EQU 1084H
KEYBM1: EQU 11A3H
SEA: EQU 1376H
EMWP0: EQU 13C6H
ELMD26: EQU 101AH
ZMAPB: EQU 1057H
POOL: EQU 1072H
SW: EQU 1374H
PAIWED: EQU 137CH
PALBK: EQU 137EH
SCRNT0: EQU 13A9H
EMWP1: EQU 13C8H
ELMD18: EQU 1012H
ZRWX: EQU 1043H
ZRO: EQU 1055H
ZMAPS: EQU 1055H
.$CRT: EQU 106CH
CURXY: EQU 1082H
CMTMSG: EQU 108EH
IBUFE: EQU 10F0H
CSMDT: EQU 1199H
AMPM: EQU 1366H
XS: EQU 1369H
CRTMD1: EQU 1379H
EMFLG: EQU 13C3H
CTABLE: EQU 13DAH
ZLOG: EQU 1042H
ZDIRS: EQU 1059H
ZPOS: EQU 1061H
ZFREE: EQU 1065H
TEXTST: EQU 1070H
MEMLMT: EQU 107EH
PWMODE: EQU 109AH
PMASK: EQU 109EH
GMODE: EQU 109FH
YS: EQU 136FH
CRTMD2: EQU 137AH
ZTOP: EQU 1040H
PSMAL: EQU 1096H
SUMDT: EQU 1197H
TEMPW: EQU 119EH
XE: EQU 136AH
SSW: EQU 1377H
ZDIRMX: EQU 1052H
ZINIT: EQU 1053H
DCHAN: EQU 1069H
TEXTED: EQU 1072H
MEMOP: EQU 1099H
CSIZE: EQU 136DH
YE: EQU 1370H
ZWRK1: EQU 1048H
LPT.TM: EQU 1094H
MAXCF: EQU 109DH
SECD: EQU 1367H
PALTBL: EQU 1381H
LSPAL: EQU 00F0H
LSFC: EQU 00FCH
LSE0: EQU 00E0H
LSE1: EQU 00E1H
LSE2: EQU 00E2H
LSE3: EQU 00E3H
LSE4: EQU 00E4H
LSE5: EQU 00E5H
LSE6: EQU 00E6H
LSD0: EQU 00D0H
LSD1: EQU 00D1H
LSD2: EQU 00D2H
LSD3: EQU 00D3H
LSWF: EQU 00CCH
LSRF: EQU 00CDH
LSDMD: EQU 00CEH
LSSCR: EQU 00CFH
TEXTBF: EQU 2000H
BITBUF: EQU 8000H
FONTBF: EQU 1000H
ERRTXT: EQU FDA0H
ZBYTES: EQU 001DH
END
END

463
asm/mz-xz009/MUSIC.ASM Normal file
View File

@@ -0,0 +1,463 @@
; ---------------------------
; MZ-800 BASIC Music command
; FI:MUSIC ver 1.0A 7.18.84
; Programed by T.Miho
; ---------------------------
;
INCLD MACRO
;
DIRARE: EQU 27D0H
NMAX: EQU 83 ;/ÙÄs max
;
;
; SOUND m,l / SOUND=(r,d)
;
SOUND: ENT
TEST1 0F4H ;=
CALL TEST1
DEFB 0F4H
ENDM
JR NZ,SOUND1
CALL HCH28H ;(
CALL IBYTE
CP 16
SET 7,A
JR SOUND2
;
SOUND1: CALL IBYTE
CP NMAX+1
SOUND2: JP NC,ER03
PUSH AF
CALL HCH2CH ;,
CALL IDEEXP
POP AF
PUSH AF
OR A
CALL M,HCH29H ;)
POP AF
PUSH HL
SVC .SOUND
RST 3
DEFB .SOUND
ENDM
POP HL
RET
;
; TEMPO n (n= 1 to 7 )
;
TEMPO: ENT
CALL IBYTE
DEC A
CP 7
INC A
JP $TEMPO
SKP H
;
;;;;;;;;;;;;;;;;;;;;;
;
; NOISE A1$;A2$,B1$;...
; MUSIC A1$;A2$;...;A6$,B1$;...
;
NOISE: ENT
LD A,08H ;pattern (3)
DEFB 1
;
MUSIC: ENT
LD A,07H ;pattern (0,1,2)
LD (MUNOF),A ;channel pattern
CALL HLFTCH
LD B,3
CP BEH ;WAIT
JR Z,MCTRL
DEC B
CP 99H ;STOP
JR Z,MCTRL
CP DCH ;INIT
JR NZ,MUSIC1
;
LD DE,MUSCHO
LD B,4
LD A,2
CALL ?SETDE
MCTRL: PUSH HL
SVC .MCTRL
RST 3
DEFB .MCTRL
ENDM
POP HL
INC HL
RET
;
MUSIC1: CALL ENDCHK
RET Z
XOR A
LD (MUDNO),A
LD (MUCHNO),A
LD B,A
LD A,0DH
LD DE,DIRARE
LD (MMBU1A),DE
LD (DE),A
CALL ?SETDE
LD A,(MUNOF)
LD (MUNOF2),A
MUSI1: LD DE,MUNOF2
LD A,(DE)
RRC A
LD (DE),A
PUSH AF
LD B,0
JR NC,MUSI3
CALL HLFTCH
CP ";"
JR Z,MUSI3
CALL STREXP
MUSI3: PUSH HL
LD A,(MUCHNO)
CP 4
JP Z,ER01 ;Ch no over
INC A
LD (MUCHNO),A
INC B
JP Z,ER05
LD A,(MUDNO)
ADD A,B
JP C,ER05 ;data no. over
LD (MUDNO),A
LD HL,(MMBU1A)
CALL LDHLDE
LD (MMBU1A),HL
DEC HL
LD M,0DH
POP HL
POP AF
JR NC,MUSI1
CALL ENDCHK
JR Z,MUSI4
TEST1 ','
CALL TEST1
DEFB ','
ENDM
JR Z,MUSI4
TEST1 ';'
CALL TEST1
DEFB ';'
ENDM
JR MUSI1
MUSI4: PUSH HL
LD HL,DIRARE
LD IX,HL
LD IY,MUSCHO
LD B,4
MUSI5: PUSH BC
PUSH HL
LD HL,IX
LD DE,DIRARE
XOR A
SBC HL,DE
LD (IY+4),L
POP HL
LD (MUSI6+1),SP
CALL MML.EN
MUSI6: LD SP,0 ;xxx
POP BC
INC HL
INC IY
DJNZ MUSI5
LD B,3
SVC .MCTRL ;MWAIT
RST 3
DEFB .MCTRL
ENDM
MUSI8: LD BC,100H
LD HL,DIRARE
LD DE,DIRARE+700H
LDIR
LD B,4
LD HL,MMCHDA
MUSDS: LD E,M
LD D,0
INC HL
PUSH HL
LD HL,DIRARE+700H
ADD HL,DE
LD A,M
CP 0FFH
JR Z,MUSDS1
LD A,4
SUB B
PUSH BC
EX DE,HL
SVC .PLAY
RST 3
DEFB .PLAY
ENDM
POP BC
MUSDS1: POP HL
DJNZ MUSDS
LD B,1
SVC .MCTRL ;PSGON
RST 3
DEFB .MCTRL
ENDM
;
POP HL
JP MUSIC1
;
MUSCHO: DEFW 0202H ;Oct data eny ch.
DEFW 0202H
MMCHDA: DEFS 4 ;Play & Noise Data addr
;
MUDNO: DEFS 1 ;total data No.
MUCHNO: DEFS 1 ;ch no.
MMBU1A: DEFS 2 ;MML data buffer
MUNOF: DEFS 1 ;07:MUSIC 08:NOISE
MUNOF2: DEFS 1 ;rotate(MUNOF)
;
SKP H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; MML(HL) => IOCSM(IX) trans
; END code=00H or 0DH or C8H
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
MML.EN: CALL MML.WC
MML.E0: CALL HLFTCH
CALL MMAGCH
JR C,MMTCAL
LD C,0
CALL MML.AG ;String:A-G
JR MMTCA9
;
MMTCAL: CALL MMENCH
JP Z,MMLEND
LD B,12
EX DE,HL
LD HL,MMTCAT ;Call address table
MMTCA0: CP M ;cmp chr
INC HL
JR Z,MMTCAJ
DEC B
JP Z,ER03
INC HL
INC HL
JR MMTCA0
MMTCAJ: LD C,M
INC HL
LD B,M
EX DE,HL
INC HL
CALL .BC
MMTCA9: JP C,ER03
JR MML.E0
;
.BC: PUSH BC
RET
;
MMTCAT: DEFM '#'
DEFW MML.SH
DEFM '+'
DEFW MML.UO
DEFB D7H
DEFW MML.UO
DEFM '-'
DEFW MML.DO
DEFB CFH
DEFW MML.DO
DEFM 'O'
DEFW MML.O
DEFM 'N'
DEFW MML.N
DEFM 'T'
DEFW MML.T
DEFM 'V'
DEFW MML.V
DEFM 'S'
DEFW MML.S
DEFM 'M'
DEFW MML.M
DEFM 'L'
DEFW MML.L
;
MML.DO: LD C,-12 ;-
DEFB 11H
;
MML.UO: LD C,12 ;+
TEST1 "#"
CALL TEST1
DEFB "#"
ENDM
JR NZ,+3
INC C
DEFB 11H
;
MML.SH: LD C,1 ;#
CALL HLFTCH
CALL MMAGCH
RET C
MML.AG: LD B,A
INC HL
CALL MML.DL
CCF
CALL C,MML.L1
RET C
LD A,B
CP 'R'
JR Z,MML.R
PUSH HL
LD HL,ONCTT-41H ;A-G
CALL ADDHLA
LD B,(IY+0)
INC B
LD A,M
POP HL
ADD A,C
SUB 12
ADD A,12
DJNZ -2
JR MML.N0
;
MML.R: XOR A
MML.R0: PUSH AF
CALL MML.WO
POP AF
MML.W1: LD (IX+0),A
INC IX
RET
;
MML.O: CALL MML.DL ;O
JR NC,+4
LD A,2
CP 7
CCF
RET C
LD (IY+0),A ;oct No.
RET
;
MML.N: CALL MML.DL ;N
RET C
MML.N0: CP NMAX+1
CCF
RET C
JR MML.R0
;
MML.T: CALL MML.DL ;T
JR NC,+4
LD A,4
DEC A
CP 7
CCF
RET C
ADD A,6AH
LD (MML.W),A
RET
;
MML.V: CALL MML.DL ;V
JR NC,+4
LD A,15
CP 16
CCF
RET C
ADD A,80H
LD (MML.W+1),A
RET
;
MML.L: CALL MML.DL ;L
JR NC,+4
LD A,5
MML.L1: CP 10
CCF
RET C
MML.L2: ADD A,60H
LD (MML.W+2),A
RET
;
MML.S: CALL MML.DL ;S
RET C
CP 9
CCF
RET C
ADD A,90H
LD (MML.W+3),A
RET
;
MML.M: CALL MML.DL ;M
RET C
OR A
SCF
RET Z
LD B,A
LD C,0A0H
LD (MML.W+4),BC
OR A
RET
;
;
MML.DL: CALL HLFTCH
CALL MMENCH
SCF
CALL NZ,TSTNUM
RET C ;RET not number
SVC .DEASC
RST 3
DEFB .DEASC
ENDM
JP DCHECK
;
MMAGCH: CP 'R' ;A-G & R check
RET Z
CP 'A'
RET C
CP 'H'
CCF
RET
;
MMENCH: OR A
RET Z
CP 0DH
RET Z
CP 0C8H
RET
;
MMLEND: CALL MML.WO
LD A,FFH ;Music Data end
CALL MML.W1
JP MUSI6
;
MML.WO: LD DE,MML.W
LD B,6
LD A,(DE)
OR A
CALL NZ,MML.W1
INC DE
DJNZ -6
;
MML.WC: LD DE,MML.W
LD B,6
JP ?CLRDE
;
;
ONCTT: DEFB 9 ;A
DEFB 11 ;B
DEFB 0 ;C
DEFB 2 ;D
DEFB 4 ;E
DEFB 5 ;F
DEFB 7 ;G
;
MML.W: DEFB 0 ;T
DEFB 0 ;V
DEFB 0 ;L
DEFB 0 ;S
DEFB 0 ;Mn
DEFB 0
;
END

754
asm/mz-xz009/PLT.ASM Normal file
View File

@@ -0,0 +1,754 @@
; -----------------------------
; MZ-800 BASIC Plotter package
; FI:PLT ver 1.0A 8.25.84
; Programed by T.Miho
; -----------------------------
;
INCLD MACRO
;
P.PLT: EQU 0
PNCHNM: DEFB "N" ;N,S,L
;
NEWON: ENT
LD BC,ER59'
LD DE,NEWONT ;NEW ON
NEWON2: LD A,(DE) ; omit plotter
INC DE
ADD A,A
JR Z,NEWON4
LD HL,SJPTBL
CALL ADDHLA
LD M,C
INC HL
LD M,B
JR NEWON2
NEWON4: XOR A ; PLOT OFF
LD (INPFLG),A
LD A,(PNMODE)
DEC A
CALL NZ,MODETX ; PMODE TX
LD HL,NEWAD2
NEWON9: LD (TEXTST),HL
RET
SKP H
;
NEWONT: DEFB A2H ;PMODE
DEFB A3H ;PSKIP
DEFB A4H ;PLOT
DEFB A5H ;PLINE
DEFB A6H ;RLINE
DEFB A7H ;PMOVE
DEFB A8H ;RMOVE
DEFB AEH ;PCOLOR
DEFB AFH ;PHOME
DEFB B0H ;HSET
DEFB B1H ;GPRINT
DEFB B3H ;AXIS
DEFB BBH ;PCIRCLE
DEFB BCH ;PTEST
DEFB BDH ;PAGE
DEFB 0
;
LPTTMD: ENT
LD B,1 ;Check text mode
JR +4
LPTGMD: ENT
LD B,2 ;Check graph mode
LD A,(PNMODE)
CP B
RET Z
JP LPTMER
;
SKP H
;
NEWAD2: ENT
;
MODE: ENT
CALL MODE0 ;"PMODE" command
XOR A
LD (LPOSB),A ;LPT TAB
RET
;
MODE0: LD A,(INPFLG)
OR A
JP NZ,LPTMER
CALL PPCHCK
TEST1 "G"
CALL TEST1
DEFB "G"
ENDM
JP Z,PGRAPH
TESTX "T"
CALL TESTX
DEFB "T"
ENDM
TEST1 "N"
CALL TEST1
DEFB "N"
ENDM
JR Z,TEXTN
TEST1 "L"
CALL TEST1
DEFB "L"
ENDM
JR Z,TEXTN
TESTX "S"
CALL TESTX
DEFB "S"
ENDM
TEXTN: LD (PNCHNM),A
CALL ENDZ
CALL OUTA3H
MODETX: LD A,1
LD (PNMODE),A
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD A,(PNCHNM)
CP "N"
RET Z
CP "L"
LD A,0BH
JR Z,XLPTOT
T80CH: LD A,9
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
XLPTOT: SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
RET
;
OUTA3H: LD A,0AH
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD A,3
JR XLPTOT
;
PGRAPH: INC HL ;Graphic mode
CALL ENDZ
LD A,2
LD (PNMODE),A
JR XLPTOT
SKP H
;
SKIP: ENT
CALL PPCHCK
CALL LPTTMD ;SKIP n
CALL IDEEXP
LD A,E
OR A
RET Z
CP -20
JR NC,SKIPPS
CP 21
JP NC,ER03
SKIPPS: CALL ENDZ
BIT 7,E
JR NZ,SKIPD
SKIPI: LD A,0AH
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
DEC E
JR NZ,SKIPI
RET
;
SKIPD: LD A,03H
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
INC E
JR NZ,SKIPD
RET
;
PNMX99: PUSH HL
LD HL,999
JR +6
PNMX48: PUSH HL
LD HL,480
PUSH HL
ADD HL,DE
POP HL
JR C,PNMX2
SBC HL,DE
JP C,ER03
PNMX2: POP HL
RET
SKP H
;
PLINE: ENT ; PLINE %n,x,y
LD C,"D"
DEFB 11H
RLINE: ENT ; RLINE %n,x,y"
LD C,"J"
DEFB 11H
PMOVE: ENT ; PMOVE x,y
LD C,"M"
DEFB 11H
RMOVE: ENT ; RMOVE x,y
LD C,"R"
CALL PPCHCK
CALL LPTGMD
LD A,C
LD (LINEC+1),A
CP "M"
JR NC,LINE5 ;"M","R"
TEST1 "%"
CALL TEST1
DEFB "%"
ENDM
JR NZ,LINE5
CALL IBYTE
LD A,E
DEC A
CP 16
JP NC,ER03
DEC DE
LD A,"L"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
CALL NUMPLT
CALL LPTCR
CALL ENDCHK
RET Z
CALL CH2CH
LINE5: CALL IDEEXP
CALL CH2CH
CALL PNMX48
PUSH DE
CALL IDEEXP
CP ","
JR Z,LINEXY
CALL ENDZ
LINEXY: CALL PNMX99
POP BC
PUSH DE
LINEC: LD A,0 ;Plotter command
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD E,C
LD D,B
CALL NUMPLT ;X
CALL LPTCOM
POP DE
CALL NUMPLT ;Y
CALL LPTCR
CALL ENDCHK
RET Z
INC HL
JR LINE5
SKP H
;
PCOLOR: ENT
CALL PPCHCK
CALL IBYTE ;PCOLOR n
LD A,E
CP 4
JP NC,ER03
CALL ENDZ
LD A,(PNMODE)
CP 2
JR Z,PNMBR2
CALL OUTA3H
LD A,2
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
CALL PNMBR2
JP PRTTX
;
PNMBR2: LD A,"C"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD A,E
OR 30H
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LPTCR: LD A,0DH
JR +4
LPTCOM: LD A,","
YLPTOT: SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
RET
;
PHOME: ENT
LD C,"H"
DEFB 11H
HSET: ENT
LD C,"I"
CALL LPTGMD ;PHOME / HSET
CALL ENDZ
LD A,C
JR YLPTOT
;
SKP H
;
GPRINT: ENT
CALL PPCHCK
CALL LPTGMD ;GPRINT [n,s],x$
TEST1 "["
CALL TEST1
DEFB "["
ENDM
JR NZ,SYMBL2
CALL IBYTE
CP 64
JP NC,ER03
PUSH DE
CALL HCH2CH
CALL IBYTE
CP 4
JP NC,ER03
PUSH DE
TESTX "]"
CALL TESTX
DEFB "]"
ENDM
POP BC
POP DE
PUSH BC
LD A,"S"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
CALL NUMPLT
CALL LPTCOM
POP DE
LD A,"Q"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
CALL NUMPLT
CALL LPTCR
CALL ENDCHK
RET Z
CALL CH2CH
SYMBL2: CALL STREXP
CALL ENDCHK
JR Z,SYMBL5
CALL CH2CH
DEC HL
SYMBL5: LD A,B
OR A
JR Z,SYMBL4
LD A,"P"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
SYMBL3: LD A,(DE)
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
INC DE
DJNZ SYMBL3
CALL LPTCR
SYMBL4: CALL ENDCHK
RET Z
INC HL
JR SYMBL2
SKP H
;
AXIS: ENT
CALL LPTGMD ;AXIS x,p,r
CALL IBYTE
CP 2
JP NC,ER03
PUSH AF
CALL HCH2CH
CALL IDEEXP
PUSH DE
CALL CH2CH
CALL IBYTE
OR A
JP Z,ER03
CALL ENDZ
LD A,"X"
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
POP BC
POP AF
PUSH DE
PUSH BC
OR 30H
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
CALL LPTCOM
POP DE
CALL PNMX99
CALL NUMPLT
CALL LPTCOM
POP DE
CALL NUMPLT
JP LPTCR
SKP H
;
PCIRCLE:ENT
CALL LPTGMD ;PCIRCLE x,y,r,s,e,d
PUSH HL
LD DE,0
LD HL,CRS
CALL FLTHEX
LD DE,360
LD HL,CRE
CALL FLTHEX
LD HL,FLTEN
LD DE,CRTEN
CALL LDIR5
POP HL
CALL EXPR ;X
CALL CH2CH
PUSH HL
LD HL,CRX
EX DE,HL
CALL LDIR5
POP HL
CALL EXPR ;Y
CALL CH2CH
PUSH HL
LD HL,CRY
EX DE,HL
CALL LDIR5
POP HL
CALL EXPR ;R
PUSH HL
PUSH AF
LD HL,CRR
EX DE,HL
CALL LDIR5
LD A,(CRR+1)
RLCA
JP C,ER03
POP AF
CP ","
JR NZ,CIREND
POP HL
INC HL
CALL EXPR ;S
PUSH HL
PUSH AF
LD HL,CRS
EX DE,HL
CALL LDIR5
POP AF
CP ","
JR NZ,CIREND
POP HL
INC HL
CALL EXPR ;E
PUSH HL
PUSH AF
LD HL,CRE
EX DE,HL
CALL LDIR5
POP AF
CP ","
JR NZ,CIREND
POP HL
INC HL
CALL EXPR ;D
PUSH HL
LD HL,CRTEN
EX DE,HL
CALL LDIR5
LD A,(CRTEN+1)
RLCA
JP C,ER03
CIREND:
POP HL
CALL ENDZ
PUSH HL
;
LD HL,CRE
LD DE,CRS
LD A,(CRTEN)
OR A
CALL NZ,CMP
JP C,ER03
;
CALL CRXYRS ;CAL X,Y
;
LD HL,CRXX ;MOVE X,Y
LD (CRMOVX+1),HL
LD HL,CRYY
LD (CRMOVY+1),HL
CALL CRMOVE
LD A,(CRTEN)
OR A
JR Z,CREDLI
;
CRCLP: LD HL,CRS ;S+D
LD DE,CRTEN
CALL ADD
LD DE,CRE
CALL CMP
JR NC,EDLINE
CALL CRXYRS
CALL CRLINE
;
SVC .BREAK
RST 3
DEFB .BREAK
ENDM
JR NZ,CRCLP
;
POP HL
RET
;
EDLINE: CALL CREDST
CALL CRLINE
POP HL
RET
;
CREDST: LD HL,CRE
LD DE,CRS
LD BC,5
LDIR
JR CRXYRS
;
CREDLI: LD HL,CRX
LD (CRMOVX+1),HL
LD HL,CRY
LD (CRMOVY+1),HL
CALL CRLINE
CALL CREDST
LD HL,CRXX
LD (CRMOVX+1),HL
LD HL,CRYY
LD (CRMOVY+1),HL
CALL CRLINE
POP HL
RET
;
CRLINE: LD A,"D"
DEFB 21H
CRMOVE: LD A,"M"
PUSH AF
CRMOVX: LD HL,CRX
CALL HLFLT
PUSH HL
EX DE,HL
CALL PNMX99
CRMOVY: LD HL,CRY
CALL HLFLT
PUSH HL
EX DE,HL
CALL PNMX99
POP HL
POP DE
POP AF
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
PUSH HL
CALL NUMPLT
CALL LPTCOM
POP DE
CALL NUMPLT
JP LPTCR
;
CRXYRS: LD DE,(INTFAC)
LD HL,CRS
CALL LDIR5
LD HL,(INTFAC)
CALL RAD
CALL COS
LD DE,CRR
CALL MUL
LD DE,CRX
CALL ADD
LD DE,CRXX
CALL LDIR5
LD DE,(INTFAC)
LD HL,CRS
CALL LDIR5
LD HL,(INTFAC)
CALL RAD
CALL SIN
LD DE,CRR
CALL MUL
LD DE,CRY
CALL ADD
LD DE,CRYY
JP LDIR5
;
CRX: DEFS 5
CRY: DEFS 5
CRR: DEFS 5
CRS: DEFS 5
CRE: DEFS 5
CRTEN: DEFS 5
CRXX: DEFS 5
CRYY: DEFS 5
DEFS 5
;
;
;
NUMPLT: PUSH AF
PUSH HL
LD HL,(INTFAC)
CALL FLTHEX
CALL CVNMFL
SVC .COUNT
RST 3
DEFB .COUNT
ENDM
NUMPL2: LD A,(DE)
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
INC DE
DJNZ NUMPL2
POP HL
POP AF
RET
;
SKP H
;
TEST: ENT
CALL PPCHCK
CALL LPTTMD ;TEST command
CALL ENDZ
LD A,04H
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
RET
;
PAGE: ENT
CALL LPTTMD ;PAGE n
CALL IDEEXP
LD A,E
OR A
JP Z,ER03
CP 73
JP NC,ER03
CALL ENDZ
LD A,9
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD A,(PSEL)
BIT P.PLT,A
JR Z,PAGE2
CALL NUMPLT ;Plotter only
JP LPTCR
PAGE2: LD A,E ;Except plotter
LD DE,KEYBUF
CALL HEXACC
DEC DE
DEC DE
LD A,(DE)
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
INC DE
LD A,(DE)
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
RET
;
PLOT: ENT
LD A,M
CP 9DH ;PLOT ON/OFF
JR Z,PLOTO'
CP A1H ;OFF
JP NZ,ER01
XOR A
PLOTOK: LD (INPFLG),A
INC HL
RET
PLOTO': CALL LPTTMD
CALL PPCHCK
LD A,(PNCHNM)
CP "L"
JP Z,LPTMER
CALL PRTTX
PL40C: LD A,(INPFLG)
OR A
JR NZ,PLOTOK
CALL CONSOI
LD A,16H
SVC .CRT1C
RST 3
DEFB .CRT1C
ENDM
OR 01H
JR PLOTOK
;
PRTTX: LD A,1
SVC .LPTOT
RST 3
DEFB .LPTOT
ENDM
LD A,(CRTMD2)
CP 3
RET C
CALL T80CH
RET
;
PPCHCK: LD A,(PSEL)
BIT P.PLT,A ;if not plotter
JP Z,LPTMER ; then err
RET
;
NEWAD0: ENT
;
END

1346
asm/mz-xz009/STMNT.ASM Normal file

File diff suppressed because it is too large Load Diff

5
asm/mz-xz009/XSYS.ASM Normal file
View File

@@ -0,0 +1,5 @@
;
;
ORG 5800H
$START: ENT
END

9
asm/mz-xz009/XWORK.ASM Normal file
View File

@@ -0,0 +1,9 @@
ORG 2000H
TEXTBF:
DEFS 2000
;
; work area
;
DIRARE: ENT ;DIR area
DEFS 800H
END

1631
asm/mz2000_ipl.asm Normal file

File diff suppressed because it is too large Load Diff

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"

5
asm/mz2000_ipl_tzpu.asm Normal file
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"

2952
asm/mz800_1z_013b.asm Normal file

File diff suppressed because it is too large Load Diff

3164
asm/mz800_9z_504m.asm Normal file

File diff suppressed because it is too large Load Diff

1613
asm/mz800_iocs.asm Normal file

File diff suppressed because it is too large Load Diff

369
asm/mz80afi.asm Normal file
View File

@@ -0,0 +1,369 @@
; 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 (IX) ; No data, jump in place whilst waiting.
; Ensure we fill the entire 1K by padding with FF's.
ALIGN 0EFFDh
DB 0FFh
LF7FE: JP (IY) ; Data ready, jump to store.

904
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
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
asm/nascombasic.asm Normal file

File diff suppressed because it is too large Load Diff

155
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

7525
asm/sa-5510_tzfs.asm Normal file

File diff suppressed because it is too large Load Diff

2833
asm/sa1510.asm Normal file

File diff suppressed because it is too large Load Diff

1658
asm/sfd700.asm Normal file

File diff suppressed because it is too large Load Diff

2657
asm/sharpmz-test.asm Normal file

File diff suppressed because it is too large Load Diff

2254
asm/testtz.asm Normal file

File diff suppressed because it is too large Load Diff

2522
asm/tzfs.asm Normal file

File diff suppressed because it is too large Load Diff

553
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
asm/tzfs_bank3.asm Normal file

File diff suppressed because it is too large Load Diff

344
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

73
buildhost.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/bash
ROOT_DIR=/dvlp/Projects/TZFS/
SW_DIR=${ROOT_DIR}/
PROCESS_MZF_FILES=0
if [ "x$1" = '-m' ]; then
PROCESS_MZF_FILES=1
fi
(
cd $SW_DIR
tools/assemble_tzfs.sh
if [ $? != 0 ]; then
echo "TZFS assembly failed..."
exit 1
fi
tools/assemble_roms.sh
if [ $? != 0 ]; then
echo "ROMS assembly failed..."
exit 1
fi
tools/assemble_cpm.sh
if [ $? != 0 ]; then
echo "CPM assembly failed..."
exit 1
fi
# Only needed if the program source tree changes, takes too long to run on every build!
if [[ ${PROCESS_MFZ_FILES} -eq 1 ]]; then
tools/processMZFfiles.sh
if [ $? != 0 ]; then
echo "Failed to process MZF files into sectored variants...."
exit 1
fi
fi
tools/make_cpmdisks.sh
if [ $? != 0 ]; then
echo "CPM disks assembly failed..."
exit 1
fi
)
if [ $? != 0 ]; then
exit 1
fi
# USE tools/copytosd.sh for copying TZFS to SD card.
# 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-80A, MZ-700, MZ-800, 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.
echo "Done!"

1623
config/diskdefs Normal file

File diff suppressed because it is too large Load Diff

7511
dis/1Z-013B/SA-5510.asm Normal file

File diff suppressed because it is too large Load Diff

568
dis/1Z-013B/SA-5510.ini Normal file
View File

@@ -0,0 +1,568 @@
----------------------------------------
-- dZ80 configuration file
----------------------------------------
----------------------------------------
-- Disassembly control
----------------------------------------
cpu="z80"
inputfile="SA-5510.bin"
outputfile="SA-5510.asm"
--fileheadersize=27
filebaseaddr=4605
disstart=0
disend=16946
--disstart=0
--disend=3584
--quiet=0
labelledoutput=1
----------------------------------------
-- Layout
----------------------------------------
labelreference=1
addresscolumn=1
opcodecolumn=1
relativejumpcomment=1
uppercase=1
autoblanklines=1
db="db"
comment="; "
radix=16
numprefix="0"
numsuffix="H"
----------------------------------------
-- Scripts
----------------------------------------
--script="scripts\\spectrum.lua"
----------------------------------------
-- References
----------------------------------------
referencefile="SA-5510.ref"
inportreference=1
outportreference=1
addressreference=1
indirectaddressreference=1
limitreferences=1
----------------------------------------
-- Opcode mapfile and code/data areas
----------------------------------------
--opmapfile="mayhem.map"
-- Code Region isnt required as v2.x sets the entire region to code unless a data region overrides it.
-- d_SetCodeRegion(4608, 2464)
-- Set the known data regions, either as a data region (byte), word or string. The type affects the assembly output definitions and word
-- regions will attempt to map to an address, ie. jump tables will be setup with labels rather than constants.
d_SetDataRegion( hex("1347"), 100) -- 0x1347
d_SetStringRegion(hex("1347"), 28)
d_SetStringRegion(hex("1364"), 31)
d_SetStringRegion(hex("1384"), 5)
d_SetStringRegion(hex("138A"), 6)
d_SetStringRegion(hex("1391"), 3)
d_SetStringRegion(hex("1395"), 6)
d_SetStringRegion(hex("139C"), 6)
d_SetDataRegion( hex("2FC2"), 30)
d_SetStringRegion(hex("2FC2"), 6)
d_SetStringRegion(hex("2FC9"), 8)
d_SetStringRegion(hex("2FD2"), 10)
d_SetStringRegion(hex("2FDD"), 2)
d_SetStringRegion(hex("1D44"), 9)
-- Reserved key words.
d_SetDataRegion( hex("15A8"), 402) -- 0x15A8 Start of tokens.
d_SetStringRegion(hex("15A8"), 2) -- 0 - REM
d_SetStringRegion(hex("15AB"), 3) -- 1 - DATA
d_SetStringRegion(hex("15AF"), 0) -- 2 - undefined
d_SetStringRegion(hex("15B0"), 0) -- 3 - undefined
d_SetStringRegion(hex("15B1"), 3) -- 4 - READ
d_SetStringRegion(hex("15B5"), 3) -- 5 - LIST
d_SetStringRegion(hex("15B9"), 2) -- 6 - RUN
d_SetStringRegion(hex("15BC"), 2) -- 7 - NEW
d_SetStringRegion(hex("15BF"), 4) -- 8 - PRINT
d_SetStringRegion(hex("15C4"), 2) -- 9 - LET
d_SetStringRegion(hex("15C7"), 2) -- 10 - FOR
d_SetStringRegion(hex("15CA"), 1) -- 11 - IF
d_SetStringRegion(hex("15CC"), 3) -- 12 - THEN
d_SetStringRegion(hex("15D0"), 3) -- 13 - GOTO
d_SetStringRegion(hex("15D4"), 4) -- 14 - GOSUB
d_SetStringRegion(hex("15D9"), 5) -- 15 - RETURN
d_SetStringRegion(hex("15DF"), 3) -- 16 - NEXT
d_SetStringRegion(hex("15E3"), 3) -- 17 - STOP
d_SetStringRegion(hex("15E7"), 2) -- 18 - END
d_SetStringRegion(hex("15EA"), 0) -- 19 - undefined
d_SetStringRegion(hex("15EB"), 1) -- 20 - ON
d_SetStringRegion(hex("15ED"), 3) -- 21 - LOAD
d_SetStringRegion(hex("15F1"), 3) -- 22 - SAVE
d_SetStringRegion(hex("15F5"), 5) -- 23 - VERIFY
d_SetStringRegion(hex("15FB"), 3) -- 24 - POKE
d_SetStringRegion(hex("15FF"), 2) -- 25 - DIM
d_SetStringRegion(hex("1602"), 5) -- 26 - DEF FN
d_SetStringRegion(hex("1608"), 4) -- 27 - INPUT
d_SetStringRegion(hex("160D"), 6) -- 28 - RESTORE
d_SetStringRegion(hex("1614"), 2) -- 29 - CLS
d_SetStringRegion(hex("1617"), 4) -- 30 - MUSIC
d_SetStringRegion(hex("161C"), 4) -- 31 - TEMPO
d_SetStringRegion(hex("1621"), 3) -- 32 - USRN
d_SetStringRegion(hex("1625"), 4) -- 33 - WOPEN
d_SetStringRegion(hex("162A"), 4) -- 34 - ROPEN
d_SetStringRegion(hex("162F"), 4) -- 35 - CLOSE
d_SetStringRegion(hex("1634"), 2) -- 36 - MON
d_SetStringRegion(hex("1637"), 4) -- 37 - LIMIT
d_SetStringRegion(hex("163C"), 3) -- 38 - CONT
d_SetStringRegion(hex("1640"), 2) -- 39 - GET
d_SetStringRegion(hex("1643"), 3) -- 40 - INP@
d_SetStringRegion(hex("1647"), 3) -- 41 - OUT@
d_SetStringRegion(hex("164B"), 5) -- 42 - CURSOR
d_SetStringRegion(hex("1651"), 2) -- 43 - SET
d_SetStringRegion(hex("1654"), 4) -- 44 - RESET
d_SetStringRegion(hex("1659"), 0) -- 45 - undefined
d_SetStringRegion(hex("165A"), 0) -- 46 - undefined
d_SetStringRegion(hex("165B"), 0) -- 47 - undefined
d_SetStringRegion(hex("165C"), 0) -- 48 - undefined
d_SetStringRegion(hex("165D"), 0) -- 49 - undefined
d_SetStringRegion(hex("165E"), 0) -- 59 - undefined
d_SetStringRegion(hex("165F"), 3) -- 51 - AUTO
d_SetStringRegion(hex("1663"), 0) -- 52 - undefined
d_SetStringRegion(hex("1664"), 0) -- 53 - undefined
d_SetStringRegion(hex("1665"), 5) -- 54 - COPY/P
d_SetStringRegion(hex("166B"), 5) -- 55 - PAGE/P
d_SetStringRegion(hex("1671"), 0) -- 56 - undefined
d_SetStringRegion(hex("1672"), 0) -- 57 - undefined
d_SetStringRegion(hex("1673"), 0) -- 58 - undefined
d_SetStringRegion(hex("1674"), 0) -- 59 - undefined
d_SetStringRegion(hex("1675"), 0) -- 60 - undefined
d_SetStringRegion(hex("1676"), 0) -- 61 - undefined
d_SetStringRegion(hex("1677"), 0) -- 62 - undefined
d_SetStringRegion(hex("1678"), 0) -- 63 - undefined
d_SetStringRegion(hex("1679"), 0) -- 64 - undefined
d_SetStringRegion(hex("167A"), 0) -- 65 - undefined
d_SetStringRegion(hex("167B"), 1) -- 66 - undefined
d_SetStringRegion(hex("167D"), 1) -- 67 - undefined
-- Functions
d_SetStringRegion(hex("167F"), 1) -- >=
d_SetStringRegion(hex("1681"), 1) -- <>
d_SetStringRegion(hex("1683"), 1) -- =<
d_SetStringRegion(hex("1685"), 1) -- <=
d_SetStringRegion(hex("1687"), 1) -- <=
d_SetStringRegion(hex("1689"), 1) -- <=
d_SetStringRegion(hex("168B"), 0) -- undefined
d_SetStringRegion(hex("168C"), 0) -- <=
d_SetStringRegion(hex("168D"), 0) -- <=
d_SetStringRegion(hex("168E"), 0) -- undefined
d_SetStringRegion(hex("168F"), 0) -- undefined
d_SetStringRegion(hex("1690"), 0) -- undefined
d_SetStringRegion(hex("1691"), 0) -- undefined
d_SetStringRegion(hex("1692"), 0) -- undefined
d_SetStringRegion(hex("1693"), 0) -- undefined
d_SetStringRegion(hex("1694"), 0) -- undefined
d_SetStringRegion(hex("1695"), 0) -- undefined
d_SetStringRegion(hex("1696"), 0) -- undefined
d_SetStringRegion(hex("1697"), 0) -- undefined
d_SetStringRegion(hex("1698"), 0) -- undefined
d_SetStringRegion(hex("1699"), 0) -- undefined
d_SetStringRegion(hex("169A"), 0) -- undefined
d_SetStringRegion(hex("169B"), 0) -- undefined
d_SetStringRegion(hex("169C"), 0) -- undefined
d_SetStringRegion(hex("169D"), 0) -- undefined
d_SetStringRegion(hex("168E"), 0) -- undefined
d_SetStringRegion(hex("168F"), 0) -- undefined
d_SetStringRegion(hex("16A0"), 1) -- TO
d_SetStringRegion(hex("16A2"), 3) -- STEP
d_SetStringRegion(hex("16A6"), 5) -- LEFT$(
d_SetStringRegion(hex("16AC"), 6) -- RIGHT$(
d_SetStringRegion(hex("16B3"), 4) -- MID$(
d_SetStringRegion(hex("16B8"), 3) -- LEN(
d_SetStringRegion(hex("16BC"), 4) -- CHR$(
d_SetStringRegion(hex("16C1"), 4) -- STR$(
d_SetStringRegion(hex("16C6"), 3) -- ASC(
d_SetStringRegion(hex("16CA"), 3) -- VAL(
d_SetStringRegion(hex("16CE"), 4) -- PEEK(
d_SetStringRegion(hex("16D3"), 3) -- TAB(
d_SetStringRegion(hex("16D7"), 6) -- SPACE$(
d_SetStringRegion(hex("16DE"), 3) -- SIZE
d_SetStringRegion(hex("16E2"), 2) -- undefined
d_SetStringRegion(hex("16E5"), 6) -- STRING$(
d_SetStringRegion(hex("16ED"), 0) -- undefined
d_SetStringRegion(hex("16EE"), 10) -- CHARACTER$(
d_SetStringRegion(hex("16F9"), 2) -- CSR
d_SetStringRegion(hex("16FC"), 12) -- undefined
d_SetStringRegion(hex("1709"), 3) -- RND(
d_SetStringRegion(hex("170D"), 3) -- SIN(
d_SetStringRegion(hex("1711"), 3) -- COS(
d_SetStringRegion(hex("1715"), 3) -- TAN(
d_SetStringRegion(hex("1719"), 3) -- ATN(
d_SetStringRegion(hex("171D"), 3) -- EXP(
d_SetStringRegion(hex("1721"), 3) -- INT(
d_SetStringRegion(hex("1725"), 3) -- LOG(
d_SetStringRegion(hex("1729"), 2) -- LN(
d_SetStringRegion(hex("172C"), 3) -- ABS(
d_SetStringRegion(hex("1730"), 3) -- SGN(
d_SetStringRegion(hex("1734"), 3) -- SQR(
d_SetStringRegion(hex("1738"), 2) -- End of Table
d_SetDataRegion( hex("13AB"), 77) -- 0x13AB
d_SetStringRegion(hex("4223"), 15) -- 0x4223 BASIC SA-5510
d_SetDataRegion( hex("1D15"), 2) -- 0x1D15 Data
d_SetDataRegion( hex("1C4C"), 1)
d_SetDataRegion( hex("1C63"), 1) -- 0x1C63 Data
d_SetWordRegion( hex("1BB2"), 128) -- 0x1BB2 Data
d_SetDataRegion( hex("3400"), 3) -- 0x3400 Data
d_SetDataRegion( hex("3404"), 1) -- 0x3404 Data
d_SetDataRegion( hex("2355"), 1) -- 0x2355 Data
d_SetDataRegion( hex("239F"), 1) -- 0x239f Data
d_SetWordRegion( hex("2691"), 34)
d_SetWordRegion( hex("26B3"), 40)
d_SetWordRegion( hex("26DB"), 24)
d_SetDataRegion( hex("26F3"), 6)
d_SetDataRegion( hex("27B2"), 2) -- 0x27B2 Data
d_SetDataRegion( hex("2884"), 1) -- 0x2885 Data
d_SetDataRegion( hex("2A83"), 25) -- 0x2A83 Data
--d_SetDataRegion( hex("2B3D"), 2) -- 0x2B3D Data
--d_SetDataRegion( hex("2D1D"), 2) -- 0x2D1D Data
-- Function table.
d_SetWordRegion( hex("22E1"), 18)
-- Function calls, CALL <Operation Byte> <Function>
d_SetDataRegion( hex("204A"), 2)
d_SetDataRegion( hex("12CE"), 1)
d_SetWordRegion( hex("12CF"), 2)
d_SetDataRegion( hex("1A78"), 1)
d_SetWordRegion( hex("1A79"), 2)
d_SetDataRegion( hex("1C54"), 1)
d_SetWordRegion( hex("1C55"), 2)
d_SetDataRegion( hex("1E23"), 1)
d_SetWordRegion( hex("1E24"), 2)
d_SetDataRegion( hex("20EB"), 1)
d_SetWordRegion( hex("20EC"), 2)
d_SetDataRegion( hex("21B3"), 1)
d_SetWordRegion( hex("21B4"), 2)
d_SetDataRegion( hex("287F"), 1)
d_SetWordRegion( hex("2880"), 2)
d_SetDataRegion( hex("2949"), 1)
d_SetWordRegion( hex("294A"), 2)
d_SetDataRegion( hex("29A2"), 1)
d_SetWordRegion( hex("29A3"), 2)
d_SetDataRegion( hex("2A3A"), 1)
d_SetWordRegion( hex("2A3B"), 2)
d_SetDataRegion( hex("2A4E"), 1)
d_SetWordRegion( hex("2A4F"), 2)
d_SetDataRegion( hex("2B10"), 1)
d_SetWordRegion( hex("2B11"), 2)
d_SetDataRegion( hex("2B32"), 1)
d_SetWordRegion( hex("2B33"), 2)
d_SetDataRegion( hex("2B6C"), 1)
d_SetWordRegion( hex("2B6D"), 2)
d_SetDataRegion( hex("2C05"), 1)
d_SetWordRegion( hex("2C06"), 2)
d_SetDataRegion( hex("2CFF"), 1)
d_SetWordRegion( hex("2D00"), 2)
d_SetDataRegion( hex("2D56"), 1)
d_SetWordRegion( hex("2D57"), 2)
d_SetDataRegion( hex("2D5C"), 1)
d_SetWordRegion( hex("2D5D"), 2)
d_SetDataRegion( hex("2CB2"), 1)
d_SetWordRegion( hex("2CB3"), 2)
d_SetDataRegion( hex("2D78"), 1)
d_SetWordRegion( hex("2D79"), 2)
d_SetDataRegion( hex("2D88"), 1)
d_SetWordRegion( hex("2D89"), 2)
d_SetDataRegion( hex("2D95"), 1)
d_SetWordRegion( hex("2D96"), 2)
d_SetDataRegion( hex("2DA2"), 1)
d_SetWordRegion( hex("2DA3"), 2)
d_SetDataRegion( hex("2DB0"), 1)
d_SetWordRegion( hex("2DB1"), 2)
d_SetDataRegion( hex("2E97"), 1)
d_SetWordRegion( hex("2E98"), 2)
d_SetDataRegion( hex("2FE7"), 1)
d_SetWordRegion( hex("2FE8"), 2)
d_SetDataRegion( hex("3323"), 1)
d_SetWordRegion( hex("3324"), 2)
d_SetDataRegion( hex("2D74"), 1)
d_SetDataRegion( hex("2E33"), 32)
d_SetDataRegion( hex("2EB0"), 3)
d_SetDataRegion( hex("2F8C"), 2)
d_SetDataRegion( hex("2FE8"), 2)
d_SetDataRegion( hex("37AE"), 269)
d_SetDataRegion( hex("3CE7"), 30)
d_SetDataRegion( hex("3F05"), 48)
d_SetDataRegion( hex("4041"), 35)
d_SetDataRegion( hex("406F"), 7)
d_SetDataRegion( hex("4121"), 56)
d_SetDataRegion( hex("18BE"), 3)
d_SetDataRegion( hex("18D7"), 3)
d_SetDataRegion( hex("1CAA"), 2)
d_SetWordRegion( hex("1D90"), 2)
d_SetDataRegion( hex("2104"), 3)
--d_SetDataRegion( hex("2221"), 3)
d_SetDataRegion( hex("2317"), 1)
d_SetDataRegion( hex("270F"), 3)
d_SetWordRegion( hex("2929"), 2)
d_SetDataRegion( hex("2A14"), 2)
d_SetDataRegion( hex("2A2A"), 2)
d_SetDataRegion( hex("2C8B"), 3)
d_SetWordRegion( hex("2CDE"), 2)
d_SetDataRegion( hex("2D10"), 2)
d_SetWordRegion( hex("2D90"), 2)
d_SetDataRegion( hex("30F4"), 3)
d_SetDataRegion( hex("3BE9"), 25)
d_SetDataRegion( hex("4118"), 3)
d_SetDataRegion( hex("3DED"), 5)
d_SetDataRegion( hex("3DF2"), 5)
d_SetDataRegion( hex("3DF7"), 5)
d_SetDataRegion( hex("3DFC"), 5)
d_SetDataRegion( hex("1B42"), 1)
d_SetDataRegion( hex("1C5A"), 1)
d_SetDataRegion( hex("1D02"), 1)
d_SetDataRegion( hex("1D89"), 1)
d_SetDataRegion( hex("1F31"), 1)
d_SetDataRegion( hex("204F"), 1)
d_SetDataRegion( hex("208F"), 1)
d_SetDataRegion( hex("2116"), 1)
d_SetDataRegion( hex("220F"), 1)
d_SetDataRegion( hex("221B"), 1)
d_SetDataRegion( hex("221F"), 1)
d_SetDataRegion( hex("245F"), 1)
d_SetDataRegion( hex("24FD"), 1)
d_SetDataRegion( hex("2715"), 1)
d_SetDataRegion( hex("284E"), 1)
d_SetDataRegion( hex("2855"), 1)
d_SetDataRegion( hex("288F"), 1)
d_SetDataRegion( hex("28C6"), 1)
d_SetDataRegion( hex("2AB3"), 1)
d_SetDataRegion( hex("2B75"), 1)
d_SetDataRegion( hex("2C21"), 1)
d_SetDataRegion( hex("2CEF"), 1)
d_SetDataRegion( hex("2D7E"), 1)
d_SetDataRegion( hex("2D8E"), 1)
d_SetDataRegion( hex("2D9B"), 1)
d_SetDataRegion( hex("2DA8"), 1)
d_SetDataRegion( hex("2DB6"), 1)
-- Create a mapping table of known Sharp I/O ports and 8 bit constants.
--
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetByteEquate(hex("FE") , 1, "PRTC" )
d_SetByteEquate(hex("FF") , 1, "PRTD" )
-- Create a mapping table of known Sharp MZ BIOS/Memory Mapped Hardware addresses which dz80
-- can use to replace an address with the label. The EQU list will also be output at the start
-- of the disassembly file so it can compile.
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetWordEquate(hex("0003"), 1, "GETL" )
d_SetWordEquate(hex("0006"), 1, "LETNL" )
d_SetWordEquate(hex("0009"), 1, "NL" )
d_SetWordEquate(hex("000C"), 1, "PRNTS" )
d_SetWordEquate(hex("000F"), 1, "PRNTT" )
d_SetWordEquate(hex("0012"), 1, "PRNT" )
d_SetWordEquate(hex("0015"), 1, "MSG" )
d_SetWordEquate(hex("0018"), 1, "MSGX" )
d_SetWordEquate(hex("001B"), 1, "GETKY" )
d_SetWordEquate(hex("001E"), 1, "BRKEY" )
d_SetWordEquate(hex("0021"), 1, "?WRI" )
d_SetWordEquate(hex("0024"), 1, "?WRD" )
d_SetWordEquate(hex("0027"), 1, "?RDI" )
d_SetWordEquate(hex("002A"), 1, "?RDD" )
d_SetWordEquate(hex("002D"), 1, "?VRFY" )
d_SetWordEquate(hex("0030"), 1, "MELDY" )
d_SetWordEquate(hex("0033"), 1, "?TMST" )
d_SetWordEquate(hex("003B"), 1, "TIMRD" )
d_SetWordEquate(hex("003E"), 1, "BELL" )
d_SetWordEquate(hex("0041"), 1, "XTEMP" )
d_SetWordEquate(hex("0044"), 1, "MSTA" )
d_SetWordEquate(hex("0047"), 1, "MSTP" )
d_SetWordEquate(hex("0000"), 1, "MONIT" )
d_SetWordEquate(hex("0089"), 1, "SS" )
d_SetWordEquate(hex("0095"), 1, "ST1" )
d_SetWordEquate(hex("0410"), 1, "HLHEX" )
d_SetWordEquate(hex("041F"), 1, "_2HEX" )
d_SetWordEquate(hex("074D"), 1, "?MODE" )
d_SetWordEquate(hex("08CA"), 1, "?KEY" )
d_SetWordEquate(hex("096C"), 1, "PRNT3" )
d_SetWordEquate(hex("0BB9"), 1, "?ADCN" )
d_SetWordEquate(hex("0BCE"), 1, "?DACN" )
d_SetWordEquate(hex("0DB5"), 1, "?DSP" )
d_SetWordEquate(hex("0DA6"), 1, "?BLNK" )
d_SetWordEquate(hex("0DDC"), 1, "?DPCT" )
d_SetWordEquate(hex("03BA"), 1, "PRTHL" )
d_SetWordEquate(hex("03C3"), 1, "PRTHX" )
d_SetWordEquate(hex("03DA"), 1, "ASC" )
d_SetWordEquate(hex("03F9"), 1, "HEX" )
d_SetWordEquate(hex("0DDC"), 1, "DPCT" )
d_SetWordEquate(hex("0DA7"), 1, "DLY12" )
d_SetWordEquate(hex("0DAA"), 1, "DLY12A" )
d_SetWordEquate(hex("0EE6"), 1, "?RSTR1" )
d_SetWordEquate(hex("06A3"), 1, "MOTOR" )
d_SetWordEquate(hex("071A"), 1, "CKSUM" )
d_SetWordEquate(hex("077A"), 1, "GAP" )
d_SetWordEquate(hex("0485"), 1, "WTAPE" )
d_SetWordEquate(hex("0700"), 1, "MSTOP" )
d_SetWordEquate(hex("11FD"), 1, "TAPECOPY" )
d_SetWordEquate(hex("1200"), 1, "COLDSTRT" )
d_SetWordEquate(hex("1250"), 1, "WARMSTRTMON")
d_SetWordEquate(hex("15A8"), 1, "CMDWORDTBL" )
d_SetWordEquate(hex("1BB2"), 1, "CMDJMPTBL" )
d_SetWordEquate(hex("2E33"), 1, "CMTBUF" )
d_SetWordEquate(hex("2E34"), 1, "CMTFNAME" )
d_SetWordEquate(hex("1C3C"), 1, "CMDREMDATA" )
d_SetWordEquate(hex("13AB"), 1, "SYNTAXERR" )
d_SetWordEquate(hex("2D12"), 1, "CMDREAD" )
d_SetWordEquate(hex("1C4D"), 1, "CMDLIST" )
d_SetWordEquate(hex("1E91"), 1, "CMDRUN" )
d_SetWordEquate(hex("1C42"), 1, "CMDNEW" )
d_SetWordEquate(hex("2B0D"), 1, "CMDPRINT" )
d_SetWordEquate(hex("1D6A"), 1, "CMDLET" )
d_SetWordEquate(hex("1F2B"), 1, "CMDFOR" )
d_SetWordEquate(hex("21AD"), 1, "CMDIF" )
d_SetWordEquate(hex("13AB"), 1, "CMDTHEN" )
d_SetWordEquate(hex("1EA6"), 1, "CMDGOTO" )
d_SetWordEquate(hex("1EC7"), 1, "CMDGOSUB" )
d_SetWordEquate(hex("1EF8"), 1, "CMDRETURN" )
d_SetWordEquate(hex("1FC0"), 1, "CMDNEXT" )
d_SetWordEquate(hex("1D2C"), 1, "CMDSTOP" )
d_SetWordEquate(hex("1D15"), 1, "CMDEND" )
d_SetWordEquate(hex("203E"), 1, "CMDON" )
d_SetWordEquate(hex("2D75"), 1, "CMDLOAD" )
d_SetWordEquate(hex("2D82"), 1, "CMDSAVE" )
d_SetWordEquate(hex("2EB3"), 1, "CMDVERIFY" )
d_SetWordEquate(hex("2191"), 1, "CMDPOKE" )
d_SetWordEquate(hex("2080"), 1, "CMDDIM" )
d_SetWordEquate(hex("2201"), 1, "CMDDEFFN" )
d_SetWordEquate(hex("2BFF"), 1, "CMDINPUT" )
d_SetWordEquate(hex("1D4D"), 1, "CMDRESTORE" )
d_SetWordEquate(hex("21A6"), 1, "CMDCLS" )
d_SetWordEquate(hex("2269"), 1, "CMDMUSIC" )
d_SetWordEquate(hex("2282"), 1, "CMDTEMPO" )
d_SetWordEquate(hex("2942"), 1, "CMDUSRN" )
d_SetWordEquate(hex("2D9F"), 1, "CMDWOPEN" )
d_SetWordEquate(hex("2D92"), 1, "CMDROPEN" )
d_SetWordEquate(hex("2DAD"), 1, "CMDCLOSE" )
d_SetWordEquate(hex("28B6"), 1, "CMDMON" )
d_SetWordEquate(hex("2967"), 1, "CMDLIMIT" )
d_SetWordEquate(hex("29CE"), 1, "CMDCONT" )
d_SetWordEquate(hex("2902"), 1, "CMDGET" )
d_SetWordEquate(hex("29FE"), 1, "CMDINP" )
d_SetWordEquate(hex("2A1C"), 1, "CMDOUT" )
d_SetWordEquate(hex("28B9"), 1, "CMDCURSOR" )
d_SetWordEquate(hex("2AA6"), 1, "CMDSET" )
d_SetWordEquate(hex("2AAA"), 1, "CMDRESET" )
d_SetWordEquate(hex("2A2F"), 1, "CMDAUTO" )
d_SetWordEquate(hex("33AB"), 1, "CMDCOPY" )
d_SetWordEquate(hex("32D4"), 1, "CMDPAGE" )
d_SetWordEquate(hex("13AE"), 1, "OVFLERR" )
d_SetWordEquate(hex("13B1"), 1, "ILDATERR" )
d_SetWordEquate(hex("13B4"), 1, "DATMISERR" )
d_SetWordEquate(hex("13B7"), 1, "STRLENERR" )
d_SetWordEquate(hex("13BA"), 1, "MEMERR" )
d_SetWordEquate(hex("13C0"), 1, "LINELENERR" )
d_SetWordEquate(hex("13C3"), 1, "GOSUBERR" )
d_SetWordEquate(hex("13C6"), 1, "FORNEXTERR" )
d_SetWordEquate(hex("13C9"), 1, "FUNCERR" )
d_SetWordEquate(hex("13CC"), 1, "NEXTFORERR" )
d_SetWordEquate(hex("13CF"), 1, "RETGOSBERR" )
d_SetWordEquate(hex("13D2"), 1, "UNDEFFNERR" )
d_SetWordEquate(hex("13D5"), 1, "LINEERR" )
d_SetWordEquate(hex("13D8"), 1, "CONTERR" )
d_SetWordEquate(hex("13DB"), 1, "BADWRERR" )
d_SetWordEquate(hex("13DE"), 1, "CMDSTMTERR" )
d_SetWordEquate(hex("13E1"), 1, "READDATAERR")
d_SetWordEquate(hex("13E4"), 1, "OPENERR" )
d_SetWordEquate(hex("13E7"), 1, "UNKNWNERR" )
d_SetWordEquate(hex("13EA"), 1, "OUTFILEERR" )
d_SetWordEquate(hex("13ED"), 1, "PRTNRDYERR" )
d_SetWordEquate(hex("13F0"), 1, "PRTHWERR" )
d_SetWordEquate(hex("13F3"), 1, "PRTPAPERERR")
d_SetWordEquate(hex("13F6"), 1, "CHKSUMERR" )
d_SetWordEquate(hex("1347"), 1, "TITLEMSG" )
d_SetWordEquate(hex("1364"), 1, "COPYRMSG" )
d_SetWordEquate(hex("1384"), 1, "READYMSG" )
d_SetWordEquate(hex("138A"), 1, "ERRORMSG" )
d_SetWordEquate(hex("1391"), 1, "INMSG" )
d_SetWordEquate(hex("1395"), 1, "BREAKMSG" )
d_SetWordEquate(hex("139C"), 1, "BYTESMSG" )
d_SetWordEquate(hex("13A3"), 1, "ERRCODE" )
d_SetWordEquate(hex("1332"), 1, "MSGNL" )
d_SetWordEquate(hex("167B"), 1, "UNUSEDTBL1" )
d_SetWordEquate(hex("167D"), 1, "UNUSEDTBL2" )
d_SetWordEquate(hex("124E"), 1, "WARMSTRT" )
d_SetWordEquate(hex("167F"), 1, "OPERATORTBL")
d_SetWordEquate(hex("17FC"), 1, "STRTONUM" )
d_SetWordEquate(hex("1E88"), 1, "GETNUM" )
d_SetWordEquate(hex("173F"), 1, "SKIPSPACE" )
d_SetWordEquate(hex("173E"), 1, "INCSKIPSPCE")
d_SetWordEquate(hex("177B"), 1, "EXECHL" )
d_SetWordEquate(hex("1795"), 1, "EXECNOTCHR" )
d_SetWordEquate(hex("17A3"), 1, "MATCHCHR" )
d_SetWordEquate(hex("490D"), 0, "LINEBUFR" )
d_SetComment( hex("1795"), "Scan for character after command" )
d_SetComment( hex("1779"), "Get address after call and jump to it via a RET command." )
d_SetComment( hex("2E1D"), "Compare loaded filename against name given by user." )
d_SetComment( hex("2B0D"), "Check to see if a stream, ie. /T = Tape is given. The 02FH below is / and the function after is called if it doesnt match /." )
d_SetComment( hex("1250"), "Sharp defined BASIC restart location from Monitor." )
-- Known Sharp Constants.
d_SetWordEquate(hex("10F0"), 0, "ATRB" ) -- ATTRIBUTE
d_SetWordEquate(hex("10F1"), 0, "NAME" ) -- FILE NAME
d_SetWordEquate(hex("1102"), 0, "SIZE" ) -- BYTESIZE
d_SetWordEquate(hex("1104"), 0, "DTADR" ) -- DATA ADDRESS
d_SetWordEquate(hex("1106"), 0, "EXADR" ) -- EXECUTION ADDRESS
d_SetWordEquate(hex("1108"), 0, "COMNT" ) -- COMMENT
d_SetWordEquate(hex("1164"), 0, "SWPW" ) -- SWEEP WORK
d_SetWordEquate(hex("116E"), 0, "KDATW" ) -- KEY WORK
d_SetWordEquate(hex("1170"), 0, "KANAF" ) -- KANA FLAG (01=GRAPHIC MODE)
d_SetWordEquate(hex("1171"), 0, "DSPXY" ) -- DISPLAY COORDINATES
d_SetWordEquate(hex("1173"), 0, "MANG" ) -- COLUMN MANAGEMENT
d_SetWordEquate(hex("1179"), 0, "MANGE" ) -- COLUMN MANAGEMENT END
d_SetWordEquate(hex("117A"), 0, "PBIAS" ) -- PAGE BIAS
d_SetWordEquate(hex("117B"), 0, "ROLTOP" ) -- ROLL TOP BIAS
d_SetWordEquate(hex("117C"), 0, "MGPNT" ) -- COLUMN MANAG. POINTER
d_SetWordEquate(hex("117D"), 0, "PAGETP" ) -- PAGE TOP
d_SetWordEquate(hex("117F"), 0, "ROLEND" ) -- ROLL END
d_SetWordEquate(hex("118E"), 0, "FLASH" ) -- FLASHING DATA
d_SetWordEquate(hex("118F"), 0, "SFTLK" ) -- SHIFT LOCK
d_SetWordEquate(hex("1190"), 0, "REVFLG" ) -- REVERSE FLAG
d_SetWordEquate(hex("1191"), 0, "SPAGE" ) -- PAGE CHANGE
d_SetWordEquate(hex("1192"), 0, "FLSDT" ) -- CURSOR DATA
d_SetWordEquate(hex("1193"), 0, "STRGF" ) -- STRING FLAG
d_SetWordEquate(hex("1194"), 0, "DPRNT" ) -- TAB COUNTER
d_SetWordEquate(hex("1195"), 0, "TMCNT" ) -- TAPE MARK COUNTER
d_SetWordEquate(hex("1197"), 0, "SUMDT" ) -- CHECK SUM DATA
d_SetWordEquate(hex("1199"), 0, "CSMDT" ) -- FOR COMPARE SUM DATA
d_SetWordEquate(hex("119B"), 0, "AMPM" ) -- AMPM DATA
d_SetWordEquate(hex("119C"), 0, "TIMFG" ) -- TIME FLAG
d_SetWordEquate(hex("119D"), 0, "SWRK" ) -- KEY SOUND FLAG
d_SetWordEquate(hex("119E"), 0, "TEMPW" ) -- TEMPO WORK
d_SetWordEquate(hex("119F"), 0, "ONTYO" ) -- ONTYO WORK
d_SetWordEquate(hex("11A0"), 0, "OCTV" ) -- OCTAVE WORK
d_SetWordEquate(hex("11A1"), 0, "RATIO" ) -- ONPU RATIO
d_SetWordEquate(hex("11A3"), 0, "BUFER" ) -- GET LINE BUFFER
----------------------------------------
-- End of configuration file
----------------------------------------

2643
dis/1Z-013B/SA-5510.ref Normal file

File diff suppressed because it is too large Load Diff

BIN
dis/1Z-013B/basic_1z-013b.mzf Executable file

Binary file not shown.

View File

@@ -0,0 +1,889 @@
;****************************************************************
;
; MZ-2000 Initial Program Loader Firmware.
;
; Disassembled with dz80 v2.1 and comments copied from the
; MZ-80B IPL disassembly.
;
;****************************************************************
;
CR EQU 0D8H
TR EQU 0D9H
SCR EQU 0DAH
DR EQU 0DBH
DM EQU 0DCH
HS EQU 0DDH
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
IBUFE EQU 0CF00H
ATRB EQU 0CF00H
NAME EQU 0CF01H
SIZE EQU 0CF12H
DTADR EQU 0CF14H
SUMDT EQU 0FFE0H
TMCNT EQU 0FFE2H
IBADR1 EQU 0CF00H
IBADR2 EQU 08000H
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
PRGSTART EQU 00000H
ORG PRGSTART
L0000: JR START
;
; NST RESET
;
NST: LD A,003H ;Set PC1 NST=1
OUT (PPICTL),A
START: LD A,082H ;8255 A=OUT B=IN C=OUT
OUT (PPICTL),A
LD A,058H ;PIO A=OUT
OUT (PPIC),A
LD SP,SUMDT ;PIO B=IN
LD A,0F7H
OUT (PPIA),A
LD A,00FH
OUT (PIOCTLA),A ;BST=1 NST=0 OPEN=1 WRITE=1
LD A,0CFH
OUT (PIOCTLB),A
LD A,0FFH
OUT (PIOCTLB),A
XOR A ;Set Graphics VRAM to default, input to GRPH I, no output.
OUT (0F6H),A
OUT (GRPHCTL),A
INC A
OUT (0F7H),A
LD A,007H
OUT (0F5H),A
LD A,0D3H
OUT (PIOA),A
LD HL,0D000H
LD A,CR
CLEAR: LD (HL),000H ; DISPLAY CLEAR
INC HL
CP H
JR NZ,CLEAR
LD A,0FFH
OUT (PPIA),A
LD A,003H
OUT (0F7H),A
CALL L006E
LD A,002H
OUT (0F7H),A
CALL L006E
LD A,001H
OUT (0F7H),A
CALL L006E
LD A,013H
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.
L006E: LD HL,0C000H
DI
IN A,(PIOA)
SET 7,A
RES 6,A
OUT (PIOA),A
LD DE,0C001H
LD (HL),000H
LD BC,03E7FH
L0082: LDIR
RES 7,A
SET 6,A
OUT (PIOA),A
EI
RET
KEYS1: LD B,014H ;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 (TR),A
CALL DLY80U
IN A,(TR)
CP B
RET
;
; ;
; CMT CONTROL ;
; ;
;
CMT: CALL MSTOP
CALL KYEMES
CALL RDINF
JR C,ST1
CALL LDMSG
LD HL,NAME
LD E,010H
LD C,010H
CALL DISP2
LD A,(IBUFE)
CP 001H
JR NZ,MISMCH
CALL RDDAT
ST1: PUSH AF
CALL FR
POP AF
JP C,TRYAG
JP NST
MISMCH: LD HL,MES16
LD E,00AH
LD C,00FH
CALL DISP
CALL MSTOP
SCF
JR ST1
;
;READ INFORMATION
; CF=1:ERROR
?RDI:
RDINF: DI
IN A,(PPIC)
SET 5,A
OUT (PPIC),A
LD D,004H
LD BC,0080H
LD HL,IBUFE
RD1: CALL MOTOR
JR C,STPEIR
CALL TMARK
JR C,STPEIR
CALL RTAPE
JR C,STPEIR
BIT 3,D
JR Z,EIRTN
STPEIR: CALL MSTOP
EIRTN: EI
RET
;
;
;READ DATA
;
?RDD:
RDDAT: DI
LD D,008H
LD BC,(0CF12H)
LD HL,IBADR2
JR RD1
;
;
;READ TAPE
; BC=SIZE
; DE=LOAD ADDRSS
RTAPE: PUSH DE
PUSH BC
PUSH HL
LD H,002H
RTP2: CALL SPDIN
JR C,TRTN1 ; BREAK
JR Z,RTP2
LD D,H
LD HL,L0000
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: IN A,(PPIB)
CPL
RLCA
RET C ; BREAK
RLCA
JR NC,EDGE ; WAIT ON LOW
L016A: IN A,(PPIB)
CPL
RLCA
RET C ; BREAK
RLCA
JR C,L016A ; WAIT ON HIGH
RET
; 1 BYTE READ
; DATA=A
; SUMDT STORE
RBYTE: PUSH HL
LD HL,00800H ; 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,01414H
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
SPDIN: CALL EDGE ;WAIT ON HIGH
RET C ;BREAK
CALL DLY2
IN A,(PPIB) ;READ BIT
AND 040H
RET
;
;
;MOTOR ON
MOTOR: PUSH DE
PUSH BC
PUSH HL
IN A,(PPIB)
AND 020H
JR Z,MOTRD
LD HL,MES6
LD E,00AH
LD C,00EH
CALL DISP
CALL OPEN
MOT1: IN A,(PIOB)
CPL
RLCA
JR C,MOTR
IN A,(PPIB)
AND 020H
JR NZ,MOT1
CALL KYEMES
CALL DEL1M
MOTRD: CALL PLAY
MOTR: POP HL
POP BC
POP DE
RET
;
;
;MOTOR STOP
MSTOP: LD A,0F7H
OUT (PPIA),A
CALL DEL6
LD A,0FFH
OUT (PPIA),A
RET
;EJECT
OPEN: LD A,008H ;Reset PC4 - EJECT activate
OUT (PPICTL),A
CALL DEL6
LD A,009H
OUT (PPICTL),A ;Set PC4 - Deactivate EJECT
RET
KYEMES: LD HL,MES3
LD E,004H
LD C,01CH
CALL DISP
RET
;
;PLAY
PLAY: LD A,0FBH
OUT (PPIA),A
CALL DEL6
LD A,0FFH
OUT (PPIA),A
RET
FR: LD A,0FEH
FR1: OUT (PPIA),A
CALL DEL6
LD A,0FFH
OUT (PPIA),A
IN A,(PPIC)
RES 5,A
OUT (PPIC),A
RET
;
;TIMING DEL
DM1: PUSH AF
DM1A: XOR A
DM1B: DEC A
JR NZ,DM1B
DEC BC
LD A,B
OR C
JR NZ,DM1A
POP AF
POP BC
RET
DEL6: PUSH BC
LD BC,RDINF
JR DM1
DEL1M: PUSH BC
LD BC,060FH
JR DM1
;
;TAPE DELAY TIMING
;
;
DLY2: LD A,031H
DLY2A: DEC A
JP NZ,DLY2A
RET
LDMSG: LD HL,MES1
LD E,000H
LD C,00EH
JR DISP
DISP2: LD A,0D3H
OUT (PIOA),A
JR DISP1
BOOTER: LD HL,MES8
LD E,00AH
LD C,00DH
DISP: LD A,0D3H
OUT (PIOA),A
EXX
LD HL,0D000H
LD A,CR
DISP3: LD (HL),000H
INC HL
CP H
JR NZ,DISP3
EXX
DISP1: XOR A
LD B,A
LD D,0D0H
LDIR
LD A,013H
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 disk "
MES12: DB "C:Cassette tape"
MES13: DB "Drive No? (1-4)"
MES14: DB "This disk 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,IBUFE
XOR A
LD (0CF1EH),A
LD (0CF1FH),A
LD IY,SUMDT
LD HL,0100H
LD (IY+002H),L
LD (IY+003H),H
CALL BREAD ;INFORMATION INPUT
LD HL,IBUFE ;MASTER CHECK
LD DE,IPLMC
LD B,006H
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,00AH
CALL DISP2
LD IX,IBADR2
LD HL,(0CF14H)
LD (IY+002H),L
LD (IY+003H),H
CALL BREAD
CALL MOFF
JP NST
NODISK: LD HL,MES9
LD E,00AH
LD C,00DH
CALL DISP
JP ERR1
;
; READY CHECK
;
READY: LD A,(MTFG)
RRCA
CALL NC,MTON
LD A,(DRINO) ;DRIVE NO GET
OR 084H
OUT (DM),A ;DRIVE SELECT MOTON
XOR A
CALL DLY60M
LD HL,L0000
REDY0: DEC HL
LD A,H
OR L
JR Z,NODISK
RET C
RET C
CPL
RLCA
JR C,REDY0
LD A,(DRINO)
LD C,A
LD HL,CLBF0
LD B,000H
ADD HL,BC
BIT 0,(HL)
RET NZ
CALL RCLB
SET 0,(HL)
RET
;
; MOTOR ON
;
MTON: LD A,080H
OUT (DM),A
LD B,00AH ;1SEC DELAY
MTD1: LD HL,03C19H
MTD2: DEC HL
LD A,L
OR H
JR NZ,MTD2
DJNZ MTD1
LD A,001H
LD (MTFG),A
RET
;
; Track SEEK
;
SEEK: LD A,01BH
CPL
OUT (CR),A
CALL BUSY
CALL DLY60M
IN A,(CR)
CPL
AND 099H
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,00BH
CPL
OUT (CR),A
CALL BUSY
CALL DLY60M
IN A,(CR)
CPL
AND 085H
XOR 004H
POP HL
RET Z
JP ERR
;
; BUSY AND WAIT
;
BUSY: PUSH DE
PUSH HL
CALL DLY80U
LD E,007H
BUSY2: LD HL,L0000
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,000H
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+004H),H
LD (IY+005H),L
DCHK: LD A,(DRINO)
CP 004H
JR NC,DTCK1
LD A,(IY+004H)
CP 046H
JR NC,DTCK1
LD A,(IY+005H)
OR A
JR Z,DTCK1
CP 011H
JR NC,DTCK1
LD A,(IY+002H)
OR (IY+003H)
RET NZ
DTCK1: JP ERR
;
; SEQUENTIAL READ
;
BREAD: DI
CALL CONVRT
LD A,00AH
LD (RETRY),A
READ1: CALL READY
LD D,(IY+003H)
LD A,(IY+002H)
OR A
JR Z,RE0
INC D
RE0: LD A,(IY+005H)
LD (IY+001H),A
LD A,(IY+004H)
LD (IY+000H),A
PUSH IX
POP HL
RE8: SRL A
CPL
OUT (DR),A
JR NC,RE1
LD A,001H
JR RE2
RE1: LD A,000H
RE2: CPL
OUT (HS),A
CALL SEEK
JR NZ,REE
LD C,DR
LD A,(IY+000H)
SRL A
CPL
OUT (TR),A
LD A,(IY+001H)
CPL
OUT (SCR),A
EXX
LD HL,RE3
PUSH HL
EXX
LD A,094H
CPL
OUT (CR),A
CALL WAIT
RE6: LD B,000H
RE4: IN A,(CR)
RRCA
RET C
RRCA
JR C,RE4
INI
JR NZ,RE4
INC (IY+001H)
LD A,(IY+001H)
CP 011H
JR Z,RETS
DEC D
JR NZ,RE6
JR RE5
RETS: DEC D
RE5: LD A,CR
CPL
OUT (CR),A
CALL BUSY
RE3: IN A,(CR)
CPL
AND 0FFH
JR NZ,REE
EXX
POP HL
EXX
LD A,(IY+001H)
CP 011H
JR NZ,REX
LD A,001H
LD (IY+001H),A
INC (IY+000H)
REX: LD A,D
OR A
JR NZ,RE7
LD A,080H
OUT (DM),A
RET
RE7: LD A,(IY+000H)
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,008H
WAIT2: LD HL,L0000
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,007H
LD C,01BH
CALL DISP
JR ERR1
;
; ;
; ERRROR OR BREAK ;
; ;
;
ERR: CALL BOOTER
ERR1: CALL MOFF
LD SP,SUMDT
TRYAG: CALL FDCC
JR NZ,TRYAG3
LD HL,MES10
LD E,05AH
LD C,00CH
CALL DISP2
LD E,0ABH
LD C,011H
CALL DISP2
LD E,0D3H
LD C,00FH
CALL DISP2
TRYAG1: CALL KEYS1
BIT 3,A
JP Z,CMT
BIT 6,A
JR Z,DNO
JR TRYAG1
DNO: LD HL,MES13
LD E,00AH
LD C,00FH
CALL DISP
DNO10: LD D,012H
CALL DNO0
JR NC,DNO3
LD D,018H
CALL DNO0
JR NC,DNO3
JR DNO10
DNO3: LD A,B
LD (DRINO),A
JP FD
TRYAG3: LD HL,MES15
LD E,054H
LD C,01DH
CALL DISP2
TRYAG4: LD B,006H
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,000H
LD C,004H
RRCA
DNO1: RRCA
RET NC
INC B
DEC C
JR NZ,DNO1
RET
;
; TIME DELAY (1M &60M &80U )
;
DLY80U: PUSH DE
LD DE,000DH
JP DLYT
DLY1M: PUSH DE
LD DE,L0082
JP DLYT
DLY60M: PUSH DE
LD DE,01A2CH
DLYT: DEC DE
LD A,E
OR D
JR NZ,DLYT
POP DE
RET
;
;
; ;
; INTRAM EXROM ;
; ;
;
EXROMT: LD HL,IBADR2
LD IX,EROM1
JR SEROMA
EROM1: IN A,(0F9H)
CP 000H
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,004H
SEROMD: DEC D
JR NZ,SEROMD
JP (IX)

View File

@@ -0,0 +1,264 @@
----------------------------------------
-- dZ80 configuration file
----------------------------------------
----------------------------------------
-- Disassembly control
----------------------------------------
cpu="z80"
inputfile="mz2000_ipl.rom"
outputfile="mz2000_ipl.asm"
--fileheadersize=27
filebaseaddr=0
disstart=0
disend=1606
--quiet=0
labelledoutput=1
----------------------------------------
-- Layout
----------------------------------------
labelreference=1
addresscolumn=1
opcodecolumn=1
relativejumpcomment=1
uppercase=1
autoblanklines=1
db="db"
comment="; "
radix=16
numprefix="0"
numsuffix="H"
----------------------------------------
-- Scripts
----------------------------------------
--script="scripts\\spectrum.lua"
----------------------------------------
-- References
----------------------------------------
referencefile="mz2000_ipl.ref"
inportreference=1
outportreference=1
addressreference=1
indirectaddressreference=1
limitreferences=1
----------------------------------------
-- Opcode mapfile and code/data areas
----------------------------------------
--opmapfile="mayhem.map"
-- Code Region isnt required as v2.x sets the entire region to code unless a data region overrides it.
d_SetCodeRegion(0, 1606)
-- Set the known data regions, either as a data region (byte), word or string. The type affects the assembly output definitions and word
-- regions will attempt to map to an address, ie. jump tables will be setup with labels rather than constants.
d_SetDataRegion( hex("0289"), 218)
d_SetStringRegion( hex("0289"), 13)
d_SetStringRegion( hex("0297"), 27)
d_SetStringRegion( hex("02B3"), 13)
d_SetStringRegion( hex("02C1"), 12)
d_SetStringRegion( hex("02CE"), 12)
d_SetStringRegion( hex("02DB"), 11)
d_SetStringRegion( hex("02E7"), 31)
d_SetStringRegion( hex("0307"), 14)
d_SetStringRegion( hex("0316"), 22)
d_SetStringRegion( hex("032D"), 3)
d_SetStringRegion( hex("0331"), 28)
d_SetStringRegion( hex("034E"), 14)
d_SetStringRegion( hex("035D"), 7)
-- Create a mapping table of known Sharp I/O ports and 8 bit constants.
--
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
--d_SetByteEquate(hex("FE") , 1, "PRTC" )
--d_SetByteEquate(hex("FF") , 1, "PRTD" )
-- Create a mapping table of known Sharp MZ BIOS/Memory Mapped Hardware addresses which dz80
-- can use to replace an address with the label. The EQU list will also be output at the start
-- of the disassembly file so it can compile.
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetWordEquate(hex("0002"), 1, "NST" )
d_SetWordEquate(hex("0006"), 1, "START" )
d_SetWordEquate(hex("0036"), 1, "CLEAR" )
d_SetWordEquate(hex("0060"), 1, "KEYIN" )
d_SetWordEquate(hex("008C"), 1, "KEYS1" )
d_SetWordEquate(hex("008E"), 1, "KEYS" )
d_SetWordEquate(hex("0098"), 1, "NKIN" )
d_SetWordEquate(hex("00A0"), 1, "FDCC" )
d_SetWordEquate(hex("0364"), 1, "FD" )
d_SetWordEquate(hex("00AC"), 1, "CMT" )
d_SetWordEquate(hex("00CE"), 1, "ST1" )
d_SetWordEquate(hex("00D9"), 1, "MISMCH" )
d_SetWordEquate(hex("026D"), 1, "DISP" )
d_SetWordEquate(hex("01F6"), 1, "MSTOP" )
d_SetWordEquate(hex("00E9"), 1, "RDINF" )
d_SetWordEquate(hex("00F8"), 1, "RD1" )
d_SetWordEquate(hex("01C7"), 1, "MOTOR" )
d_SetWordEquate(hex("0193"), 1, "TMARK" )
d_SetWordEquate(hex("010B"), 1, "STPEIR" )
d_SetWordEquate(hex("010E"), 1, "EIRTN" )
d_SetWordEquate(hex("0110"), 1, "RDDAT" )
d_SetWordEquate(hex("011C"), 1, "RTAPE" )
d_SetWordEquate(hex("0121"), 1, "RTP2" )
d_SetWordEquate(hex("01BB"), 1, "SPDIN" )
d_SetWordEquate(hex("015E"), 1, "TRTN1" )
d_SetWordEquate(hex("0121"), 1, "RTP2" )
d_SetWordEquate(hex("0133"), 1, "RTP3" )
d_SetWordEquate(hex("0173"), 1, "RBYTE" )
d_SetWordEquate(hex("0154"), 1, "RTP5" )
d_SetWordEquate(hex("015A"), 1, "RTP6" )
d_SetWordEquate(hex("0266"), 1, "BOOTER" )
d_SetWordEquate(hex("0162"), 1, "EDGE" )
d_SetWordEquate(hex("0177"), 1, "RBY1" )
d_SetWordEquate(hex("0188"), 1, "RBY2" )
d_SetWordEquate(hex("0191"), 1, "RBY3" )
d_SetWordEquate(hex("019C"), 1, "TM0" )
d_SetWordEquate(hex("019F"), 1, "TM1" )
d_SetWordEquate(hex("01A2"), 1, "TM2" )
d_SetWordEquate(hex("01AC"), 1, "TM3" )
d_SetWordEquate(hex("01DD"), 1, "MOT1" )
d_SetWordEquate(hex("01EF"), 1, "MOTRD" )
d_SetWordEquate(hex("01F2"), 1, "MOTR" )
d_SetWordEquate(hex("0202"), 1, "OPEN" )
d_SetWordEquate(hex("020E"), 1, "KYEMES" )
d_SetWordEquate(hex("0219"), 1, "PLAY" )
d_SetWordEquate(hex("0237"), 1, "DM1" )
d_SetWordEquate(hex("0238"), 1, "DM1A" )
d_SetWordEquate(hex("0239"), 1, "DM1B" )
d_SetWordEquate(hex("0244"), 1, "DEL6" )
d_SetWordEquate(hex("024A"), 1, "DEL1M" )
d_SetWordEquate(hex("0250"), 1, "DLY2" )
d_SetWordEquate(hex("0252"), 1, "DLY2A" )
d_SetWordEquate(hex("0257"), 1, "LDMSG" )
d_SetWordEquate(hex("027E"), 1, "DISP1" )
d_SetWordEquate(hex("0260"), 1, "DISP2" )
d_SetWordEquate(hex("0277"), 1, "DISP3" )
d_SetWordEquate(hex("0289"), 1, "MES1" )
d_SetWordEquate(hex("0297"), 1, "MES3" )
d_SetWordEquate(hex("02B3"), 1, "MES6" )
d_SetWordEquate(hex("02C1"), 1, "MES8" )
d_SetWordEquate(hex("02CE"), 1, "MES9" )
d_SetWordEquate(hex("02DB"), 1, "MES10" )
d_SetWordEquate(hex("0307"), 1, "MES13" )
d_SetWordEquate(hex("0316"), 1, "MES14" )
d_SetWordEquate(hex("034E"), 1, "MES16" )
d_SetWordEquate(hex("035D"), 1, "IPLMC" )
d_SetWordEquate(hex("0387"), 1, "MCHECK" )
d_SetWordEquate(hex("03B4"), 1, "NODISK" )
d_SetWordEquate(hex("03C1"), 1, "READY" )
d_SetWordEquate(hex("03D6"), 1, "REDY0" )
d_SetWordEquate(hex("03F4"), 1, "MTON" )
d_SetWordEquate(hex("03FA"), 1, "MTD1" )
d_SetWordEquate(hex("03FD"), 1, "MTD2" )
d_SetWordEquate(hex("040A"), 1, "SEEK" )
d_SetWordEquate(hex("041B"), 1, "MOFF" )
d_SetWordEquate(hex("0431"), 1, "RCLB" )
d_SetWordEquate(hex("0449"), 1, "BUSY" )
d_SetWordEquate(hex("0450"), 1, "BUSY2" )
d_SetWordEquate(hex("0453"), 1, "BUSY0" )
d_SetWordEquate(hex("0461"), 1, "BUSY1" )
d_SetWordEquate(hex("0467"), 1, "CONVRT" )
d_SetWordEquate(hex("0470"), 1, "TRANS" )
d_SetWordEquate(hex("0477"), 1, "TRANS1" )
d_SetWordEquate(hex("0480"), 1, "DCHK" )
d_SetWordEquate(hex("049F"), 1, "DTCK1" )
d_SetWordEquate(hex("04A2"), 1, "BREAD" )
d_SetWordEquate(hex("04AB"), 1, "READ1" )
d_SetWordEquate(hex("04B8"), 1, "RE0" )
d_SetWordEquate(hex("04C7"), 1, "RE8" )
d_SetWordEquate(hex("04D2"), 1, "RE1" )
d_SetWordEquate(hex("04D4"), 1, "RE2" )
d_SetWordEquate(hex("04FA"), 1, "RE6" )
d_SetWordEquate(hex("04FC"), 1, "RE4" )
d_SetWordEquate(hex("0516"), 1, "RETS" )
d_SetWordEquate(hex("0517"), 1, "RE5" )
d_SetWordEquate(hex("051F"), 1, "RE3" )
d_SetWordEquate(hex("0538"), 1, "REX" )
d_SetWordEquate(hex("0541"), 1, "RE7" )
d_SetWordEquate(hex("0546"), 1, "REE" )
d_SetWordEquate(hex("0555"), 1, "WAIT" )
d_SetWordEquate(hex("055C"), 1, "WAIT2" )
d_SetWordEquate(hex("055F"), 1, "WAIT0" )
d_SetWordEquate(hex("056D"), 1, "WAIT1" )
d_SetWordEquate(hex("0572"), 1, "NMASTE" )
d_SetWordEquate(hex("057E"), 1, "ERR" )
d_SetWordEquate(hex("0581"), 1, "ERR1" )
d_SetWordEquate(hex("0583"), 1, "TRYAG2" )
d_SetWordEquate(hex("0587"), 1, "TRYAG" )
d_SetWordEquate(hex("05A4"), 1, "TRYAG1" )
d_SetWordEquate(hex("05B2"), 1, "DNO" )
d_SetWordEquate(hex("05BC"), 1, "DNO10" )
d_SetWordEquate(hex("05CC"), 1, "DNO3" )
d_SetWordEquate(hex("05D3"), 1, "TRYAG3" )
d_SetWordEquate(hex("05DD"), 1, "TRYAG4" )
d_SetWordEquate(hex("05DF"), 1, "TRYAG5" )
d_SetWordEquate(hex("0331"), 1, "MES15" )
d_SetWordEquate(hex("05E9"), 1, "DNO0" )
d_SetWordEquate(hex("05F7"), 1, "DNO1" )
d_SetWordEquate(hex("05FE"), 1, "DLY80U" )
d_SetWordEquate(hex("0605"), 1, "DLY1M" )
d_SetWordEquate(hex("060C"), 1, "DLY60M" )
d_SetWordEquate(hex("0610"), 1, "DLYT" )
d_SetWordEquate(hex("0617"), 1, "EXROMT" )
d_SetWordEquate(hex("0620"), 1, "EROM1" )
d_SetWordEquate(hex("062B"), 1, "ERMT1" )
d_SetWordEquate(hex("062D"), 1, "EROM2" )
d_SetWordEquate(hex("063A"), 1, "SEROMA" )
d_SetWordEquate(hex("0642"), 1, "SEROMD" )
d_SetWordEquate(hex("CF00"), 1, "IBUFE" )
d_SetWordEquate(hex("CF00"), 1, "ATRB" )
d_SetWordEquate(hex("CF01"), 1, "NAME" )
d_SetWordEquate(hex("CF12"), 1, "SIZE" )
d_SetWordEquate(hex("CF14"), 1, "DTADR" )
d_SetWordEquate(hex("FFE0"), 1, "SUMDT" )
d_SetWordEquate(hex("FFE2"), 1, "TMCNT" )
d_SetWordEquate(hex("CF00"), 1, "IBADR1" )
d_SetWordEquate(hex("8000"), 1, "IBADR2" )
d_SetWordEquate(hex("FFE0"), 1, "NTRACK" )
d_SetWordEquate(hex("FFE1"), 1, "NSECT" )
d_SetWordEquate(hex("FFE2"), 1, "BSIZE" )
d_SetWordEquate(hex("FFE4"), 1, "STTR" )
d_SetWordEquate(hex("FFE5"), 1, "STSE" )
d_SetWordEquate(hex("FFE6"), 1, "MTFG" )
d_SetWordEquate(hex("FFE7"), 1, "CLBF0" )
d_SetWordEquate(hex("FFE8"), 1, "CLBF1" )
d_SetWordEquate(hex("FFE9"), 1, "CLBF2" )
d_SetWordEquate(hex("FFEA"), 1, "CLBF3" )
d_SetWordEquate(hex("FFEB"), 1, "RETRY" )
d_SetWordEquate(hex("FFEC"), 1, "DRINO" )
d_SetByteEquate(hex("D8"), 1, "CR" )
d_SetByteEquate(hex("D9"), 1, "TR" )
d_SetByteEquate(hex("DA"), 1, "SCR" )
d_SetByteEquate(hex("DB"), 1, "DR" )
d_SetByteEquate(hex("DC"), 1, "DM" )
d_SetByteEquate(hex("DD"), 1, "HS" )
d_SetByteEquate(hex("E0"), 1, "PPIA" )
d_SetByteEquate(hex("E1"), 1, "PPIB" )
d_SetByteEquate(hex("E2"), 1, "PPIC" )
d_SetByteEquate(hex("E3"), 1, "PPICTL" )
d_SetByteEquate(hex("E8"), 1, "PIOA" )
d_SetByteEquate(hex("E9"), 1, "PIOCTLA" )
d_SetByteEquate(hex("EA"), 1, "PIOB" )
d_SetByteEquate(hex("EB"), 1, "PIOCTLB" )
d_SetByteEquate(hex("F4"), 1, "GRPHCTL" )
-- Comments to be added at fixed addresses.
d_SetComment( hex("1250"), "Sharp defined BASIC restart location from Monitor." )
d_SetComment( hex("5B55"), "Relocated to 0x3302 for 0x5B bytes." )
d_SetComment( hex("5BB0"), "Relocated to 0x4806 for 0xF8 bytes." )
d_SetComment( hex("5CA8"), "End of Relocated code." )
----------------------------------------
-- End of configuration file
----------------------------------------

View File

@@ -0,0 +1,466 @@
dZ80 2.1 Reference file from the disassembly of "mz2000_ipl.rom".
Input Port Reference (22 entries)
---------------------------------
Input Port 000d8H. 6 references:
--------------------------------
00415H: IN A,(0D8H)
0043dH: IN A,(0D8H)
00458H: IN A,(0D8H)
004fcH: IN A,(0D8H)
0051fH: IN A,(0D8H)
00564H: IN A,(0D8H)
Input Port 000d9H. 1 references:
--------------------------------
000a8H: IN A,(0D9H)
Input Port 000e1H. 5 references:
--------------------------------
00162H: IN A,(0E1H)
0016aH: IN A,(0E1H)
001c2H: IN A,(0E1H)
001caH: IN A,(0E1H)
001e3H: IN A,(0E1H)
Input Port 000e2H. 2 references:
--------------------------------
000eaH: IN A,(0E2H)
00230H: IN A,(0E2H)
Input Port 000e8H. 3 references:
--------------------------------
00072H: IN A,(0E8H)
0008eH: IN A,(0E8H)
005e9H: IN A,(0E8H)
Input Port 000eaH. 3 references:
--------------------------------
00095H: IN A,(0EAH)
001ddH: IN A,(0EAH)
005f0H: IN A,(0EAH)
Input Port 000f9H. 2 references:
--------------------------------
00620H: IN A,(0F9H)
0062dH: IN A,(0F9H)
Output Port Reference (50 entries)
----------------------------------
Output Port 000d8H. 4 references:
---------------------------------
0040dH: OUT (0D8H),A
00435H: OUT (0D8H),A
004f5H: OUT (0D8H),A
0051aH: OUT (0D8H),A
Output Port 000d9H. 2 references:
---------------------------------
000a3H: OUT (0D9H),A
004e4H: OUT (0D9H),A
Output Port 000daH. 1 references:
---------------------------------
004eaH: OUT (0DAH),A
Output Port 000dbH. 1 references:
---------------------------------
004caH: OUT (0DBH),A
Output Port 000dcH. 4 references:
---------------------------------
003cdH: OUT (0DCH),A
003f6H: OUT (0DCH),A
0041fH: OUT (0DCH),A
0053eH: OUT (0DCH),A
Output Port 000ddH. 1 references:
---------------------------------
004d5H: OUT (0DDH),A
Output Port 000e0H. 8 references:
---------------------------------
00013H: OUT (0E0H),A
0003eH: OUT (0E0H),A
001f8H: OUT (0E0H),A
001ffH: OUT (0E0H),A
0021bH: OUT (0E0H),A
00222H: OUT (0E0H),A
00227H: OUT (0E0H),A
0022eH: OUT (0E0H),A
Output Port 000e2H. 3 references:
---------------------------------
0000cH: OUT (0E2H),A
000eeH: OUT (0E2H),A
00234H: OUT (0E2H),A
Output Port 000e3H. 4 references:
---------------------------------
00004H: OUT (0E3H),A
00008H: OUT (0E3H),A
00204H: OUT (0E3H),A
0020bH: OUT (0E3H),A
Output Port 000e8H. 9 references:
---------------------------------
0002fH: OUT (0E8H),A
00057H: OUT (0E8H),A
00078H: OUT (0E8H),A
00088H: OUT (0E8H),A
00093H: OUT (0E8H),A
00262H: OUT (0E8H),A
0026fH: OUT (0E8H),A
00286H: OUT (0E8H),A
005eeH: OUT (0E8H),A
Output Port 000e9H. 1 references:
---------------------------------
00017H: OUT (0E9H),A
Output Port 000ebH. 2 references:
---------------------------------
0001bH: OUT (0EBH),A
0001fH: OUT (0EBH),A
Output Port 000f4H. 1 references:
---------------------------------
00024H: OUT (0F4H),A
Output Port 000f5H. 1 references:
---------------------------------
0002bH: OUT (0F5H),A
Output Port 000f6H. 1 references:
---------------------------------
00022H: OUT (0F6H),A
Output Port 000f7H. 4 references:
---------------------------------
00027H: OUT (0F7H),A
00042H: OUT (0F7H),A
00049H: OUT (0F7H),A
00050H: OUT (0F7H),A
Output Port 000f8H. 2 references:
---------------------------------
00635H: OUT (0F8H),A
0063bH: OUT (0F8H),A
Output Port 000f9H. 1 references:
---------------------------------
0063eH: OUT (0F9H),A
Direct address Reference (47 entries)
-------------------------------------
Direct address 00000H. 4 references:
------------------------------------
00129H: LD HL,00000H
003d3H: LD HL,00000H
00450H: LD HL,00000H
0055cH: LD HL,00000H
Direct address 0000dH. 1 references:
------------------------------------
005ffH: LD DE,0000DH
Direct address 00010H. 1 references:
------------------------------------
00469H: LD DE,00010H
Direct address 00080H. 1 references:
------------------------------------
000f2H: LD BC,00080H
Direct address 00082H. 1 references:
------------------------------------
00606H: LD DE,00082H
Direct address 000e9H. 1 references:
------------------------------------
00245H: LD BC,000E9H
Direct address 00100H. 1 references:
------------------------------------
00373H: LD HL,00100H
Direct address 00289H. 1 references:
------------------------------------
00257H: LD HL,00289H
Direct address 00297H. 1 references:
------------------------------------
0020eH: LD HL,00297H
Direct address 002b3H. 1 references:
------------------------------------
001d0H: LD HL,002B3H
Direct address 002c1H. 1 references:
------------------------------------
00266H: LD HL,002C1H
Direct address 002ceH. 1 references:
------------------------------------
003b4H: LD HL,002CEH
Direct address 002dbH. 1 references:
------------------------------------
0058cH: LD HL,002DBH
Direct address 00307H. 1 references:
------------------------------------
005b2H: LD HL,00307H
Direct address 00316H. 1 references:
------------------------------------
00572H: LD HL,00316H
Direct address 00331H. 1 references:
------------------------------------
005d3H: LD HL,00331H
Direct address 0034eH. 1 references:
------------------------------------
000d9H: LD HL,0034EH
Direct address 0035dH. 1 references:
------------------------------------
00382H: LD DE,0035DH
Direct address 0051fH. 1 references:
------------------------------------
004edH: LD HL,0051FH
Direct address 0060fH. 1 references:
------------------------------------
0024bH: LD BC,0060FH
Direct address 00620H. 1 references:
------------------------------------
0061aH: LD IX,00620H
Direct address 0062dH. 1 references:
------------------------------------
00627H: LD IX,0062DH
Direct address 00800H. 1 references:
------------------------------------
00174H: LD HL,00800H
Direct address 01414H. 1 references:
------------------------------------
00194H: LD HL,01414H
Direct address 01a2cH. 1 references:
------------------------------------
0060dH: LD DE,01A2CH
Direct address 03c19H. 1 references:
------------------------------------
003faH: LD HL,03C19H
Direct address 03e7fH. 1 references:
------------------------------------
0007fH: LD BC,03E7FH
Direct address 08000H. 3 references:
------------------------------------
00117H: LD HL,08000H
0039eH: LD IX,08000H
00617H: LD HL,08000H
Direct address 0c000H. 1 references:
------------------------------------
0006eH: LD HL,0C000H
Direct address 0c001H. 1 references:
------------------------------------
0007aH: LD DE,0C001H
Direct address 0cf00H. 3 references:
------------------------------------
000f5H: LD HL,0CF00H
00364H: LD IX,0CF00H
0037fH: LD HL,0CF00H
Direct address 0cf01H. 1 references:
------------------------------------
000baH: LD HL,0CF01H
Direct address 0cf07H. 1 references:
------------------------------------
00394H: LD HL,0CF07H
Direct address 0cf12H. 1 references:
------------------------------------
00113H: LD BC,(0CF12H)
Direct address 0d000H. 2 references:
------------------------------------
00031H: LD HL,0D000H
00272H: LD HL,0D000H
Direct address 0ffe0H. 3 references:
------------------------------------
0000eH: LD SP,0FFE0H
0036fH: LD IY,0FFE0H
00584H: LD SP,0FFE0H
Direct address 0ffe7H. 1 references:
------------------------------------
003e5H: LD HL,0FFE7H
Indirect address Reference (27 entries)
---------------------------------------
Indirect address 0cf00H. 1 references:
--------------------------------------
000c4H: LD A,(0CF00H)
Indirect address 0cf14H. 1 references:
--------------------------------------
003a2H: LD HL,(0CF14H)
Indirect address 0cf1eH. 2 references:
--------------------------------------
00369H: LD (0CF1EH),A
0046cH: LD HL,(0CF1EH)
Indirect address 0cf1fH. 1 references:
--------------------------------------
0036cH: LD (0CF1FH),A
Indirect address 0ffe0H. 4 references:
--------------------------------------
0012cH: LD (0FFE0H),HL
0013fH: LD HL,(0FFE0H)
0017fH: LD HL,(0FFE0H)
00183H: LD (0FFE0H),HL
Indirect address 0ffe2H. 2 references:
--------------------------------------
0019cH: LD (0FFE2H),HL
0019fH: LD HL,(0FFE2H)
Indirect address 0ffe6H. 4 references:
--------------------------------------
0005dH: LD (0FFE6H),A
003c1H: LD A,(0FFE6H)
00406H: LD (0FFE6H),A
0042dH: LD (0FFE6H),A
Indirect address 0ffe7H. 1 references:
--------------------------------------
00421H: LD (0FFE7H),A
Indirect address 0ffe8H. 1 references:
--------------------------------------
00424H: LD (0FFE8H),A
Indirect address 0ffe9H. 1 references:
--------------------------------------
00427H: LD (0FFE9H),A
Indirect address 0ffeaH. 1 references:
--------------------------------------
0042aH: LD (0FFEAH),A
Indirect address 0ffebH. 3 references:
--------------------------------------
004a8H: LD (0FFEBH),A
00546H: LD A,(0FFEBH)
0054aH: LD (0FFEBH),A
Indirect address 0ffecH. 5 references:
--------------------------------------
0005aH: LD (0FFECH),A
003c8H: LD A,(0FFECH)
003e1H: LD A,(0FFECH)
00480H: LD A,(0FFECH)
005cdH: LD (0FFECH),A
End of reference file for "mz2000_ipl.rom"

Binary file not shown.

7511
dis/SA-5510/SA-5510.asm Normal file

File diff suppressed because it is too large Load Diff

568
dis/SA-5510/SA-5510.ini Normal file
View File

@@ -0,0 +1,568 @@
----------------------------------------
-- dZ80 configuration file
----------------------------------------
----------------------------------------
-- Disassembly control
----------------------------------------
cpu="z80"
inputfile="SA-5510.bin"
outputfile="SA-5510.asm"
--fileheadersize=27
filebaseaddr=4605
disstart=0
disend=16946
--disstart=0
--disend=3584
--quiet=0
labelledoutput=1
----------------------------------------
-- Layout
----------------------------------------
labelreference=1
addresscolumn=1
opcodecolumn=1
relativejumpcomment=1
uppercase=1
autoblanklines=1
db="db"
comment="; "
radix=16
numprefix="0"
numsuffix="H"
----------------------------------------
-- Scripts
----------------------------------------
--script="scripts\\spectrum.lua"
----------------------------------------
-- References
----------------------------------------
referencefile="SA-5510.ref"
inportreference=1
outportreference=1
addressreference=1
indirectaddressreference=1
limitreferences=1
----------------------------------------
-- Opcode mapfile and code/data areas
----------------------------------------
--opmapfile="mayhem.map"
-- Code Region isnt required as v2.x sets the entire region to code unless a data region overrides it.
-- d_SetCodeRegion(4608, 2464)
-- Set the known data regions, either as a data region (byte), word or string. The type affects the assembly output definitions and word
-- regions will attempt to map to an address, ie. jump tables will be setup with labels rather than constants.
d_SetDataRegion( hex("1347"), 100) -- 0x1347
d_SetStringRegion(hex("1347"), 28)
d_SetStringRegion(hex("1364"), 31)
d_SetStringRegion(hex("1384"), 5)
d_SetStringRegion(hex("138A"), 6)
d_SetStringRegion(hex("1391"), 3)
d_SetStringRegion(hex("1395"), 6)
d_SetStringRegion(hex("139C"), 6)
d_SetDataRegion( hex("2FC2"), 30)
d_SetStringRegion(hex("2FC2"), 6)
d_SetStringRegion(hex("2FC9"), 8)
d_SetStringRegion(hex("2FD2"), 10)
d_SetStringRegion(hex("2FDD"), 2)
d_SetStringRegion(hex("1D44"), 9)
-- Reserved key words.
d_SetDataRegion( hex("15A8"), 402) -- 0x15A8 Start of tokens.
d_SetStringRegion(hex("15A8"), 2) -- 0 - REM
d_SetStringRegion(hex("15AB"), 3) -- 1 - DATA
d_SetStringRegion(hex("15AF"), 0) -- 2 - undefined
d_SetStringRegion(hex("15B0"), 0) -- 3 - undefined
d_SetStringRegion(hex("15B1"), 3) -- 4 - READ
d_SetStringRegion(hex("15B5"), 3) -- 5 - LIST
d_SetStringRegion(hex("15B9"), 2) -- 6 - RUN
d_SetStringRegion(hex("15BC"), 2) -- 7 - NEW
d_SetStringRegion(hex("15BF"), 4) -- 8 - PRINT
d_SetStringRegion(hex("15C4"), 2) -- 9 - LET
d_SetStringRegion(hex("15C7"), 2) -- 10 - FOR
d_SetStringRegion(hex("15CA"), 1) -- 11 - IF
d_SetStringRegion(hex("15CC"), 3) -- 12 - THEN
d_SetStringRegion(hex("15D0"), 3) -- 13 - GOTO
d_SetStringRegion(hex("15D4"), 4) -- 14 - GOSUB
d_SetStringRegion(hex("15D9"), 5) -- 15 - RETURN
d_SetStringRegion(hex("15DF"), 3) -- 16 - NEXT
d_SetStringRegion(hex("15E3"), 3) -- 17 - STOP
d_SetStringRegion(hex("15E7"), 2) -- 18 - END
d_SetStringRegion(hex("15EA"), 0) -- 19 - undefined
d_SetStringRegion(hex("15EB"), 1) -- 20 - ON
d_SetStringRegion(hex("15ED"), 3) -- 21 - LOAD
d_SetStringRegion(hex("15F1"), 3) -- 22 - SAVE
d_SetStringRegion(hex("15F5"), 5) -- 23 - VERIFY
d_SetStringRegion(hex("15FB"), 3) -- 24 - POKE
d_SetStringRegion(hex("15FF"), 2) -- 25 - DIM
d_SetStringRegion(hex("1602"), 5) -- 26 - DEF FN
d_SetStringRegion(hex("1608"), 4) -- 27 - INPUT
d_SetStringRegion(hex("160D"), 6) -- 28 - RESTORE
d_SetStringRegion(hex("1614"), 2) -- 29 - CLS
d_SetStringRegion(hex("1617"), 4) -- 30 - MUSIC
d_SetStringRegion(hex("161C"), 4) -- 31 - TEMPO
d_SetStringRegion(hex("1621"), 3) -- 32 - USRN
d_SetStringRegion(hex("1625"), 4) -- 33 - WOPEN
d_SetStringRegion(hex("162A"), 4) -- 34 - ROPEN
d_SetStringRegion(hex("162F"), 4) -- 35 - CLOSE
d_SetStringRegion(hex("1634"), 2) -- 36 - MON
d_SetStringRegion(hex("1637"), 4) -- 37 - LIMIT
d_SetStringRegion(hex("163C"), 3) -- 38 - CONT
d_SetStringRegion(hex("1640"), 2) -- 39 - GET
d_SetStringRegion(hex("1643"), 3) -- 40 - INP@
d_SetStringRegion(hex("1647"), 3) -- 41 - OUT@
d_SetStringRegion(hex("164B"), 5) -- 42 - CURSOR
d_SetStringRegion(hex("1651"), 2) -- 43 - SET
d_SetStringRegion(hex("1654"), 4) -- 44 - RESET
d_SetStringRegion(hex("1659"), 0) -- 45 - undefined
d_SetStringRegion(hex("165A"), 0) -- 46 - undefined
d_SetStringRegion(hex("165B"), 0) -- 47 - undefined
d_SetStringRegion(hex("165C"), 0) -- 48 - undefined
d_SetStringRegion(hex("165D"), 0) -- 49 - undefined
d_SetStringRegion(hex("165E"), 0) -- 59 - undefined
d_SetStringRegion(hex("165F"), 3) -- 51 - AUTO
d_SetStringRegion(hex("1663"), 0) -- 52 - undefined
d_SetStringRegion(hex("1664"), 0) -- 53 - undefined
d_SetStringRegion(hex("1665"), 5) -- 54 - COPY/P
d_SetStringRegion(hex("166B"), 5) -- 55 - PAGE/P
d_SetStringRegion(hex("1671"), 0) -- 56 - undefined
d_SetStringRegion(hex("1672"), 0) -- 57 - undefined
d_SetStringRegion(hex("1673"), 0) -- 58 - undefined
d_SetStringRegion(hex("1674"), 0) -- 59 - undefined
d_SetStringRegion(hex("1675"), 0) -- 60 - undefined
d_SetStringRegion(hex("1676"), 0) -- 61 - undefined
d_SetStringRegion(hex("1677"), 0) -- 62 - undefined
d_SetStringRegion(hex("1678"), 0) -- 63 - undefined
d_SetStringRegion(hex("1679"), 0) -- 64 - undefined
d_SetStringRegion(hex("167A"), 0) -- 65 - undefined
d_SetStringRegion(hex("167B"), 1) -- 66 - undefined
d_SetStringRegion(hex("167D"), 1) -- 67 - undefined
-- Functions
d_SetStringRegion(hex("167F"), 1) -- >=
d_SetStringRegion(hex("1681"), 1) -- <>
d_SetStringRegion(hex("1683"), 1) -- =<
d_SetStringRegion(hex("1685"), 1) -- <=
d_SetStringRegion(hex("1687"), 1) -- <=
d_SetStringRegion(hex("1689"), 1) -- <=
d_SetStringRegion(hex("168B"), 0) -- undefined
d_SetStringRegion(hex("168C"), 0) -- <=
d_SetStringRegion(hex("168D"), 0) -- <=
d_SetStringRegion(hex("168E"), 0) -- undefined
d_SetStringRegion(hex("168F"), 0) -- undefined
d_SetStringRegion(hex("1690"), 0) -- undefined
d_SetStringRegion(hex("1691"), 0) -- undefined
d_SetStringRegion(hex("1692"), 0) -- undefined
d_SetStringRegion(hex("1693"), 0) -- undefined
d_SetStringRegion(hex("1694"), 0) -- undefined
d_SetStringRegion(hex("1695"), 0) -- undefined
d_SetStringRegion(hex("1696"), 0) -- undefined
d_SetStringRegion(hex("1697"), 0) -- undefined
d_SetStringRegion(hex("1698"), 0) -- undefined
d_SetStringRegion(hex("1699"), 0) -- undefined
d_SetStringRegion(hex("169A"), 0) -- undefined
d_SetStringRegion(hex("169B"), 0) -- undefined
d_SetStringRegion(hex("169C"), 0) -- undefined
d_SetStringRegion(hex("169D"), 0) -- undefined
d_SetStringRegion(hex("168E"), 0) -- undefined
d_SetStringRegion(hex("168F"), 0) -- undefined
d_SetStringRegion(hex("16A0"), 1) -- TO
d_SetStringRegion(hex("16A2"), 3) -- STEP
d_SetStringRegion(hex("16A6"), 5) -- LEFT$(
d_SetStringRegion(hex("16AC"), 6) -- RIGHT$(
d_SetStringRegion(hex("16B3"), 4) -- MID$(
d_SetStringRegion(hex("16B8"), 3) -- LEN(
d_SetStringRegion(hex("16BC"), 4) -- CHR$(
d_SetStringRegion(hex("16C1"), 4) -- STR$(
d_SetStringRegion(hex("16C6"), 3) -- ASC(
d_SetStringRegion(hex("16CA"), 3) -- VAL(
d_SetStringRegion(hex("16CE"), 4) -- PEEK(
d_SetStringRegion(hex("16D3"), 3) -- TAB(
d_SetStringRegion(hex("16D7"), 6) -- SPACE$(
d_SetStringRegion(hex("16DE"), 3) -- SIZE
d_SetStringRegion(hex("16E2"), 2) -- undefined
d_SetStringRegion(hex("16E5"), 6) -- STRING$(
d_SetStringRegion(hex("16ED"), 0) -- undefined
d_SetStringRegion(hex("16EE"), 10) -- CHARACTER$(
d_SetStringRegion(hex("16F9"), 2) -- CSR
d_SetStringRegion(hex("16FC"), 12) -- undefined
d_SetStringRegion(hex("1709"), 3) -- RND(
d_SetStringRegion(hex("170D"), 3) -- SIN(
d_SetStringRegion(hex("1711"), 3) -- COS(
d_SetStringRegion(hex("1715"), 3) -- TAN(
d_SetStringRegion(hex("1719"), 3) -- ATN(
d_SetStringRegion(hex("171D"), 3) -- EXP(
d_SetStringRegion(hex("1721"), 3) -- INT(
d_SetStringRegion(hex("1725"), 3) -- LOG(
d_SetStringRegion(hex("1729"), 2) -- LN(
d_SetStringRegion(hex("172C"), 3) -- ABS(
d_SetStringRegion(hex("1730"), 3) -- SGN(
d_SetStringRegion(hex("1734"), 3) -- SQR(
d_SetStringRegion(hex("1738"), 2) -- End of Table
d_SetDataRegion( hex("13AB"), 77) -- 0x13AB
d_SetStringRegion(hex("4223"), 15) -- 0x4223 BASIC SA-5510
d_SetDataRegion( hex("1D15"), 2) -- 0x1D15 Data
d_SetDataRegion( hex("1C4C"), 1)
d_SetDataRegion( hex("1C63"), 1) -- 0x1C63 Data
d_SetWordRegion( hex("1BB2"), 128) -- 0x1BB2 Data
d_SetDataRegion( hex("3400"), 3) -- 0x3400 Data
d_SetDataRegion( hex("3404"), 1) -- 0x3404 Data
d_SetDataRegion( hex("2355"), 1) -- 0x2355 Data
d_SetDataRegion( hex("239F"), 1) -- 0x239f Data
d_SetWordRegion( hex("2691"), 34)
d_SetWordRegion( hex("26B3"), 40)
d_SetWordRegion( hex("26DB"), 24)
d_SetDataRegion( hex("26F3"), 6)
d_SetDataRegion( hex("27B2"), 2) -- 0x27B2 Data
d_SetDataRegion( hex("2884"), 1) -- 0x2885 Data
d_SetDataRegion( hex("2A83"), 25) -- 0x2A83 Data
--d_SetDataRegion( hex("2B3D"), 2) -- 0x2B3D Data
--d_SetDataRegion( hex("2D1D"), 2) -- 0x2D1D Data
-- Function table.
d_SetWordRegion( hex("22E1"), 18)
-- Function calls, CALL <Operation Byte> <Function>
d_SetDataRegion( hex("204A"), 2)
d_SetDataRegion( hex("12CE"), 1)
d_SetWordRegion( hex("12CF"), 2)
d_SetDataRegion( hex("1A78"), 1)
d_SetWordRegion( hex("1A79"), 2)
d_SetDataRegion( hex("1C54"), 1)
d_SetWordRegion( hex("1C55"), 2)
d_SetDataRegion( hex("1E23"), 1)
d_SetWordRegion( hex("1E24"), 2)
d_SetDataRegion( hex("20EB"), 1)
d_SetWordRegion( hex("20EC"), 2)
d_SetDataRegion( hex("21B3"), 1)
d_SetWordRegion( hex("21B4"), 2)
d_SetDataRegion( hex("287F"), 1)
d_SetWordRegion( hex("2880"), 2)
d_SetDataRegion( hex("2949"), 1)
d_SetWordRegion( hex("294A"), 2)
d_SetDataRegion( hex("29A2"), 1)
d_SetWordRegion( hex("29A3"), 2)
d_SetDataRegion( hex("2A3A"), 1)
d_SetWordRegion( hex("2A3B"), 2)
d_SetDataRegion( hex("2A4E"), 1)
d_SetWordRegion( hex("2A4F"), 2)
d_SetDataRegion( hex("2B10"), 1)
d_SetWordRegion( hex("2B11"), 2)
d_SetDataRegion( hex("2B32"), 1)
d_SetWordRegion( hex("2B33"), 2)
d_SetDataRegion( hex("2B6C"), 1)
d_SetWordRegion( hex("2B6D"), 2)
d_SetDataRegion( hex("2C05"), 1)
d_SetWordRegion( hex("2C06"), 2)
d_SetDataRegion( hex("2CFF"), 1)
d_SetWordRegion( hex("2D00"), 2)
d_SetDataRegion( hex("2D56"), 1)
d_SetWordRegion( hex("2D57"), 2)
d_SetDataRegion( hex("2D5C"), 1)
d_SetWordRegion( hex("2D5D"), 2)
d_SetDataRegion( hex("2CB2"), 1)
d_SetWordRegion( hex("2CB3"), 2)
d_SetDataRegion( hex("2D78"), 1)
d_SetWordRegion( hex("2D79"), 2)
d_SetDataRegion( hex("2D88"), 1)
d_SetWordRegion( hex("2D89"), 2)
d_SetDataRegion( hex("2D95"), 1)
d_SetWordRegion( hex("2D96"), 2)
d_SetDataRegion( hex("2DA2"), 1)
d_SetWordRegion( hex("2DA3"), 2)
d_SetDataRegion( hex("2DB0"), 1)
d_SetWordRegion( hex("2DB1"), 2)
d_SetDataRegion( hex("2E97"), 1)
d_SetWordRegion( hex("2E98"), 2)
d_SetDataRegion( hex("2FE7"), 1)
d_SetWordRegion( hex("2FE8"), 2)
d_SetDataRegion( hex("3323"), 1)
d_SetWordRegion( hex("3324"), 2)
d_SetDataRegion( hex("2D74"), 1)
d_SetDataRegion( hex("2E33"), 32)
d_SetDataRegion( hex("2EB0"), 3)
d_SetDataRegion( hex("2F8C"), 2)
d_SetDataRegion( hex("2FE8"), 2)
d_SetDataRegion( hex("37AE"), 269)
d_SetDataRegion( hex("3CE7"), 30)
d_SetDataRegion( hex("3F05"), 48)
d_SetDataRegion( hex("4041"), 35)
d_SetDataRegion( hex("406F"), 7)
d_SetDataRegion( hex("4121"), 56)
d_SetDataRegion( hex("18BE"), 3)
d_SetDataRegion( hex("18D7"), 3)
d_SetDataRegion( hex("1CAA"), 2)
d_SetWordRegion( hex("1D90"), 2)
d_SetDataRegion( hex("2104"), 3)
--d_SetDataRegion( hex("2221"), 3)
d_SetDataRegion( hex("2317"), 1)
d_SetDataRegion( hex("270F"), 3)
d_SetWordRegion( hex("2929"), 2)
d_SetDataRegion( hex("2A14"), 2)
d_SetDataRegion( hex("2A2A"), 2)
d_SetDataRegion( hex("2C8B"), 3)
d_SetWordRegion( hex("2CDE"), 2)
d_SetDataRegion( hex("2D10"), 2)
d_SetWordRegion( hex("2D90"), 2)
d_SetDataRegion( hex("30F4"), 3)
d_SetDataRegion( hex("3BE9"), 25)
d_SetDataRegion( hex("4118"), 3)
d_SetDataRegion( hex("3DED"), 5)
d_SetDataRegion( hex("3DF2"), 5)
d_SetDataRegion( hex("3DF7"), 5)
d_SetDataRegion( hex("3DFC"), 5)
d_SetDataRegion( hex("1B42"), 1)
d_SetDataRegion( hex("1C5A"), 1)
d_SetDataRegion( hex("1D02"), 1)
d_SetDataRegion( hex("1D89"), 1)
d_SetDataRegion( hex("1F31"), 1)
d_SetDataRegion( hex("204F"), 1)
d_SetDataRegion( hex("208F"), 1)
d_SetDataRegion( hex("2116"), 1)
d_SetDataRegion( hex("220F"), 1)
d_SetDataRegion( hex("221B"), 1)
d_SetDataRegion( hex("221F"), 1)
d_SetDataRegion( hex("245F"), 1)
d_SetDataRegion( hex("24FD"), 1)
d_SetDataRegion( hex("2715"), 1)
d_SetDataRegion( hex("284E"), 1)
d_SetDataRegion( hex("2855"), 1)
d_SetDataRegion( hex("288F"), 1)
d_SetDataRegion( hex("28C6"), 1)
d_SetDataRegion( hex("2AB3"), 1)
d_SetDataRegion( hex("2B75"), 1)
d_SetDataRegion( hex("2C21"), 1)
d_SetDataRegion( hex("2CEF"), 1)
d_SetDataRegion( hex("2D7E"), 1)
d_SetDataRegion( hex("2D8E"), 1)
d_SetDataRegion( hex("2D9B"), 1)
d_SetDataRegion( hex("2DA8"), 1)
d_SetDataRegion( hex("2DB6"), 1)
-- Create a mapping table of known Sharp I/O ports and 8 bit constants.
--
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetByteEquate(hex("FE") , 1, "PRTC" )
d_SetByteEquate(hex("FF") , 1, "PRTD" )
-- Create a mapping table of known Sharp MZ BIOS/Memory Mapped Hardware addresses which dz80
-- can use to replace an address with the label. The EQU list will also be output at the start
-- of the disassembly file so it can compile.
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetWordEquate(hex("0003"), 1, "GETL" )
d_SetWordEquate(hex("0006"), 1, "LETNL" )
d_SetWordEquate(hex("0009"), 1, "NL" )
d_SetWordEquate(hex("000C"), 1, "PRNTS" )
d_SetWordEquate(hex("000F"), 1, "PRNTT" )
d_SetWordEquate(hex("0012"), 1, "PRNT" )
d_SetWordEquate(hex("0015"), 1, "MSG" )
d_SetWordEquate(hex("0018"), 1, "MSGX" )
d_SetWordEquate(hex("001B"), 1, "GETKY" )
d_SetWordEquate(hex("001E"), 1, "BRKEY" )
d_SetWordEquate(hex("0021"), 1, "?WRI" )
d_SetWordEquate(hex("0024"), 1, "?WRD" )
d_SetWordEquate(hex("0027"), 1, "?RDI" )
d_SetWordEquate(hex("002A"), 1, "?RDD" )
d_SetWordEquate(hex("002D"), 1, "?VRFY" )
d_SetWordEquate(hex("0030"), 1, "MELDY" )
d_SetWordEquate(hex("0033"), 1, "?TMST" )
d_SetWordEquate(hex("003B"), 1, "TIMRD" )
d_SetWordEquate(hex("003E"), 1, "BELL" )
d_SetWordEquate(hex("0041"), 1, "XTEMP" )
d_SetWordEquate(hex("0044"), 1, "MSTA" )
d_SetWordEquate(hex("0047"), 1, "MSTP" )
d_SetWordEquate(hex("0000"), 1, "MONIT" )
d_SetWordEquate(hex("0089"), 1, "SS" )
d_SetWordEquate(hex("0095"), 1, "ST1" )
d_SetWordEquate(hex("0410"), 1, "HLHEX" )
d_SetWordEquate(hex("041F"), 1, "_2HEX" )
d_SetWordEquate(hex("074D"), 1, "?MODE" )
d_SetWordEquate(hex("08CA"), 1, "?KEY" )
d_SetWordEquate(hex("096C"), 1, "PRNT3" )
d_SetWordEquate(hex("0BB9"), 1, "?ADCN" )
d_SetWordEquate(hex("0BCE"), 1, "?DACN" )
d_SetWordEquate(hex("0DB5"), 1, "?DSP" )
d_SetWordEquate(hex("0DA6"), 1, "?BLNK" )
d_SetWordEquate(hex("0DDC"), 1, "?DPCT" )
d_SetWordEquate(hex("03BA"), 1, "PRTHL" )
d_SetWordEquate(hex("03C3"), 1, "PRTHX" )
d_SetWordEquate(hex("03DA"), 1, "ASC" )
d_SetWordEquate(hex("03F9"), 1, "HEX" )
d_SetWordEquate(hex("0DDC"), 1, "DPCT" )
d_SetWordEquate(hex("0DA7"), 1, "DLY12" )
d_SetWordEquate(hex("0DAA"), 1, "DLY12A" )
d_SetWordEquate(hex("0EE6"), 1, "?RSTR1" )
d_SetWordEquate(hex("06A3"), 1, "MOTOR" )
d_SetWordEquate(hex("071A"), 1, "CKSUM" )
d_SetWordEquate(hex("077A"), 1, "GAP" )
d_SetWordEquate(hex("0485"), 1, "WTAPE" )
d_SetWordEquate(hex("0700"), 1, "MSTOP" )
d_SetWordEquate(hex("11FD"), 1, "TAPECOPY" )
d_SetWordEquate(hex("1200"), 1, "COLDSTRT" )
d_SetWordEquate(hex("1250"), 1, "WARMSTRTMON")
d_SetWordEquate(hex("15A8"), 1, "CMDWORDTBL" )
d_SetWordEquate(hex("1BB2"), 1, "CMDJMPTBL" )
d_SetWordEquate(hex("2E33"), 1, "CMTBUF" )
d_SetWordEquate(hex("2E34"), 1, "CMTFNAME" )
d_SetWordEquate(hex("1C3C"), 1, "CMDREMDATA" )
d_SetWordEquate(hex("13AB"), 1, "SYNTAXERR" )
d_SetWordEquate(hex("2D12"), 1, "CMDREAD" )
d_SetWordEquate(hex("1C4D"), 1, "CMDLIST" )
d_SetWordEquate(hex("1E91"), 1, "CMDRUN" )
d_SetWordEquate(hex("1C42"), 1, "CMDNEW" )
d_SetWordEquate(hex("2B0D"), 1, "CMDPRINT" )
d_SetWordEquate(hex("1D6A"), 1, "CMDLET" )
d_SetWordEquate(hex("1F2B"), 1, "CMDFOR" )
d_SetWordEquate(hex("21AD"), 1, "CMDIF" )
d_SetWordEquate(hex("13AB"), 1, "CMDTHEN" )
d_SetWordEquate(hex("1EA6"), 1, "CMDGOTO" )
d_SetWordEquate(hex("1EC7"), 1, "CMDGOSUB" )
d_SetWordEquate(hex("1EF8"), 1, "CMDRETURN" )
d_SetWordEquate(hex("1FC0"), 1, "CMDNEXT" )
d_SetWordEquate(hex("1D2C"), 1, "CMDSTOP" )
d_SetWordEquate(hex("1D15"), 1, "CMDEND" )
d_SetWordEquate(hex("203E"), 1, "CMDON" )
d_SetWordEquate(hex("2D75"), 1, "CMDLOAD" )
d_SetWordEquate(hex("2D82"), 1, "CMDSAVE" )
d_SetWordEquate(hex("2EB3"), 1, "CMDVERIFY" )
d_SetWordEquate(hex("2191"), 1, "CMDPOKE" )
d_SetWordEquate(hex("2080"), 1, "CMDDIM" )
d_SetWordEquate(hex("2201"), 1, "CMDDEFFN" )
d_SetWordEquate(hex("2BFF"), 1, "CMDINPUT" )
d_SetWordEquate(hex("1D4D"), 1, "CMDRESTORE" )
d_SetWordEquate(hex("21A6"), 1, "CMDCLS" )
d_SetWordEquate(hex("2269"), 1, "CMDMUSIC" )
d_SetWordEquate(hex("2282"), 1, "CMDTEMPO" )
d_SetWordEquate(hex("2942"), 1, "CMDUSRN" )
d_SetWordEquate(hex("2D9F"), 1, "CMDWOPEN" )
d_SetWordEquate(hex("2D92"), 1, "CMDROPEN" )
d_SetWordEquate(hex("2DAD"), 1, "CMDCLOSE" )
d_SetWordEquate(hex("28B6"), 1, "CMDMON" )
d_SetWordEquate(hex("2967"), 1, "CMDLIMIT" )
d_SetWordEquate(hex("29CE"), 1, "CMDCONT" )
d_SetWordEquate(hex("2902"), 1, "CMDGET" )
d_SetWordEquate(hex("29FE"), 1, "CMDINP" )
d_SetWordEquate(hex("2A1C"), 1, "CMDOUT" )
d_SetWordEquate(hex("28B9"), 1, "CMDCURSOR" )
d_SetWordEquate(hex("2AA6"), 1, "CMDSET" )
d_SetWordEquate(hex("2AAA"), 1, "CMDRESET" )
d_SetWordEquate(hex("2A2F"), 1, "CMDAUTO" )
d_SetWordEquate(hex("33AB"), 1, "CMDCOPY" )
d_SetWordEquate(hex("32D4"), 1, "CMDPAGE" )
d_SetWordEquate(hex("13AE"), 1, "OVFLERR" )
d_SetWordEquate(hex("13B1"), 1, "ILDATERR" )
d_SetWordEquate(hex("13B4"), 1, "DATMISERR" )
d_SetWordEquate(hex("13B7"), 1, "STRLENERR" )
d_SetWordEquate(hex("13BA"), 1, "MEMERR" )
d_SetWordEquate(hex("13C0"), 1, "LINELENERR" )
d_SetWordEquate(hex("13C3"), 1, "GOSUBERR" )
d_SetWordEquate(hex("13C6"), 1, "FORNEXTERR" )
d_SetWordEquate(hex("13C9"), 1, "FUNCERR" )
d_SetWordEquate(hex("13CC"), 1, "NEXTFORERR" )
d_SetWordEquate(hex("13CF"), 1, "RETGOSBERR" )
d_SetWordEquate(hex("13D2"), 1, "UNDEFFNERR" )
d_SetWordEquate(hex("13D5"), 1, "LINEERR" )
d_SetWordEquate(hex("13D8"), 1, "CONTERR" )
d_SetWordEquate(hex("13DB"), 1, "BADWRERR" )
d_SetWordEquate(hex("13DE"), 1, "CMDSTMTERR" )
d_SetWordEquate(hex("13E1"), 1, "READDATAERR")
d_SetWordEquate(hex("13E4"), 1, "OPENERR" )
d_SetWordEquate(hex("13E7"), 1, "UNKNWNERR" )
d_SetWordEquate(hex("13EA"), 1, "OUTFILEERR" )
d_SetWordEquate(hex("13ED"), 1, "PRTNRDYERR" )
d_SetWordEquate(hex("13F0"), 1, "PRTHWERR" )
d_SetWordEquate(hex("13F3"), 1, "PRTPAPERERR")
d_SetWordEquate(hex("13F6"), 1, "CHKSUMERR" )
d_SetWordEquate(hex("1347"), 1, "TITLEMSG" )
d_SetWordEquate(hex("1364"), 1, "COPYRMSG" )
d_SetWordEquate(hex("1384"), 1, "READYMSG" )
d_SetWordEquate(hex("138A"), 1, "ERRORMSG" )
d_SetWordEquate(hex("1391"), 1, "INMSG" )
d_SetWordEquate(hex("1395"), 1, "BREAKMSG" )
d_SetWordEquate(hex("139C"), 1, "BYTESMSG" )
d_SetWordEquate(hex("13A3"), 1, "ERRCODE" )
d_SetWordEquate(hex("1332"), 1, "MSGNL" )
d_SetWordEquate(hex("167B"), 1, "UNUSEDTBL1" )
d_SetWordEquate(hex("167D"), 1, "UNUSEDTBL2" )
d_SetWordEquate(hex("124E"), 1, "WARMSTRT" )
d_SetWordEquate(hex("167F"), 1, "OPERATORTBL")
d_SetWordEquate(hex("17FC"), 1, "STRTONUM" )
d_SetWordEquate(hex("1E88"), 1, "GETNUM" )
d_SetWordEquate(hex("173F"), 1, "SKIPSPACE" )
d_SetWordEquate(hex("173E"), 1, "INCSKIPSPCE")
d_SetWordEquate(hex("177B"), 1, "EXECHL" )
d_SetWordEquate(hex("1795"), 1, "EXECNOTCHR" )
d_SetWordEquate(hex("17A3"), 1, "MATCHCHR" )
d_SetWordEquate(hex("490D"), 0, "LINEBUFR" )
d_SetComment( hex("1795"), "Scan for character after command" )
d_SetComment( hex("1779"), "Get address after call and jump to it via a RET command." )
d_SetComment( hex("2E1D"), "Compare loaded filename against name given by user." )
d_SetComment( hex("2B0D"), "Check to see if a stream, ie. /T = Tape is given. The 02FH below is / and the function after is called if it doesnt match /." )
d_SetComment( hex("1250"), "Sharp defined BASIC restart location from Monitor." )
-- Known Sharp Constants.
d_SetWordEquate(hex("10F0"), 0, "ATRB" ) -- ATTRIBUTE
d_SetWordEquate(hex("10F1"), 0, "NAME" ) -- FILE NAME
d_SetWordEquate(hex("1102"), 0, "SIZE" ) -- BYTESIZE
d_SetWordEquate(hex("1104"), 0, "DTADR" ) -- DATA ADDRESS
d_SetWordEquate(hex("1106"), 0, "EXADR" ) -- EXECUTION ADDRESS
d_SetWordEquate(hex("1108"), 0, "COMNT" ) -- COMMENT
d_SetWordEquate(hex("1164"), 0, "SWPW" ) -- SWEEP WORK
d_SetWordEquate(hex("116E"), 0, "KDATW" ) -- KEY WORK
d_SetWordEquate(hex("1170"), 0, "KANAF" ) -- KANA FLAG (01=GRAPHIC MODE)
d_SetWordEquate(hex("1171"), 0, "DSPXY" ) -- DISPLAY COORDINATES
d_SetWordEquate(hex("1173"), 0, "MANG" ) -- COLUMN MANAGEMENT
d_SetWordEquate(hex("1179"), 0, "MANGE" ) -- COLUMN MANAGEMENT END
d_SetWordEquate(hex("117A"), 0, "PBIAS" ) -- PAGE BIAS
d_SetWordEquate(hex("117B"), 0, "ROLTOP" ) -- ROLL TOP BIAS
d_SetWordEquate(hex("117C"), 0, "MGPNT" ) -- COLUMN MANAG. POINTER
d_SetWordEquate(hex("117D"), 0, "PAGETP" ) -- PAGE TOP
d_SetWordEquate(hex("117F"), 0, "ROLEND" ) -- ROLL END
d_SetWordEquate(hex("118E"), 0, "FLASH" ) -- FLASHING DATA
d_SetWordEquate(hex("118F"), 0, "SFTLK" ) -- SHIFT LOCK
d_SetWordEquate(hex("1190"), 0, "REVFLG" ) -- REVERSE FLAG
d_SetWordEquate(hex("1191"), 0, "SPAGE" ) -- PAGE CHANGE
d_SetWordEquate(hex("1192"), 0, "FLSDT" ) -- CURSOR DATA
d_SetWordEquate(hex("1193"), 0, "STRGF" ) -- STRING FLAG
d_SetWordEquate(hex("1194"), 0, "DPRNT" ) -- TAB COUNTER
d_SetWordEquate(hex("1195"), 0, "TMCNT" ) -- TAPE MARK COUNTER
d_SetWordEquate(hex("1197"), 0, "SUMDT" ) -- CHECK SUM DATA
d_SetWordEquate(hex("1199"), 0, "CSMDT" ) -- FOR COMPARE SUM DATA
d_SetWordEquate(hex("119B"), 0, "AMPM" ) -- AMPM DATA
d_SetWordEquate(hex("119C"), 0, "TIMFG" ) -- TIME FLAG
d_SetWordEquate(hex("119D"), 0, "SWRK" ) -- KEY SOUND FLAG
d_SetWordEquate(hex("119E"), 0, "TEMPW" ) -- TEMPO WORK
d_SetWordEquate(hex("119F"), 0, "ONTYO" ) -- ONTYO WORK
d_SetWordEquate(hex("11A0"), 0, "OCTV" ) -- OCTAVE WORK
d_SetWordEquate(hex("11A1"), 0, "RATIO" ) -- ONPU RATIO
d_SetWordEquate(hex("11A3"), 0, "BUFER" ) -- GET LINE BUFFER
----------------------------------------
-- End of configuration file
----------------------------------------

2643
dis/SA-5510/SA-5510.ref Normal file

File diff suppressed because it is too large Load Diff

1894
dis/XPATCH/XPATCH-5510.asm Normal file

File diff suppressed because it is too large Load Diff

875
dis/XPATCH/XPATCH-5510.ref Normal file
View File

@@ -0,0 +1,875 @@
dZ80 2.1 Reference file from the disassembly of "XPATCH-5510.bin".
Direct address Reference (127 entries)
--------------------------------------
Direct address 00000H. 3 references:
------------------------------------
05098H: LD DE,00000H
05696H: LD BC,00000H
05a94H: LD HL,00000H
Direct address 00002H. 1 references:
------------------------------------
05729H: LD BC,00002H
Direct address 00003H. 1 references:
------------------------------------
056f4H: LD BC,00003H
Direct address 0000aH. 2 references:
------------------------------------
050d8H: LD DE,0000AH
050e5H: LD DE,0000AH
Direct address 00011H. 1 references:
------------------------------------
05b06H: LD BC,00011H
Direct address 00016H. 1 references:
------------------------------------
05a83H: LD BC,00016H
Direct address 0001cH. 1 references:
------------------------------------
05a69H: LD BC,0001CH
Direct address 0005bH. 1 references:
------------------------------------
05b45H: LD BC,0005BH
Direct address 00080H. 1 references:
------------------------------------
0515fH: LD BC,00080H
Direct address 000f8H. 1 references:
------------------------------------
05b4dH: LD BC,000F8H
Direct address 00100H. 1 references:
------------------------------------
05167H: LD BC,00100H
Direct address 00200H. 1 references:
------------------------------------
05c8fH: LD BC,00200H
Direct address ATRB. 1 references:
----------------------------------
05b5eH: LD HL,010F0H
Direct address SIZE. 3 references:
----------------------------------
05bbdH: LD BC,(01102H)
05c08H: LD BC,(01102H)
05c72H: LD BC,(01102H)
Direct address DTADR. 2 references:
-----------------------------------
05bc9H: LD (01104H),DE
05befH: LD DE,(01104H)
Direct address BUFER. 6 references:
-----------------------------------
05386H: LD DE,011A3H
053e6H: LD DE,011A3H
054b0H: LD DE,011A3H
054fbH: LD DE,011A3H
05569H: LD DE,011A3H
055ecH: LD DE,011A3H
Direct address 011ccH. 2 references:
------------------------------------
053afH: LD DE,011CCH
0552eH: LD HL,011CCH
Direct address 01211H. 1 references:
------------------------------------
055abH: LD DE,01211H
Direct address 01414H. 1 references:
------------------------------------
05c92H: LD DE,01414H
Direct address 015a8H. 1 references:
------------------------------------
0584eH: LD HL,015A8H
Direct address 0165eH. 1 references:
------------------------------------
05a7aH: LD DE,0165EH
Direct address 01b35H. 1 references:
------------------------------------
0506dH: LD BC,01B35H
Direct address 01c16H. 1 references:
------------------------------------
05a66H: LD DE,01C16H
Direct address 02035H. 1 references:
------------------------------------
058b6H: LD SP,02035H
Direct address 02305H. 1 references:
------------------------------------
05a80H: LD DE,02305H
Direct address 02a2fH. 1 references:
------------------------------------
05a06H: CPL
Direct address 02f6cH. 1 references:
------------------------------------
05aafH: LD HL,02F6CH
Direct address 032d4H. 1 references:
------------------------------------
05a0eH: CALL NC,06D32H
Direct address 03302H. 2 references:
------------------------------------
05a8eH: LD HL,03302H
05b42H: LD DE,03302H
Direct address 0330bH. 1 references:
------------------------------------
05abaH: LD HL,0330BH
Direct address 03311H. 1 references:
------------------------------------
05a9dH: LD HL,03311H
Direct address 03338H. 1 references:
------------------------------------
05a88H: LD HL,03338H
Direct address 033abH. 1 references:
------------------------------------
05a0cH: XOR E
Direct address 04224H. 1 references:
------------------------------------
05b03H: LD DE,04224H
Direct address 04806H. 2 references:
------------------------------------
05a12H: LD B,048H
05b4aH: LD DE,04806H
Direct address 0488eH. 1 references:
------------------------------------
05a16H: ADC A,(HL)
Direct address 048c1H. 1 references:
------------------------------------
05aa3H: LD HL,048C1H
Direct address LINEBUFR. 7 references:
--------------------------------------
05378H: LD DE,0490DH
0539fH: LD DE,0490DH
05427H: LD DE,0490DH
054d7H: LD HL,0490DH
05501H: LD HL,0490DH
0555cH: LD DE,0490DH
057b3H: LD DE,0490DH
Direct address 0490fH. 1 references:
------------------------------------
053e9H: LD HL,0490FH
Direct address 04a0eH. 2 references:
------------------------------------
053d6H: LD DE,04A0EH
059acH: LD HL,04A0EH
Direct address 04e84H. 1 references:
------------------------------------
0574fH: LD IX,04E84H
Direct address 04e86H. 1 references:
------------------------------------
056cbH: LD HL,04E86H
Direct address 0505cH. 1 references:
------------------------------------
05248H: LD DE,0505CH
Direct address 05063H. 7 references:
------------------------------------
0509bH: LD (05063H),DE
050afH: LD (05063H),DE
050c4H: LD (05063H),DE
050efH: LD BC,(05063H)
051a6H: LD BC,(05063H)
0527aH: LD DE,(05063H)
0591cH: LD BC,(05063H)
Direct address 05065H. 5 references:
------------------------------------
050a1H: LD (05065H),DE
050baH: LD (05065H),DE
050c8H: LD (05065H),DE
05118H: LD BC,(05065H)
05926H: LD BC,(05065H)
Direct address 05067H. 3 references:
------------------------------------
050dbH: LD (05067H),DE
051adH: LD BC,(05067H)
0528aH: LD DE,(05067H)
Direct address 05069H. 2 references:
------------------------------------
050e8H: LD (05069H),DE
0529eH: LD DE,(05069H)
Direct address 0506dH. 1 references:
------------------------------------
05a10H: LD L,L
Direct address 0507dH. 1 references:
------------------------------------
05077H: LD DE,0507DH
Direct address 05089H. 1 references:
------------------------------------
0512dH: LD DE,05089H
Direct address 05255H. 1 references:
------------------------------------
05216H: LD DE,05255H
Direct address 05257H. 1 references:
------------------------------------
05231H: LD DE,05257H
Direct address 0525cH. 1 references:
------------------------------------
05221H: LD DE,0525CH
Direct address 052f0H. 1 references:
------------------------------------
05a14H: RET P
Direct address 05363H. 1 references:
------------------------------------
05a18H: LD H,E
Direct address 05446H. 1 references:
------------------------------------
05392H: LD DE,05446H
Direct address 05453H. 1 references:
------------------------------------
054a5H: LD DE,05453H
Direct address 05469H. 2 references:
------------------------------------
054c2H: LD BC,(05469H)
05531H: LD DE,(05469H)
Direct address 0548eH. 1 references:
------------------------------------
05a1aH: ADC A,(HL)
Direct address 05499H. 1 references:
------------------------------------
05565H: LD BC,05499H
Direct address 055abH. 1 references:
------------------------------------
0558aH: LD DE,055ABH
Direct address 055b3H. 1 references:
------------------------------------
054e7H: LD DE,055B3H
Direct address 055c5H. 1 references:
------------------------------------
05a1cH: PUSH BC
Direct address 055f8H. 1 references:
------------------------------------
055dcH: LD DE,055F8H
Direct address 05614H. 2 references:
------------------------------------
056a1H: LD (05614H),DE
056d3H: LD DE,(05614H)
Direct address 05616H. 1 references:
------------------------------------
05a1eH: LD D,056H
Direct address 05807H. 2 references:
------------------------------------
05744H: LD DE,05807H
05772H: LD HL,05807H
Direct address 05820H. 1 references:
------------------------------------
0576bH: LD HL,05820H
Direct address 05838H. 1 references:
------------------------------------
05acbH: LD HL,05838H
Direct address 05849H. 1 references:
------------------------------------
05ac2H: LD HL,05849H
Direct address 0585dH. 2 references:
------------------------------------
05840H: LD DE,0585DH
05857H: LD HL,0585DH
Direct address 05899H. 1 references:
------------------------------------
05b39H: LD HL,05899H
Direct address 058a5H. 1 references:
------------------------------------
0589fH: LD DE,058A5H
Direct address 058b7H. 1 references:
------------------------------------
05af4H: LD HL,058B7H
Direct address 058e0H. 1 references:
------------------------------------
05adeH: LD HL,058E0H
Direct address 058ebH. 1 references:
------------------------------------
05a04H: EX DE,HL
Direct address 05907H. 1 references:
------------------------------------
05a08H: RLCA
Direct address 0590eH. 1 references:
------------------------------------
05a0aH: LD C,059H
Direct address 059c7H. 1 references:
------------------------------------
05969H: LD DE,059C7H
Direct address 05a04H. 2 references:
------------------------------------
05a63H: LD HL,05A04H
05b0bH: LD HL,05A04H
Direct address 05a20H. 1 references:
------------------------------------
05a72H: LD DE,05A20H
Direct address 05a3cH. 1 references:
------------------------------------
05a6eH: LD HL,05A3CH
Direct address 05a52H. 1 references:
------------------------------------
05b00H: LD HL,05A52H
Direct address 05a61H. 1 references:
------------------------------------
05af8H: LD HL,05A61H
Direct address 05b55H. 1 references:
------------------------------------
05b3fH: LD HL,05B55H
Direct address 0d753H. 1 references:
------------------------------------
05c6fH: LD DE,0D753H
Direct address 0e548H. 1 references:
------------------------------------
05bb9H: LD DE,0E548H
Direct address 0ffffH. 1 references:
------------------------------------
05bb3H: LD HL,0FFFFH
Indirect address Reference (120 entries)
----------------------------------------
Indirect address DTADR. 2 references:
-------------------------------------
05bd9H: LD HL,(01104H)
05c76H: LD HL,(01104H)
Indirect address DSPXY. 2 references:
-------------------------------------
0521bH: LD (01171H),A
05228H: LD (01171H),A
Indirect address DPRNT. 1 references:
-------------------------------------
0539bH: LD A,(01194H)
Indirect address 01201H. 1 references:
--------------------------------------
05b33H: LD (01201H),HL
Indirect address 01225H. 1 references:
--------------------------------------
05b3cH: LD (01225H),HL
Indirect address 01492H. 1 references:
--------------------------------------
05aceH: LD (01492H),A
Indirect address 01493H. 1 references:
--------------------------------------
05ad1H: LD (01493H),HL
Indirect address 0153eH. 1 references:
--------------------------------------
05ac5H: LD (0153EH),A
Indirect address 0153fH. 1 references:
--------------------------------------
05ac8H: LD (0153FH),HL
Indirect address 018b4H. 1 references:
--------------------------------------
05b11H: LD (018B4H),HL
Indirect address 01958H. 6 references:
--------------------------------------
05153H: LD HL,(01958H)
052bbH: LD HL,(01958H)
053bbH: LD HL,(01958H)
05935H: LD HL,(01958H)
0598cH: LD HL,(01958H)
05b0eH: LD (01958H),HL
Indirect address 01ac8H. 1 references:
--------------------------------------
05b14H: LD (01AC8H),HL
Indirect address 01ae2H. 1 references:
--------------------------------------
05b17H: LD (01AE2H),HL
Indirect address 01b14H. 1 references:
--------------------------------------
05b1aH: LD (01B14H),HL
Indirect address 01b1cH. 1 references:
--------------------------------------
05b1dH: LD (01B1CH),HL
Indirect address 01c16H. 1 references:
--------------------------------------
05aeaH: LD (01C16H),A
Indirect address 01c17H. 1 references:
--------------------------------------
05aefH: LD (01C17H),A
Indirect address 01c7dH. 2 references:
--------------------------------------
05b7cH: LD (01C7DH),A
05b84H: LD (01C7DH),A
Indirect address 01c7eH. 1 references:
--------------------------------------
05b20H: LD (01C7EH),HL
Indirect address 01ccdH. 1 references:
--------------------------------------
05a91H: LD (01CCDH),HL
Indirect address 01ccfH. 1 references:
--------------------------------------
05a97H: LD (01CCFH),HL
Indirect address 01cd1H. 1 references:
--------------------------------------
05a9aH: LD (01CD1H),HL
Indirect address 01ec2H. 1 references:
--------------------------------------
05b23H: LD (01EC2H),HL
Indirect address 022c9H. 1 references:
--------------------------------------
05a8bH: LD (022C9H),HL
Indirect address 028f5H. 2 references:
--------------------------------------
05b6cH: LD (028F5H),A
05b74H: LD (028F5H),A
Indirect address 02b11H. 1 references:
--------------------------------------
05aa0H: LD (02B11H),HL
Indirect address 02d44H. 1 references:
--------------------------------------
05b26H: LD (02D44H),HL
Indirect address 02f19H. 2 references:
--------------------------------------
05c9aH: LD (02F19H),A
05ca2H: LD (02F19H),A
Indirect address 02f24H. 1 references:
--------------------------------------
05b29H: LD (02F24H),HL
Indirect address 0303cH. 1 references:
--------------------------------------
05b2cH: LD (0303CH),HL
Indirect address 03042H. 1 references:
--------------------------------------
05b2fH: LD (03042H),HL
Indirect address 0307bH. 1 references:
--------------------------------------
05aa6H: LD (0307BH),HL
Indirect address 03140H. 1 references:
--------------------------------------
05ab7H: LD (03140H),A
Indirect address 03141H. 1 references:
--------------------------------------
05abdH: LD (03141H),HL
Indirect address 0315bH. 1 references:
--------------------------------------
05ab2H: LD (0315BH),HL
Indirect address 0318cH. 1 references:
--------------------------------------
05aa9H: LD (0318CH),HL
Indirect address 03199H. 1 references:
--------------------------------------
05aacH: LD (03199H),HL
Indirect address 031adH. 1 references:
--------------------------------------
05adbH: LD (031ADH),A
Indirect address 031aeH. 1 references:
--------------------------------------
05ae1H: LD (031AEH),HL
Indirect address 0322eH. 1 references:
--------------------------------------
05ad4H: LD A,(0322EH)
Indirect address 041ecH. 1 references:
--------------------------------------
05afdH: LD (041ECH),A
Indirect address 041ffH. 1 references:
--------------------------------------
05b36H: LD (041FFH),HL
Indirect address 0430dH. 1 references:
--------------------------------------
058c3H: LD A,(0430DH)
Indirect address 04a0eH. 5 references:
--------------------------------------
053ceH: LD HL,(04A0EH)
054f2H: LD HL,(04A0EH)
0557bH: LD HL,(04A0EH)
05582H: LD (04A0EH),HL
055e4H: LD HL,(04A0EH)
Indirect address 04a10H. 1 references:
--------------------------------------
05543H: LD HL,(04A10H)
Indirect address 04ab3H. 3 references:
--------------------------------------
052f3H: LD HL,(04AB3H)
0562eH: LD HL,(04AB3H)
05c1fH: LD HL,(04AB3H)
Indirect address 04ab5H. 3 references:
--------------------------------------
0530eH: LD HL,(04AB5H)
05647H: LD HL,(04AB5H)
05c14H: LD HL,(04AB5H)
Indirect address 04e4eH. 2 references:
--------------------------------------
0519fH: LD (04E4EH),HL
0532eH: LD (04E4EH),HL
Indirect address 04e94H. 2 references:
--------------------------------------
05175H: LD HL,(04E94H)
05179H: LD (04E94H),HL
Indirect address 0504eH. 1 references:
--------------------------------------
0536dH: LD A,(0504EH)
Indirect address 05051H. 2 references:
--------------------------------------
050ecH: LD (05051H),HL
05901H: LD (05051H),HL
Indirect address 05063H. 1 references:
--------------------------------------
0595bH: LD HL,(05063H)
Indirect address 05065H. 4 references:
--------------------------------------
050f3H: LD HL,(05065H)
051b8H: LD HL,(05065H)
05272H: LD HL,(05065H)
05954H: LD HL,(05065H)
Indirect address 05067H. 2 references:
--------------------------------------
0510aH: LD HL,(05067H)
0594aH: LD HL,(05067H)
Indirect address 05069H. 1 references:
--------------------------------------
051c6H: LD HL,(05069H)
Indirect address 0506bH. 2 references:
--------------------------------------
05149H: LD (0506BH),HL
05943H: LD HL,(0506BH)
Indirect address 05465H. 6 references:
--------------------------------------
05364H: LD (05465H),A
0538bH: LD A,(05465H)
05432H: LD A,(05465H)
05490H: LD (05465H),A
05553H: LD A,(05465H)
055c7H: LD (05465H),A
Indirect address 05466H. 6 references:
--------------------------------------
0548aH: LD (05466H),A
0549fH: LD A,(05466H)
055d6H: LD A,(05466H)
0590fH: LD (05466H),A
05963H: LD A,(05466H)
05978H: LD (05466H),A
Indirect address 05467H. 6 references:
--------------------------------------
05383H: LD (05467H),A
053b7H: LD A,(05467H)
054b3H: LD A,(05467H)
054f5H: LD A,(05467H)
05574H: LD A,(05467H)
055efH: LD A,(05467H)
Indirect address 05468H. 4 references:
--------------------------------------
053b2H: LD (05468H),A
054c9H: LD A,(05468H)
05535H: LD A,(05468H)
0556fH: LD A,(05468H)
Indirect address 05469H. 3 references:
--------------------------------------
05404H: LD (05469H),HL
0556cH: LD HL,(05469H)
05598H: LD A,(05469H)
Indirect address 0546bH. 4 references:
--------------------------------------
05424H: LD (0546BH),HL
054adH: LD HL,(0546BH)
054bfH: LD HL,(0546BH)
0551eH: LD HL,(0546BH)
Indirect address 05611H. 5 references:
--------------------------------------
05617H: LD (05611H),A
05628H: LD (05611H),A
057e3H: LD A,(05611H)
057f2H: LD A,(05611H)
057ffH: LD A,(05611H)
Indirect address 05612H. 2 references:
--------------------------------------
056a5H: LD (05612H),HL
05736H: LD HL,(05612H)
Indirect address 05614H. 1 references:
--------------------------------------
056faH: LD HL,(05614H)
Indirect address 058e0H. 1 references:
--------------------------------------
058fdH: LD (058E0H),A
End of reference file for "XPATCH-5510.bin"

330
dis/XPATCH/XPATCH.ini Normal file
View File

@@ -0,0 +1,330 @@
----------------------------------------
-- dZ80 configuration file
----------------------------------------
----------------------------------------
-- Disassembly control
----------------------------------------
cpu="z80"
inputfile="XPATCH-5510.bin"
outputfile="XPATCH-5510.asm"
--fileheadersize=27
filebaseaddr=20572
disstart=0
disend=23724
--disstart=0
--disend=3584
--quiet=0
labelledoutput=1
----------------------------------------
-- Layout
----------------------------------------
labelreference=1
addresscolumn=1
opcodecolumn=1
relativejumpcomment=1
uppercase=1
autoblanklines=1
db="db"
comment="; "
radix=16
numprefix="0"
numsuffix="H"
----------------------------------------
-- Scripts
----------------------------------------
--script="scripts\\spectrum.lua"
----------------------------------------
-- References
----------------------------------------
referencefile="XPATCH-5510.ref"
inportreference=1
outportreference=1
addressreference=1
indirectaddressreference=1
limitreferences=1
----------------------------------------
-- Opcode mapfile and code/data areas
----------------------------------------
--opmapfile="mayhem.map"
-- Code Region isnt required as v2.x sets the entire region to code unless a data region overrides it.
d_SetCodeRegion(20572, 3152)
-- Set the known data regions, either as a data region (byte), word or string. The type affects the assembly output definitions and word
-- regions will attempt to map to an address, ie. jump tables will be setup with labels rather than constants.
d_SetDataRegion( hex("507D"), 27)
d_SetStringRegion( hex("507D"), 11)
d_SetStringRegion( hex("5089"), 15)
d_SetDataRegion( hex("5255"), 23)
d_SetStringRegion( hex("5257"), 4)
d_SetStringRegion( hex("525C"), 15)
d_SetDataRegion( hex("5446"), 31)
d_SetStringRegion( hex("5446"), 12)
d_SetStringRegion( hex("5453"), 17)
d_SetDataRegion( hex("5465"), 8)
d_SetStringRegion( hex("55B3"), 18)
d_SetStringRegion( hex("55F8"), 25)
d_SetDataRegion( hex("5807"), 49)
d_SetStringRegion( hex("5807"), 23)
--d_SetStringRegion( hex("581F"), 5)
d_SetStringRegion( hex("5827"), 5)
d_SetStringRegion( hex("582F"), 5)
d_SetDataRegion( hex("585D"), 45)
d_SetStringRegion( hex("585D"), 4)
d_SetStringRegion( hex("5862"), 5)
d_SetStringRegion( hex("5868"), 7)
d_SetStringRegion( hex("5870"), 5)
d_SetStringRegion( hex("5876"), 3)
d_SetStringRegion( hex("587A"), 5)
d_SetStringRegion( hex("5880"), 3)
d_SetStringRegion( hex("5884"), 3)
--d_SetStringRegion( hex("585D"), 4)
--d_SetDataRegion( hex("58A5"), 59)
--d_SetStringRegion( hex("58A5"), 17)
--d_SetStringRegion( hex("58B7"), 40)
d_SetDataRegion( hex("59C7"), 25)
d_SetStringRegion( hex("59C7"), 24)
d_SetDataRegion( hex("5A04"), 56)
d_SetWordRegion( hex("5A04"), 28)
-- Reserved key words.
d_SetDataRegion( hex("5A20"), 28)
d_SetStringRegion( hex("5A20"), 3) -- LINE
d_SetStringRegion( hex("5A24"), 3) -- AUTO
d_SetStringRegion( hex("5A28"), 2) -- CLR
d_SetStringRegion( hex("5A2B"), 3) -- MOVE
d_SetStringRegion( hex("5A2F"), 5) -- COPY/P
d_SetStringRegion( hex("5A35"), 5) -- PAGE/P
d_SetDataRegion( hex("5A52"), 17)
d_SetStringRegion( hex("5A52"), 15)
-- Create a mapping table of known Sharp I/O ports and 8 bit constants.
--
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetByteEquate(hex("FE") , 1, "PRTC" )
d_SetByteEquate(hex("FF") , 1, "PRTD" )
-- Create a mapping table of known Sharp MZ BIOS/Memory Mapped Hardware addresses which dz80
-- can use to replace an address with the label. The EQU list will also be output at the start
-- of the disassembly file so it can compile.
-- Format Addr IsAddr Label : IsAddr = 0, value is a constant, = 1, value is an address.
d_SetWordEquate(hex("0003"), 1, "GETL" )
d_SetWordEquate(hex("0006"), 1, "LETNL" )
d_SetWordEquate(hex("0009"), 1, "NL" )
d_SetWordEquate(hex("000C"), 1, "PRNTS" )
d_SetWordEquate(hex("000F"), 1, "PRNTT" )
d_SetWordEquate(hex("0012"), 1, "PRNT" )
d_SetWordEquate(hex("0015"), 1, "MSG" )
d_SetWordEquate(hex("0018"), 1, "MSGX" )
d_SetWordEquate(hex("001B"), 1, "GETKY" )
d_SetWordEquate(hex("001E"), 1, "BRKEY" )
d_SetWordEquate(hex("0021"), 1, "?WRI" )
d_SetWordEquate(hex("0024"), 1, "?WRD" )
d_SetWordEquate(hex("0027"), 1, "?RDI" )
d_SetWordEquate(hex("002A"), 1, "?RDD" )
d_SetWordEquate(hex("002D"), 1, "?VRFY" )
d_SetWordEquate(hex("0030"), 1, "MELDY" )
d_SetWordEquate(hex("0033"), 1, "?TMST" )
d_SetWordEquate(hex("003B"), 1, "TIMRD" )
d_SetWordEquate(hex("003E"), 1, "BELL" )
d_SetWordEquate(hex("0041"), 1, "XTEMP" )
d_SetWordEquate(hex("0044"), 1, "MSTA" )
d_SetWordEquate(hex("0047"), 1, "MSTP" )
d_SetWordEquate(hex("0000"), 1, "MONIT" )
d_SetWordEquate(hex("0089"), 1, "SS" )
d_SetWordEquate(hex("0095"), 1, "ST1" )
d_SetWordEquate(hex("0410"), 1, "HLHEX" )
d_SetWordEquate(hex("041F"), 1, "_2HEX" )
d_SetWordEquate(hex("074D"), 1, "?MODE" )
d_SetWordEquate(hex("08CA"), 1, "?KEY" )
d_SetWordEquate(hex("096C"), 1, "PRNT3" )
d_SetWordEquate(hex("0BB9"), 1, "?ADCN" )
d_SetWordEquate(hex("0BCE"), 1, "?DACN" )
d_SetWordEquate(hex("0DB5"), 1, "?DSP" )
d_SetWordEquate(hex("0DA6"), 1, "?BLNK" )
d_SetWordEquate(hex("0DDC"), 1, "?DPCT" )
d_SetWordEquate(hex("03BA"), 1, "PRTHL" )
d_SetWordEquate(hex("03C3"), 1, "PRTHX" )
d_SetWordEquate(hex("03DA"), 1, "ASC" )
d_SetWordEquate(hex("03F9"), 1, "HEX" )
d_SetWordEquate(hex("0DDC"), 1, "DPCT" )
d_SetWordEquate(hex("0DA7"), 1, "DLY12" )
d_SetWordEquate(hex("0DAA"), 1, "DLY12A" )
d_SetWordEquate(hex("0EE6"), 1, "?RSTR1" )
d_SetWordEquate(hex("06A3"), 1, "MOTOR" )
d_SetWordEquate(hex("071A"), 1, "CKSUM" )
d_SetWordEquate(hex("077A"), 1, "GAP" )
d_SetWordEquate(hex("0485"), 1, "WTAPE" )
d_SetWordEquate(hex("0700"), 1, "MSTOP" )
d_SetWordEquate(hex("11FD"), 1, "TAPECOPY" )
d_SetWordEquate(hex("1200"), 1, "COLDSTRT" )
d_SetWordEquate(hex("1250"), 1, "WARMSTRTMON")
d_SetWordEquate(hex("15A8"), 1, "CMDWORDTBL" )
d_SetWordEquate(hex("1BB2"), 1, "CMDJMPTBL" )
d_SetWordEquate(hex("2E33"), 1, "CMTBUF" )
d_SetWordEquate(hex("2E34"), 1, "CMTFNAME" )
-- Known BASIC SA-5510 labels/addresses.
d_SetWordEquate(hex("1C3C"), 1, "CMDREMDATA" )
d_SetWordEquate(hex("13AB"), 1, "SYNTAXERR" )
d_SetWordEquate(hex("2D12"), 1, "CMDREAD" )
d_SetWordEquate(hex("1C4D"), 1, "CMDLIST" )
d_SetWordEquate(hex("1E91"), 1, "CMDRUN" )
d_SetWordEquate(hex("1C42"), 1, "CMDNEW" )
d_SetWordEquate(hex("2B0D"), 1, "CMDPRINT" )
d_SetWordEquate(hex("1D6A"), 1, "CMDLET" )
d_SetWordEquate(hex("1F2B"), 1, "CMDFOR" )
d_SetWordEquate(hex("21AD"), 1, "CMDIF" )
d_SetWordEquate(hex("13AB"), 1, "CMDTHEN" )
d_SetWordEquate(hex("1EA6"), 1, "CMDGOTO" )
d_SetWordEquate(hex("1EC7"), 1, "CMDGOSUB" )
d_SetWordEquate(hex("1EF8"), 1, "CMDRETURN" )
d_SetWordEquate(hex("1FC0"), 1, "CMDNEXT" )
d_SetWordEquate(hex("1D2C"), 1, "CMDSTOP" )
d_SetWordEquate(hex("1D15"), 1, "CMDEND" )
d_SetWordEquate(hex("203E"), 1, "CMDON" )
d_SetWordEquate(hex("2D75"), 1, "CMDLOAD" )
d_SetWordEquate(hex("2D82"), 1, "CMDSAVE" )
d_SetWordEquate(hex("2EB3"), 1, "CMDVERIFY" )
d_SetWordEquate(hex("2191"), 1, "CMDPOKE" )
d_SetWordEquate(hex("2080"), 1, "CMDDIM" )
d_SetWordEquate(hex("2201"), 1, "CMDDEFFN" )
d_SetWordEquate(hex("2BFF"), 1, "CMDINPUT" )
d_SetWordEquate(hex("1D4D"), 1, "CMDRESTORE" )
d_SetWordEquate(hex("21A6"), 1, "CMDCLS" )
d_SetWordEquate(hex("2269"), 1, "CMDMUSIC" )
d_SetWordEquate(hex("2282"), 1, "CMDTEMPO" )
d_SetWordEquate(hex("2942"), 1, "CMDUSRN" )
d_SetWordEquate(hex("2D9F"), 1, "CMDWOPEN" )
d_SetWordEquate(hex("2D92"), 1, "CMDROPEN" )
d_SetWordEquate(hex("2DAD"), 1, "CMDCLOSE" )
d_SetWordEquate(hex("28B6"), 1, "CMDMON" )
d_SetWordEquate(hex("2967"), 1, "CMDLIMIT" )
d_SetWordEquate(hex("29CE"), 1, "CMDCONT" )
d_SetWordEquate(hex("2902"), 1, "CMDGET" )
d_SetWordEquate(hex("29FE"), 1, "CMDINP" )
d_SetWordEquate(hex("2A1C"), 1, "CMDOUT" )
d_SetWordEquate(hex("28B9"), 1, "CMDCURSOR" )
d_SetWordEquate(hex("2AA6"), 1, "CMDSET" )
d_SetWordEquate(hex("2AAA"), 1, "CMDRESET" )
d_SetWordEquate(hex("2A2F"), 1, "CMDAUTO" )
d_SetWordEquate(hex("33AB"), 1, "CMDCOPY" )
d_SetWordEquate(hex("32D4"), 1, "CMDPAGE" )
d_SetWordEquate(hex("13AE"), 1, "OVFLERR" )
d_SetWordEquate(hex("13B1"), 1, "ILDATERR" )
d_SetWordEquate(hex("13B4"), 1, "DATMISERR" )
d_SetWordEquate(hex("13B7"), 1, "STRLENERR" )
d_SetWordEquate(hex("13BA"), 1, "MEMERR" )
d_SetWordEquate(hex("13C0"), 1, "LINELENERR" )
d_SetWordEquate(hex("13C3"), 1, "GOSUBERR" )
d_SetWordEquate(hex("13C6"), 1, "FORNEXTERR" )
d_SetWordEquate(hex("13C9"), 1, "FUNCERR" )
d_SetWordEquate(hex("13CC"), 1, "NEXTFORERR" )
d_SetWordEquate(hex("13CF"), 1, "RETGOSBERR" )
d_SetWordEquate(hex("13D2"), 1, "UNDEFFNERR" )
d_SetWordEquate(hex("13D5"), 1, "LINEERR" )
d_SetWordEquate(hex("13D8"), 1, "CONTERR" )
d_SetWordEquate(hex("13DB"), 1, "BADWRERR" )
d_SetWordEquate(hex("13DE"), 1, "CMDSTMTERR" )
d_SetWordEquate(hex("13E1"), 1, "READDATAERR")
d_SetWordEquate(hex("13E4"), 1, "OPENERR" )
d_SetWordEquate(hex("13E7"), 1, "UNKNWNERR" )
d_SetWordEquate(hex("13EA"), 1, "OUTFILEERR" )
d_SetWordEquate(hex("13ED"), 1, "PRTNRDYERR" )
d_SetWordEquate(hex("13F0"), 1, "PRTHWERR" )
d_SetWordEquate(hex("13F3"), 1, "PRTPAPERERR")
d_SetWordEquate(hex("13F6"), 1, "CHKSUMERR" )
d_SetWordEquate(hex("1347"), 1, "TITLEMSG" )
d_SetWordEquate(hex("1364"), 1, "COPYRMSG" )
d_SetWordEquate(hex("1384"), 1, "READYMSG" )
d_SetWordEquate(hex("138A"), 1, "ERRORMSG" )
d_SetWordEquate(hex("1391"), 1, "INMSG" )
d_SetWordEquate(hex("1395"), 1, "BREAKMSG" )
d_SetWordEquate(hex("139C"), 1, "BYTESMSG" )
d_SetWordEquate(hex("13A3"), 1, "ERRCODE" )
d_SetWordEquate(hex("1332"), 1, "MSGNL" )
d_SetWordEquate(hex("167B"), 1, "UNUSEDTBL1" )
d_SetWordEquate(hex("167D"), 1, "UNUSEDTBL2" )
d_SetWordEquate(hex("124E"), 1, "WARMSTRT" )
d_SetWordEquate(hex("167F"), 1, "OPERATORTBL")
d_SetWordEquate(hex("17FC"), 1, "STRTONUM" )
d_SetWordEquate(hex("1E88"), 1, "GETNUM" )
d_SetWordEquate(hex("173F"), 1, "SKIPSPACE" )
d_SetWordEquate(hex("173E"), 1, "INCSKIPSPCE")
d_SetWordEquate(hex("177B"), 1, "EXECHL" )
d_SetWordEquate(hex("1795"), 1, "EXECNOTCHR" )
d_SetWordEquate(hex("17A3"), 1, "MATCHCHR" )
d_SetWordEquate(hex("490D"), 0, "LINEBUFR" )
-- XPATCH labels/addresses.
d_SetWordEquate(hex("5A63"), 1, "XPINIT" )
d_SetWordEquate(hex("5B55"), 1, "RELOC3302" )
d_SetWordEquate(hex("5BB0"), 1, "RELOC4806" )
-- Comments to be added at fixed addresses.
d_SetComment( hex("1250"), "Sharp defined BASIC restart location from Monitor." )
d_SetComment( hex("5B55"), "Relocated to 0x3302 for 0x5B bytes." )
d_SetComment( hex("5BB0"), "Relocated to 0x4806 for 0xF8 bytes." )
d_SetComment( hex("5CA8"), "End of Relocated code." )
-- Known Sharp Constants.
d_SetWordEquate(hex("10F0"), 0, "ATRB" ) -- ATTRIBUTE
d_SetWordEquate(hex("10F1"), 0, "NAME" ) -- FILE NAME
d_SetWordEquate(hex("1102"), 0, "SIZE" ) -- BYTESIZE
d_SetWordEquate(hex("1104"), 0, "DTADR" ) -- DATA ADDRESS
d_SetWordEquate(hex("1106"), 0, "EXADR" ) -- EXECUTION ADDRESS
d_SetWordEquate(hex("1108"), 0, "COMNT" ) -- COMMENT
d_SetWordEquate(hex("1164"), 0, "SWPW" ) -- SWEEP WORK
d_SetWordEquate(hex("116E"), 0, "KDATW" ) -- KEY WORK
d_SetWordEquate(hex("1170"), 0, "KANAF" ) -- KANA FLAG (01=GRAPHIC MODE)
d_SetWordEquate(hex("1171"), 0, "DSPXY" ) -- DISPLAY COORDINATES
d_SetWordEquate(hex("1173"), 0, "MANG" ) -- COLUMN MANAGEMENT
d_SetWordEquate(hex("1179"), 0, "MANGE" ) -- COLUMN MANAGEMENT END
d_SetWordEquate(hex("117A"), 0, "PBIAS" ) -- PAGE BIAS
d_SetWordEquate(hex("117B"), 0, "ROLTOP" ) -- ROLL TOP BIAS
d_SetWordEquate(hex("117C"), 0, "MGPNT" ) -- COLUMN MANAG. POINTER
d_SetWordEquate(hex("117D"), 0, "PAGETP" ) -- PAGE TOP
d_SetWordEquate(hex("117F"), 0, "ROLEND" ) -- ROLL END
d_SetWordEquate(hex("118E"), 0, "FLASH" ) -- FLASHING DATA
d_SetWordEquate(hex("118F"), 0, "SFTLK" ) -- SHIFT LOCK
d_SetWordEquate(hex("1190"), 0, "REVFLG" ) -- REVERSE FLAG
d_SetWordEquate(hex("1191"), 0, "SPAGE" ) -- PAGE CHANGE
d_SetWordEquate(hex("1192"), 0, "FLSDT" ) -- CURSOR DATA
d_SetWordEquate(hex("1193"), 0, "STRGF" ) -- STRING FLAG
d_SetWordEquate(hex("1194"), 0, "DPRNT" ) -- TAB COUNTER
d_SetWordEquate(hex("1195"), 0, "TMCNT" ) -- TAPE MARK COUNTER
d_SetWordEquate(hex("1197"), 0, "SUMDT" ) -- CHECK SUM DATA
d_SetWordEquate(hex("1199"), 0, "CSMDT" ) -- FOR COMPARE SUM DATA
d_SetWordEquate(hex("119B"), 0, "AMPM" ) -- AMPM DATA
d_SetWordEquate(hex("119C"), 0, "TIMFG" ) -- TIME FLAG
d_SetWordEquate(hex("119D"), 0, "SWRK" ) -- KEY SOUND FLAG
d_SetWordEquate(hex("119E"), 0, "TEMPW" ) -- TEMPO WORK
d_SetWordEquate(hex("119F"), 0, "ONTYO" ) -- ONTYO WORK
d_SetWordEquate(hex("11A0"), 0, "OCTV" ) -- OCTAVE WORK
d_SetWordEquate(hex("11A1"), 0, "RATIO" ) -- ONPU RATIO
d_SetWordEquate(hex("11A3"), 0, "BUFER" ) -- GET LINE BUFFER
----------------------------------------
-- End of configuration file
----------------------------------------

Some files were not shown because too many files have changed in this diff Show More