====== Emulated Peripherals ====== * **Controlled by CFG Files** * FDD * QD * RAM (SROM/SRAM) * EMM * HTTP server * SIO/USARTShell * PS/2 mouse * **Controlled by ROM Files** * MZ-1R23(B) * MZ-1R24 * **Permanently Emulated** * ALU (AM9511, AM9512, SHARP ALU) * GDG, PCG, 80 column mode (SUC and K&P) * RTC * PSG (audio, DAC) ---- ===== Peripherals Controlled by CFG Files ===== ---- ==== The Importance of Configuration Files ==== |< 100% >| || @red: | The Unicard's behaviour is can be influenced using text configuration files, located on the SD card in the //\unicard\// folder. There are four types of configuration files: * the setup of the emulation of supported peripherals * the configuration of Unicards communication interface * the starting of Unicard Manager using MZF Loader * other ---- ==== Description of the Configuration Files ==== |< 100% >| || @red: | === Setup of the Emulation of Supported Peripherals === == fd<0..3>.cfg == If it exists and contains the path and name of an existing file with the floppy disk image, it is mounted into the emulated floppy dics drive. If not, the drive will appear empty. The range of the emulated floppy disk drive ports fd<0..3>.cfg is **0xD8-0xDF**, the booting drive is fd0. * [{{:unicard:emulation:unicardcfg_fd1.jpg|The contents of files fd<0..3>.cfg are as follows:\\ //fd0.cfg:// **CPM80.dsk**\\ //fd1.cfg:// **Tutecham.dsk**\\ //fd2.cfg:// **Lemmings.dsk**\\ //fd3.cfg:// **Kyrandia.dsk**}}] * [{{:unicard:emulation:unicardcfg_fd2.jpg|All emulated drives have a mounted floppy disk:\\ //fd0([A]:):// **CPM80.dsk**\\ //fd1([B]:):// **Tutecham.dsk**\\ //fd2([C]:):// **Lemmings.dsk**\\ //fd3([D]:):// **Kyrandia.dsk**}}] * [{{:unicard:emulation:unicardcfg_fd3.jpg|The contents of files fd<0,1,3>.cfg are as follows:\\ //fd0.cfg:// **CPM80.dsk**\\ //fd1.cfg:// **Tutecham.dsk**\\ //fd2.cfg: --removed--//\\ //fd3.cfg:// **Kyrandia.dsk**}}] * [{{:unicard:emulation:unicardcfg_fd4.jpg|The disk drive fd2([C]:) is empty:\\ //fd0([A]:):// **CPM80.dsk**\\ //fd1([B]:):// **Tutecham.dsk**\\ //fd2([C]:): --empty--//\\ //fd3([D]:):// **Kyrandia.dsk**}}] * [{{:unicard:emulation:unicardcfg_fd5.jpg|The contents of file fd1.cfg are as follows:\\ //fd0.cfg: --removed--//\\ //fd1.cfg:// **Tutecham.dsk**\\ //fd2.cfg: --removed--//\\ //fd3.cfg: --removed--//}}] * [{{:unicard:emulation:unicardcfg_fd6.jpg|All drives except for fd1([B]:) are empty:\\ //fd0([A]:): --empty--//\\ //fd1([B]:):// **Tutecham.dsk**\\ //fd2([C]:): --empty--//\\ //fd3([D]:): --empty--//}}] * [{{:unicard:emulation:unicardcfg_fd7.jpg|All files fd<0..3>.cfg were removed:\\ //fd0.cfg: --removed--//\\ //fd1.cfg: --removed--//\\ //fd2.cfg: --removed--//\\ //fd3.cfg: --removed--//}}] * [{{:unicard:emulation:unicardcfg_fd8.jpg|All the drives are empty:\\ //fd0([A]:): --empty--//\\ //fd1([B]:): --empty--//\\ //fd2([C]:): --empty--//\\ //fd3([D]:): --empty--//}}] == fd0disabled.cfg == Using an empty file fd0disabled.cfg we can prohibit the emulated disk drive fd0([A]:), even though the file fd0.cfg exists with correct path to the folder with the floppy disk image. * [{{:unicard:emulation:unicardcfg_fd9.jpg|The configuration file fd0.cfg for floppy disk drive fd0([A]:) refers to a floppy disk image containing CPM.}}] * [{{:unicard:emulation:unicardcfg_fd10.jpg|The floppy disk drive fd0([A]:) is mounted and is emulating the inserted booting floppy disk with CPM.}}] * [{{:unicard:emulation:unicardcfg_fd11.jpg|After turning on the computer, a successful CPM boot from the emulated disk drive FD0([A]:) will occur.}}] * [{{:unicard:emulation:unicardcfg_fd12.jpg|If we copy an empty file fd0disabled.cfg into folder \unicard\, we will prohibit booting from drive FD0([A]:).}}] [{{:unicard:emulation:unicardcfg_fd13.jpg|When displaying the Unicard parameters using a http server, we can see the status of disk drive fd0.}}] == qd.cfg == If it exists and contains a path and a name of an existing file with a Quick disk image, this image is mounted into the emulated QD drive. If the file does not exist, the QD drive wil not be emulated. The current firmware version also emulates recording. * [{{:unicard:emulation:unicardcfg_qd1.png|File qd.cfg does not exist.}}] * [{{:unicard:emulation:unicardcfg_qd2.png|The Quick disk image is not mounted, Quick disk is not emulated.}}] * [{{:unicard:emulation:unicardcfg_qd3.png|The commands for managing Quick disk are not doing anything.}}] * [{{:unicard:emulation:unicardcfg_qd4.png|File qd.cfg exists and contains a path to a file with the Quick disk image.}}] * [{{:unicard:emulation:unicardcfg_qd5.png|The Quick disk image is mounted, Quick disk is emulated.}}] * [{{:unicard:emulation:unicardcfg_qd6.png|The commands for managing Quick disk are working.}}] Quick disk can also be used in BASIC: * [{{:unicard:emulation:unicardcfg_bqd1.png|File qd.cfg exists and contains a path to a file with the Quick disk image.}}] * [{{:unicard:emulation:unicardcfg_bqd2.png|The Quick disk image is mounted, Quick disk is emulated.}}] * [{{:unicard:emulation:unicardcfg_bqd3.png|Quick disk can be used in BASIC 1Z-016.}}] Used ports: RW 0x74/0xF4 - SIO channel A data RW 0x75/0xF5 - SIO channel B data RW 0x76/0xF6 - SIO channel A control RW 0x77/0xF7 - SIO channel B control == Warning == //The numbers of ports used for working with Quick disk are changed for Sharp MZ-1500 from default values used for Sharp MZ-700 and Sharp MZ-800 **0xF4-0xF7** to new values **0x74-0x77**. For working with emulated Quck disk on Sharp MZ-1500 it is necessary to have a modified ROM for programs using QD routines from ROM and modified BASIC for working with BASIC. In the case of a disconnected QD SIO, firmware will be available with standard port numbers, even for Sharp MZ-1500.// An emulated QD drive also allows running programs and games on multiple disks. If the file of the mounted Quick disk image has the name //filename//**_**A//.mzq// or //filename//**-**1//.mzq// (the character **'_'** or **'-'** is before the last position in the file name), then the Unicard will, after finishing reading from the emulated QD drive, which results in switching off the motor, increment after 3 seconds the last character of the file name ('A'->'B','B'->'C','1'->'2','2'->'3'...) and if a Quick disk image with this name exists, it will be mounted instead of the previous Quick disk image. Multiple images can be chained this way. If there are no more Quick disk images with appropriate file names, the image marked in file qd.cfg will be used again. After being asked to change the Quick disk in the emulated QD drive, it is therefore necessary to wait for at least 3 seconds, so the Unicard can mount the next image of the emulated Quick disk and then confirm the changing of the Quick disk. * [{{:unicard:emulation:unicardcfg_qdn1.png|Images of programs or games on 2 Quick disks need to be correctly named **Flappy-A.mzq** and **Flappy-B.mzq**. Mount **Flappy-A.mzq** as emulated Quick disk.}}] * [{{:unicard:emulation:unicardcfg_qdn2.png|The first image of the Quick disk **Flappy-A.mzq** is mounted and QD is emulated.}}] [{{:unicard:emulation:unicardcfg_qdn3.png |After running the game from Quick disk, the first part of the game **Flappy-A.mzq** will start.}}] [{{:unicard:emulation:unicardcfg_qdn4.png |After being asked to insert another Quick disk and waiting for 3 seconds for the QD motor to switch off, the second image of the Quick disk **Flappy-B.mzq** is mounted.}}] [{{:unicard:emulation:unicardcfg_qdn5.png |Now you can confirm that the second Quick disk **Flappy-B.mzq** has been inserted and the game will run.}}] [{{:unicard:emulation:unicardcfg_qdn6.png |If the Quick disk images are named correctly, it is possible to run programs and games even on multiple Quick disks.}}] ---- == ramdisc.cfg == If it exists and contains a path and a name of an existing file with the RAM (SROM/SRAM) disk image, the emulation is working. Unicard supports emulation on files of these sizes: 64k,128k,256k,512k,1M,2M,4M,8M,16M. If the file's image is smaller than 64kb, the Unicard will stop emulating. RAM disk can also be used in BASIC: * [{{:unicard:emulation:unicardcfg_brd1.png|The file ramdisc.cfg exists and contains a path to the file with a RAM disk image.}}] * [{{:unicard:emulation:unicardcfg_brd2.png|The RAM disk image is mounted, the RAM disk is being emulated.}}] * [{{:unicard:emulation:unicardcfg_brd3.png|RAM disk can be used in BASIC 1Z-016.}}] Used ports for the individual emulation modes: RD mode: ========= -W 0xE9 - set bank (0x00-0xFF) for MZ-700 or MZ-800 (not for MZ-1500!) RW 0xEA - I/O data, addr++ -W 0xEB - set addr, Data(D0-7) = LoBYTE, Addr(8-15) = HiBYTE (on Unicard LoBYTE only) R- 0xF8 - reset addr and page -W 0xF8 - set HiBYTE addr SROM/SRAM mode: ================ R- 0xF8/0xA8 - reset addr R- 0xF9/0xA9 - read data, addr++ -W 0xFA - write data, addr++ ---- == emm.cfg == Using a file with size 640kB emulates a 640kB PIO-3034 EMM disk drive, which supports HuBASIC for MZ-700 (also works on MZ-800 and MZ-1500), PIO EMM uses ports **0x00-0x03**, Unicard supports up to 1 EMM drive. EMM disk can also be used in BASIC: * [{{:unicard:emulation:unicardcfg_bem1.png|The file emm.cfg exists and contains a path to the file with an image of an EMM drive.}}] * [{{:unicard:emulation:unicardcfg_bem2.png|The EMM disk is mounted, EMM disk is being emulated.}}] * [{{:unicard:emulation:unicardcfg_bem3.png|EMM disk can be used in HuBASIC.}}] Used ports: RW 0x00 - read/set LowBYTE addr RW 0x01 - read/set MidBYTE addr RW 0x02 - read/set HiBYTE addr RW 0x03 - read/write data, addr++ ---- === Configuration of the communication interface === == network.cfg == Contains in text form the settings of the parameters used to configure the network for accessing the HTTP Server, the pre-set values are mentioned in brackets: HWADDR\\ IPADDR\\ NETMASK\\ GATEWAY\\ = \\ = \\ = \\ = \\ (hash from a UniqueID processor in range 00:1C:EE:XX:XX:XX)\\ (192.168.1.10)\\ (255.255.255.0)\\ (192.168.1.20)\\ The network parameters can be reviewed through [[en:unicard:httpserver|HTTP Server]] interface or [[en:unicard:uniusartshell|USARTShell]] interface, using the program UniUSARTShell. DHCP is not supported. Configuration of the file network.cfg IPADDR=192.168.1.111 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 ---- == ushelldisabled.cfg == If it exists in file location /unicard/ushelldisabled.cfg, then USB is available for SHARP as emulated SIO channel B ports **0xB0-0xB3**, if not, the communication interface [[en:unicard:uniusartshell|USARTShell]] is running. RW 0xB0 - Z80SIO channel A data RW 0xB1 - Z80SIO channel A control RW 0xB2 - Z80SIO channel B data RW 0xB3 - Z80SIO channel B control ---- === MZFLoader === == mzfloader.cfg == The configuratuin file containing the path to MZF, which is run by MZFLoader - usually contains path and a name of the file with the [[en:unicard:unimanager|Unicard Manager]]. MZFloader is generally run from an emulated SRAM disk or Quick disk. Unicard will, after a reset, temporarily set up on the computer its own SRAM disk with the MZFloader, which is then downloaded and run. MZFloader will then search the mzfloader.cfg file and run a program mentioned in it (usually the Unicard manager). Only then will it set up the RAM (SRAM) disk according to the contents of the appropriate configuration file. This function works relatively well on MZ-1500, but is not completely reliable on MZ-800. Sometimes it can help to enter the monitor using the M key (or M+Reset) and to run MZFloader from the SRAM disk using the command **EB**. If you do not need to actively use the RAM disk, you can put mzfloader.ram in it directly, which works better, but watch out for overwriting the RAM disk by, for example, running BASIC or CP/M. If you do not need to actively use Quick disk, it is best to start the MZFloader from it - copy mzfloader.mzq into the QD device. Running MZFloader from QD is reliable on all platforms. If all you need is to run MZF programs and games, it is the recommended solution for now. At the same time, if you have a floppy disk mounted in of the virtual drives, use Q+Reset to directly load QD instead of running FD, which otherwise has higher priority. Configuring the configuration file for Sharp MZ-800 and UniManager mgr800.mzf /unicard/mgr800.mzf ---- Configuring the configuration file for Sharp MZ-1500 and UniManager mgr1500.mzf /unicard/mgr1500.mzf ---- === Other === == mouse.cfg == The existence of this file turns on PS/2 mouse emulation on port **0x71**. Normally, programs with mouse support use the second JoyPort on port **0xF1**. Because it is impossible to turn it off and a Unicard emulation would interfere with it, the Unicard emulation is moved to port **0x71**. If you want to use this emulation, you have to have the default port modified to the emulated one for programs and games. ---- ===== Peripherals run by ROM files ===== ---- ==== ROM cards ==== |< 100% >| || @red: | Unicard also emulates peripherals that do not need configuration and are not activated by the contents of or the existence of a CFG file. These are peripherals, whose emulation is activated by the presence of binary ROM images in the //\unicard\// folder == MZ-1R23(b) == If we copy file mz1r23.rom (mz1r23b.rom), containing a binary image of a ROM KANJI MZ-1R23 card into the //\unicard\// folder, the Unicard will emulate this card on ports **0xB8-0xB9**. == MZ-1R24 == If we copy file mz1r24.rom, containing a binary ROM image of a dictionary card MZ-1R24 into the //\unicard\// folder, the Unicard will emulate it on ports **0xB8-0xB9**, same as with MZ-1R23. ---- ===== Permanently emulated peripherals ===== ---- ==== Math Coprocessors ==== |< 100% >| || @red: | As of 08/2018, the Unicard emulates 3 types of math coprocessors. AM9511(I8231,CI8231..), AM9512(I8232,CI8232..) and a coprocessor for calculations in SHARP BASIC numerical representation internally called SHARP ALU. When a command is entered, ALU will activate bit BUSY, which returns to zero after it is finished. The data reading routine therefore has to wait for ALU to not be BUSY. It is not necessary to block wait or anytihng like that. The communication and supported math functions and operations are similar for all types of coprocessors. == ALU == AM9511, AM9512, SHARP ALU AM9511 * 0x00 NOP - No Operation * 32-Bit Floating Point Instructions * 0x01 SQRT - Square Root of A * 0x02 SIN - Sine of A (radians) * 0x03 COS - Cosine of A (radians) * 0x04 TAN - Tangent of A (radians) * 0x05 ASIN - Inverse Sine of A * 0x06 ACOS - Inverse Cosine of A * 0x07 ATAN - Inverse Tangent of A * 0x08 LOG - Common Logarithm (base 10) of A * 0x09 LN - Natural Logarithm of A * 0x0a EXP - eA Function * 0x0b PWR - B^A Power Function * 0x10 FADD - Add A and B * 0x11 FSUB - Substract A from B * 0x12 FMUL - Multiply A and B * 0x13 FDIV - Divide B by A * 0x15 CHSF - Sign Change of A * 0x17 PTOF, PTOD - Stack Push * 0x18 POPF, POPD - Stack Pop * 0x19 XCHF, XCHD - Exchange A and B * 0x1a PUPI - Push PI onto Stack * 0x1C FLTD - 32-Bit Integer to Floating Point Conversion * 0x1D FLTS - 16-Bit Integer to Floating Point Conversion * 0x1E FIXD - Floating Point to 32-Bit Integer Conversion * 0x1F FIXS - Floating Point to 16-Bit Integer Conversion * 32-Bit Integer Instructions * 0x2C DADD - 32-bit fixed point add * 0x2D DSUB - 32-bit fixed point substract * 0x2E DMUL - 32-bit fixed point multiply, lower * 0x2F DDIV - 32-bit fixed point divide * 0x34 CHSD - 32-bit fixed-point sign change * 0x36 DMUU - 32-bit fixed point multiply, upper * 16-Bit Integer Instructions * 0x6C SADD - Add Au and Al * 0x6D SSUB - Substract Au from Al * 0x6E SMUL - Multiply Al and Au (R=lower 32-bits) * 0x6F SDIV - Divide Au and Al * 0x74 CHSS - 16-bit fixed-point sign change * 0x76 SMMU - Multiply Al and Au (R=upper 32-bits) * 0x77 PTOS - Stack Push * 0x78 POPS - Stack Pop * 0x79 XCHS - Exchange A and B * 0x7f - Push ALU1 signature '9511' onto stack AM9512 * 0x00 CLR - CLR status * 32-Bit Floating Point Instructions * 0x01 SADD - Add A and B * 0x02 SSUB - Substract A from B * 0x03 SMUL - Multiply A by B * 0x04 SDIV - Divide B by A. if exponent = 0 then R = B * 0x05 CHSS - Change sign of A * 0x06 PTOS - Push stack * 0x07 POPS - Pop stack * 0x08 XCHS - Exchange * 64-Bit Double Floating Point Instructions * 0x29 DADD - Add A and B * 0x2A DSUB - Substract A from B * 0x2B DMUL - Multiply A by B * 0x2C DDIV - Divide B by A, If A = 0, then R = B * 0x2D CHSD - Change sign of A * 0x2E PTOD - Push stack * 0x2F POPD - Pop stack * 0x7f - Push ALU2 signature '8232' onto stack SHARP ALU - BASIC 5-Byte numbering format * 0x00 NOP - No Operation * 0x01 SADD - Add A and B * 0x02 SSUB - Substract A from B * 0x03 SMUL - Multiply A by B * 0x04 SDIV - Divide B by A. if exponent = 0 then R = B * 0x05 CHSS - Change sign of A * 0x06 PTOS - Push stack * 0x07 POPS - Pop stack * 0x08 XCHS - Exchange * 0x10 SQRT - Square Root of A * 0x12 SIN - Sine of A (radians) * 0x13 COS - Cosine of A (radians) * 0x14 TAN - Tangent of A (radians) * 0x15 ASIN - Inverse Sine of A * 0x16 ACOS - Inverse Cosine of A * 0x17 ATAN - Inverse Tangent of A * 0x18 LOG - Common Logarithm (base 10) of A * 0x19 LN - Natural Logarithm of A * 0x1a EXP - eA Function * 0x1b PWR - B^A Power Function * 0x2a PUPI - Push PI onto Stack * 0x7f - Push ALU3 signature 'M801' onto stack BASIC is modified to calculate these function through SHARP ALU: SQR EXP LOG LN SIN (COS) TAN ATN x ^ y x * y x / y x + y x - y \\ {{unicard:emulation:mz-alu-20180614.zip|Modified BASIC and examples of ALU use.}} ---- ==== VGA output ==== |< 100% >| || @red: | == GDG, PCG, 80 column mode (SUC a K&P) == The Unicard takes in all the communication with GDG and a video memory and emululates a graphics output, which outputs to VGA in full resolution. * **MZ-700** - for now, there is no emulation of the external peripheral PCG700, but both 80 column modifications are emulated - Sharp Users Club (SUC) and K&P 80 column interface * **MZ-800** - standard functionality is fully emulated. With Japanese programs for MZ-700, it is possible to, when running MZF, using key 'J' define the Japanese character set * **MZ-1500** - is also fully emulated, including RGB PCG, but some programs have graphical artifacts on the Unicard VGA output due to timing issues [{{:unicard:emulation:unicardcfg80.png|On Unicard VGA output **MZ-700**, there is an emulated SUC modification, so an 80 column mode works.}}] [{{:unicard:emulation:unicardcfg40.png|Using **MZ-700** without the SUC hardware modification, you will see through the composite output the default 40 column mode and in it every other character, because the emulation of a SUC modification is only functional on a Unicard VGA output.}}] ==== Other ==== |< 100% >| || @red: | == RTC == The Unicard contains a real time clock maintained by a battery. If you do not need or want the clock, you do not have to install the battery. The clock is used by the Unicard file system when creating or modifying files and are controllable through MZFrepo interface. This can then be used by some applications. For example, UNIUTIL can read the time from the Unicard and set it into CP/M. It is best done automatically when starting CP/M. == PSG (audio, DAC) == Emulating sound on the audio output, mono output is split into stereo. Currently, only PSG output is emulated, and not i8253, the output is line only, it will not handle headphones. SV2 jumpers switch the connection of two pins of the four point jack on Samsung × Apple standard - the ground is either closest to the cable or second closest, and the input is the other one, for a three pole connector it should not matter, the ground is over both of them.