---------------------------------------------------------------------------- MU.COM MU - Memory Mapper Utility system - for MSX1/2/2+/turboR version 1.05 Copyright (C) 1993-1995 Yoshikazu Yamamoto ---------------------------------------------------------------------------- 1/ What is MU? MU is a mapper management system with RAM-disk driver for MSX-DOS 1. Up to two RAM-disks can be used. To use MU, a memory mapper of at least 80K is required. MU does not work under MSX-DOS 2. On turboR press the [1] key during startup until the "beep" if the disk is formatted under MSX-DOS2 or Disk-BASIC 2.0. 2/ How to activate In order to use MU, please copy MSXDOS.SYS, COMMAND.COM and MU.COM to an MSX-DOS bootable disk (MSX-DOS formatted disk). To activate MU, enter the DOS command as follows: A>MU [option] [RAM-disk 1 size [RAM-disk 2 size]] The RAM-disk size is specified in kilobytes. The specified value will be rounded up to the nearest multiple of 16. The maximum size is 992K. The following options can be specified: /Z80 -> Set the CPU to Z80 mode. (turboR only) /ROM -> Set the CPU to R800 ROM. (turboR only) /DRAM -> Set the CPU to R800 DRAM. (turboR only) /B -> Specify this option if MU starts from AUTOEXEC.BAT (see below for details) The CPU mode and RAM-disk size can also be set with the configuration file as described later. If no error occurs, the DOS prompt will display the slot number and RAM capacity of the memory mapper, and the RAM-disk size. Examples of use: A>MU Installs MU according to the contents of the configuration file. A>MU/ROM Sets the CPU to R800 ROM mode and installs MU. The RAM-disk installation will depend on the configuration file. A>MU 720 Installs MU and creates a RAM-disk of 720K. CPU mode and second RAM-disk installation will depend on the configuration file. A>MU/DRAM 720 64 Installs MU, sets the CPU mode to R800 DRAM and creates two RAM-disks, one of 720K and another of 64K. 3/ Error messages Below are the errors that may occur at MU startup. - No mapper RAM. No memory mapper found. You probably forgot to insert the cartridge into the slot. - No enough segment. Mapper RAM is insufficient (less than 80K). Please increase the mapper RAM. - HIMSAV is modified. A program secured a work area before installing MU. Please reset and install up MU again. This error occurs when MU is installed after executing _KANJI, _MUSIC, etc under BASIC. This error also occurs when trying to install under DOS 2. - MU system already exists. MU is already installed. 4/ Configuration file In the configuration file you can specify the RAM-disk size and the CPU mode when using turbo R. The name of the configuration file is MU.CNF. It is read from the current drive. Note that the options specified on the command line take priority over the contents of the configuration file. The format of configuration file lines is as follows: Attribute : Value The following describes the attributes that can be specified. * RAM-disk1 The value is a decimal value that specifies the size of the first RAM-disk in kilobytes. The value specified can be between 0 and 992, and is rounded up to the nearest 16K. If you specify a number greater than 992, it will be treated as 992. The format is: RAM-disk1 : nn [K] The default value is 0. * RAM-disk2 Specifies the size of the second RAM-disk. Set it the same as RAM-disk 1. The format is: RAM-disk2 : nn [K] If you do not create a first RAM-disk, you will not be able to create a second one. * CPUMODE Specifies the CPU mode used on turboR. It has no effect on MSX 1/2/2+. It can specify Z80, R800 ROM or R800 DRAM. The format is: CPUMODE : {Z80|R800ROM|R800DRAM} When CPUMODE is not specified, the CPU mode doesn't change. Below is an example configuration file: ========= (MU.CNF sample) ========= RAM-disk1 : 720 RAM-disk2 : 64 CPUMODE : R800ROM =================================== 5/ Install from AUTOEXEC.BAT When MU is put in a batch file (.BAT), the execution of commands stops at the execution of MU. This is because DOS is reset when MU is installed. Therefore, it was not possible to put MU in the AUTOEXEC.BAT and copy files to the RAM-disk. So I added the /B option to v1.05 for it to be possible. If you execute MU with the /B option, the screen is cleared and the usual MSX-DOS boot-up message is displayed again. At this point, AUTOEXEC.BAT will run again from the beginning. Then, when MU is run for the second time, the RAM and RAM-disk information for the mapper is displayed and the next line in AUTOEXEC.BAT is executed. Since AUTOEXEC.BAT is executed twice, be sure to put MU on the first line. Otherwise, the commands placed above it will be executed twice. In addition, if another program is executed between the first execution of MU and the second, an error or bug could occur. Below is an example AUTOEXEC.BAT: ========= (AUTOEXEC.BAT sample) ========= MU/B 720 COPY MSXDOS.SYS C: COPY COMMAND.COM C: ========================================= 6/ MU extended BIOS The device number of MU's extended BIOS is 84H. To use MU's extended BIOS, set the parameters for each function and call 0FFCAH. Please use GET_VER first to confirm if it is installed before using MU's extended BIOS functions. Name GET_VER Function Get MU version number Entry A = 0 D = 84H E = 00H Output A = 1 when installed, 0 if not HL = Version number (H = major version / L = minor version) Name ALL_SYSSEG Function Allocate a system segment Entry D = 84H E = 10H Output Cy = 0: Successful / 1: Failed A = Segment number B = Slot number Name FRE_SEG Function Free a segment Entry A = Segment number B = Slot number D = 84H E = 11H Output Cy = 0: Successful / 1: Failed Comment Use this function to free system and user segments. Name ALL_USRSEG Function Allocate a user segment Entry D = 84H E = 20H Output Cy = 0: Successful / 1: Failed A = Segment number B = Slot number Name FRE_USRSEGS Function Free all user segments Entry D = 84H E = 21H Output None 7/ MSX-DOS2 compatible extended BIOS mapper support routines The standard device number of the extended BIOS mapper support routines is 04H. MU uses the same device number as provided by MSX-DOS 2. To use the mapper support routines, set the parameters for each function and call 0FFCAH. Name GET_VARTAB Function Get the variable table of all memory mappers Entry A = 0 D = 04H E = 01H Output A = Primary mapper slot number, 0 if mapper support routines are not available. HL = Address of the variable table Modifies All registers The memory mapper variable table has the following format: Offset Function 0 Slot number of the mapper 1 Number of 16K segments 2 Number of free segment(s) 3 Number of segments allocated by the system 4 Number of segments allocated by the user 5 Reserved 6 Reserved 7 Reserved 8 Slot number of next mapper, 0 if not . . . Name GET_JMPTAB Function Get the jump table address of the memory mapper routines Entry D = 04H E = 02H Output A = Number of segments of the primary memory mapper B = Primary mapper slot number C = Number of free segments of the primary memory mapper HL = Jump table address The memory mapper jump table has the following format: Offset Name Function 0H ALL_SEG Allocate a 16K segment 3H FRE_SEG Free a 16K segment 6H RD_SEG Read 1 byte from the segment specified by A at the address pointed to by HL 9H WR_SEG Write 1 byte from E to the segment specified by A at the address pointed to by HL CH CAL_SEG Inter-segment call FH CALLS Inter-segment call 12H PUT_PH Put a segment on the bank specified by HL 15H GET_PH Get the segment number of the bank specified by HL 18H PUT_P0 Put a segment on bank 0 1BH GET_P0 Get the segment number of bank 0 (0000h~3FFFh) 1EH PUT_P1 Put a segment on bank 1 21H GET_P1 Get the segment number of bank 1 (4000h~7FFFh) 24H PUT_P2 Put a segment on bank 2 27H GET_P2 Get the segment number of bank 2 (8000h~CFFFh) 2AH PUT_P3 No effect 2DH GET_P3 Get the segment number of bank 3 (C000h~FFFFh) The supported memory mapper routines are listed below. The entry point is indicated by an offset from the first address of the mapper jump table whose address can be determined by calling GET_JMPTAB. With MSX-DOS 2’s extended BIOS mapper support routines the user segments are automatically freed at the end of the program, but this is not the case with the MU extended BIOS mapper support routines. Before returning to DOS, call the FRE_USRSEGS function of MU's extended BIOS to free the user segments. Name ALL_SEG Function Allocate a memory mapper segment Offset +00H Entry A = 0 to allocate a user segment, 1 for a system segment B = Slot number (FxxxSSPP) and allocation method F000SSPP only the specified slot F001SSPP any other than the specified slot F010SSPP prefer the specified slot F011SSPP prefer any other than the specified slot B = 0 to allocate a segment from the primary memory mapper Output Cy = 1 if nothing has been allocated A = Segment number B = Slot number Modifies F Note Stack must be in bank 1 or 3 Name FRE_SEG Function Free a segment Offset +03H Entry A = Segment number B = Mapper slot number (0 for the primary memory mapper) Output Cy = 1 if nothing has been freed Modifies AF Note Stack must be in bank 1 or 3 Name RD_SEG Function Read a byte in a segment Offset +06H Entry A = Segment number HL = Address (the two most significant bits are ignored) Output A = Value read Modifies F Notes - The mapper slot must be selected in bank 2 - Stack must be on another bank - Interrupts are disabled Name WR_SEG Function Write a byte to a segment Offset +09H Entry A = Segment number HL = Address (the two most significant bits are ignored) E = Value to write Output Nothing Notes - The mapper slot must be selected in bank 2 - Stack must be on another bank - Interrupts are disabled Name CAL_SEG Function Call a routine in a segment Offset +0CH Entry IX = Address (bank 3 not possible) IYh = Segment number Registers AF, BC, DE and HL are passed to the routine Output Registers AF, BC, DE and HL are returned from the routine Modifies AF', BC', DE', HL', IX, IY, registers used as output parameters Notes - Stack must be on another bank - The mapper segment's slot must be selected at the address - Interrupts are not disabled Name CALLS Function Call a routine in a segment Offset +0FH Entry Registers AF, BC, DE and HL are passed to the routine The three bytes following the statement CALL CALLS must be: CALL CALLS DB SEG ;Segment number DW ADRS ;Address (bank 3 not possible) Output Registers AF, BC, DE and HL are returned from the routine Modifies AF', BC', DE', HL', IX, IY, registers used as output parameters Notes - Stack must be on another bank, - The mapper segment's slot must be selected at the address - Interrupts are not disabled Name PUT_PH Function Put a segment on the specified bank Offset +12H Entry A = Segment number H = Bits 6~7 specify the bank number (bank 3 not possible) Output Nothing Modifies Nothing Note Be sure to restore the original segment before returning to DOS Name GET_PH Function Get the segment number selected on the specified bank Offset +15H Entry H = Bits 6~7 specify the bank number Output A = Segment number Modifies A Name PUT_P0, PUT_P1, PUT_P2 Function Put a segment on the corresponding bank Name PUT_P0, PUT_P1, PUT_P2 Offset +18H PUT_P0 +1EH PUT_P1 +24H PUT_P2 Entry A = Segment number Output Nothing Modifies Nothing Note Be sure to restore the original segment before returning to DOS Name GET_P0, GET_P1, GET_P2, GET_P3 Function Get the segment number selected on the corresponding bank Offset +1BH GET_P0 +21H GET_P1 +27H GET_P2 +2DH GET_P3 Entry Nothing Output A = Segment number Modifies A 8/ References [1] "MSX2 Technical Handbook", ASCII and Publication Administration, 1986 [2] "MSX Magazine", ASCII Corporation, Jan-Mar 1991 [3] "MSX Technical Guidebook Fourth Edition", ASCAT Editorial Department, 1992 [4] "MSX Technical Guidebook Disk Version 2nd Edition ", ASCAT Editorial Department, 1993 9/ Use, distribution and copyrights This software is copyrighted. It is not a abandonware! This software can be used / distributed / released for free as long as it is not for commercial purpose. However, please contact the author beforehand in case of resale. I do not assume any responsibility for problems with using this software. --- Author: Yoshikazu Yamamoto Date: 1995/08/13 Translation: GDX & Grauw