• Nenhum resultado encontrado

Checking and Changing the Assemble and Link Commands

No documento Assembly Language: Step-by-Step (páginas 125-128)

The whole point of JED is to help you do your work in assembly language, and the

central task in assembly-language work is processing a correct file through an assembler.

JED can execute your assembler program and assemble your current file with only one keystroke on your part. That keystroke is function key F9, as you'll see from the prompt bar at the bottom of the screen. Before you press F9 on our tour, however, we'd better make sure JED has your assembler and linker commands straight.

As programs go, JED is pretty clever, but it doesn't read minds. It can make use of any assembler that operates from the DOS command line, but you have to tell JED how to invoke the assembler you've chosen. MASM and TASM are invoked in different ways, and JED must know which assembler you're using to invoke the assembler program from disk and make use of it.

Pressing function key F4 displays a whole new screen that allows you to specify your assembler. See Figure 4.3. The screen contains two command lines, one that invokes your assembler, and another that invokes your linker. I've set JED up to assume the use of Borland's Turbo Assembler TASM, which is faster and in many ways more

sophisticated than Microsoft's MASM. If you are using TASM, you needn't change JED's built-in default command lines. Figure 4.3 shows the default command lines for TASM.

file:///D|/Agent%20Folders/Chapter%204%20Learning%20and%20Using%20Jed.htm (10 of 33) [9/25/2002 6:57:23 PM]

To use MASM or some other assembler, however, you'll need to change both command lines. This will require some knowledge of how your assembler and linker operate. I'll provide you with some basic information about MASM and TASM; for other assemblers (or for using specialized features of MASM and TASM) you're on your own.

The line beneath the prompt "Assemble command" is the line JED will use to invoke your assembler. The default is

TASM ~

which will invoke Borland's Turbo Assembler with all default conditions in force. The tilde character ~ is used to indicate where in the line JED is to substitute the name of the current file. In other words, when JED goes out to DOS to execute TASM on the file

EAT2.ASM, it will substitute EAT2.ASM for the tilde, using the following line for invoking TASM:

TASM EAT2.ASM

If you're using MASM instead, you must change the Assemble command. Invoking MASM with all defaults in force (using the tilde to indicate the position of the filename) requires this command line:

MASM ~;

Again, in our example JED would automatically expand the line to read:

MASM EAT2.ASM;

The semicolon is very important, and prevents MASM from going into interac-tive mode. If you omit the semicolon, MASM will stop and begin asking questions from the keyboard. JED is not equipped to answer these questions, and while you yourself could answer MASM's questions from the keyboard, there's no point to it if all we want to do is use MASM's defaults. If you're using MASM, make sure you enter that semicolon!

Modifying a command line isn't difficult. You can backspace over the existing command line and replace it with a new one, or zap the whole line at once by pressing Ctrl+X, and then typing in your new command line.

When the changes are the way you want them, press Enter to retain the changes and record them in JED.CFG. If somehow you change your mind after zapping or otherwise altering the existing command line, you can abandon your changes and leave the original command line untouched by simply pressing Esc.

You'll notice that while you're editing a command line, a line of periods runs from the end of the command line to the right margin. These periods indicate how large the

command line can be. You can type as far as the periods allow. If you try to type further,

file:///D|/Agent%20Folders/Chapter%204%20Learning%20and%20Using%20Jed.htm

JED will quite literally say "uh-uh." Try it and see!

Changing the link command line is done the same way. TASM's link command line is this:

TLINK ~

MASM's link command line, on the other hand, requires a semicolon, and for the same reasons mentioned before:

LINK ~;

These are the absolute simplest command lines possible, and will suffice for simple learning programs like EAT2.ASM. For more advanced work you may need to use assembler or linker options, which are additional commands that provide special information to the assembler or linker about the job at hand.

Figure 4.3. Changing JED's assembler and link commands

\\JED\\ Assenble/link command edit screen

Assemble connand:

************************************************

Link connand:

TLINK ~

Line editing commands:

CR: Accepts changes and continues ESC: Abandons changes and continues

Ctrl-X: Clears entire field to empty string BS: Destructive backspace

For example, under MASM you can specify that the assembler write the program's segments to disk in alphabetical order (don't mind for now if you don't know what that means) by using the /A option. This requires that you enter the /A option as part of the assemble command line:

MASM /A ~;

file:///D|/Agent%20Folders/Chapter%204%20Learning%20and%20Using%20Jed.htm (12 of 33) [9/25/2002 6:57:23 PM]

Both TASM and MASM have numerous options of this type. You won't need any of them while working your way through this book. Later on, when you graduate to larger, more sophisticated assembly-language work, you will need to understand and use these options. If you continue to use JED at that stage, you'll have to add the desired options to the assemble and link command lines.

No documento Assembly Language: Step-by-Step (páginas 125-128)