I am in a computer architecture class and we are in the subject of 16 bit assemb
ID: 3624674 • Letter: I
Question
I am in a computer architecture class and we are in the subject of 16 bit assembly. Could someone show me how to go about writing these two examples problems and if possible place comments next to the code lines so I can learn off them. This isn't homework or an assignment, its just a self learning example.Thanks! live long and prosper my friends
1.Write code that jumps to label L1 if either bit 4,5, or 6 is set in the BL register.
I know I need to write a test case for this example but I'm unsure how to go about it
2.Write code that jumps to label L1 if bits 4,5 or 6 are all set in the BL register
Explanation / Answer
;;;;;;;;;;;;;;
; Problem 1
;;;;;;;;;;;;;;
; test cases
;MOV BL, 00110000b ;jump to L1
;MOV BL, 00010000b ;jump to L1
;MOV BL, 00001000b ;jump to L1
;MOV BL, 00110000b ;jump to L1
MOV BL, 10110001b ;jump to L1
;MOV BL, 10000000b ;not jump
; code that jumps to label L1 if either bits 4, 5, or 6 are set in the BL register
TEST BL, 00111000b
JNZ L1
RET
L1:
XOR BX, BX
RET
;;;;;;;;;;;;;;
; Problem 2
;;;;;;;;;;;;;;
;test cases
MOV BL, 00111001b ;jump to L2
;MOV BL, 10111001b ;jump to L2
;MOV BL, 11111000b ;jump to L2
;MOV BL, 00111000b ;jump to L2
;MOV BL, 00101000b ;not jump
;MOV BL, 00100001b ;not jump
; code that jumps to label L2 if bits 4,5 or 6 are all set in the BL register
AND BL, 00111000b
CMP BL, 00111000b
JE L2
RET
L2:
XOR BX, BX
RET
Greetings from Argentina!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.