; eBASIC PIC16 Code Generator ; Copyright(c) 2004, Compubotics LLC ; www.Compubotics.com ORG 0x0 ; File: hello.bas ; ' Hello World Example ; ' eBASIC Compiler ; ' ; ' www.compubotics.com ; ; ' We're using a 16F877 at 16MHz ; #device "16f877" ; #clock 16000000 ; ; Hello con "Hello world!" ; ; Main: nop clrf 0xa goto _startup ORG 0x4 retfie Hello: retlw 0x48 retlw 0x65 retlw 0x6c retlw 0x6c retlw 0x6f retlw 0x20 retlw 0x77 retlw 0x6f retlw 0x72 retlw 0x6c retlw 0x64 retlw 0x21 retlw 0x0 _startup: movlw 0x83 bsf 0x3,5 movwf 0x81 bcf 0xb,5 movlw 0x39 bcf 0x3,5 movwf 0x10 movlw 0x60 movwf 0x78 call _uartSetup goto Main ; ; debug hello, CR Main: movlw 0x5 movwf 0x70 movlw 0x0 movwf 0x71 call _dbgStr movlw 0xd call _uartTX movlw 0xa call _uartTX ; pause 1000 movlw 0xe8 movwf 0x70 movlw 0x3 movwf 0x71 call _pause ; goto Main goto Main ; ; END sleep goto $-1 _uartSetup: movlw 0x67 bsf 0x3,5 bcf 0x3,6 movwf 0x99 bsf 0x98,2 bsf 0x98,5 bcf 0x3,5 bsf 0x18,4 bsf 0x18,7 return _uartTX: bcf 0x3,5 bcf 0x3,6 btfss 0xc,4 goto $-1 movwf 0x19 return _inc16: incfsz 0x70,0 decf 0x71,1 incf 0x71,1 movwf 0x70 iorwf 0x71,0 return _dbgStr: call _j000 iorlw 0x0 btfsc 0x3,2 return call _uartTX call _inc16 goto _dbgStr _j000: movf 0x71,0 movwf 0xa movf 0x70,0 movwf 0x2 _dec16: decf 0x70,1 incfsz 0x70,0 incf 0x71,1 decf 0x71,1 movf 0x70,0 iorwf 0x71,0 return _pause: bcf 0xb,2 btfss 0xb,2 goto $-1 call _dec16 btfss 0x3,2 goto _pause return END ; end of code generation