next up previous contents

[ENGN3213 Home]

Assembling and Linking

In order to assemble or compile programs for the BSVC simulator with the gcc tools, you will need to download and save in your working directory the startup object file crt0.o and the linker script bsvc-unix.ld These two files together with the assembly program should all be in the same directory.

(Note: If you are doing this under MS WINDOWS at home you may use the Windows version of the linker script bsvc-win.ld).

Assemble the program in a terminal window as follows:

1.
First, check with your tutor that the environment on your computer has been set up correctly.

2.
Run the assembler in the terminal window :
m68k-coff-as clab70s.s -o clab70s.o -m68000 -ahls=clab70s.lst
This will produce an object file clab70s.o and a listing file clab70s.lst

3.
Next, run the linker:
m68k-coff-ld clab70s.o -o clab70s.s19 -L. -Tbsvc-unix.ld
This will produce a Motorola s-record clab70s.s19 which can be read by the BSVC simulator. This linking process links in the startup routine and any other required routines from the standard C libraries.

Exercise.

1.
Start the BSVC simulator, load the setup file bsvc-win.setup, and load the program executable clab70s.s19. Run the code and check for correct operation.

2.
Find the memory location where the variable sum is stored, and check its contents.

3.
Examine the program listing in the memory viewer. Notice that the code which has been loaded into memory includes the startup routine and so your user program appears in the middle of this (translated). Closely examine the listing and memory contents. Explain. What addressing modes are used, and what offsets have been used in referring to count and sum.


next up previous contents

[ENGN3213 Home]

ANU Engineering - ENGN3213