|
There are two formats for writing PIC assembler code. One comes directly from Microchip (MPASM), the other comes originally from Parallax who sold it to Tech-Tools (CVASM). Microchips format seems to be the most used today. The Tech-Tool's format, however, incorporates many features that had become expected in assemblers for Z80, 68000, 8086, 8751 and others. So, for those of us who have been working with micros from Day One, Microchip's assembler seems both primitive and cumbersome. Here are some coding examples of the differences. Microchip: #define CLAMP PORTA,5 ;clamp input to T0 #define R20 PORTA,0 ;20 ohm direct feed #define R100 PORTA,1 ;100 ohms #define R470 PORTA,4 ;470 ohms Tech-Tools: CLAMP = ra.5 ;clamp input to T0 R20 = ra.0 ;20 ohm direct feed R100 = ra.1 ;100 ohms R470 = ra.4 ;470 ohms This is not too bad. Microchip is using the format familiar C compilers. The Tech-Tools format is more like previous assemblers for various processors. Microchip: wsave equ 20h
ssave equ 21h
dsave equ 22h
icount equ 24h
Tech-Tools:
org 20h wsave ds 1 ssave ds 1 dsave ds 2 icount ds 1 The Microchip format requires you to specify the address of each variable and leave it enough space by adjusting the address of the next variable. Tech-Tools lets you just define the size of each variable and their order in ram. It creates all the addresses for you. This is the way virtually all assemblers have worked. Microchip: getano addwf PCL,f
retlw 1
retlw 2
retlw 4
retlw 8
Tech-Tools getano addwf PCL
retw 1,2,4,8
Additionally, you can do ASCII strings with mixed decimal values. prntxy addwf PCL
retw 13,10,'This would take a lot of lines'
retw 13,10,'in the Microchip format!',0
If your program needs a lot of imbedded data, this can make a great difference in readability. Other than this, the programming looks very much the same in either assembler. If you only need to grab a routine here or there, it is should not take much to put it in the Microchip format. Also, the hex/obj files produced by eithe assembler are identical. Either one will work with any PIC programmer.
|