2013-04-18 22:00:39Morris
[組合語言][練習] Color Matrix
產生 16*16 = 256 種可能的 table 表示一個隨便的可顯示字元。
TITLE
; Write a program that displays a single character in all
; possible combinations of foreground and background
; color(16*16 = 256). The colors are numbered from 0 to 15
; so you can use a nested loop to generate all possible
; combinations.
INCLUDE Irvine32.inc
.data
.code
start PROC
mov ecx, 16
mov ebx, 0
loopi:
push ecx
mov ecx, 16
loopj:
mov eax, ebx
call SetTextColor
mov al, 65
call WriteChar
inc ebx
loop loopj
call Crlf
pop ecx
loop loopi
mov eax, 15+0*16 ; black = 0, white = 15
call SetTextColor ; background*16 + foreground
invoke ExitProcess, 0
start ENDP
end start