==================================Outline====================================
String Instruction
- stos
- lods
Character Translation
- xlat
----------------------------------------------------------------------------
교재 p/249
stos
같은 문자를 반복하여 저장한다.
lods
‘esi’에 있는 문자열을 'eax'에 저장한다.
Character Translation
교재 p/254
xlat
'EBX' 문자열이 시작하는 주소를 가리키고 ‘AL’에서 배열의 값을 가지고 있는 상황에서 'AL'에 해당 값이 들어가게 된다.
[Figure 7.13 Translation program]
/*** 소스 ***/
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h
cr equ 0dh
Lf equ 0ah
.STACK 4096
.DATA
string BYTE 'This is a #!$& STRING', 0
strLength EQU $ - string - 1
label1 BYTE "Original string ->", 0
label2 BYTE cr, Lf, "Translated string", 0
crLf BYTE cr, Lf, 0
table BYTE 48 DUP (' '), '0123456789', 7 DUP (' ')
BYTE 'abcdefghijklmnopqrstuvwxyz', 6 DUP (' ')
BYTE 'abcdefghijklmnopqrstuvwxyz', 133 DUP (' ')
.CODE
_start: output label1
output string
output crlf
mov ecx, strLength
lea ebx, table
lea esi, string
lea edi, string
forIndex: lodsb
xlat
stosb
loop forIndex
output label2
output string
output crlf
INVOKE ExitProcess, 0
PUBLIC _start
'Busan IT > Assembly' 카테고리의 다른 글
Bit Manipulation, Shift and Rotate Instructions (0) | 2015.11.03 |
---|---|
Repeat Prefixes and More String Instructions (0) | 2015.11.02 |
String Operation (0) | 2015.10.29 |
task switching (0) | 2015.10.29 |
메모리 출력 함수 'memory_display' 프로그램 실행 함수, ‘program_execute' (0) | 2015.10.24 |