,ll 6.6
,cs 10
,pl 66
,lm 0.2,0.5
,pn 1
,ju
,hd
,ce
OmegaSoft 6809 Cross Pascal Target Debugger (V1.0)
,,
,ft

,ce 1
14-##
,,
,ce
OmegaSoft 6809 Cross Pascal Target Debugger (V1.0)

,ce
INTRODUCTION

This software package is designed to work with the Pascal compiler and optionally the Relocatable Assembler.

Intermediate code from the compiler is translated to object code by the debugger directly into the target system's memory. Additional information is provided by the compiler that allows breakpointing at pascal statements and display and changing of variables, this information is kept in the host system.

This package allows you to link in your assembly language support routines if required and to replace standard runtime routines.

The TCON file must be setup on your system before the debugger can be used, see the installation section of this manual.

,ce 17
HOST MEMORY MAP

TOP OF HEAP
    
+--------------------------+
|  ESD table               |
|                          |
|  Externals table         |
+--------------------------+
|  Internal labels         |
+--------------------------+
|  Macro Buffer            |
+--------------------------+
|  Debugger table          |
+--------------------------+

BOTTOM OF HEAP

,ce
DESCRIPTION OF HOST MEMORY AREAS

The debugger table holds information about where in memory each breakpointable statement is, procedure start and end, and variable declarations. This table may need to be very large if you have many modules compiled with the compiler D option on.

The macro buffer is used to hold strings to be used as commands when the macro is executed. There is no re-use of macro buffer space when macros are redefined.

The internal labels area is used to store destinations for the various branching activities that occur in pascal loops or case statements. This table is fairly small since once a label is no longer needed (as directed by the compiler) the label is purged and that space can be re-used.

The externals table is used to hold the names, sections, and addresses of entry/external variables and procedures. This table needs to be large when you have many modules with many references between them or a large number of entry variables.

The ESD table is used to hold relocation information generated by loaded relocatable object files. This information is then used when linking as a pseudo second linker pass.
,pg

,ce
TARGET MEMORY MAP

 FILE LOADING AND LINKING                 ACTUAL OPERATION

      TOP OF RAM                             TOP OF RAM
    
+-------------------------+---------+-------------------------+
|  Debugger system stack  |         |   Debugger system stack |
+-------------------------+---------+-------------------------+
|  Debugger data stack    |         |   Debugger data stack   |
+-------------------------+---------+-------------------------+
|                         |         |   User system stack     |
|                         |         +-------------------------+
|                         |         |   User data stack       |
|                         |         |                         |
|                         |         |   User heap             |
|                         |         +-------------------------+
|                         |         |                         |
|  User code area         |         |   User code area        |
+-------------------------+---------+-------------------------+
|  Data Section           |         |   Data Section          |
+-------------------------+---------+-------------------------+
|                         |         |   Runtime jump table    |
+-------------------------+---------+-------------------------+
|  Interrupt vectors      |         |   Interrupt vectors     |
+-------------------------+---------+-------------------------+
| Debugger and user Y reg |         | Debugger and user Y reg |
+-------------------------+---------+-------------------------+

     BOTTOM OF RAM                        BOTTOM OF RAM

,ce
DESCRIPTION OF TARGET MEMORY AREAS

The user code area is where the translated code is stored along with any object code from assembly language routines you may have included.

The runtime jump table is used to get from the user's address space to the runtime routines shared with the debugger. It also facilitates runtime routine replacement.

The data section stores those constants defined to be in data section by the user, and structured constants.

The Interrupt vectors hold the 6 2 byte vectors used by the 6809 series processors. The storage for debugger and user Y register is used to hold the global stack marks for both the debugger and user, allowing correct access when interrupts occur.

The actual debugger code and runtime library are stored in EPROM, and will fit into less than 16K bytes including real support.

,ce
INSTALLATION

The first step in installation of the target debugger is to select and modify if necessary the serial I/O driver module. Among those included in the package as samples are drivers for the 6850 and 2661. Other drivers may be added to the package in the future, or drivers may be available from the manufacturer of the target computer you are using.
,pg
,ce
INSTALLATION

In any case, the serial driver must use interrupt driven support for both input and output functions. If you are using one of these chips then it is likely that you will not have to change very much in these sample drivers.

,ce
6850 DRIVER EXAMPLE (IO6850)

The following items may need to be changed in the sample :

,in 0.3
,si -0.3
1) "mode1 equ $15" "mode2 equ $95" "mode3 equ $b5" - check these to make sure that the clock divisor rate is correct for your system.
,si -0.3
2) "abs $bf40" change this to the address of the acia control register.
,in 0

,ce
2661 DRIVER EXAMPLE (IO2661)

The following items may need to be changed in the sample :

,in 0.3
,si -0.3
1) "mode1a equ $4e" "mode1b equ $7e" - check these to make sure they are correct for your system, especially the baud rate divisor.
,si -0.3
2) "abs $bf40" - change this to the address of the 2661 data register.
,in 0

,ce
USING OTHER SERIAL CHIPS

There are of course other serial chips commonly used in 6809 series processor designs. In the above examples the operation of the 6850 and 2661 are almost identical, with the only real differences being in the name of the registers and initialization. The 6551 chip should also be very similar, with necessary changes in initialization code (such as baud rate).

In the 6850 and 2661 chips, if the transmit interrupt is enabled via the control register, then IRQ will be asserted whenever the transmitter is empty. The method used to handle this is that the transmit interrupt is disabled until there is data to send.

When this occurs the transmit interrupt is enabled, which immediately generates an interrupt. When data runs out then the transmit interrupt is disabled until new data is available.

,ce
STACK SETUP CODE (TARGET.PS)

The debugger can place all buffers and code areas in the same contiguous area or memory, or the user sections can be placed in a separate area. This is often used when the target system just has a small amount of RAM area used by the target program. Since use of the target debugger requires the user code to go into the target RAM instead of EPROM, more RAM is often desired. In most cases a plug in RAM card can be used when debugging, and then removed after you ROM the software. If you have external RAM, then set "auxstrt" and "auxend" to the limits as noted below. Debugger stacks and vectors always stay at the location specified for "global" and "ramtop" regardless of the existence of external RAM.
,pg
,ce
STACK SETUP CODE (TARGET.PS)

The following items need to be changed for your target system : 

,in 0.3
,si -0.3
1) "global equ $a000" set this to the first location of RAM, this is used to store the global stack mark for the debugger.
,si -0.3
2) "ramtop equ $bbff" set this to the last location of RAM.
,si -0.3
3) "auxstrt fdb $0000" if you have external memory that you want your user code and stacks to be in, then set this to the first available location, else set to zero.
,si -0.3
4) "auxend fdb $3fff" if you have external memory that you want your user code and stacks to be in, then set this to the last available location, else set to zero.
,si -0.3
5) "clear equ 0" this must be set to 1 if your target system uses parity. This initializes parity for the target debugger stack area.
,in 0

,ce
RUNTIME JUMP TABLE (TARGET1)

There is a flag "float equ 1" which if set to 0 will exclude floating point support in the target debugger. If the debugger is generated with this flag set to 0 and an attempt is made to call a floating point routine, you will be notified by a runtime error. Since setting this flag to zero does not reduce the size of EPROM for the debugger to the 8K level, there should be no reason to use this option.

,ce
SHELL FILE CHANGES 

In file target.sf you need to change the "start C000" to where the EPROM starts. You also need to change the "align 1ff0" so that the sum of the start and the align parameter is equal to fff0 (c000 + 1ff0 = fff0).

You can then run the cross pascal shell to compile, assemble, and link your target debug code. The next step is to burn your EPROMS, which is up to you to figure out.

,ce
THE TERMINAL TEST

The first step in testing is to connect a terminal to the serial port. When typing a carriage return, the target debugger should respond with " TAB" with no line feed. If this works, then you are just about ready to go. 

As a further test using the terminal, put your terminal into upper case only keyboard mode, and type " NB1" carriage return, note the space before the "N", this must be there. The debugger should respond with a string starting with "6H". If all of this works then you are ready to connect the target system to the host system.

The host end of the link is operating system dependent, so turn to chapter 2 for more information.

