New Semester
Started
Get
50% OFF
Study Help!
--h --m --s
Claim Now
Question Answers
Textbooks
Find textbooks, questions and answers
Oops, something went wrong!
Change your search query and then try again
S
Books
FREE
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Tutors
Online Tutors
Find a Tutor
Hire a Tutor
Become a Tutor
AI Tutor
AI Study Planner
NEW
Sell Books
Search
Search
Sign In
Register
study help
business
implementing programming languages
Assembly Language For X86 Processors 7th Edition Kip Irvine - Solutions
4. What will be the value of BX after the following instructions execute?mov bx,029D6h xor bx,8181h
3. What will be the value of BX after the following instructions execute?mov bx,0649Bh or bx,3Ah
2. What will be the value of BX after the following instructions execute?mov bx,91BAh and bx,92h
1. What will be the value of BX after the following instructions execute?mov bx,0FFFFh and bx,6Bh
7. Would the following simplification of a signed decimal integer finite-state machine work just as well as the one shown in Section 6.6.2? If not, why not? Digit Digit Start +,- A B
6. What happens in a finite-state machine when no more input is available and the current state is a nonterminal state?
5. In the signed integer finite-state machine (Section 6.6.2), how many digits can occur after a minus sign?
4. In the signed integer finite-state machine (Section 6.6.2), which state is reached when the input consists of “5”?
3. In a finite-state machine diagram, what do the edges represent?
2. In a finite-state machine diagram, what do the nodes represent?
1. A finite-state machine is a specific application of what type of data structure?
4. Challenge: Rewrite the code from Section 6.5.3 so it is functionally equivalent, but uses fewer instructions.
3. In the program from Section 6.5.4, why is it better to let the assembler calculate NumberOfEntries rather than assigning a constant such as NumberOfEntries 4?
2. Implement the following pseudocode in assembly language:if edx
1. Implement the following pseudocode in assembly language:if ebx > ecx X = 1
5. Challenge: The LOOPNZ example in Section 6.4.2 relies on a sentinel value to handle the possibility that a positive value might not be found. What might happen if you removed the sentinel?
4. Modify the LOOPNZ example in Section 6.4.2 so that it scans for the first negative value in the array. Change the array initializers so they begin with positive values.
3. (True/False): The destination label of a LOOPZ instruction must be no farther than 128 or127 bytes from the instruction immediately following LOOPZ.
2. (True/False): In 32-bit mode, the LOOPNZ instruction jumps to a label when ECX is greater than zero and the Zero flag is clear.
1. (True/False): The LOOPE instruction jumps to a label when (and only when) the Zero flag is clear.
6. (Yes/No): Will the following code jump to the label named Target?mov ax,8109h cmp ax,26h jg Target
5. Which conditional jump instruction is equivalent to the JNGE instruction?
4. Which conditional jump instruction is equivalent to the JNA instruction?
3. Which conditional jump instruction is equivalent to JNAE?
2. Which jump instructions follow signed integer comparisons?
1. Which jump instructions follow unsigned integer comparisons?
5. Write a single instruction that converts an uppercase character in AL to lowercase but does not modify AL if it already contains a lowercase letter.
4. Write instructions that set the Zero flag if the 32-bit value in EAX is even and clear the Zero flag if EAX is odd.
3. Write a single instruction (other than NOT) that reverses all the bits in EAX.
2. Write a single instruction using 16-bit operands that sets the high 8 bits of AX and does not change the low 8 bits.
1. Write a single instruction using 16-bit operands that clears the high 8 bits of AX and does not change the low 8 bits.
In a byte array of size N, write a procedure that finds all multiples of K that are less than N. Initialize the array to all zeros at the beginning of the program, and then whenever a multiple is found, set the corresponding array element to 1. Your procedure must save and restore any registers it
Write a procedure that produces N values in the Fibonacci number series and stores them in an array of doubleword. Input parameters should be a pointer to an array of doubleword, a counter of the number of values to generate. Write a test program that calls your procedure, passing N = 47. The first
Direct recursion is the term we use when a procedure calls itself. Of course, you never want to let a procedure keep calling itself forever, because the runtime stack would fill up. Instead, you must limit the recursion in some way. Write a program that calls a recursive procedure. Inside this
Write a program that displays a single character in all possible combinations of foreground and background colors (16 16 256). The colors are numbered from 0 to 15, so you can use a nested loop to generate all possible combinations.
Create a procedure that generates a random string of length L, containing all capital letters.When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will hold the random string. Write a test program that calls your procedure 20 times and displays the
The RandomRange procedure from the Irvine32 library generates a pseudorandom integer between 0 and N 1. Your task is to create an improved version that generates an integer between M and N1. Let the caller pass M in EBX and N in EAX. If we call the procedure BetterRandomRange, the following code
Use the solution program from the preceding exercise as a starting point. Let this new program repeat the same steps three times, using a loop. Clear the screen after each loop iteration.
Write a program that clears the screen, locates the cursor near the middle of the screen, prompts the user for two integers, adds the integers, and displays their sum.
2. Suppose you are given three data items that indicate a starting index in a list, an array of characters, and an array of link index. You are to write a program that traverses the links and locates the characters in their correct sequence. For each character you locate, copy it to a new array.
1. Write a program that displays the same string in four different colors, using a loop. Call the Set-TextColor procedure from the book’s link library. Any colors may be chosen, but you may find it easiest to change the foreground color.
5. Write a sequence of statements that display a subroutine’s return address. Be sure that whatever modifications you make to the stack do not prevent the subroutine from returning to its caller.
4. Write a sequence of statements using indexed addressing that copies an element in a doubleword array to the previous position in the same array.
3. Functions in high-level languages often declare local variables just below the return address on the stack. Write an instruction that you could put at the beginning of an assembly language subroutine that would reserve space for two integer doubleword variables. Then, assign the values 1000h and
2. Suppose you wanted a subroutine to return to an address that was 3 bytes higher in memory than the return address currently on the stack. Write a sequence of instructions that would be inserted just before the subroutine’s RET instruction that accomplish this task.
1. Write a sequence of statements that use only PUSH and POP instructions to exchange the values in the EAX and EBX registers (or RAX and RBX in 64-bit mode).
20. What values will be written to the array when the following code executes?.data array DWORD 4 DUP(0).code main PROC mov eax,10 mov esi,0 call proc_1 add esi,4 add eax,10 mov array[esi],eax INVOKE ExitProcess,0 main ENDP proc_1 PROC call proc_2 add esi,4 add eax,10 mov array[esi],eax ret proc_1
19. Which statement is true about what will happen when the example code runs?1: main PROC 2: mov edx,0 3: mov eax,40 4: push eax 5: call Ex5Sub 6: INVOKE ExitProcess,0 7: main ENDP 8:9: Ex5Sub PROC 10: pop eax 11: pop edx 12: push eax 13: ret 14: Ex5Sub ENDPa. EDX will equal 40 on line 6b. The
18. Which statement is true about what will happen when the example code runs?1: main PROC 2: mov eax,40 3: push offset Here 4: jmp Ex4Sub 5: Here:6: mov eax,30 7: INVOKE ExitProcess,0 8: main ENDP 9:10: Ex4Sub PROC 11: ret 12: Ex4Sub ENDPa. EAX will equal 30 on line 7b. The program will halt with
17. Which statement is true about what will happen when the example code runs?1: main PROC 2: mov eax,30 3: push eax 4: push 40 5: call Ex3Sub 6: INVOKE ExitProcess,0 7: main ENDP 8:9: Ex3Sub PROC 10: pusha 11: mov eax,80 12: popa 13: ret 14: Ex3Sub ENDPa. EAX will equal 40 on line 6b. The program
16. Which statement is true about what will happen when the example code runs?1: main PROC 2: push 10 3: push 20 4: call Ex2Sub 5: pop eax 6: INVOKE ExitProcess,0 7: main ENDP 8:9: Ex2Sub PROC 10: pop eax 11: ret 12: Ex2Sub ENDPa. EAX will equal 10 on line 6b. The program will halt with a runtime
15. What will be the final value in EAX after these instructions execute?push 5 push 6 pop eax pop eax
14. Which statement(s) in the ArraySum procedure (Section 5.2.5) would have to be modified so it could accumulate an array of 16-bit words? Create such a version of ArraySum and test it.
13. (True/False): The register list in the USES directive must use commas to separate the register names.
12. (True/False): The USES operator only generates PUSH instructions, so you must code POP instructions yourself.
11. (True/False): The USES operator lets you name all registers that are modified within a procedure.
10. (True/False): The ArraySum procedure (Section 5.2.5) receives a pointer to any array of doublewords.
9. (True/False): The ESI and EDI registers cannot be used when passing 32-bit parameters to procedures.
8. (True/False): In protected mode, each procedure call uses a minimum of 4 bytes of stack space.
7. (True/False): Nested procedure calls are not permitted by the Microsoft assembler unless the NESTED operator is used in the procedure definition.
6. (True/False): The RET instruction pops the top of the stack into the instruction pointer.
5. Challenge: Suppose there were no PUSH instruction. Write a sequence of two other instructions that would accomplish the same as push eax.
4. Challenge: Another assembler (called NASM) permits the PUSH instruction to list multiple specific registers. Why might this approach be better than the PUSHAD instruction in MASM? Here is a NASM example:PUSH EAX EBX ECX
3. Which instruction pops the stack into the EFLAGS register?
2. Which instruction pushes the 32-bit EFLAGS register on the stack?
1. Which instruction pushes all of the 32-bit general-purpose registers on the stack?
11. Challenge: Write statements that prompt the user for an identification number and input a string of digits into an array of bytes.
10. Which processor status flags are displayed by the DumpRegs procedure?
9. What are the required input parameters for the ReadString procedure?
8. What are the required input parameters for the DumpMem procedure?
7. What types of statements are inside the Irvine32.inc file?
6. Write the INCLUDE directive that is required when using the Irvine32 library.
5. Which procedure from the link library places the cursor at a specific console window location?
4. Which procedure from the link library writes an unsigned integer to the console window in decimal format?
3. Write statements that cause a program to pause for 700 milliseconds.
2. Which procedure in the link library displays “Press [Enter] to continue. . .” and waits for the user to press the Enter key?
1. Which procedure in the link library generates a random integer within a selected range?
5. What type of file is kernel32.dll?
4. What is the name of the 32-bit link library supplied with this book?
3. Write a CALL statement that calls a procedure named MyProc in an external link library.
2. Use the PROTO directive to declare a procedure named MyProc in an external link library.
1. (True/False): A link library consists of assembly language source code.
6. (True/False): The CALL instruction pushes the offset of the instruction following the CALL on the stack.
5. (True/False): The CALL instruction pushes the offset of the CALL instruction on the stack.
4. How are the words Receives and Returns used in the suggested procedure documentation?
3. What would happen if the RET instruction was omitted from a procedure?
2. (True/False): It is possible to define a procedure inside an existing procedure.
1. (True/False): The PROC directive begins a procedure and the ENDP directive ends a procedure.
6. (True/False): The PUSH instruction cannot have an immediate operand.
5. (True/False): Local variables in procedures are created on the stack.
4. When a 32-bit value is pushed on the stack, what happens to ESP?
3. Why is the stack called a LIFO structure?
2. How is the runtime stack different from the stack abstract data type?
1. Which register (in 32-bit mode) manages the stack?
8. Using a loop and indexed addressing, write code that rotates the members of a 32-bit integer array forward one position. The value at the end of the array must wrap around to the first position.For example, the array [10,20,30,40] would be transformed into [40,10,20,30].
7. Write a program with a loop and indirect addressing that copies a string from source to target, reversing the character order in the process. Use the following variables:source BYTE "This is the source string",0 target BYTE SIZEOF source DUP('#')
6. Use a loop with indirect or indexed addressing to reverse the elements of an integer array in place. Do not copy the elements to any other array. Use the SIZEOF, TYPE, and LENGTHOF operators to make the program as flexible as possible if the array size and type should be changed in the future.
5. Write a program that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2).
4. Write a program that uses a loop to copy all the elements from an unsigned Word (16-bit) array into an unsigned doubleword (32-bit) array.
3. Write a program with a loop and indexed addressing that calculates the sum of all the gaps between successive array elements. The array elements are doublewords, sequenced in nondecreasing order. So, for example, the array {0, 2, 5, 9, 10} has gaps of 2, 3, 4, and 1, whose sum equals 10.
Showing 600 - 700
of 1525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Last
Step by Step Answers