This assembly project reads the key presses and outputs them in a specific color. When a vowel is pressed it changes the color of the text until another vowel is pressed and does so until ESC is pressed. The colors are in a certain pattern which is why I sub colorCode, 8 when it reaches the end of the cycle. I am just looking to make it more efficient. I tried making all the compare statements into one line but wasn't successful.
INCLUDE Macros.inc
INCLUDE Irvine32.inc
INCLUDELIB Irvine32.lib
.386
.STACK 4096
ExitProcess PROTO, dwExitCode:DWORD
.DATA
key BYTE ?
colorCode BYTE 5
max BYTE 13
.CODE
main PROC
FindKey:
mov EAX, 50
call Delay
call ReadKey
jz FindKey
MOV key, AL
cmp key, 75h
JE UP
CMP key, 6Fh
JE UP
CMP key, 69h
JE UP
CMP key, 65h
JE UP
CMP key, 61h
JE UP
CMP key, 55h
JE UP
CMP key, 4Fh
JE UP
CMP key, 49h
JE UP
CMP key, 45h
JE UP
CMP key, 41h
JE UP
CMP dx,VK_ESCAPE
JE OVER
COLOR:
MOVZX EAX, (black * 16) + colorCode
CALL SetTextColor
MOV AL, key
call WriteChar
jmp FindKey
UP:
CMP colorCode, 13
JE RESET
INC colorCode
jmp COLOR
RESET:
sub colorCode, 8
jmp COLOR
OVER:
CALL Crlf
INVOKE ExitProcess, 0
main ENDP
END main