PRELIMINARY

Assembly Source for Algorithms

SACL

FL_ST

;Save array start address.

LACL

FL_ADRS

;Get segment start address.

NEWROW

;********Begin a new row.*

SACL

BASE_1

;Save row start address.

LAR

AR1,#0

;Init pulse count to zero.

SAMEROW

;********Same row, next pulse.*

SPLK

#1,BASE_0

;Set row done flag = 1(True).

LACL

BASE_1

;Get row start address.

SACL

FL_ADRS

;Save as current address.

LAR

AR2,#31

;Init row index.

********Repeat the following code 32 times until end of row.*

LOBYTE

 

;********First, do low byte.*

 

SPLK

#0FFh,BASE_2

;Get lo±byte mask.

 

CALL

PRG_BYTE

;Check/Program lo±byte

 

SPLK

#0FF00h,BASE_2 ;Get hi±byte mask.

 

CALL

PRG_BYTE

;Check/Program hi±byte.

NEXTWORD

;********Next word in row.

 

LACL

FL_ADRS

;Load address for next word.

 

ADD

#1

;Increment address.

 

SACL

FL_ADRS

;Save as current address.

 

MAR

*,AR2

;Point to row index.

 

BANZ

LOBYTE

;Do next word,and dec AR2.

********Reached end of row. Check if row done.*

 

BIT

BASE_0,15

;Get row_done flag.

 

BCND

ROW_DONE,TC

;If 1, then row is done.

 

MAR

*,AR1

;Else, row is not done, so

 

MAR

*+

;inc row pulse count.

 

LAR

AR0,#MAX_PGM

;Check if passed allowable max.

 

CMPR

2

;If AR1>MAX_PGM, then

 

BCND

EXIT,TC

;fail, don't continue.

 

B

SAMEROW

;else, go to beginning

 

 

 

;of same row.

********If row done, then check if Array done.*

ROW_DONE

 

;Check if end of array.

 

SUB

SEG_END

;Subtract segment end address.

 

BCND

DONE,GEQ

;If >0, then done.

********Else, go to next row.*

 

LACL

FL_ADRS

;Get current address.

 

B

NEWROW

;Start new row.

********If here, then done.

 

DONE

CALL

ARRAY

;Access flash in array mode.

 

RET

 

 

********If here, then unit failed to program.*

EXIT

SPLK

#1,ERROR

;Update error flag.

 

B

DONE

;Get outa here.

.page

 

 

*************************************************************

* THIS SECTION PROGRAMS THE VALUE STORED IN FL_DATA INTO

*

*

THE FLASH ADDRESS DEFINED BY FL_ADRS.

*

*

 

*

* The following resources are used for temporary storage: *

*

AR6

Parameter passed to Delay.

*

*

SPAD1

Flash program and STOP commands.

*

PRELIMINARY

Assembly Source Listings and Program Examples

A-7

Page 59
Image 59
Texas Instruments TMS320F20x/F24x DSP Sacl Flst, Lacl Fladrs, Newrow, Sacl BASE1, Lar, Samerow, Splk, Lacl BASE1, Lobyte