TechTools CVASM™

NOTE: These items have been discontinued for a long time.
We no longer support these products or offer alternatives.

We retain these pages so that users can see what their existing tools support and to provide download links to the final documentation and software versions. We have a few replacement parts left, but not many. Available items have an 'ADD to CART' or 'Buy Now' button next to them. Otherwise they are not available.

logo has a few items in stock as well.

TechTools PICmicro® MCU Assembler

linkClick here to download the latest version.

link General Information
link Generating Assembly Listings
link Command-Line Options
link Assembler Basics
link Addressing Definitions
link Data Types
link Expressions
link Symbols & Labels
link Local Labels
link Default Symbol Tables
link Instruction Set
link Directives

TOP General Information

    If you already know how to use an assembler, you'll probably find our's to be quite simple. However, if you have little or no experience with assemblers, you should read the following before attempting to use the assembler.

When you write programs for PIC microcontrollers, you'll use a text editor to create source code. Source code is the format that you're accustomed to looking at; it contains English-like labels, instructions, and data.

Before your source code can be used by a programmer, emulator, or other development tool, it must be converted into hex code. Hex code is the "machine-readable" version of source code; it contains instructions and data in the form of hexadecimal data, which can be executed by the PIC.
An assembler is a piece of software that converts source code into hex code.

For instance, this line of source code:
CALL SENDBYTE ;Call send routine

assembles into just two bytes of hex code:

It's possible to write programs directly in hex code, using the individual machine codes that make up each instruction. However, most people find it preferable to use an assembler.

The TechTools assembler (CVASM16 ) is unique in its ability to accept two instruction sets: our own 8051-like instruction set, and the original Microchip instruction set. Many customers appreciate the TechTools instruction set, because it resembles other processors. However, there are certainly customers who prefer the Microchip instructions.

If you plan to use source code in the Microchip format, please note that while our assembler will accept their basic instructions, it will not accept various other aspects of their source code. The syntax of numbers is sometimes different, and our assembler does not recognize Microchip assembler directives and macros. If you plan to write a lot of code in the Microchip format, then you may wish to use the Microchip assembler (MPASM).

TOP Generating Assembly Listings

    It's possible to have the assembler create an "assembly listing" of your program. An assembly listing is a duplicate of the source code, but with hex code information (line number, address, opcode, & data) preceding each original line. To have the assembler create a listing file, simply add "/L" after the filename:

CVASM16 filename /L

Assembles text file filename.src into hex file filename.obj and creates a listing file called filename.lst.

TOP Command-Line Options


The PIC assembler has several options which can be invoked when it is run. These command-line options are shown below:

CVASM16 filename
Assembles text file filename.src into hex file filename.obj.

Assembles text file into hex file filename.obj.

CVASM16 filename /L
Assembles text file filename.src into hex file filename.obj and creates a listing file called filename.lst.

CVASM16 filename /M
Creates a generic Microchip compatible HEX file (.HEX) instead of the TechTools format HEX file (.OBJ).

CVASM16 filename /S
Assembles text file filename.src into hex file filename.obj, but suppresses TechTools device data normally included in the file. (This may be useful with other tools that won't accept any extra data.)

TOP Assembler Basics

    The purpose of the assembler is to convert assembly language source code into hex code. The assembler accomplishes its task in two passes:

Pass 0 - The source code is scanned in an attempt to resolve all symbols. This is possible if all origin, define space, and equate directives can be resolved (equated symbols may be referenced by origin or define space). All other symbols can be resolved by byte-offsets which are determined by the mnemonic/operand combinations. If Pass 0 is successful, the assembler will advance to Pass 1. If Pass 0 is unsuccessful, a list of errors will be shown and assembly will be aborted.

Pass 1 - The source code is scanned once more in order to assemble the hex code. Since all symbols were resolved in Pass 0, all instructions and miscellaneous directives can be fully resolved in Pass 1. If Pass 1 is successful, a hex file containing the assembled code will be created. If Pass 1 is not successful, a list of errors will be shown and assembly will be aborted.

In addition to a hex file, the assembler can be used to generate an assembly listing. An assembly listing shows line numbers, equated values, addresses, data, and original source code (for more information, see the section "Generating Assembly Listings" in TechTools PIC Tools Manual).  

TOP Addressing Definitions


Throughout your programs, you'll refer to bits and bytes by their addresses. Depending on the instruction being used and the item being referred to, the address will be given in one of the following forms:

addr8 An 8-bit address (on 16C5x devices, the lower half of the current 512-word page).

addr9 A 9-bit address (on 16C5x devices, within the current 512-word page).

addr11 An 11-bit address (anywhere in program memory in a device with 2K of memory).

addr12 A 12-bit address (anywhere in program memory in a device with 4K of memory).

bit An address for bitwise operations
(Example: PortC.3 = bit 3 of port C)

fr A file register (RAM) address.

rel A relative address ranging from -7Fh to +80h.

literal An immediate 8-bit value.

TOP Data Types


Eight data types are allowed in the assembler. These data types are:

  1. Assembly address (origin)
  2. EEPROM address (origin)
  3. Local symbol/label
  4. Symbol/label
  5. ASCII value
  6. Binary value
  7. Decimal value
  8. Hex value

The examples below show various data types:

18h (Hex value 18)

100 (Decimal value 100)

0A7h (Hex value A7)

1011b (Binary value 1011)

'A' (ASCII value for the letter A- 65 decimal)

Start (Label called Start)

:loop (Local label called :loop)

$ (Current assembly address)

% (Current EEPROM address)

In addition to single-character text, entire strings can be generated using the RETW instruction:

retw 'The fox jumped over the lazy dog'

TOP Expressions


Mathematical expressions are used in many instructions. These expressions may be created using the following operators:

& (Logical AND)
/   (Divide)
|   (Logical OR)
<< (Shift left)
^   (Exclusive OR )
>> (Shift right)
+   (Add )
<   (High byte)
-    (Subtract )
>   (Low byte)
*   (Multiply )
.   (Bit address)

Some example expressions:

setb PortA.0 Set bit 0 on port A.

mov Count+3,#88h ;Store 88h in location Count+3.

ds N*2 ;Define empty space of Nx2 bytes.

All expressions are resolved strictly from left to right. Please make note of this, since it may affect the result of expressions. For instance, the expression 5+2*4 would normally be resolved as (2*4)+5, for a result of 13. Since our assemblers resolve expressions strictly from left to right, however, the example would be resolved as (5+2)*4, for a result of 28.

TOP Symbols & Labels

    Symbols are used to name locations and values within your program. Many people refer to address symbols as "labels", but both have the same effect. For instance, by assigning a symbol to the start of an important routine, you can later call that routine by its name, rather than its address. And by giving a symbol to a common value, you can refer to it by its name. Rather than typing "212" many times in your program, you can type HOT = 212 at the beginning of your program, and then use HOT wherever you need it. This is also quite handy if your idea of what's "hot" changes. By changing the symbol definition, you can easily redefine HOT to be a different temperature.

Symbols may be up to 32 character long. They must begin with a letter or underscore (_) and must contain only letters, numbers, underscores, and colons. Further, if you're labeling an address (such as the start of a routine), the label must start at the beginning of the line.

Here are some examples of valid symbols:

min_count = 20h

maximum_count = 21h

begin mov min_count,#05h

TOP Local Labels


By default, labels are global, which means that they can be "seen" from anywhere in your program. Sometimes, however, you may want to use a local label, which can only be "seen" within a limited part of your program (the area in which the local label can be seen starts at the preceding global label, and continues up to the following global label).

Local labels have the same syntax rules as global labels, except they must begin with a colon (:), and must be referenced with a colon. Local labels can be referenced from from outside their normal area by referring to preceding global label name:local label name.

The following code demonstrates how to use the local label :loop for common looping purposes within two globally-labeled routines.

(global    label Routine1)
Routine1    mov count,#100

(local label :loop)
:loop           call send_a

(jump to line 2)
                  djnz count,:loop


(global label Routine2)
Routine2    mov count,#200

(local label :loop)
:loop           call send_b

(jump to line 6)
                   djnz count,:loop


(global label Routine3)
Routine3    mov count,#250

(jump to line 6)
                jmp Routine2:loop

TOP Default Symbol Tables


When the assembler is started, its symbol table is initialized with various PIC symbols from the device "Include" file, such as C for the Carry register, RA for Port A, etc. This saves you from having to define every register and bit in the PIC.

If you'd like to see the symbol table for a particular PIC, open the coresponding "include" file in TDE or a text editor.