Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/emu2Public
forked fromdmsc/emu2

Simple x86 and DOS emulator for the Linux terminal.

License

NotificationsYou must be signed in to change notification settings

nero/emu2

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a simple DOS emulator for the Linux text console, supporting basic DOSsystem calls and console I/O.

Using the emulator

To run a DOS.exe or.com file, simply load it with

emu2 myprog.exe

The emulator accepts some options in the command line and more options asenvironment variables, this allows child process (programs run by your DOSprogram) to inherit the configuration.

The full usage is:

emu2 [options] <prog.exe> [args...] [-- environment vars]

Options (should be placedbefore the DOS program name):

  • -h Shows a brief help.

  • -b addr Load header-less binary at given address (to load ROMs or test data).

  • -r <seg>:<ip> Specify a run address to start execution (only for binary loaded data).

The available environment variables are:

  • EMU2_DEBUG_NAME Base name of a file to write the debug log, defaults tothe exe name if not given.

  • EMU2_DEBUG List of debug options to activate, from the following:cpu,int,port,dos,video.

  • EMU2_PROGNAME DOS program name, if not given try to convert the unixname to an equivalent DOS path.

  • EMU2_DEFAULT_DRIVE DOS default (current) drive letter, if not given useC:

  • EMU2_CWD DOS current working directory, if not given tries to convertthe current directory to the equivalent DOS path inside theDOS default drive, orC:\ if not possible.

  • EMU2_DRIVE_n Set unix path as root of driven, by default all drivespoint to the unix working directory.

  • EMU2_APPEND Sets a list of paths to search for data files on open,emulating the DOSAPPEND command. Only files with arelative path are included in the search, and the searchis relative to the current working directory if no driveletter is specified in the append path.For example, if set to "TXT;C:\IN", when opening thefile "CAT.TXT" the file is searched as "CAT.TXT","TXT\CAT.TXT" and "C:\IN\CAT.TXT" in turn.

  • EMU2_CODEPAGE Set DOS code-page to the specified string. Set to '?' toshow list of included code-pages, multiple aliasesseparated with commas. Set to a file name to read themapping table from a file with the unicode value foreach byte. You can download mapping tables fromftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/The code-page setting affects keyboard input and screenoutput, but does not change the DOS NLS information.The default code-page is CP437.

  • EMU2_LOWMEM Limits main memory to 512KB, this fixes some old DOSprograms with a bug that checks available memory using"signed" comparison instructions (JLE instead of JBE).This is needed at least for MASM versions 1.0 and 1.10.

  • EMU2_ROWS Setups the VGA text mode to the given number of rows,from 12 to 50 at the program start. Some full-screen DOSprograms will retrieve this info and adjust the screenproperly, some other will ignore this and setup the textmode again.

Simple Example

For a simple example, we can run the Turbo Pascal 3, available from the antiquesoftware collection as a filetp302.zip.

First, make a new directory and unzip the file:

$ mkdir tp302$ cd tp302$ unzip ../tp302.zip$ ls$ ls$ lsACCESS3.BOX   CALC.PAS      DEMO-BCD.PAS  GRAPH.P     SUBDIR.PAS    TURBO.COMART.PAS       CMDLINE.PAS   EXTERNAL.DOC  LISTER.PAS  TINST.COM     TURBO.MSGCALCDEMO.MCS  COLOR.PAS     GETDATE.PAS   README      TINST.MSG     TURTLE.PASCALC.HLP      DEMO1-87.PAS  GETTIME.PAS   README.COM  TURBO-87.COM  WINDOW.PASCALC.INC      DEMO2-87.PAS  GRAPH.BIN     SOUND.PAS   TURBOBCD.COM$ chmod +w *

The last is necessary as you will want to to modify the program files afterwards.

The main file is named "TURBO.COM", there is also a "README.COM" to read furtherinfo, try that:

$ emu2 README.COM

Image of README.COM

You can press exit to return to the command line. Now, you can configure the compiler,as the README said, just loadTINST.COM, press "S" (screen type), "0" (default), "N"(screen does not blink) and "Q" to quit.

$ emu2 TINST.COM                   TURBO Pascal installation menu.             Choose installation item from the following:[S]creen type |  [C]ommand installation  |  [M]sg file path  |  [Q]uit                         Enter S, C, M or Q: Choose one of the following displays:  0)  Default display mode  1)  Monochrome display  2)  Color display 80x25  3)  Color display 40x25  4)  b/w   display 80x25  5)  b/w   display 40x25Which display? (Enter no. or ^Q to exit):Does your screen blink when the text scrolls? (Y/N):

Finally, we are ready to run the program:

$ emu2 TURBO.COM----------------------------------------TURBO Pascal system        Version 3.02A                                  PC-DOS                                        Copyright (C) 1983,84,85,86 BORLAND Inc.----------------------------------------                                        Default display mode                                                                                                                                            Include error messages (Y/N)?           Logged drive: C                         Active directory: \                                                             Work file:                              Main file:                                                                      Edit     Compile  Run   Save                                                    Dir      Quit  compiler Options                                                 Text:     0 bytes                       Free: 62024 bytes                                                               >

Try loading a program, use "e" to edit, type "window.pas", and you are in the editor:

      Line 1    Col 1   Insert    Indent  C:WINDOW.PAS                          program TestWindow;                                                             {$C-}                                                                           {                                                                                             WINDOW DEMONSTRATION PROGRAM  Version 1.00A                                                                                                              This program demonstrates the use of windows on the IBM PC                      and true compatibles.                                                                                                                                           PSEUDO CODE                                                                     1.  MakeWindow        - draws window boxes on the screen                        2.  repeat                                                                            UpdateWindow 1  - scrolls the window contents up or                                               down for each window.                                         UpdateWindow 2                                                                  UpdateWindow 3                                                                until a key is pressed                                                      3.  Reset to full screen window                                                                                                                                 INSTRUCTIONS                                                                    1.  Compile this program using the TURBO.COM compiler.                          2.  Type any key to exit the program.                                    }

To exit the editor, type "CONTROL+K" and "D", in the prompt you can now type "R" tocompile and run the program.

Image of WINDOW.PAS running

Advanced Example

For a more advanced example, we can install and run Turbo Pascal 5.5, available from the sameantique software collection as a filetp55.zip.

First, make a new directory and unzip the file:

$ mkdir tp55$ cd tp55$ unzip ../tp55.zip$ lsDisk1 Disk2

As you see, the program was distributed in two disks, and must be installed before running.

To install, let's first copy all the contents to one directory:

$ mkdir all$ cp -r Disk1/* Disk2/* all/

And now, run the emulator giving the correct paths to simulate a floppy drive:

$ EMU2_DEFAULT_DRIVE=A EMU2_DRIVE_A=all emu2 all/INSTALL.EXE

Image of TP55 INSTALL.EXE

Type enter, enter again to install from drive "A", again to install on a hard-drive, go downto "Start Installation" and enter again. The install program shows an error, this is becausewe copied all the content to one drive. Simply type "S" to skip all errors.

After the installation is finished, we must run the install again, to copy the missing filesfrom before, with the same command line:

$ EMU2_DEFAULT_DRIVE=A EMU2_DRIVE_A=all emu2 all/INSTALL.EXE

Image of TP55 INSTALL.EXE at the end

Again, press enter to the questions and go to "Start Installation", this time will completewithout errors.

You can now compile from the command line, as:

$ emu2 tp/tpc.exe -- 'PATH=C:\TP'Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland InternationalSyntax: TPC [options] filename [options]/BBuild all units/$A-No word alignment/DxxxDefine conditionals/$B+Complete boolean evaluation/ExxxEXE & TPU directory/$D-No debug information/FxxxFind run-time error/$E-No 8087 emulation/GSMap file with segments/$F+Force FAR calls/GPMap file with publics/$I-No I/O checking/GDDetailed map file/$L-No local debug symbols/IxxxInclude directories/$MxxxMemory allocation parameters/LLink buffer on disk/$N+8087 code generation/MMake modified units/$O+Overlays allowed/OxxxObject directories/$R+Range checking/QQuiet compile/$S-No stack checking/TxxxTurbo directories/$V-No var-string checking/UxxxUnit directories/VEXE debug information$ emu2 tp/tpc.exe tp\\qsort.pas -- 'PATH=C:\TP'Turbo Pascal Version 5.5  Copyright (c) 1983,89 Borland InternationalTP\QSORT.PAS(66)66 lines, 4384 bytes code, 2668 bytes data.$ emu2 tp/qsort.exe....

And for the IDE, you can use:

emu2 tp/turbo.exe  -- 'PATH=C:\TP'

Image of TP55 environment

About

Simple x86 and DOS emulator for the Linux terminal.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C99.5%
  • Makefile0.5%

[8]ページ先頭

©2009-2025 Movatter.jp