INCLUDE Irvine32.inc

CHAR_VALUE = '!';

.code
main PROC
    call Clrscr
    mov eax, 0

    mov ecx, 16
L1:
    push ecx ;vary the background colors

    mov ecx, 16
L2:
    SetTextColor ;vary the foreground colors
    push eax
    mov al, CHAR_VALUE
    call WriteChar
    pop eax

    inc al ;next foreground color
    loop L2

    sub al, 16 ;reset forground color to zero
    add al, 16 ;select next backtround color
    call Crlf

    pop ecx
    loop L1

    mov eax, 7
    call SetTextColor

    exit
main ENDP
END main

문자를 모든 가능한 전경색과 배경색의 조합(16*16=256)으로 출력하는 프로그램
색상은 0부터 15까지의 번호가 부여되어서 모든 가능한 조합을 생성하기 위해서 중첩된 루프를 사용할 수 있다
Posted by 정훈승