INTRODUCTION

Functionality

The Proteus VSM 8086 model is an instruction and bus cycle accurate simulation of the Intel 8086 processor. It can be connected in conjunction with a bus driver and demultiplexer circuit to RAM, ROM and different peripheral controllers.

All bus signals and timing for device operation in minimum mode are simulated; support for maximum mode is not implemented at this time.

In addition, regions of 'internal memory' can be defined such that simulation of external bus activity is not needed for program fetch and data memory read/write operations. This enables a reasonable speed of simulation to be achieved.

See also

Model Properties

Supported Assemblers and Compilers

This help file last modified 16th April 2010


MODEL PROPERTIES

The 8086 model can be configured via a number of properties which can be modified from the Edit Component dialogue form:

Property | Default | Description
Clock | 1MHz | Specifies the clock frequency of the processor. This property is ignored if external clocking is selected.
External Clock | No | Specifies whether the model is internally clocked as opposed to responding to an external clock signal presented on the CLK pin. Note that clocking the model externally will result in significantly slower simulation speed.
Program | - | Specifies a program file to be loaded into the model's internal memory. The program file can be a binary (.BIN) file or an MS-DOS compatible (.COM) or (.EXE) program.
Program Load Segment | 0x0000 | Determines where the external program is loaded in the internal memory.
Internal Memory Location | 0x0000 | Location of the internally simulated memory block.
Internal Memory Size | 0x0000 | Size of the internally simulated memory.

In addition, the 8086 model supports a number of debug diagnostic categories which can be enabled or disabled from the Configure Diagnostics dialogue. You can access this from the Debug menu or the component's right hand context menu.

See also

Supported Assemblers and Compilers


SUPPORTED ASSEMBLERS AND COMPILERS

There is a very wide choice of assemblers and compilers for the 8086. Below is the list of tools that have been tested with the model. We recommend using exact same versions of tools as in our list because of the potential for subtle differences in the debug information format.

Compiler | Licence | Debug Format | Website
MASM32 | Freeware | Codeview | www.masm32.com
Borland Turbo Assembler (TASM) | Commercial | Borland |
Digital Mars C++ Compiler | Freeware | Codeview | www.digitalmars.com
Microsoft C/C++ Compiler 7.00 | Commercial | Codeview | www.microsoft.com
Borland C++ Compiler for Windows 5.02 | Commercial | Borland | www.codegear.com

The 8086 model can load programs in .BIN, .COM and .EXE formats into its internal RAM directly without DOS and allows source and/or disassembly level debugging of programs containing debugging information in Microsoft (Codeview) and Borland formats. Both debug information formats allow source-level debugging and viewing of global variables but only the Borland format supports viewing of local variables. For .COM and .BIN files debug information must be written in the separate .DBG file.

It is also important to appreciate that whilst the model can load files created in .EXE and .COM format, your programs will be running without the presence of an IBM PC BIOS or MS-DOS. It follows that they must be compiled to work without the standard Run-Time Libraries (RTL). This is because the standard compiler RTLs make use of BIOS and MS-DOS functions calls.

The different assemblers compilers have specific options for debug information generation. Here we will provide information needed to start using 8086 models with compiler of your choice. All of the samples will generate .EXE or .COM files with debug information and with no RTL so they can be loaded into the 8086 internal memory for debugging.

Creating a .EXE file with MASM32

SAMPLE.ASM

.MODEL SMALL

.8086

.stack

.code

.startup

mov dx,0020h

mov al,35h

out dx,al

end_loop:

jmp end_loop

.data

END

BUILD.BAT

@ECHO OFF

ml /c /Zd /Zi sample.asm

link16 /CODEVIEW sample.obj,sample.exe,,,nul.def

Creating a .COM file with MASM32

SAMPLE.ASM

.MODEL TINY

.8086

.code

.startup

mov dx,0020h

mov al,35h

out dx,al

end_loop:

jmp end_loop

.data

END

BUILD.BAT

@ECHO OFF

ml /c /Zd /Zi sample.asm

link16 /TINY /CODEVIEW sample.obj, sample.com,,,nul.def

Creating a .EXE file with the Digital Mars or Microsoft C++ Compilers

A custom run time library is needed to use compiler with a 'bare' 8086. It can be limited only to start-up code but the program will be unable to use standard library functions. In order to implement full RTL you would need to adapt the low level file I/O (stdin, stdout) to drive whatever hardware is present in your system.

RTL.ASM (minimal Run Time Library)

.MODEL SMALL

.8086

.stack

.code

;EXTRN _main

extern _main:near

.startup

call near ptr _main

endless:

jmp endless

.data

public __acrtused ; trick to force in startup

__acrtused = 9876h ; funny value not easily matched ; ; in SYMDEB

END

MAIN.C

void outp(unsigned int addr, char data)

// Write a byte to the specified I/O port

{ __asm

{ mov dx, addr

mov al, data

out dx, al

}

}

char inp(unsigned int addr)

// Read a byte from the specified I/O port

{ char result;

__asm

{ mov dx, addr

in al, dx

mov result, al

}

return result;

}

void main(void)

// Output 10 values to port 0x20

{ char i;

for (i=0; i<10; i++)

outp(0x20, i);

}

BUILD.BAT for Digital Mars (also requires MASM32 assembler)

@echo on

ml /Zd /Zi /Zf -c RTL.ASM

dmc -g -ms -0 -c -omain.obj main.c

link /CO /NOD /DEB /DEBUGB main.obj+rtl.obj

Note that your MS-DOS search PATH should be ordered such that the LINK program will execute from the Digital Mars (DM\BIN) folder. Also, the environment variable INCLUDE should point to the DM\INCLUDE folder.

BUILD.BAT for Microsoft C/C++ (also requires MASM32 assembler)

@echo off

ml /c /Zd /Zi RTL.ASM

cl /Zl /Ot /Gs /Zd /Zi /G0 /Gy /c main.c

link16 /CODEVIEW rtl.obj+main.obj,main.exe,,,nul.def

Note that your MS-DOS search PATH should be ordered such that the LINK16 program will execute from the Microsoft C++ (C700\BIN) folder. Also, the environment variable INCLUDE should point to the C700\INCLUDE folder.

Creating a .EXE file with Borland TASM

SAMPLE.ASM

.MODEL SMALL

.8086

.stack

.code

.startup

mov dx,0020h

mov al,35h

out dx,al

end_loop:

jmp end_loop

.data

END

BUILD.BAT

@ECHO OFF

tasm /zi sample.asm

tlink /v sample.obj, sample.exe,,,,

Creating a .EXE file with Borland C++ Compiler

A custom run time library is needed to use compiler with a 'bare' 8086. It can be limited only to start-up code but the program will be unable to use standard library functions. In order to implement full RTL you would need to adapt the low level file I/O (stdin, stdout) to drive whatever hardware is present in your system.

RTL.ASM (minimal Run Time Library)

.MODEL SMALL

.8086

.stack

.code

extrn _main:proc

.startup

call _main

endless:

jmp endless

.data

END

MAIN.C

void outp(unsigned int addr, char data)

// Write a byte to the specified I/O port

{ __asm

{ mov dx, addr

mov al, data

out dx, al

}

}

char inp(unsigned int addr)

// Read a byte from the specified I/O port

{ char result;

__asm

{ mov dx, addr

in al, dx

mov result, al

}

return result;

}

void main(void)

// Output 10 values to port 0x20

{ char i;

for (i=0; i<10; i++)

outp(0x20, i);

}

BUILD.BAT for Borland C/C++ (also requires TASM)

@echo off

tasm /zi RTL.ASM

BCC -R -1 -y -v -c -omain.obj main.c

tlink /v rtl.obj+main.obj, main.exe,,,,

Note that the environment variable INCLUDE should point to the BC5\INCLUDE folder.

See also

Model Properties