Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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
Appearance settings

The famous Intel 8080 CP/M 2.2 to Intel 8086/8088 MS-DOS assembly language translator.

License

NotificationsYou must be signed in to change notification settings

ibara/8088ify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

8088ify is an Intel 8080 CP/M 2.2 to Intel 8086 (8088)MS-DOS assembly language translator. This means that8088ify reads in assembly language written for the Intel8080 and outputs an equivalent assembly program for theIntel 8086/8088. As many of us home computer users begintransitioning to the IBM PC with its 16-bit Intel 8088 CPUand new IBM PC DOS operating system, we need not bidfarewell to our CP/M programs.8088ify is the tool tobring our home computing out of the 1970s and into the1980s and beyond. No need to depend upon expensive andunreliable 8080 emulators!

8088ify was written forPCjam 2021.

8088ify converting hello world program

We're famous!

8088ify has been featured onHacker NewsandHackaday.We are even mentioned onWikipedia.

Thanks to everyone for sharing this project.

Why?

I could not find an open source translator between Intel8080 and Intel 8086/8088. The 8080 and 8088 CPUs werecontemporaries from the introduction of the 8088 in 1979 tothe discontinuation of the 8080 in 1990. Not being able toeasily find such a translation tool surprised me.

It may be lesser-known that Intel had the porting of 8080assembly code to 8086/8088 in mind when designing the8086/8088. According tothis retrocomputing forum post,Intel even produced documentation of conversion tablesbetween the 8080 and the 8086/8088. Unfortunately, I wasunable to find that document. However, there was acommercial tool written by Digital Research, Inc., XLT86,that could translate from 8080 to 8086/8088 assembly. XLT86was designed for translation from CP/M-80 to CP/M-86 andrelated DRI operating systems. The XLT86 users manual, whichcontains DRI's own 8080 to 8086/8088 conversion tables, isavailable,and which I used for8088ify.

Later, @bilegeek altered me toan official Intel documentfor Intel's own 8080 to 8086 translator program.

Building

Run your C compiler on8088ify.c. It is a single-file Cutility and written in ANSI C. As8088ify was written onOpenBSD,I can verify that it works equally as well on Unix asMS-DOS. It even runs on CP/M and Windows!

8088ify should compile with any ANSI C compiler thatincludes astrtol() function. I may remedy this in thefuture with a built-instrtol() function, but as OpenWatcom v2 has the function, I have not (yet) found a need.

8088ify can be compiled as a standalone application forUnix, as a standalone application for Windows using theDigital Mars C/C++ Compiler,natively compiled on MS-DOS usingOpen Watcom v2,cross compiled on Unix for MS-DOS usingthe Amsterdam Compiler Kit,or cross compiled on Unix for CP/M using the AmsterdamCompiler Kit.

When compiling for Unix, the following compiler invocationis recomended:

$ cc -O2 -pipe -o 8088ify 8088ify.c

When compiling for Windows, the following compilerinvocation is recommended:

> dmc 8088ify.c -o

When compiling for MS-DOS with Open Watcom v2, the followingcompiler invocation is recommended:

> wcl -0 -ox -mt 8088ify.c

When compiling for MS-DOS with the Amsterdam Compiler Kit,the following compiler invocation is recommended:

$ ack -mmsdos86 -O2 -o 8088ify.com 8088ify.c

When compiling for CP/M with the Amsterdam Compiler Kit, thefollowing compiler invocation is recommended:

$ ack -mcpm -O2 -o 8088ify.com 8088ify.c

The includedMakefile is for creating a Unix binary,sorry.

Running

usage: 8088ify infile.asm outfile.asm

So long as your system is able to open the input and outputfiles,8088ify will not fail. That is to say, it is onlya mechanical translator.8088ify does not perform anysemantic or syntactic analysis; it assumes the inputassembly is valid. The user should review the output beforeattempting assembly.

Assembling translated programs

8088ify targetsnasm.It has been a long time since nasm built 16-bit DOSbinaries. In this repository you will find binaries of nasm0.98.31, as found onSourceforge,which do work on an 8086 (tested via DOSBox-X).

To create binaries, the following nasm command can be used:

nasm -f bin -o prog.com prog.asm

Whereprog.asm is the name of your assembly program outputfrom8088ify andprog.com is the name you want for yourfinal binary. This also means that all programs translatedby8088ify target the tiny memory model only. This couldbe improved in the future.

NOTE: This version of nasm is licensed under the LGPLv2.1+.You can find a copy of the LGPLv2.1 licensehere.This license does not affect the license of8088ify.

Examples

In theexamples directory you will find two exampleprograms:hello.asm which is a typical hello worldprogram andTST8080.ASM which tests all the opcodes of the8080 to ensure correct functionality.

To demonstrate8088ify, there are two additional exampleprograms:test1.asm andtest2.asm. Thetest1.asm fileis the result of runningTST8080.ASM through8088ify.Thetest2.asm file is the result of fixing all the nasmerrors reported ontest1.asm. A diff between the two filescan be found intest.diff.

Caveats

8088ify assumes no single line of input assembly code willexceed 255 characters. It will truncate lines longer than255 characters, but still output assembly for what it didread in before truncation.

Comments are carried over to the output assembly. They maynot make sense for an 8086/8088 CPU.

An attempt is made to detect calls to the CP/M BDOS:call 0005h. The firstequ statement to assign the value5 to a label will be assumed to be the BDOS label and usedfor allcall andjmp checks.

Calls to0000h are also special-cased and will result inan MS-DOS termination call. As with0005h, the firstequstatement to assign the value 0 to a label will be assumedto be the warm reboot label and used for allcall andjmp checks.

Line separation with! is detected but not properly used.Split those lines before running8088ify.

No macro facilities. Preprocess your assembly before runningit through8088ify.

I don't actually know if8088ify or the programs itgenerates will work on the original IBM PC DOS. But I didn'twant to ruin the anachronistic sales pitch at the top ofthis file.8088ify was tested onDOSBox-Xwith the 8086 core. Both it and the programs it generateswork with the 8086 core.

Not all programs can be mechanically translated and justwork. There exists fundamental differences between 8080 and8086 assembly that need to be smoothed over by hand if suchincompatibilties exist in the original 8080 assembly.

If you see the following warning from nasm:warning: uninitialized space declared in .text section: zeroingeverything is fine. This is in fact the desired behavior.Newer versions of nasm have a command line option to disablethis warning but the older 16-bit versions of nasm do not.

Bugs

None! As far as I know...

If you find one, please open an Issue or (better!) a PullRequest with a diff.

License

ISC License. SeeLICENSE for details.

Releases

The current release is 8088ify-1.2; a tarball can be foundin the Releases section.


[8]ページ先頭

©2009-2025 Movatter.jp