temp set 60h ;Init program constants
ram_addr .set 61h
ram_word .set 62h
hi_byte .set 63h
dummyport .set 0h
**
** This section is loaded and executed within internal RAM block
**
.sect ÒBOOT_CODEÓ ;Section compiled to run at 0xFA00
EPROM_START ;External EPROM starts with branch
b BOOT_START ; instruction for signature sensing
BOOT_START
ldpk 0
lrlk AR0,( 8000h | APPCODE_START )
larp AR0 ;EPROM start = APPCODE_START
lalk 8000h
sacl ram_addr ;External RAM start = 0x8000
call TRANSFER ;Move first half of EPROM to
; RAM[0x8000 to almost BFFF]
in temp,dummyport ;Set EPROM address bit to upper half
; and enable BIO- signal
lrlk AR0,8000h ;Reset EPROM pointer to 0x8000
lalk 7FFFh ;Set MSB of RAM address to Ò0Ó to
and ram_addr ; allow writes to external RAM and
sacl ram_addr ; not over-write internal boot
; loaded RAM at 0xFA00
call TRANSFER ;Move second half of EPROM to
; alias of address
; RAM[almost 0xBFFF to almost FFFF]
; All code loaded from EPROM. Now jump to application code in RAM.
b 8000h
; Subroutine ÒTRANSFERÓ converts high byte, low byte pairs
; in external EPROM to 16 bit words and stores them in external RAM
TRANSFER ;Ó*Ó always points to EPROM bytes
lack 255
and *+
sacl hi_byte ;Mask and save high byte
lack 255
and *+
add hi_byte,8 ;Mask low byte, combine with high
sacl ram_word ; byte and store for transfer
zals ram_addr
tblw ram_word ;Copy word to external RAM
addk 1
sacl ram_addr ;Calc next external RAM address
sar AR0,temp ;Test for EPROM address to wrap to
lac temp ; 0x0000
bnz TRANSFER ;Loop until half of EPROM transferred
**
** This section is loaded and executed within external RAM block
** starting at address 0x8000
.sect ÒAPP_CODEÓ ;Section compiled to run at 0x8000
APPCODE_START
( continue on with remaining application code ... )
|