QUESTIONS AND PROBLEMS ON USING ASSEMBLY LANGUAGE WITH C/C++.

QUESTIONS AND PROBLEMS

1. Does the inline assembler support assembly language macro sequences?

2. Can a byte be defined in the inline assembler by using the DB directive?

3. How are labels defined in the inline assembler?

4. Which registers can be used in assembly language (either inline or linked modules) without saving?

5. What register is used to return integer data from assembly language to the C++ language caller?

6. What register is used to return floating-point data from assembler language to the C++ language caller?

7. Is it possible to use the .if statement in the inline assembler?

8. In Example 7–3, explain how the mov dl,strings[si] instruction accesses strings data.

9. In Example 7–3, why was the SI register pushed and popped?

10. Notice in Example 7–5 that no C++ libraries (#include) are used. Do you think that compiled code for this program is smaller than a program to accomplish the same task in C++ language? Why?

11. What is the main difference between the 16-bit and 32-bit versions of C/C++ when using the inline assembler?

12. Can the INT 21H instruction, used to access DOS functions, be used in a program using the 32-bit version of the C/C++ compiler? Explain your answer.

13. What is the #include <conio.h> C/C++ library used for in a program?

14. Write a short C/C++ program that uses the _getche() function to read a key and the _putch() function to display the key. The program must end if an ‘@’ is typed.

15. Would an embedded application that is not written for the PC ever use the conio.h library?

16. In Example 7–7, what is the purpose of the sequence of instructions _punch(10); followed by _punch(13);?

17. In Example 7–7, explain how a number is displayed in any number base.

18. Which is more flexible in its application, the inline assembler or assembly language modules that are linked to C++?

19. What is the purpose of a PUBLIC statement in an assembly code module?

20. How is an assembly code module prepared for use with C++ language?

21. In a C++ language program, the extern void GetIt(int); statement indicates what about func- tion GetIt?

22. How is a 16-bit word of data defined in C++?

23. What is a control in a C++ Visual program and where is it obtained?

24. What is an event in a C++ Visual program and what is an event handler?

25. In Example 7–13, what size parameter is short?

26. Can the edit screen of C++ Visual Studio be used to enter and edit an assembly language programming module.

27. How are external procedures that are written in assembly language indicated to a C++ program?

28. Show how the RDTSC instruction (opcode is 0F 31) could be added to a C++ program using the _emit macro.

29. In Example 7–17, explain what data type is used by Scan.

30. Write a short assembly language module to be used with C++ that rotates a number three places to the left. Call your procedure RotateLeft3 and assume the number is an 8-bit char (byte in assembly).

31. Repeat question 30, but write the same function in C++ without the assembler.

32. Write a short assembly language module that receives a parameter (byte-sized) and returns a byte-sized result to a caller. Your procedure must take this byte and convert it into an upper- case letter. If an uppercase letter or anything else appears, the byte should not be modified.

33. How is a CLR Visual C++ Express application executed from Visual Studio?

34. What are properties in a Visual C++ application?

35. What is an ActiveX control or object?

36. Show how a single instruction assembly language instruction, such as inc ptr, is inserted into a Visual C++ program.

Leave a comment

Your email address will not be published. Required fields are marked *