| 1 |
; Blank line |
| 2 |
loop sleep ; Label and operation |
| 3 |
incf 6,1 ; Operation with 2 parameters |
| 4 |
goto loop ; Operation with 1 parameter |
| 5 |
|
| 6 |
#define X Y |
| 7 |
#defin ; incomplete |
| 8 |
#undefine X |
| 9 |
|
| 10 |
number equ 5 |
| 11 |
|
| 12 |
label_#v((number + 1) * 5)_suffix equ 0x10 |
| 13 |
|
| 14 |
db .34,O'35',O'93',0xAf,0xady,a'a',a'ap,A'\' |
| 15 |
|
| 16 |
any macro parm |
| 17 |
movlw parm |
| 18 |
endm |
| 19 |
any 33 |
| 20 |
|
| 21 |
; Shift reg left |
| 22 |
slf macro reg |
| 23 |
clrc |
| 24 |
rlf reg,f |
| 25 |
endm |
| 26 |
|
| 27 |
; Scale W by “factor”. Result in “reg”, W unchanged. |
| 28 |
scale macro reg, factor |
| 29 |
if (factor == 1) |
| 30 |
movwf reg ; 1 X is easy |
| 31 |
else |
| 32 |
scale reg, (factor / 2) ; W * (factor / 2) |
| 33 |
slf reg,f ; double reg |
| 34 |
if ((factor & 1) == 1) ; if lo-bit set .. |
| 35 |
addwf reg,f ; .. add W to reg |
| 36 |
endif |
| 37 |
endif |
| 38 |
endm |
| 39 |
|
| 40 |
scale tmp,D'10' |
| 41 |
|
| 42 |
movwf tmp |
| 43 |
clrc |
| 44 |
rlf tmp,f |
| 45 |
addwf tmp,f |
| 46 |
|
| 47 |
spin macro n |
| 48 |
movlw n |
| 49 |
addlw 0xff |
| 50 |
btfss STATUS,Z |
| 51 |
goto $-2 |
| 52 |
endm |
| 53 |
|
| 54 |
LOOP: BTFSS flag,0x00 |
| 55 |
GOTO LOOP |
| 56 |
|
| 57 |
|
| 58 |
BTFSS flag,0x00 |
| 59 |
GOTO $ - 1 |
| 60 |
|