Visible Elf 1802 Emulator

Contents

Installing and removing the emulator.

Loading Programs – emulator file types.

Running Programs – the main screens.

Setting Options – the preference screen.

About the 1802 processor.

About the Visible Elf Emulator – Changes and known issues.

Sample Programs.

 


Installing and removing the emulator

The contents of the zip file includes 4 files and one folder for the emulator itself and a number of sample 1802 programs.  The emulator files are:

V1802.EXE – the main program

COMDLG.OCX – a support routine needed by Visual Basic.

ELFNOISE8.WAV – a sound file used for the sound card function

V1802.HTM – this help file and a related folder V1802_FILES.

The COMDLG.OCX is a common visual basic add-in control and is probably already on your system.  If the emulator won’t work as shipped, this file needs to be copied to your C:\windows\system directory.  The other files can be left in the directory with the emulator module.  The Sample Programs are described elsewhere in this file.

 

The emulator will also create a settings file V1802.INI in the directory you run it from.

 

To remove the program just delete the directory you unzipped it to.  The COMDLG file can probably be left in place.


Loading Programs – The File Menu and File Types

Choose Load from the emulator File menu to load a new program. The emulator loads files from files on disk with the following formats:

*.COS are binary memory images.

*.TEX are ascii formatted hex files.  Each line has the form 0000 C0 F000 where 0000 represents a 4 character hex address for the data on the line and C0 F000 represents any even number of hex digits to be loaded at that address.  Spaces are ignored except that one is needed between the address and the first byte of data. 

*.HEX is the simplest visual basic data file type.  Each line contains a decimal number representing the contents of  a memory byte starting at 0000.  For example, the TEX line given above would be 3 lines: containing 192 240 and 0.

*.CP8 is a binary memory image (like *.COS) but starting at address 0200.  This is meant for loading CHIP-8 files.  Note that the CHIP-8 emulator has to be loaded separately in address 0000-01FF.

 

LOADing a program will also cause a Reset, setting X and P to 0 to start execution at location 0.

 

You can load and run a program in any of the supported file types by dragging and dropping it onto the emulator icon.  You can also associate the supported file types with the emulator: double click on any of the sample files (say doodle.hex) and Windows will pop up a screen asking what program to use to run it.  Choose Browse, find and select V1802.EXE and click ok.  The emulator will run the program and, thereafter, if you double click a file of that type it will run in the emulator.  Note that the emulator won’t start a CHIP-8 program automatically from a CP8 file because you need to load CHIP-8 itself separately.

 

The File menu also allows you to SAVE the program in memory as a .HEX file.  The whole 8192 bytes of program memory are saved.

 

Running Programs – The Main Screens.

 

The emulator screen has two principle sections. The left half of the form is a "visible machine" image of the 1802 processor.  It shows the registers and 32 bytes of memory.  When Visualize is checked, the screen is updated after every instruction in Single Step mode and once per video cycle in Run mode.

 

Most of the registers and the memory components can be changed by overtyping them.  To view a different section of memory, overtype the first address field (to the right of the Mem Loc label).

 

The command buttons control the operation of the emulator.

Run/Step starts the execution of the emulator.  If the Single Step box is checked it will execute a singe instruction.  If not, it will run continuously until you check the Single Step box or press Reset.

Reset puts the processor in single step mode, resets X and P to 0 and sets R0 to 0000.  It does not change any other registers or flags.  Note that if the processor is not stopped already when Reset is pressed, it may execute one more instruction from location 00 before stopping.

 

Other controls on the Visible Machine panel include:

Memory Protect which stops the 1802 instructions from changing memory.

Visualize which causes the forms contents to get updated after every instruction in Single Step mode and once per video cycle in Run mode.  Note that because the run-mode update happens exactly at the end  of the video cycle, it always looks like it’s in the video interrupt routine (if video is on).

The Trap box allows you to type in a hex address in your program.  The emulator will drop into single step mode with all registers preserved just before executing this instruction.

 

 

The right half of the form shows the traditional operating controls of an ELF II but without the Load, Run, and MP buttons which are (sort of) replaced by items on the visible machine side.

 

The main thing used on this side is the hex keypad.  The small LED simulation above and to the right of the keys shows what will be read next by a 6C instruction.  The small text box beside that allows you to use the PC keyboard.  If you click in it, it turns black and pressing the keys on the PC numeric keypad of the A-F letter keys simulates the keypad.

 

The I button responds to the mouse of course but also has a keyboard shortcut of ctrl-i which is handy if you need to press I while you're starting up or while another button is clicked.

 

Setting Options – the preferences screen

The preferences screen allows you to control program options.

The Run Video at 60.9/second checkbox causes the emulator to inject deliberate delays into the video cycle so that the video interrupt runs roughly 60.9 times per second and the emulator executes the same number of 1802 instructions in this time as would a real elf.  Note that this is a single delay at one point in the cycle so that individual instruction execution time is not limited.  This setting pretty successfully enables elf video games to be played.

The Flag Keypress with EF3 checkbox causes the elf’s external flag 3 to be raised whenever a hex key is pressed.

The Input Ports selection boxes allow you to attach peripherals to the elf.  The options are N/C for not connected, TV+ to turn on the 1861 video,  XKP for the hex keypad,  KBD for the PC’s ascii keyboard; and JST for a joystick (not implemented). Traditional elf’s have port 1:TV+, Port 4:XKP, and optionally Port 7:KBD.

The Output Ports allow you to select from N/C, LED for the onboard LEDs, SND for a sound card, and TTY for a virtual Teletype printer.  Traditional elf’s have Port 4:LED and optionally Port 7:TTY.

 

About the 1802 processor.

There are many reference works on the 1802.  One good one on programming is Tom Pittman’s “A Short Course In Programming” available at http://www.cosmacelf.com/shortcourse.htm.

 

About the Visible Elf Emulator – Changes

Changes in Version 8.

Visualization is synchronized with the video cycle.

Speed monitoring via QueryPerformanceCounter and ability to lock video to 61hz.

The idle instruction is handled correctly.

A preferences dialog was added.

The File/Load menu item now looks for all file types by default.

 


Sample Programs

fblink.hex is a foolishly fast blinker

sblink.hex is a slowed down version

elfmon.hex is the elf monitor loaded at 0F00.  You can start it by putting a C00F00 at 0 or by setting reg 0 to 0F00. 

Poptronship.hex is the starship program from popular electronics

missile.hex is a simple shooter game.  press the I key to launch a missile at the targets on the top line.

Tbasic.hex is a tiny basic emulator

Chip8bouncer.hex is a chip-8 sample program.