Assemble (Stage 5) -- Source file ready for simulation

When you assembled the file e1v1.s using the command

as68000 -V 68020 -L -m -o e1v1a.o e1v1.s

then in the file e1v1.lst you would have found two errors remaining. Both were associated with the directive ORG.


Specifying RAM and ROM memory locations using the SDS 68K software tools

The SDS 68K software kit does not specify locations in memory using the standard Motorola ORG type descriptor. Instead the SDS tools break up the processor memory into a series of blocks (called sections) according to what happens in that location of memory.

The tools then place things that will not change during the program execution (code, number constants and string constants) into read only memory (ROM). These items are immediately available when the processor powers up.

The SDS tools also recognize that certain other items must change during the course of your program and must be stored in random access memory (RAM).


Ready for the simulator -- e1v2.s

We can modify file "e1v1.s" to incorporate these memory specification assembler directives. The new file e1v2.s is now ready for the simulator. This file can be assembled with no errors

as68000 -V 68020 -L -m -o e1v2.o e1v2.s

giving the listing file "e1v2.lst". I have replaced the Motorola symbol for hexadecimal numbers ($) with the "C" symbol (0x) as discussed earlier and modified the values of A and B for easier reading inside the tool.

; Code from  HVZ Computer Organization
; Chapter 2 -- Figure 2.26 -- page 67 Changed file
; A 68000 routine for C <- [A] + [B]

; Version 1 -- M. R. Smith -- July 1, 1996

********************************************************************

C 	EQU	0x202200	; Specify location to store the result

;	ORG	0x201150	; Start of CONSTANTs section
	section const		; Start of const section (handled by linker)

	.EXPORT A		; (No HVZ notation equivalent)
A 	DC.W	639		; Specify and initialize a variable
B 	DC.W	-215		; Specify and initialize a variable
		
********************************************************************
	
;	ORG	0x201200	; Start of CODE section
	section code		; Start of CODE section (handled by linker)

	.EXPORT mycode		; (No HVZ notation equivalent)
mycode 			 	; (No HVZ notation equivalent)
	MOVE A, D0		; D0 <- [A]
	ADD B, D0		; D0 <- [D0] + [B}
	MOVE D0, C		; C <- [D0]

	END			

The "mycode" and ".EXPORT" directives

These directives allow information to be passed between the assembler, the linker and the simulator. The use and importance of the .EXPORT and mycode directives will become apparent when we use the SDS 68K simulator to execute our code segment.


The "section" directive

The basic SDS memory map is as follows. The section "names" follow a standard SDS definition. The identical or equivalent names will be found with other assemblers and compilers.

Section NameMemory LocationFunction
section codeROMprogram codeUsed in task 1
section constROMnumerical constantsUsed in task 1
section stringROMstring constants
section dataRAMnumerical and string values
that have a known "initial" value
when your program starts
section ramRAMnumerical and string values
that do not have a known "initial" value
when your program starts.
SDS recommends that these value
be initialized to zero values.

The location of these sections is not specified in the source file, but is handled more flexibly by the SDS tools at link time. At that time, a number of object and library files, each with their own sections, are brought together and joined into an executable file.



Last modified: July 01, 1996 05:21 PM by M. Smith.
Copyright -- M. R. Smith