;Write assembly language code for all type of the conditional for value comparison operations
TTL transfer
AREA Myprog, CODE, READONLY
ENTRY
EXPORT main
main
;*****************************conditional instructions***************************
;Table: Conditional branch instructions for value comparison operations
;=============================================================================
;Required branch control Unsigned data Signed data
;=============================================================================
;If (R0 equal R1) then branch BEQ label BEQ label
;If (R0 not equal R1) then branch BNE label BNE label
;If (R0 > R1) then branch BHI label BGT label
;If (R0 >= R1) then branch BCS label/BHS label BGE label
;If (R0 < R1) then branch BCC label/BLO label BLT label
;If (R0 <= R1) then branch BLS label BLE label
;=============================================================================
MOVS R1,#3
MOVS R2,#3
MOVS R3,#4
;for signed and unsigned equ and Not equ
CMP R2, R1 ; compare the R2 with R1 and reflect the status in FLAGS
BEQ LOOP3 ;branch if R2 = R1
LOOP3 CMP R2,R3 ; compare the R2 with R3 and reflect the status in FLAGS
BNE LOOP4_1 ; branch if R2 != R3
;unsigned greater than/equal and less than/equal
LOOP4_1 MOVS R1,#5 ;Loop counter starting value is 5
LOOP4
ADDS R4, #1
CMP R1, R4
BLO LOOP5 ;branch if R1<R4/ R1 is lower than R4
SUBS R1, #1
BHI LOOP4 ;branch if R1 is higher than 1
LOOP5 MOVS R1,#6 ;Loop counter starting value is 6
ADDS R4, #1
CMP R1, R4
BLS LOOP6 ;branch if R1<= R4/ R1 lower than or same to R4
SUBS R1, #1
BHS LOOP5 ;branch if R1 is higher and same to 1
;signed greater than/equal and less than/equal
LOOP6 MOVS R1,#5 ;Loop counter starting value is 5
MOVS R4,#0 ;Set R4 to zero
LOOP7
ADDS R4, #1
CMP R1, R4
BLT LOOP8 ;branch if R1<R4
SUBS R1, #1
BGT LOOP7 ;branch if R1>1
LOOP8 MOVS R1,#6 ;Loop counter starting value is 3
ADDS R4, #1
CMP R1, R4
BLE done ; branch if R1<=R4
SUBS R1, #1
BGE LOOP8 ; branch if R1>=1
done
SWI &11
END
Adsense
Write assembly language code for all type of the conditional for value comparison operations
Subscribe to:
Post Comments (Atom)
Write a ARM cortex M0+ assembly language code based on arithmatc and logical instructions.
Problem 1: Implement following code conversions to convert binary no 0x89ABCDEF(32-bits) into a) BCD (64-bits) b) Gray (32-bits) Problem...
-
;Write assembly language code for all type of the conditional for value comparison operations TTL transfer AREA Myprog, CODE, READ...
-
Table SW1 SW2 SW3 SW4 Operation Result stored on location OFF ...
-
// this is basic LED blinking code realize without external header file of the MKL25Z.h /* System Integration Module System Clock Gating Co...
No comments:
Post a Comment