DLX Executable

From VO-EM Wiki
Jump to: navigation, search

Much like a .exe is an executable file that the Windows operating system can run as a program, the VO-EM debug console is capable of executing .dlx files. Despite the extension, these files are actually plain text - you can edit them in any garden-variety text editor such as notepad or wordpad.

While the .dlx format has a few hidden options (and as a result you may see some things in .dlx files that are generated by the assembler, the VO-EM console's file loader only recognises its basic functionality.

Binary data

The bulk of a .dlx file consists of the binary data which makes up the program it contains. Its format consists of a target address followed by the information to be put in the address. The target and the string of data are separated by a double space, and targetting a different address must be done on a new line. Bytes of data are separated with a single space.

There is technically no limit to how many bytes of data you can write to a single target, but the assembler writes 16 bytes per line to make things easy to read.

All values are represented in hex.

Format:

[target1]  [byte] [byte] [byte] [byte]
[targetn]  [byte] [byte] [byte] [byte]

Example:

000006A0  8F C3 FF FC 2B DE 00 14 4B E0 00 00 
00004000  00 00 18 03 34 C6 4D 89 60 06 6E 61 7F 12 7F 44 

This example writes 12 bytes starting from address 0x6A0, then writes 16 bytes starting from address 0x4000.

Banking

The VO-EM's cartridge memory from 0x4000 to 0x7999 is banked, meaning that depending on which bank is selected, the data at an address in this range may be different.

Being a third party application, the assembler was not written with banked memory in mind. As such, a stopgap measure has been used to support compiling for banked memory.

Simply, binary data targeting blocks 0x8000 and above will be inserted into banks in blocks of 0x4000 bytes.

Meaning that the following:

00004000  DE AD
00008000  BE EF

Will load the bytes DE and AD into the first address of bank 1 (addressable by the CPU at 0x4000 with bank 1 selected), while the bytes BE and EF will be available in the first address of bank 2 (*also* addressable by the CPU at 0x4000, but with bank 2 selected).

The cartridge converter application also accepts this convention.

Start address

The .dlx file also instructs the CPU as to where in the program to begin execution. Once the cartridge is loaded and verified, the program counter will be set to the address following the .start command, like so:

.start 50 

This starts program execution at address 0x50.

The program can be set to start at any address in 32 bit addressable space. If no .start command is found, the CPU will begin execution at address 0x0.

The cartridge converter application also accepts this convention.

Future features

The current system of implementing banked memory is unwieldy. Going forward, I intend to write a wrapper for the assembler that will allow it to accept commands in the format

.bank 0
...data... 
.bank 1
...data...
.bank 2
...data...

Which will prevent having to rely on trickery to support banked memory. The old system of memory banking will still be supported as a legacy feature.