; This is a very simple testfile
; with two comments in a row here!


config # "Test File For Assembler" ;
config pic	1684 ;
config clk	hs 1000000 ;
config cp	disabled ;
config wdt	enabled ;
config pwrup	enabled ;
config id	0xffff 0xffff 0xffff 0xffff ;
config # "... The End ..." ;

#include "pic14"

	macro	sid

		begin		; a comment
		nop
		loop:	clrf 1+2+3
		addwf 0x02, w	; whee two arguments to this macro
		nop
		end
	endm

	macro	eric

		begin
	start:	sid
	fini:	end

	endm


	valUE1	equ	0B00000111	; binary
	value2	equ	0xf000		; hex
	value3	=	10		; decimal
	value4	=	071		; octal

	begin
	org 0x0000

	w	=	1		; note either equ or =
	same	=	0

	expr1	=	1 + 2 * 3 - 4 / 2 >> 2 << 3 * 20 % 7
	expr2	=	0b11110000 & 0b10101010
	expr3	=	~0b11110000 | (0b10101010 ^ 0b11110000)

	minreg	equ	0x00
	maxreg	equ	0x7f
	bit0	equ	0
	bit7	equ	7
	minaddr	equ	0x0000
	maxaddr	equ	0x03ff

	addwf	minreg, w
back1:	addwf	minreg, same
back2:	addwf	maxreg, w
	addwf	maxreg, same

	andwf	minreg, w
	andwf	minreg, same
	andwf	maxreg, w
	andwf	maxreg, same

	clrf	minreg
	clrf	maxreg

	clrw

	comf	minreg, w
	comf	minreg, same
	comf	maxreg, w
	comf	maxreg, same

	decf	minreg, w
	decf	minreg, same
	decf	maxreg, w
	decf	maxreg, same

	decfsz	minreg, w
	decfsz	minreg, same
	decfsz	maxreg, w
	decfsz	maxreg, same

	incf	minreg, w
	incf	minreg, same
	incf	maxreg, w
	incf	maxreg, same

	incfsz	minreg, w
	incfsz	minreg, same
	incfsz	maxreg, w
	incfsz	maxreg, same

	iorwf	minreg, w
	iorwf	minreg, same
	iorwf	maxreg, w
	iorwf	maxreg, same

	movf	minreg, w
	movf	minreg, same
	movf	maxreg, w
	movf	maxreg, same

	movwf	minreg
	movwf	maxreg

	nop

	rlf	minreg, w
	rlf	minreg, same
	rlf	maxreg, w
	rlf	maxreg, same

	rrf	minreg, w
	rrf	minreg, same
	rrf	maxreg, w
	rrf	maxreg, same

	subwf	minreg, w
	subwf	minreg, same
	subwf	maxreg, w
	subwf	maxreg, same

	swapf	minreg, w
	swapf	minreg, same
	swapf	maxreg, w
	swapf	maxreg, same

	xorwf	minreg, w
	xorwf	minreg, same
	xorwf	maxreg, w
	xorwf	maxreg, same

; bit functions

	bcf	minreg, bit0
	bcf	maxreg, bit0
	bcf	minreg, bit7
	bcf	maxreg, bit7

	bsf	minreg, bit0
	bsf	maxreg, bit0
	bsf	minreg, bit7
	bsf	maxreg, bit7

	btfsc	minreg, bit0
	btfsc	maxreg, bit0
	btfsc	minreg, bit7
	btfsc	maxreg, bit7

	btfss	minreg, bit0
	btfss	maxreg, bit0
	btfss	minreg, bit7
	btfss	maxreg, bit7

; literal ops

	andlw	0xff
	andlw	0x00

	call	back1
	call	forw1
	call	back2
	call	forw2

	clrwdt

	goto	back1
	goto	forw1
	goto	back2
	goto	forw2

	org 0x03ff	; another origin!

	iorlw	0x00
	iorlw	0xff

	movlw	0x00
	movlw	0xff

	option

	retlw	0x00
	retlw	0xff

	sleep

	xorlw	0x00
	xorlw	0xff

forw1:	tris	5
forw2:	tris	6
	tris	7

; extras for 14 bit Pics

	addlw	0x00
	addlw	0xff

	retfie

	return

	sublw	0x00
	sublw	0xff

	eric

fred:	nop	; in one level
	begin
fred:	nop	; within another
	end


	goto .+1

	end

; ... The End ...


