Application Programming Example - Motorola MC68VZ328 User Manual

Motorola mc68vz328 integrated processor user's manual
Table of Contents

Advertisement

17.1.6

Application Programming Example

The code shown in Example 17-2 can be used to calculate a CRC value. The example demonstrates how
assembly code is assembled and downloaded to system RAM.
section code
START:
copy clr.l
d1
clr.w
nextwd move.w
(a0,d2),d6
move.w
add.l
add.w
cmpi.w
blt
clr.w
cmp.l
blt
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 Example 17-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
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.
Example 17-2. Application Programming Example
;d1 is used to count the number of words copied.
d2
;d2 is used to count the number of words copied.
d6,(a1)+
#2,d1
;Count the number of words copied.
#2,d2
;Count the number of words copied.
#16,d2
nextwd
;until the whole section has been copied.
d2
d0,d1
;Copy the next word (nextwd)
nextwd
;until the whole section has been copied.
to start receiving a new b-record.
Bootstrap Mode
Bootstrap Mode Operation
17-5

Advertisement

Table of Contents
loading

Table of Contents