Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Creating a \"Guess the Number\" Game in Assembly, need help with the coding. Att

ID: 3565797 • Letter: C

Question

Creating a "Guess the Number" Game in Assembly, need help with the coding.

Attention, you will need to use the following links for this to work properly.

The Psuedo Random Number Generator:

http://pastebin.com/Y66fnWEu

The Batch File that combines the program code and the PRNG Code together to create the Guessing Game output program:

ww.speedyshare.com/3hgnz/P2Combine.bat

For this project, you will write a MIPS assembly language program implementing a guess the number game. Your program should use the provided pseudorandom number generator to create random numbers between 1 and 100. The player should then be prompted to guess the computer

Explanation / Answer

;######################################################################## ; DD_Get_RGB_Format Procedure ;######################################################################## DD_Get_RGB_Format PROC surface:DWORD ;========================================================= ; This function will setup some globals to give us info ; on whether the pixel format of the current diaplay mode ;========================================================= ;==================================== ; Local variables ;==================================== LOCAL shiftcount :BYTE ;================================ ; get a surface despriction ;================================ DDINITSTRUCT ADDR ddsd, sizeof(DDSURFACEDESC2) MOV ddsd.dwSize, sizeof(DDSURFACEDESC2) MOV ddsd.dwFlags, DDSD_PIXELFORMAT DDS4INVOKE GetSurfaceDesc, surface, ADDR ddsd ;============================== ; fill in masking values ;============================== m2m mRed, ddsd.ddpfPixelFormat.dwRBitMask ; Red Mask m2m mGreen, ddsd.ddpfPixelFormat.dwGBitMask ; Green Mask m2m mBlue, ddsd.ddpfPixelFormat.dwBBitMask ; Blue Mask ;==================================== ; Determine the pos for the red mask ;==================================== MOV shiftcount, 0 .WHILE (!(ddsd.ddpfPixelFormat.dwRBitMask & 1)) SHR ddsd.ddpfPixelFormat.dwRBitMask, 1 INC shiftcount .ENDW MOV AL, shiftcount MOV pRed, AL ;======================================= ; Determine the pos for the green mask ;======================================= MOV shiftcount, 0 .WHILE (!(ddsd.ddpfPixelFormat.dwGBitMask & 1)) SHR ddsd.ddpfPixelFormat.dwGBitMask, 1 INC shiftcount .ENDW MOV AL, shiftcount MOV pGreen, AL ;======================================= ; Determine the pos for the blue mask ;======================================= MOV shiftcount, 0 .WHILE (!(ddsd.ddpfPixelFormat.dwBBitMask & 1)) SHR ddsd.ddpfPixelFormat.dwBBitMask, 1 INC shiftcount .ENDW MOV AL, shiftcount MOV pBlue, AL ;=========================================== ; Set a special var if we are in 16 bit mode ;=========================================== .IF app_bpp == 16 .IF pRed == 10 MOV Is_555, TRUE .ELSE MOV Is_555, FALSE .ENDIF .ENDIF done: ;=================== ; We completed ;=================== return TRUE DD_Get_RGB_Format ENDP ;######################################################################## ; END DD_Get_RGB_Format ;########################################################################

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote