Write a program that displays your name on the screen, using color characters. The color of each character should be chosen randomly (using Random_range) from the range of colors 1 - 15. You will need to use INT 10h, function 9 when displaying characters. You are permitted to use only the following procedures from IRVINE.LIB:
Crlf, Writestring, Randomize, Random_range, Gotoxy, Clrscr
Use short procedures whenever possible. Do not make any procedure (including main) longer than twenty lines. Always document procedures carefully with a description of what the procedure does and any required parameters. Here is an example, taken from my solution program:
;---------------------------------------------------- WriteCharOneColor PROC ; ; Write a single character in color ; Receives: AL = character, BL = color ; Returns: nothing ;---------------------------------------------------- pusha mov ah,9 ; function 9 mov bh,0 ; video page mov cx,1 ; repetition factor int 10h popa ret WriteCharOneColor ENDP
(The PUSHA and POPA instructions, by the way, push and pop all the general-purpose registers.)
The characters must fly toward the middle of the screen from the right side of the screen, using enough of a delay so their motion can be seen. The user can halt the program any time by pressing any key. Call a Delay procedure inside your motion loop so the character's motion can be seen. Use the following Delay procedure without making any changes. It is designed for the computer that I will use when testing your program:
;----------------------------------------------------- Delay PROC ; Cause a delay of about 1/30 second on 1.2 GHz machine. ;----------------------------------------------------- pusha mov cx,1000 L1: push cx mov cx,5000 L2: Loop L2 pop cx Loop L1 popa ret Delay ENDP
The characters fly toward the middle of the screen from the top and bottom, in alternating sequence. The user can still halt the program any time by pressing any key.