?? boot5409.asm
字號:
ldm *ar1, a ; acc A <-- DRR
sub #0008h, a ; acc A = 0008
rc aneq
call ser_in ; call SP input sub
ldm *ar1, a ; acc A <-- DRR
sub #0AAh, a ; acc A = 00aa
rc aneq
ser_08
;The dummy words are read to maintain
; hex converter compatibility with
; the 548/549
call DBsreadA ; call SP double read byte from DRR
stl a, @temp0 ; save DUMMY WORD value in temp0
call DBsreadA ; call SP double read byte from DRR
stl a, @temp1 ; save DUMMY WORD value in temp1
call DBsreadA ; call SP double read byte from DRR
stl a, @temp2 ; save DUMMY WORD value in temp2
call DBsreadA ; call SP double read byte from DRR
stl a, @temp3 ; save DUMMY WORD value in temp3
call DBsreadA ; call SP double read byte from DRR
stl a, @xentry ; save XPC entry point
call DBsreadA ; call SP double read byte from DRR
stl a, @entry ; save entry point
SP08_1 call DBsreadA ; call SP double read byte from DRR
; read section size
bcd endboot,aeq ; section size =0 indicate boot end
sub #1,a,b ; brc = section size - 1
stlm b, brc ; update block repeat counter register
call DBsreadA ; call SP double read byte from DRR
; read XPC of destination address
stl a,@dest ; XPC of destination
call DBsreadA ; call SP double read byte from DRR
; read destination address
add @dest, 16, a ;
rptb sfxr08-1
call ser_in ; call SP input sub
ld *ar1, 8, b ; acc B <-- junkbyte.high byte
and #0ff00h, b ; acc B <-- high.byte
stl b, @hbyte ; save high byte
call ser_in ; call SP input sub
ldu *ar1, b ; acc B <-- junkbyte.low byte
and #0ffh, b ; acc B <-- low byte
or @hbyte, b ; acc B <-- high byte.low byte
writa @BL ; [acc A] <-- acc BL
add #1, a ; increment dest add
sfxr08
b SP08_1 ; check next section
*************************************************************************
*** SPIBOOT - This routine reads a boot-table from an SPI EEPROM through
*** McBSP2. 12/06/99 PMJ2
*************************************************************************
SPIBOOT
*** Initialize the McBSP2 for SPI mode. *********************************
stm SPSA2, ar4 ;AR4->SPSA2
stm dxr12-1, ar5 ;AR5->DXR
ld #249, a ;Bit-rate divisor (.4Mhz @100MIPs)
ssbx XF ;Drive XF high - optional hold feature.
call SPI_INIT ;Initialize McBSP.
***************************************************
***** Start reading EEPROM. *****
***************************************************
stm #0, AR3 ;Init address to read from.
call SPI_READ ;Read address 0.
xor #08h,a ;Checking for boot-table (08AAh)
bc parallel, aneq ;If not 08h, no-go. Branch to parallel.
mar *AR3+ ;increment address
call SPI_READ ;Read address 1.
xor #0AAh,a ;Checking for boot-table (08AAh)
bc parallel, aneq ;If not AAh, no-go. Branch to parallel.
***************************************************
***** If here then booting.************************
***** The next eight addresses are skipped *****
***** to maintain hex converter compatibility *****
***** with the 548/549 serial boot-table *****
***************************************************
stm #0ah, AR3 ;Init address to read from.
call SPI_READ ;Read address 0ah.
stl a, 8, xentry ;Store xentry high-byte.
mar *ar3+ ;increment address
call SPI_READ ;Read address 0fh.
or xentry, a ;And xentry high-byte and low-byte.
stl a, xentry ;Store XPC entry point.
mar *ar3+ ;Increment address.
call SPI_READ ;Read address 010h.
stl a, 8, entry ;Store entry high-byte.
mar *ar3+ ;increment address
call SPI_READ ;Read address 011h.
or entry, a ;And entry high-byte and low-byte.
stl a, entry ;Store PC entry point.
mar *ar3+ ;increment address
SPISECT call SPI_READ ;Read address 0ch.
stl a, 8, temp0 ;Store size high-byte.
mar *ar3+ ;Increment address.
call SPI_READ ;Read address 0dh.
or temp0, a ;And size high-byte and low-byte.
bc SPIEND, aeq ;If size = 0, done.
sub #1,a ;Section size - 1.
stlm a, brc ;Update block repeat counter register.
mar *ar3+ ;Increment address.
call SPI_READ ;Read address 0eh.
stl a, 8, xdest ;Store xdest high-byte.
mar *ar3+ ;increment address
call SPI_READ ;Read address 0fh.
or xdest, a ;And xdest high-byte and low-byte.
stl a, xdest ;Store XPC entry point.
mar *ar3+ ;Increment address.
call SPI_READ ;Read address 010h.
stl a, 8, dest ;Store dest high-byte.
mar *ar3+ ;increment address
call SPI_READ ;Read address 011h.
or dest, a ;And dest high-byte and low-byte.
stl a, dest ;Store PC dest point.
*********This is the loop for reading a section**************
rptb SPILOOP-1
mar *ar3+ ;Increment address.
call SPI_READ ;Read high-byte.
stl a, 8, temp0 ;Store high-byte.
mar *ar3+ ;increment address
call SPI_READ ;Read address low-byte.
or temp0, a ;And high-byte and low-byte.
stl a, temp0 ;Temporarily save it.
dld xdest, a ;Get destination address.
writa temp0 ;[acc A] <-- acc BL
add #1, a ;increment dest add
dst a, xdest ;Save destination address.
SPILOOP mar *ar3+ ;Increment address.
b SPISECT ;Read next section.
SPIEND rsbx XF ;Drive XF low - optional hold feature.
b endboot ;Branch to loaded code.
*****************************************************************
* Bootload from parallel I/O port (pa0)
*****************************************************************
pasyini
call handshake
portr pa0, @temp0 ; read BSW 10AAh or 8AAh
ld @temp0, a ; check BSW
sub #10aah, a, b ; acc A = 10aah ?
bcd pasync16, beq ;
and #0ffh, a ; check acc AL = 08
sub #8,a ;
bc endboot, aneq ; not a boot mode
call handshake
portr pa0, @temp0 ; read BSW 10AAh or 8AAh
ld @temp0, a ; check BSW
and #0ffh, a ; check acc AL = 08
sub #0aah, a ; acc A = 0aah ?
bc pasync08, aeq ;
b endboot
*****************************************************************
* Bootload from I/O port (8-bit parallel), MS byte first
*****************************************************************
pasync08
call handshake8
stl b, @swwsr ; save swwsr ini-value to SWWSR
call handshake8
stl b, @bscr ; save bscr ini-value to BSCR
call handshake8
stl b, @xentry ; save XPC of entry point
call handshake8
stl b, @entry ; save entry point
pasy08_1
ld #0, b ; b=0, Rev1.02 to fix 8bitI/O bug.
call handshake8
bc endboot, beq ; if size = 0, branch to endboot
sub #1, b ; otherwise, subtract 1 from block size
stlm b, brc ; set brc to correct block size
call handshake8
*********************** Bug fix ***********************************
stl b, @temp0 ; save XPC of destination addr
ld @temp0,16,a ;added to correctly calculate the
;extended address of the section
;PMJ2(11/10/99) 1.02
call handshake8
add b,a ; acc A <-- destination address
*******************************************************************
rptb pfxr08-1
call handshake8
ssbx xf ; acknowledge byte as soon as it's read
bc $,bio ;wait until BIO high to write data
writa BL ; write code word to program memory
add #1, a ; increment destination address
pfxr08
b pasy08_1 ; branch to next section
*****************************************************************
* Bootload from I/O port (16-bit parallel)
*****************************************************************
pasync16
call handshake
portr pa0, @swwsr ; read word from port to SWWSR
call handshake
portr pa0, @bscr ; read word from port to BSCR
call handshake
portr pa0, @xentry ; read word from port to XPC of
; entry point
call handshake
portr pa0, @entry ; read word from port to entry
pasy16_1
call handshake
portr pa0, @lngth ; read word from port to length
ldu @lngth, a ; check size
bcd endboot, aeq ; size = 0, end of boot
sub #1, a, b ;
stlm b, brc
call handshake
portr pa0, @dest ; read word from port to XPC of
; destination addr
call handshake
portr pa0, @temp0 ; read from port to temp for
; destiantion addr
ldu @temp0, a ; acc A <-- destination address
add @dest, 16, a ;
rptb pfxr16-1
call handshake ; check BIO low ?
portr pa0, @temp0 ; read word from port to temp
ssbx xf ; acknowledge word as soon as it's read
bc $,bio ; wait until BIO high to write data
writa @temp0 ; write word to destination
add #1, a ; increment destination address
pfxr16
b pasy16_1
* Handshake with BIO signal using XF
handshake
ssbx xf ; acknowledge previous data word
bc $,bio ; wait till host sends request
rsbx xf ; indicate ready to receive new data
rc bio ; wait till new data ready
b $-1
handshake8
ssbx xf ; acknowledge previous data word
bc $,bio ; wait till host sends request
rsbx xf ; indicate ready to receive new data
bc $,nbio ; wait till new data ready
portr pa0, BL ;read high byte into accumulator A
************* Bug fix ******************************************************
and #0ffh,b ;force BG, BH to zero for correct evaluation
;(11/10/99 PMJ2)
****************************************************************************
sftl b,8 ;left shift by 8 bits
ssbx xf ; acknowledge previous data word
bc $,bio ; wait till host sends request
rsbx xf ; indicate ready to receive new data
bc $,nbio ; wait till new data ready
portr pa0, @temp0
andm #0ffh,temp0 ; clear upper byte
or @temp0, b ; combine high and low byte
ret
bootend
.end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -