Assembly (Stage 1) -- Generating the source file

Before proceeding, you should adjust your screen so that there is both a WEB browser window and a DOS command window (set to your working directory - lab1) available. Depending on your screen and font size, place the screens side by side or above of each other. A third window is necessary if you intend to make use of a window based editor.

If you plan to make use of the editor built into, or call an "external" editor from, the SDS toolkit follow this link to see how to correctly set up the SDS toolkit.


Assembling the suggested HVZ code for task 1

In the first laboratory we are going to start with the suggested HVZ code (original Motorola assembler syntax) and simply apply the HIW process. This means "just using the SDS toolset" and "fixing only the bits that are broken".

The first task has a possible solution as given in the source file e1v0.s (example_1_version_0.s). This is the same code that was given as a solution for the task

C <- [A] + [B]

in Chapter 2 of HVZ's book.

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

C 	EQU	$202200
	ORG	$201150
A 	DC.W	639	
B 	DC.W	-215	
	ORG	$201200	
	MOVE	A,D0	
	ADD	B,D0	
	MOVE	D0,C	
	END

End of e1v0.s	

Syntax explanation

Assembly language code has a STRICT (you have no choice) format. There is not the same free format of splitting an instruction across a number of lines as is possible in C or C++.

Each code statement is made up of four parts or fields.


Software Engineering Concerns

The source code file e1v0.s, as it stands, may be satisfactory if the documentation of the associated HVZ pages is immediately available. However, if you were provided with just this code segment, and nothing else, you would be hard pushed to understand what it is intended to do and how it works. If you had to maintain or modify the code segment, as part of your job description, you would be upset to have to work with code, such as "t1hvz.s", with few comments.

It is important to cultivate a consistent assembly language coding style that makes it easy for a "stranger" to understand your code. Remember that the stranger reading your code in 3 weeks might just be you.

We can create a new file e1v1.s from e1v0.s that follows the standard practices of

The source file e1v1.s (example_1_version_1.s) shows these practices in operation

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

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

C	 EQU	$202200		; Specify location to store the result

	ORG	$201150		; Start of DATA (variable) section
A 	DC.W	639		; Specify and initialize a variable
B 	DC.W	-215		; Specify and initialize a variable

	ORG	$201200		; Start of CODE (program) section
	MOVE	A, D0		; D0 <- [A]
	ADD	B, D0		; D0 <- [D0] + [A]
	MOVE	D0, C		; C  <- [D0]
	END

; End of e1v1.s		

We are now ready to issue the assembler commands.



Last modified: July 02, 1996 06:38 PM by M. Smith.
Copyright -- M. R. Smith