Question

In: Computer Science

Give an example of the pair of assembler instructions equivalent to a push using 32 bit...

Give an example of the pair of assembler instructions equivalent to a push using 32 bit ISA.

Solutions

Expert Solution

ISA: Stands for Instruction Set Architecture
It is the boundary between software and hardware.

3 most common types of ISAs are:
Stack (Push, Pop, Add) - The operands are implicitly on top of the stack.
Accumulator (Load, Add, Store) - One operand is implicitly the accumulator.
General Purpose Register (GPR)

Push stores a 64-bit register out onto the stack.
The 64-bit registers are those like "rax" or "r8"
32-bit registers like "eax" or "r8d".

If we use eax register with push it gives an error "instruction not supported in 64-bit mode. So we must use push rax 64 bit instead.

32 Bit Register are:
eax, edx, ecx, ebx, esp, ebp, esi, edi, r8d, r9d, r10d, r11d, r12d, r13d, r14d, r15d

Set up Stack Segment with 16-bit stack push to SP and the stack should be aligned as two byte as 16-bit register occupies one slot and pushing a 32-bit register occupies two slots
16 bit register + 16 bit register into one slot of 32bit.

verify this to yourself with the following code:
push eax
pop ax
pop bx
Example; nasm -f bin -o test32.com test32.asm
bits 16
org 100h
mov eax, 11112222h
push eax
pop ax
pop dx
call ax2hex
mov ax, dx
call ax2hex
ret

ax2hex:
push cx
push dx
mov cx, 4

.top
rol ax, 4
mov dl, al
and dl, 0Fh
cmp dl, 9
jbe .dec_dig
add dl, 7

.dec_dig:
add dl, 30h
push ax
mov ah, 2
int 21h
pop ax

loop .top
pop dx
pop cx
ret


Related Solutions

Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal....
Translate these two LEGv8 assembly instructions to 32-bit binary machine code. Give your answer in hexadecimal. CBZ X19, exit ADD X10, X19, X20 exit:
Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit adder using a single 4 bit adder using verilog code
Design a 32 bit adder using a single 4 bit adder using verilog code
Using behavioral VHDL, 32-bit up counter with enable.
Using behavioral VHDL, 32-bit up counter with enable.
Assume that we are executing the following code on a 32-bit machine using two’s complement arithmetic...
Assume that we are executing the following code on a 32-bit machine using two’s complement arithmetic for signed integers. Which of the following will be printed when the following code is executed (circle those printed, and show work; e.g., how the values are stored): #include <stdio.h> int main() { char x = 0xF;                // x = ________ char y = -1;                 // y = ________ unsigned char z = 0xFF;      // z = 11111111        if (x<z)     printf("performed unsigned compare,...
using Windows 32 bit framework , Write an assembly language program to find the second minimum...
using Windows 32 bit framework , Write an assembly language program to find the second minimum element (formally, second minimum is larger than the minimum but smaller than all the other elements in the array) of an array of size 100. Note: You can define the array as nbrArray DWORD 23 45 21 67 78 95 dup(?) and show that your program works for the first five elements. Display the second minimum in a message box using Input output macro
Could you give me a 7-bit example of non-restoring binary division algorithm using: Dividend: 1100000 Divisor:...
Could you give me a 7-bit example of non-restoring binary division algorithm using: Dividend: 1100000 Divisor: 01011
Give 4 example in the market - that is using nano technoloy - give some example...
Give 4 example in the market - that is using nano technoloy - give some example to support your answer and What does it help for social, economic and environmental . (is it some thing like that?)
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit...
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit integers X and Y (X and Y can be prompted separately or at the same time), get them from the user then store them in memory locations labeled X and Y respectively. The program then loads X and Y from the main memory to registers, calculates the sum of them (i.e. X + Y) and store the sum into a memory location labeled S....
Q: Give numerical example explaining the concept of Equivalent number of units. Discuss the advantages of...
Q: Give numerical example explaining the concept of Equivalent number of units. Discuss the advantages of using equivalent number f units?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT