atari email archive

a collection of messages sent at Atari from 1983 to 1992.

TMS320 Macro Assembler

(1 / 11)


;This is what used to work:

	.TITLE	DSOUND

	.ENABL USD,LC
	.INCLUDE TMS320.INC
	.ASECT
	.RADIX 16
	.ENABL AMA

; Driver Sound Tests routines for TMS-320
;
; Programmer: Jed Margolin
;
; Date: 8/5/85
;
; Hardware: Driver Sound
;
; MAC65
;-------------------------------------------------------------------------------
; Use:
; 	MAC65 TMS320.MAC/NP
; 	LINKM TMS320/NP
; 	LTO TMS320
; This produces  TMS320.OL  with TMSCODE and TMSEND Labels
;-------------------------------------------------------------------------------
:   code 

tms320

(2 / 11)


Change the following and should work:

old:	.INCLUDE TMS320.INC
new:	.INCLUDE UTL$MAC:TMS320.INC

old: ; Use:
old: ; 	MAC65 TMS320.MAC/NP
old: ; 	LINKM TMS320/NP
new: ; Use:
new: ; 	MAC65 TMS320/LIS	!/LIS only if you want a listing file
new: ; 	LLF TMS320.OB/MAP	!/MAP only if you want a map file

ds

TMS320 assembly procedure

(3 / 11)


The old stuff:
;-------------------------------------------------------------------------------
; Use:
; 	MAC65 TMS320.MAC/NP
; 	LINKM TMS320/NP
; 	LTO TMS320
; This produces  TMS320.OL  with TMSCODE and TMSEND Labels
;-------------------------------------------------------------------------------

The new stuff:
;-------------------------------------------------------------------------------
; Use:
; 	MAC68K TMS320/LIS	!/LIS only if you want a listing
;           ^^^ use a different assembler
; The creates a TMS320.OB object file.
;-------------------------------------------------------------------------------

Plus you have to add to and change a couple of things in your TMS320.MAC file:

-----------------------------------------------------------------------------
         New		         |         Old
-------------------------------- 80 -----------------------------------------
        .psect TICODE            |          .=0                              
	.globl TMSCODE           |
TMSBEGIN:                        |                                           
-------------------------------- 88 -----------------------------------------
        .=TMSBEGIN+10            |          .=10                             
-------------------------------- 94 -----------------------------------------
        .=TMSBEGIN+30            |          .=30                             
-------------------------------- 1168 ---------------------------------------
TMSEND == .-TMSBEGIN             |
-----------------------------------------------------------------------------

Then you can LLF the TMS320.OB file with your 68000 code directly BUT you
will need to include it in an options file:

TMS320.OPT:
	FILE (TMS320.OB additional_68k_files_to_link ...)
	LOCATE (TICODE_ : 0x0000 TO 0x3FFF OUTPUT 0x????)
	DECLARE (TMSCODE 0x????)

where the ???? is the address in 68k address space where you want the
TMS320 code to reside. (NOTE that the section name is TICODE_ with
a trailing underscore, even though the .psect name in the .MAC file
doesn't have a trailing underscore). The global symbol TMSCODE is
set in the options file by the DECLARE directive and TMSEND is set
by the assembler.

ds

TMS320

(4 / 11)


I made the changes in TMS320.MAC and it seems to run, except that it insists
on assembling statements even after '.END' 


on TMS320.OPT:	I would like the TMS code to appear after the program segment
		like it did before. The following is my old locate file:


	locate(PROGRAM TICODE: #1000);
	locate(VECTORS: #0000);
	locate($$seg14 : #0FFC000 TO #0FFCFFF );

Does this need to change and what is 0x0000 TO 0x3FFF and do I need to
fill in the 'x'?

How do I tell it there is an .OPT file and whom would I tell?


TMS320.OPT:
	FILE (TMS320.OB additional_68k_files_to_link ...)
	LOCATE (TICODE_ : 0x0000 TO 0x3FFF OUTPUT 0x????)
	DECLARE (TMSCODE 0x????)


The following is how I used to link it. Does it need to change?

$ LLF DSOUND,TMS320,STUB,dsound.lc/opt/sym/map
$ EXIT


	Jed

RE: TMS320

(5 / 11)


>I made the changes in TMS320.MAC and it seems to run, except that it insists
>on assembling statements even after '.END' 

.END is only advisory (it's a comment as far as the assembler is concerned)
except if there's a label on it in which case the label is read to be the
program start address.

>on TMS320.OPT:	I would like the TMS code to appear after the program segment
>		like it did before. The following is my old locate file:

Oh. This will require some more work. I'll have to fix a problem in LLF
in order for you to do that.

>	locate(PROGRAM TICODE: #1000);
>	locate(VECTORS: #0000);
>	locate($$seg14 : #0FFC000 TO #0FFCFFF );
>
>Does this need to change and what is 0x0000 TO 0x3FFF and do I need to
>fill in the 'x'?

0x is another way of specifying hex (it's the C syntax for hexidecimal).
The 0 to 3FFF is to locate the TMS320 program in TMS320 address space (0-3FFF
or whatever) and the OUTPUT is to locate that block of code into the
68000's address space. LLF won't do what you want directly, I'll have to
figure something out. In the meantime, you can put the TMS320 code somewhere
in the 68000's address space that doesn't conflict with the 68000's program.

You might make your option file (DSOUND.LC) look like:

	FILE (DSOUND STUB TMS320.OB)
	locate(PROGRAM : #1000 TO 7FFF);
	locate(VECTORS : #0000);
	locate($$seg14 : #0FFC000 TO #0FFCFFF );
	LOCATE (TICODE_ : 0x0000 TO 0x3FFF OUTPUT 0x8000)
	DECLARE (TMSCODE 0x8000)

Change the 7FFF and 8000 to whatever is appropriate (wherever there is
room for the TMS code). Then you link it with:

$ LLF dsound.lc/opt/sym/map
$ EXIT

ds

TMS320

(6 / 11)


 I changed DSOUND.LC to:

	FILE (DSOUND STUB TMS320.OB)
	locate(PROGRAM : #1000 TO 7FFF);
	locate(VECTORS : #0000);
	locate($$seg14 : #0FFC000 TO #0FFCFFF );
	LOCATE (TICODE_ : 0x0000 TO 0x3FFF OUTPUT 0x8000)
	DECLARE (TMSCODE 0x8000)

and ran

$ LLF dsound.lc/opt/sym/map
$ EXIT

and got:

$	@LNK        
%LLF-E-ERROR,Segment is not present in object code
	locate(PROGRAM : #1000 TO 7FFF);
	                           ^
%LLF-E-ERROR,Expected ':' here, assumed
	DECLARE (TMSCODE 0x8000)
	                 ^
%LLF-W-WARN,Segment {VECTORS } at 00000000 overlays another segment or reserved mem
%LLF-I-INFO,Completed with 2 error(s) and 1 warning(s)

  MARGOLIN     job terminated at  8-FEB-1990 16:27:52.85
Accounting information:
  Buffered I/O count:          183      Peak working set size:   930
  Direct I/O count:            202      Peak page file size:    3319
  Page faults:                4226      Mounted volumes:           0
  Charged CPU time:     0 00:00:07.88   Elapsed time:     0 00:00:21.31



	Jed

RE: TMS320

(7 / 11)


>	FILE (DSOUND STUB TMS320.OB)
>	locate(PROGRAM : #1000 TO 7FFF);
				  ^ need a # or 0x here
>    [...]
>	DECLARE (TMSCODE 0x8000)
		        ^ apparently need a : here.
>
>%LLF-W-WARN,Segment {VECTORS } at 00000000 overlays another segment or reserved mem

To fix this (or at least make LLF shut up about it), you'll need to make
a small change to TMS320.MAC:

	new				old
-----------------------------------------------------------------------------
	.GLOBL TMSCODE		|	.ASECT
	.PSECT TICODE		|
TMSBEGIN:			|
-----------------------------------------------------------------------------
	.=TMSBEGIN		|	.=0000
-----------------------------------------------------------------------------
	.=TMSBEGIN		|	.globl TMSCODE
				|	.psect TICODE
				| TMSBEGIN:
-----------------------------------------------------------------------------

ds

Assemble and link TMS320 again. It ought to work

(8 / 11)


From:	SANDY::MARGOLIN      8-FEB-1990 18:25:33.15
To:	SHEPPERD
CC:	MARGOLIN
Subj:	Thank You

It seems to work.  Thank you.

  Jed

It broke

(9 / 11)


After adding some code it assembles ok but gives the following message
during LLF:


$	LNK        
%LLF-E-ERROR,.TEST expression computed true: ;DMA too big
%LLF-E-ERROR,.TEST expression computed true: ;DMA too big
%LLF-E-ERROR,.TEST expression computed true: ;DMA too big
%LLF-I-INFO,Completed with 3 error(s) and 0 warning(s)
  MARGOLIN     job terminated at  9-FEB-1990 14:08:47.68

Accounting information:
  Buffered I/O count:          181      Peak working set size:  1040
  Direct I/O count:            180      Peak page file size:    3352
  Page faults:                4032      Mounted volumes:           0
  Charged CPU time:     0 00:00:08.35   Elapsed time:     0 00:00:19.70


   Jed

RE: It broke

(10 / 11)


The .TEST is an assembler directive that instructs LLF to check the value
of an expression and print the accompanying error message if the test is
true.

The TMS320.INC file has a .TEST directive in the OOP (One Operand Instruction)
primative which checks that the value of the one operand is less than 128.
The assembler doesn't flag the error because I had you put the ram variables
in a relocatable .PSECT so you wouldn't get the LLF warning about overlapping
sections and therefore it doesn't know what the value of the variables are
until link time. Until I can figure out a way around this, you'll either have
to live with an LLF warning or not finding out about ram "out of range" until
link time.

There is another bug, however, since LLF is also supposed to give you the
line number in the source file where the .TEST directive was given. Damn.

ds

RE: It broke

(11 / 11)


ok
Message 1 of 11

Feb 07, 1990