
;Simple template for Ubicom SX28A
;Assembles with SASM. Save HEX (for ICprog / Fluffy2 burning) from the RUN/Device option.
;By Phil Ruston 2005

;---------------------------------------------------------------------------------------------
;Chip Config......

DEVICE		SX28AC,TURBO,BANKS8,OSCHS3,SYNC,OPTIONX,IFBD
		
		;chip model, 1 instruction per clock, standard memory size
		;High Speed (external) oscillator, Synchronize inputs internally
		;Use standard 8 level stack, disable internal oscillator resistor
		;See docs for other settings

;----------------------------------------------------------------------------------------------

RESET		initialize	;address to jump to on reset / power up

;----------------------------------------------------------------------------------------------
IRC_CAL		IRC_SLOW	;not necessary - just stops a SASM warning
;----------------------------------------------------------------------------------------------
FREQ		64_000_000	;not necessary - for SXsim debugging only
;----------------------------------------------------------------------------------------------

;Some useful macros

SKIPIFZERO	macro
		SB status.2
		endm
SKIPNOTZERO	macro
		SNB status.2
		endm
SKIPONCARRY	macro
		SB status.0
		endm
SKIPNOCARRY	macro
		SNB status.0
		endm

;---------------------------------------------------------------------------------------------

; Project variables

TEMP 		EQU $08			;first global SRAM address 


;---------------------------------------------------------------------------------------------

		org $000

interrupt	NOP
		RETI			;interrupt routine here if required
		

initialize	MOV W,#$00		;Set all PORT A pins to outputs 
		MOV !RA,W
		MOV W,#$00		;Set all PORT B pins to outputs 
		MOV !RB,W
		MOV W,#$00		;Set all PORT C pins to outputs 
		MOV !RC,W
		
		MOV W,#$00		;Set all PORT outputs low
		MOV RA,W			
		MOV RB,W
		MOV RC,W
		
		MOV M,#$0d		;Mode $0D = adjust voltage levels
		MOV W,#$00		;Set all ports to use CMOS levels
		MOV !RA,W
		MOV !RB,W
		MOV !RC,W

;---------------------------------------------------------------------------------------------

main_code:	INC RB			;demo - count up on port B
		JMP main_code		

;====================================================================================================================

		END
