Toan Lam IrvineLiBrary assignment

docx

School

Collin County Community College District *

*We aren’t endorsed by this school

Course

2325

Subject

Statistics

Date

Apr 3, 2024

Type

docx

Pages

3

Uploaded by SargentLapwing320

Report
Name Toan Lam Date 03/03/2024 Course and Section: COSC-2325.902 Irvine Library Assignment Question 1: Starting on Page 184: Complete Tutorial: Library Test #1 In this hands-on tutorial, you will write a program that demonstrates integer input–output with screen colors. Take a screenshot of the output. Program code: INCLUDE C:\Irvine\Irvine32.inc .data COUNT = 4 BlueTextOnGray = blue + (lightGray * 16) DefaultColor = lightGray + (black * 16) arrayD SDWORD 12345678h,1A4B2000h,3434h,7AB9h prompt BYTE "Enter a 32-bit signed integer: ",0 .code main PROC ; Select blue text on a light gray background mov eax,BlueTextOnGray call SetTextColor call Clrscr ; clear the screen ; Display an array using DumpMem. mov esi,OFFSET arrayD ; starting OFFSET mov ebx,TYPE arrayD ; doubleword = 4 bytes mov ecx,LENGTHOF arrayD ; number of units in arrayD call DumpMem ; display memory ; Ask the user to input a sequence of signed integers call Crlf ; new line mov ecx,COUNT L1: mov edx,OFFSET prompt call WriteString call ReadInt ; input integer into EAX call Crlf ; new line ; Display the integer in decimal, hexadecimal, and binary call WriteInt ; display in signed decimal call Crlf call WriteHex ; display in hexadecimal call Crlf call WriteBin ; display in binary call Crlf call Crlf Loop L1 ; repeat the loop ; Return the console window to default colors
Name Toan Lam Date 03/03/2024 Course and Section: COSC-2325.902 call WaitMsg ; "Press any key..." mov eax,DefaultColor call SetTextColor call Clrscr exit main ENDP END main Screenshot of output screen 2. Starting on Page 188: Complete Tutorial: Library Test #2 Random Integers. This program demonstrates random-number-generation capabilities of the link library and introduces the CALL instruction. Take a screenshot of the output. Program code: INCLUDE C:\Irvine\Irvine32.inc TAB = 9 ; ASCII code for Tab .code main PROC call Randomize ; init random generator call Rand1 call Rand2 exit main ENDP
Name Toan Lam Date 03/03/2024 Course and Section: COSC-2325.902 Rand1 PROC ; Generate ten pseudo-random integers. mov ecx,10 ; loop 10 times L1: call Random32 ; generate random int call WriteDec ; write in unsigned decimal mov al,TAB ; horizontal tab call WriteChar ; write the tab loop L1 call Crlf ret Rand1 ENDP Rand2 PROC ; Generate ten pseudo-random integers from -50 to +49 mov ecx,10 ; loop 10 times L1: mov eax,100 ; values 0-99 call RandomRange ; generate random int sub eax,50 ; values -50 to +49 call WriteInt ; write signed decimal mov al,TAB ; horizontal tab call WriteChar ; write the tab loop L1 call Crlf ret Rand2 ENDP END main Program 2 screenshot of output:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help