hahahia

SetTextColor procedure 본문

Language/Assembly

SetTextColor procedure

hahahia 2012. 5. 4. 11:39

SetTextColor Procedure


 black = 0

red = 4 

gray = 8 

lightRed = 12 

blue = 1 

 magenta = 5

lightBlue = 9 

lightMagenta = 13 

green = 2 

brown = 6 

lightGreen = 10 

yellow = 14 

cyan = 3 

lightGray = 7 

lightCyan = 11 

white = 15 

ex) yellow + (blue * 16) ; 파란색 배경에 흰색 문자열로 출력되도록 설정한다.
위 표에서 색상에 부여된 숫자나 색상이름 둘다 사용할 수 있다.

/* SetTextColor.asm */

INCLUDE Irvine32.inc

.data

buffer BYTE "Hello World!!", 0

newline BYTE 0Dh, 0Ah, 0

count DWORD 4

.code

    main PROC

mov ecx, 4

L1 :

mov eax, count

call SetTextColor ; count를 이용해 글씨 색깔을 다르게 처리 

mov edx, OFFSET buffer

call WriteString

mov edx, OFFSET newline ; 개행 처리

call WriteString

inc count

loop L1

exit

main ENDP

END main


실행결과 : 


Comments