3. Link Library
1) Link Library
Machine code로 assemble된 procedure를 포함하고 있는 파일
2) Link Library 목록
1> Clrscr - Clears the console and locates the cursor at the upper left corner.
2> Crlf - Writes an end of line sequence to standard output.
3> Delay - Pauses the program execution for a specified n millisecond interval.
4> DumpMem - Writes a block of memory to standard output in hexadecimal.
5> DumpRegs - Displays the EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP, EFLAGS, and EIP registers in hexadecimal. Also displays the Carry, Sign, Zero, and Overflow flags.
6> GetCommandtail - Copies the program’s command-line arguments (called the command tail) into an array of bytes. If empty, the Carry flag is set. Otherwise, reset.
7> GetMseconds - Returns the number of milliseconds that have elapsed since midnight.
8> Gotoxy - Locates cursor at row and column on the console.
9> Random32 - Generates a 32-bit pseudorandom integer in the range 0 to FFFFFFFFh.
10> Randomize - Seeds the random number generator.
11> RandomRange - Generates a pseudorandom integer within a specified range.
12> ReadChar - Reads a single character from standard input.
13> ReadHex - Reads a 32-bit hexadecimal integer from standard input, terminated by the Enter key.
14> ReadInt - Reads a 32-bit signed decimal integer from standard input, terminated by the Enter key.
15> ReadString - Reads a string from standard input, terminated by the Enter key.
16> SetTextColor - Sets the foreground and background colors of all subsequent text output to the console.
17> WaitMsg - Displays message, waits for Enter key to be pressed.
18> WriteBin - Writes an unsigned 32-bit integer to standard output in ASCII binary format.
19> WriteChar - Writes a single character to standard output.
20> WriteDec - Writes an unsigned 32-bit integer to standard output in decimal format.
21> WriteHex - Writes an unsigned 32-bit integer to standard output in hexadecimal format.
22> WriteInt - Writes a signed 32-bit integer to standard output in decimal format.
23> WriteString - Writes a null-terminated string to standard output.
3) 예시
1> 예시 1
.code
call Clrscr
mov eax,500
call Delay
call DumpRegs
- Clear the screen, delay the program for 500 milliseconds, and dump the registers and flags.
2> 예시 2
.data
str1 BYTE "Assembly language is easy!",0
.code
mov edx,OFFSET str1
call WriteString
call Crlf
- Display a null-terminated string and move the cursor to the beginning of the next screen line.
(다른 구현)
.data
str1 BYTE "Assembly language is easy!",0Dh,0Ah,0
.code
mov edx,OFFSET str1
call WriteString
3> 예시 3
.data
fileName BYTE 80 DUP(0)
.code
mov edx,OFFSET fileName
mov ecx,SIZEOF fileName – 1 ; 0 is appended
call ReadString
- Input a string from the user. EDX points to the string and ECX specifies the maximum number of characters the user is permitted to enter.
4> 예시 4
.code
mov ecx,10 ; loop counter
L1: mov eax,100 ; ceiling value
call RandomRange ; generate random int
call WriteInt ; display signed int
call Crlf ; goto next display line
loop L1 ; repeat loop
- Generate and display ten pseudorandom signed integers in the range 0 – 99. Pass each integer to WriteInt in EAX and display it on a separate line.
5> 예시 5
.data
str1 BYTE "Color output is easy!",0
.code
mov eax,yellow + (blue * 16)
call SetTextColor
mov edx,OFFSET str1
call WriteString
call Crlf
- Display a null-terminated string with yellow characters on a blue background.
- The background color is multiplied by 16 before being added to the foreground color.
'Assembly' 카테고리의 다른 글
6-2강 - Conditional Processing 2 (conditional jump, loop) (0) | 2020.06.05 |
---|---|
6-1강 - Conditional Processing 1 (bool과 비교 명령어) (AND, OR, XPR, NOT, TEST, CMP) (0) | 2020.05.21 |
5-2강 - Procedure 2 (Procedure) (0) | 2020.05.21 |
5-1강 - Procedure 1 (Stack Operation) (0) | 2020.05.21 |
4-4강 - Data Transfer, Addressing and Arithmetic 4 (Indirect Addressing, JMP & LOOP) (0) | 2020.05.19 |