44 #include "sys/clock.h"
48 bus_init (
void) __banked
50 CLKCON = (0x00 | OSC32K);
51 while(CLKCON != (0x00 | OSC32K));
69 flash_read (uint8_t *buf, uint32_t address, uint8_t size) __banked
89 add a, #0xf9 ;stack - 7 = size
96 mov _DPL1, a ;DPTR1 = address & 0x7FFF | 0x8000
101 inc r0 ;MEMCTR = ((address >> 15 & 3) << 4) | 0x01 (bank select)
113 mov _DPS, #1 ;active DPTR = 1
115 movc a, @a+dptr ;read flash (DPTR1)
117 mov _DPS, #0 ;active DPTR = 0
118 movx @dptr,a ;write to DPTR0
120 djnz r2,lp1 ;
while (--size)
123 mov _MEMCTR, a ;restore bank