You are on page 1of 1

You will find here a very simple program (fragment) that adds two numbers.

The two
numbers are stored in the memory at the symbolic addresses VALUE1 and VALUE2. The
result of the addition is found after the calculation in the register A.

Copy the program to the MC8ASM and have it assembled.


Then copy the Intel Hex code into the MC8 simulator and run it.
The example is not about the (not necessarily present) meaningfulness or efficiency
of the code, but how the individual instructions are executed and what happens in
the registers and on the buses of the MC8.

You can also add other values ??(for this you have to change the two values ??for
VALUE1 and VALUE2 in the MC8ASM) and observe how the flags are set depending on the
result.

In addition to the material in the exercises, it is also relevant for the exam to
familiarize you with all the commands used in this code!

Beispielprogramm A
;BESPIELPROGRAMM
;DIGITALE SYSTEME UE 384.047
;2. Labor "MC8" - Fernlehre

;Read first value of memory location WERT1


MOV A,WERT1
MOV B,A ;A freimachen

;Read second value of memory location WERT2


MOV A,WERT2

;The addition
ADD B ;A := A+B

HALT
;Result (sum) is now in the A register
;(Without taking account of a possible transfer)
WERT1: DB 22h ;1. Summand
WERT2: DB 44h ;2. Summand

MC8ASM.select the menu item Own program in the configuration ROM and enter the
machine code of the program to be simulated in IntelHex format.

:030000003A0900BA
:0100030047B5
:030004003A0A00B5
:010007008078
:010008007681
:0100090022D4
:01000A0044B1
:00000001FF

You might also like