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:
Create a 32-bit Linux-based assembler language program (nasm) which: 1. Defines these variables: A: A single...
Create a 32-bit Linux-based assembler language program (nasm) which: 1. Defines these variables: A: A single byte B: A word C: A double word D: A double word 2. Using the eax register (and its sub-registers), process the following equations (ONLY using the mov, add and sub assembly keywords): I. A + (B + C) = D II. (A + C) - B = D 3. Using the linux function library, print a string describing each equation, then values in...
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
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a...
c) Using the 32-bit binary representation for floating point numbers, represent the number 1011100110011 as a 32 bit floating point number. i) A digital camera processes the images images in the real-world and stores them in binary form. Using the principles of digital signal processing, practically explain how this phenomenon occurs.
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?)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT