Bootstrap Mode Operation
Bootstrap Mode 17-5
17.1.6 Application Programming Example
The code shown in Example17-2 can be used to calculate a CRC value. The example demonstrates how
assembly code is assembled and downloaded to system RAM.
Example 17-2. Application Programming Example
section code
START:
copy clr.l d1 ;d1 is used to count the number of words copied.
clr.w d2 ;d2 is used to count the number of words copied.
nextwd move.w (a0,d2),d6
move.w d6,(a1)+
add.l #2,d1 ;Count the number of words copied.
add.w #2,d2 ;Count the number of words copied.
cmpi.w #16,d2
blt nextwd ;until the whole section has been copied.
clr.w d2
cmp.l d0,d1 ;Copy the next word (nextwd)
blt nextwd ;until the whole section has been copied.
crc clr.l D0
lp2 add.l (A0)+,D0
cmp.l A0,A1
bpl.b lp2
nop
rts
After assembling and linking the program in Example17-2, generate the following s-record file.
S0030000FC
S1134000428142423C30200032C6548154420C4228
S113401000106DF04242B2806DEA4280D098B3C87D
S10940206AFA4E714E75B0
S9030000FC
Run the DOS program STOB.EXE to convert the preceding s-records to bootstrap format.
0000400010428142423C30200032C6548154420C42
000040101000106DF04242B2806DEA4280D098B3C8
00004020066AFA4E714E75
Download the preceding b-record file to the target system using the UART port in bootstrap mode. Since
this b-record file will be loaded into system RAM , initialize the system by downloading an init b-record
file.
To run the preceding program after it is downloaded to RAM, issue an execution b-record “0000400000”,
where 00004000 is the start address of the program and the last two zeros identify the record as an
execution b-record and not a data record.
To resume bootstrap mode operation after running a program, make the last instruction in the application
program a jmp $FFFFFF5A to start receiving a new b-record.
Any b-record may be entered in a RS-232 terminal environment, but when a key is pressed, the character
produced by the keystroke is sent to the bootloader to be assembled. Although the backspace capability is
not implemented, the b-record can be terminated at any time by pressing the ENTER key. As long as a
program execution b-record is not issued, the MC68VZ328 will remain in bootstrap mode.