ASSEMBLY: Identify which of the following addressing modes are illegal, explain why it is illegal.
A) mov bl, [rbx][rbx]
B) mov ebx, [cs]
C) mov ah, [rbp][rbx]
D) mov ax, [rbp*10]
E) mov bx, [rax*8][rbp][-7]
F) mov dx, [rbp*1][rax*8]
G) mov r15, [VTable+rax][rcx]
H) mov rbp, [rsp+rax]
I) mov cl, [rdx][rax*8]
J) mov ax, [ah][al]
Answer
Below are the illegal addressing modes:
A) mov bl, [rbx][rbx]
C) mov ah, [rbp][rbx]
E) mov bx, [rax*8][rbp][-7]
F) mov dx, [rbp*1][rax*8]
G) mov r15, [VTable+rax][rcx]
I) mov cl, [rdx][rax*8]
J) mov ax, [ah][al]
In the assembly instruction one must choose maximum of one item from the group of displacement, base and offset.
ASSEMBLY: Identify which of the following addressing modes are illegal, explain why it is illegal. A)...
May you explain how you got the answer
The following code sequence occurs near the beginning of the assembly code generated by gcc for a c procedure: 9. 1, subq 2" movq 3" movq 4" movq 5. movq 6. movq 7. movq 8. movq 9. movq 10. movq $24,%rsp %rbx, (%rsp) %r12, 8(%rsp) %r13, 16(%rsp) 16(%rbp), %rbx 24(%rbp), %r13 (%rbx), %r12 (%r13), %rax 16(%rbp ) ,%rdx (%rdx), %rcx we see that just three registers (%rbx, %r12 and %r13) are saved...
a) Write the following C function in Assembly. You must follow the System V 64-bit calling convention and use AT&T Syntax notation. long fibonacci (long n) { if (n == 0) return 0; else if (n == 1) return 1; else return (fibonacci (n - 1) + fibonacci (n - 2)); } b) The Windows x86-64 calling convention passes function parameters in the registers RCX, RDX, R8 and R9 and returns values on register RAX. Caller saved registers are: RAX,...
a) Write the following C function in Assembly. You must follow
the System V 64-bit calling convention and use AT&T Syntax
notation. Note: You cannot change the algorithm in any way so your
assembly function must still be recursive. (20 points) long Catalan(long n) { long sum
= 0; if (n == 0) return 1; for (int i = 0; i < n; i++) { sum +=
Catalan(i) * Catalan(n - i - 1); } return sum; } b) The...
Assembly language 64 bit please !
An example file for set up
==========+
;| Data Segment BEGINS Here |
;+======================================================================+
segment .data
;Code this expression: sum = num1+num2
num1 dq 0 ;left operand of the addition operation
num2 dq 0 ;right operand of the addition operation
sum dq 0 ;will hold the computed Sum value
RetVal dq 0 ;Integer value RETURNED by function calls
;can be ignored or used as determined by the programmer
;Message string prompting for the keyboard...
EEE 3423 - MICROPROCESSOR & MICROCOMPUTERS Sem I, 2019/2020 TUTORIAL #2: Week 05 - Week 08 Answer all questions. [CO1-P011 1. Assuming that the instructions below are being executed in sequence from line 1 to 6. MOV AL, 010101010 MOV AH, AL AND AL, 00011111B OR AH, 11000000B XOR AL, 00001111B (62 NOT AH Descnbe the result of executing the following sequence of instructions from line 1 to 6 respectively but in HEX number system. Then, please provide the final...
Need help on Assembly language 1.Solve the following conditions: A. Suppose AL contains 11001011 and CF = 1. Give the new contents of AL after each of the following instructions is executed. Assume the above initial conditions for each part of this question. a. SHL AL,1 b. SHR AL,1 c. ROL AL,2 d. ROR AL,3 e. SAR AL,2 f. RCL AL,1 g. RCR AL,3 B. Suppose EAX contain ABCDH. Show the contents of BX and CX after...
Assume that the registers have the following values (all in hex) and that CS= 1000, DS = 2000, SS=3000, SI=4000, DI = 5000, BX=6080, BP= 7000, AX=25FF, CX=8791, and DX=1299. Calculate the physical address of the memory where the operand is stored and the contents of the memory locations in each of the addressing examples. a) MOV [SI], AL b) MOV [SI+BX+8], AH c) MOV [BX]+300, DX Now Examine the status of the CF, PF, AF, ZF, and SF if...