26 May 2013

Subtract two Values in DLX Programming

Subtraction commands on DLX

1:  sub r1,r2,r3   ;Subtract Signed integers  
2:  subi r1,r2,100 ;Subtract Signed integers Immediate  
3:  subur1,r2,r3   ;Subtract Unsigned integers  
4:  subui r1,r2,100;Subtract Unsigned integers Immediate  
Explanation of code for subtracting from 2 registers
1:  ; #r1 register=0  
2:  ; #r2 register=10  
3:  ; #r3 register=30  
4:  ; Before execution  
5:  sub r1,r2,r3  
6:  ; After execution  
7:  ; #r1 register=20  
8:  ; #r2 register=10  
9:  ; #r3 register=30  
Explanation of code for subtracting register from immediate value
1:  ; #r1 register=0  
2:  ; #r2 register=10  
3:  ; Before execution  
4:  subi r1,r2,30  
5:  ; After execution  
6:  ; #r1 register=20  
7:  ; #r2 register=10  

0 comments:

Post a Comment

Popular Posts