extern void main (void);
/* prototype for the startup function */
-void _entry (void) _naked interrupt 0;
-void _startup (void) _naked;
+void _entry (void) __naked __interrupt 0;
+void _startup (void) __naked;
/* prototype for the initialized data setup */
-void _do_cinit (void) _naked;
+void _do_cinit (void) __naked;
/*
* entry function, placed at interrupt vector 0 (RESET)
*/
-void _entry (void) _naked interrupt 0
+void _entry (void) __naked __interrupt 0
{
- _asm goto __startup _endasm;
+ __asm goto __startup __endasm;
}
-void _startup (void) _naked
+void _startup (void) __naked
{
- _asm
+ __asm
// Initialize the stack pointer
lfsr 1, _stack_end
lfsr 2, _stack_end
// for non-flash devices, so we do it on all parts.
bsf 0xa6, 7, 0
bcf 0xa6, 6, 0
- _endasm ;
+ __endasm ;
/* cleanup the RAM */
- _asm
+ __asm
/* load FSR0 with top of RAM memory */
; movlw 0xff
; movwf _FSR0L, 0
movlw 0x00
clear_loop:
- movwf _POSTDEC0
+ clrf _POSTDEC0
movf 0x00, w
bnz clear_loop
- _endasm ;
+ __endasm ;
_do_cinit();
/* the cinit table will be filled by the linker */
-extern code struct
+extern __code struct
{
unsigned short num_init;
struct _init_entry {
*/
/* the variable initialisation routine */
-void _do_cinit (void) _naked
+void _do_cinit (void) __naked
{
/*
* access registers 0x00 - 0x09 are not saved in this function
*/
- _asm
+ __asm
; TBLPTR = &cinit
movlw low(_cinit)
movwf _TBLPTRL
; while (curr_entry) {
test:
- bnz done1
+ bnz cont1 ;;done1
tstfsz curr_entry, 1
bra cont1
TBLRDPOSTINC
TBLRDPOSTINC
- ; read the destination address directly into FSR0
+ ; read the size of data to transfer to destination address
TBLRDPOSTINC
movf _TABLAT, w
movwf curr_byte
; decrement byte counter
decf curr_byte, f
- bnc copy_loop ; copy_loop
+ bc copy_loop ; copy_loop
decf curr_byte + 1, f
- bra copy_loop
+ bra copy_one_byte
done_copying:
movff data_ptr + 2, _TBLPTRU
- dcfsnz curr_entry, f
+ decf curr_entry, f
+ bc do_next
decf curr_entry + 1, f
+do_next:
; next entry...
; _do_cinit_curr_entry--;
; emit done label
done:
return
- _endasm;
+ __endasm;
}