Question

In: Computer Science

Code using assembly language Create a program using the Irvine32 procedures were the user can input...

Code using assembly language

Create a program using the Irvine32 procedures were the user can input a list of 32-bit unsigned integers an “x” number of times, then display these integers to the console in reverse order.

Hint: Use loops and PUSH & POP instructions.

Extra Challenge: Inform the user with a message what to do; also, tell them what they are seeing.

Solutions

Expert Solution

Consider the following code fragment:

somenum = 0FFh ; define constant to FF hex

MOV ah, somenum ; move (i.e. copy) to the AH register

somenum = 0AAh ; re-define constant to AA hex

MOV ah, somenum ; move to the AH register

The above is equivalent to:

MOV ah, 0FFh

MOV ah, 0AAh

In the above, we redefined the value of the constant somenum. The following code would be invalid:

somenum = 0FFh

MOV somenum, ah ; INVALID

This would be akin to trying to do:

MOV 0FFh, ah ; Move accumulator high to FF? Not valid since FF is a number, not a storage loc

1 title Add and Subtract (AddSub.asm)

2 ; This program adds and subtracts 32-bit integers.

3

4 INCLUDE Irvine32.inc

5 .code

6 main PROC

7 mov eax, 10000h ; EAX = 10000h

8 add eax, 40000h ; EAX = 50000h

9 sub eax, 20000h ; EAX = 30000h

10 call DumpRegs ; Display registers

11 exit

12 main ENDP

13 END main

Alternate version of AddSub

By including irvine32.inc, we are hiding a number of details. Here is a description of some of these details shown in this alternate version of the same program:

1 title Alternate Add and Subtract (AddSubAlt.asm)

2 ; This program adds and subtracts 32-bit integers.

3

4 .386

5 .MODEL flat,stdcall

6 .STACK 4096

7 ExitProcess PROTO, dwExitCode: DWORD

8 DumpRegs PROTO

9 .code

10 main PROC

11 mov eax, 10000h ; EAX = 10000h

12 add eax, 40000h ; EAX = 50000h

13 sub eax, 20000h ; EAX = 30000h

14 call DumpRegs ; Display registers

15 INVOKE ExitProcess, 0

12 main ENDP

13 END main


Related Solutions

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....
Using Java (Swing) language(please hard code)... Create a program that has a textfield for the user...
Using Java (Swing) language(please hard code)... Create a program that has a textfield for the user to type in a set of input. Below that textfield have the following controls to show string manipulations: (1) A button that will change the entire textfield’s current text to uppercase. (2) A button with its own textfield for a search value, that will tell the position the search value appears in the textfield above. (3) A button that reports the current number of...
Using x86 assembly language, create a flowchart and write an example of code that will sort...
Using x86 assembly language, create a flowchart and write an example of code that will sort 2 arrays of unsigned doubleword integers in ascending order and output the largest element in each array. Any sorting procedure can be used, but this procedure must be called twice for each array. The first time it is called, the first array should be sorted and the second time it is called, the second array must be sorted. As well as outputting which is...
Using C++ Create a program that asks the user to input a string value and then...
Using C++ Create a program that asks the user to input a string value and then outputs the string in the Pig Latin form. - If the string begins with a vowel, add the string "-way" at the end of the string. For “eye”, it will be “eye-way”. - If the string does not begin with a vowel, first add "-" at the end of the string. Then rotate the string one character at a time; that is, move the...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
MIPS Assembly LanguageWrite a MIPS assembly language program that asks the user toinput an...
MIPS Assembly LanguageWrite a MIPS assembly language program that asks the user to input an integer and then prints out a string that shows how that integer should be encoded using 16 bits. Your program should handle both positive and negative valued inputs. Your program should also print out an error message if the given input cannot be expressed as a 16 bit signed integer.As an example, if the input is 12, your program should output “0000000000001100”. If the input...
Using RAPTOR create a program that allows the user to input a list of first names...
Using RAPTOR create a program that allows the user to input a list of first names in on array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. the output should be a list of email address where the address is of the following form: [email protected]
create a program using IDLE where you will gather input from the user using a loop....
create a program using IDLE where you will gather input from the user using a loop. The user needs to provide you with a list of test scores for two categories (two different classrooms). Test scores must be integer values between 0 and 10. You need to process each score so that you can output the following: Number of test scores entered for classroom A. Number of test scores entered for classroom B. Average of test scores entered for classroom...
create a program using IDLE where you will gather input from the user using a loop....
create a program using IDLE where you will gather input from the user using a loop. The user needs to provide you with a list of test scores for two categories (two different classrooms). Test scores must be integer values between 0 and 10. You need to process each score so that you can output the following: Number of test scores entered for classroom A. Number of test scores entered for classroom B. Average of test scores entered for classroom...
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT