
; PicBasic Pro Compiler 2.03,  Copyright (c) 1998 microEngineering Labs, Inc.     All Rights Reserved.

PM_USED			EQU	1

	INCLUDE	"16F84.INC"

RAM_START       		EQU	0000Ch
RAM_END         		EQU	0004Fh
RAM_BANKS       		EQU	00001h
BANK0_START     		EQU	0000Ch
BANK0_END       		EQU	0004Fh
EEPROM_START    		EQU	02100h
EEPROM_END      		EQU	0213Fh

R0              		EQU	RAM_START + 000h
R1              		EQU	RAM_START + 002h
R2              		EQU	RAM_START + 004h
R3              		EQU	RAM_START + 006h
R4              		EQU	RAM_START + 008h
R5              		EQU	RAM_START + 00Ah
R6              		EQU	RAM_START + 00Ch
R7              		EQU	RAM_START + 00Eh
T1              		EQU	RAM_START + 010h
FLAGS           		EQU	RAM_START + 012h
GOP             		EQU	RAM_START + 013h
RM1             		EQU	RAM_START + 014h
RM2             		EQU	RAM_START + 015h
RR1             		EQU	RAM_START + 016h
RR2             		EQU	RAM_START + 017h
_W0              		EQU	RAM_START + 018h
_W1              		EQU	RAM_START + 01Ah
_W2              		EQU	RAM_START + 01Ch
_W3              		EQU	RAM_START + 01Eh
_W4              		EQU	RAM_START + 020h
_W5              		EQU	RAM_START + 022h
_W6              		EQU	RAM_START + 024h
_PORTL           		EQU	PORTB
_PORTH           		EQU	PORTA
_TRISL           		EQU	TRISB
_TRISH           		EQU	TRISA
_PINS            		EQU	_PORTL
_B0              		EQU	_W0
_B1              		EQU	_W0 + 001h
_B2              		EQU	_W1
_B3              		EQU	_W1 + 001h
_B4              		EQU	_W2
_B5              		EQU	_W2 + 001h
_B6              		EQU	_W3
_B7              		EQU	_W3 + 001h
_B8              		EQU	_W4
_B9              		EQU	_W4 + 001h
_B10             		EQU	_W5
_B11             		EQU	_W5 + 001h
_B12             		EQU	_W6
_B13             		EQU	_W6 + 001h
_W0_LOWBYTE      		EQU	_W0
_W0_HIGHBYTE     		EQU	_W0 + 001h
_W1_LOWBYTE      		EQU	_W1
_W1_HIGHBYTE     		EQU	_W1 + 001h
_W2_LOWBYTE      		EQU	_W2
_W2_HIGHBYTE     		EQU	_W2 + 001h
_W3_LOWBYTE      		EQU	_W3
_W3_HIGHBYTE     		EQU	_W3 + 001h
_W4_LOWBYTE      		EQU	_W4
_W4_HIGHBYTE     		EQU	_W4 + 001h
_W5_LOWBYTE      		EQU	_W5
_W5_HIGHBYTE     		EQU	_W5 + 001h
_W6_LOWBYTE      		EQU	_W6
_W6_HIGHBYTE     		EQU	_W6 + 001h
#define _PIN0            	_PINS_0
#define _PIN1            	_PINS_1
#define _PIN2            	_PINS_2
#define _PIN3            	_PINS_3
#define _PIN4            	_PINS_4
#define _PIN5            	_PINS_5
#define _PIN6            	_PINS_6
#define _PIN7            	_PINS_7
#define _BIT0            	_B0_0
#define _BIT1            	_B0_1
#define _BIT2            	_B0_2
#define _BIT3            	_B0_3
#define _BIT4            	_B0_4
#define _BIT5            	_B0_5
#define _BIT6            	_B0_6
#define _BIT7            	_B0_7
#define _BIT8            	_B1_0
#define _BIT9            	_B1_1
#define _BIT10           	_B1_2
#define _BIT11           	_B1_3
#define _BIT12           	_B1_4
#define _BIT13           	_B1_5
#define _BIT14           	_B1_6
#define _BIT15           	_B1_7
#define _PINS_0          	_PINS, 000h
#define _PINS_1          	_PINS, 001h
#define _PINS_2          	_PINS, 002h
#define _PINS_3          	_PINS, 003h
#define _PINS_4          	_PINS, 004h
#define _PINS_5          	_PINS, 005h
#define _PINS_6          	_PINS, 006h
#define _PINS_7          	_PINS, 007h
#define _B0_0            	_B0, 000h
#define _B0_1            	_B0, 001h
#define _B0_2            	_B0, 002h
#define _B0_3            	_B0, 003h
#define _B0_4            	_B0, 004h
#define _B0_5            	_B0, 005h
#define _B0_6            	_B0, 006h
#define _B0_7            	_B0, 007h
#define _B1_0            	_B1, 000h
#define _B1_1            	_B1, 001h
#define _B1_2            	_B1, 002h
#define _B1_3            	_B1, 003h
#define _B1_4            	_B1, 004h
#define _B1_5            	_B1, 005h
#define _B1_6            	_B1, 006h
#define _B1_7            	_B1, 007h

; Constants.
_T2400           		EQU	00000h
_T1200           		EQU	00001h
_T9600           		EQU	00002h
_T300            		EQU	00003h
_N2400           		EQU	00004h
_N1200           		EQU	00005h
_N9600           		EQU	00006h
_N300            		EQU	00007h
_OT2400          		EQU	00008h
_OT1200          		EQU	00009h
_OT9600          		EQU	0000Ah
_OT300           		EQU	0000Bh
_ON2400          		EQU	0000Ch
_ON1200          		EQU	0000Dh
_ON9600          		EQU	0000Eh
_ON300           		EQU	0000Fh
_MSBPRE          		EQU	00000h
_LSBPRE          		EQU	00001h
_MSBPOST         		EQU	00002h
_LSBPOST         		EQU	00003h
_LSBFIRST        		EQU	00000h
_MSBFIRST        		EQU	00001h
_SND             		EQU	00000h

; Commands Used.
RANDOM_USED     	= 	001h
BAND_USED       	= 	001h
CMPGE_USED      	= 	001h
IF_USED         	= 	001h
SOUNDPIN_USED   	= 	001h
SOUND_USED      	= 	001h
GOTO_USED       	= 	001h

	INCLUDE	"SOUND.MAC"
	INCLUDE	"PBPPIC14.LIB"

_loop	
	RANDOM?W	_W0
	BAND?BCB	_B0, 05Fh, _B2
	CMPGE?BCL	_B2, 044h, _beep
	MOVE?CB	000h, _B2
_beep	
	SOUNDPIN?C	_SND
	SOUND?BC	_B2, 004h
	GOTO?L	_loop

	END
