;Write assembly language code for all type of the conditional overgflow and signed
;program flow control instructions
TTL transfer
AREA Myprog, CODE, READONLY
ENTRY
EXPORT main
main
;Table1: Conditional branch instructions for overflow detections
;==============================================================================
;Required branch control Unsigned data Signed data
;==============================================================================
;If (overflow(R0 + R1)) then branch BCS label BVS label
;If (no_overflow(R0 + R1)) then branch BCC label BVC label
;If (overflow(R0 – R1)) then branch BCC label BVS label
;If (no_overflow(R0 – R1)) then branch BCS label BVC label
;==============================================================================
;Table2: Conditional branch instructions for positive or negative value detection
;==============================================================================
;Required branch control Unsigned data Signed data
;==============================================================================
;If (result >=0) then branch Not applicable BPL label
;If (result < 0) then branch Not applicable BMI label
;==============================================================================
;unsigned overflow detection/ carry flag based branch
LDR R6,=0xFFFFFFFF
LDR R5,=0x00000001
LOOP11 ADDS R6,R6,R5
; during first addition carry flag is set, ans is C=1 R6=0x00000000
; during second addition carry flag is reset, ans is C=0 R6=0x00000001
BCC LOOP10 ;branch if C=0
BCS LOOP11 ;branch if C=1
;above example peform the overflow for addition operations
;for subtraction you can do it by your own
;Signed overflow incorporate signed ov, carry and Signed flag
LOOP10
LDR R6,=0xFFFFFFFF
LDR R5,=0x80000000
LOOP12 ADDS R6,R6,R5
; during first addition sign change and ov flag is set, ans is N=0,C=1,ov=1 R6=0x7FFFFFFF
; during second addition sign changes and ov flag is reset, ans is N=1,C=0,ov=0 R6=0xFFFFFFFF
BVC LOOP13 ;branch if V=0
BCS LOOP15 ;branch if C=1
LOOP15 BPL LOOP16 ;branch if N=0
LOOP16 BVS LOOP12 ;branch if V=1
LOOP13 BCC LOOP14 ;branch if C=0
LOOP14 BMI done ;branch if N=1
done
SWI &11
END
Adsense
Write assembly language code for all type of the conditional overgflow and signed program flow control instructions
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