Download windlx_d.exe (for windows PC)

This program is a assembly interpreter for the DLX assembly language described in the text and in lecture. Please read the tutorials and the links to get yourself familiarized with DLX.

WinDLX Links:

A quick start for windlx.exe
Source code:
  1. Source code can be edited by using any text editor and ends with extension .s. eg: program.s
  2. The source code can be visualized as 3 portions. The directives, the DLX codes and the I/O traps.
  3. The first portion contains the directives that are basically variables declarations, memory code and data pointers.
  4. The DLX codes contain the DLX assembly language that has been presented in the class.
  5. The I/O traps (trap 0 - trap 5) are part of the DLX codes that deal with files and standard I/O.

; eg: a typical program
; Your directives
               .global main
; Your DLX codes start here

; ******* end *******


While the assembler is processing an assembly file, the data and instructions it assembles are placed in memory based on either a text (code) or data pointe. Which pointer is used is selected not by the type of information, but by whether the most recent directive was .data or .text. The program initially loads into the text segment.

The WinDLX assembler supports several directives that affect how it loads the DLX's memory. These should be entered in the place where you normally place the instructions and its arguments. Other directives supported are:

.align n
Cause the next data/code loaded to be at the next higher address with the lower n bits zeroed.

.ascii "string1", "string2",...
Store the strings listed on the line in the memory as a list of characters. The strings are not terminated by a 0 byte.

.asciiz "string1", "string2",...
Similiar to .ascii except each string is followed by a 0 byte.

.byte "byte1", "byte2",...
Store the bytes listed on the line sequentially in memory.

.double number1, number2,...
Store the numbers listed on the line sequentially in memory as double-precision floating point numbers.

.float number1, number2,...
Store the numbers listed on the line sequentially in memory as single-precision floating point numbers.

.global label
Make the label available for reference by code found in files loaded after this file.

.space size
Move the current storage pointer forward size bytes (to leave some empty space in memory)

.word word1, word2,....
Store the words listed on the line sequentially in memory.


Traps - the System Interface

Traps build the interface between DLX programs and the I/O-system. There are five traps defined in WinDLX. Zero is an invalid parameter for a trap instruction, used to terminate a program.

The Traps:

  • Trap 0: Terminate a program.
  • Trap 1: Open File
  • Trap 2: Close File
  • Trap 3: Read Block from File
  • Trap 4: Write Block to File
  • Trap 5: Formatted Output to Standard-Output
For all five defined traps:
  • They match the UNIX/DOS-System calls resp. C-library-functions open(), close(), read(), write() and printf().
  • The file descriptors 0,1 and 2 are reserved for the stdin, stdout and stderr. The input and output to the DLX-I/O-Windows can be controlled with this descriptors.
  • The address of the required parameters for the system calls must be loaded in register R14.
  • All parameters have to be 32 bits long (except the double-precision FPs that are 64 bits long). Strings are referenced with their begin address.
  • The result is returned into R1.
  • If an error occurs during the execution of a system call, register R1 is set to -1 and: if the symbol "_errno" is set to value A, then an error code is returned at the memory address A and the simulation continues, otherwise the simulation is aborted. See MS-DOS documentation for details about the error codes.
Please refer to the example programs for the usage of traps.
Loading and Running the program:
  1. File->load Code or data (F3) to load the programs.
  2. If codes are contained in multiple files, load the file with the main module first then followed by the files with subroutines.
  3. Execute->Run (F5) to run the program.
  4. Execute->Single cycle (F7) to step and debug the program, together with the code and register sub-windows.