DCPU VM

Another DCPU-16 Virtual Machine

Download as .zip Download as .tar.gz View on GitHub

DCPU VM

Multi-platform DCPU-16 Virtual Machine

Note that this VM is aimed to implement and test some of the proposed hardware devices of the Trillek project. In addition, includes some extra tools.

Based on Benedek Vartok VM

COMPILATION

mkdir build
cd build
cmake ..
make

To make a Release build (compiling with optimizations):

cmake -DCMAKE_BUILD_TYPE=Release ..

To make a Debug build:

cmake -DCMAKE_BUILD_TYPE=Debug ..

Run make install to copy the executable to the root of the project This project fork is made to run perfectly on windows without boost

RUNNING

Just type dcpu-vm --help to get these infos.

dcpu-vm 0.1
usage : dcpu-vm [-options] <dcpu16-exe>
--------------------------------------------------------
  options:
    -assemble (-a) : assemble before load (experimental)
    -output <filename> (-o) : output assembled filename
    -debug (-d) : start in debug mode
            F1  : next step
            F2  : print CPU status
            System + F12 : switch debug/run
    -time (-t) : use timed emulation (else refresh based)
    -vsync (-v) : use vertical synchronisation
                    (more accurate but may bug)
  Hardware loadout options:
    -loadout (-l) : XML file that describes hardware loadout. If isn't using
            a loadout file, then a default loadout will be used. The default
            loadout contains a generic clock, a generic keyboard, a monitor,
            a floppy drive and a sound speaker.
            The next options will be used to change the default loadout of
            the virtual machine.
    --monitor=<monitor_name> : use the following monitor
            1802 -> Lem1802 (default) [c] (-1802)
            1803 -> Lem1803 [c] (-1803)
            cgm -> Colour Graphics Monitor (-cgm)
            [c] : compatible with Lem1802 0x10c programs
    --no-sound : disable the sound speaker device
    -floppy <filenames...> (-fd) : floppy image files

There is a debug/step mode that can be activated and deactivated with System+F12:

Available shortcuts all-time:

LOAD-OUT DESCRIPTION FILES

A custom device load-out can be set using a XML file describing what devices will be used. The XML file follow this structure :

<?xml version="1.0" encoding="utf-8"?>
<loadout>
  <hardware>
    <device type="GenericClock" />
    <device type="GenericKeyboard" />
    <device type="M35FD" />
    <device type="LEM1803" />
    <device type="CGM1084" />
    <device type="SimpleSpeaker" />
  </hardware>
</loadout>

The devices will be loaded in the same order that is in the XML file. Also can read the load-out from a .10csln solution file from DevKit. Actually admit this device list:

TODO

TOOLS

PBM2FONT

PBM2FONT is a small tool to create LEM180x and CGM 1084 fonts. It uses a ASCII PBM image file to create the HEX data values that represents the font.

RUN

Just type pbm2font --help to get these infos.

usage : pbm2font [-options] <input-file>
--------------------------------------------------------
  options:
    -output <filename> (-o) : output filename
    -charset=<charset_type> : use the following charset type
            4x8 -> Generates 4x8 font charset
            8x8 -> Generates 8x8 font charset
    -format=<output_format> : use the following format
            dat -> Uses universal .dat output format
            hex_dump -> Generates a hexadecimal dump
            By default, the ouput format is "dat" and the charset is 4x8

If no output file has been chosen, then it will write to standard out.

HOW IT WORKS

PBM2FONT reads the PBM file, and makes a grid of 4x8, or 8x8 cells. Each cell is converted to the appropriate format for 4x8 or 8x8 fonts. So to generate a font, you only need to use a graphics editor program that outputs ASCII PBM files (for example The Gimp), and set a grid of 4x8 or 8x8. Then you only need to draw each character in black and white and save the file.

Creating a font with The Gimp