Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

 
3. LABELS AND INSTRUCTIONS
Mas is 2 PASS assembly for PICxx family of microcontrolers. In first pass mas calculate all label offsets and do some directives (like .org for finding offsets of labels). Output of pass 1 compilation is just text file. This text file has no labels. Second pass do most compilation to make output file. Mas can make 3 different output formats (see '6. Output file formats').

Any line of code can be:

  • label after goes instruction (optionally)
  • instruction
  • directive
  • assign expression
  • macro call
anything else is a syntax error.

In mas labels are declared like most x86 assemblers - name followed by colon. After label instruction can go, or not:

start:   ; label definition

   movlw 10 ; instruction

do: goto do  ; label and instruction
unlike other pic assemblers where declaration of label must be at first character on line, in mas label can goes anywhere.

All things in mas are case sensitive, so labels 'Start' and 'start' are two different labels. Labels can not have same name as instructions. Alphabet for labels contains:

  a..z A..Z 0..9 and '_'

Every label must start with a..z, A..Z or '_'. Labels that start with numbers are illegal:

   mylabel: ; OK

   _mylab123: ; OK

   123lab:  ; error - start with number
Instructions can have up to 3 operands. Because all operands are calculated in pass 2 compilation, operands can reference labels not previous declared:
  start:

     movlw end - start ; size of code

  end:
There is some restrictions for operands (see '4. Assign expressions'). In mas there exist just one version of comment. Any chars that follow ; (semicolon) are skipped to end-of-line.
 
[PREV][HOME][NEXT]