as12 assembler guide

52
The as12 assembler The as12 assembler Introduction Invoking the as12 assembler commandline options Files as12 constructs Version 1.2: 8 July 1996 by Karl Lunt, http://www.seanet.com/~karllunt Version 1.2a: 7 April 1999 by Tom Almy, http://www.aracnet.com/~tomalmy Version 1.2b: 18 January 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/ Version 1.2c: 29 January 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/ Version 1.2d: 29 March 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/ Version 1.2e June 19, 2005 by Matthew Kincaid, Eric Engler, Tom Almy http://www.ericengler.com/ AsmIDE.aspx The current version of as12 is available here: http://www.ericengler.com/AsmIDE.aspx as12 constructs commandline Options Directives Pound Sign (#) Operators Comments Expressions Mnemonics Invoking the as12 assembler file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (1 of 30)2/18/2007 4:00:11 AM

Upload: lsd4all

Post on 16-Oct-2014

113 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AS12 Assembler Guide

The as12 assembler

The as12 assembler

● Introduction ● Invoking the as12 assembler ● commandline options ● Files ● as12 constructs

Version 1.2: 8 July 1996 by Karl Lunt, http://www.seanet.com/~karllunt

Version 1.2a: 7 April 1999 by Tom Almy, http://www.aracnet.com/~tomalmy

Version 1.2b: 18 January 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/

Version 1.2c: 29 January 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/

Version 1.2d: 29 March 2003 by Eric Engler, http://www.geocities.com/SiliconValley/Network/2114/

Version 1.2e June 19, 2005 by Matthew Kincaid, Eric Engler, Tom Almy http://www.ericengler.com/AsmIDE.aspx

The current version of as12 is available here: http://www.ericengler.com/AsmIDE.aspx

as12 constructs

● commandline Options ● Directives ● Pound Sign (#) Operators ● Comments ● Expressions ● Mnemonics

Invoking the as12 assembler

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (1 of 30)2/18/2007 4:00:11 AM

Page 2: AS12 Assembler Guide

The as12 assembler

To start the as12 assembler, enter the following command at the prompt:

as12 foo.asm

Where as12 is the name of the assembler you want to use, and foo.asm is the path, name, and extension of the file you want to assemble. The as12 assembler will assemble the file, sending the listing output to the console and writing the S19 object output to a file named file.ext.

To save the listing output in a text file for later review, use the -L option. For example:

as12 foo.asm -Lfoo.lst

will assemble the file foo.asm and write the output listing to a file named foo.lst. Entering as12 with no arguments will display a short help file describing the available commandline options.

Commandline Options

Commandline options allow you to specify input file names, define global symbols, and declare paths for library files. For example:

as12 foo.asm -dTIMERS -l\mylib\hc12 -Lfoo.lst

will assemble the file foo.asm, using the library files found in the directory \mylib\hc12. Additionally, the label TIMERS will be defined with a value of 1 and the listing output will be written to file foo.lst.

When specifying the assembler source file, the extension ".asm" is assumed if no extension is explicitly given.

The full set of commandline options includes:

-o<filename> Define object file (default extension is .s19)

-d<symbol> Define the symbol 'name' with a value of 1

-l<dir> Define a library directory with path 'lib'

-L<filename> Define listing file (default extension is .lst)

-D Turn on debugging printout

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (2 of 30)2/18/2007 4:00:11 AM

Page 3: AS12 Assembler Guide

The as12 assembler

-s<filename> Create a symbol table file (use dflt: filename.sym)

-p<part #> Define MCU part number, such as 68hc12a4 (see #ifp)

--list Display list file to console

--cycles Display the cycle count

--line-numbers Display line numbers in list file

--no-warns Suppress warnings being displayed to console and list file

-d Define a label

The -d option allows you to define a label on the commandline. Labels defined in this manner are treated by the as12 assembler as if they had been defined within your source file and assigned a value of 1. Your source file can then refer to these labels in #ifdef tests. For example:

as12 foo.asm -dMY_ALGORITHM

causes the as12 assembler to behave as if your source file began with the line:

#define MY_ALGORITHM

This ability to define labels from the commandline adds great power to the as12 assembler. You can use this feature to selectively assemble blocks of source code based on arguments you specify in the commandline, without first having to edit the source code before each assembly.

-l Define a library path

Normally, as12 first checks in the current directory for needed include files. If as12 cannot find a needed file in the current directory, it will try the library path specified with the -l option on the commandline, if any.

For example:

as12 foo.asm -lc:\mypath

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (3 of 30)2/18/2007 4:00:11 AM

Page 4: AS12 Assembler Guide

The as12 assembler

-p Define the target processor

as12 allows you to pass in a specific processor or board to identify the part you are compiling the program for. When combined with the #ifpart conditional assembly directive, can give users a powerful way to compile source code which may depend upon what part is being targeted.

For example:

as12 foo.asm -pDragon12

-D Debug the as12 assembler

Turns on the internal debug features of as12. Mostly for the developer of as12, but might be helpful if you are having a problem understanding what as12 is doing.

For example:

as12 foo.asm -D

-L Listing file

Specifies a listing file. If no filename extension is given, ".lst" is assumed. If no file name is given, then the file name will be that of the first source file, with an extension ".lst".

For example:

as12 foo.asm -L

Pound Sign (#) Operators

● #include ● #define ● #ifeq

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (4 of 30)2/18/2007 4:00:11 AM

Page 5: AS12 Assembler Guide

The as12 assembler

● #ifndef ● #ifdef ● #ifpart ● #else ● #endif ● Typical Conditional Assembly Examples

#include

The include directive allows other assembly source files to be inserted in the code immediately after the include statement, as if the contents of the included file were actually in the file that contained the include statement. Stated differently, the include statement works as you might expect. The syntax of the include statement is shown below...

#include \my_dir\myfile.asm

In linux, it is important to note that the filename expansion will only be as good as the filename expansion as the shell that you are operating in. For example, if you are running shell (/bin/sh) then the tilde username (~user) lookup may not work correctly. It is best to put in relative or absolute filepath specifications that are not shell dependent.

Include statements may be used within #ifdef statements.

We support quoted filenames within #include. This lets us use filenames that might have embedded spaces, or the directory name may have embedded spaces:

#include "c:\program files\as12\my defs.h"

#define

The define statement allows labels to be defined. This statement is simply an alternate form for an equ assembler directive. The alternate form is provided so that users will be alerted to the opportunities to write more sophisticated code that the #ifeq, and related statements allow. The proper use of the define statement is:

#define MY_LABEL expression

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (5 of 30)2/18/2007 4:00:11 AM

Page 6: AS12 Assembler Guide

The as12 assembler

The define statement is as if the user had typed the following:

MY_LABEL: EQU expression

Both forms are equally valid, and both forms are implemented internally thee same way. The EQU is probably more portable of the two constructs.

#ifeq

The ifeq command allows for the user to conditionally compile different sections of assembly language based on whether or not a label is equal to a value. Example:

#ifeq MY_SYMBOL expression_to_compare_to ... (this code will be assembled if MY_SYMBOL has the same value as expression_to_compare_to) ...#endif

I show the #endif statement because for every form of #if there needs to be a marker so that as12 knows what code is to be conditionally compiled. Restated, for every if there needs to be an endif.

If the expression resolves to the same value as the label in an #ifeq directive, then every line between the #ifeq and the #endif is executed. If the expression resolves to a different value than the label, all of the lines between the #ifeq and the #endif are ignored.

#ifndef

The ifndef command allows for the user to conditionally compile different sections of assembly language based on whether or not a label is defined. Example:

#ifndef MY_LABEL ... (this code will be assembled if MY_LABEL has not been defined) ...#endif

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (6 of 30)2/18/2007 4:00:11 AM

Page 7: AS12 Assembler Guide

The as12 assembler

I show the #endif statement because for every form of #if there needs to be a marker so that as12 knows what code is to be conditionally compiled. Restated, for every if there needs to be an endif.

#ifdef

The ifdef command allows for the user to conditionally compile different sections of assembly language based on whether or not a label is defined (via a #define or an EQU. Example...

#ifdef MY_LABEL ... (this code will be assembled if MY_LABEL has been defined) ...#endif

I show the #endif statement because for every form of #if there needs to be a marker so that as12 knows what code is to be conditionally compiled. Restated, for every if there needs to be an endif.

If the label in an #ifdef directive is defined, then every line between the #ifeq and the #endif is executed. If the label is not defined, all of the lines between the #ifdef and the #endif are ignored.

#ifpart

This is the only directive that allows for a string comparison. A special internal variable is the only variable which is a string variable. The only way to set that variable is with the -p commandline option. The sole purpose of this directive is to allow for conditional assembly based upon the value of the string. This seemed natural for handling the different part types. Example..

#ifpart b32 ... (this code will be assembled if the string <b32> is same as string in -p commandline option

...#endif

I show the #endif statement because for every form of #if there needs to be a marker so that as12 knows what code is to be conditionally compiled. Restated, for every if there needs to be an endif.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (7 of 30)2/18/2007 4:00:11 AM

Page 8: AS12 Assembler Guide

The as12 assembler

If the string that follows the #ifpart directive matches the string that was passed in via the -p option, then the lines betwee n the #ifpart and the #endif will be executed. If the strings do not match, the lines between the #ifpart and the #endif will be ignored.

#else

This directive must be coupled with any of the if directives. This allows either or compilation and performs just like you expect an else to perform. Example..

#ifdef MY_LABEL ... (this code will be assembled if MY_LABEL is defined) ...#else ... (this code will be assembled if MY_LABEL is NOT defined) ...#endif

I show the #endif statement because for every form of #if there needs to be a marker so that as12 knows what code is to be conditionally compiled. Restated, for every #if there needs to be an #endif.

If the #if statement that goes with the #else statement is true, the statements between the #if and the #else will be assembled, and the statements between the #else and the #endif will be ignored. If the #if statement is false, the statements between the #if and the #else will be ignored and the statements between the #else and the #endif will be executed

There can only be one #else for each #if statement. But #else is optional, so you do not have to use it.

#endif

The #endif statement tells the assembler when the conditional assembly section of the code is finished. Otherwise the assembler would have no way of knowing when to quit.

For every #if statement there needs to be one #endif. If there is an #if and an #else, then there should be one #endif statement also.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (8 of 30)2/18/2007 4:00:11 AM

Page 9: AS12 Assembler Guide

The as12 assembler

Examples:

#ifpart part_name ...#else ...#endif

#ifndef MY_LABEL> ...#endif

#ifndef MY_LABEL ...#else ...#endif

Typical Conditional Assembly Examples

● Use to handle parts starting in different modes. You can automate this and keep from modifying your source code my defining the label by invoking the assembler using the -d commandline option.

#ifdef EXPANDED_MODE org START_OF_EXTERNAL_RAM_TESTS#else org START_OF_FLASH_RAM#endif

● Use to handle configuring software so that your code will operate regardless of what part might be used. You can keep from changing your source code by passing in the parttype using the -p commandline option.

#ifpart b32RAM_START: EQU $800FEE_START: EQU $8000REG_START: EQU $0000PWM_START: EQU $c7

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (9 of 30)2/18/2007 4:00:11 AM

Page 10: AS12 Assembler Guide

The as12 assembler

#endif

#ifpart a4RAM_START: EQU $600REG_START: EQU $0100#endif

Notice how easy you could build a library of different parts and make your source code compile accordingly.

Files

● Assembler executables, as12 ● Motorola machine code, *.s19 ● Source files, *.asm ● Listing files, *.lst

Assembler executable, as12

Filename: as12.exe.

NOTE: On linux the .exe extension is not typically used.

These are the cross assemblers that allow you to convert your Motorola source code to Motorola machine code on your PC.

Motorola machine code, *.s19

A file with the same name as the first source file but with the extension ".s19" is used to hold the binary machine code instructions. This is produced by the assembler: the assembler translates text commands into binary commands. The binary data is stored in the s-record format, which is contained in the .s19 file.

This is the file that is sent to the embedded board, where your program will be executed.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (10 of 30)2/18/2007 4:00:11 AM

Page 11: AS12 Assembler Guide

The as12 assembler

For additional information regarding s-records visit Seattle Encoder's s-record article

Listing files, *.lst

The listing file is useful for debugging. Simply add the commandline option "-L" to create the listing file.

Source files, *.asm

Standard ASCII source files. These should be created with the extension ".asm" since that is the default used by the assembler, but is not required.

Features

Expressions

Expressions may consist of symbols, constants or the character '*' (denoting the current value of the program counter) joined together by one of the operators: +-*/%&|^. You may nest expressions using parentheses up to 10 levels deep. The operators are the same as in C:

+ add- subtract* multiply/ divide% remainder after division& bitwise and| bitwise or^ bitwise exclusive-or

In addition, the unary minus (-) and complement (~) operators are allowed when preceding a symbol, constant, or character '*' only.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (11 of 30)2/18/2007 4:00:11 AM

Page 12: AS12 Assembler Guide

The as12 assembler

Examples of valid expressions...

(5*8) (my_val-10+20*(16-label)/10) 10 $10 * %10010 my_value ~$20

Starting with version 1.2e you can NOT have spaces in an expression:

ldaa foo + 1

will produce erronous assembly. The correct way to write this expression is:

ldaa foo+1

Note: When the asterisk (*) is used in a context where the as12 is expecting a label, the asterisk (*) represents the value of the current program counter.

Symbols

Symbols consist of one or more characters where the first character is alphabetic and any remaining characters are alphanumeric. Symbols ARE case sensitive.

Constants

' followed by ASCII character! followed by a decimal constant (decimal is assumed, so ! is optional)$ followed by hexadecimal constant@ followed by octal constant% followed by binary constantdigit decimal constant

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (12 of 30)2/18/2007 4:00:11 AM

Page 13: AS12 Assembler Guide

The as12 assembler

Examples:

'A46$2E@07%10001001

Labels

A symbol starting in the first column is a label and may optionally be ended with a ':'. A label may appear on a line by itself and is then interpreted as:

Label EQU *

Note that labels are NOT case sensitive. You can use labels named LABEL interchangebly with LaBeL.

Comments

Here are some notes about comments...

● Any line beginning with an * in column 1 is a comment line ● Any text beginning with a ; is a comment - does not have to begin in column 1

AS12 Directives (or pseudo-opcodes)

● bsz ● db ● dc.b ● dc.w ● ds ● ds.b ● ds.w

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (13 of 30)2/18/2007 4:00:11 AM

Page 14: AS12 Assembler Guide

The as12 assembler

● dw ● equ ● fcb ● fcc ● fdb ● fill ● loc ● opt ● org ● redef ● rmb ● rmw ● zmb

bsz Pseudo Opcode - Block Set Zeros

Sets a block of memory to zero values. Same as zmb.

db Pseudo Opcode - Define Byte

Syntax and examples:

db Byte_Definition[,Byte_Definition] db $55,$66,%11000011 db 10half db 0.5*100

db Defines the value of a byte or bytes that will be placed at a given address.

The db directive assigns the value of the expression to the current program counter. Then the program counter is incremented.

Multiple bytes can be defined at a time by comma separating the arguments. Each comma separated argument can be a separate expression that the as 12 will evaluate.

Notes:

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (14 of 30)2/18/2007 4:00:11 AM

Page 15: AS12 Assembler Guide

The as12 assembler

● This is probably a more universally accepted pseudo-op than the fcb. However, the selection of a pseudo op does have implications on portability. I provide as many as I can to enhance OUR ability to read other peoples code.

● This should be used for memory that is not considered volatile (ROM/EE/FLASH) or memory that will be boot-loaded or similar. For defining RAM memory for variables and scratchpad memory the ds directive is more appropriate.

Related To:

● fcb ● fdb ● dw ● ds

Useful With:

● Defining Data Tables/Structures ● Defining ASCII phrases (strings) ● Defining Constants

Things to look out for:

● Be careful not to define values that are larger than 8 bits. as12 truncates the left most bits to make the byte fit into a byte.

● A label is usually used so there is a reference to this memory. In the last example in the Syntax section, it can be seen that the label half will refer to the byte with a decimal value of 50. (Not really fixed point math but I'm only demonstrating the use of a label)

dc.b Pseudo Opcode - Define Constant Byte - declare a byte of memory

Identical to db

dc.w Pseudo Opcode - Define Constant Word - declare a word of memory

Identical to dw.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (15 of 30)2/18/2007 4:00:11 AM

Page 16: AS12 Assembler Guide

The as12 assembler

ds Pseudo Opcode - Define Storage

Syntax and examples:

ds Number_of_Bytes_To_Advance_Program_Counter

The ds increments the program counter by the value indicated in the Number of Bytes argument.

Notes:

● This is the preferred method of defining a memory location whose value... ❍ is changing ❍ is generally not known

● In other words, this is optimal for defining RAM or REGISTER spaces. The reason for this is the ease in which a ds based region can be relocated.

Related To:

● rmb

Useful With:

● RAM definitions ● REGISTER definitions

Things to look out for:

● Inappropriate for non-volatile memory definitions

ds.b Pseudo Opcode - Define Storage Bytes - declare bytes of storage

Identical to ds.

ds.w Pseudo Opcode - Define Storage Word

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (16 of 30)2/18/2007 4:00:11 AM

Page 17: AS12 Assembler Guide

The as12 assembler

Syntax and examples:

ds.w Number_of_Words_To_Advance_Program_Counter

The ds.w increments the program counter by the value indicated in the argument multiplied by two. In other words, if the ds.w expression evaluates to 4 then the program counter is advanced by 8.

Notes:

● Good for defining RAM and REGISTERS

Related To:

● ds

Useful With:

● labels

Things to look out for:

● Inappropriate for non-volatile memory.

dw Pseudo Opcode - Define Word

Syntax and examples:

dw Word_Definition[,Word_Definition] dw $55aa,$66,%11000011 dw 10half dw 0.5*65536

Defines the value of a word or words that will be placed at a given address.

The dw directive assigns the value of the expression to the current program counter. Then the program counter is incremented by 2.

Multiple words can be defined at a time by comma separating the arguments. Each comma separated argument can be a separate expression that the as 12 will evaluate.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (17 of 30)2/18/2007 4:00:11 AM

Page 18: AS12 Assembler Guide

The as12 assembler

Notes:

● This is probably a more universally accepted pseudo-op than the fdb. However, the selection of a pseudo op does have implications on portability. I provide as many as I can to enhance OUR ability to read other peoples code.

● This should be used for memory that is not considered volatile (ROM/EE/FLASH) or memory that will be boot-loaded or similar. For defining RAM memory for variables and scratchpad memory the ds directive is more appropriate.

● Words are right justified and left filled with zero's.

Related To:

● fdb ● dc.w

Useful With:

● Defining Data Tables/Structures ● Defining Constants

Things to look out for:

● Be careful not to define values that are larger than 16 bits. as12 truncates the left most bits to make the word fit into a word.

equ Pseudo Opcode - Equate

Syntax and examples:

Label EQU Value_To_Assign_To_The_Label

Directly assigns a numeric value to a label.

Notes:

● assigns a meaningful name to constants

Related To:

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (18 of 30)2/18/2007 4:00:11 AM

Page 19: AS12 Assembler Guide

The as12 assembler

● #define ● -d commandline option

Useful With:

● #ifeq and related options

Things to look out for:

● Be careful of how many bits your label can take. The as12 internally uses anywhere from 32 bits for the label value with the Win32 version. It is very easy to get bigger than 8 or 16 bits.

● Inappropriate for defining memory locations. I would recommend only using for defining constants. Otherwise relocation can be made very difficult.

fcb Pseudo Opcode - Form Constant Byte - declare bytes of storage

Identical to db.

fcc Pseudo Opcode - Form Constant Characters

Syntax and examples :

fcc delim_characterstring_to_encodedelim_character fcc /my_string/ fcc *// string with slashes //* fcc 'best to use single quotes'

FCC allows the encoding of a string.

The first character is the delimiter. By allowing the flexibility of selecting delimiters, you can easily make strings which have slashes and tick marks in them. The only catch is that if you choose a delimiter, it

● must also be used to mark the end of the string ● it cannot appear in the string as a character.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (19 of 30)2/18/2007 4:00:11 AM

Page 20: AS12 Assembler Guide

The as12 assembler

In the second example, my_string will be encoded as an ASCII string. The /'s simply mark the ending and beginning of the string. This also lets you put spaces in the string.

In the third example, the * (asterisk) is the delimiter and the slashes will be encoded with their ASCII values into the ASCII string.

Notes:

● You cannot have the space as a delimiter ● you can also define strings using FCB except that you have to encode them one character at a

time and comma delimit them.

Related To:

● fcb

Useful With:

● Defining strings for displays and such.

fdb Pseudo Opcode - Form Double Byte - declare words of storage

Identical to dw.

fill Pseudo Opcode - Fill Memory

Syntax and examples:

fill byte_to_fill_memory_with,num_of_bytes_to_fill

FILL allows a user to fill memory with a byte. See my comments in zmb about the value of these Pseudo Opcodes.

Notes:

● Nice for initializing memory.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (20 of 30)2/18/2007 4:00:11 AM

Page 21: AS12 Assembler Guide

The as12 assembler

Related To:

● zmb

Useful With:

● DebuggingFilling unused non-volatile memory with a safe opcode when the processor gets lost.

Things to look out for:

● Since RAM memory, by definition, cannot be initialized, this command has little use. This is because you must DOWNLOAD the s-records to make the clearing take place. Only in systems which have some sort of bootstrapping (where s-records are downloaded) would this be very useful. If you are clearing memory, you should probably count on routines to do it for you.

loc Pseudo Opcode - creates automatically incrementing labels

WARNING: Some people do not like to see this command used in your programs

Increments and produces an internal counter used in conjunction with the backwards tick mark (`). By using LOC's and the ` mark you can write code like the following without worrying about thinking up new labels.

LOC ldaa #1loop` deca bra loop` LOCloop` brset 0,x $55 loop`

This code will work perfectly fine because the second loops label is really loop002 and the first ones is loop001. The assembler really sees this:

LOC ldaa #1

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (21 of 30)2/18/2007 4:00:11 AM

Page 22: AS12 Assembler Guide

The as12 assembler

loop001 deca bra loop001 LOCloop002 brset 0,x $55 loop002

You may also seed the LOC with a valid expression or number by putting that expression or number in the operand field. This gives you the ability to over ride the automatic numbering. This is also sometimes handy if you need to keep track of what your local variable is. (you lose track in the source if you aren't careful, because the tick ' mark is the only thing you see).

opt Pseudo Opcode - Assembler List Options

There are five permissible operands for this instruction:

● l - enable listing after opt nol ● nol - disable listing until opt l or end of source code ● c - calculate execution time (clock cycles) ● noc - stop calculating execution time ● contc - continue calculating execution time

The org Pseudo Opcode - Origin

Specify the address in memory where the following code should be located.

Syntax and examples:

org value_to_set_program_counter_to org $800 org MY_PROGRAM_START ; use a symbol defined elsewhere with EQU org LAST_MEMORY_LOCATION-(LAST_PROGRAM_BYTE-FIRST_PROGRAM_BYTE) ; calculate a value

The org Pseudo Opcode allows the assembler's program counter to be set to a value. This is useful for locating your software and its elements (tables, ram, constants, etc) in useful (intelligent) locations within the memory space of the microcontroller.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (22 of 30)2/18/2007 4:00:11 AM

Page 23: AS12 Assembler Guide

The as12 assembler

In better multi-pass assemblers (not as12), the org statement is rarely used because the code is located at the link, and not during compilation. Since as12 is a simple two-pass assembler, orgs must be used so that the code is compiled where it is supposed to.

Notes:

● When starting a new region of code, you can examine the s-record file and see how org affects the construction of that file.

● It is better to use the form org label than org constant because the more constants that are buried within your code, the more difficult it is to reuse.

● The less orgs you use, the more reusable your code is.

Related To:

● program counter because this sets its value ● rmb and its cousins because they change the program counter

Things to look out for:

● Always find out where the orgs are in a program. This is the first key to understanding the program.

redef Pseudo Opcode - Redefine

WARNING: Some people do not like to see this command used in your programs

Used to redefine first operand (which must be a label) to value of second operand (an expression)

Example:

foo equ 10 ldaa #foo ; Accumulator A gets value 10 redef foo 12 ldab #foo ; Accumulator B gets value 12

rmb Pseudo Opcode - Reserve Memory Bytes

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (23 of 30)2/18/2007 4:00:11 AM

Page 24: AS12 Assembler Guide

The as12 assembler

Equivalent to ds.b and ds.

rmw Pseudo Opcode - Reserve Memory Words

Equivalent to ds.w.

zmb Pseudo Opcode - Zero Memory Bytes

Operand specifies number of bytes to allocate and fill with zero. Similar to bss on some assemblers.

AS12 Opcode Mnemonics - Names for Machine Code Instructions

● ABA - add accumulator B to accumulator A ● ABX - add accumulator B to index reg. X ● ABY - add accumulator B to index reg. Y ● ADCA - add with carry to A ● ADCB - add with carry to B ● ADDA - add without carry to A ● ADDB - add without carry to B ● ADDD - add double accumulator ● ANDA - logical and A ● ANDB - logical and B ● ANDCC - logical and CCR with mask * ● ASL - arithmetic shift left memory ● ASLA - arithmetic shift left A ● ASLB - arithmetic shift left B ● ASLD - arithmetic shift left double acc. ● ASR - arithmetic shift right memory ● ASRA - arithmetic shift right A ● ASRB - arithmetic shift right B ● BCC - branch if carry clear ● BCLR - clear bit(s) in memory ● BCS - branch if carry set ● BEQ - branch if equal ● BGE - branch if >= zero

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (24 of 30)2/18/2007 4:00:11 AM

Page 25: AS12 Assembler Guide

The as12 assembler

● BGND - enter background debug mode * ● BGT - branch if > zero ● BHI - branch if higher ● BHS - branch if higher or same ● BITA - bit test A ● BITB - bit test B ● BLE - branch if <= zero ● BLO - branch if lower ● BLS - branch if lower or same ● BLT - branch if < zero ● BMI - branch if minus ● BNE - branch if not equal to zero ● BPL - branch if plus ● BRA - branch always ● BRCLR - branch if bit(s) clear ● BRN - branch never ● BRSET - branch if bit(s) set ● BSET - set bit(s) in memory ● BSR - branch to subroutine ● BVC - branch if overflow clear ● BVS - branch if overflow set ● CALL - call subroutine in extended memory * ● CBA - compare accumulators ● CLC - clear carry ● CLI - clear interrupt mask ● CLR - clear memory ● CLRA - clear A ● CLRB - clear B ● CLV - clear two's complement overflow bit ● CMPA - compare A ● CMPB - compare B ● COM - complement memory ● COMA - complement A ● COMB - complement B ● CPD - compare accumulator D ● CPS - compare stack pointer * ● CPX - compare index reg. X ● CPY - compare index reg. Y ● DAA - decimal adjust A ● DBEQ - decrement and branch if equal to zero * ● DBNE - decrement and branch if not equal to zero * ● DEC - decrement memory ● DECA - decrement A

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (25 of 30)2/18/2007 4:00:11 AM

Page 26: AS12 Assembler Guide

The as12 assembler

● DECB - decrement B ● DES - decrement stack pointer ● DEX - decrement index register X ● DEY - decrement index register Y ● EDIV - extended divide 32-bit by 16-bit (unsigned) * ● EDIVS - extended divide 32-bit by 16-bit (signed) * ● EMACS - extended multiply and accumulate (signed) * ● EMAXD - max of 2 unsigned 16-bit values (result in D) * ● EMAXM - max of 2 unsigned 16-bit values (result in mem) * ● EMIND - min of 2 unsigned 16-bit values (result in D) * ● EMINM - min of 2 unsigned 16-bit values (result in mem) * ● EMUL - extended multiply 16-bit by 16-bit (unsigned) * ● EMULS - extended multiply 16-bit by 16-bit (signed) * ● EORA - exclusive or A ● EORB - exclusive or B ● ETBL - extended table lookup and interpolate * ● EXG - exchange register contents * ● FDIV - fractional divide ● IBEQ - increment and branch if equal to zero * ● IBNE - increment and branch if not equal to zero * ● IDIV - integer divide ● IDIVS - integer divide (signed) * ● INC - increment memory ● INCA - increment A ● INCB - increment B ● INS - increment stack pointer ● INX - increment index register X ● INY - increment index register Y ● JMP - jump ● JSR - jump to subroutine ● LBCC - long branch if carry clear * ● LBCS - long branch if carry set * ● LBEQ - long branch if equal * ● LBGE - long branch if greater than or equal to zero * ● LBGT - long branch if greater than zero * ● LBHI - long branch if higher * ● LBHS - long branch if higher or same * ● LBLE - long branch if less than or equal to zero * ● LBLO - long branch if lower * ● LBLS - long branch if lower or same * ● LBLT - long branch if less than zero * ● LBMI - long branch if minus * ● LBNE - long branch if not equal to zero *

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (26 of 30)2/18/2007 4:00:11 AM

Page 27: AS12 Assembler Guide

The as12 assembler

● LBPL - long branch if plus * ● LBRA - long branch always * ● LBRN - long branch never * ● LBVC - long branch if overflow clear * ● LBVS - long branch if overflow set * ● LDAA - load accumulator A ● LDAB - load accumulator B ● LDD - load double accumulator ● LDS - load stack pointer ● LDX - load index register X ● LDY - load index register Y ● LEAS - load stack pointer with effective address * ● LEAX - load X with effective address * ● LEAY - load Y with effective address * ● LSL - logical shift left memory ● LSLA - logical shift left A ● LSLB - logical shift left B ● LSLD - logical shift left double ● LSR - logical shift right memory ● LSRA - logical shift right A ● LSRB - logical shift right B ● LSRD - logical shift right double accumulator ● MAXA - max of 2 unsigned 8-bit values (result in A) * ● MAXM - max of 2 unsigned 8-bit values (result in mem) * ● MEM - determine grade of membership * ● MINA - min of 2 unsigned 8-bit values (result in A) * ● MINM - min of 2 unsigned 8-bit values (result in mem) * ● MOVB - move data from one memory byte to another * ● MOVW - move data from one memory word to another * ● MUL - multiply unsigned ● NEG - negate memory ● NEGA - negate A ● NEGB - negate B ● NOP - no operation ● ORAA - inclusive or A ● ORAB - inclusive or B ● ORCC - logical or CCR with mask * ● PSHA - push A onto stack ● PSHB - push B onto stack ● PSHC - push CCR onto stack * ● PSHD - push double accumulator onto stack * ● PSHX - push index reg. X onto stack ● PSHY - push index reg. Y onto stack

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (27 of 30)2/18/2007 4:00:11 AM

Page 28: AS12 Assembler Guide

The as12 assembler

● PULA - pull A from stack ● PULB - pull B from stack ● PULC - pull CCR from stack * ● PULD - pull double accumulator from stack * ● PULX - pull index reg. X from stack ● PULY - pull index reg. Y from stack ● REV - fuzzy logic rule evaluation * ● REVW - fuzzy logic rule evaluation (weighted) * ● ROL - rotate left memory ● ROLA - rotate left A ● ROLB - rotate left B ● ROR - rotate right memory ● RORA - rotate right A ● RORB - rotate right B ● RTC - return from call * ● RTI - return from interrupt ● RTS - return from subroutine ● SBA - subtract accumulators ● SBCA - subtract with carry from A ● SBCB - subtract with carry from B ● SEC - set carry ● SEI - set interrupt mask ● SEV - set two's complement overflow bit ● SEX - sign extend into 16-bit register * ● STAA - store accumulator A ● STAB - store accumulator B ● STD - store double accumulator ● STOP - stop processing ● STS - store stack pointer ● STX - store index register X ● STY - store index register Y ● SUBA - subtract A ● SUBB - subtract B ● SUBD - subtract double accumulator ● SWI - software interrupt ● TAB - transfer from acc. A to acc. B ● TAP - transfer from acc. A to CCR ● TBA - transfer from acc. B to acc. A ● TBEQ - test and branch if equal to zero * ● TBL - table lookup and interpolate * ● TBNE - test and branch if not equal to zero * ● TFR - transfer register content to another register * ● TPA - transfer from CCR to accumulator A

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (28 of 30)2/18/2007 4:00:11 AM

Page 29: AS12 Assembler Guide

The as12 assembler

● TRAP - unimplemented opcode trap ● TST - test memory ● TSTA - test A ● TSTB - test B ● TSX - transfer from SP to index reg. X ● TSY - transfer from SP to index reg. Y ● TXS - transfer from index reg. X to SP ● TYS - transfer from index reg. Y to SP ● WAI - wait for interrupts ● WAV - weighted average * ● XGDX - exchange double acc. and index reg. X ● XGDY - exchange double acc. and index reg. Y

* means a new opcode that was not supported on the 68hc11

Non-standard Opcode Mnemonics

These mnemonics are defined in as12, but are not considered standard.

I recommend that you do not use these in your programs. This is mostly an issue for people who might want to migrate their code to a different assembler in the future - that other assembler won't understand these opcodes (although in many cases you can get around it by defining a macro for each of these):

● bkgnd - - alias for bgnd ● cbnz - - alias for dbeq ● cmpd - - alias for cpd ● cmps - - alias for cps ● cmpx - - alias for cpx ● cmpy - - alias for cpy ● lbsr - - alias for jsr ● lda - - alias for ldaa ● ldad - - alias for ldd ● ldb - - alias for ldab ● ora - - alias for oraa ● orb - - alias for orab ● pshbyte - - alias for movb ● pshword - - alias for movw ● pulbyte - - alias for movb ● pulword - - alias for movw

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (29 of 30)2/18/2007 4:00:11 AM

Page 30: AS12 Assembler Guide

The as12 assembler

● sta - - alias for staa ● stb - - alias for stab ● swpb - - alias for tap ● wavr - - alias for wav

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/as12 assembler.htm (30 of 30)2/18/2007 4:00:11 AM

Page 31: AS12 Assembler Guide

Assembly Language Syntax by Valvano

Developing Software in Assembly LanguageSyntaxBy Jonathan W. Valvano

This article, which discusses assembly language programming, accompanies the book Embedded Microcomputer Systems: Real Time Interfacing published by Brooks-Cole 1999. This document has four overall parts Overview Syntax (fields, pseudo ops) (this document) Local variables Examples

Assembly Language Syntax Programs written in assembly language consist of a sequence of source statements. Each source statement consists of a sequence of ASCII characters ending with a carriage return. Each source statement may include up to four fields: a label, an operation (instruction mnemonic or assembler directive), an operand, and a comment. The following are examples of an assembly directive and a regular machine instruction.PORTA equ $0000 ; Assembly time constantInp ldaa PORTA ; Read data from fixed address I/O data port

An assembly language statement contains the following fields. Label Field can be used to define a symbol Operation Field defines the operation code or pseudo-op Operand Field specifies either the address or the data. Comment Field allows the programmer to document the software.

Sometimes not all four fields are present in an assembly language statement. A line may contain just a comment. The first token in these lines must begin with a star (*) or a semicolon (;). For example,; This line is a comment* This is a comment too * This line is a comment

Instructions with inherent mode addressing do not have an operand field. For example,label clra comment deca comment cli comment inca comment

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (1 of 22)2/18/2007 4:05:44 AM

Page 32: AS12 Assembler Guide

Assembly Language Syntax by Valvano

Recommendation: For small programs, you enable automatic assembly colors. The editor will then color each field according to its type.

Recommendation: For large programs, you disable automatic assembly colors, because the system will run too slow. Instead, use the assembler to color the source code.

--------------------------------------------------------------------------------------Label FieldThe label field occurs as the first field of a source statement. The label field can take one of the following three forms:

A. An asterisk (*) or semicolon (;) as the first character in the label field indicates that the rest of the source statement is a comment. Comments are ignored by the Assembler, and are printed on the source listing only for the programmer's information. Examples:* This line is a comment; This line is also a comment

B. A white-space character (blank or tab) as the first character indicates that the label field is empty. The line has no label and is not a comment. These assembly lines have no labels: ldaa 0 rmb 10

C. A symbol character as the first character indicates that the line has a label. Symbol characters are the upper or lower case letters a- z, digits 0-9, and the special characters, period (.), dollar sign ($), and underscore (_). Symbols consist of one to 15 characters, the first of which must be alphabetic or the special characters period (.) or underscore (_). All characters are significant and upper and lower case letters are distinct.

A symbol may occur only once in the label field. If a symbol does occur more than once in a label field, then each reference to that symbol will be flagged with an error. The exception to this rule is the set pseudo-op that allows you to define and redefine the same symbol. We typically use set to define the stack offsets for the local variables in a subroutine. For more information see the examples of local variables. Set allows two separate subroutines to re-use the same name for their local variables.

With the exception of the equ = and set directives, a label is assigned the value of the program counter of the first byte of the instruction or data being assembled. The value assigned to the label is absolute. Labels may optionally be ended with a colon (:). If the colon is used it is not part of the label but merely acts to set the label off from the rest of the source line. Thus the following code fragments are equivalent:here: deca bne here

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (2 of 22)2/18/2007 4:05:44 AM

Page 33: AS12 Assembler Guide

Assembly Language Syntax by Valvano

here deca bne here

A label may appear on a line by itself. The assembler interprets this as set the value of the label equal to the current value of the program counter. A label may occur on a line with a pseudo-op.

The symbol table has room for at least 2000 symbols of length 8 characters or less. Additional characters up to 15 are permissible at the expense of decreasing the maximum number of symbols possible in the table.

--------------------------------------------------------------------------------------Operation Field The operation field occurs after the label field, and must be preceded by at least one white-space character. The operation field must contain a legal opcode mnemonic or an assembler directive. Upper case characters in this field are converted to lower case before being checked as a legal mnemonic. Thus 'nop', 'NOP', and 'NoP' are recognized as the same mnemonic. Entries in the operation field may be one of two types:

Opcode. These correspond directly to the machine instructions. The operation code includes any register name associated with the instruction. These register names must not be separated from the opcode with any white-space characters. Thus 'clra' means clear accumulator A, but 'clr a' means clear memory location identified by the label 'a'. The available instructions depend on the microcomputer you are using

Directive. These are special operation codes known to the Assembler that control the assembly process rather than being translated into machine instructions. The pseudo-op codes supported by this assembler are

Group A Group B Group C meaning

org org .org Specific absolute address to put subsequent object code

= equ Define a constant symbol

set Define or redefine a constant symbol

dc.b db fcb .byte Allocate byte(s) of storage with initialized values

fcc Create an ASCII string (no termination character)

dc.w dw fdb .word Allocate word(s) of storage with initialized values

dc.l dl .long Allocate 32 bit long word(s) of storage with initialized values

ds ds.b rmb .blkb Allocate bytes of storage without initialization

ds.w .blkw Allocate bytes of storage without initialization

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (3 of 22)2/18/2007 4:05:44 AM

Page 34: AS12 Assembler Guide

Assembly Language Syntax by Valvano

ds.l .blkl Allocate 32 bit words of storage without initialization

end end .end Signifies the end of the source code (TExaS ignores these)

--------------------------------------------------------------------------------------Operand Field The operand field's interpretation is dependent on the contents of the operation field. The operand field, if required, must follow the operation field, and must be preceded by at least one white-space character. The operand field may contain a symbol, an expression, or a combination of symbols and expressions separated by commas. There can be no white-spaces in the operand field. For example the following two lines produce identical object code because of the space between data and + in the first line: ldaa data + 1 ldaa data

The operand field of machine instructions is used to specify the addressing mode of the instruction, as well as the operand of the instruction. The following table summarizes the operand field formats.

Operand Format 6811/6812exampleno operand accumulator and inherent clra

<expression> direct, extended, or relative ldaa 4

#<expression> immediate ldaa #4

<expression>,R indexed with address register ldaa 4,x

<expr>,<expr> bit set or clear bset 4,#$01

<expr>,<expr>,<expr> bit test and branch brset 4,#$01,there

<expr>,R,<expr>,<expr> bit test and branch brset 4,x,#$01,there

The valid syntax of the operand field depends on the microcomputer. For a detailed explanation of the instructions and their addressing modes, see the help system with the TExaS application.

--------------------------------------------------------------------------------------Expressions. An expression is a combination of symbols, constants, algebraic operators, and parentheses. The expression is used to specify a value that is to be used as an operand. Expressions may consist of symbols, constants, or the character '*' (denoting the current value of the program counter) joined together by one of the operators: + - * / % & | ^ .

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (4 of 22)2/18/2007 4:05:44 AM

Page 35: AS12 Assembler Guide

Assembly Language Syntax by Valvano

+ add - subtract * multiply / divide % remainder after division & bitwise and | bitwise or ^ bitwise exclusive or

Expressions may include parentheses and other expressions. Expressions are evaluated using the standard arithmetic precedence. Evaluation occurs left to right for multiple operations with the same precedence. Arithmetic is carried out in signed 32-bit twos-complement integer precision (on the IBM PC).

Precedence operationHighest parentheses2 unary + - ~3 binary * / % &lowest binary + - ^ |

Each symbol is associated with a 16-bit integer value that is used in place of the symbol during the expression evaluation. The asterisk (*) used in an expression as a symbol represents the current value of the location counter (the first byte of a multi-byte instruction)

Constants represent quantities of data that do not vary in value during the execution of a program. Constants may be presented to the assembler in one of four formats: decimal, hexadecimal, binary, or ASCII. The programmer indicates the number format to the assembler with the following prefixes:

0x hexadecimal, C syntax % binary 'c' ASCII code for a single letter ‘c’

Unprefixed constants are interpreted as decimal. The assembler converts all constants to binary machine code and are displayed in the assembly listing as hexadecimal.

A decimal constant consists of a string of numeric digits. The value of a decimal constant must fall in the range 0-65535, inclusive. The following example shows both valid and invalid decimal constants:

VALID INVALID REASON INVALID

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (5 of 22)2/18/2007 4:05:44 AM

Page 36: AS12 Assembler Guide

Assembly Language Syntax by Valvano

12 123456 more than 5 digits12345 12.3 invalid character

A hexadecimal constant consists of a maximum of four characters from the set of digits (0-9) and the upper case alphabetic letters (A-F), and is preceded by a dollar sign ($). Hexadecimal constants must be in the range $0000 to $FFFF. The following example shows both valid and invalid hexadecimal constants:

VALID INVALID REASON INVALID$12 ABCD no preceding "$"$ABCD $G2A invalid character$001F $2F018 too many digits

A binary constant consists of a maximum of 16 ones or zeros preceded by a percent sign (%). The following example shows both valid and invalid binary constants:

VALID INVALID REASON INVALID%00101 1010101 missing percent%1 %10011000101010111 too many digits%10100 %210101 invalid digit

A single ASCII character can be used as a constant in expressions. ASCII constants are surrounded by a single quotes ('). Any character, except the single quote, can be used as a character constant. The following example shows both valid and invalid character constants:

VALID INVALID REASON INVALID'*' 'VALID' too long

For the invalid case above the assembler will not indicate an error. Rather it will assemble the first character and ignore the remainder.

--------------------------------------------------------------------------------------Comment Field The last field of an Assembler source statement is the comment field. This field is optional and is only printed on the source listing for documentation purposes. The comment field is separated from the operand field (or from the operation field if no operand is required) by at least one white-space character. The comment field can contain any printable ASCII characters. As software developers, our goal is to produce code that not only solves our current problem, but can

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (6 of 22)2/18/2007 4:05:44 AM

Page 37: AS12 Assembler Guide

Assembly Language Syntax by Valvano

serve as the basis of our future problems. In order to reuse software we must leave our code in a condition such that future programmer (including ourselves) can easily understand its purpose, constraints, and implementation. Documentation is not something tacked onto software after it is done, but rather a discipline built into it at each stage of the development. We carefully develop a programming style providing appropriate comments. I feel a comment that tells us why we perform certain functions is more informative than comments that tell us what the functions are. An examples of bad comments would be: clr Flag Flag=0 sei Set I=1 ldaa $1003 Read PortC

These are bad comments because they provide no information to help us in the future to understand what the program is doing. An example of good comments would be: clr Flag Signifies no key has been typed sei The following code will not be interrupted ldaa $1003 Bit7=1 iff the switch is pressed

These are good comments because they make it easier to change the program in the future. Self-documenting code is software written in a simple and obvious way, such that its purpose and function are self-apparent. To write wonderful code like this, we first must formulate the problem organizing it into clear well-defined subproblems. How we break a complex problem into small parts goes a long way making the software self-documenting. Both the concept of abstraction (introduced in the last section) and modular code (to be presented in the next section) address this important issue of software organization. Maintaining software is the process of fixing bugs, adding new features, optimizing for speed or memory size, porting to new computer hardware, and configuring the software system for new situations. It is the MOST IMPORTANT phase of software development. My personal opinion is that flowchart charts or software manuals are not good mechanisms for documenting programs because it is difficult to keep these types of documentation up to date when modifications are made. We should use careful indenting, and descriptive names for variables, functions, labels, I/O ports. Liberal use of equ provide explanation of software function without cost of execution speed or memory requirements. A disciplined approach to programming is to develop patterns of writing that you consistently follow. Software developers are unlike short story writers. It is OK to use the same subroutine outline over and over again. In the following program, notice the following style issues:

1) Begins and ends with a line of *'s 2) States the purpose of the subroutine 3) Gives the input/output parameters, what they mean and how they are passed 4) Different phases (submodules) of the code delineated by a line of -'s

******************* Max ******************************** Purpose: returns the maximum of two 16 bit numbers

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (7 of 22)2/18/2007 4:05:44 AM

Page 38: AS12 Assembler Guide

Assembly Language Syntax by Valvano

* This subroutine creates three 16 bit local variables * Inputs: Num1 and Num2 are two 16 bit unsigned numbers* passed in on the stack* Output: RegX is the maximum of X,Y* Destroyed: CCR* Calling sequence* ldx #100* pshx Num1 pushed on stack* ldx #200* pshx Num2 pushed on stack* jsr Max* puly Balance stack* puly Result in RegXFirst set 0 The first 16 bit local variableSecond set 2 The second 16 bit local variableResult set 4 The Maximum of first,secondNum1 set 12 Input parameter1Num2 set 10 Input parameter2Max pshy Save registers, that will be modified* - - - - - - - - - - - - - - - - - - - - - - - - - - - pshx Allocate Result local variable pshx Allocate Second local variable pshx Allocate First local variable* - - - - - - - - - - - - - - - - - - - - - - - - - - - tsx Create stack frame pointer ldy Num1,X sty First,X Initialize First=Num1 ldy Num2,X sty Second,X Initialize Second=Num2 ldy First,X sty Result,X Guess that Result=First cpy Second,X bhs MaxOK Skip if First>=Second ldy Second,X Since First<Second sty Result,X make Result=SecondMaxOK ldx Result,X Return Result in RegX* - - - - - - - - - - - - - - - - - - - - - - - - - - - puly Deallocate local variables puly puly* - - - - - - - - - - - - - - - - - - - - - - - - - - - puly Restore registers rts

****************** End of Max *****************************

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (8 of 22)2/18/2007 4:05:44 AM

Page 39: AS12 Assembler Guide

Assembly Language Syntax by Valvano

--------------------------------------------------------------------------------------Assembly Listing The assembler output includes an optional listing of the source program and an object files. The listing file is created when the TheList.RTF file is open. Each line of the listing contains a reference line number, the address and bytes assembled, and the original source input line. If an input line causes more than 8 bytes to be output (e.g., a long FCC directive), the additional bytes are included in the object code (S19 file or loaded into memory) but not shown in the listing. There are three assembly options, each can be toggled on/off using the Assembly->Options command.

(4) cycles shows the number of cycles to execute this instruction

[100] total gives a running cycle total since last org pseudo-op{PPP} type gives the cycle type

The codes used in the cycle type are different for each microcomputer The assembly listing may optionally contain a symbol table. The symbol table is included at the end of the assembly listing if enabled. The symbol table contains the name of each symbol, along with its defined value. Since the set pseudo-op can be used to redefine the symbol, the value in the symbol table is the last definition.

--------------------------------------------------------------------------------------Assembly Errors

Programming errors fall into two categories. Simple typing/syntax error will be flagged by the TExaS assembler as an error when the assembler tries to translate source code into machine code. The more difficult programming errors to find and remove are functional bugs that can be identified during execution, when the program does not perform as expected. Error messages are meant to be self-explanatory. The assembler has a verbose (see Assembler->Options command) mode that provides more details about the error and suggests possible solutions.

Assembler Error Types1) Undefined symbol: Program refers to a label that does not exist How to fix: check spelling of both the definition and access2) Undefined opcode or pseudo-op How to fix: check the spelling/availability of the instruction3) Addressing mode not available How to fix: look up the addressing modes available for the instruction4) Expression error How to fix: check parentheses, start with a simpler expression

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (9 of 22)2/18/2007 4:05:44 AM

Page 40: AS12 Assembler Guide

Assembly Language Syntax by Valvano

5) Phasing Error occurs when the value of a symbol changes from pass1 to pass2 How to fix: first remove any undefined symbols, then remove forward references6) Address error How to fix: use org pseudo-op’s to match available memory. Error diagnostic messages are placed in the listing file just after the line containing the error. If there is no TheList.RTF file, then assembly errors are reported in TheLog.RTF file. If there is neither TheList.RTF or TheLog.RTF files, then assembly errors are not reported.

--------------------------------------------------------------------------------------Phasing errors A phasing error occurs during Pass 2 of the assembler when the address of a label is different than when it was previously calculated. The purpose of Pass 1 of the assembler is to create the symbol table. In order to calculate the address of each assembly line, the assembler must be able to determine the exact number of bytes each line will take. For most instructions, the number of bytes required is fixed and easy to calculate, but for other instructions, the number of bytes can vary. A phasing errors occur when the assembler calculates the size of an instruction different in Pass 2 than previously calculated in Pass 2. Sometimes a phasing error often occurs on a line further down in the program than where the mistake occurs. A phasing error usually results from the use of forward references. In this 6812 example the symbol "index" is not available at the time of assembling the ldaa index,x. The assembler incorrectly chooses the 2 byte IDX addressing mode version rather than the correct 3 byte IDX1 mode. ldaa index,xindex equ 100; ...loop ldaa #0

The listing shows the phasing errorCopyright 1999-2000 Test EXecute And Simulate$0000 A6E064 ldaa index,x$0064 index equ 100 ; ...$0003 8600 loop ldaa #0##### Phasing errorThis line was at address $0002 in pass 1, now in pass 2 it is $0003

***************Symbol Table*********************index $0064 loop $0002 ##### Assembly failed, 1 errors!

When the assembler gets to loop, the Pass 1 and Pass 2 values are off by one causing a phasing error at the loop ldaa #0 instruction. The solution here to simply put the index equ 100 first.

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (10 of 22)2/18/2007 4:05:44 AM

Page 41: AS12 Assembler Guide

Assembly Language Syntax by Valvano

--------------------------------------------------------------------------------------Assembler pseudo-op's

Pseudo-op's are specific commands to the assembler that are interpreted during the assembly process. A few of them create object code, but most do not. There are two common formats for the pseudo-op's used when developing Motorola assembly language. The TExaS assembler supports both categories. If you plan to export software developed with TExaS to another application, then you should limit your use only the psuedo-op's compatible with that application.

Group A is supported by Motorola's MCUez, HiWare and ImageCraft's ICC11 and ICC12Group B is supported by Motorola's DOS level AS05, AS08, AS11 and AS12Group C are some alternative definitions

Group A Group B Group C meaning

org org .org Specific absolute address to put subsequent object code

= equ Define a constant symbol

set Define or redefine a constant symbol

dc.b db fcb .byte Allocate byte(s) of storage with initialized values

fcc Create an ASCII string (no termination character)

dc.w dw fdb .word Allocate word(s) of storage with initialized values

dc.l dl .long Allocate 32 bit long word(s) of storage with initialized values

ds ds.b rmb .blkb Allocate bytes of storage without initialization

ds.w .blkw Allocate bytes of storage without initialization

ds.l .blkl Allocate 32 bit words of storage without initialization

end end .end Signifies the end of the source code (TExaS ignores these)

--------------------------------------------------------------------------------------equ equate symbol to a value

<label> equ <expression> (<comment>) <label> = <expression> (<comment>)

The EQU (or =) directive assigns the value of the expression in the operand field to the label. The equ directive assigns a value other than the program counter to the label. The label cannot be redefined anywhere else in the program. The expression cannot contain any forward references or undefined

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (11 of 22)2/18/2007 4:05:44 AM

Page 42: AS12 Assembler Guide

Assembly Language Syntax by Valvano

symbols. Equates with forward references are flagged with Phasing Errorsphasing_error. In the following example, the local variable names can not be reused in another subroutine:; MC68HC812A4; *****binding phase***************I equ -4PT equ -3Ans equ -1; *******allocation phase *********function pshx save old Reg X tsx create stack frame pointer leas -4,sp allocate four bytes for I,PT,Result; ********access phase ************ clr I,x Clear I ldy PT,x Reg Y is a copy of PT staa Ans,x store into Ans; ********deallocation phase ***** txs deallocation pulx restore old X rts

In the following example, the equ pseudo-op is used to define the I/O ports and to access the various elements of the linked structure.* ***********Moore.RTF********************** Jonathan W. Valvano 7/18/98 10:54:28 PM* Moore Finite State Machine Controller * PC1,PC0 are binary inputs, PB1,PB0 are binary outputsPORTB equ 0x01DDRB equ 0x03PORTC equ 0x04DDRC equ 0x06TCNT equ 0x84 ; 16 bit unsigned clock, incremented each cycleTSCR equ 0x86 ; set bit 7=1 to enable TCNT* Finite State Machine Controller * C1,C0 are inputs B1,B0 are outputs org $800 variables go in RAMStatePt rmb 2 Pointer to the current state org $F000 Put in EEPROM so it can be changedOut equ 0 offset for output value * 2 bit pattern stored in the low part of an 8 bit byteWait equ 1 offset for time to waitNext equ 2 offset for 4 next states* Four 16 bit unsigned absolute addressesInitState fdb S1 Initial stateS1 fcb %01 Output fcb 5 Wait Time

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (12 of 22)2/18/2007 4:05:44 AM

Page 43: AS12 Assembler Guide

Assembly Language Syntax by Valvano

fdb S2,S1,S2,S3S2 fcb %10 Output fcb 10 Wait Time fdb S3,S1,S2,S3S3 fcb %11 Output fcb 20 Wait Time fdb S1,S1,S2,S1 org $F800 programs go in ROMMain lds #$0C00 movb #$FF,TSCR enable TCNT ldaa #%11111111 staa DDRB B1,B0 are LED outputs ldaa #%00000000 staa DDRC C1,C0 are switch inputs ldx InitState State pointer stx StatePt* Purpose: run the FSM* 1. Perform output for the current state* 2. Wait for specified amout of time * 3. Input from the switches* 4. Go to the next state depending on the input* StatePt is the current state pointerFSM ldx StatePt 1. Do output ldab Out,x Output value for this state in bits 1,0 stab PORTB ldaa Wait,x 2. Wait in this state bsr WAIT ldab PORTC 3. Read input andb #$03 just interested in bits 1,0 lslb 2 bytes per 16 bit address abx add 0,2,4,6 depending on input ldx Next,x 4. Next state depending on input stx StatePt bra FSM* Reg A is the time to wait (256 cycles each)WAIT tfr a,b clra RegD= number of cycles to wait addd TCNT TCNT value at the end of the delayWloop cpd TCNT EndT-TCNT<0 when EndT<Tcnt bpl Wloop rts org $FFFE fdb Main reset vector

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (13 of 22)2/18/2007 4:05:44 AM

Page 44: AS12 Assembler Guide

Assembly Language Syntax by Valvano

--------------------------------------------------------------------------------------set equate symbol to a value

<label> set <expression> (<comment>)

The SET directive assigns the value of the expression in the operand field to the label. The set directive assigns a value other than the program counter to the label. Unlike the equ pseudo-op, the label can be redefined anywhere else in the program. The expression should not contain any forward references or undefined symbols. The use of this pseudo-op with forward references will not be flagged with Phasing Errors.

In the following example, the local variable names could be reused in another subroutine:; MC68HC812A4; *****binding phase***************I set -4PT set -3Ans set -1; *******allocation phase *********function pshx save old Reg X tsx create stack frame pointer leas -4,sp allocate four bytes for I,PT,Result; ********access phase ************ clr I,x Clear I ldy PT,x Reg Y is a copy of PT staa Ans,x store into Ans; ********deallocation phase ***** txs deallocation pulx restore old X rts

--------------------------------------------------------------------------------------fcb Form Constant Byte

(<label>) fcb <expr>(,<expr>,...,<expr>) (<comment>) (<label>) dc.b <expr>(,<expr>,...,<expr>) (<comment>) (<label>) db <expr>(,<expr>,...,<expr>) (<comment>) (<label>) .byte <expr>(,<expr>,...,<expr>) (<comment>)

The FCB directive may have one or more operands separated by commas. The value of each operand is truncated to eight bits, and is stored in a single byte of the object program. Multiple operands are stored in successive bytes. The operand may be a numeric constant, a character constant, a symbol, or an expression. If multiple operands are present, one or more of them can be null (two adjacent commas), in

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (14 of 22)2/18/2007 4:05:44 AM

Page 45: AS12 Assembler Guide

Assembly Language Syntax by Valvano

which case a single byte of zero will be assigned for that operand. An error will occur if the upper eight bits of the evaluated operands' values are not all ones or all zeros. A string can be included, which is stored as a sequence of ASCII characters. The delimitors supported by TExaS are " ' and \. The string is not terminated, so the programmer must explicitly terminate it. For example:str1 fcb "Hello World",0

In the following finite state machine the fcb definitions are used to store outputs and wait times.Out equ 0 offset for output value * 2 bit pattern stored in the low part of an 8 bit byteWait equ 1 offset for time to waitNext equ 2 offset for 4 next states* Four 16 bit unsigned absolute addressesInitState fdb S1 Initial stateS1 fcb %01 Output fcb 5 Wait Time fdb S2,S1,S2,S3S2 fcb %10 Output fcb 10 Wait Time fdb S3,S1,S2,S3S3 fcb %11 Output fcb 20 Wait Time fdb S1,S1,S2,S1

--------------------------------------------------------------------------------------fcc Form Constant Character String

(<label>) FCC <delimiter><string><delimiter> (<comment>)

The FCC directive is used to store ASCII strings into consecutive bytes of memory. The byte storage begins at the current program counter. The label is assigned to the first byte in the string. Any of the printable ASCII characters can be contained in the string. The string is specified between two identical delimiters. The first non-blank character after the FCC directive is used as the delimiter. The delimitors supported by TExaS are " ' and \.

Examples:

LABEL1 FCC 'ABC'LABEL2 fcc "Jon Valvano "LABEL4 fcc /Welcome to FunCity!/

The first line creates the ASCII characters ABC at location LABEL1. Be careful to position the fcc code away from executable instructions. The assembler will produce object code like it would for

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (15 of 22)2/18/2007 4:05:44 AM

Page 46: AS12 Assembler Guide

Assembly Language Syntax by Valvano

regular instructions, one line at a time. For example the following would crash because after executing the LDX instruction, the 6811 would try to execute the ASCII characters "Trouble" as instructions. ldaa 100 ldx #StrgStrg fcc "Trouble"

Typically we collect all the fcc, fcb, fdb together and place them at the end of our program, so that the microcomputer does not try to execute the constant data. For example ldaa Con8 ldy Con16 ldx #Strg bra loop* Since the bra loop is unconditional, * the 6811 won't go beyond this point.Strg fcc "No Trouble"Con8 fcb 100Con16 fdb 1000

--------------------------------------------------------------------------------------fdb Form Double Byte

(<label>) fdb <expr>(,<expr>,...,<expr>) (<comment>) (<label>) dc.w <expr>(,<expr>,...,<expr>) (<comment>) (<label>) dw <expr>(,<expr>,...,<expr>) (<comment>) (<label>) .word <expr>(,<expr>,...,<expr>) (<comment>)

The FDB directive may have one or more operands separated by commas. The 16-bit value corresponding to each operand is stored into two consecutive bytes of the object program. The storage begins at the current program counter. The label is assigned to the first 16-bit value. Multiple operands are stored in successive bytes. The operand may be a numeric constant, a character constant, a symbol, or an expression. If multiple operands are present, one or more of them can be null (two adjacent commas), in which case two bytes of zeros will be assigned for that operand.

In the following finite state machine the fdb definitions are used to define state pointers. E.g., the InitState and the four Next pointers.Out equ 0 offset for output value * 2 bit pattern stored in the low part of an 8 bit byteWait equ 1 offset for time to waitNext equ 2 offset for 4 next states* Four 16 bit unsigned absolute addressesInitState fdb S1 Initial stateS1 fcb %01 Output

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (16 of 22)2/18/2007 4:05:44 AM

Page 47: AS12 Assembler Guide

Assembly Language Syntax by Valvano

fcb 5 Wait Time fdb S2,S1,S2,S3S2 fcb %10 Output fcb 10 Wait Time fdb S3,S1,S2,S3S3 fcb %11 Output fcb 20 Wait Time fdb S1,S1,S2,S1

--------------------------------------------------------------------------------------dc.l Define 32 bit constant

(<label>) dc.l <expr>(,<expr>,...,<expr>) (<comment>) (<label>) dl <expr>(,<expr>,...,<expr>) (<comment>) (<label>) .long <expr>(,<expr>,...,<expr>) (<comment>)

The dl directive may have one or more operands separated by commas. The 32-bit value corresponding to each operand is stored into four consecutive bytes of the object program (big endian). The storage begins at the current program counter. The label is assigned to the first 32-bit value. Multiple operands are stored in successive bytes. The operand may be a numeric constant, a character constant, a symbol, or an expression. If multiple operands are present, one or more of them can be null (two adjacent commas), in which case four bytes of zeros will be assigned for that operand.

In the following finite state machine the dl definitions are used to define 32 bit constants. S1 dl 100000,$12345678S2 .long 1,10,100,1000,10000,100000,1000000,10000000S3 dc.l -1,0,1

--------------------------------------------------------------------------------------org Set Program Counter to Origin

org<expression> (<comment>) .org<expression> (<comment>)

The ORG directive changes the program counter to the value specified by the expression in the operand field. Subsequent statements are assembled into memory locations starting with the new program counter value. If no ORG directive is encountered in a source program, the program counter is initialized to zero. Expressions cannot contain forward references or undefined symbols.

The org statements in the following skeleton place the variables in RAM and the programs in EEPROM of a MC68HC812A4* ********** <<Name>> ********************

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (17 of 22)2/18/2007 4:05:44 AM

Page 48: AS12 Assembler Guide

Assembly Language Syntax by Valvano

org $800 variables go in RAM* <<globals defined with rmb's go here>> org $F000 programs in EEPROMMain: lds #$0C00 initialize stack to RAM* <<one time initializations go here>>loop:* <<repeated operations go here>> bra loop* <<subroutines go here>> org $FFFE fdb Main reset vector

--------------------------------------------------------------------------------------rmb Reserve Multiple Bytes

(<label>) rmb <expression> (<comment>) (<label>) ds <expression> (<comment>) (<label>) ds.b <expression> (<comment>) (<label>) .blkb <expression> (<comment>)

The RMB directive causes the location counter to be advanced by the value of the expression in the operand field. This directive reserves a block of memory the length of which in bytes is equal to the value of the expression. The block of memory reserved is not initialized to any given value. The expression cannot contain any forward references or undefined symbols. This directive is commonly used to reserve a scratchpad or table area for later use.

--------------------------------------------------------------------------------------ds.w Reserve Multiple Words

(<label>) ds.w <expression> (<comment>) (<label>) .blkw <expression> (<comment>)

The ds.w directive causes the location counter to be advanced by 2 times the value of the expression in the operand field. This directive reserves a block of memory the length of which in words (16 bit) is equal to the value of the expression. The block of memory reserved is not initialized to any given value. The expression cannot contain any forward references or undefined symbols. This directive is commonly used to reserve a scratchpad or table area for later use.

--------------------------------------------------------------------------------------ds.l Reserve Multiple 32-bit Words

(<label>) ds.l <expression> (<comment>)

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (18 of 22)2/18/2007 4:05:44 AM

Page 49: AS12 Assembler Guide

Assembly Language Syntax by Valvano

(<label>) .blkl <expression> (<comment>)

The ds.l directive causes the location counter to be advanced by 4 times the value of the expression in the operand field. This directive reserves a block of memory the length of which in words (32 bit) is equal to the value of the expression. The block of memory reserved is not initialized to any given value. The expression cannot contain any forward references or undefined symbols. This directive is commonly used to reserve a scratchpad or table area for later use.

--------------------------------------------------------------------------------------end End of program (optional)

end (<comment>) .end (<comment>)

The END directive signifies the end of the source code. The TExaS assembler will ignore these pseudo operation codes.

--------------------------------------------------------------------------------------ASCII Character codes

BITS 4 to 6

0 1 2 3 4 5 6 7

0 NUL DLE SP 0 @ P ` p

B 1 SOH DC1 : 1 A Q a q

I 2 STX DC2 ! 2 B R b r

T 3 ETX DC3 # 3 C S c s

S 4 EOT DC4 $ 4 D T d t

5 ENQ NAK % 5 E U e u

0 6 ACK SYN & 6 F V f v

7 BEL ETB ' 7 G W g w

T 8 BS CAN ( 8 H X h x

O 9 HT EM ) 9 I Y i y

A LF SUB * : J Z j z

3 B VT ESC + ; K [ k {

C FF FS , < L \ l ;

D CR GS - = M ] m }

E SO RS . > N ^ n ~

F S1 US / ? O _ o DEL

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (19 of 22)2/18/2007 4:05:44 AM

Page 50: AS12 Assembler Guide

Assembly Language Syntax by Valvano

--------------------------------------------------------------------------------------S-19 Object code The S-record output format encodes program and data object modules into a printable (ASCII) format. This allows viewing of the object file with standard tools and allows display of the module while transferring from one computer to the next or during loads between a host and target. The S-record format also includes information for use in error checking to insure the integrity of data transfers. S-Records are character strings made of several fields that identify the record type, record length, memory address, code/data, and checksum. Each byte of binary data is encoded as a 2-character hexadecimal number: the first character representing the high-order 4 bits, and the second the low-order 4 bits of the byte.

The 5 fields that comprise an S-record are: 1) Type S0, S1 or S9 2) Record Length 3) Address 4) Code/Data 5) Checksum

Eight types of S-records have been defined to accommodate various encoding, transportation, and decoding needs, but only three types are used in most Motorola microcontrollers. The S0 record is a title record containing the ASCII name of the file in the Code/Data field. The address field of this type is usually 0000. The S1 record is a data record containing the information to be loaded sequentially starting at the specified address. The S9 record is a end of file marker, and sometimes contains the starting address to begin execution. In an embedded microcomputer environment, the starting address must be programmed at the appropriate place. For most Motorola microcontrollers, the reset vector is the last two bytes of ROM or EEPROM.

The Record Length contains the count of the character pairs in the length record, excluding the type and record length.

For S0, S1, S9 record types, the Address field is a 4-byte value. For the S1 record type the address specifies where the data field is to be loaded into memory.

There are from 0 to n bytes in the Code/Data field. This information contains executable code, memory loadable data, or descriptive information.

The Checksum field is 2 ASCII characters used for error checking. The least significant byte of the one's complement of the sum of the values represented by the pairs of characters making up the record length, address, and the code/data fields. When generating a checksum, one adds (call the result sum) the record length, address and code/data field using 8 bit modulo arithmetic (ignoring overflows.) The

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (20 of 22)2/18/2007 4:05:44 AM

Page 51: AS12 Assembler Guide

Assembly Language Syntax by Valvano

checksum is calculated checksum = $FF - sumWhen verifying a checksum, one adds (call the result sum) the record length, address code/data field and checksum using 8 bit modulo arithmetic (ignoring overflows.) The sum should be $FF.

Each record may be terminated with a CR/LF/NULL.

The following is a typical S-record module:

S1130000285F245F2212226A000424290008237C2A S11300100002000800082629001853812341001813 S113002041E900084E42234300182342000824A952 S107003000144ED492 S9030000FC

The module consists of four code/data records and an S9 termination record.

The first S1 code/data record is explained as follows:

S1 S-record type S1, indicating a code/data record to be loaded/verified at a 2-byte address.

13 Hex 13 (decimal 19), indicating 19 character pairs, representing 19 bytes of binary data, follow.

00 Four-character 2-byte address field: hex address 0000, indicates location where the following data is to be loaded.

The next 16 character pairs are the ASCII bytes of the actual program code/data

2A Checksum of the first S1 record.

The second and third S1 code/data records each also contain $13 character pairs and are ended with checksums. The fourth S1 code/data record contains 7 character pairs.

The S9 termination record is explained as follows:

S9 S-record type S9, indicating a termination record.

03 Hex 03, indicating three character pairs (3 bytes) to follow.

00 Four character 2-byte address field, zeroes. 00

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (21 of 22)2/18/2007 4:05:44 AM

Page 52: AS12 Assembler Guide

Assembly Language Syntax by Valvano

FC Checksum of S9 record.

This document has four overall parts Overview Syntax (fields, pseudo ops) (this document) Local variables Examples

file:///C|/_ENZO STUFF/_NJIT/ECET310/References/Assembly Language Syntax.htm (22 of 22)2/18/2007 4:05:44 AM