FM TOWNS / Marty Emulator "Tsugaru"
FM TOWNS / Marty ãšãã¥ã¬ãŒã¿ ã接軜ã
by CaptainYS
Introduction
It is an emulator of legendary Fujitsu FM TOWNS computer including Marty. The goal is to emulate model II MX, which was the last computer I pledged allegiance. Also I am trying to find and document undocumented features of FM TOWNS system as much as possible while writing the emulator.
Have been tested on Windows 10 and macOS. I think it runs on Linux, but I have a report that audio doesn't work on the natively-running Linux. I can hear audio on my developing environment on Virtual Box. I haven't been able to confirm the report on my side yet.
äŒèª¬ã®åæ©å¯å£«éFM TOWNS/Martyã®ãšãã¥ã¬ãŒã¿ã§ããç®æšã¯ã¢ãã«II MXãåçŸããããšã§ããFM TOWNS II MXã¯åãæåŸã«å¿ èª ãèªã£ãæ©çš®ã§ããããŸããéçºãšäžŠè¡ããŠFM TOWNSã®ã·ã¹ãã ã§æªå ¬éã®æ©èœãèŠã€ããŠèšé²ã«æ®ãããšãç®æšã«ããŠããŸãã
ãšãããããWindows 10ãšmacOSXã§åããŸããLinuxã察å¿ãããšæããã§ãããVirtual Boxäžã®éçºç°å¢ã ãšæ®éã«é³ã鳎ãã®ã§ãããçŽæ¥èµ·åããŠããLinuxã§é³ãåºãªããšããå ±åãããã®ã§ããããŸã 確èªã§ããŠãŸããã
ROMS
The ROM set is compatible with another FM TOWNS emulator UNZ. You can get the best experience if you own an actual FM TOWNS hardware and extract ROM image from your TOWNS. However, if you do not own your FM TOWNS hardware, you can use the following free version of the ROM.
http://ysflight.com/FM/towns/FreeTOWNS/e.html
ROMã€ã¡ãŒãžã¯FM TOWNSãšãã¥ã¬ãŒã¿UNZãšäºææ§ããããŸããå®æ©ãææããŠããæ¹ã¯ãå®æ©ããæãåºããROMã€ã¡ãŒãžã䜿ãã®ãæãé«ãåçŸæ§ãåºãããšãã§ããŸãããå®æ©ãææããŠããªãå Žåã¯ã以äžã®URLããããªãŒã®äºæROMãããŠã³ããŒãããŠäœ¿ãããšãã§ããŸãã
http://ysflight.com/FM/towns/FreeTOWNS/j.html
LIMITATIONS
The emulation is getting better. Thanks to the great help from the users around the world, with conservative estimate Tsugaru can run more than 97% of the FM TOWNS commercial application titles. Emulation state is in the Wiki (https://wiki3.jp/fmtowns/page/10). Wiki is set up by WINDY. (Thanks!) Overall, I think it is safe to say more than 97% of FM TOWNS apps works.
80486 emulation is, getting faster, but there is a room for improvement. Will be improved down the road.
Not-all instructions of Intel 80486 processor have been implemented yet. Towns OS didn't use task registers. I have no plan on adding support for those registers. Since the emulator works as a debugger, debug registers won't be supported, either.
If you compile in High-Fidelity Mode (cmake from srchf instead of src), it is able to start Windows 3.1, but only limited functionalities are supported.
ãšãã¥ã¬ãŒã·ã§ã³ã¯ããªããããªã£ãŠããŠãäžçäžã®ãŠãŒã¶ã®çããŸã®ãååã«ãããå°ãªãèŠç©ãã£ãŠFM TOWNSçšã«çºå£²ããããœããã®97%以äžãåäœå¯èœãšæšå®ããŠããŸãããŸãããŠãŒã¶ã«ããåäœç¢ºèªãWikiã«äžãã£ãŠããŠããŸãã(https://wiki3.jp/fmtowns/page/10) Wikiã¯WINDYãããã»ããã¢ããããŠãã ãããŸãããããããšãããããŸããçŸç¶ã§ãå°ãªãèŠç©ãã£ãŠ97%以äžã®FM TOWNSã¢ããªã±ãŒã·ã§ã³ãå®è¡ã§ãããšèšããããã§ãã
80486ãšãã¥ã¬ãŒã·ã§ã³ã¯éããªã£ãŠããŸãããããŸã æ¹åã®äºç¥ããããŸããå°ããã€ã¹ããŒãã¢ããããŠãããŸãã
80486ã®ãã¹ãŠã®ã€ã³ã¹ãã©ã¯ã·ã§ã³ããšãã¥ã¬ãŒãã§ããŠãŸããããªããTowns OSã¯ã¿ã¹ã¯æ©èœã¯äœ¿ã£ãŠãªãã£ããšæãããã®ã§å€åãµããŒãããŸããããŸãããšãã¥ã¬ãŒã¿ããããã¬ãšããŠæ©èœããã®ã§ãããã°æ©èœããµããŒãããªãäºå®ã§ãã
High-Fidelity Modeã§ã³ã³ãã€ã«ãããš(srcã§ãªãsrchfã«cmakeãããã)ãWindows 3.1ãèµ·åã§ããããã«ãªããŸãããããŸã ããªãæ©èœéå®ã§ãã
Source Code
Open Source with 3-clause BSD License.
Build Instruction
For Windows Visual C++:
git clone https://github.com/captainys/TOWNSEMU.git
cd .\TOWNSEMU\gui\src
git clone https://github.com/captainys/public.git
cd ..
mkdir build
cd build
cmake ../src
cmake --build . --config Release --parallel
For macOS:
git clone https://github.com/captainys/TOWNSEMU.git
cd TOWNSEMU/gui/src
git clone https://github.com/captainys/public.git
cd ..
mkdir build
cd build
cmake ../src
cmake --build . --config Release
cp main_cui/Tsugaru_CUI.app/Contents/MacOS/Tsugaru_CUI main_gui/Tsugaru_GUI.app/Contents/MacOS/.
main_gui/Tsugaru_GUI.app/Contents/MacOS/Tsugaru_GUI
Starting the GUI
In Windows and Linux, just start Tsugaru_GUI. It internally uses Tsugaru_CUI, therefore two programs must be in the same directory.
In macOS, start the app bundle Tsugaru_GUI.
WindowsãšLinuxã§ã¯Tsugaru_GUIãèµ·åããŠãã ãããäžã§Tsugaru_CUIã䜿ãã®ã§ãåããã£ã¬ã¯ããªã«äž¡æ¹ã®ããã°ã©ã ã眮ããŠãã ããã
macOSã§ã¯ãTsugaru_GUIã¢ããªã±ãŒã·ã§ã³ãå®è¡ããŠãã ããã
Starting the Command-Line Program
It starts from terminal/command prompt. The basic options are:
main_cui ROM_FILE_PATH -CD CD_IMAGE_FILE -FD0 FD0_IMAGE_FILE
CD-image can be .ISO or .CUE. Floppy-disk image can be raw-binary or .D77 file. You can look into scripts sub-directories for samples of other options.
You can see the help by typing:
main_cui -HELP
I add some command samples below. Please see also command.md
ã³ãã³ãããèµ·åããŸãã
main_cui ROM_FILE_PATH -CD CD_IMAGE_FILE -FD0 FD0_IMAGE_FILE
CD-imageã¯.ISOãš.CUEã«å¯Ÿå¿ããã£ã¹ã¯ã€ã¡ãŒãžã¯.D77ãçã€ã¡ãŒãžãã¡ã€ã«ã«å¯Ÿå¿ãscriptsãµããã£ã¬ã¯ããªå ã«ãããå®è¡ãªã©ã®äŸé¡ãããã®ã§ããã£ã¡ãåç §ããã«ããæžãæéãç¡ãã
ãŸãã次ã®ããã«ã¿ã€ããããšãã«ãã衚瀺ããŸããè±èªã§ããã
main_cui -HELP
以äžã«èµ·åã³ãã³ãã®äŸãããã€ãæããŸããcommand.mdãã¡ã€ã«ãåç §ããŠãã ããã
Emulating Marty
To emulate Marty, you need to own ROM images extracted from a Marty.
In addition to specify the ROM location in the command parameter in CUI or text dialog box in GUI, you also need to select the machine type. From CUI, add a parameter -TOWNSTYPE MARTY. Or from GUI, select MARTY as Towns Type.
If you do not specify the machine type, even with the Marty ROM, the virtual machine will start just like a full-spec FM TOWNS.
MartyãåçŸããã«ã¯ãMartyããæãåºããROMã€ã¡ãŒãžãå¿ èŠã§ãã
Martyã®ROMã€ã¡ãŒãžã®å Žæãã³ãã³ããã©ã¡ãŒã¿ããããã¯GUIã®ãã€ã¢ãã°ã§æå®ããä»ã«ããã·ã³ã¿ã€ããMartyã«èšå®ããå¿ èŠããããŸããã³ãã³ãããæå®ããå Žå㯠-TOWNSTYPE MARTY ãªãã·ã§ã³ãè¿œå ããŠãã ãããGUIããæå®ããå Žåã¯ããªã¹ãããMARTYãéžãã§ãã ããã
ãã·ã³ã¿ã€ããæå®ããªãå ŽåãMartyã®ROMã䜿ã£ãŠãããã«ã¹ããã¯ã®FM TOWNSã®ããã«èµ·åããŠããŸããŸãã
Command-Line Examples
.\Tsugaru_CUI.exe -HELP
Print help.
ãã«ãã衚瀺ããŸãã
./Tsugaru_CUI E:/ROM_MX -CD E:/ISOImage/AFTER_BURNER.CUE -GAMEPORT0 KEY -SCALE 160
If FM TOWNS ROM image files are stored in E:/ROM_MX
directory, boot from disc image E:/ISOImage/AfterburnerII/AFTER_BURNER.CUE
. Game pad 0 is emulated by keyboard (A,S,Z,X,ââââ), and Window size is scaled up to 160%.
If you have a physical game pad, you can use PHYS0
, PHYS1
, PHYS2
, or PHYS3
in place for KEY
. Or, in case your game pad reports direction button as the analog input, use ANA0
,ANA1
, ANA2
or ANA3
.
FM TOWNSã®ROMã€ã¡ãŒãžãE:/ROM_MX
ã®ãšãããã£ã¹ã¯ã€ã¡ãŒãžE:/ISOImage/AFTER_BURNER.CUE
ããèµ·åããŸãããžã§ã€ããã0ã¯ããŒããŒããšãã¥ã¬ãŒã·ã§ã³ (A,S,Z,X,ââââ)ããŠã£ã³ããŠã¯160%ã«ã¹ã±ãŒã«ã¢ãããããŸãã
USBãBluetoothæ¥ç¶ã®ã²ãŒã ããããããå Žåã¯ãKEY
ã®ä»£ããã«PHYS0
, PHYS1
, PHYS2
, ãŸã㯠PHYS3
ãæå®ãããšäœ¿ããŸãããŸããååãã¿ã³ããããã¹ã€ããã§ã¯ãªãã¢ããã°ã¬ããŒãšããŠæ±ãã²ãŒã ãããã®å Žåã¯ãANA0
,ANA1
,ANA2
,ANA3
ãæå®ããããšã§å©çšã§ããŸãã
./Tsugaru_CUI E:/ROM_MX -CD E:/ISOImage/AUGUSTA.CUE -FD0 E:/ISOImage/AUGUSTAFD.bin -SCALE 160
IF FM TOWNS ROM image files are in E:/ROM_MX
directory, boot from disc image E:/ISOImage/AUGUSTA.CUE
and floppy-disk image E:/ISOImage/AUGUSTAFD.bin
in drive A. Window is scaled up to 160%.
FM TOWNSã®ROMã€ã¡ãŒãžãE:/ROM_MX
ã®ãšããCDã€ã¡ãŒãžE:/ISOImage/AUGUSTA.CUE
ãšãã©ã€ãAã®ãããããŒãã£ã¹ã¯ã€ã¡ãŒãžE:/ISOImage/AUGUSTAFD.bin
ããèµ·åããŸãããŠã£ã³ããŠã¯160%ã«ã¹ã±ãŒã«ã¢ãããããŸãã
./Tsugaru_CUI E:/ROM_MX -CMOS ./CMOS.BIN -CD E:/ISOImage/TownsOSV2.1L20.cue
If FM TOWNS ROM image files are stored in E:/ROM_MX, and CMOS file (BIOS Settings in the DOS terminology) is ./CMOS.BIN, boot from disc image E:/ISOImage/TownsOSV2.1L20.cue
If ./CMOS.BIN
does not exist, it is created when the program is closed by Q (Quit) command. If the program is forced to close by window-close button, the file won't be created.
FM TOWNSã®ROMã€ã¡ãŒãžãE:/ROM_MX
ã§ãCMOSãã¡ã€ã«(DOSã§èšããšããã®BIOSèšå®)ã./CMOS.BIN
ã®ãšãããã£ã¹ã¯ã€ã¡ãŒãžE:/ISOIMage/TownsOSV2.1L20.cue
ããã·ã¹ãã ãèµ·åããŸãã./CMOS.BIN
ãååšããªãå Žåãã³ã³ãœãŒã«ã³ãã³ãã®Q (Quit) ã³ãã³ãã§çµäºãããšããæ°ãã«CMOS.BIN
ãäœæããŸãããŠã£ã³ããŠãéããŠåŒ·å¶çµäºããå Žåã¯ãã¡ã€ã«ã¯ã§ããŸããã
Mouse Integration
FM TOWNS uses a MSX mouse, which sends a displacement infornation in X- and Y-directions to the PC. Therefore, mouse does not know where the cursor is. To match the mouse cursor location in the host OS and guest VM, the emulator needs to know where the guest VM is thinking the mouse cursor is currently.
I did reverse engineering and found the mouse-cursor locations for TBIOSes that come with V1.1 L10/L20/L30, V2.1 L10B/L20/L31. Will add other versions of TownsOS and VINGBIOS hopefully. Most likely I will forget updating version numbers here, but probably I'll add comments in the commit log.
FM TOWNSã¯MSXããŠã¹ã䜿çšããŸããMSXããŠã¹ã¯ããŠã¹ã®ç§»åéã®XYãPCã«éä¿¡ããŸããã ãããããŠã¹ã«ãŒãœã«ãPCäžã®ã©ãã«ããã®ããããŠã¹ã¯ç¥ããŸããããã¹ãPCãšã²ã¹ãVMã§ããŠã¹äœçœ®ãäžèŽãããããã«ã¯ããšãã¥ã¬ãŒã¿ããVMãä»ããŠã¹ãã©ãã«ãããšæã£ãŠãããæ€åºããªããŠã¯ãªããŸããã
ãã®ãšãã¥ã¬ãŒã¿ã§ã¯ãTowns OS V1.1 L10/L20/L30, V2.1 L10B/L20/L31ä»å±ã®TBIOSã«ã€ããŠè§£æããŠã察å¿ããŸãããä»ã®ããŒãžã§ã³ãVINGBIOSã«ãé ã«å¯Ÿå¿ããŸãããå€åããã®READMEã«ã¯æžãã®ãå¿ããã§ããããããGITã®ã³ãããã³ã¡ã³ãã«ã¯å€åæžããšæãã®ã§ãã£ã¡ãèŠãŠãã ããã
VM<->Host File Transfer
Direct File Sharing - TGDRV
You can share a directory of the host with the VM using a utility called TGDRV.COM
When you start Tsugaru CUI, specify -SHAREDDIR <dir> option to specify a host directory to be shared with the VM. When you start Tsugaru GUI, specify shared directories in "TGDRV" tab. You can specify up to 8 directories in CUI, 4 directories in GUI.
In the VM, insert the TsugaruUtil.D77, and run TGDRV.COM. The sheard directory will appear as a virtual disk drive in the VM. If you use a Towns OS installed on the hard-disk image, it would be convenient to copy TGDRV.COM to the virtual hard disk.
Kanji and Katakana files also cannot be accessed. In macOS and Linux environment, since MS-DOS capitalizes all the files, you cannot access filles with small-case letters.
ãŠãŒãã£ãªãã£TGDRV.COMã䜿ãããšã§ããã¹ãPCã®ãã£ã¬ã¯ããªãçŽæ¥æŽ¥è»œäžã®VMãšå ±æããããšãã§ããŸãã
接軜CUIãèµ·åãããšãã-SHAREDDIR <dir>ãªãã·ã§ã³ãè¿œå ããŠãå ±æãããã£ã¬ã¯ããªãæå®ããŠãã ããã接軜GUIã䜿ãå Žåã¯ã"TGDRV"ã¿ãã§å ±æãã£ã¬ã¯ããªãæå®ããŠãã ãããCUIã§ã¯æ倧8ç®æãGUIã§ã¯æ倧4ãæã®ãã£ã¬ã¯ããªãæå®ã§ããŸãã
接軜VMäžã§ã¯ãã£ã¹ã¯ã€ã¡ãŒãž TsugaruUtil.D77 ãã»ããããŠãTGDRV.COMãå®è¡ãããšãå ±æãã£ã¬ã¯ããªãVMäžã®ä»®æ³ãã©ã€ããšããŠã¢ã¯ã»ã¹ã§ããããã«ãªããŸããããŒããã£ã¹ã¯ã€ã¡ãŒãžãå©çšããŠããå Žåã¯ãããŒããã£ã¹ã¯ã€ã¡ãŒãžã«TGDRV.COMãã³ããŒããŠãããšäŸ¿å©ãšæããŸãã
挢åã»ã«ããå«ããã¡ã€ã«ãã¢ã¯ã»ã¹ã§ããŸãããmacOSãšLinuxã§ã¯ãMS-DOSããã¹ãŠã®ãã¡ã€ã«åã倧æåã«ããŠããŸãããããã¹ãäžã®å°æåãå«ããã¡ã€ã«ã¯ã¢ã¯ã»ã¹ã§ããŸããã
Using XMODEM
To transfer a file from the host to the VM, follow the following steps:
- In Tsugaru CUI, type
XMODEMTOVM filename
(filename
is the file that you want to send to the VM). - Start a terminal program in the VM and start XMODEM transfer. I have confirmed with a popular free text editor called WINK2, which has a terminal mode.
To transfer a file from the VM to the host, follow the following steps:
- Start a terminal program in the VM and start XMODEM transfer.
- In Tsugaru CUI, type
XMODEMFROMVM filename
.
XMODEMã䜿ã£ãŠãã¹ãããVMã«ãã¡ã€ã«ã転éããã«ã¯ã次ã®ã¹ãããã§æäœããŠãã ãã:
- 接軜CUIã¢ãŒãã§ã
XMODEMTOVM filename
(filename
ã¯è»¢éãããã¡ã€ã«å)ãšã³ãã³ããå ¥åã - VMäžã§ã¿ãŒããã«ãœãã (WINK2ã®éä¿¡ã¢ãŒããªã©) ãèµ·åããŠXMODEMã®ãã¡ã€ã«è»¢éãéå§ããã
XMODEMã䜿ã£ãŠVMãããã¹ãã«ãã¡ã€ã«ã転éããã«ã¯ã次ã®ã¹ãããã§æäœããŠãã ãã:
- VMäžã§ã¿ãŒããã«ãœãããèµ·åããŠXMODEMã®ãã¡ã€ã«è»¢éãéå§ããã
- 接軜CUIã¢ãŒãã§ã
XMODEMFROMVM filename
ãšã³ãã³ããå ¥åã
Using Tsugaru File Transfer Protocol (TFTP)
XMODEM works, but it sends 1 byte at a time, and slow. You can transfer a file much faster using TFTP by the following steps. You need to use Tsugaru CUI. You need to transfer FTCLIENT.EXP to the VM. You can do it once with XMODEM or use a conventional disk-image tools such as EDITDISK.
- Type command
VM2HOST vmfile hostfile
orHOST2VM hostfile vmfile
. These commands schedule file transfer. If you want to transfer multiple files, type commands multiple times. - In VM, start FTCLIENT.EXP (like
run386 -nocrt FTCLIENT.EXP
in the command mode)
Then the files will be transferred. FTCLIENT.EXP can be found in townsapp/exp
subdirectory.
XMODEMã¯æ©èœããŸããã1ãã€ãåäœã§ãã¡ã€ã«ã転éããã®ã§ãé ãã§ããããé«éã«VMãšãã¹ãéã§ãã¡ã€ã«ã転éãããå Žåã次ã®æé ã§æäœããŠãã ãããCUIã§å®è¡ããå¿ èŠããããŸããFTCLIENT.EXPãVMã«è»¢éããŠããå¿ èŠããããŸãããXMODEMã䜿ããããããã¯EDITDISKãªã©ã®ãã£ã¹ã¯ã€ã¡ãŒãžããŒã«ãå©çšããŠãã ããã
- ã³ãã³ã
VM2HOST vmfile hostfile
ãŸãã¯HOST2VM hostfile vmfile
ãã¿ã€ãããããããã®ã³ãã³ãã¯ãã¡ã€ã«è»¢éãäºçŽãããè€æ°ãã¡ã€ã«ã転éãããå Žåã¯ãã³ãã³ããè€æ°åã¿ã€ãããã - VMäžã§FTCLIENT.EXPãå®è¡ããã(ã³ãã³ãã¢ãŒãã«éããŠ
run386 -nocrt FTCLIENT.EXP
ãšã¿ã€ã)
ãã®æé ã§äºçŽãããã¡ã€ã«ã転éãããŸããFTCLIENT.EXPã¯townsapp/exp
ãµããã£ã¬ã¯ããªã«ãããŸãã
Flight Joystick to Mouse Translation
Wing Commander 1 and Strike Commander (not Strike Commander Plus) for FM TOWNS did not support analog joystick. The player had choice between fly by mouse or fly by keyboard, which was a major frustration. Especially, Wing Commander for FM TOWNS comes with Orchestra BGM by CDDA. It was the BEST Wing Commander port of all. Only thing missing was analog joystick. Tsugaru offers a redemption. With the option
-FLIGHTMOUSE joystickId centerX centerY scaleX scaleY zeroZoneInPercent
Tsugaru translates flight joystick input to mouse input. It is also exposed in GUI. It makes Wing Commander and Strike Commander so much more easy to fly. joystickID is you know what it is. centerX and centerY specifies screen coordinate (in 640x480 scale) where mouse cursor should be when the joystick is neutral. scaleX and scaleY specifies how large a deflection in screen scale the mouse cursor should travel when the stick is moved all the way. Actually majority of the analog joysticks doesn't deflect to 1.0. Usually stops at 0.9 or so. So, specifying larger scaleX and scaleY is recommended, or your fighter will maneuver real slow. zeroZoneInPercent specifies zero zone (or dead zone) of the joyostick.
To use it with Wing Commander or Strike Commander, you also need to enable application-specific augumentation for the program.
FM TOWNSçšWing Commander 1ãStrike Commanderã¯ã¢ããã°ãžã§ã€ã¹ãã£ãã¯ããµããŒãããŸããã§ããããã¬ã€ã€ãŒã¯ããŠã¹ãããŒããŒããã©ã¡ããã§æ瞊ããªããŠã¯ãªããŸããã§ããããšãã«Wing Commander 1ã¯FM TOWNSçã¯CDDAã«ãããªãŒã±ã¹ãã©ã®BGMãã€ããŠããŠãä»ã®ã©ã®ç§»æ€çããããã®äžç¹ã§æé«ã®ç§»æ€ãšæãã®ã§ãããã¢ããã°ã¹ãã£ãã¯é察å¿ã ããå¿æ®ãã§ããã接軜ã¯ãã®åœæã®æšã¿ãæŽããæ©èœãæäŸããŸãããŸãã«æ±æžã®æšã¿ãé森ã§ãã³ãã³ããªãã·ã§ã³ïŒGUIãããæå®å¯)ã§ã
-FLIGHTMOUSE joystickId centerX centerY scaleX scaleY zeroZoneInPercent
joystickIdã¯ãã®ãŸããŸã§ãcenterX,centerYã¯ãžã§ã€ã¹ãã£ãã¯ãäžç«äœçœ®ã®ãšãããŠã¹åº§æšãã©ãã«çœ®ããã§ãscaleX,scaleYã¯ãžã§ã€ã¹ãã£ãã¯ã®å ¥åã1.0ã®ãšãããŠã¹åº§æšãã©ãã ãåãããã®èšå®ã§ããzeroZoneInPercentã¯ãžã§ã€ã¹ãã£ãã¯ã®éã³ãããŒã»ã³ãã§æå®ããŸãããªãããžã§ã€ã¹ãã£ãã¯ã¯çµæ§ç²Ÿäžæ¯æŒãããåŒãããããŠãå€ã1.0ãŸã§äžãããŸãããscaleX,scaleYã¯å€§ããã®å€ãæå®ããŠãããæ¹ã楜ã§ãã
ãªããWing CommanderãŸãã¯Strike Commanderã§äœ¿çšããã«ã¯ããã®ãªãã·ã§ã³ã«å ããŠApplication Specific Augumentationãæå¹ã«ããå¿ èŠããããŸãã
Unit Tests
You need bootable floppy disk images/CD-ROM images to run unit tests. My guess is it is ok to redistribute Towns OS bootable floppy disk images, but to be safe I am keeping them to myself.
If you have an ISO image (track 0 image) of Towns OS V1.1 L10 or Towns OS V2.1 L31, you can run two tests by:
- Configure the top-level CMakeLists.txt so that DISC_IMAGE_DIR points to the directory where you store your ISO images.
- CMake and build everything.
- Run either one of the following comman in the build directory.
ctest -R MX_V21L31_GUI
ctest -R MX_V11L10_GUI
The tests are timing-sensitive, or the CPU needs to be reasonably fast. If not, mouse-click may take place before wigets are ready, in which case, the test may not run all the way.
ãŠããããã¹ããå®è¡ããã«ã¯ãèµ·åå¯èœãªãããããŒãã£ã¹ã¯ã€ã¡ãŒãžãŸãã¯CD-ROMã€ã¡ãŒãžãå¿ èŠã§ããTowns OSã§ãã©ãŒãããããèµ·åå¯èœãã£ã¹ã¯ã€ã¡ãŒãžã¯å€ååé åžããŠãè¯ããšæããŸãã(å€åå¯å£«éãšããŠã¯å°ããªãœããããŠã¹ãªã©ããããããŒçã®ãœããã販売ããããã«äœ¿ãããšãæ³å®ããŠããã®ã§ã¯ãªãããšæãã®ã§)ãäžå¿ããã£ã¹ã¯ã€ã¡ãŒãžã¯å€ã«åºããŠãŸããã
ããTowns OS V1.1 L10ãŸãã¯V2.1 L31ã®ISOã€ã¡ãŒãž(ãã©ãã¯0ã®ã€ã¡ãŒãž)ãããã°ãGUIã®ãã¹ãã ãå®è¡ã§ããŸãã
- æäžäœã®CMakeLists.txtãä¿®æ£ããŠãDISC_IMAGE_DIRãISOã€ã¡ãŒãžã®å Žæãæãããã«ããã
- CMakeãå床å®è¡ããŠããBuildã
- 次ã®ã³ãã³ããå®è¡ã
ctest -R MX_V21L31_GUI
ctest -R MX_V11L10_GUI
ãªããã¿ã€ãã³ã°ã«åœ±é¿ãããã®ã§é ãCPUã ãšå€åéäžããå ã«é²ãŸãªããªã£ãŠããã¹ãéäžã§æ¢ãŸã鎚ãããŸããã
Revisions
Please see commit comments after this!
2023/03/25
- Can start Windows 3.1 if compiled in the High-Fidelity Mode!
2021/05/06
- Virtual Machine is pretty stable, I think.
- Added tight-integration mode in the GUI module.
2020/09/06
- I lost track of what I added or improved. But, I can say I clear-confirmed Wing Commander 1 and Strike Commander :-)
2020/07/11
- YM2612 emulator for Tsugaru (Tsugaru-Ben) is becoming much better than earlier version. Super DAISENRYAKU intro music and Emerald Dragon BGM sound very similar to actual YM2612.
- I lost track of what changes I made since 6/15. Please see git commit log!
2020/06/15
- Added separate timer for audio. Super DAISENRYAKU BGM plays better. Still need more work in YM2612 emulation.
- Changed the internal clock frequency of YM2612 from 600KHz to 690KHz. FM Towns Technical Databook [2] tells it is 600KHz, but somehow 690KHz is giving me more accurate timing.
- Fixed CDC. Was reporting number of tracks as binary. It should be in BCD. TOWNS ILLUSION runs again. This time it needs to start from BIN/CUE. It stopps in the middle if you start from ISO.
- Speed up in CPU emulation.
2020/06/12
- Better CDDA emulation, preliminary support for electric volume registers, fixed BT MEM,R instruction. Confirmed RAYXANBER can start game play!
2020/06/07
- Improvement in YM2612 emulation. Still different, but getting similar. (Struggling to make sense of envelope calculation.)
- Fixed hard-disk read/write. Now can install TownsOS in a hard-disk image, and boot from it.
2020/05/26
- Mouse Integration for Wing Commander. Need -APP WINGCOMMANDER1 option.
- Fixed CDC. Was pushing status code 06 00 00 00 twice after MODE1 Read.
- Added disk-access indicators. Changed FDC timing.
2020/05/23
- Tested TownsOS boot and mouse integration with Freeware Collection 1-3, Free Software Collection 4-11. Made corrections for Free Software Collection 4 Disc B and Free Software Collection 6.
- Free Software Collection 4 Disc B uses Towns OS V2.1L10 (L10 with no mark). DOS Extender that comes with Towns OS V2.1L10 blocks unless the CPU type identified by I/O port 0030H is 80386DX or 80386SX. For this problem, I have added -PRETEND386DX option.
2020/05/19
- Sprite emulation should be pretty good.
- Game pad can be emulated by keyboard (-GAMEPORT0 option. Use arrow keys and Z,X,A,S)
- Afterburner II (SEGA, ported by CRI) is playable! Sample boot script is Afterburner2.py.
2020/05/06
- Preliminary support for SCSI Hard disks. (Create a big binary filled with zeros and use -HD0 option.)
2020/05/03
- CPU core speed up. Still not good enough for 486DX 66MHz.
- Support 3-mode floppy disk read/write.
- Very preliminary YM2612 support.
- Added initial CMOS.
2020/04/11
- Started CPU instruction tests. Already captured and fixed numerous bugs in CPU cores.
- Fixed sprite.
- Towns ILLUSION works all the way without corrupted image!!!!
2020/04/10
- At least the program doesn't crash or freeze when sprite is used.
- Towns ILLUSION (Legendary DEMO that comes with Towns OS V1.1 L10) runs all the way, although the images are still corrupted.
2020/04/09
- Primitive support for RF5C68 PCM Sound Generator Playback.
- Roughly 25% speed up.
Somewhere in between
- Supported CDDA from BIN/CUE
- Added a unit test for Towns OS GUI V1.1 L30
2020/03/22
- Added unit tests for Towns OS GUI V1.1 L10 and V2.1 L31.
2020/03/16
- Make it public.
2020/03/04
- Major progress! My Towns can boot from ISO image of Towns OS V2.1 L20 and can move mouse cursor with keys.
2020/02/26
- Major progress! My Towns can read from ISO image!
2020/02/14
- Succeeed in booting into Towns OS V2.1 L30 command mode, and then running a test program compiled by High-C!
2020/01/17
- First line of code!
Mystery
- Interpretation of I/O 480H
[2] pp. 91 tells that:
I/O 0480H
Bit 1: Select F8000H to FFFFFH mapping RAM or System-ROM (0:SysROM 1:RAM)
Bit 0: RAM or CMOS (0:RAM 1:CMOS)
It doesn't tell where in the memory space Bit 0 is controlling. From the memory map, it looks to be D0000 to DFFFF. However, the boot ROM does not clear Bit 0 before memory test, which causes CMOS destruction upon restarting by REIPL.COM
.
Only interpretation I can think of is:
Bit 1 Bit 0 F0000-FFFFF D0000-DFFFF
0 0 SysROM RAM
0 1 SysROM CMOS
1 0 RAM RAM
1 1 RAM RAM
Eventually I'm going to write a test program and see the behavior on my actual FM Towns.
References
[1] Intel i486TM Microprocessor Programmer's Reference Manual, Intel, 1990
[2] Noriaki Chiba, FM TOWNS Technical Databook, 3rd Edition, ASCII, 1994
[3] towns_cd.h, Linux for FM TOWNS source code.
[4] X86 Opcode and Instruction Reference Home, http://ref.x86asm.net/coder32.html (As of February 9 2020)
[5] Intel 80386 Programmre's Reference Manual, Intel, 1986
[6] https://github.com/nabe-abk/free386/blob/master/doc-ja/dosext/coco_nsd.txt
[7] http://www.ctyme.com/rbrown.htm
[8] SEGA Genesis Software Manual
[9] http://www.mit.edu/afs/sipb.mit.edu/contrib/doc/specs/protocol/scsi-2/s2-r10l.txt (As of May 3 2020)
[10] List of Floppy Disk Formats, https://en.wikipedia.org/wiki/List_of_floppy_disk_formats, (As of May 23 2020)
[11] YM2608 OPNA Application Manual
[12] Source code of Artane's FM Towns emulator project https://github.com/Artanejp