DAT2343 Creating Programs with MASM / Arrow ASM © Alan T. Pinck / Algonquin College; 2003 The Text-Edit Stage Use NotePad or any other text.

Download Report

Transcript DAT2343 Creating Programs with MASM / Arrow ASM © Alan T. Pinck / Algonquin College; 2003 The Text-Edit Stage Use NotePad or any other text.

DAT2343
Creating Programs with
MASM / Arrow ASM
© Alan T. Pinck / Algonquin College; 2003
The Text-Edit Stage
Use NotePad or any other text editor you feel comfortable with to
create your source program file. (Recommended that you do NOT use
a word processor). Save with extension .ASM
Identification comments at beginning (lines starting with semicolons)



source file name
brief description of purpose
author and date written
Body of source in 4 columns (separated by at least on space):




labels (where required by the logic)
mnemonic operations (or pseudo-ops)
operands (registers, immediate values, label references
comments (when intent is not obvious)
Creating an Object File with MASM
At a DOS prompt (in, or with a PATH set to the MASM
directory), enter

MASM
MASM will prompt for




source file : xxxx.ASM
object file : xxxx.OBJ (hit <Enter> to accept default)
listing file : NUL.LST (change to xxxx.LST if desired)
cross-reference file : NUL.CRF (hit <Enter>)
Alternately, you could enter:
MASM xxxx.ASM;
(replacing “xxxx” with your file’s primary name) to accept all defaults

Creating an Object File
with Arrow ASM
Identical to MASM except leave the ‘M’ off; that is:
 ASM

Arrow ASM will provide the same prompts as MASM
or

ASM xxxx.ASM;
Correcting Source Errors
MASM/ASM will display a list of all the errors it
discovered in your source file; the error messages will
include line number references.
For difficult to interpret errors, it may be useful to have
MASM/ASM generate the .LST file; this will also contain
the error messages at/following the location where they
were detected.
Creating an EXE with MASM
(LINK)
From the DOS prompt (with the same directory conditions
as for MASM), type:

LINK
LINK will prompt for the files it needs; you will need to
specify the name of the .OBJ created by MASM and
otherwise accept the defaults.
Alternately, type:

LINK xxxx.OBJ;
If you are creating a .COM style program, you will get a
warning message about not having a stack segment; ignore
this.
Do NOT use LINK with object files created with the
Arrow ASM
Creating an EXE with Arrow
(VAL)
Arrow’s equivalent to MASM’s LINK is called VAL; in its
simplest form (when creating a .EXE style program) type:
 VAL
instead of LINK (everything else should be the same)
Do NOT use VAL with .OBJ files created by MASM
Creating a .COM with MASM
(EXE2BIN)
(Assuming your original source was coded in a form
compatible with a .COM style program), type:
 EXE2BIN xxxx.EXE, xxxx.COM
where “xxxx” should be replaced with your primary file
name.
Creating a .COM with Arrow
(VAL)
Instead of using the basic form of VAL to create a .EXE
program, run VAL with the COM option:
VAL /COM
to cause it to output a .COM style program
Comparison of
MASM and Arrow ASM
In later versions MASM supplies some additional
features and forms useful for developing very
large Assembler based systems. These features are
not available in the Arrow Assembler.
The Arrow Assembler is free.
The Arrow Assembler was designed to be
equivalent to MASM version 3 (anything that
works in Arrow Assembler will also work in
MASM; even later versions)
Arrow Assembler Usage
Demonstration
Download and run the file Arrow.AVI using the MediaPlayer.
End of Lecture