Category : Assembly Language Source Code
Archive   : SVASM02.ZIP
Filename : SVASM02.DOC

Output of file : SVASM02.DOC contained in archive : SVASM02.ZIP

S V A S M 0 2

A two-pass cross-referencing assembler


6502 and 65C02 microproccessors

Written by

John Michne, KM2H
10 Evergreen Ave.
Clifton Park, New York 12065

Version 1.0

May, 1988

S V A S M 0 2

USER'S MANUAL - Version 1.0 - May, 1988


INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . 1

RUNNING THE SVASM02 ASSEMBLER. . . . . . . . . . . . . . 1
Source filename. . . . . . . . . . . . . . . . . . . . 1
Object filename. . . . . . . . . . . . . . . . . . . . 1
Print filename . . . . . . . . . . . . . . . . . . . . 2

INPUT FILE LINE STRUCTURE. . . . . . . . . . . . . . . . 2
Label field. . . . . . . . . . . . . . . . . . . . . . 2
Instruction field. . . . . . . . . . . . . . . . . . . 2
Argument field . . . . . . . . . . . . . . . . . . . . 3
Comment field. . . . . . . . . . . . . . . . . . . . . 3

ARITHMETIC . . . . . . . . . . . . . . . . . . . . . . . 3
Symbols. . . . . . . . . . . . . . . . . . . . . . . . 3
Program counter. . . . . . . . . . . . . . . . . . . . 3
Constants. . . . . . . . . . . . . . . . . . . . . . . 3
Expressions. . . . . . . . . . . . . . . . . . . . . . 4
Arithmetic operators . . . . . . . . . . . . . . . . . 4
Logical operators. . . . . . . . . . . . . . . . . . . 5

ADDRESSING MODE SYNTAX . . . . . . . . . . . . . . . . . 5
6502 Addressing modes. . . . . . . . . . . . . . . . . 5
65C02 Additional addressing modes. . . . . . . . . . . 7

ASSEMBLER DIRECTIVES (Psuedo-ops). . . . . . . . . . . . 8
.BYTE. . . . . . . . . . . . . . . . . . . . . . . . . 8
.WORD. . . . . . . . . . . . . . . . . . . . . . . . . 8
.CMOS. . . . . . . . . . . . . . . . . . . . . . . . . 9
.END . . . . . . . . . . . . . . . . . . . . . . . . . 9
.LIST. . . . . . . . . . . . . . . . . . . . . . . . . 9
.NOLIST. . . . . . . . . . . . . . . . . . . . . . . . 9
.INCLUDE . . . . . . . . . . . . . . . . . . . . . . . 9
.PAGE. . . . . . . . . . . . . . . . . . . . . . . . . 9
.WIDTH . . . . . . . . . . . . . . . . . . . . . . . .10
.PRINTC. . . . . . . . . . . . . . . . . . . . . . . .10
.IF, .ELSE, .ENDIF, .LISTF . . . . . . . . . . . . . .10

ERRORS . . . . . . . . . . . . . . . . . . . . . . . . .11
Fatal errors . . . . . . . . . . . . . . . . . . . . .11
Invocation errors. . . . . . . . . . . . . . . . . . .11
Assembler errors . . . . . . . . . . . . . . . . . . .12

SVASM02 LST Output File Description. . . . . . . . . .14

SVASM02 HEX Object File Description. . . . . . . . . .16


The SVASM02 program and User's Manual are Copyright
1988 by John Michne. Both may be freely copied and
USE ONLY. The SVASM02 program and User's Manual may
not be copied and distributed commercially except as
arranged with the author.

The author makes no warranty or guarantee of
suitability of SVASM02 for any purpose, and will not
be held liable for any damages, direct or
consequential, that may arise due to the use of this

SVASM02 is a two-pass cross-referencing assembler for 6502 and 65C02
microprocessors. It runs in IBM and compatible machines, and has been run
under both PC-DOS (Version 3.1) and MSDOS (Version 2.11). Since it is written
in 8086 assembly language, memory requirerments are minimal and execution
speed is optimum. It is approximately 12K long, and will run in as little as
64K. The original Version 1.0 distribution was via GEnie to the public
domain. This was primarily to get the program out to where it may be useful,
and get it tested under conditions of actual use by programmers other than the
author. Future versions will be distributed to registered users only. See
the file INFORMAL.DOC for details.

This document is not intended to teach assembly language programming. It will
fully explain the operation of the SVASM02 assembler, and with numerous
examples, will guide the user to efficient and successful assembly of 6502 and
65C02 code.


SVASM02 is invoked in the usual manner - merely type the program name. The
screen will clear and a sign-on line will appear, followed by a prompt for the
input file name. It looks like this:


Source filename [.ASM]:

At this point, enter the requested filename. A valid disk designator may
preceed the filename, but a path designation may not. SVASM02 does not
support directory paths. If no drive specifier is used, the default logged
drive is assumed. Note in the example above the "[.ASM]" following the
filename prompt. This is the default filename extension that will be used in
the absence of any input filename extension. For example, the filename
SOURCE.ASM may be input as SOURCE or as SOURCE.ASM. If the filename extension
is anything other than .ASM, it must be specified. Any error situation is
immediately displayed, with a repeat of the prompt. The source file is
expected to be standard ASCII text, which may be prepared with any suitable
editor or word processor.

The next prompt is for the object filename:

Object filename [.HEX]:

Again, disk designations are supported, paths are not, and the default
filename extension is .HEX. If no drive specifier is used, the default drive
is assumed. A filename must be entered to obtain an object file. If no
object file is desired, merely strike the ENTER key. Output is normally to
disk as ASCII characters in the standard Intel format (see Appendix B for a
description of the HEX file format). Reserved Device Names may be used for
directing HEX output to the COM ports, console, or printers. This is done by
DOS, and is not supported by SVASM02. Obviously, you do this at your own
peril. The results may not be as expected.

The final prompt is for the name of the listing or print filename:

Print filename [.LST]:

The same rules apply here as for the .HEX file, except the listing file may be
directed to the screen by entering CON or to the printer by entering LPT.
Entering a valid optional drive and filename will cause the print file to be
written to disk. If no drive specifier is used, the default logged drive is
assumed. Use of the system Reserved Device Names may produce unexpected
results, except for CON. Drivers have been included to produce the correct
results using CON, and using LPT instead of any of the system names produces a
correct printer output. See Appendix A for a description of the LST output
file format.

Assembly now begins. If any assembly errors are found, the offending numbered
line is output to the screen, followed by a line containing the error number
and a description of the error. Error output to the screen is automatic,
regardless of the presence or absence of a .LST or .HEX file. If a .LST file
is being written, the same error sequence will appear in it. Errors are fully
discussed anon. Completion of assembly is signaled by the appearance of an
ending statement containing the number of bytes assembled and the number of
errors, followed by the DOS prompt.


SVASM02 uses the standard format for assembler input. Each instruction is on
a single line, and each line is composed of four fields. A line may start in
any column. The fields are:

Label Instruction Argument ;Comment

All fields are generally optional. The argument field may or may not be
required depending on the nature of the instruction. Fields are separated by
one or more space or tab characters. The argument field may be separated from
the comment field by the comment delimiting semicolon character ";".

Label Field

Labels are used as references within the code. Their use is optional, but if
a label is used it is the first non-blank field on the line. They may be up
to six characters long and must begin with a letter. Only the upper case
alphabetic characters from A to Z and the numerals 0 to 9 may be used in a
label. A label does NOT require a colon. In fact, use of a colon following a
label will generate an error. A label may be the only field on a line.

Instruction Field

The instruction field is composed of microprocessor instructions. All
instructions are three upper case characters long. The instruction mnemonic
is as described by the manufacturer. The instruction field is the first non-
blank field on the line if a label is not used, or if the statement is not an
equate or directive. If a label is used, one or more blank or tab characters
must separate the label field from the instruction field. For a complete
listing of all of the 6502 and 65C02 instructions, see the file TEST02.ASM.
Argument Field

The argument field contains any argument required by the instruction. It may
be a constant, a symbol, register name, or an expression. Numeric constants
may be expressed in decimal, octal, hexadecimal, or binary. Quoted string
constants are also allowed. See the Arithmetic section for a complete
description of constants, symbols, and expressions.

Comment Field

The comment field is the last field on a line, and must begin with a semicolon
(;). Anything, regardless of case, that follows a semicolon is considered
commentary information and is ignored by SVASM02. Comments appear in the
source listing exactly as they appear in the source line. A blank line is
considered a comment, and need not be preceeded by a semicolon.



A symbol is a name assigned to represent a value. A symbol, once defined, may
not be redefined. Labels are symbols, since the value of the label is the
value of the program counter when the label is defined. A label is defined
when it appears as the first field on a line.

Program Counter

The program counter is represented symbolically by the asterisk (*). If the
program counter is not defined, a starting value of zero is assumed. The
value assigned to the program counter may not be a forward reference.

Consider the following sequence:

* = $100 ; The program counter is defined a value of 100 hex.
FLAG * = * + 1 ; The value of FLAG is 100 hex, and the program counter
; is advanced by 1.
START LDA #1 ; The value of START is 101 hex

In the above sequence, FLAG is uninitialized storage at location 100 hex.
START is a label having a value of the program counter, or 101 hex.

Symbols follow the same rules of syntax as labels - up to six characters (A-Z,
0-9), beginning with a letter.


A constant is an unsigned numerical value between 0 and 65,535 (decimal). It
may be expressed in any of four radices - decimal, hexadecimal, octal, and
binary - or may be a quoted string one or two characters long.

A decimal constant may contain the numerals 0 through 9, and must have no
leading or trailing radix specifier.

A hexadecimal constant may contain the numerals 0 through 9 and the upper case
letters A through F. It must be either preceeded by the dollar sign ($)
character or contain the letter H as the last character. If the trailing H
specifier is used, the first character must be a numeral between 0 and 9.

An octal constant may contain the numerals 0 through 7, and must be either
preceeded by the @ character or trailed by the letter Q.

A binary constant consists of up to sixteen 0 and 1 characters, preceeded by
the % character or trailed by the letter B.

A quoted string constant is any one or two characters enclosed between single
quote characters. The value of a single character quoted string is the 8-bit
ASCII code value of the character. A two character quoted string has similar
characteristics, being the 16-bit value of the characters, in ascending order
(from left to right). Note that the double quote is invalid as a string
delimiter, and is considered to be a character just like K, a, &, etc. (See
the discussion of the .BYTE directive for additional use of the quoted

Some examples:

1233 Decimal, no radix specifier
$4ACF Hexadecimal, leading radix specifier
4ACFH Hexadecimal, trailing specifier
@377 Octal, leading specifier
377Q Octal, trailing specifier
%10110 Binary
10100110B Binary
'A' Single character quoted string
'CQ' Two character quoted string


An expression is a symbol, constant, or combination of symbols and constants
connected by arithmetic and/or logical operators such that the value of the
expression does not exceed 16 bits, or 65,535. The arithmetic operators are:

+ Addition
- Subtraction
* Multiplication
/ Division
< Extraction of low 8 bits
> Extraction of high 8 bits

Arithmetic Operators

The four arithmetic operators (+, -, *, and /) apply to addition, subtraction,
multiplication, and division, respectively, and warrant no further
explanation. The byte extraction operators extract either the low 8 bits or
high 8 bits from a 16-bit argument. This is best illustrated by examples:

LOW8 = <$1234 ; The value of LOW8 is $34
HIGH8 = >$1234 ; The value of HIGH8 is $12

The logical operators are:

AND Logical AND of the arguments
OR Logical OR
NOT Complement of the argument
XOR Exclusive OR of the arguments
MOD Remainder
SHL n Shift left n bits
SHR n Shift right n bits

Logical Operators

All logical operations assume 16-bit arguments. Leading bits not contributing
to the value of the operation are either 0 or 1, as appropriate. For example,
NOT 0 has a value of $FFFF, while $1234 AND $34 has a value of $0034. Results
of a shift operation (SHL n or SHR n) do not wrap around, ie., a bit shifted
right out of bit 0 or shifted left out of bit 15 is lost.

Evaluation of expressions is from left to right only. There is no hierarchy,
and parenthesis are not allowed. Examples of all of the above may be had by
assembling the TEST02.ASM file.


The generation of the appropriate opcode by SVASM02 is totally dependent on
the addressing mode used. The syntax of the instruction and its argument (if
any) determines the addressing mode, and therefore what opcode will be
generated. The 6502 uses thirteen addressing modes, and the 65C02 uses all of
these with two additional. The following descriptions of each addressing mode
give an example illustrating the syntax of each:

6502 Addressing Modes:

Zero Page - LDA $20

Only the low eight bits are specified and refer to an address of $00FF or
less. The high eight bits of the address are assumed to be 0. This is a
very efficient addressing mode for the 6502/65C02.

Absolute - LDA $125F

The second and third bytes of the instruction contain a 16-bit address.
Any address within the 6502 64K address space may be specified.

Immediate - LDA #$FF

The second byte of the instruction contains immediate data requiring no
further addressing. The # symbol signifies immediate data. The value of
the data is limited to 8 bits.

Indexed Zero Page - LDA $20,X or LDA $20,Y

The second byte of the instruction contains the value of a base address
on page zero to which is added the contents of the X or Y register. The
result is the effective page zero address and must not exceed 255
Indexed Absolute - LDA $453D,X or LDA $453D,Y

The second and third bytes of the instruction contain the value of a base
address to which is added the contents of the X or Y register. The
result is a 16-bit value which is the effective address. The value must
not exceed 65,535 (decimal).

Zero Page Indexed Indirect - LDA ($20,X)

The second byte of the instruction is added to the contents of the X
register, with any carry discarded. The result points to a location on
page zero which contains the low eight bits of the effective address.
The next higher page zero address contains the high eight bits of the
effective address. CAUTION - Both memory locations containing the
effective address must be on page zero. SVASM02 has no way of checking
this at assembly time, so the programmer is cautioned to heed this

Indirect Indexed - LDA ($20),Y

The second byte of the instruction points to a page zero location. The
contents of this location is added to the contents of the Y register,
producing a result which is the low 8 bits of the effective address. Any
carry resulting from the addition is added to the contents of the next
page zero address, the result being the high 8 bits of the effective
address. See the CAUTION in the preceeding paragraph.

Absolute Indirect - JMP ($122F)

The second and third bytes of the instruction contain a 16-bit address.
The contents of that address contain the low 8 bits of the effective
address, and the next higher memory location contains the high 8 bits of
the effective address. This addressing mode applies only to the JMP

Implied - TSX

The addressing is implied by the instruction, and no further address is

Acumulator - LSR A

This addressing mode is but a single byte, which specifies an operation
to be performed on the accumulator. The argument must be the single
letter A.

Relative - BEQ *+5

The second byte of the instruction contains an 8-bit offset which is
added to the program counter value of the next instruction. The result
is the new value of the program counter. The assembler uses the present
value of the program counter to make the calculation. When writing the
code, use the value of the program counter at the beginning of the
present line. The assembler takes this into account when computing the
offset, and the proper offset to the target is produced. This avoids
undetected errors in the offset. For example,
12 1000 F003 BEQ *+5
13 1002 200041 JSR FIX3 ; A subroutine at $4100
14 1005 4C0010 TARGET JMP $1000

Line 12 (program counter = address 1000) specifies a branch to the target
at 5 bytes beyond the present program counter to address 1005. The
assembled offset is 03, which is the target relative to the program
counter at line 13. This 2 byte difference is due to the way in which
the 6502/65C02 handles the program counter and relative addressing.

The permissible range of the offset is -128 to +127 bytes relative to the
next instruction, or -126 to +129 relative to the present instruction.

65C02 Additional Addressing Modes:

Zero Page Indirect - LDA ($20)

The second byte of the instruction contains a page zero address whose
contents is the low 8 bits of the effective address. The high 8 bits of
the effective address is in the next highest page zero location. See the
CAUTION under Zero Page Indexed Indirect above.

Indexed Absolute Indirect - JMP ($203B,X)

The second and third bytes of the insruction contain a base address. The
contents of the X register is added to it, and the result points to a
memory location containing the low 8 bits of the effective address. The
high 8 bits are loaded from the next highest memory location.

In the above examples numeric constants were used as arguments to illustrate
the magnitude of the argument (8 or 16 bits). In actual use, the argument may
be expressed symbolically as well.

Symbolic zero page (8 bit) arguments must be defined prior to their use in an
expression. While it would be correct to use a 16 bit value with the high 8
bits set to zero, to do so is not good programming practice and is not allowed
by SVASM02. For example:

TEMP2 = $12

This will generate a "Forward Reference to Page Zero" error. If the order was

TEMP2 = $12

no error would be generated. There are instructions where this does not
apply, however. Those instructions that have no zero page mode may use an
absolute argument with a value anywhere in the range of 0 to 65,535.


SVASM02 utilizes several directives, or pseudo-operators, for directing the
assembly. These include directives for page length and width control, printer
control, listing control, conditional assembly, CMOS (65C02) assembly,
inclusion of source code from an alternate file, and definition of byte and
word storage. All pseudo-ops must begin with a period. The pseudo-ops are as

.BYTE ; Defines initialized byte storage
.WORD ; Defines initialized word (two bytes in low/high format)
.CMOS : Allows assembly of 65C02 instructions
.END ; Defines the physical end of the source code
.LIST ; Turns on listing if it had been off
.NOLIST ; Turns off assembler listing
.INCLUDE ; Reads source code from an alternate disk file
.PAGE ; Controls page length
.WIDTH ; Controls page width
.PRINTC ; Outputs printer control characters
.IF ; Assembles following statements if argument is non-zero
.ELSE ; Alternate assembly if .IF argument is zero
.ENDIF ; Terminates conditional assembly
.LISTF ; List but do not assemble false conditionals

A detailed description of each pseudo-op follows.


The .BYTE pseudo-op is perhaps the most used. It initializes storage of its
arguments in the code at the address of the value of the program counter at
the beginning of the line. The arguments may be constants, symbols,
expressions, or quoted strings. Each individual argument must be separated
from the next by a comma. The magnitude of each evaluated argument must not
exceed 8 bits. In the case of quoted string arguments, the only limit is the
length of the line. The delimiter for the quoted string is the single quote
character. A double quote has no meaning in SVASM02 other than as a
character. To include a single quote character as part of the quoted string,
use two single quotes together. Examples:

.BYTE $45,$77,$FF,0,3 ; Constants
.BYTE SHELL + 4 ; Expression (value of 8 bits or less)
.BYTE 'This Can''t be' ; Quoted string with embedded
; single quote


Similar to .BYTE, the .WORD pseudo-op assembles 16-bit values at the address
of the value of the program counter at the beginning of the line. Since the
6502/65C02 handles 16-bit values (addresses) in low byte/high byte order,
the .WORD directive assembles the 16-bit values of its arguments in low/high
order. The arguments to .WORD follow the same rules as for .BYTE, except the
value of each argument may be within the range of 0 to 65,535. Examples:

.WORD START ; The 16-bit value of START is placed in the code
.WORD ASSEM+9 ; 9 is added to the value of ASSEM, and the result
; is placed in the code


Directs SVASM02 to assemble 65C02 instructions in addition to 6502. The
default is off (do not assemble 65C02). If assembly of 65C02 instructions or
address modes is attempted without first invoking .CMOS, an error will be
generated. The .CMOS directive has no arguments.


This directive causes assembly to stop, and must be used as the last statement
in the source code. No further assembly occurs following the .END directive.
The .END directive has no arguments, and its omission causes an error. .END
must be used in .INCLUDE files as well. The .END in an .INCLUDE file causes
termination of assembly of the .INCLUDED source statements and a return to the
primary source file.


This directive, together with its complementary .NOLIST, may be used to
selectively list the assembled source code in the output file. If no LST file
or device is selected at program invocation, the .LIST directive is ignored.
The default is on (list assembler output). There are no arguments.


Turns off assembler output listing. Source code lines following the .NOLIST
are counted and assembled, but generate no LST output. If no LST file or
device is selected at program invocation, the .NOLIST directive is ignored.
The default is .LIST, and there are no arguments.


This directive causes SVASM02 to read source code input from the file named as
the argument. The filename must be valid, and may include a disk drive
specifier. Omission of a drive specifier causes the default drive to be used.
A pathname may not be used. The source code in the INCLUDEd file must contain
the .END directive. Its omission will cause an error. INCLUDEs may not be
nested (only a single open INCLUDE at a time is allowed). Example:

.INCLUDE DISTRIB.TAB ; Source code is taken from the file named
; DISTRIB.TAB on the default logged disk.


This directive controls the length of the LST output page and causes a header
to be printed on the top of each new page. The header includes the assembler
name and version number, the name of the file being assembled, the date and
time at which assembly was started, and the page number. Four blank lines
separate the header from the output. The default is no paging.

The .PAGE directive may or may not have an argument. If no argument is
specified, paging is initiated at the default 58 output lines per page or at
the previous number of lines per page if a previous .PAGE n had been used. If
a .PAGE 0 is specified, paging is turned off if it had been on. .PAGE n will
initiate paging at n lines per page. The maximum lines per page is 255. A
PAGE may be used to cause a page eject. The .PAGE directive is not printed,
and has no line number assigned. Examples:

.PAGE ; Initiate paging at 58 lines/page or the previous value
.PAGE 60 ; Use 60 lines/page
.PAGE 0 ; Turn off paging


This directive controls the number of character spaces on the LST output line.
The default is 76, and includes the neccessary fill spaces for tab characters.
A tab character is assumed to be eight character spaces long, and occur every
eight character positions. Beginning at position 1, a tab can position the
print head at column 9, 17, 25, 33, etc. If a tab character is encountered
between the tab settings, blanks are added to position the print head at the
next tab stop. The .WIDTH directive must have an argument, and its value must
be in the range of 64 to 255. Any input source code characters beyond the
number specified in the argument are assembled, but are ignored in the LST


Many printers use "escape codes" or other control characters to control pitch,
form length, page width, etc. The .PRINTC directive is intended to send
initializing or control characters to the printer. The argument contains a
string that is evaluated as binary bytes by SVASM02 and is written to the LST
output device prior to any other output. The bytes are not counted against
line width, the line is not counted and it does not appear in the LST output.
There is no default. When used, the .PRINTC directive should be the very
first statement in the source code. Example:

.PRINTC '[x2,' ; Causes the four byte string [x2, to be sent
; to the LST output file or device.


These pseudo-ops will be discussed together, since they are the so-called
conditional assembly directives.

A conditional assembly sequence consists of the openning .IF statement with
its argument, source statements, and the closing .ENDIF statement. If the
argument of the .IF evaluates non-zero (true), the source statements between
the .IF and .ENDIF are assembled. If the argument evaluates zero (false), the
statements between the .IF and .ENDIF are not assembled. Statements within a
false conditional are not listed on the LST output unless .LISTF (list false
conditionals) has been invoked.

The .ELSE directive is used between the .IF and .ENDIF to permit alternate
assembly or non-assembly of the code following, depending on the value of the
IF argument. This is best shown by illustration:
.IF arg
. If arg is non-zero, the statements up to the
. .ELSE are assembled and those between the .ELSE
. and the .ENDIF are not.
. If arg is zero, the statements between the .ELSE
. and the .ENDIF are assembled and those between the
. .IF and .ELSE are not.

The argument to the .IF is required, and may be any constant, symbol, or
expression. .ELSE, .ENDIF, and .LISTF do not require arguments. There are no
defaults to conditional assembly. Conditionals may be nested up to 16 levels.
It should be noted that this version of SVASM02 does not allow the use of
relational operators such as EQ, LT, GT, etc. in the argument to the .IF.


Fatal Errors

There are three fatal errors possible in SVASM02. Each causes the program to
stop and an error message to be displayed on the screen. Control is returned
to DOS.

1. Directory full - An attempt was made to create a file entry in a
disk directory that contained no available slots. Reduce the
number of files on the disk or use another disk.

2. Input file read error - The source file is corrupted or otherwise
not readable. Try another copy of the file.

3. Disk full - An attempt was made to write data on a full disk. Use
another disk or delete files to make room.

Invocation errors

These errors are non-fatal, merely causing a reissuing of the prompt.

1. Filename error - An incorrect syntax was used to specify a
filename for the source, object, or list file.

2. Invalid drive - The disk drive specified does not exist or is not

3. File not found - The source file could not be found on the drive

Assembler Errors

There are 25 possible assembly time errors. Each is numbered, and when
encountered, is output to the screen along with the line containing the error.
For example,

381 2079 .PSGE 60 ; Use 60 lines/page
*** 10 *** Unidentified directive

The first line is the assembler output of the line containing the error. In
the above example, 381 is the line number and 2079 is the program counter
value. The remainder of the line is as input. The error message number
appears before the description of the error and is the reference to the
detailed discussion of the error in this document. If an output file is being
generated or there is output to a list device, the same error sequence appears
there. Regardless of the output medium, all errors are output to the screen
as shown above. For errors occurring in lines containing instructions, one,
two, or three NOP's ($EA) are assembled depending on the number of bytes
expected to be required for the instruction.

1 Undefined symbol - A reference was made to a symbol that has never been
defined. This could be caused by a misspelling of a valid symbol or label
name, or omission of a line of code. An improper numeric argument or
directive name could also be considered a "symbol" and as such, could cause
this error.

2 Label or symbol previously defined - An attempt was made to redefine a
symbol or use a label more than once. Once defined, SVASM02 does not allow
a symbol to be redefined.

3 Syntax error - The stucture of the line is not recognized. Check the
statement for proper syntax, missing arguments, etc.

4 Illegal first character in label or symbol - Labels and symbols must begin
with a letter. Am improperly structured or used numeric argument may also
cause this error.

5 Forward reference to page zero - All references to addresses on page zero
must be known before they are used. See the discussion on page 6 under
Addressing Modes.

6 Label or symbol more than 6 characters - The present version of SVASM02
limits the number of characters in a label or symbol to six.

7 No .END directive in INCLUDE file - The .END directive is required to
terminate assembly. An end of file was reached without finding the .END

8 Forward reference in equate or origin - An expression contained a symbol
which was not defined prior to its use to define the program counter or an

9 (Reserved)

10 Unidentified directive - A directive or pseudo-op was found that is not in
the list of valid directives. Check for a stray leading period or bad

11 Invalid quoted string - An attempt was made to use a quoted string constant
greater than two characters long, or there was a missing quote character.

12 Branch target out of range - The target address of a branch instruction
was beyond the maximum allowed displacement from the source instruction.
See the discussion on relative addressing.

13 Invalid addressing mode - An attempt was made to use an addressing mode
that is invalid for the instruction. See the file TEST02.ASM for a
complete listing of all valid addressing modes for all instructions.

14 Invalid numeric argument - A numeric argument contained a character invalid
for the radix used.

15 Arithmetic overflow - The result of an arithmetic operation exceeded 65,535

16 No .END directive - The last statement in the source file was not an .END
directive. .END must be encountered before the physical end of the file.

17 Expression value > 8 bits - An arithmetic operation produced a result
greater than 255 (decimal) for an instruction or addressing mode requiring
a single byte value.

18 Division by zero - The divisor in a division operation had a value of zero
when the operation was attempted.

19 CMOS assembly not selected - An attempt was made to use a 65C02 instruction
or addressing mode before invoking the .CMOS directive.

20 Open .IF limit exceeded - The number of open conditional assembly (.IF
directive) exceeds the maximum of 16.

21 Forward reference in conditional - The value of the argument in an .IF
directive was unknown at the time the .IF was encountered during the first
pass. The argument value must be known before the .IF can be openned.

22 No open .IF - An .ELSE or .ENDIF was encountered for which there was no

corresponding .IF directive previously specified.

23 .INCLUDE file already open - An attempt was made to .INCLUDE a file that
has already been openned (.INCLUDEd).

24 INCLUDE filename error - A syntax error has occurred in the filename given
in an .INCLUDE directive.

25 Invalid drive name - The disk drive specifier in a filename to be .INCLUDEd
is invalid.

26 INCLUDE file not found - The file specified in an .INCLUDE directive cannot
be found on the specified disk drive or currently logged disk if no disk
specifier is used.

SVASM02 LST Output File Description

The output fragments which follow were extracted from the TEST02.LST file to
illustrate the format of the assembler output. In general, the first 33
spaces on a line are generated by SVASM02. The remainder of the line is a
copy of the input code.
18 = 0047 QUOTE1='G' ;SINGLE QUOTE
Line 18 contains an equate. The line number appears in the first four spaces
on the left. The = signifies a valid equate, having the hexadecimal value of
0047. The several spaces between the value and QUOTE1 are the remaining
spaces up to column 32, followed by tab expansion spaces up to the QUOTE1.
The spaces between the 'G' and the ; are tab fill spaces such that the comment
delimiter (;) starts in a column which is a multiple of 8, plus 1. The input
source code contained tabs in these spaces.
52 ;
54 ;
55 1006 0D0A5356 .BYTE $0D,$0A,'SVENSON ELECTRONICS','$'
100A 454E534F
100E 4E20454C
1012 45435452
Lines 52 through 55 are the output from commentary information and a .BYTE
directive. The ; in lines 52-54 are in column 33, having been in column 1 in
the input file. The byte output begins in line 55. The 1006 is the
hexadecimal address (program counter) at which the bytes were assembled. The
eight hexadecimal characters which follow represent the value of the first
four bytes of the data assembled. The remainder of the line is as input. The
three unumbered lines following are the remaining output for the directive.
For .BYTE and .WORD directives, the line number is not incremented if
additional lines are required to complete the output of the data. Line
numbering resumes at the next statement.
65 1024 AD0230 LDA PORT1
66 1027 29FF AND #$FF
67 1029 8D0530 STA DAT1
Lines 65-67 are typical instruction code output. Note that addresses are
listed in lowbyte/high byte order exactly the way they appear in memory.
86 102F EAEA BRA *-126
*** 19 *** CMOS Assembly not selected
Line 86 contains an error, with the error message on the following line.
Since the branch instruction is expected to generate two bytes of machine
code, two NOP's (EA) are inserted in place of the code that would be generated
had there been no error. In the error message line, the 19 refers to the
error number, a discussion of which may be found in the main documentation
under ERRORS.




BIAS 0007 48
BVAL1 009D 34 47
BVAL2 009D 35 51
CHECKP 2091 381

The above output fragment appears at the end of the code output. The number
of bytes asembled is given, and represents the actual count of bytes
assembled. Gaps in the address space of the program, such as for
uninitialized storage, are not counted. The number of errors is also stated.

The alphabetically sorted symbol table follows, with appropriate column
headings for the symbol name, its hexadecimal value, the decimal line number
in which it was defined, and decimal listing of cross-reference line numbers.
The above example shows only a single reference for two symbols, but multiple
references are listed on the same line up to the maximum number of spaces
allowed by the WIDTH directive. Any additional references are listed on the
following lines.

SVASM02 Object File Format

The object file consists of records of ASCII hexadecimal characters in the
Intel format. A typical record looks like this:


Byte 0 A colon character, signifying the beginning of the record

Bytes 1-2 Hexadecimal value indicating the number of loadable bytes in the
record. The maximum is 10 (16 decimal).

Bytes 3-6 Hexadecimal address where first byte of the record will be

Bytes 7-9 Always 00.

Bytes 10-on Hexadecimal characters representing the actual data bytes.

Last two A checksum. The checksum is the two's complement of the 8-bit
bytes sum of the value of all bytes (not the ASCII) with carry
discarded. It includes the byte count, load address bytes, and
loadable data bytes.

The last record contains values of zero for byte count, load address, and
checksum. It effectively is :0000000000.

  3 Responses to “Category : Assembly Language Source Code
Archive   : SVASM02.ZIP
Filename : SVASM02.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: