Write L3 machine code routines for the following To perform
Write L3 machine code routines for the following: To perform an NOR on two binary numbers stored in x3100 and x3101 store the result at x3102.
Solution
Solution:
The L3 machine code is as follows:
.ORIG x3000 ; It specifies the address from where program code will begin
;load the beginning address of the data to R2
LEA R2 , xFF ; This instruction means R2 will have x3000 + x1 + xFF i.e. x3100
; First binary number located at x3100 is loaded into R1
LDR R1 , R2 , x0 ; R1 MEM[ x3100 ]
; Second binary number located at x3101 is loaded into R3
LDR R3 , R2 , x1 ; R3 MEM[ x3100 + x1 ]
NOT R1 , R1 ; Now R1 will have NOT(R1)
NOT R3 , R3 ; Now R3 will have NOT(R3)
;Perform the operation given below to NOR the values of
AND R4 , R1 , R3 ; Now R4 will have NOT(R1) AND NOT(R3)
AND R4 , R4 , x0 ; Clear R4 with 0
STR R4 , R2 , x2 ; Now MEM[ x3100 + x2 ] will have the value of R4
