MASM Assembly Language x86 Processor - Random_Screen_Location (Chapter 5, Pr 7)
ID: 3591234 • Letter: M
Question
MASM Assembly Language x86 Processor -
Random_Screen_Location (Chapter 5, Pr 7)
Hello Chegg experts, this is one of my programming assignments for MASM assembly language x86 Processor.
I desperately need your help on this!! Also use Irvine32 library.
Here is the assignment:
Write a program that displays a single character at 100 random screen locations, with a delay factor of some milliseconds. First, call GetMaxXY to determine the row and column range in AX and DX. Then in a loop, call RandomRange twice to get random row and column values for Gotoxy, where row and column numbers are zero-based. Next just use WriteChar and Delay. You can run ch05_07.exe to watch the screen similar to this:
Thank you in advance...
A A A A A A AA A A A A A A A A A A A A A A A A A AA A A A A A A A A A A A A A A A
Thank you in advance...
Random_Screen Location (Chapter 5, Pr 7) Write a prograrm that displays a single character a 100 randorn screen loc ations, with a delay facter of soe milliseconds. First, cal GetMaxXY lo delernine the row and colun range in AX and DX. Thern in a loup, call RandomRange twice to gel rarndorn row and column values for Gotoxy, whane rw and calumn numbers ara zara-hased Naxt just use WriteChar and Delay You can run ch0_xtowatch the screen similar to this ay You can nun ch0507 xe the stExplanation / Answer
INCLUDE Irvine32.inc
MAX_COUNT = 100
.data
str1 BYTE "Enter a character: ",0
char BYTE ?
rows BYTE ?
cols BYTE ?
randrow WORD ?
randcol WORD ?
.code
main PROC
mov edx, OFFSET str1
call writeString
call ReadChar
mov char, al
call crlf
call WriteChar
call crlf
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
call crlf
call GetMaxXY
mov rows,dh
mov cols,dl
call crlf
call crlf
movzx eax,rows
call WriteDec
call crlf
call crlf
movzx eax,cols
call WriteDec
call crlf
mov eax,0
mov ebx,0
mov ecx,0
mov edx,0
;creating random numbers
mov ecx,MAX_COUNT ;counter
L1:
movzx eax,rows
call RandomRange
;call WriteDec
call crlf
mov eax,0
movzx eax,cols
call RandomRange
;call WriteDec
call crlf
mov eax,0
mov ebx,0
mov edx,0
mov dh,rows
mov dl, cols
call Gotoxy
movzx eax,char
call WriteChar
call crlf
mov eax,0
loop L1
exit ;exiting main.
main ENDP
END main
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.