==================================== Project #4 - Intel Assembly Language ===================================== - Ian! D. Allen - idallen@idallen.ca - www.idallen.com Available online: Monday November 30, 2009 Due date in the Blackboard Assignment Area: due at 23:59 PM on Wednesday December 9, 2009 Do *not* use the DigitalDropbox to submit your answers. Submission method: Via the "Assignments" DAT2343_Project_4 upload. Due to bugs in Blackboard, you can only submit your Assignment to me *once*. After that, you cannot submit any more times. If you need to re-submit it, you have to ask me to clear your previous submission. Do *not* use the DigitalDropbox to submit your answers. Upload Assignment file name: p4.asm The name must be exactly as given. Typing mistakes in the name mean no credit. Be precise. (Your userid is not required.) Upload only plain text, not HTML, not MSWord. No fonts. Plain text only. Plain text only. Did I mention that the format is plain text? Part I - VMware --------------- 1. Download the Project 4 zip file "project4.zip" containing the VMware Project 4 virtual machine files. You can get this zip file from the DAT2343 course web site or from Algonquin Blackboard DAT2343 "Course Documents". 2. Create a directory named Project4 on your computer (or on your College "N" drive) and extract/unzip all the virtual machine files into that directory. You must see all five of these files in the directory: dat2343win95osr2.nvram, dat2343win95osr2.vmdk, dat2343win95osr2.vmsd, dat2343win95osr2.vmx, dat2343win95osr2.vmxf 3. To run the VMware virtual machine, you need some form of VMware software on your computer. Many College computers in T building labs have VMware already installed. If you don't have VMware on your computer, you can register and download a free copy of VMware Player from http://www.vmware.com/products/player/. 4. If VMware is installed properly, you can simply double-click on the *.vmx file to open it, or start VMware and use it to open the *.vmx file in the Project4 directory. Use the default answers for any questions you are asked. 5. When VMware is open, inside VMware, Power On the virtual machine. You should see Windows 95 boot up. Use the default answers for any questions you are asked. 6. Double-click on the DAT2343 directory on the Win95 desktop. You should see a list of assembly-language files there. Close the listing window. 7. Use the MS-DOS Prompt shortcut icon on the Win95 desktop to start up an MS-DOS window in the DAT2343 directory. Confirm that your DOS prompt says "C:\WINDOWS\DESKTOP\DAT2343>" and that typing "DIR" shows the same list of assembly language files. 8. At the DOS prompt, use "MORE" to view the file "ONEPAGE.ASM". Follow the directions in that file to assemble, link, and execute this program. (If you get "bad command or file name" for the assembler or linker, ensure that directory C:\ARROW.ASM exists and that you open the MS-DOS window using the desktop shortcut icon that runs AUTOEXEC.BAT to set your DOS search path correctly.) 9. At the DOS prompt, copy ONEPAGE.ASM to TWO.ASM 10. At the DOS prompt, type: NOTEPAD TWO.ASM which will open up NOTEPAD as an editor on the file TWO.ASM 11. Using NOTEPAD (or any plain text editor you like), edit TWO.ASM and change "first" to "second" in the output string. Save the file. If NOTEPAD opens the "Save As" dialog box when you try to save a file, it may be because the file is Read-Only. Be careful with the "Save As" dialog box in NOTEPAD - if you type a name "foo.asm" here and save, you will create a new file "foo.asm.txt", which you will have to rename to "foo.asm". Avoid the "Save As" dialog box in NOTEPAD. 12. Assemble, link, and execute TWO.ASM and verify that the output is "This is my second Intel Assembler program." 13. To safely stop your Win95 Virtual Machine, you can either shut down Win95 (using the Start->Shut Down menu in Win95) or you can use VMware to "suspend" your virtual machine without shutting it down. A suspended virtual machine remembers all your open windows and can be restarted quickly. (Try it!) 14. When Windows 95 has stopped (or been suspended), and not before, close VMware. Wait until Windows 95 has safely shut down or been suspended before closing VMware. Do not close VMware before you have safely stopped or suspended Win95. Contact your instructor if the above VMware test does not work. Don't wait until the day before the project is due. Part II - Intel Assembly Language --------------------------------- See the "Project 4 Appendix" in the Week 13 Notes file. 1. Add this line to the end of C:\AUTOEXEC.BAT: BREAK ON It will allow you to break out of looping ASM programs. (You will need to turn off the Read-Only attribute for the file to be able to edit it.) 2. Copy file ADDTWO.ASM to P4.ASM and remove the teacher-style comments from the top of the file. Insert a full DAT2343 assignment label. The following project expects that you have the GETSHOW.ASM procedures file in your current directory. GETSHOW.ASM is included in your source file using an INCLUDE statement near the bottom of the P4.ASM source file. 3. Assemble, link, and execute P4.ASM and verify that you can type in two numbers (maximum four digits) and have the sum print as output. If NOTEPAD opens the "Save As" dialog box when you try to save a file, it may be because the file is Read-Only. Be careful with the "Save As" dialog box in NOTEPAD - if you type a name "foo.asm" here and save, you will create a new file "foo.asm.txt", which you will have to rename to "foo.asm". Avoid the "Save As" dialog box in NOTEPAD. 4. The existing file duplicates the code for "put out a newline". Move this newline code into a near procedure named "newline" and CALL it instead of having the code duplicated. Remember to save and restore any registers used by your procedure. (You will need to make other minor adjustments to the program to allow the use of the name "newline" as a near procedure.) 5. The existing file duplicates the code for "display the string pointed to by register DX". Move this duplicate code into a near procedure named "outstr" and CALL it instead of having the code duplicated. Remember to save and restore any registers used by your procedure. 6. Modify the P4.ASM algorithm. Remove the addition of the two numbers (and the associated variable) from the P4.ASM program and replace the addition code so that the program implements this FOR loop instead: prompt for and read num1 (this is the loop start value) prompt for and read num2 (this is the loop decrement value) for ( i=num1, count=0; i >= 0; i -= num2, ++count ) { output i output space } output CR/LF output "Program done after ", count, " iterations.", CR/LF exit NOTES: Use better variable names in your program. The names above and in the original program are not good and must be replaced with better names. Do not use any ASM reserved words as variable names! (A list of reserved words is in Notes file 28AssemblerTools.htm ) The input prompts should be changed to reflect the purposes of the numbers being input. Do not use the existing program prompt texts. Use a different prompt for each input value and make each relevant. 7. Bonus+20%: If the loop only loops once, the last output message should say "iteration" (singular) instead of "iterations". Make it so. Fully comment your solution and submit it. No comments; no marks. See the submission details at the top of this file.