Assembly Language for x86 Processors --- 3.5 课后习题答案

3.5 Symbolic Constants

1 Use a TEXTEQU expression to redefine “PROC” as “PROCEDURE.”

答 :PROCEDURE TEXTEQU < PROC >

2 Declare a symbolic constant using the equal-sign directive that contains the ASCII code (08h) for the Backspace key.

答 :BACKSPACE = 08h

3 Use TEXTEQU to assign the symbol SetupESI to the following line of code: mov esi,OFFSET myArray

答 :SetupESI TEXTEQU <mov esi,OFFSET myArray>

4 Declare a symbolic constant named SecondsInDay using the equal-sign directive and assign it an arithmetic expression that calculates the number of seconds in a 24-hour period.

答 :SecondsInDay = 24 * 60 * 60

5 Show how to calculate the number of elements in the following array, and assign the value to a symbolic constant named ArraySize: myArray DWORD 30 DUP(?)

答 :ArraySize = ($ - myArray)/TYPE DWORD

6 Write a statement that causes the assembler to calculate the number of bytes in the following array, and assign the value to a symbolic constant named ArraySize: myArray WORD 20 DUP(?)

答 :ArraySize = ($ - myArray)

7 Use TEXTEQU to create a symbol named Sample for a string constant, and then use the symbol when defining a string variable named MyString.

答 :
Sample TEXTEQU <“HELLO,WORLD!”>
MyString BYTE Sample

猜你喜欢

转载自blog.csdn.net/weixin_43574277/article/details/106132743