I am using Xcode on Mac OS with 32-bit Intel architecture and need help with the
ID: 3877182 • Letter: I
Question
I am using Xcode on Mac OS with 32-bit Intel architecture and need help with the following written in assembly language
Create a program for GAS that contains the following items:
-A sum variable of the appropriate size to hold initializer 0x10000
-A message variable that holds the text (preserving line breaks): Welcome to Assembly programming. Your grade will be randomly assigned by the Intel 8086 processor!
-An input variable that does not contain an initial value and is able to hold the values 0-255
-An instuction to assign the base-10 value 200 to the input variable as a binary literal
Explanation / Answer
1- This program gives you idea about how to prompts the user to enter an integer and returns the integer value entered via the EAX register. The prompt string should be passed to the proc as an argument using the stack. The prompt should be displayed using the strput.
.386
.MODEL flat,stdcall
.STACK 4096
;; change the IRVINE32 direction if it is not installed in the bellow folder
INCLUDE C:IrvineIrvine32.inc
INCLUDELIB C:IrvineIrvine32.lib
.data
prompt BYTE "Enter the integer: ", 0
.code
qryInt PROC
push ebp
mov ebp, esp
mov edx, [ebp + 8] ; get the address of the prompt parameter
call WriteString
call ReadInt ; read the integer into EAX
pop ebp
ret
qryInt ENDP
main PROC
; put the address of the prompt onto the stack
mov eax, OFFSET prompt
push eax
call qryInt
; the integer should be EAX
call WriteInt
exit
main ENDP
END main
2- This program takes a single string argument, counts the number of characters in the string, and returns the count via the EAX register.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.