Rational PIC Assembler 2.0 reviewDownload
Rational PIC Assembler is an assembler for the mid-range microcontrollers from Microchip
Rational PIC Assembler is an assembler for the mid-range microcontrollers from Microchip. The project uses Intel style mnemonics and target-first operand ordering. Designed to feel comfortable to PC assembly programmers.
This assembler generates code compatible with Microchip's midline microcontrollers but is incompatible with their assembler. It should feel familiar to any PC assembly programmer. The instruction mnemonics and operand order are Intel style ( i.e. 'right', as opposed to 'wrong' ).
Command Line Syntax
pic-asm [ -c ] [ -l filename ] [ -o filename ] input_file
-c -- console mode
an assembly source is accepted from stdin. binary code is
output on stdout. errors are output to stderr
-l filename -- specify listing file
-o filename -- specify object file
The input is a sequence of line each of which contains one or more of the following fields
label instruction operands ; comment
The label and comment are optional. The operands required depend on the instruction.
The assembler is case sensitive, even for instructions.
Hex values can be specified with C-style '0x'[:xdigit:]+. Binary values can be specified with '0b'+. Decimal values require no prefix as decimal is the default base.
Character constants are specified by enclosing a single character or escaped character within single quotes. String constants are specified by enclosing zero or more characters and escaped characters within double quotes. String constants generate one character constant for each character in the string. There is no trailing zero stored. For example:
db "Hello worldn", 0, 'a', 'b', 'r', 'n', 't'
A label is a sequence of alphanumeric characters ( including underbar ) that starts a line. Labels do not have colons. Labels local to the last nonlocal label can be defined by prefixing the name with a dot. For instance
; example from example-1.asm
foo call .1
.1 jmp .2
.2 jmp .1
bar call .1
.1 jmp .2
.2 jmp .1
In this example, the labels defined are foo, foo.1, foo.2, bar, bar.1, and bar.2. The first call branches to foo.1. The second call branches to bar.1. The labels local to 'foo' can not be referenced before 'foo' has been declared nor after 'bar' has been declared.
Data can be declared. The declarator takes the place of the instruction and is followed by one or more expressions separated by commas. Each expression corresponds to one word in the output code regardless of the declarator type.
db - each operand is AND-ed with 0xff before being stored
dw - full 14 bit word definition
dt - each operand is AND-ed with 0xff and OR-ed with 0x3400 ( the return-with-value opcode ). This allows generation of case tables. You can add the accumulator ( 'w' ) to the offset of the table. The processor will branch to the location in the table and return with an eight bit result
dw 0x3fff, 0x3ff * 16 + 15, -1
dt 0b001, 0b010, 0b100
Equates are a named sequence of tokens. They can be defined with 'equ'. For instance:
led_1 equ 0x100 | 1
led_2 equ 0x100 | 2
combo equ ( led_1 ) | ( led_2 )
The org position can be changed with 'org'. For instance
What's New in This Release:
This release adds support for sophisticated macros, include files, conditional compilation, and compatibility with Microchip headers.
Rational PIC Assembler 2.0 keywords