Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
This is a short program to practice assembly language loops and if/else statements. You will use various jump commands and the cmp instruction.The program will generate a random number in the range 0-9 using the Randomize and RandomRange functions and the user will try and guess the number generated. The numbers entered are in base 10.You should use ReadDec to read a decimal number from the keyboard (the user's guess). ReadDec stores the number read into the eax register.This program must can be run in Visual Studio 2008 Professional editionThis program MUST ONLY use Irvine library functions INCLUDELIB /Irvine/Irvine32.libConstants (using "equ")You should define a constant, LF, for ASCII code for a linefeed (0Ah).PrototypesDeclare the following prototypes in the Prototype section of your code.ExitProcess PROTO,dwExitCode:DWORD;from Win32 api not Irvine to exit to dos with exit codeReadChar PROTO;Irvine code for getting a single char from keyboard;Character is stored in the al register.;Can be used to pause program execution until key is hit.ReadDec PROTO;Irvine code to read 32 bit decimal number from console;and store it into eaxWriteString PROTO ; Irvine code to write null-terminated string to output; EDX points to stringRandomRange PROTO ; Returns an unsigned pseudo-random 32-bit integer; in EAX, between 0 and n-1. If n = 10 a random number; in the range 0-9 is generated;; Input parameter: EAX = n.Randomize PROTO ; Re-seeds the random number generator with the current time; in seconds.Variables (.data)You should declare zero terminated strings for the prompts.You should embed in the string enough CR,LF as necessary to generate the correct output.See output example below for how the output should be formatted. You should use WriteString to print out the messages and the output.The messages should be as follows (substitute your name for my name):"Program 3 by Fred Kennedy""Guess a number in the range 0 - 9.""Guess: ""High!""Low!""Correct!!""Do another?('y' or 'Y' to continue. Any other character to exit)"You may declare any other variables you think you need but use variables sparingly since moving data to and from memory is not as efficient as using registers which are on the CPU.mPrtStr Macro(See Irvine 10.2)(see macro_mPrtStr.asm on the class web site)To print a string you should use the mPrtStr macro defined at the top of ifElse.asmInstead of the following code to print a string named message:pushedx ;save edxmovedx, offset message ;address of str to display should be in dxcallWriteString;display 0 terminated stringpopedx;restore edxyou can use a macro:mPrtStr messageWherever mPrtStr appears in the code it will be replaced with the macro definitionmPrtStr MACRO arg1 ;arg1 is replaced by the name of string to be displayedpushedx ;save edxmovedx, offset arg1 ;address of str to display should be in dxcallWriteString ;display 0 terminated stringpopedx ;restore edxENDMDo not copy the above macro from this PDF file. It may not operate properly if you do. If you wish to copy the mPrtStr macro copy it from the top of ifElse.asm on the class web site or copy it from macro_mPrtStr.asmDuring assembling wherever "mPrtStr message" appears in the code it will be replaced with:pushedxmovedx, offset messagecallWriteStringpopedxarg1 is replaced with message if that is the name of the string passed in.Before you can use a macro you must first define it in your code.You can place the macro definition section of your code just above the prototype section.Please do not use any other macros in your code unless directed otherwise or unless you ask first.Program specification:The list of steps below just gives the basic flow of the program. You should read the details of this entire document to get all the requirements for writing the program.You are to write a program with an outer and inner loop. The outer loop is the equivalent of a doWhile loop.1. display opening message2. seed the random number generator by calling Randomize3. enter outer loop (loop1:)4. display "guess a number" message"5. get the random number (RandomRange)6. enter inner loop (loop2:)7. display "guess" message8. get guess from user (ReadDec)9. You should code a series of if/else statements that compares the user's guess to the random number generated and takes appropriate action depending on whether the guess was high (print "High!" and repeat loop2), low (print "Low!" and repeat loop2) or correct(print "Correct!!" and ask the user to input 'y' to continue (ReadChar)).You should arrange the series of if/else for step 9 in the most efficient order that requires the least amount of jumps.You should also determine the best timing for exiting loop 2 and in which loop (loop1 or loop2) the "High!", "Low!" and "Correct!!" messages should be printed.The series of if/else should take the following form:if(condition);codeelse if (condition);codeelse (no condition needed since only option left);code10.If the user enters 'Y' or 'y', repeat loop1 (step 3) else quit (exit to dos with ExitProcess).Warning: "Invoke ExitProcess" should remain at the bottom of the main proc even if it seems inefficient.Since loop2 is contained in loop1, if loop1 is repeated loop2 will be repeated.Use the appropriate jump instruction: JB, JA, JE, JBE, JAE, JNE or JMP. You should use the cmp instruction to compare 2 numbers.Do not use any directives like .IF, .WHILE etc. You should code a loop and if/else statements using cmp, labels and jumps.Remember that efficiency counts. Points will be taken off for inefficient code, convoluted code or code that has no effect. You should use the least amount of jumps you need to get the job done.Organization of codeIn general code should flow from top to bottom.You should only jump back towards the top to repeat a loop. Loops should flow from top to bottom. If you have nested loops, the code for the outer loop should flow from top of outer loop to bottom of outer loop and the code for the inner loop should flow from top of inner loop to bottom of inner loop.Outer Loop top:-outer loop codeinnerLoopTop-inner loop code-bottom of inner loop: code to jump back to innerLoopTop to repeat inner loop-you may also have code to cut the loop short to repeat the loop like the C++ continue-bottom of outer loop: code in outer loop that comes after inner loop including code to jump back to outerLoopTop to repeat outer loop. If your code does not flow from top to bottom as described above, points will be taken off.
program to find negative and positive integers from given signed numbers with output and explanation of every instructions.
Fourth Generation Microprocessor : The single chip 32-bit microprocessor was introduced in 1981 by Intel as iAPX 432. The other 4th generation microprocessors were; Hewlett
Assume that the registers are initialized to EAX=12345h,EBX =9528h ECX=1275h,EDX=3001h sub AH,AH sub DH,DH mov DL,AL mov CL,3 shl DX,CL shl AX,1 add DX,AX
Using the windows32 framework, write a complete 80x86 program for Programming Exercises 4.3 number 3, on pages 130-131 of the textbook. Follow all coding conventions mentioned in
Project Overview In this series of projects you will write a compiler for a small subset of Pascal. In this assignment, you will start writing the syntax analysis and code gen
HELLO I AM TRYING TO ADD AND SUBTRACT BUT I SEEM CAN''T FIND THE CORRECT REGISTER TO PUT IN
DEC : A powerful new Alpha 64 bit RISC computer chip was introduced in the year 1977, as new VAX (Virtual Address Extension) Computer. The VAX was 32 bit computer line based on
Internal Hardware-Interrupts Internal hardware-interrupts are the outcome of sure situations that occur during the execution of a program, for example. Divide by 0. The interru
Write an assembly language program to perform a rot13 1 conversion on characters in a text file. The program should read charatcers from the input file, perform the rot13 convers
Ask(2) Write a program to mask bits D3D2D1D0 and to set bits D5D4 and to invert bits D7D6 of the AX register question #Minimum 100 words accepted#
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd