Skip to content

3. DLX Assembly

Alberto Rodríguez edited this page Nov 9, 2022 · 3 revisions

Here are the WinDLX assembly directives to use when loading data.

Assembly directives

Directives are used to control the way data or code is loaded into the emulator. The following directives are working currently:

  • .aling n
    • Causes the next data/code loaded to be at the next higher address with the lower n bits zeroed.
  • .space "size"
    • Move the current storage pointer forward size bytes (to leave some empty space in memory)
  • .byte "byte 1", "byte 2", ...
    • Store the bytes listed on the line sequentially in memory.
  • .word "word 1", "word 2", ...
    • Store the words listed on the line sequentially in memory.
  • .float "numer 1", "number 2", ...
    • Store the numbers listed on the line sequentially in memory as single-precision floating point numbers.
  • .double "numer 1", "number 2", ...
    • Store the numbers listed on the line sequentially in memory as double-precision floating point numbers.
  • .ascii "string 1", "string 2", ...
    • 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 "string 1", "string 2", ...
    • Similiar to .ascii except each string is followed by a 0 byte.

The global directive is missing due to it being a little too specific and really not that useful.

Traps

Traps - the System Interface

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

THUMDER Core is intended to be used as a server for the Web UI, only the first trap will be supported.

  • Trap 0: Terminate a program
  • Trap 1: Open File. - Unimplemented
  • Trap 2: Close File. - Unimplemented
  • Trap 3: Read Block from File. - Unimplemented
  • Trap 4: Write Block to File. - Unimplemented
  • Trap 5: Formatted Output to Standard-Output. - Unimplemented

Instruction

Arithmetic and Logic R-TYPE instructions

nop          ;NOP                          
add          ;Add                          
addu         ;Add Unsigned                 
sub          ;SUB                          
subu         ;Sub Unsigned                                           
and          ;AND                          
or           ;OR                           
xor          ;Exclusive OR                 
sll          ;SHIFT LEFT LOGICAL           
sra          ;SHIFT RIGHT ARITHMETIC       
srl          ;SHIFT RIGHT LOGICAL          
seq          ;Set if equal                 
sne          ;Set if not equal             
slt          ;Set if less                  
sgt          ;Set if greater               
sle          ;Set if less or equal         
sge          ;Set if greater or equal      
movi2s       ;Move integer to special registers - Unimplemented
movs2i       ;Move special registers to integer - Unimplemented
movf         ;Move float
movd         ;Move double
movfp2i      ;Move a fp register into general registers
movi2fp      ;Move a general register into a fp register

Floating point and Logic R-type Instructions

;Operations done in the floating point units
mult         ;Mult integers
multu        ;Mult unsigned integers
div          ;Div integers
divu         ;Div unsigned integers
addf         ;Add float
subf         ;Sub float
multf        ;Mul float
divf         ;Div float
addd         ;Add double
subd         ;Sub double
multd        ;Mul double
divd         ;Div double
cvtf2d       ;Converts float to double
cvtd2i       ;Converts float to integer
cvtd2f       ;Converts double to float
cvtd2i       ;Converts double to integer
cvti2f       ;Converts integer to float
cvti2d       ;Converts integer to double
eqf          ;Equals float
nef          ;Not equals float
ltf          ;Less than float
gtf          ;Greater than float
lef          ;Less or equal float
gef          ;Greater or equal float
eqd          ;Equals double
ned          ;Not equals double
ltd          ;Less than double
gtd          ;Greater than double
led          ;Less or equal double
ged          ;Greater or equal double

Arithmetic and Logical Immediate I-TYPE instructions

addi         ;Add Immediate                
addui        ;Add Usigned Immediate        
subi         ;Sub Immediate                
subui        ;Sub Unsigned Immedated       
andi         ;AND Immediate                
ori          ;OR  Immediate                
xori         ;Exclusive OR  Immediate      
slli         ;SHIFT LEFT LOCICAL Immediate 
srai         ;SHIFT RIGHT ARITH. Immediate 
srli         ;SHIFT RIGHT LOGICAL Immediate
seqi         ;Set if equal                 
snei         ;Set if not equal             
slti         ;Set if less                  
sgti         ;Set if greater               
slei         ;Set if less or equal         
sgei         ;Set if greater or equal          

Load/Stores

lb           ;Load Byte
lh           ;Load Halfword
lw           ;Load Word
lbu          ;Load Byte Unsigned
lhu          ;Load Halfword Unsigned
lf           ;Load Float
ld           ;Load Double
sb           ;Store Byte
sh           ;Store Halfword
sw           ;Store Word
sf           ;Store Float
sd           ;Store Double

Jumps and branches

j	     ;Jump
jal	     ;Jump and link
jr	     ;Jump register
jalr	     ;Jump and link register
call         ;Jump (Alias for jump)
rfe          ;Return form execution - Unimplemented
beqz         ;Branch if a == 0
bnez         ;Branch if a != 0
bfpt         ;Branch if FPSR == 1
bfpf         ;Branch if FPSR == 0

Back to home

Clone this wiki locally