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
2. Which INT 21h function terminates a program?
1. Which register holds the function number when calling INT 21h?
13. What offset within the interrupt vector table contains the address of the INT 21h interrupt handler?
12. Which interrupt number is used for the time of day?
11. Which interrupt number is used for video services?
10. When an interrupt service routine finishes, how does an application program resume execution?
9. What four steps are taken by the CPU when an INT instruction is invoked by a program?Hint: See Fig. 14-2.
8. When the INT instruction executes, what is the first task carried out by the CPU?
7. What is an interrupt service routine?
6. What is the MS-DOS device name for the first parallel printer?
5. Show an example of redirecting a program’s output to the printer.
4. What is the name of the memory area containing low-level procedures used by the computer for input–output?
3. What is the starting location of the BIOS and MS-DOS data area?
2. What occupies the lowest 1024 bytes of memory?
1. What is the highest memory location into which you can load an application program?
5. LastIndexOf Procedure Modify the IndexOf procedure from Section 13.3.1. Name your function LastIndexOf, and let it search backward from the end of the array. Return the index of the first matching value, or if no match is found, return –1.
4. Prime Number Program Write an assembly language procedure that returns a value of 1 if the 32-bit integer passed in the EAX register is prime, and 0 if EAX is nonprime. Call this procedure from a high-level language program. Let the user input a sequence of integers, and have your program
3. Summing Three Arrays Write an assembly language subroutine that receives the offsets of three arrays, all of equal size.It adds the second and third arrays to the values in the first array. When it returns, the first array has all new values. Write a test program in C/C++ that creates an array,
2. Longest Increasing Sequence Write an assembly language subroutine that receives two input parameters: the offset of an array and the array’s size. It must return a count of the longest increasing sequence of integer values.For example, in the following array, the longest strictly increasing
1. Multiply an Array by an Integer Write an assembly language subroutine that multiplies a doubleword array by an integer. Write a test program in C/C++ that creates an array, passes it to the subroutine, and prints the resulting array values.
15. Using an Internet search, make a short list of optimization tricks used by C/C++ compilers.
14. Why is name decoration important when calling external assembly language procedures from C++?
13. What is the purpose of the “C” specifier in the extern declaration in procedures called from C++?
12. When the following C language function is called, will the argument x be pushed on the stack first or last?void MySub( x, y, z );
11. What is a valid assembly language PROTO declaration for the standard C printf( ) function?
10. What value is returned by the SIZE operator when applied to an array of long integers?
9. What value is returned by the LENGTH operator when applied to an array of 32-bit integers?
8. Rather than using the OFFSET operator, is there another way to move a variable’s offset into an index register?
7. When using the __fastcall calling convention, what might happen if your inline assembly code modifies registers?
6. (Yes/No): Can variables be defined with both the DW and the DUP operator in inline assembly code?
5. (Yes/No): Can the OFFSET operator be used in inline assembly code?
4. (Yes/No): Can both the EVEN and ALIGN directives be used in inline assembly code?
3. Does a language’s calling convention include the preserving of certain registers by procedures?
2. Why is case sensitivity important when calling assembly language procedures from C and C++ programs?
1. When a procedure written in assembly language is called by a high-level language program, must the calling program and the procedure use the same memory model?
4. How does a Microsoft Visual C++ function return a short int?
3. How do C++ functions usually return floating-point values?
2. In what way is the calling convention used by the Irvine32 library not compatible with the calling convention used by the C and C++ languages?
1. Which two C++ keywords must be included in a function definition if the function will be called from an assembly language module?
4. (Yes/No): Can an inline statement refer to code labels outside the __asm block?
3. Show at least two ways of placing comments in inline assembly code.
2. What advantage does inline assembly code offer over the use of external assembly language procedures?
1. How is inline assembly code different from an inline C++ procedure?
3. Will an assembly language procedure that uses the STDCALL language specifier link to a C++ program?
2. Which memory models are available in real-address mode?
1. What is meant by the naming convention used by a language?
7. Showing Register Status Values The Tag register (Section 12.2.1) indicates the type of contents in each FPU register, using 2 bits for each (Fig. 12-7). You can load the Tag word by calling the FSTENV instruction, which fills in the following protected-mode structure (defined in
6. Quadratic Formula Prompt the user for coefficientsa, b, and c of a polynomial in the form ax2 bx c 0. Calculate and display the real roots of the polynomial using the quadratic formula. If any root is imaginary, display an appropriate message.
5. Area of a Circle Write a program that prompts the user for the radius of a circle. Calculate and display the circle’s area. Use the ReadFloat and WriteFloat procedures from the book’s library. Use the FLDPI instruction to load onto the register stack.
4. Expression Evaluation Write a program that evaluates the following arithmetic expression:((A B) / C) * ((D A) E)Assign test values to the variables and display the resulting value.
3. Set Rounding Modes(Requires knowledge of macros.) Write a macro that sets the FPU rounding mode. The single input parameter is a two-letter code:• RE: Round to nearest even• RD: Round down toward negative infinity• RU: Round up toward positive infinity• RZ: Round toward zero
2. Display Floating-Point Binary Write a procedure that receives a single-precision floating-point binary value and displays it in the following format: sign: display or ; significand: binary floating-point, prefixed by “1.”;exponent: display in decimal, unbiased, preceded by the letter E
1. Floating-Point Comparison Implement the following C++ code in assembly language. Substitute calls to WriteString for the printf() function calls:double X;double Y;if( X < Y )printf("X is lower");else printf("X is not lower");(Use Irvine32 library routines for console output, rather than calling
13. Assemble the following instructions by hand and write the hexadecimal machine language bytes for each labeled instruction. Assume that val1 is located at offset 0. Where 16-bit values are used, the bytes must appear in little endian order:.data val1 BYTE 5 val2 WORD 256.code mov ax,@data mov
12. Provide Mod R/M bytes for the following MOV instructions:.data array WORD 5 DUP(?).code mov ax,@data mov ds,ax mov BYTE PTR array,5 ; a.mov dx,[bp+5] ; b.mov [di],bx ; c.mov [di+2],dx ; d.mov array[si+2],ax ; e.mov array[bx+di],ax ; f.
11. Provide opcodes for the following MOV instructions:.data myByte BYTE ?myWord WORD ?.code mov ax,@data mov ds,ax mov es,ax ; a.mov dl,bl ; b.mov bl,[di] ; c.mov ax,[si+2] ; d.mov al,myByte ; e.mov dx,myWord ; f.
10. Write instructions that implement the following C++ code:int B = 7;double N = 7.1;double P = sqrt(N) + B;
9. Write instructions that implement the following C++ code:double B = 7.8;double M = 3.6;double N = 7.1;double P = -M * (N + B);
8. Given a precise result of –1.010101101, round it to an 8-bit significand using the FPU’s default rounding method.
7. Given a precise result of 1.010101101, round it to an 8-bit significand using the FPU’s default rounding method.
6. Write a two-instruction sequence that moves the FPU status flags into the EFLAGS register.
13. Which field in the FPU control word lets you change the processor’s rounding mode?
12. Which instruction loads an integer operand into ST(0)?
11. In processors prior to the P6 family, which instruction compares two floating-point values?
10. How is the FISUB instruction different from FSUB?
9. What types of operands may be used with the FADD instruction?
8. Which instruction changes the sign of a floating-point number?
7. How is the FSTP instruction different from FST?
6. What is the largest data type permitted by the FLD instruction, and how many bits does it contain?
5. What are the two types of NaNs?
4. Given the binary value 0000100111101.1, what is its normalized value?
3. Given the binary value 11011.01011, what is its normalized value?
2. Why cannot decimal 0.2 be represented exactly by a finite number of bits?
1. Given the binary floating-point value 1101.01101, how can it be expressed as a sum of decimal fractions?
4. In the IEEE single-precision format, how many bits are reserved for the exponent?
3. In the IEEE double-precision format, how many bits are reserved for the fractional part of the significand?
2. Why doesn’t the single-precision real format permit an exponent of 128?
1. Why doesn’t the single-precision real format permit an exponent of 127?
5. Which floating-point instructions accept immediate operands?
4. When the second letter of a floating-point instruction is B, what type of operand is indicated?
3. Name at least three FPU special-purpose registers.
2. If ST(0) is positioned at absolute register R6 in the register stack, what is the position of ST(2)?
1. Write an instruction that loads a duplicate of ST(0) onto the FPU stack.
2. Provide Mod R/M bytes for the following MOV instructions:.data array WORD 5 DUP(?).code mov ax,@data mov ds,ax ; a.mov dl,bl ; b.mov bl,[di] ; c.mov ax,[si+2] ; d.mov ax,array[si] ; e.mov array[di],ax ; f.
1. Provide opcodes for the following MOV instructions:.data myByte BYTE ?myWord WORD ?.code mov ax,@data mov ds,ax ; a.mov ax,bx ; b.mov bl,al ; c.mov al,[si] ; d.mov myByte,al ; e.mov myWord,ax ; f.
11. Linked List Advanced: Implement a singly linked list, using the dynamic memory allocation functions presented in this chapter. Each link should be a structure named Node (see Chapter 10) containing an integer value and a pointer to the next link in the list. Using a loop, prompt the user for as
10. Reading a Large File Modify the ReadFile.asm program in Section 11.1.8 so that it can read files larger than its input buffer. Reduce the buffer size to 1024 bytes. Use a loop to continue reading and displaying the file until it can read no more data. If you plan to display the buffer with
9. Last Access Date of a File Write a procedure named LastAccessDate that fills a SYSTEMTIME structure with the date and time stamp information of a file. Pass the offset of a filename in EDX, and pass the offset of a SYSTEMTIME structure in ESI. If the function fails to find the file, set the
8. Block Animation Write a program that draws a small square on the screen using several blocks (ASCII code DBh) in color. Move the square around the screen in randomly generated directions. Use a fixed delay value of 50 milliseconds. Extra: Use a randomly generated delay value between 10 and 100
7. Scrolling Text Window Write a program that writes 50 lines of text to the console screen buffer. Number each line. Move the console window to the top of the buffer, and begin scrolling the text upward at a steady rate(two lines per second). Stop scrolling when the console window reaches the end
6. Student Records Write a program that creates a new text file. Prompt the user for a student identification number, last name, first name, and date of birth. Write this information to the file. Input several more records in the same manner and close the file.
5. DrawBox Draw a box on the screen using line-drawing characters from the character set listed on the inside back cover of the book. Hint: Use the WriteConsoleOutputCharacter function.
4. Random Screen Fill Write a program that fills each screen cell with a random character in a random color. Extra:Assign a 50% probability that the color of any character will be red.
3. Clearing the Screen Write your own version of the link library’s Clrscr procedure that clears the screen.
2. String Input/Output Write a program that inputs the following information from the user, using the Win32 Read-Console function: first name, last name, age, phone number. Redisplay the same information with labels and attractive formatting, using the Win32 WriteConsole function. Do not use any
1. ReadString Implement your own version of the ReadString procedure, using stack parameters. Pass it a pointer to a string and an integer, indicating the maximum number of characters to be entered.Return a count (in EAX) of the number of characters actually entered. The procedure must input a
32. Which structure contains the base address of a page frame?
31. Which structure contains the base address of a page table?
30. Which structures are involved in the paging process?
29. Name at least four fields in a segment descriptor.
Showing 200 - 300
of 1525
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Last
Step by Step Answers