1.
Assembly programs have a
.asm extension and text format. You will need to use
a good text editor like Textpad. Wordpad and Notepad
can also be used. MS Word must be used carefully,
files must be saved as text with .asm extension.
2. As usual, to move files from an off-campus location to your w drive you will need Filezilla and a special account from computer services.
3. To run assembly:
4. Choice A: You may download and install software to run assembly language code. This is in a zip file on my w drive: http://employees.oneonta.edu/higgindm/assembly/irvinecd/irvinecd.zip
a. After download, unzip contents and run the setup program in the content directory.
b. There is an index.html file in the contents directory with a listing of various support information, including a list of examples, other articles, a link to the book’s website (this CD is from an older text edition), and more.
c. We will run some batch files included in the software to assemble and link our programs. These will be in the C:\Masm615 directory created by setup. You will need to add these to your path settings to run from any directory. Otherwise, you could create a command window in this MASM615 directory and can move .asm files to this location to assemble and link. On the blackscreen, you could assemble a file example.asm as follows:
C:\masm615>make16 example
This will generate some messages. Notice, do not type .asm after the assembly file name, the batch file will add this. After assembly, type the file name on the command line to execute. Here is screen content from assembling and running a file 16-bit.asm from chapter 3 of the text:
C:\masm615>make16 16-bit
Assembling: 16-bit.asm
Volume in drive C is WINDOWS
Volume Serial Number is
6C22-8605
Directory of C:\masm615
08/16/2002
12:51 PM 343
16-bit.asm
08/19/2011
06:27 AM 6,808
16-bit.exe
08/19/2011
06:27 AM 7,961
16-bit.lst
08/19/2011
06:27 AM 2,415
16-bit.obj
4 File(s) 17,527 bytes
0 Dir(s)
105,559,838,720 bytes free
Press any key to continue . . .
C:\masm615>16-bit
EAX=00030000 EBX=00000000 ECX=000000FF
EDX=0000059F
ESI=00000000 EDI=00000400 EBP=0000091E
ESP=00000400
EIP=0000001A EFL=00007206 CF=0
SF=0 ZF=0 OF=0
C:\masm615>
Be sure to test your installation on a correct assembly program before moving on.
d. The CD comes with some library files. We will write our own code for much of what these contain over the course of the semester. But for your initial programs, you will need to include irvine16.inc or inrvine32.inc in your own assembly programs for i/o and other services. Here is the source for the program 16-bit.asm which I ran above. It simply dumps some register contents to the screen as hex values. DumpRegs is called in the program. It is a procedure in the irvine16.inc which you can see has been included. Referenced in the code are EAX, AX, and DS; these are some of the registers in you processor.
TITLE Add and Subtract (16-bit.asm)
; This program adds and subtracts 32-bit
integers.
; Last update: 2/1/02
INCLUDE Irvine16.inc
.code
main PROC
mov ax,@data
mov ds,ax
mov eax,10000h ; EAX = 10000h
add eax,40000h ;
EAX = 50000h
sub eax,20000h ;
EAX = 30000h
call DumpRegs
exit
main ENDP
END main
5. Choice B: Kip Irvine provided the following
information about an alternative method for running assembly code using MS
Visual Studio:
Microsoft
includes the Microsoft Assembler in its freely downloadable Visual Studio
Express product. On my website, I have an extensive tutorial that explains how
to install and test the software:
http://kipirvine.com/asm/gettingStartedVS2010/index.htm
Here's
the book's main page: