Slide 9.7: This book's link library (cont.) Slide 10.2: The runtime stack Home |
http://people.cs.und.edu/~userid/250/
.
lab4.asm
.
+
: string concatenation.
For example, "abc" + "xyz" = "abcxyz" .
/
: string removal.
It removes the first occurrence of the pattern from the string.
For example, "abcxyz" / "cx" = "abyz" and "xabyabz" / "ab" = "xyabz" .
/
has higher precedence than +
has.
For example, "abcd" + "123bc" / "bc" = "abcd123" .
No error checking is required, i.e., assume the input is always correct.
The following list shows some execution examples:
Examples of Laboratory 4 Execution | |
---|---|
|
No. | Operators/ Directives/ Commands |
Description | Textbook Page Numbers |
---|---|---|---|
1 | add |
Addition | 87 – 88 |
2 | BYTE |
Directive of defining byte | 66 – 67 |
3 | call |
Calls a procedure by directing the processor to begin execution at a new memory location. | 136 |
4 | call Crlf |
Writes an end of line sequence to standard output. | 115 |
5 | call ReadString |
Reads a string from the keyboard, stopping when the user presses the Enter key. |
122 |
6 | call StrLength |
Returns the length of a string in EAX .
Pass the string's offset in EDX . |
123 |
7 | call WriteChar |
Writes a single character to standard output. Place the character in AL before calling the procedure. |
123 |
8 | call WriteString |
Writes a null-terminated string to standard output. When calling it, place the string's offset in EDX register. |
124 |
9 | cmp |
Performs an implied subtraction of a source operand from a destination operand. | 156 |
10 | .code |
Marks the beginning of the code segment. | 55 |
11 | .data |
Marks the beginning of the data segment. | 55 |
12 | dec |
Decrement | 87 |
13 | DUP |
Generates a repeated storage allocation, using a constant expression as a counter. | 67 |
14 | DWORD |
Directive of defining doubleword | 68 |
15 | END |
Marks the last line of the program to be assembled. | 59 |
16 | ENDP |
Marks the end of a procedure. | 59 |
17 | exit |
Calls a predefined MS-Windows function that halts the program. | 59 |
18 | .IF |
IF statement |
184 – 186 |
19 | inc |
Increment | 87 |
20 | INCLUDE Irvine32.inc |
Copies necessary definitions and sets up information from a text file name Irvine32.inc , located in the assembler's INCLUDE directory. |
59 |
21 | je |
Jumps if equal | 158 – 162 |
22 | jmp |
Causes an unconditional transfer to a target location inside the code segment. | 104 |
23 | jne |
Jump if not equal | 158 – 162 |
24 | LENGTHOF |
Counts the number of elements in an array. | 97 |
25 | loop |
Loop. ECX is automatically used as a counter and is decremented each time the loop repeats. |
105 – 106 |
26 | mov |
Move | 81 – 82 |
27 | movsb |
Move string byte | 270 – 272 |
28 | OFFSET |
Returns the offset of a data label. | 94 |
29 | PROC |
Identifies the beginning of a procedure. | 59 |
30 | PROC ... USES |
Lists the names of all registers modified within a procedure. | 140 – 142 |
31 | PTR |
Overrides the declared size of an operand. | 95 – 96 |
32 | rep |
Repeat while ECX≥0 . |
270 – 272 |
33 | ret |
Pops the return address from the stack into the instruction pointer. | 135 – 136 |
34 | SIZEOF |
Size of a data item | 97 |
35 | sub |
Subtraction | 88 |
http://people.cs.und.edu/~userid/250/
or a CD is not submitted.
For security, perform the following operation:
gandalf> chmod 700 lab?.asm*
to block all read/write accesses from others to the files lab?.asm*
.
Firefox will be used to download code.
Be sure your system is working on Firefox 3.0 or above.