Sei sulla pagina 1di 5

Lab #3: Writing and Testing a Simple Program

Adrian Hendels
abh12@students.uwf.edu
Dept. of Electrical & Computer Engineering
University of West Florida
Course: EEL4744L Spring 2015
September 30, 2015

Objective:
Introduce students to writing and testing a program in HC11 assembly language and using the BUFFALO
I/O routines to display/verify the results.

Introduction/Expectations:
In this lab we will the skills learned in lab two, in order to write and create a program which multiplies a 3
bit number with a 1 bit number, and saves the result at memory locations $04- $07. We will do so by
following each procedure laid out in the lab manual, in order to write a program which performs this task.
This program can be explained by the following figure which was given in the lab report.

Figure 1: A visual of how the multiplication will be carried out in memory.

Procedure:
Following the procedures laid out in the lab report, I was able to generate the following code shown
below.
*AdrianHendels
*LAB03

M
N
P
P1
P2
P3

ORG

$00

RMB
RMB
RMB
RMB
RMB
RMB

3
1
4
2
2
3

;ALLOCATEMEMORYFORM
;ALLOCATEMEMORYFORN
;ALLOCATEMEMORYFORP
;ALLOCATEMEMORYFORP1
;ALLOCATEMEMORYFORP2
;ALLOCATEMEMORYFORP3

ORG
LDAA
LDAB
MUL
STAB
STAA
LDAA
LDAB
MUL
STD
LDAA
LDAB
MUL
STD
LDAA
ADDA
STAA
LDAA
ADCA
STAA
LDAA
ADCA
STAA
SWI

$100
M+2
N

;PUTPROGRAMINRAM
;READMULLSBTOA
;READMULTIPLIERTOB
;MULTIPLYA&B
;STOREBTOPRODLSB
;STOREATOP1MSB
;READMULMIDTOA
;READMULTIPLIERTOB
;MULTIPLYA&B
;STOREDTOP2
;READMULMSBTOA
;READMULTIPLERTOB
;MULTIPLYA&B
;STOREDTOP3
;READP1MSBTOA
;ADDP2LSB
;STORESUMTOPRODMIDL
;READP2MSBTOA
;ADDW/CARRYP3LSB
;STORESUMTOPRODMIDH
;READP3MSBTOA
;ADDW/CARRYZERO
;STORESUMTOPRODUCTMSB

P+3
P1
M+1
N
P2
M
N
P3
P1
P2+1
P+2
P2
P3+1
P+1
P3
#0
P

When executing the above code, I received the following results. I will show 5 different executions of the
code when multiplicand N holds different values. This will show that the program performs the expected
operations, and stores them in the appropriate memory locations.

NOTE: I have denoted the 3 bit multiplicand M by yellow highlight, 1 bit multiplicand N by green
highlight, and 4 bit product P by red highlight.
>LOAD T
done
>G 0100
P-0129 Y-FFFF X-FFFF A-37 B-BC C-D0 S-0041
>MD 00 0
0000 A4 79 C8 57 37 E5 62 F8 43 FF 29 1F 37 BC FF FF

y W7 b C )

Figure 2: Terminal window, first multiplication.


>G 0100
P-0129 Y-FFFF X-FFFF A-00 B-00 C-D4 S-0041
>MD 00 0
0000 A4 79 C8 00 00 00 00 00 00 FF 00 00 00 00 FF FF

Figure 3: Terminal window, second multiplication.


>G 0100
P-0129 Y-FFFF X-FFFF A-05 B-20 C-D0 S-0041
>MD 00 0
0000 A4 79 C8 08 05 23 CE 40 06 FF 03 C8 05 20 FF FF

# @

Figure 4: Terminal window, third multiplication.


>G 0100
P-0129 Y-FFFF X-FFFF A-00 B-A4 C-D4 S-0041
>MD 00 0
0000 A4 79 C8 01 00 A4 79 C8 00 FF 00 79 00 A4 FF FF

Figure 5: Terminal window, fourth multiplication.


>G 0100
P-0129 Y-FFFF X-FFFF A-A3 B-5C C-D8 S-0041
>MD 00 0
0000 A4 79 C8 FF A3 D5 4E 38 C7 FF 78 87 A3 5C FF FF

N8

Figure 6: Terminal window, fifth multiplication.

Conclusion:
In conclusion the lab was completed successfully. Every execution of the code produced accurate results,
as shown in figures 2-6. The instructions included in this lab were concise enough for one to write and
test this program and achieve the desired results.

Potrebbero piacerti anche