Spru 191
Spru 191
NECESSARY
IF MAILED
IN THE
UNITED STATES
PERF PERF
BIND THIS EDGE
1
BIND THIS EDGE
PERF PERF
2
TMS320C54x DSKplus
DSP Starter Kit
User’s Guide
1996
User’s Guide
DSP Starter Kit
TMS320C54x DSKplus
User’s Guide
IMPORTANT NOTICE
Texas Instruments (TI) reserves the right to make changes to its products or to discontinue any
semiconductor product or service without notice, and advises its customers to obtain the latest
version of relevant information to verify, before placing orders, that the information being relied
on is current.
TI warrants performance of its semiconductor products and related software to the specifications
applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality
control techniques are utilized to the extent TI deems necessary to support this warranty.
Specific testing of all parameters of each device is not necessarily performed, except those
mandated by government requirements.
Certain applications using semiconductor products may involve potential risks of death,
personal injury, or severe property or environmental damage (“Critical Applications”).
Inclusion of TI products in such applications is understood to be fully at the risk of the customer.
Use of TI products in such applications requires the written approval of an appropriate TI officer.
Questions concerning potential risk applications should be directed to TI through a local SC
sales office.
In order to minimize risks associated with the customer’s applications, adequate design and
operating safeguards should be provided by the customer to minimize inherent or procedural
hazards.
ii
Preface
iii
How to Use This Manual / Notational Conventions
Notational Conventions
This document uses the following conventions.
iv
Notational Conventions / Information About Cautions
- Braces { and } indicate a list. The symbol | (read as or) separates items
within the list. Here’s an example of a list:
{ * | *+ | *– }
This provides three choices: *, *+, or *–.
Unless the list is enclosed in square brackets, you must choose one item
from the list.
The information in a caution is provided for your protection. Please read each
caution carefully.
The following books describe the ’54x and related support tools. To obtain a
copy of any of these TI documents, call the Texas Instruments Literature
Response Center at (800) 477-8924. When ordering, please identify the book
by its title and literature number.
vi
Related Documentation From Texas Instruments
Trademarks
Code Explorer is a trademark of GoDSP Corporation.
HP-UX is a trademark of Hewlett-Packard Company.
MS-DOS is a registered trademark of Microsoft Corporation.
OS/2 is a trademark of International Business Machines Corporation.
TI, XDS510, and 320 Hotline On-line are trademarks of Texas Instruments
Incorporated.
viii
If You Need Assistance
t
DSP Solutions http://www.ti.com/dsps
320 Hotline On-line http://www.ti.com/sc/docs/dsps/support.html
- Japan
Product Information Center +0120-81-0026 (in Japan) Fax: +0120-81-0036 (in Japan)
+03-3457-0972 or (INTL) 813-3457-0972 Fax: +03-3457-1259 or (INTL) 813-3457-1259
DSP Hotline +03-3769-8735 or (INTL) 813-3769-8735 Fax: +03-3457-7071 or (INTL) 813-3457-7071
DSP BBS via Nifty-Serve Type “Go TIASP”
- Documentation
When making suggestions or reporting errors in documentation, please include the following information that is on the title
page: the full title of the book, the publication date, and the literature number.
Mail: Texas Instruments Incorporated Email: [email protected]
Technical Documentation Services, MS 702
P.O. Box 1443
Houston, Texas 77251-1443
Note: When calling a Literature Response Center to order documentation, please specify the literature number of the
book.
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
Provides general information about the DSKplus and lists the hardware and software
requirements.
1.1 Kit Contents and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.2 What You Need . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.2.1 Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.2.2 Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.3 Functional Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
xi
Contents
6 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
Describes the DSKplus development hardware, including parallel port registers, signal
definitions, ports, and modes.
6.1 Power and Cables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
6.2 DSKplus Communications Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-4
6.2.1 The PC’s Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
6.2.2 The PC’s Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
xii
Contents
E Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . E-1
Defines acronyms and key terms used in this book.
Contents xiii
Figures
Figures
1–1 DSKplus Board Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
1–2 DSKplus Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
2–1 Connection Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2–2 Code Explorer Port Selection Dialog Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2–3 Code Explorer Debugger Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2–4 Self-Test Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
3–1 Debugger Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
5–1 DSKplus Assembler in the Software Development Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
5–2 Using the .space and .bes Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-25
5–3 Using the .field Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-26
5–4 Using Initialization Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-28
5–5 Using the .align Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-29
6–1 Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
6–2 Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
6–3 Control Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
6–4 PALR Device’s Internal Logic Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-7
6–5 Functional Diagram for a 4-Bit Read Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-9
6–6 Functional Diagram for a Write or 8-Bit Read Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-10
A–1 TMS320C54x DSKplus Circuit Board Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-2
A–2 Schematic Diagram of DSKplus Circuit Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-3
C–1 The .field Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-15
C–2 Using the .usect Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . C-37
xiv
Tables
Tables
5–1 Operators Used in Expressions (Precedence) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
5–2 DSKplus Assembler Directives Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20
6–1 DB25 Connector Pin Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
Examples
5–1 Assembler Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
5–2 Using Sections Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-24
B–1 PALR Equation Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B-2
Contents xv
xvi
Chapter 1
Introduction
The TMS320C54x DSKplus is a low-cost DSP starter kit with enhanced archi-
tecture. The development kit contains a stand-alone application board that you
connect to your PC and that enables you to explore the architecture and
operation of the ’C54x CPU and its peripherals. The DSKplus board executes
your custom ’C54x code in real time while the Windows-based debugger
analyzes it line-by-line, displaying internal DSP register information in multiple
windows, also in real time. The board’s communication interface lets you
create your own ’C54x DSP code and host PC code. The hardware enables
the use of expansion boards for adding memory, peripherals such as codecs,
interface logic, other DSPs, or microcontrollers.
Topic Page
1-1
Kit Contents and Features
1-2
What You Need
Introduction 1-3
Functional Overview
P1
JP6
JP4 U3
R37
C19 C31 R62
R43 R48
C33 C35 D2
IN
J2
U5 L1
J3
U1
OUT
R36
U6 DSP
PTC C34 TMS320C542
C22
C32 C26
R34
R35
U2
JP2
Universal 5-V Buffered serial port (BSP) XDS510 DSP external 8-bit bidirectional,
power supply and host port interface (HPI) emulator data bus 4-bit unidirectional
included control signals port printer port connectivity,
(IEEE1149.1 standard) enabling high speed
applications
(cable included)
The host port interface logic is an on-board PALR device that operates as the
main interface between the host PC’s parallel port and the ’C542 host port in-
terface (HPI). As a result, the interface logic gives the host PC direct control of
the ’C542’s HPI and DSP reset signal, and it can configure the board to operate
with different PC parallel ports (that is, 4-bit and 8-bit printer ports).
When you power the board and start the debugger, the debugger software ini-
tializes the host interface logic and configures the board to the correct parallel
port mode, either 4-bit or 8-bit. At this time, the communication link between
the DSKplus board and host PC is ready for operation.
For the DSKplus and the host to communicate properly, the DSP must follow a
common communication protocol defined by the host. Therefore, the host PC
downloads the protocol to the DSP communication software, which resides in
DSP memory at addresses 80h–17Fh. The protocol also uses a mutual com-
1-4
Functional Overview
Program Data
0000h 0080h 0000h
Reserved
(OVLY = 1) Interrupts
Memory-mapped
007Fh registers
0080h Communications 0100h
kernel 005Fh
0180h 0060h
Scratch-pad RAM
On-chip Program RAM 007Fh
DARAM 0080h
10K words
(OVLY = 1)
BSP RAM block 0800h
or program RAM On-chip
DARAM
Kernel buffer 1000h (10K words)
(10 words)
HPI RAM block 100Ah
27FFh or program RAM
2800h
1800h
27FFh
Program RAM 2800h
External
27FFh
Reserved memory
EFFFh
F000h External
Reserved
on-chip ROM
F7FFh
F800h
Reserved
ROM
(bootloader)
FF7Fh
FF80h Reserved
ROM interrupts
FFFFh FFFF
Introduction 1-5
Functional Overview
The ’AC01 interfaces directly to the ’C542 TDM serial port. The ’AC01 generates
the required shift clock (SCLK) and frame sync (FS) pulses used to send data
to/from the ’AC01. These pulses are a function of software-programmable
registers and the ’AC01 master clock. The master clock is generated by the
on-board oscillator. See Chapter 4, Software Considerations, for instructions on
how to program the ’AC01 or see the TLC320AC01C Single-Supply Analog
Interface Circuit Data Manual.
The DSKplus board provides six headers, including an XDS510 emulator header,
to aid in the design of daughter boards. The XDS510 emulator header allows the
board to act as an XDS emulator target board with robust, nonintrusive de-
bugging capabilities. The XDS is the advanced emulator from TI available
through your local sales office.
R
The on-board 10-MHz oscillator provides a clock to the ’C542, the ’AC01, and the
PAL device. The ’C542 PLL option is set to 4, creating a 40-MHz internal clock
oscillator. The ’AC01 runs at 10 MHz. The ’AC01 data manual includes information
for operation at 10.368 MHz; the data from the ’AC01 tables and graphs must be
interpolated to 10 MHz.
1-6
Functional Overview
The DSKplus algebraic assembler converts the source file with a .asm exten-
sion to an object-based COFF file with a .obj extension. As a result, code ad-
dressing is fully resolved at assembly time using in-line assembler directives,
so there is no need for a linker stage. The code is ready to be loaded into the
DSP.
Introduction 1-7
1-8
Chapter 2
Before you use the DSKplus board, verify that your equipment meets the re-
quirements described in the previous chapter. Next, you must install the hard-
ware and the software on your PC.
This chapter provides instructions for connecting the DSKplus board, installing
the DSKplus software, and running the self-test program.
Topic Page
2-1
Connecting the DSKplus Board
6) Connect the 5-pin DIN-to-5.5-mm power supply adapter cable to the pow-
er supply’s 5-pin DIN connector.
7) Connect the 5.5-mm power supply adapter cable into the power supply
connector on the DSKplus board.
R
PAL DB25
Analog in
Analog out
TMS320C542
Printer cable
Power supply
5-V Power Power connector
supply supply
adapter
cable
Power
cord PC display for
software and
debugger
2-2
Installing the DSKplus Software
By default the installation program installs the software to the C:\DSKplus di-
rectory. If you like, change this directory when you are prompted to confirm the
destination directory.
After running the install program, a Windows program group icon appears called
Code Explorer. It has two program icons: Code Explorer and ’C54x Help. The ab-
solute assembler, application loader and self-test are not members of this group
because they are DOS programs and are accessed through the Windows DOS
shell.
To test the setup, click on the Code Explorer icon. The port dialog box appears,
as shown in Figure 2–2.
The debugger lists all available parallel ports in the dialog box. You may select
one of the ports listed or type in the desired port I/O address to override the
existing address. The correct port will start the debugger interface. See Sec-
tion 3.1, Code Explorer Debugger, page 3-2 for more information.
Provided you have properly installed the hardware and software, the Code Ex-
plorer debugger interface is displayed on your screen as shown in Figure 2–3.
If an error occurs when you attempt to start the debugger, it may be due to the
hardware setup. To test the hardware setup, run the self-test program.
2-4
Running the Self-Test Program
1) Port locator. Checks all parallel ports to determine which are connected
to the DSKplus board.
2) Continuity check. Checks for open data lines and shorts between data
lines.
3) PALR state machine test. Checks nibble mode functionality and the
PALR clock.
4) Latch mode test. Verifies that the latch mode of the PALR is operating
correctly, and brings the PALR out of 3-state mode.
6) HPIA verification. Checks the address in the HPI address register and
HPIA mode.
10) ’AC01 test. Performs ’AC01 register programming. Checks the analog fi-
nal output data via loopback mode.
To start the self-test, click on the DOS icon to access a DOS prompt and type:
SELFTEST.EXE
The testing script appears on the screen as shown in Figure 2–4 on page 2-6.
If any errors occur the execution is halted.
If an error occurs during the self-test, read the error script completely and con-
firm the following:
The system setup can be responsible for problems connecting to the DSKplus
board. For example, in Windows 95 the DSKplus software does not work if the
parallel port is being “captured” by Windows. You must go into the system set-
up and make sure the port is not captured. A common error is to have a printer
set up to print from DOS-based programs. This captures the port, making it in-
accessible to DSKplus applications.
2-6
Running the Self-Test Program
Accesses to the parallel port can vary in speed from machine to machine. The
self-test program ends with information of which you may want to take note if
you plan to write custom host PC applications. This information includes the
port base address, the operating mode (either 4-bit unidirectional or 8-bit bi-
directional) and additional CPU cycles needed for reading from the port. The
extra CPU cycles may be needed for reads, because the data lines become
valid after the RC time constant on the data lines. Self-test calculates how
many host PC CPU cycles are required.
The DSKplus lets you experiment with and use a DSP for real-time signal pro-
cessing. The DSKplus gives you the freedom to create your own software to
run on the board as is, or to build new boards and expand the system in a num-
ber of ways.
The DSKplus debugger works with the assembler and application loader to
help you develop, test, and refine DSKplus assembly language programs.
This chapter describes the features of the debugger and how to use the ap-
plication loader software.
Topic Page
3-1
Code Explorer Debugger
The disassembly window shows the DSP code and address location. The
location of the DSP program counter (PC) is highlighted by a yellow line over-
laying the code. The interface also supports symbolic debugging, which
makes debugging code much easier. You can reference locations in code and
code variables by the assembly name or label, so you do not need to know the
physical address. Breakpoints can be added or deleted by pointing and click-
ing on the instruction for the operation you would like to break. Disassembly
window properties can be changed using your menu and select buttons.
CPU registers
and bit fields
Symbolic
debugging
DSP peripheral
registers
Data memory
window
Note: Watch windows can be set up to watch variables, system stack, or any other memory location.
Files can be connected to probe points within your code.
3-2
Code Explorer Debugger
The CPU registers window allows you to view the internal registers and impor-
tant bit fields of the DSP. To change a value of a register, point and click on the
register and type in the new value.
The peripheral register window is like the CPU register window, except that it
includes only the registers that are used for the DSP peripherals, such as the
serial ports.
The data memory window is a default data memory window. The starting ad-
dress and length can be defined using your select button. Multiple data
memory windows can be displayed, allowing you to view any variable, such
as the system stack or assembly variables. Using the data memory window
properties screen you can rename the window to reflect the variable name.
The tool bar on top of the screen includes buttons for single-stepping, running,
and resetting the DSKplus board. These buttons allow you to step over or into
functions. The animation button supports a graphical representation of a
variable or buffer. The data can be viewed in either the time domain or the fre-
quency domain.
Code Explorer probe points are used to connect hard-disk drive files to points
within your application code. Once connected, these files can be used as in-
puts or outputs to your code. To set a probe point, position the cursor over the
instruction and click your right mouse button. To set/reset the probe point se-
lect toggle probe point. After the probe point is set, specific attributes must be
assigned in the probe point window.
This command loads appfile.obj to the DSP and begins executing the code at
label. The label must be a valid label in the assembly source files (.asm).
–px Forces the line printer (LPT) port to a specific number where x is
either 1, 2, or 3.
–e Specifies the starting location for execution in the DSP. The option
is followed by a space and a valid label or address. If you use an
address, it can be in either 0x0 or 0h format. Labels are case sensi-
tive.
After the code has been loaded, the system exits LoadApp and restores the
DOS prompt. The loader returns the PALR device to an uninitialized state, so
you must make sure you reinitialize the PALR device if you have a PC-based
application interfacing with the DSKplus board.
3-4
Chapter 4
Software Considerations
DSP code is the program you create and eventually load into the resident DSP
processor. To create DSP code, you must have an ASCII text editor and the
TMS320C54x DSP Reference Set, Volume 3: Algebraic Instruction Set. The
assembly source code you create in the editor must be assembled using the
’C54x DSKplus algebraic assembler. The algebraic assembler converts your
source code (.asm) file to machine code (.obj file) that only the DSP can use.
Host PC application code is a program you create with one of the many PC-
based C or C++ compilers. These compilers generate machine code for the
PC CPU (PC resident); this machine code will not run on the DSP. The debug-
ger, and application loader are perfect examples of executable PC code and
are used to load DSP code to the DSP CPU.
Normally, a DSP application begins with the creation of the DSP code, followed
by the creation of the host PC application code (if needed). This chapter de-
scribes software considerations you must make before creating DSP and/or
host PC application code for the ’C54x DSKplus board.
Topic Page
4-1
DSP Software
The DSKplus software includes a simple application that takes data from the
’AC01 and places it in a buffer. To view the source code, open the file named
firstapp.asm located in the firstapp subdirectory of the DSKplus software and
load it into your ASCII editor.
The source code contains two sections: .text and vectors. The .text section in-
cludes all of the executable code that gets data from the ’AC01 and places it
into the buffer. The second section, called vectors, contains the vector location
where the DSP should receive data from the ’AC01. Each time the ’AC01
transfers a data word to the DSP, the DSP goes to the vector for the serial port
interrupt service routine associated with the ’AC01.
By using the .setsect directive, you can set the code section to a particular ad-
dress and page. The .text section resides at 500h and the vectors section re-
sides at 180h, as shown in the file’s statements:
The page determines which memory space the section will be loaded to. The
page indicator is either 0 or 1, corresponding to program or data space, re-
spectively.
4-2
DSP Software
The .copy directive copies the source code from the file name enclosed in
double quotes. For the following code, shown in full on your PC editor screen it
copies vectors.asm into the vectors section and appends the ac01init.asm file
to the .text section. Therefore, the assembly source code actually contains
code from the three files: firstapp.asm, vectors.asm, and ac01init.asm.
.sect ”vectors”
.copy ”c:\dskplus\inits\vectors.asm”
start:
.text
<initialize DSP>
<wait>
XINT:
<interrupt service routine>
<return>
.copy ”C:\dskplus\inits\ac01init.asm”
The program begins at the label start, where it initializes the DSP and contin-
ues in a wait routine. The initialization routine must always set up the ’AC01(if
you plan to use it), the interrupt table pointer (IPTR), the stack pointer (SP), and
the interrupt mask register (IMR). In this code, the ar2 register is also initialized
to the beginning of the data buffer at 1200h. The interrupt mask bit (INTM) is
set to 0 when initialization is complete and the DSP is ready to receive data.
start:
call AC01INIT
pmst = #01a0h ; set up iptr
sp = #0ffah ; init stack pointer
ar2 = #1200h ; pointer to receive buffer
*ar2+ = data(#0bh) ; store to rcv buffer
imr = #280h
intm = 0 ; ready to rcv int’s
wait nop
goto wait
When the DSP receives an interrupt, it proceeds to the vectors section and
reads the vector location. The vector informs the DSP to go to the XINT sub-
routine (also known as the XINT interrupt service routine). As a result, the code
in the XINT routine is executed.
XINT:
b = trcv ; load acc b with input
b = #0FFFCh & b
*ar2+ = data(#0bh) ; store to rcv buffer
tdxr = b ; transmit the data.
TC = (@ar2 == #01280h)
if (TC) goto restrt ; stop if rcv buffer is at 1280h
return_enable
restrt
ar2 = #1200h
return_enable ; used only when not using
debugger
.end
The interrupt service routine gathers data and copies it to the data buffer and
transmits it back to the ’AC01 until the buffer is full. When the buffer is full, the
DSP enters the routine restrt and initializes the ar2 buffer pointer to 1200h to
begin again.
You can use the DSKplus algebraic assembler to assemble this code by typing
the following at a DOS prompt:
dskplasm c:\dskplus\firstapp\firstapp.asm –l
This creates a file firstapp.obj, which you can load into the debugger and ex-
amine. The data values received via the ’AC01 are loaded into the DSP buffer
at location 1200h.
4-4
DSP Programming Tips
1) The stack pointer (SP) must be initialized. Choose a memory location that
allows the SP to grow with your application.
2) The interrupt mask register (IMR) must always have the HPI interrupt en-
abled so that the debugger can communicate with the DSP’s communica-
tion kernel (IMR = 200h only if you are using the debugger or the loader).
4) Always have INT2 masked in the IMR register. The HINT pin is tied to INT2
to perform an HPI boot at power up. Enable this interrupt only if you want
the DSP to interrupt itself when the DSP sets the HINT bit in the HPIC.
Otherwise, keep it 0 in the IMR.
5) TRAP 2 is reserved for the kernel (only when using the debugger). There
are many software interrupts to choose from.
After compiling the hostapp.cpp source file, you can write a batch file to run the
DSP and host PC code simultaneously. First, load the DSP code into the DSP
memory using the LoadApp program, then start the hostapp.exe program. The
batch file would be similar to:
Be sure to reassemble firstapp.asm with instruction hpic = #0ah added into the
source file as follows:
restrt
ar2 = #1200h
hpic = #0ah
return_enable
By adding this line, the DSP generates a DSP-to-host interrupt when the buffer
is full. This is the same interrupt the debugger uses to communicate with
DSKplus board. Therefore, it cannot be used with the debugger software.
4-6
Host Programming Tips
The first three of these variables are used to set up the port number (pport), the
parallel port mode (portmode), and the delay for 8-bit reads (Readdelay). The
port number, pport, is 1, 2, or 3 to select the corresponding port; portmode is
either 0 or 1, to identify 4-bit or 8-bit mode, respectively. The Readdelay vari-
able is needed in cases where the host PC can read data from the data register
before it is validated from the DSKplus board. Readdelay is the value of PC
CPU cycles required before the information on the DSKplus data lines is valid.
The next three variables are the data, status, and control register addresses of
the three common parallel ports. The datareg is the data register where data is
loaded to and from the PC and DSKplus. The statreg is the status register and
is used by the host PC to read data in 4-bit mode and receive DSP-to-host in-
terrupts. The ctrlreg is the control register and is used to control the DSKplus
board via the host interface logic and send host-to-DSP interrupts.
See the C54XHIL.DOC file in the C54XHIL subdirectory for a complete refer-
ence list of the host interface library functions.
This chapter explains how to invoke the assembler and discusses source
statement format, valid constants and expressions, and assembler output.
Topic Page
- Produces a source listing (if requested) and provides you with control over
this listing. The section program counter (SPC) is the absolute address of
that opcode.
This assembler allows you to segment your code into sections and maintain an
SPC for each section of object code.
5-2
DSKplus Assembler Development Flow
Assembler
source
Absolute
object
files
’C54x
DSKplus
5-4
Naming Alternate Directories for Assembler Input
.copy ”filename”
.include ”filename”
The filename names a copy/include file that the assembler reads statements
from. The filename may be a complete pathname, a partial pathname, or a file-
name with no path information. The assembler searches for the file in the fol-
lowing location in the order listed:
1) The directory that contains the current source file; the current source file is
the file being assembled when the .copy or .include directive is encountered.
You can augment the assembler’s directory search algorithm by using the – i
assembler option or the A_DIR environment variable.
dskplasm –ipathname
You can use up to 10 – i options per invocation; each – i option names one path-
name. In assembly source, you can use the .copy or .include directive without
specifying path information. If the assembler doesn’t find the file in the direc-
tory that contains the current source file, it searches the paths designated by
the – i options.
For example, assume that a file called source.asm is in the current directory;
source.asm contains the following directive statement:
.copy ”copy.asm”
Assume that the file is stored in the directory
c:\320tools\files\copy.asm
Your assembly invocation is:
dskplasm –ic:\320tools\files\source.asm
The assembler first searches for copy.asm in the current directory because
source.asm is in the current directory. Then the assembler searches in the
directory named with the – i option.
5-6
Source Statement Format
if you use the .word directive to initialize several words, a label would point to
the first word. In the following example, the label Start has the value 40h.
. . . .
. . . .
. . . .
9 003F ; Assume some other code was assembled.
10 0040 000A Start: .word 0Ah,3,7
0041 0003
0042 0007
A label on a line by itself is a valid statement. The label assigns the current value
of the section program counter to the label; this is equivalent to the following
directive statement:
label .set $ ; $ provides the current value of the SPC.
When a label appears on a line by itself, it points to the instruction on the next
line (the SPC is not incremented):
3 0050 Here:
4 0050 0003 .word 3
5.5.3 Operands
An operand can be a constant (see Section 5.6, page 5-10), a symbol (see
Section 5.8, page 5-13), or a combination of constants and symbols in an
expression (see Section 5.9, page 5-15).
- Operand prefixes for instructions
The assembler allows you to specify that a constant, symbol, or expression
is used as an address, an immediate value, or an indirect value. The follow-
ing rules apply to the operands of instructions.
J # prefix — the operand is an immediate value. If you use the # sign
as a prefix, the assembler treats the operand as an immediate value.
This is true even when the operand is a register or an address; the
assembler treats the address as a value instead of using the contents
of the address. This is an example of an instruction that uses an oper-
and with the # prefix:
Label: B = B + #123
5-8
Source Statement Format
The immediate value mode uses the # character in front of the immediate
value and is primarily used with instructions. In some cases, it can also be
used with the operands of directives.
It is not usually necessary to use the immediate value mode for directives.
Compare the following statements:
A = A + #10
.byte 10
In the first statement, the immediate value mode is necessary to tell the
assembler to add the value 10 to accumulator A. In the second statement,
however, immediate value is not used; the assembler expects the operand
to be a value and initializes a byte with the value 10.
A comment can begin in any column and extends to the end of the source line.
A comment can contain any ASCII character, including blanks. Comments are
printed in the assembly source listing, but they do not affect the assembly.
5.6 Constants
The assembler supports six types of constants:
- Binary integer
- Octal integer
- Decimal integer
- Hexadecimal integer
- Character
- Assembly time
5-10
Constants
Note the difference between character constants and character strings (Sec-
tion 5.7, page 5-12, discusses character strings). A character constant repre-
sents a single integer value; a string is a list of characters.
You can also use the .set directive to assign symbolic constants for register
names. In this case, the symbol becomes a synonym for the register:
AuxR1 .set AR1
SP = AuxR1
5-12
Symbols
5.8 Symbols
Symbols are used as labels, constants, and substitution symbols. A symbol
name is a string of up to 32 alphanumeric characters (A–Z, a–z, 0–9, $, and _ ).
The first character in a symbol cannot be a number, and symbols cannot contain
embedded blanks. The symbols you define are case sensitive; for example, the
assembler recognizes ABC, Abc, and abc as three unique symbols. You can
override case sensitivity with the –c assembler option. A symbol is valid only
during the assembly in which it is defined.
5.8.1 Labels
Symbols used as labels become symbolic addresses associated with loca-
tions in the program. Labels used locally within a file must be unique. Opcodes
and assembler directive names (without the . prefix) are valid label names.
Labels can also be used as the operands of the .bss directive; for example:
.bss label1, 1
label2 NOP
B = B + @label1
goto label2
The assembler also has several predefined symbolic constants; these are
discussed in the next section.
dskplasm –dname=[value]
The name is the name of the symbol you want to define. The value is the value
you want to assign to the symbol. If the value is omitted, the symbol will be set
to 1.
Within assembler source, you may test the symbol with the following directives:
The argument to the $isdefed built-in function must be enclosed in quotes. The
quotes cause the argument to be interpreted literally rather than as a substitu-
tion symbol.
- $, the dollar sign character, represents the current value of the section
program counter (SPC).
5-14
Expressions
5.9 Expressions
An expression is a constant, a symbol, or a series of constants and symbols sepa-
rated by arithmetic operators. The range of valid expression values is –32 768 to
32 767. Three main factors influence the order of expression evaluation:
5.9.1 Operators
< <= > >= Less than, LT or equal, greater than, Left to right
GT or equal
Note: Unary +, –, and * have higher precedence than the binary forms.
The assembler checks for overflow and underflow conditions when arithmetic
operations are performed at assembly time. It issues a Value Truncated warning
whenever an overflow or underflow occurs. The assembler does not check for
overflow or underflow in multiplication.
1000h+X
5-16
Expressions
= Equal to == Equal to
!= Not equal to
< Less than <= Less than or equal to
> Greater than >= Greater than or equal to
A source listing shows source statements and the object code they produce.
To obtain a listing file, invoke the assembler with the –l (lowercase L) option.
Two banner lines, a blank line, and a title line are at the top of each source listing
page. Any title supplied by a .title directive is printed on the title line; a page number
is printed to the right of the title. If you don’t use the .title directive, the name of the
source file is printed. The assembler inserts a blank line below the title line.
A source statement produces at least one word of object code. The assembler
lists the SPC value and object code on a separate line for each word of object
code produced. Each additional line is listed immediately following the source
statement line. Each line in the source file produces a line in the listing file that
shows a source statement number, an SPC value, the object code assembled,
and the source statement.
Line Number
The assembler may precede a line number with a letter; the letter in-
dicates that the line is assembled from an included file.
The assembler may precede a line number with a number; the number
indicates the nesting level of loop blocks.
This field contains the section program counter (SPC) value, which is
hexadecimal. All sections (.text, .data, .bss, and named sections) main-
tain separate SPCs. Some directives do not affect the SPC and leave
this field blank. Each section’s SPC value can be initialized using section-
address initializers ( that is, .setsect ”section name”).
5-18
Source Listings
Example 5–1 shows an assembler listing with each of the four fields identified.
1
2
4 .setsect ”vecs”, 080h
5 .setsect ”.text”, 0500h
6 .setsect ”.bss”, 0600h
7 ***********************************************************
8 * Reserve space for a variable *
9 ***********************************************************
10 000600 .bss reserve, 1
11 ***********************************************************
12 * Reset and Interrupt Vectors
13 ***********************************************************
14 000080 .sect ”vecs”
15 000080 F073 RESET: goto main
000081 0104
16 000082 F073 NMI: goto NOPS
000083 0100
17 ***********************************************************
18 * Main Program
19 ***********************************************************
20 .copy ”4nops.inc”
A 1 000500 .text
A 2 000500 F495 NOPS: nop ; NOPS function begins here
A 3 000501 F495 nop
A 4 000502 F495 nop
A 5 000503 F495 nop
A 6
21 000504 771D main PMST = #00a0h
000505 00A0
22 : : :
: : :
Assembler directives supply data to the program and control the assembly
process. Assembler directives enable you to do the following:
Note:
Any source statement that contains a directive may also contain a label and
a comment. Labels begin in the first column (and they are the only item al-
lowed to appear in the first column) and all comments are preceded by a
semicolon or an asterisk. To improve readability, labels and comments are
not shown as part of the directive syntax.
.setsect ”section name”, address [, page] Initialize the section’s absolute address. C-29
symbol .usect ”section name”, size in words Reserve size words in a named (uninitialized) section. C-35
[, alignment ]
5-20
DSKplus Assembler Directives
.bes size in bits Reserve size bits in the current section; a label points to C-31
the last addressable word in the reserved space.
.byte value1 [, ... , valuen ] Initialize one or more successive bytes in the current C-5
section.
.float value [, ... , valuen ] Initialize one or more 32-bit, IEEE single-precision, C-16
floating-point constants.
.int value1 [, ... , valuen ] Initialize one or more 16-bit integers. C-19
.long value1 [, ... , valuen ] Initialize one or more 32-bit integers. C-23
.space size in bits Reserve size bits in the current section; a label points to C-31
the beginning of the reserved space.
.string ”string1 ” [, ... , ”stringn ”] Initialize one or more text strings. C-32
.pstring ”string1 ” [, ... , ”stringn ”] Initialize one or more text strings (packed). C-32
.xfloat value1 [, ...,valuen ] Initialize one or more 32-bit integers, IEEE single-precision, C-16
floating-point constants, but does not align the result on the
long word boundary.
.xlong value1 [, ...,valuen ] Initialize one or more 32-bit integers, but do not align on C-23
long word boundary.
.word value1 [, ... , valuen ] Initialize one or more 16-bit integers. C-19
.length page length Set the page length of the source listing. C-20
.width page width Set the page width of the source listing. C-20
.else well-defined expression Assemble code block if the .if condition is false. The .else C-17
construct is optional.
.elseif well-defined expression Assemble code block if the .if condition is false and the C-17
.elseif condition is true. The .elseif construct is optional.
.if well-defined expression Assemble code block if the condition is true. C-17
5-22
DSKplus Assembler Directives
- .data identifies portions of code in the .data section. The .data section
usually contains initialized data.
- .setsect initializes the section program counter (SPC) to a value that cor-
responds to the absolute address of the section.
- .text identifies portions of code in the .text section. The .text section usually
contains executable code.
Example 5–2 shows how you can use sections directives to associate code
and data with the proper sections. This is an output listing; column 1 shows line
numbers, and column 2 shows the SPC values. (Each section has its own pro-
gram counter, or SPC.) When code is first placed in a section, its SPC equals
0. When you resume assembling into a section after other code is assembled,
the section’s SPC resumes counting as if there had been no intervening code.
The .bss and .usect directives do not end the current section or begin new sections;
they reserve the specified amount of space, and then the assembler resumes
assembling code or data into the current section.
5-24
DSKplus Assembler Directives
- The .bes and .space directives reserve a specified number of bits in the
current section. The assembler fills these reserved bits with 0s.
You can reserve a specified number of words by multiplying the number of
bits by 16.
J When you use a label with .space, it points to the first word that
contains reserved bits.
J When you use a label with .bes, it points to the last word that contains
reserved bits.
Figure 5–2 shows the .space and .bes directives. Assume the following
code has been assembled for this example:
1
2 ** .space and .bes directives
3
4 0000 0100 .word 100h, 200h
0001 0200
5 0002 Res_1: .space 17
6 0004 000f .word 15
7 0006 Res_2: .bes 20
8 0007 00ba .byte 0BAh
Res_1 points to the first word in the space reserved by .space. Res_2
points to the last word in the space reserved by .bes.
Res_1 = 02h
17 bits
reserved
20 bits
reserved
Res_2 = 06h
- .byte places one or more 8-bit values into consecutive words of the current
section. This directive is similar to .word, except that the width of each
value is restricted to eight bits.
- The .field directive places a single value into a specified number of bits
in the current word. With .field, you can pack multiple fields into a single
word; the assembler does not increment the SPC until a word is filled.
Figure 5–3 shows how fields are packed into a word. For this example,
assume the following code has been assembled; the SPC doesn’t change for
the first three fields (the fields are packed into the same word):
4 0000 6000 .field 3, 3
5 0000 6400 .field 8, 6
6 0000 6440 .field 16, 5
7 0001 0123 .field 01234h,20
0002 4000
8 0003 0000 .field 01234h,32
0004 1234
3 bits
15 12 11 10 9 8 7 0
.field 8,6
0 1 1 0 0 1 0 0 0
6 bits
15 6 5 4 3 2 0
0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 .field 16,5
5 bits
15
0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 .field 01234h,20
15
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
15
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .field 01234h,32
15
0 0 0 1 0 0 1 0 0 0 1 1 0 1 0 0
5-26
DSKplus Assembler Directives
- .int and .word place one or more 16-bit values into consecutive words in
the current section.
- .long and .xlong place 32-bit values into consecutive 2-word blocks in the
current section. The most significant word is stored first. The .long directive
automatically aligns to a long word boundary, and the .xlong directive does not.
- .string and .pstring place 8-bit characters from one or more character
strings into the current section. The .string directive is similar to .byte, placing
an 8-bit character in each consecutive word of the current section. The .pstring
also has a width of eight bits but packs two characters into a word. For .pstring,
the last word in a string is padded with null characters (0) if necessary.
Figure 5–4 compares the .byte, .int, .long, .xlong, .float, .xfloat, .word, and
.string directives. For this example, assume that the following code has been
assembled:
1 0000 00aa .byte 0AAh, 0BBh
0001 00bb
2 0002 0ccc .word 0CCCh
3 0003 0eee .xlong 0EEEEFFFh
0004 efff
4 0006 eeee .long 0EEEEFFFFh
0007 ffff
5 0008 dddd .int 0DDDDh
6 0009 3fff .xfloat 1.99999
000a ffac
7 000c 3fff .float 1.99999
000d ffac
8 000e 0068 .string ”help”
000f 0065
0010 006c
0011 0070
2 0 C C C .word OCCCh
3, 4 0 E E E E F F F .xlong 0EEEEFFFh
6, 7 E E E E F F F F .long EEEEFFFFh
8 D D D D .int DDDDh
9, a 3 F F F F F A C .xfloat 1.99999
c, d 3 F F F F F A C .float 1.99999
e, f 0 0 6 8 0 0 6 5 .string ”help”
h e
10, 11 0 0 6 C 0 0 7 0
l p
5-28
DSKplus Assembler Directives
The .align directive aligns the SPC at a 1-word to 128-word boundary. This
ensures that the code following the directive begins on an x-word or page
boundary. If the SPC is already aligned at the selected boundary, it is not
incremented. Operands for the .align directive must equal a power of 2
between 20 and 216 (although alignments beyond 27 are not meaningful). For
example:
The .align directive with no operands defaults to 128, that is, to a page boundary.
Figure 5–5 demonstrates the .align directive. Assume that the following code
has been assembled:
1 0000 4000 .field 2, 3
2 0000 4160 .field 11, 8
3 .align 2
4 0002 0045 .string ”Errorcnt”
0003 0072
0004 0072
0005 006f
0006 0072
0007 0063
0008 006e
0009 0074
5 .align
6 0100 0004 .byte 4
- The .length directive controls the page length of the listing file. You can
use this directive to adjust listings for various output devices.
- The .list and .nolist directives turn the output listing on and off. You can
use the .nolist directive to stop the assembler from printing selected
source statements in the listing file. Use the .list directive to turn the listing
on again.
- The .title directive supplies a title that the assembler prints at the top of
each page.
- The .width directive controls the page width of the listing file. You can use
this directive to adjust listings for various output devices.
- The .if /.elseif /.else /.endif directives tell the assembler to conditionally
assemble a block of code according to the evaluation of an expression.
5-30
DSKplus Assembler Directives
The assembler supports several relational operators that are useful for condi-
tional expressions. For more information about relational operators, see sub-
section 5.9.4, page 5-17.
- The .set and .equ directives set a constant value to a symbol. The symbol
is stored in the symbol table and cannot be redefined. For example:
bval .set 0100h
.byte bval, bval*2, bval+12
goto #bval
The .set and .equ directives produce no object code. The two directives
are identical and can be used interchangeably.
Hardware
Topic Page
6-1
Power and Cables
The cable is a straight DB25M-to-DB25F connection. Please use the cable in-
cluded in the kit. If for some reason the cable needs to be replaced, it is recom-
mended that the cable be high quality and not exceed 6 feet in length. Below is
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
a pin description of the typical DB25 connector and its connection to DSKplus.
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Table 6–1. DB25 Connector Pin Connections
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Pin Name Connection Description
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
1
ÁÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
STROBE HR/W
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Controls HR/W of the host port interface (HPI) and the direction of
the bidirectional buffer, and resets the NBL state machine (STROBE = 0)
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
2 D0 HD0 Bit 0 (LSB) data line; controls MODE and TRIST in latch mode
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
3
ÁÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
D1 HD1
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Bit 1 data line; controls LS mode and RESET in latch mode
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
4 D2 HD2 Bit 2 data line
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
5 D3 HD3 Bit 3 data line
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
6
ÁÁÁÁÁ
ÁÁÁÁÁ
7
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
D4 HD4
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
D5 HD5
Bit 4 data line
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
8
ÁÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
D6 HD6 Bit 6 data line
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
9 D7 HD7 Bit 7 (MSB) data line
6-2
Power and Cables
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Table 6–1. DB25 Connector Pin Connections (Continued)
ÁÁÁÁÁ
ÁÁÁÁÁ
Pin
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Name Connection Description
ÁÁÁÁÁ
ÁÁÁÁÁ
10
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ACK
ÁÁÁÁ
HD2 or HD6
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
(NBL)
Bits 2 and 6 when reading from status register in nibble mode
ÁÁÁÁÁ
ÁÁÁÁÁ
11
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
BUSY
ÁÁÁÁ
HD3 or HD7
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
(NBL)
Bits 3 and 7 when reading from status register in nibble mode
ÁÁÁÁÁ
ÁÁÁÁÁ
12
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
PE
ÁÁÁÁ
HD1 or HD5
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
(NBL)
Bits 1 and 5 when reading from status register in nibble mode
ÁÁÁÁÁ
ÁÁÁÁÁ
13
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
SLCT
ÁÁÁÁ
HD0 or HD4
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
(NBL)
Bits 0 and 4 when reading from status register in nibble mode
ÁÁÁÁÁ
ÁÁÁÁÁ
14
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
AUTOFD
ÁÁÁÁ
HCNTL0
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
Controls HCNTL0 of the HPI
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
15 ERROR HINT DSP-to-host interrupt signal
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
16 INIT BYTE Controls HBIL of the ’C54x HPI and is low for first transfer, high for se-
cond, low for third, and high for fourth (nibble mode). There are only two
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ
17
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
SLCTIN HCNTL1
transfers when operating in byte mode.
Controls HCNTL1 of the HPI and which latch is selected in latch mode
ÁÁÁÁÁ
ÁÁÁÁÁ
ÁÁÁÁÁ ÁÁÁÁ
ÁÁÁÁÁ
18-25 ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
ÁÁÁÁ
ÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁÁ
GND ground
Hardware 6-3
DSKplus Communications Protocol
Today’s high-end computers often use enhanced parallel ports and extended
capabilities ports, called EPP and ECP, respectively. These are much more
complex; they provide a multiplexed data and address scheme across the
eight data lines and they use a completely different protocol for communica-
tions. However, these ports support standard compatibility by default, which
is 8-bit bidirectional.
The DSKplus does not support the EPP and EPC extended capabilities.
The parallel port’s registers are located in the PC’s data memory. You must use
a 100% IBM/AT-compatible computer to eliminate any parallel port specification
discrepancies. Compatible PCs use the following port addresses:
Don’t get confused by the port number and the LPT designator. The LPTx can
change due to other peripherals connected to your PC. When running custom
applications, always take note of available ports by their addresses.
6-4
DSKplus Communications Protocol
Hardware 6-5
DSKplus Communications Protocol
Bit 5 This bit controls the direction of the parallel port data lines. Writ-
ing to this bit in 4-bit unidirectional ports has no effect.
Bit 4 This bit enables the PC interrupt when ACK in the status register
is set. This bit is always loaded with zero.
Bit 3 Controls the hardware to set/reset the CNTL1 signal
Bit 2 Controls the hardware reset (inverted BYTE signal)
Bit 1 Controls the hardware to set/reset the CNTL0 signal
Bit 0 Controls the hardware to set/reset the RNW signal. When you are
setting bit 0, be sure to set bit 5 appropriately.
6-6
Using a PALR Device
D1
D0
IN
CNTL1 Strobe
generator
CNTL0 INV STRB STRB
Latch select
D Q LS
LOAD
D Q MODE
LOAD
D Q RESET
LOAD
(Output enable)
D Q TRIST
LOAD
Hardware 6-7
Using a PALR Device
Upon power up of the DSKplus board, the PALR device is reset and all D-latches
are set to 0, driving TRIST low, MODE low, and RESET low. TRIST is the 3-state
controller that places the output pins in the high-impedance state when TRIST
is low. Therefore, at power up, the PALR device is in the high-impedance state
and STROBE, HBIL, and RESET output values have no effect. Loading the
PALR device TRIST latch with a 1 drives RESET, STROBE, and HBIL. Once out
of the high-impedance state, the DSP is placed in reset and the DSKplus board
operates in nibble mode.
The host PC reads its data register twice to complete the 16-bit read when
MODE = 1. The host must read the status register four times to complete a
16-bit read when MODE = 0.
During a read or write access to the HPI, both bytes (high and low) must be
accessed to complete the HPI read/write cycle. Always perform a complete
16-bit read/write. See the TMS320C54x DSP Reference Set, Volume 1: CPU and
Peripherals, for more information about the HPI.
6-8
Using a PALR Device
PAL
CLK
BYTE† 1 2 3 4
STRB
RNW
HBIL
NBL 1st high nibble 1st low nibble 2nd low nibble 2nd high nibble
† BYTE cycle time corresponds to the speed at which the host PC can write to the BYTE location in the PC’s port
control register.
Hardware 6-9
Using a PALR Device
Figure 6–6 is the disabled state machine functional diagram. When the state
machine is disabled (MODE = 1) or when it is not selected (RNW is low), HBIL
mimics the BYTE signal.
HBIL
NBL
6-10
Using a PALR Device
11 Unused
The levels of the data lines propagate to the respective output pins in real time.
To load the data into the latch, load the host data register first, then enter the
correct CNTL1 and CNTL0 levels and return to the neutral state to latch in the
data. You must return to the neutral state after loading the data to the latch to
allow the loading of the data register before performing another load. Also, re-
turning to the neutral state avoids transient states of the CNTL1 and CNTL0
lines. Transient states occur when attempting to change the two signal levels
at the same time. For example, if the current states of CNTL1 and CNTL0 are
high and low (equivalent to 1 and 0) and a load of the PC control register
changes the states to low and high (01), the bits may not change exactly at the
same time, generating erroneous states 00 or 11. Because both of these states
are neutral in the factory-programmed PALR device, there is no concern. How-
ever, if the state 11 is used in a customized PALR device, transient states may
have adverse effects. Always return to the neutral state to be safe.
To disable the LS mode, reset the LS latch to 0 by writing a 0x0000 to the HPIC.
At this point, the data latches are loaded and DSP/PC communications oper-
ate normally. The HPIC BOB bit = 0; therefore, the byte ordering is least signifi-
cant byte first. There are PC-based C functions that perform this task automati-
cally.
Refer to the host interface library C54XHIL on your DSKplus diskette for more
information about using the PALR device. This library includes all of the com-
munication software needed to run application code on your PC. Remember
that when you are running host PC applications, usually you will be unable to
use the debugger.
Hardware 6-11
PALR Device Modifications
The PALR device can be modified by reprogramming a 28-pin PLCC 22V10 device
and placing it into the socket. All pins of the PALR device are accessible though
the JP headers. When modifying the PALR device, keep in mind the pin connec-
tions listed:
- Pin 1. No connection
- Pin 2. PAL R device CLK input
- Pin 3. Connected to the PC’s D0 data line; cannot be disconnected from
the HPI data lines
- Pin 4. Connected to the PC’s D1 data line; cannot be disconnected from
the HPI data lines
- Pin 5. Connected to the PC’s CNTL1 line; can be disconnected from the
host by removing the series resistor, but cannot be disconnected from the
HPI’s HCNTL1 signal
- Pin 6. Connected to the PC’s BYTE line; can be disconnected from the
host by removing the series resistor, but cannot be disconnected from the
HPI’s HBIL signal
- Pin 7. Connected to the PC’s CNTL0 line; can be disconnected from the
host by removing the series resistor, but cannot be disconnected from the
HPI’s HCNTL0 signal
- Pin 8. No connection
- Pin 9. Connected to the host PC’s RNW line; can be disconnected from
the host by removing the series resistor, but cannot be disconnected from
the HPI’s HR/W signal
- R R
Pin 10. Used for an asynchronous PAL device reset; forces PAL device
into 3-state mode by pulling this pin low (the pin is high for normal opera-
tion)
- Pin 11. General-purpose; input only
- Pin 12. General-purpose; input only
6-12
PALR Device Modifications
-
R R
Pin 19. Used to create a strobe signal. The strobe signal is delayed by one
PAL device CLK cycle and has a one PAL device CLK cycle duration,
R
required to satisfy the tsu(HAD) and tw(HDSl) HPI timings. There is sufficient
guardband to accomodate an increase in the PAL clock rate.
- Pin 20. Connected to the output enable (OE) of the bidirectional buffer
(74245). This pin is used to set the outputs of the bidirectional buffer to the
high-impedance state, for lower power consumption, or to allow an external
device control of the DSP HPI data lines.
- Pin 23. Connected to the DSP HDS2 pin and cannot be disconnected. If
R
using an external strobe via the JP4 (pin 25) header, be sure pin 23 of the
PAL device is in the 3-state mode.
- Pin 24. Connected to the DSP reset pin (RS) and cannot be disconnected.
R
If you are using an external reset line via the JP4 (pin 2) header, be sure
pin 24 of the PAL device is in 3-state mode. The reset LED (D2) is con-
nected to this pin.
- Pin 25. Connected to the DSP HBIL pin and cannot be disconnected. If
R
you are using an external HBIL line via the JP1 (pin 31) header, be sure
pin 25 of the PAL device is in 3-state mode.
- Pin 26. NBL; selects which nibble is used by the 74257 multiplexer; can
be used as a general-purpose pin if the host PC has an 8-bit bidirectional
port
- Pin 27. Mode latch; can be used as a general-purpose pin if the host PC
has an 8-bit bidirectional port. This pin is also pulled high to disable the
74257 multiplexer. When pin 27 is high, additional external status/data,
etc., lines can be connected to be available in the host PC’s status register.
Hardware 6-13
Connecting
Connecting Boards
Boards to Headers / Connecting the XDS510 Emulator Port
The XDS510 emulator port is the JP2 header on the DSKplus board. To con-
nect the XDS510 pod and cable, you must first solder a 7 2 header to the
header on the board. The emulator connector is keyed at pin 6, so you must
use wire cutters to cut off pin 6 of the soldered JP2 header.
Once the XDS510 header has been installed, turn off the power to the DSKplus
board, connect the XDS510 emulator to the board, and turn the power back
on. You do not need to disconnect the parallel port from the DSKplus board.
You can use the host printer port to cycle the reset line and to generate HPI
interrupts, etc. Additionally, by using the XDS510 emulator, debugging is less
intrusive and much more powerful. The XDS510 emulator debugs the ’C54x
DSP via the JTAG emulator port allowing you to debug applications that in-
volve the host port interface.
If you are controlling the reset line externally, be sure the PALR device is in
3-state mode (TRISTATE is low). The PALR device can be placed in the high-
impedance state mode by loading the TRIST latch with 0 (if TRISTATE is low,
RESET is in the high-impedance state).
6-14
Chapter 7
Initialization Routines
The chapter describes how to initialize each of the devices on the DSKplus
board and the PC’s parallel port.
The first three elements form part of the communications link and the remain-
ing two elements are DSP peripherals.
Topic Page
7-1
Communication Link (CommLink) Initialization
7-2
Serial Port and TLC320AC01 Initialization
Code for performing the initialization of the serial port and the ’AC01 is included
in the PERIPHS directory of the DSKplus software.
Note:
If you wish to use the DSP’s on-chip peripherals in your own applications,
your code must perform the appropriate peripheral initializations.
Perform the peripheral initialization by loading and running the following DSP
code:
XF = 0 /* Force the AC01 to reset state */
TSPC = #0008h /* Store 8h to the TDM serial port cotrl reg */
TSPC = #00C8h /* Store C8h to the TDM serial port ctrl reg */
CALL AC01INIT /* Call the AC01 init routine */
The first store to the TSPC stops the serial port from operating by resetting the
XRST and RRST bits each to 0. The second store to the TSPC configures the
serial port to receive the CLKX and CLKR clock signals externally (MCM = 0)
and configures FSR and FSX to receive the frame sync pulses externally
(TXM = 0). As a result of the second store to the TSPC, the serial port begins
operating, dependent upon external clock and frame sync pulses.
Note:
The ’AC01 is configured to generate the CLKX, CLR, FSX, and FSR signals.
Do not program the DSP serial port to generate these signals. Always store
#00C8h to the TSPC as the second store.
The CALL statement calls the function AC01INIT to initialize the ’AC01 regis-
ters. By default, the ’AC01 begins operating with a sampling rate of 15.4 kHz.
By programming the internal ’AC01 registers, sampling rates can be changed
quickly and easily. See the TLC320AC01C Single-Supply Analog Interface
Circuit Data Manual for more information about programming the ’AC01.
The AC01INIT routine is located in the PERIPHS directory of the DSKplus soft-
ware. Normally, this routine is included as one of the first operation in the DSP’s
application source code. The PERIPHS directory also includes initialization
routines for all of the peripherals of the TMS320C542. Your DSP software does
not need to initialize peripherals that it does not use.
7-4
Appendix
AppendixAA
This appendix contains the circuit board dimensions shown in Figure A–1 and
the schematic diagram shown in Figure A–2 for the TMS320C54x DSKplus.
A-1
7-2
4.920
P1
JP6
JP4 U3
R37
C19 C31
R62
R43 R48
2.200
C33 C35 D2
IN
J2
U5 L1
J3
2.350
2.500
U1
OUT
R36
U6 DSP
PTC C34 TMS320C542
C22
C32 C26
R34
R35
U2
J1 R54 R53 R46 R45
C24
JP1 JP3
R39
C29
JP2
3.800
0.150
4.445
VCC
R1 R2 R3 R4
470 470 470 470
P1
R13 330
1
HRNW
14
HCNTL0
2
R14 330 R17 100
15
HINT
3
R15 330
16
BYTE
4
R16 330
17
HCNTL1
5
18
6
19 C1 C2 C3 C4 C17
7 220pf 220pf 220pf 220pf 220pf
20
8
21
9 270 GND
R5
22
BD0
10
R6 270
23
BD1
11
R7 270
24
BD2
12
R8 270
25
BD3
13
R9 270
BD4
DB25–F R10 270
BD5
R11 270
BD6
R12 270
BD7
R18 100
ACK
R19 100
/BUSY
R20 100
PE
R21 100
SLCT
150pf 150pf 150pf 150pf 150pf 150pf 150pf 150pf 220pf 220pf 220pf 220pf
GND
A-3
Schematic Diagram of DSKplus Circuit Board
Figure A–2. Schematic Diagram of DSKplus Circuit Board (Continued)
A-4
VCC
L1
INDUCTOR
R27
2K
C18
R26 R25 R23 R22 R24
.1UF 10K 10k 10K 10K 10K
D2
LED
GND Yellow
JP6
1 2
3 4
5 6
7 8
TIBPAL22V10ACFN 9 10
R44
11 12
(SOCKETED PLCC) 4.7K
13 14
U3
2 28 HEADER 7X2
MCLK CLK VDD
11 20
NC BUFEN
16 27
NC MODE
13 21
NC LB
Schematic Diagram of DSKplus Circuit Board
12 19
NC DLY1
7 18
HCNTL0 CNTL0 POL
5 17
HCNTL1 CNTL1 TRIST
4 25
HD1 HBIL HBIL
3 26
HD0 NBL
9 23
HRNW RNW STRB HDS2
6 24
BYTE BYTE RESET RESET\
10
N N N N /RST
C C C C
2 1
8 1 2 5
U1
11 9
BD0 B8 A8 HD0
12 8 GND
BD1 B7 A7 HD1
13 7
BD2 B6 A6 HD2
14 6
BD3 B5 A5 HD3
15 5
BD4 B4 A4 HD4
16 4
BD5 B3 A3 HD5
17 3
BD6 B2 A2 HD6
18 2
BD7 B1 A1 HD7
19
G
1
DIR
74ACT245
U2
2 4
1A 1Y SLCT
3
1B
5 7
2A 2Y PE
6
2B
11 9
3A 3Y ACK
10
3B
14 12
4A 4Y /BUSY
13
4B
15
G
1
A/B
74HCT257
Figure A–2. Schematic Diagram of DSKplus Circuit Board (Continued)
VCC VCC
A[0..15]
C20 A A A A A A A A A A A A A A A A
R29 R30 R31 R32 R33 C19 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1
10K 10K 10K 10K 10K .1UF .1UF 0 1 2 3 4 5
D[0..15]
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
GND 3 5 7 0 3 1 GND 1 1 5 6 9 2 4 3 3 3 3 3 3 3 3 4 4 1 1 U5
4 3 6 5 5 0 2 2 6 2 8 1 5 2 1 2 3 4 6 7 8 9 0 1 5 7 8 9 0 1
V V V V V V V C C C C C C C A A A A A A A A A A A A A A A A
99 D0
D D D D D D D V V V V V V V 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 D0
64 D D D D D D D D D D D D D D 0 1 2 3 4 5 100 D1
INT0\ INT0 D1
65 D D D D D D D 101 D2
INT1\ INT1 D2
66 102 D3
INT2\ INT2 D3
67 103 D4
INT3\ INT3 D4
63 104 D5
NMI\ NMI D5
98 113 D6
RESET\ RS D6
61 114 D7
IACK\ IACK D7
18 115 D8
HRNW HRNW D8
17 116 D9
HCS\ HCS D9
51 117 D10
HINT HINT D10
46 118 D11
HCNTL1 HCNLT1 D11
127 119 D12
HDS1 HDS1 D12
39 121 D13
HCNTL0 HCNTL0 D13
129 122 D14
HDS2 HDS2 D14
92 123 D15
HPIENA HPIENA D15
62
HBIL HBIL
55 22
HRDY HRDY IS IS\
13 20
HAS\ HAS PS PS\
58 TMS320C542 DSP 21
HD0 HD0 DS DS\
69 23
HD1 HD1 R/W R/W
81 24
HD2 HD2 MSTRB MSTRB\
95 PLLX4 (OPTION 2) 25
HD3 HD3 IOSTRB IOSTRB\
120 19
HD4 HD4 READY READY
124 30
HD5 HD5 HOLD HOLD\
135 29
HD6 HD6 IAQ IAQ\
6 28
HD7 HD7 HOLDA HOLDA\
59 26
BDX BDX MSC MSC\
41
BCLKR BCLKR
45 27
BDR BDR XF XF
43 31
BFSR BFSR BIO BIO\
48 82
BCLKX BCLKX TOUT TOUT
53
BFSX BFSX
94 83
CLKOUT CLKOUT EMU0 EMU0
42 84
TCLKR TCLKR EMU1/OFF EMU1
49 85
TCLKX TCLKX TDO TDO
44 86
TFSR TFSR/TADD TDI TDI
54 87 VCC
TFSX TFSX/TFRM C C C TRST TRST\
47 88
TDR TDR M L L L TCK TCK
60 C C C C C C C C C C C C P K K K 89
TDX TDX TMS TMS
96 V V V V V V V V V V V V V V V V V V V V V V V V C / M M M
X1 N
97 S S S S S S S S S S S S S S S S S S S S S S S S M D D D
CLKIN X2/CLKIN S S S S S S S S S S S S S S S S S S S S S S S S T C 3 2 1 R34 R35
10K 10K
1 3 3 5 7 7 9 1 1 1 1 3 4 5 7 7 9 1 1 1 1 1 8 3 7 7 7
1 3 5 4 7 0 0 3 0 0 1 2 4 6 0 7 2 6 3 0 0 1 2 4 0 2 9 8 7
R28 9 1 6 6 8 1 8 4
CLKMD1
33 CLKMD2
3 CLKMD3
MP/MC\
U4
C
L
K SOCKETED R36 R37
GND
A-5
Schematic Diagram of DSKplus Circuit Board
Figure A–2. Schematic Diagram of DSKplus Circuit Board (Continued)
A-6
VCC
VCC
R56 R57
10 10
C35
4.7UF
R55 R59
C33 R60
C32
R51 R52 4.7UF GND
10K 33K 8
10K 10K 510 .22UF
U7A
J2 3
R63
1
CLKIN
IN JACK 2
0
GND
TLC2272C
U6
11 26
TDR DOUT IN+
10 25
TDX DIN IN–
12 28
TFSX FS AUXIN+ AUX+
14 27 GND
MCLK MCLK AUXIN– AUX–
13 1
TCLKX SCLK MONOUT MONOUT
Schematic Diagram of DSKplus Circuit Board
17 4 R61 C38
FSD\ FSD OUT– OUT–
19 3 10K 220pf
EOC OUT+ OUT+
18 5
M/S\ M/S DACVDD
15 6
FC0 DACMID U7B
16 7 6
FC1 DACGND
2 24 7
PWRDWN\ PWRDWN ADCVDD
8 23 5
XF RESET ADCMID
21 22
SUBS ADCGND TLC2272C
9
DVDD
20
DGND 8
TLC320AC01CFN
C30 C31
.1UF .1UF
GND GND
R53
TFSR
C34 J3
33
GND
Figure A–2. Schematic Diagram of DSKplus Circuit Board (Continued)
VCC
D[0..15]
VCC
R38 R39
4.7K 4.7K
R45 R46
10K 10K
JP2
JP3
TMS 1 2 TRST\
1 3
TDI 3 4
4 6
5 6 PIN 6 (Key) READY
7 9
TDO 7 8 BIO\
10 12 D3
9 10
13 15 D5
TCK 11 12
16 18 D7
EMU0 13 14 EMU1
19 21 D9
XDS510 HEADER 22 24 D11
25 27 D13
28 30 D15
31 33
/BUSY SLCT
D1 34 36
ACK
2 R47 33
CLKOUT
R40 R41 R48 R42 5
HOLD\
10K 10K 0 10K 8
MP/MC\
11 D2
14 D4
17 D6
JP4 20 D8
1 3 23 D10
4 6 26 D12
HRNW IAQ\
7 9 29 D14
HRDY HOLDA\
10 12 32
PE
13 15 35 D0
HCS\
16 18
CLKMD3 CLKMD2
19 21 HEADER 12X3
22 24
HPIENA
25 27
HDS2
28 30
HDS1 R/W
31 33
HAS\ IS\
34 36
IOSTRB\
2
RESET\
5
IACK\
R43 8
XF
11
0 14
17
CLKMD1
20
23
MSC\
26
MSTRB\
29
PS\
32
DS\
35
HEADER 12X3
A-7
Schematic Diagram of DSKplus Circuit Board
Figure A–2. Schematic Diagram of DSKplus Circuit Board (Continued)
A-8
HD[0..7] R49
VCC
0
JP5
1 3
INT0\ HINT
4 6
INT2\
JP1 7 9
NMI\ CLKIN
HD0 1 3 10 12
FSD\
HD1 4 6 A14 13 15
HD2 7 9 A12 16 18
PWRDWN\
HD3 10 12 A10 19 21
AUX+
HD4 13 15 A8 22 24
AUX–
HD5 16 18 A6 25 27
HD6 19 21 A4 28 30
TCLKR
HD7 22 24 A2 31 33
TCLKX
25 27 A0 34 36
HCNTL0 TFSR
28 30 2
HCNTL1 TFSX INT1\
31 33 5
TDR INT3\
34 36 8
HBIL TDX MCLK
2 11
M/S\
5 14 A15
OUT–
8 17 A13
OUT+
11 20 A11
MONOUT
14 23 A9
BCLKR
17 26 A7
BCLKX
20 29 A5
BFSR
Schematic Diagram of DSKplus Circuit Board
23 32 A3
BFSX
26 35 A1
BDR
29
BDX
32 VCC HEADER 12X3
35
TOUT
A[0..15]
HEADER 12X3
GND
GND
J1
Power Jack
PTC
3 1
VCC
JUMPER
VCC
GND
D1
GREEN
LED
C21 C22 C23 C24 C25 C26 C27 C28 R50
2K
.1UF .1UF .1UF .1UF .1UF .1UF .1UF .1UF
GND
Appendix
AppendixBA
PAL Equations
Included here are the PALR equations and associated test vectors for the
factory default PALR device with a brief functional description for each equa-
tion:
RESET Controls the DSP reset line. This latch is reset and set with !HD1
(inverted HD1 level). It is loaded only when LS = 1 and
CNTL(0,1) = 1 0.
MODE Determines how the HPI will interface to the PC. If MODE = 0,
the PC parallel port functions in 4-bit mode. If MODE = 1, the
parallel port functions in 8-bit mode. When MODE = 1, the 74257
mutiplexer is disabled, since 8-bit bidirectional data can be read
from the data register and the multiplexer is not needed. MODE
can be loaded only when LS = 1 and CNTL(0,1) = 1 0.
BUFEN These 4-bit port data lines cannot be turned off or reversed. This
logic is used to disable the bidirectional buffer when performing
a read in 4-bit mode. By doing so, the parallel port and
bidirectional buffer will never drive into each other. The series
resistors can tolerate this but will cause data lines to be very
noisy in some cases. BUFEN is also disabled when TRIST = 0
and MODE = 1.
NBL Selects which four bits of the byte are received into the parallel
ports status register. Two BYTE cycles must be performed to
receive a byte and four BYTE cycles must be performed to
receive a 16-bit word. NBL is only active during a 4-bit read.
Writes are always eight bits.
B-1
PAL Equations
DLY1 Creates the 1-cycle delay in the synchronous delay line. The
1-cycle (100-ns) delay is used to conform to the HPI setup
timings for the HBIL, CNTL(0,1),and HR/W signals.
STRB This latch is the second stage of the synchronous delay line.
This creates a 1-cycle (100-ns) strobe signal. During the HPI
read, the HPI is strobed on the falling edge of STRB (connected
to HDS2). The data remains on the data lines only while
STRB= 0. During an HPI write the HPI data is read in on the
rising edge of STRB. The polarity of this signal is controlled by
the POL latch.
POL Reverses the polarity of the STRB signal to keep the data on the
data lines during the BYTE cycle (HPI READS only). This allows
the relatively slow PC to read the data from the data register and
keeps the data on the data lines for the duration of the BYTE
cycle.
B-2
PAL Equations
”Inputs
Clk pin 2 ; ”clock input
HD0 pin 3 ; ”HPI data line 0
HD1 pin 4 ; ”HPI data line 1
CNTL1 pin 5 ; ”HPI HCNTL1 input
BYTE pin 6 ; ”Byte indicator
CNTL0 pin 7 ; ”HPI HCNTL0 input
RNW pin 9 ; ”HPI RW indicator
RST pin 10 ; ”PALR async reset
”Outputs
POL pin 18 ; ”Strobe Polarity controller
TRIST pin 17 ; ”tri–state controller
DLY1 pin 19 ; ”delay state machine bit
BUFEN pin 20; ; ”Bi–directional buffer enabler
LS pin 21 ; ”Latch select mode
STRB pin 23 ; ”Strobe output
RESET pin 24 ; ”DSP reset pin
HBIL pin 25 ; ”Synced BYTE, HPI byte indicator
NBL pin 26 ; ”Nibble selector (4-bit mode)
MODE pin 27 ; ”Mode latch output
RD,WR,H,L = 1,0,1,0;
[POL,TRIST,LS,NBL,HBIL,DLY1,STRB,RESET,MODE].clk = Clk;
[STRB, RESET, HBIL].oe = TRIST;
[POL,NBL,HBIL,TRIST,LS,RESET,MODE].ar= !RST;
HBIL := ((!NBL & !BYTE) # (HBIL & BYTE)) & (!MODE # RNW)
# (BYTE & (MODE # !RNW));
DLY1 := HBIL;
B-4
PAL Equations
end
B-6
Appendix
AppendixCA
Assembler directives supply program data and control the assembly process.
They allow you to do the following:
This appendix is a detailed reference for all of the DSkplus assembler direc-
tives. Each directive is described individually including syntax and examples,,
and the directives are presented in alphabetical order. Generally, the direc-
tives are organized, one directive per page; however, related directives
(such as .if /.else/.endif) are presented together on one page. Following is an
alphabetical table of contents for the directives reference:
Directive Page Directive Page
.align . . . . . . . . . . . . . . . . . . . . . . . . C-2 .length . . . . . . . . . . . . . . . . . . . . . . C-20
.bes . . . . . . . . . . . . . . . . . . . . . . . . C-31 .list . . . . . . . . . . . . . . . . . . . . . . . . . C-21
.break . . . . . . . . . . . . . . . . . . . . . . C-24 .long . . . . . . . . . . . . . . . . . . . . . . . . C-23
.bss . . . . . . . . . . . . . . . . . . . . . . . . . C-3 .loop . . . . . . . . . . . . . . . . . . . . . . . . C-24
.byte . . . . . . . . . . . . . . . . . . . . . . . . . C-5 .nolist . . . . . . . . . . . . . . . . . . . . . . . C-21
.copy . . . . . . . . . . . . . . . . . . . . . . . . C-6 .page . . . . . . . . . . . . . . . . . . . . . . . C-25
.data . . . . . . . . . . . . . . . . . . . . . . . . . C-9 .pstring . . . . . . . . . . . . . . . . . . . . . . C-32
.else . . . . . . . . . . . . . . . . . . . . . . . . C-17 .sect . . . . . . . . . . . . . . . . . . . . . . . . C-26
.elseif . . . . . . . . . . . . . . . . . . . . . . . C-17 .setsect . . . . . . . . . . . . . . . . C29, C-30
.end . . . . . . . . . . . . . . . . . . . . . . . . C-10 .set . . . . . . . . . . . . . . . . . . . . . . . . . C-27
.endif . . . . . . . . . . . . . . . . . . . . . . . C-17 .space . . . . . . . . . . . . . . . . . . . . . . C-31
.endloop . . . . . . . . . . . . . . . . . . . . C-24 .string . . . . . . . . . . . . . . . . . . . . . . . C-32
.equ . . . . . . . . . . . . . . . . . . . . . . . . C-27 .text . . . . . . . . . . . . . . . . . . . . . . . . C-33
.eval . . . . . . . . . . . . . . . . . . . . . . . . C-11 .title . . . . . . . . . . . . . . . . . . . . . . . . C-34
.field . . . . . . . . . . . . . . . . . . . . . . . . C-13 .usect . . . . . . . . . . . . . . . . . . . . . . . C-35
.float . . . . . . . . . . . . . . . . . . . . . . . . C-16 .width . . . . . . . . . . . . . . . . . . . . . . . C-20
.if . . . . . . . . . . . . . . . . . . . . . . . . . . C-17 .word . . . . . . . . . . . . . . . . . . . . . . . C-19
.include . . . . . . . . . . . . . . . . . . . . . . C-6 .xfloat . . . . . . . . . . . . . . . . . . . . . . . C-16
.int. . . . . . . . . . . . . . . . . . . . . . . . . . C-19 .xlong . . . . . . . . . . . . . . . . . . . . . . . C-23
Description The .align directive aligns the section program counter (SPC) on the next
boundary, depending on the size in words parameter. The size may be any
power of 2, although only certain values are useful for alignment. An operand
of 128 aligns the SPC on the next page boundary, and this is the default if no
size is given. The assembler assembles words containing null values (0) up
to the next x-word boundary.
Operand of 1 aligns SPC to word boundary
2 aligns SPC to long word / even boundary
128 aligns SPC to page boundary
The assembler aligns the SPC on an x-word boundary within the current sec-
tion.
Example This example shows several types of alignment, including .align 2, .align 4, and
a default .align.
1 0000 0004 .byte 4
2 .align 2
3 0002 0045 .string ”Errorcnt”
0003 0072
0004 0072
0005 006F
0006 0072
0007 0063
0008 006E
0009 0074
4 .align
5 0080 6000 .field 3,3
6 0080 6A00 .field 5,4
7 .align 2
8 0082 6000 .field 3,3
9 .align 8
10 0088 5000 .field 5,4
11 .align
12 0100 0004 .byte 4
C-2
Reserve Space in the .bss Section .bss
Description The .bss directive reserves space for variables in the .bss section. This directive
is usually used to allocate variables in RAM.
symbol points to the first location reserved by this invocation of the
.usect directive. The symbol corresponds to the name of
the variable for which you’re reserving space.
size in words is an expression that defines the number of words that are
reserved in section name.
alignment is an optional parameter. This flag causes the assembler
to allocate size on long word boundaries.
The assembler follows one rule when it allocates space in the .bss section:
Whenever a hole is left in memory, the .bss directive attempts to fill it. When a
.bss directive is assembled, the assembler searches its list of holes left by
previous .bss directives and tries to allocate the current block into one of the
holes.
Section directives for initialized sections (.text, .data, and .sect) end the current
section and begin assembling into another section. The .bss directive, however,
does not affect the current section. The assembler assembles the .bss directive
and then resumes assembling code into the current section.
Example In this example, the .bss directive is used to allocate space for two variables,
TEMP and ARRAY. The symbol TEMP points to 4 words of uninitialized space
(at .bss SPC = 550h). The symbol ARRAY points to 100 words of uninitialized
space (at .bss SPC = 554h); this space must be allocated contiguously within
a page. Note that symbols declared with the .bss directive can be referenced
in the same manner as other symbols.
1 .setsect ”.text”, 0500h
2 .setsect ”.bss”, 0550h
3 *********************************************************
4 * Start Assembling into .text section *
5 *********************************************************
6 000500 .text
7 000500 E800 A = #0
8
9 *********************************************************
10 * Allocate 4 words in .bss for TEMP *
11 *********************************************************
12 000550 Var_1: .bss TEMP,4
13
14 *********************************************************
15 * Still in .text section *
16 *********************************************************
17 000501 F000 A = A + #56h
000502 0056
18 000503 F066 A = T * #73h
000504 0073
19
20 **********************************************************
21 * Allocate 100 words in .bss for the symbol named ARRAY *
22 **********************************************************
23 000554 .bss ARRAY,100
24
25 **********************************************************
26 * Assemble more code into .text section *
27 **********************************************************
28 000505 8050 @Var_1 = A
29 .end
C-4
Initialize Bytes .byte
Description The .byte directive places one or more bytes into consecutive words of the current
section. Each byte is placed in a word by itself; the eight LSBs are filled with
0s. A value can be either of the following:
Values are not packed or sign extended; each byte occupies the eight least
significant bits of a full 16-bit word. The assembler truncates values greater than
eight bits. You can use up to 100 value parameters, but the total line length can-
not exceed 200 characters.
If you use a label, it points to the location where the assembler places the first
byte.
Example In this example 8-bit values—10, –1, abc, and a—are placed into consecutive
words in memory. The label STRX has the value 100h, which is the location
of the first initialized word.
1 0000 .space 100h * 16
2 0100 000a STRX .byte 10, –1, ”abc”, ’a’
0101 00ff
0102 0061
0103 0062
0104 0063
0105 0061
Description The .copy and .include directives tell the assembler to read source statements
from a different file. The statements that are assembled from a copy file are
printed in the assembly listing. The statements that are assembled from an
included file are not printed in the assembly listing, regardless of the number of
.list/.nolist directives assembled. The assembler:
3) Resumes assembling statements in the main source file, starting with the
statement that follows the .copy or .include directive.
The .copy and .include directives can be nested within a file being copied or
included. The assembler limits nesting to ten levels; the host operating system
may set additional restrictions. The assembler precedes the line numbers of
copied files with a letter code to identify the level of copying. An A indicates the
first copied file, B indicates a second copied file, etc..
C-6
Copy Source File .copy/.include
Example 1 In this example, the .copy directive is used to read and assemble source state-
ments from other files; then the assembler resumes assembling into the current file.
The original file, copy.asm, contains a .copy statement copying the file
byte.asm. When copy.asm assembles, the assembler copies byte.asm into its
place in the listing (note listing below). The copy file byte.asm contains a .copy
statement for a second file, word.asm.
When it encounters the .copy statement for word.asm, the assembler switches
to word.asm to continue copying and assembling. Then the assembler returns
to its place in byte.asm to continue copying and assembling. After completing
assembly of byte.asm, the assembler returns to copy.asm to assemble its
remaining statement.
Listing file:
1 0000 .space 29
2 .copy ”byte.asm”
A 1 ** In byte.asm
A 2 0002 0020 .byte 32,1+ ’A’
0003 0042
A 3 .copy ”word.asm”
B 1 * In word.asm
B 2 0004 ABC .word 0ABCDh, 56q
0005 002
A 4 ** Back in byte.asm
A 5 0006 006 .byte 67h + 3q
3
4 ** Back in original file
5 0007 646F .pstring ”done”
0008 6E65
Example 2 In this example, the .include directive is used to read and assemble source
statements from other files; then the assembler resumes assembling into the
current file. The mechanism is similar to the .copy directive, except that state-
ments are not printed in the listing file.
Listing file:
1 0000 .space 29
2 .include ”byte2.asm”
3
4 ** Back in original file
5 0007 0064 .string ”done”
0008 006F
0009 006E
000a 0065
C-8
Assemble into .data Section .data
Syntax .data
Description The .data directive tells the assembler to begin assembling source code into
the .data section; .data becomes the current section. The .data section is nor-
mally used to contain tables of data or preinitialized variables.
The assembler assumes that .text is the default section. Therefore, at the
beginning of an assembly, the assembler assembles code into the .text section
unless you use a section control directive.
Example In this example, code is assembled into the .data and .text sections.
1 ***********************************************
2 ** Reserve space in .data. **
3 ***********************************************
4 0000 . data
5 0000 .space 0CCh
6
7 ***********************************************
8 ** Assemble into .text. **
9 ***********************************************
10 0000 .text
; constant into .data.
11 0000 INDEX .set 0
12 0000 e800 A = #INDEX
13
14 ***********************************************
15 ** Assemble into .data. **
16 ***********************************************
17 000d Table: .data
18 000d ffff .word –1 ; Assemble 16–bit
19
20 000e 00ff .byte 0FFh ; Assemble 8–bit
21 ; constant into .data.
22
23 ***********************************************
24 ** Assemble into .text. **
25 ***********************************************
26 0001 .text
27 0001 000d A = A + @Table
28
29 ***********************************************
30 ** Resume assembling into the .data section **
31 ** at address 0Fh. **
32 ***********************************************
33 000f .data
Syntax .end
Description The .end directive is optional and terminates assembly. It should be the last
source statement of a program. The assembler ignores any source statements
that follow a .end directive.
This directive has the same effect as an end-of-file character. You can use .end
when you’re debugging and would like to stop assembling at a specific point
in your code.
Example This example shows how the .end directive terminates assembly. If any source
statements follow the .end directive, the assembler ignores them.
Source File:
START: .space 300
TEMP .set 15
.bss LOC1, 48h
A = |A|
A = A + #TEMP
@LOC1 = A
.end
.byte 4
.word CCCh
Listing file:
1 0000 START: .space 300
2 000F TEMP .set 15
3 0000 .bss LOC1, 48h
4 0013 F485 A = |A|
5 0014 F000 A = A + #TEMP
0015 000F
6 0016 8000 @LOC1 = A
7 .end
C-10
Assign Character Strings to Substitution Symbols .eval
Description The .eval directive performs arithmetic on substitution symbols, which are
stored in the substitution symbol table. This directive evaluates the expression
and assigns the string value of the result to the substitution symbol. The .eval
directive is especially useful as a counter in .loop/.endloop blocks.
well-defined is an alphanumeric expression consisting of legal values that
expression have been previously defined.
substitution is a required parameter that must be a valid symbol name.
symbol The substitution symbol may be 32 characters long and
must begin with a letter. Remaining characters of the sym-
bol can be a combination of alphanumeric characters,
underscores, and dollar signs.
C-12
Initialize Field .field
Description The .field directive can initialize multiple-bit fields within a single word of
memory. This directive has two operands:
value is a required parameter; it is an expression that is eva-
luated and placed in the field.
size is an optional parameter; it specifies a number from 1 to
32, which is the number of bits in the field. If you do not
specify a size, the assembler assumes that the size is 16
bits. If you specify a size of 16 or more, the field will start
on a word boundary. If you specify a value that cannot fit
into size bits, the assembler truncates the value and
issues an error message. For example, .field 3,1 causes
the assembler to truncate the value 3 to 1; the assembler
also prints the message:
Successive .field directives pack values into the specified number of bits start-
ing at the current word. Fields are packed starting at the most significant part
of the word, moving toward the least significant part as more fields are added.
If the assembler encounters a field size that does not fit into the current word,
it writes out the word, increments the SPC, and begins packing fields into the
next word. You can use the .align directive with an operand of 1 to force the
next .field directive to begin packing into a new word.
If you use a label, it points to the word that contains the specified field.
Example This example shows how fields are packed into a word. Notice that the SPC
does not change until a word is filled and the next word is begun. For more
examples of the .field directive, see page 5-26.
1 ************************************
2 ** Initialize a 14–bit field. **
3 ************************************
4 0000 2AF0 .field 0ABCh, 14
5
6 ************************************
7 ** Initialize a 5–bit field **
8 ** in a new word. **
9 ************************************
10 0001 5000 L_F: .field 0Ah, 5
11
12 ***********************************
13 ** Initialize a 4–bit field **
14 ** in the same word. **
15 ************************************
16 0001 5600 x : .field 0Ch, 4
17
18 ************************************
19 ** 16–bit relocatable field **
20 ** in the next word. **
21 ************************************
22 0002 0001 .field x
23
24 ************************************
25 ** Initialize a 32–bit field. **
26 ************************************
27 0003 0000 .field 04321h, 32
0004 4321
C-14
Initialize Field .field
Figure C–1 shows how the directives in this example affect memory.
14-bit field
1 0 1 0 1 0
5-bit field
4-bit field
0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 .field x
(d) 1
2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .field 04321,32
(e) 3
4 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1
Description The .float and .xfloat directives place the floating-point representation of one
or more floating-point constants into the current section. The value must be a
floating-point constant or a symbol that has been equated to a floating-point
constant. Each constant is converted to a floating-point value in IEEE single-
precision 32-bit format. Floating point constants are aligned on the long-word
boundaries unless the .xfloat directive is used. The .xfloat directive performs
the same function as the .float directive but does not align the result on the long
word boundary.
Field Meaning
s A 1-bit sign field
f A 23-bit fraction
The value is stored most significant word first, least significant word second,
in the following format:
31 30 23 22 0
s e f
C-16
Assemble Conditional Blocks .if/.elseif/.else/.endif
The .if directive marks the beginning of a conditional block. The well-defined
expression is a required parameter.
The .elseif directive identifies a block of code to be assembled when the .if
expression is false (0) and the .elseif expression is true (nonzero). When the
.elseif expression is false, the assembler continues to the next .elseif (if pres-
ent), .else (if present) or .endif (if no .elseif or .else is present). The .elseif
directive is optional in the conditional blocks, and more than one .elseif can be
used. If an expression is false and there is no .elseif statement, the assembler
continues with the code that follows a .else (if present) or a .endif.
The .else directive identifies a block of code that the assembler assembles
when the .if expression and all .elseif expressions are false (0). This directive
is optional in the conditional block; if an expression is false and there is no .else
statement, the assembler continues with the code that follows the .endif.
The .elseif and .else directives can be used in the same conditional assembly
block and the .elseif directive can be used more than once within a conditional
assembly block.
For information about relational operators, see subsection 5.9.4, page 5-17.
C-18
Initialize 16-bit Integer .int/.word
Description The .int and .word directives are equivalent; they place one or more values
into consecutive 16-bit fields in the current section.
You can use as many values as fit on a single line. If you use a label, it points
to the first word that is initialized.
Example 4 In this example, the .word directive is used to initialize words. The symbol
WordX points to the first word that is reserved.
1 0000 0C80 WORDX: .word 3200, 1 + ’AB’, –0AFh, ’X’
0001 4143
0002 FF51
0003 0058
Description The .length directive sets the page length of the output listing file. It affects the
current and following pages. You can reset the page length with another
.length directive.
The .width directive sets the page width of the output listing file. It affects the
next line assembled and the lines following; you can reset the page width with
another .width directive.
The width refers to a full line in a listing file; the line counter value, SPC value,
and object code are counted as part of the width of a line. Comments and other
portions of a source statement that extend beyond the page width are truncated
in the listing.
The assembler does not list the .width and .length directives.
Example In this example, the page length and width are changed.
***************************************************
** Page length = 65 lines. **
** Page width = 85 characters. **
***************************************************
.length 65
.width 85
***************************************************
** Page length = 55 lines. **
** Page width = 100 characters. **
***************************************************
.length 55
.width 100
C-20
Start/Stop Source Listing .list/.nolist
Syntax .list
.nolist
Description Two directives enable you to control the printing of the source listing:
The .nolist directive suppresses the source listing output until a .list directive
is encountered. The .nolist directive can be used to reduce assembly time and
the source listing size.
The assembler does not print the .list or .nolist directives or the source statements
that appear after a .nolist directive. However, it continues to increment the line
counter. You can nest the .list/.nolist directives; each .nolist needs a matching .list
to restore the listing.
By default, the source listing is printed to the listing file; the assembler acts as
if the .list directive had been specified.
Note:
If you don’t request a listing file when you invoke the assembler, the assembler
ignores the .list directive.
Example This example shows how the .copy directive inserts source statements from
another file. The first time this directive is encountered, the assembler lists the
copied source lines in the listing file. The second time this directive is encoun-
tered, the assembler does not list the copied source lines, because a .nolist
directive was assembled. The .nolist, the second .copy, and the .list directives
do not appear in the listing file. Also, the line counter is incremented, even
when source statements are not listed.
Source file:
.copy ”copy2.asm”
* Back in original file
NOP
.nolist
.copy ”copy2.asm”
.list
* Back in original file
.string ”Done”
Listing file:
1 .copy ”copy2.asm”
A 1 * In copy2.asm (copy file)
A 2 0000 0020 .word 32, 1 + ’A’
0001 0042
2 * Back in original file
3 0002 F495 NOP
7 * Back in original file
8 0005 0044 .string ”Done”
0006 006F
0007 006E
0008 0065
C-22
Initialize Long Word .long/.xlong
Description The .long and .xlong directives place one or more 32-bit values into consecutive
words in the current section. The most significant word is stored first. The .long
directive aligns the result on the long word boundary, while the .xlong directive
does not.
You can use up to 100 values, but they must fit on a single source statement
line. If you use a label, it points to the first word that is initialized.
Example This example shows how the .long and .xlong directives initialize double words.
1 0000 0000 DAT1: .long 0ABCDh, ’A’ + 100h, ’g’, ’o’
0001 ABCD
0002 0000
0003 0141
0004 0000
0005 0067
0006 0000
0007 006F
2 0008 0000 .xlong DAT1, 0AABBCCDDh
0009 0000
000a AABB
000b CCDD
3 000c DAT2:
The .loop directive begins a repeatable block of code. The optional expression
evaluates to the loop count (the number of loops to be performed). If there is no
expression, the loop count defaults to 1024, unless the assembler first encounters
a .break directive with an expression that is true (nonzero) or omitted.
The .break directive is optional, along with its expression. When the expression
is false (0), the loop continues. When the expression is true (nonzero), or
omitted, the assembler breaks the loop and assembles the code after the
.endloop directive.
Example This example illustrates how these directives can be used with the .eval directive.
1 .eval 0,x
2 COEF .loop
3 .word x*100
4 .eval x+1, x
5 .break x = 6
6 .endloop
1 0000 0000 .word 0*100
1 .eval 0+1, x
1 .break 1 = 6
1 0001 0064 .word 1*100
1 .eval 1+1, x
1 .break 2 = 6
1 0002 00C8 .word 2*100
1 .eval 2+1, x
1 .break 3 = 6
1 0003 012C .word 3*100
1 .eval 3+1, x
1 .break 4 = 6
1 0004 0190 .word 4*100
1 .eval 4+1, x
1 .break 5 = 6
1 0005 01F4 .word 5*100
1 .eval 5+1, x
1 .break 6 = 6
C-24
Eject Page in Listing .page
Syntax .page
Description The .page directive produces a page eject in the listing file. The .page directive
is not printed in the source listing, but the assembler increments the line
counter when it encounters it. Using the .page directive to divide the source
listing into logical divisions improves program readability.
Example This example shows how the page directive causes the assembler to begin a
new page of the source listing.
Source file:
.title ”**** Page Directive Example ****”
; .
; .
; .
.page
Listing file:
TMS320C54x DSKplus Assembler Version x.xx Sun Apr 23 13:06:08 1995
Copyright (c) 1996 Texas Instruments Incorporated
**** Page Directive Example **** PAGE 1
2 ; .
3 ; .
4 ; .
TMS320C54x DSKplus Assembler Version x.xx Sun Apr 23 13:06:08 1995
Copyright (c) 1996 Texas Instruments Incorporated
**** Page Directive Example **** PAGE 2
Description The .sect directive defines a named section that can be used like the default
.text and .data sections. The .sect directive begins assembling source code
into the named section.
The section name identifies a section that the assembler assembles code into. The
name is significant to eight characters and must be enclosed in double quotes.
Example This example defines two special-purpose sections, Sym_Defs and Vars, and
assembles code into them.
1 **********************************************
2 ** Begin assembling into .text section. **
3 **********************************************
4 0000 .text
5 0000 E878 A = #78h ; Assembled into .text
6 0001 F000 A = A + #36h ; Assembled into .text
0002 0036
7 **********************************************
8 ** Begin assembling into Sym_Defs section. **
9 **********************************************
10 0000 .sect ”Sym_Defs”
11 0000 3D4C .float 0.05 ; Assembled into Sym_Defs
0001 CCCD
12 0002 00AA X: .word 0AAh ; Assembled into Sym_Defs
13 0003 F000 A = A + #X ; Assembled into Sym_Defs
0004 0002
14 **********************************************
15 ** Begin assembling into Vars section. **
16 **********************************************
17 0000 .sect ”Vars”
18 0010 WORD_LEN .set 16
19 0020 DWORD_LEN .set WORD_LEN * 2
20 0008 BYTE_LEN .set WORD_LEN / 2
21 **********************************************
22 ** Resume assembling into .text section. **
23 **********************************************
24 0003 .text
25 0003 F000 A = A + #42h ; Assembled into .text
0004 0042
26 0005 0003 .byte 3, 4 ; Assembled into .text
0006 0004
27 **********************************************
28 ** Resume assembling into Vars section. **
29 **********************************************
30 0000 .sect ”Vars”
31 0000 000D .field 13, WORD_LEN
32 0001 0A00 .field 0Ah, BYTE_LEN
33 0002 0000 .field 10q, DWORD_LEN
0003 0008
34
C-26
Define Assembly-Time Constant .set / .equ
Description The .set and .equ directives equate a constant value to a symbol. The symbol
can then be used in place of a value in assembly source. This allows you to
equate meaningful names with constants and other values.
symbol points to the first location reserved by this invocation of the
.usect directive. The symbol corresponds to the name of
the variable for which you’re reserving space.
value must be a well-defined expression; that is, all symbols in
the expression must be previously defined in the current
source module.
Undefined external symbols and symbols that are defined later in the module
cannot be used in the expression. If the expression is relocatable, the symbol
to which it is assigned is also relocatable.
The value of the expression appears in the object field of the listing. This value
is not part of the actual object code and is not written to the output file.
Symbols defined with .set can be made externally visible with the .def or .global
directive. In this way, you can define global absolute constants.
Example This example shows how symbols can be assigned with .set and .equ.
1 **********************************************
2 ** Equate symbol AUX_R1 to register AR1 **
3 ** and use it instead of the register. **
4 **********************************************
5 0011 AUX_R1 .set AR1
6 0000 7711 MMR(AUX_R1) = #56h
0001 0056
7
8 **********************************************
9 ** Set symbol index to an integer expr. **
10 ** and use it as an immediate operand. **
11 **********************************************
12 0035 INDEX .equ 100/2 +3
13 0002 F000 A = A + #INDEX
0003 0035
14
15 **********************************************
16 ** Set symbol SYMTAB to a relocatable expr. **
17 ** and use it as a relocatable operand. **
18 **********************************************
19 0004 000A LABEL .word 10
20 0005 SYMTAB .set LABEL + 1
21
22 **********************************************
23 ** Set symbol NSYMS equal to the symbol **
24 ** INDEX and use it as you would INDEX. **
25 **********************************************
26 0035 NSYMS .set INDEX
27 0005 0035 .word NSYMS
C-28
Set Section Physical Address .setsect
Description The .setsect directive initializes the absolute address of the named section. The
.setsect directive must be specified before the declaration of a section (.bss,
.text, etc.) or the section program counter (SPC) begins to assemble code into
the section’s default address (0).
section name can be either a section directive such as .text or .bss. If
section name is an initialized or uninitialized named sec-
tion, such as .sect or .usect, the actual name is used to ref-
erence the section (see the following example).
address specifies the beginning address of the section specified as
the section name. The assembler maintains each section
counter of the assembly program.
page specifies where the section resides in memory. Page 0 is pro-
gram memory and page 1 is data. You can force the program
memory to be loaded to data space by specifying page = 1
in the page field. The same applies for data memory being
loaded to program space.
Example This example shows how symbols can be assigned with .setsect.
1 .setsect ”.text”, 0500h
2 .setsect ”.bss”, 0550h
3 .setsect ”Vectors”, 080h
4 **************************************************************
5 * Start Assembling into .text section *
6 **************************************************************
7 000500 .text
8 000500 E800 A = #0
9
10 **************************************************************
11 * Allocate 4 words in .bss for TEMP *
12 **************************************************************
13 000550 Var_1: .bss TEMP,4
14
15 **************************************************************
16 * Still in .text section *
17 **************************************************************
18 000501 F000 A = A + #56h
000502 0056
19 000503 F066 A = T * #73h
000504 0073
20
21 **************************************************************
22 * Assemble into the Vectors section *
23 **************************************************************
24 000080 .sect ”Vectors”
25 000080 F4EB RESET return_enable
26 000081 .space (3*16)
27 000084 F4EB NMI: return_enable
28
29 **************************************************************
30 * Assemble more code into .text section *
31 **************************************************************
32 000505 .text
33 000505 8050 @Var_1 = A
34 .end
C-30
Reserve Space .space/.bes
Description The .space and .bes directives reserve size number of bits in the current section
and fill them with 0s.
When you use a label with the .space directive, it points to the first word reserved.
When you use a label with the .bes directive, it points to the last word reserved.
Example This example shows how memory is reserved with the .space and .bes directives.
1 *********************************************
2 ** Begin assembling into .text section. **
3 *********************************************
4 0000 .text
5
6 *********************************************
7 ** Reserve 0F0 bits (15 words) in the **
8 ** .text section. **
9 *********************************************
10 0000 .space 0F0h
11 000f 0100 .word 100h, 200h
0010 0200
12 *********************************************
13 ** Begin assembling into .data section. **
14 *********************************************
15 0000 .data
16 0000 0049 .string ”In .data”
0001 006E
0002 0020
0003 002E
0004 0064
0005 0061
0006 0074
0007 0061
17 *********************************************
18 ** Reserve 100 bits in the .data section; **
19 ** RES_1 points to the first word that **
20 ** contains reserved bits. **
21 *********************************************
22 0008 RES_1: .space 100
23 000f 000F .word 15
24 0010 0008 .word RES_1
25
26 *********************************************
27 ** Reserve 20 bits in the .data section; **
28 ** RES_2 points to the last word that **
29 ** contains reserved bits. **
30 *********************************************
31 0012 RES_2: .bes 20
32 0013 0036 .word 36h
33 0014 0012 .word RES_2
Description The .string and .pstring directives place 8-bit characters from a character
string into the current section. With the .string directive, each 8 bit character
has its own 16-bit word, but with the .pstring directive, the data is packed so
that each word contains two 8-bit bytes. Each string is either:
With .pstring, values are packed into words starting with the most significant
byte of the word. Any unused space is padded with null bytes.
The assembler truncates any values that are greater than eight bits. You may
have up to 100 operands, but they must fit on a single source statement line.
If you use a label, it points to the location of the first word that is initialized.
Example This example shows 8-bit values placed into words in the current section.
1 0000 0041 Str_Ptr: .string ”ABCD”
0001 0042
0002 0043
0003 0044
2 0004 0041 .string 41h, 42h, 43h, 44h
0005 0042
0006 0043
0007 0044
3 0008 4175 .pstring ”Austin”, ”Houston”
0009 7374
000a 696E
000b 486F
000c 7573
000d 746F
000e 6E00
4 000f 0030 .string 36 + 12
C-32
Assemble into .text Sections .text
Syntax .text
Description The .text directive tells the assembler to begin assembling into the .text section,
which usually contains executable code. The section program counter is set to the
address specified by the preceding .setsect directive if nothing has yet been
assembled into the .text section. If code has already been assembled into the .text
section, the section program counter is restored to its previous value in the section.
Example This example assembles code into the .text and .data sections. The .data section
contains integer constants, and the .text section contains character strings.
1 *****************************************
2 ** Begin assembling into .data section.**
3 *****************************************
4 0000 .data
5 0000 000a .byte 0Ah, 0Bh
0001 000b
6
7 ******************************************
8 ** Begin assembling into .text section. **
9 ******************************************
10 0000 .text
11 0000 0041 START: .string ”A”,”B”,”C”
0001 0042
0002 0043
12 0003 0058 END: .string ”X”,”Y”,”Z”
0004 0059
0005 005a
13
14 0006 0000 A = A + @START
15 0007 0003 A = A + @END
16
17 *******************************************
18 ** Resume assembling into .data section.**
19 *******************************************
20 0002 .data
21 0002 000c .byte 0Ch, 0Dh
0003 000d
22
23 *******************************************
24 ** Resume assembling into .text section.**
25 *******************************************
26 0008 .text
27 0008 0051 .string ”Quit”
0009 0075
000a 0069
000b 0074
Description The .title directive supplies a title that is printed in the heading on each listing page.
The source statement itself is not printed, but the line counter is incremented.
The assembler prints the title on the page that follows the directive, and on sub-
sequent pages until another .title directive is processed. If you want a title on
the first page, the first source statement must contain a .title directive.
Example In this example, one title is printed on the first page and a different title on
succeeding pages.
Source file:
.title ”**** Fast Fourier Transforms ****”
; .
; .
; .
.title ”**** Floating–Point Routines ****”
.page
Listing file:
TMS320C54x DSKplus Assembler Version x.xx Sun Apr 23 16:25:49 1995
Copyright (c) 1996 Texas Instruments Incorporated
**** Fast Fourier Transforms **** PAGE 1
2 ; .
3 ; .
4 ; .
TMS320C54x DSKplus Assembler Version x.xx Sun Apr 23 16:25:49 1995
Copyright (c) 1996 Texas Instruments Incorporated
**** Floating–Point Routines **** PAGE 2
C-34
Reserve Uninitialized Space .usect
Description The .usect directive reserves space for variables in an uninitialized, named
section. This directive is similar to the .bss directive; both simply reserve space
for data and have no contents. However, .usect defines additional sections
that can be placed anywhere in memory, independently of the .bss section.
symbol points to the first location reserved by this invocation of the
.usect directive. The symbol corresponds to the name of
the variable for which you are reserving space.
section name must be enclosed in double quotes; only the first eight
characters are significant. This parameter names the uni-
tialized section.
size in words is an expression that defines the number of words that are
reserved in section name.
alignment flag is an optional parameter. This flag causes the assembler
to allocate size on long word boundaries.
Other sections directives (.text, .data, and .sect) end the current section and
tell the assembler to begin assembling into another section. The .usect and the
.bss directives, however, do not affect the current section. The assembler
assembles the .usect and the .bss directives and then resumes assembling
into the current section.
Variables that can be located contiguously in memory can be defined in the same
specified section; to do so, repeat the .usect directive with the same section name.
Example This example uses the .usect directive to define two uninitialized, named sections,
var1 and var2. The symbol ptr points to the first word reserved in the var1 section.
The symbol array points to the first word in a block of 100 words reserved in var1,
and dflag points to the first word in a block of 50 words in var1. The symbol vec
points to the first word reserved in the var2 section.
Figure C–2, page C-37, shows how this example reserves space in two unini-
tialized sections, var1 and var2.
1 ******************************************
2 ** Assemble into .text section. **
3 ******************************************
4 0000 .text
5 0000 E803 A = A + #03h
6
7 ******************************************
8 ** Reserve 1 word in var1. **
9 ******************************************
10 0000 ptr .usect ”var1”, 1
11
12 ******************************************
13 ** Reserve 100 words in var1. **
14 ******************************************
15 0001 array .usect ”var1”, 100
16
17 0001 F000 A = A + #037h ; Still in .text
0002 0037
18
19 ******************************************
20 ** Reserve 50 words in var1. **
21 ******************************************
22 0065 dflag .usect ”var1”, 50
23
24 0003 F000 A = A + #dflag ; Still in .text
0004 0065
25
26 ******************************************
27 ** Reserve 100 words in var2. **
28 ******************************************
29 0000 vec .usect ”var2”, 100
30
31 0005 F000 A = A + #vec ; Still in .text
0006 0000
C-36
Reserve Uninitialized Space .usect
100 words
dflag
50 words
Appendix
AppendixDA
When the assembler completes its second pass, it reports any errors that it
encountered during the assembly. It also prints these errors in the listing file
(if one is created); an error is printed following the source line that incurred it.
This appendix lists the three types of assembler error messages in alphabetical
order according to the error message number. Most errors are fatal errors; if an
error is not fatal, this is noted in the assembler listing file. Each error message
consists of its class number and text showing the specific error that was
detected. Each class number group has a Description of the problem and an
Action that suggests possible remedies.
D-2
Assembler Error Messages: E0004 / E0005
D-4
Assembler Error Messages: E0100 / E0101 / E0200 / E0201
D-6
Assembler Error Messages: E1000 / E1300 / W0000 / W0001
Action Check the source to determine what caused the problem and
whether you need to correct the source.
Action Check the source to make sure the result will be acceptable,
or change the source if an error has occurred.
D-8
Running Title—Attribute Reference
Appendix
AppendixEA
Glossary
A
absolute address: An address that is permanently assigned to a memory
location.
AIC: analog interface circuit. Integrated circuit that performs serial A/D and
D/A conversions.
B
batch file: A file containing an accumulation of data to be processed. This
data may be either DOS commands for the PC to execute or debugger
commands for the debugger to execute.
boot loader: A built-in segment of code that transfers code from an external
source to program memory at power-up.
C
code-display windows: Windows that show code, text files, or code-
specific information.
COFF: common object file format. A system of object files configured according
to a standard developed by AT&T. These files are relocatable in memory
space.
command file: A file created by the user which names initialization options
and input files for the linker or the debugger.
command line: The portion of the COMMAND window where you can enter
instructions to the system.
D
D/A: digital-to-analog. Conversion of discrete or discontinuous electrical sig-
nals to continuously variable signals.
debugger: A software interface that permits the user to identify and eliminate
mistakes in a program.
E-2
Glossary
DSK: digital signal processor starter kit. Tools and documentation provided
to new DSP users to enable rapid use of the product.
E
EGA: enhanced graphics array. An industry-standard video card.
entry point: A point in target memory where the program begins execution.
external symbol: A symbol that is used in the current program module but
defined in another program module.
F
field: A software-configurable data type which can be programmed to be
from one to eight bits long.
file header: A portion of the COFF object file that contains general informa-
tion about the object file, such as the number of section headers, the type
of system the object file can be downloaded to, the number of symbols
in the symbol table, and the symbol table’s starting address.
G
global symbol: A symbol that is either defined in the current module and
accessed in another or accessed in the current module but defined in
another.
Glossary E-3
Glossary
Glossary
H
host port interface (HPI): An 8-bit parallel interface that the CPU uses to
communicate with a host processor.
HPIC: host port interface control register. 16-bit register that controls the
operation of the host port interface (HPI).
HPIA: host port interface address register. 16-bit pointer to HPI memory.
I
IC: integrated circuit. A tiny wafer of substitute material upon which is etched or
imprinted a complex of electronic components and their interconnections.
input section: A section from an object file that is linked into an executable
module.
E-4
Running Title—Attribute Reference
Glossary
L
label: A symbol that begins in column 1 of a source statement and corresponds
to the address of that statement.
listing file: An output file created by the assembler that lists source statements,
their line numbers, and any unresolved symbols or opcodes.
LSB: least significant bit. The binary digit, or bit, in a binary number that has
the least influence on the value of the number.
LSByte: least significant byte. The byte in a multibyte word that has the least
influence on the value of the word.
M
member: An element of a structure, union, or enumeration.
memory map: A map of target system memory space that is partitioned into
functional blocks.
menu bar: A row of pulldown menu selections at the top of the debugger dis-
play.
MP/MC bit: A bit in the processor mode status register PMST that indicates
whether the processor is operating in microprocessor or microcomputer
mode. See also microcomputer mode; microprocessor mode.
MSB: most significant bit. The binary digit, or bit, in a binary number that has
the most influence on the value of the number.
MSByte: most significant byte. The byte in a multibyte word that has the
most influence on the value of the word.
N
named section: Either an initialized section that is defined with a .sect directive,
or an uninitialized section that is defined with a .usect directive.
Glossary E-5
Glossary
Glossary
O
object file: A set of related records treated as a unit that is the output of an
assembler or compiler and is input to a linker.
operand: The arguments or parameters of an assembly language instruc-
tion, assembler directive, or macro directive.
options: Command parameters that allow you to request additional or specific
functions when you invoke a software tool.
P
PC: Personal computer or program counter, depending on context and where
it’s used. In this book, in installation instructions, or in information relating
to hardware and boards, PC means personal computer (as in IBM PC).
In general debugger and program-related information, PC means
program counter, which is the register that identifies the current statement
in your program.
PROM: programmable read-only memory. An integrated circuit on which
information can be programmed by the user. This circuit can be read
from but not written to.
pulldown menu: A command menu that is accessed by name from the
menu bar at the top of the debugger display.
R
raw data: Executable code or initialized data in an output section.
reverse assembly: The process of translating the contents of memory from
machine language to assembly language. Also known as disassembly.
S
SARAM: single-access, random-access memory. Memory that can be altered
only once during each cycle.
section: A relocatable block of code or data that ultimately occupies a space
adjacent to other blocks of code in the memory map.
serial port: An access point that the debugger uses to sequentially transmit
and receive data to and from the emulator or the applications board. The
port address represents the communication port to which the debugger
is attached.
E-6
Glossary
source file: A file that contains C code or assembly language code that will
assembled to form a temporary object file.
SPC: section program counter. A specific register that holds the address of
the section where the following directive is to be obtained.
string table: A table that stores symbol names that are longer than eight char-
acters. Symbol names of eight characters or longer cannot be stored in the
symbol table; instead, they are stored in the string table. The name portion
of the symbol’s entry points to the location of the string in the string table.
T
tag: An optional type name that can be assigned to a structure, union, or
enumeration.
U
unconfigured memory: Memory that is not defined as part of the memory
map and cannot be loaded with code or data.
V
VGA: video graphics array. An industry-standard video card.
W
word: A character or bit string considered as an entity.
Glossary E-7
E-8
Index
Index
Index-1
Index
Index-2
Index
Index-3
Index
Index-4
Index
M P
member, definition E-5 page
memory map, for DSKplus 1-5 eject C-25
length C-20
memory map for DSKplus, definition E-5 title C-34
menu bar, definition E-5 width C-20
menu selections, definition (pulldown menu) E-6 .page assembler directive 5-30, C-25
modifications, PAL device 6-12 PAL, equations B-1
MP/MC bit, definition E-5 PAL device
MSB, definition E-5 4-bit read cycle 6-9
device’s internal logic diagram 6-7
MSByte, definition E-5
latch/select (LS) mode 6-10
nibble mode state machine 6-10
strobe generator 6-9
N write or 8-bit read cycle 6-10
parentheses in expressions 5-15
named section, definition E-5 PC, definition E-6
named sections port, definition E-6
.sect directive C-26
power supply adapter cable 2-2
.usect directive C-35
power supply connector 2-2
naming alternative directories for assembler in-
put 5-5 power to the DSKplus 6-2
nibble mode state machine, NBL signal 6-10 precedence groups 5-15
.nolist assembler directive 5-30, C-21 prefixes for operands 5-8
printer cable 2-2
program entry point, definition E-3
O program memory 1-5
dual-access RAM (DARAM) 1-5
object code (source listing) 5-19 external 1-5
HPI RAM 1-5
object file, definition E-6
interrupts 1-5
octal integer constants 5-10 kernel 1-5
operand, definition E-6 reserved 1-5
operands ROM 1-5
field in assembler statement 5-8 to 5-9 programming tips
immediate addressing 5-9 DSP 4-5
in source statement format 5-8 to 5-9 host 4-7
using a label as 5-13 .pstring assembler directive 5-27, C-32
using prefixes 5-8
pulldown menus, definition E-6
operator precedence order 5-16
options
assembler 5-4
definition E-6
Q
output, listing 5-30 to 5-32 –q assembler option 5-4
overflow in expression 5-16 quiet run 5-4
Index-5
Index
SPC
R aligning, to word boundaries 5-29 to 5-32, C-2
raw data, definition E-6 assembler symbol 5-8
assigning a label to 5-8
register
data (PC host) 6-5 definition E-7
PC’s control 6-6 predefined symbol for 5-14
PC’s status 6-5 value
associated with labels 5-8
register symbols 5-14
shown in source listings 5-18
relational operators, in conditional expres-
sions 5-17 starting self-test, script 2-6
relocation 5-11 static variable, definition E-7
requirements
hardware 1-3 .string assembler directive 5-27, C-32
software 1-3 string table, definition E-7
running self-test program 2-5
strobe generator, PAL device 6-9
structure, definition E-7
S
substitution symbols
.sect arithmetic operations on 5-31
assembler directive 5-23 assigning character strings to 5-31
section 5-23
symbol 5-13
section, definition E-6
case for 5-4
self-test program 2-5
definition E-7
.set assembler directive 5-31, C-27
.setsect C-29 symbolic constants
assembler directive 5-23 $ 5-14
section 5-23 defining 5-14
single-step, definition E-7 predefined 5-14
register symbols 5-14
software breakpoints, definition E-2
software considerations symbols
DSP programming tips 4-5 assigning values to C-27
DSP software 4-2 character strings 5-12
host PC 4-6 defined, by the assembler 5-4
host programming tips 4-7 predefined 5-14
software requirements for installation 1-3 used as labels 5-13
source file, definition E-7
source listings 5-18 to 5-19
source statement
field (source listing) 5-19
format 5-7 to 5-9
T
algebraic field 5-8
comment field 5-9 tag, definition E-7
instruction field 5-8
.text
label field 5-7
operands 5-8 to 5-9 assembler directive 5-23, C-33
number (source listing) 5-18 section 5-23, C-33
.space assembler directive 5-25, C-31 .title assembler directive 5-30, C-34
Index-6
Index
U W
unconfigured memory, definition E-7 well-defined expression 5-16
.width assembler directive 5-30, C-20
underflow in expression 5-16
word, definition E-7
uninitialized sections
word alignment C-2
.bss section C-3
.usect section C-35 .word assembler directive 5-27, C-19
Index-7
Index-8