==================================Outline====================================
Repeat Prefixes and More String Instructions
----------------------------------------------------------------------------
Repeat Prefixes and More String Instructions
p/239
'rep' 명령어는 ‘ecx’ 레지스터를 카운터로 사용한다.
'rep'를 풀어서 쓰면 다음과 같다.
rep movsb
jecxz endCopy ;skip loop if count is zero
copy: movsb ;move 1 character
loop copy ;decrement count and continue
endCopy:
'ecx' 값은 'rep' 명령어 operand가 수행되기 전에 0인지 확인되고 'ZF'플래그는 operand가 수행되고 나서 검사가 된다.
첫 번째 문자가 같지 않으면 'ecx'값과 ‘ZF' 값이 동시에 0이 아님으로 ’repz'명령어는 멈추게 된다.
//‘repz’/‘repe’는 같은 명령어이다.
교재 p/244 String search program
[sca.asm]
.386 |
반응형
'Busan IT > Assembly' 카테고리의 다른 글
Bit Manipulation, Shift and Rotate Instructions (0) | 2015.11.03 |
---|---|
String Instruction, Character Translation (0) | 2015.11.03 |
String Operation (0) | 2015.10.29 |
task switching (0) | 2015.10.29 |
메모리 출력 함수 'memory_display' 프로그램 실행 함수, ‘program_execute' (0) | 2015.10.24 |