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

Overview

8088ify

8088ify is an Intel 8080 CP/M 2.2 to Intel 8086 (8088) MS-DOS assembly language translator. This means that 8088ify reads in assembly language written for the Intel 8080 and outputs an equivalent assembly program for the Intel 8086/8088. As many of us home computer users begin transitioning to the IBM PC with its 16-bit Intel 8088 CPU and new IBM PC DOS operating system, we need not bid farewell to our CP/M programs. 8088ify is the tool to bring our home computing out of the 1970s and into the 1980s and beyond. No need to depend upon expensive and unreliable 8080 emulators!

8088ify was written for PCjam 2021.

8088ify converting hello world program

Why?

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

It may be lesser-known that Intel had the porting of 8080 assembly code to 8086/8088 in mind when designing the 8086/8088. According to this retrocomputing forum post, Intel even produced documentation of conversion tables between the 8080 and the 8086/8088. Unfortunately, I was unable to find that document. However, there was a commercial tool written by Digital Research, Inc., XLT86, that could translate from 8080 to 8086/8088 assembly. XLT86 was designed for translation from CP/M-80 to CP/M-86 and related DRI operating systems. The XLT86 users manual, which contains DRI's own 8080 to 8086/8088 conversion tables, is available, and which I used for 8088ify.

Later, @bilegeek altered me to an official Intel document for Intel's own 8080 to 8086 translator program.

Building

Run your C compiler on 8088ify.c. It is a single-file C utility and written in ANSI C. As 8088ify was written on OpenBSD, I can verify that it works equally as well on Unix as MS-DOS. It even runs on CP/M!

8088ify should compile with any ANSI C compiler that includes a strtol() function. I may remedy this in the future with a built-in strtol() function, but as Open Watcom v2 has the function, I have not (yet) found a need.

8088ify can be compiled as a standalone application for Unix, natively compiled on MS-DOS using Open Watcom v2, cross compiled on Unix for MS-DOS using the Amsterdam Compiler Kit, or cross compiled on Unix for CP/M using the Amsterdam Compiler Kit.

When compiling for Unix, the following compiler invocation is recomended:

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

When compiling for MS-DOS with Open Watcom v2, the following compiler 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, the following compiler invocation is recommended:

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

The included Makefile 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 output files, 8088ify will not fail. That is to say, it is only a mechanical translator. 8088ify does not perform any semantic or syntactic analysis; it assumes the input assembly is valid. The user should review the output before attempting assembly.

Assembling translated programs

8088ify targets nasm. It has been a long time since nasm built 16-bit DOS binaries. In this repository you will find binaries of nasm 0.98.31, as found on Sourceforge, 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

Where prog.asm is the name of your assembly program output from 8088ify and prog.com is the name you want for your final binary. This also means that all programs translated by 8088ify target the tiny memory model only. This could be improved in the future.

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

Examples

In the examples directory you will find two example programs: hello.asm which is a typical hello world program and TST8080.ASM which tests all the opcodes of the 8080 to ensure correct functionality.

To demonstrate 8088ify, there are two additional example programs: test1.asm and test2.asm. The test1.asm file is the result of running TST8080.ASM through 8088ify. The test2.asm file is the result of fixing all the nasm errors reported on test1.asm. A diff between the two files can be found in test.diff.

Caveats

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

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

An attempt is made to detect calls to the CP/M BDOS: call 0005h. The first equ statement to assign the value 5 to a label will be assumed to be the BDOS label and used for all call and jmp checks.

Calls to 0000h are also special-cased and will result in an MS-DOS termination call. As with 0005h, the first equ statement to assign the value 0 to a label will be assumed to be the warm reboot label and used for all call and jmp checks.

Line separation with ! is detected but not properly used. Split those lines before running 8088ify.

No macro facilities. Preprocess your assembly before running it through 8088ify.

I don't actually know if 8088ify or the programs it generates will work on the original IBM PC DOS. But I didn't want to ruin the anachronistic sales pitch at the top of this file. 8088ify was tested on DOSBox-X with the 8086 core. Both it and the programs it generates work with the 8086 core.

Not all programs can be mechanically translated and just work. There exists fundamental differences between 8080 and 8086 assembly that need to be smoothed over by hand if such incompatibilties exist in the original 8080 assembly.

If you see the following warning from nasm: warning: uninitialized space declared in .text section: zeroing everything is fine. This is in fact the desired behavior. Newer versions of nasm have a command line option to disable this 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 Pull Request with a diff.

License

ISC License. See LICENSE for details.

Releases

The current release is 8088ify-1.0; a tarball can be found in the Releases section.

You might also like...
Episodic Transformer (E.T.) is a novel attention-based architecture for vision-and-language navigation.
Episodic Transformer (E.T.) is a novel attention-based architecture for vision-and-language navigation.

Episodic Transformer (E.T.) is a novel attention-based architecture for vision-and-language navigation. E.T. is based on a multimodal transformer that encodes language inputs and the full episode history of visual observations and actions.

ffcnn is a cnn neural network inference framework, written in 600 lines C language.

+----------------------------+ ffcnn 卷积神经网络前向推理库 +----------------------------+ ffcnn 是一个 c 语言编写的卷积神经网络前向推理库 只用了 500 多行代码就实现了完整的 yolov3、yolo-fastes

Frog is an integration of memory-based natural language processing (NLP) modules developed for Dutch. All NLP modules are based on Timbl, the Tilburg memory-based learning software package.

Frog - A Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for Dutch Copyright 2006-2020 Ko van der Sloot, Maarten van Gompel, Antal van den

C Language version for yolo in risc-v
C Language version for yolo in risc-v

RISC-V C-Embedding Yolo 基于Yolo v2的蜂鸟e203 RISC-V部署代码,其中的加速器由队伍中负责硬件的人使用Verilog编写(暂不提供),并在硬件提供的C API上搭建了yolo的部署代码。其中,加速器硬件模块暂由c编写的神经网络加速器模拟器来代替。 网络实现了人脸

New ultra super robust and fast programming language, fully supportable by G++ and Clang

Cplusplusplus New ultra super robust and fast programming language, fully supportable by G++ and Clang How to use: Just write #include C+++.h in you

Learning Programming C Language

Learning-Programming-C Learning Programming C Language Question 1 Have the computer print HI, HOW OLD ARE YOU? on one line. The user then enters his o

Rune is a programming language developed to test ideas for improving security and efficiency.

ᚣ The Rune Programming Language Safer code for secure enclaves This is not an officially supported Google product. NOTE: Rune is an unfinished languag

Adorad - Fast, Expressive, & High-Performance Programming Language for those who dare

The Adorad Language Adorad | Documentation | Contributing | Compiler design Key Features of Adorad Simplicity: the language can be learned in less tha

Deploy ultralytics Yolov5 pretained model with C++ language
Deploy ultralytics Yolov5 pretained model with C++ language

Introdution Deploy ultralytics Yolov5 pretained model with C++ language ; Env GCC 7.5 Opencv 4.5.4 Get ONNX Model go to yolov5 release page download y

Comments
  • Tim Paterson's trans.asm

    Tim Paterson's trans.asm

    Hello @ibara,

    Cool program, thanks!

    Out of curiosity, how does 8088ify compare with Tim Paterson's Z80-to-8086 translator trans.asm?

    I see that Microsoft open-sourced the trans.asm code as part of their MS-DOS 1.x source release, though they did not really publicize this fact. I have managed to "port" trans.asm to assemble with nasm.

    Thank you!

    opened by tkchia 7
  • Simplify translation of `call 0`/`jmp 0`/`call 5`/`jmp 5`

    Simplify translation of `call 0`/`jmp 0`/`call 5`/`jmp 5`

    Proposed changes:

    • I removed the push ax and pop ax surrounding each system call translated from call 5/jmp 5. I believe this is more correct: some CP/M (and MS-DOS 1.x) syscalls return status codes in the a (or al) register, and push ax ... pop ax will destroy these.
    • There should be no need to set cl = dl = 0 when exiting the program via int 0x21, ah = 0x4c. The only parameter the syscall accepts is an exit status, which will come from al.
      • (An alternative might be to use int 0x20 here, which will work on MS-DOS < 2. Yet another alternative might be to simply leave call 0 and jmp 0 as-is.)

    Thank you!

    opened by tkchia 4
  • Minor typo in readme

    Minor typo in readme

    In this sentence: "It may be lesser-known that Intel had the porting of 8080 assmebly code to 8086/8088 in mind when designing the 8086/8088."

    opened by wrljet 2
  • Found a manual for Intel's CONV86, contains more 8080 and 8086 conversion tables.

    Found a manual for Intel's CONV86, contains more 8080 and 8086 conversion tables.

    I'm not sure if there are standalone conversion tables like the forum post implied, but this is an official Intel document, so it might be of help.

    http://www.bitsavers.org/pdf/intel/ISIS_II/9800642A_MCS-86_Assembly_Language_Converter_Operating_Instructions_for_ISIS-II_Users_Mar79.pdf

    opened by bilegeek 1
Releases(v1.2)
Owner
Brian Callahan
OpenBSD developer / Prof., [email protected]
Brian Callahan
Experimental OpenCL SPIR-V to OpenCL C translator

spirv2clc spirv2clc is an experimental OpenCL SPIR-V to OpenCL C translator currently targeting OpenCL 1.2 support. It can generate OpenCL C code equi

Kévin Petit 19 Oct 1, 2022
Source code to the 1995 DOS roguelike game Alphaman

Alphaman Source and Files Source code and related files for the 1995 DOS roguelike game Alphaman by Jeffrey R. Olson. Jeff can be reached via email at

Jamie 33 Jun 8, 2022
This is a list of hardware which is supports Intel SGX - Software Guard Extensions.

SGX-hardware list This is a list of hardware which supports Intel SGX - Software Guard Extensions. Desktop The CPU and the motherboard BIOS must suppo

Lars Lühr 507 Oct 1, 2022
waifu2x converter ncnn version, runs fast on intel / amd / nvidia GPU with vulkan

waifu2x ncnn Vulkan ncnn implementation of waifu2x converter. Runs fast on Intel / AMD / Nvidia with Vulkan API. waifu2x-ncnn-vulkan uses ncnn project

null 2.3k Sep 26, 2022
Python to CLike language transpiler

Python to many CLike language transpiler Currently supports C++ and Rust. Preliminary support for Julia, Kotlin, Nim, Go and Dart. The main idea is th

null 442 Oct 4, 2022
Code and Data for our CVPR 2021 paper "Structured Scene Memory for Vision-Language Navigation"

SSM-VLN Code and Data for our CVPR 2021 paper "Structured Scene Memory for Vision-Language Navigation". Environment Installation Download Room-to-Room

hanqing 34 Aug 24, 2022
Deploying Deep Learning Models in C++: BERT Language Model

This repository show the code to deploy a deep learning model serialized and running in C++ backend.

null 42 Mar 24, 2022
Deep Learning in C Programming Language. Provides an easy way to create and train ANNs.

cDNN is a Deep Learning Library written in C Programming Language. cDNN provides functions that can be used to create Artificial Neural Networks (ANN)

Vishal R 11 Apr 18, 2022
Triton - a language and compiler for writing highly efficient custom Deep-Learning primitives.

Triton - a language and compiler for writing highly efficient custom Deep-Learning primitives.

OpenAI 4.1k Oct 2, 2022
MozoLM: A language model (LM) serving library

A language model serving library, with middleware functionality including mixing of probabilities from disparate base language model types and tokenizations along with RPC client/server interactions.

Google Research 35 Jun 19, 2022