Many of you have used Visual C++ before, in writing programs for 302. So, it will be familiar to you. That is good. However, for 354, we will be using the Visual C++ tool for writing and executing assembly language programs. So, things will be a little bit different. Try hard to follow the directions given, even if you are familiar with the tools.
Keep all your programs and homeworks in your
directory (folder). This will help to ensure that classmates cannot
access your files.
If you are being organized, (within your
create one directory (folder) for each assignment. This will reduce
the number of files per directory, making it easier for you to find
what you want. It will also reduce the incidence of overwriting
old files that you want to keep.
Make backup copies of your programs-in-progress. There is nothing worse than accidentally losing your entire program after spending many hours, or even days, working on it. Each hour, or so, copy your assembly language source code (.asm extension) to a new file name.
Since we're using the Visual C++ tool in a slightly unusual way, I will give you your first SASM program. To run the program, and see that it works, do the following.
bin, you'll see several things listed. Your home directory is under U:, so bring up that one, and double click from there to get to the right directory. In the right directory, list files of type All Files, and open as type AUTO (the default). You will get a dialog box that says something to the point that this make file was not generated by the Developer's Studio, and continuing will "wrap" the makefile. You want to "wrap" this make file, so click on YES. You will get another dialog box that assigns the Win32 platform. Click on OK.
Once you have your first SASM program set, you can create and work on other SASM programs. Here is what to do.
For Pentium programs, we use exactly the same tools as we
did for SASM programs.
The makefile (
.mak extension) is
exactly the same for Pentium programs.
The source code changes in 2 ways:
include sasmacros.incin your source code. Instead, place the line
include Pmacros.incin your source code in the same position within the file as you would have for a SASM program.
The debugging interface for SASM programs was nonexistent. We have something much better for Pentium programs. The Visual C++ environment can give us instruction-level debugging, as well as details about the state of the processor at any point within a program's execution. You can have Visual C++ display a window containing the contents of the registers when a program is executed. To display this window, look under the View menu for Debug Windows. Choose the one that says Registers. Other windows can help you see the contents of memory.
To use the single step features of the environment, you will need to use the debugging features of Visual C++. Getting to executing the code within your program is the first step, after your program has been built (without errors). From the Build menu, choose Start debug. You will then get to choose options from there. Try out the different options to see how they work.
There is quite a bit of system level code that is executed before the first instruction within your program to do things like setting up a window for input and output. So, if you look at the Disassembly window (your source code, essentially), you'll actually see the instructions executed, and their location in memory.
To make execution stop at some specific point within your
program, you will need to set a breakpoint.
The cleanest way I've found to do this is to use a macro
(it will be indistinguishable from an instruction) that
I wrote for you called
Place this call at an appropriate place within your code.
Hit the button for "Run to Cursor" and away you go.
As this call is reached, you'll get a dialog box
that pops up with the message that a breakpoint was
You will see that
the values within the registers are updated at this point.
From a breakpoint, you can single step
through your program or run to the end or run to the
Best advice when first starting out is to play around with the tool a bit. You cannot ruin your source code by playing around with the debugging support.