Sei sulla pagina 1di 3

JABATAN KEJURUTRAAN ELEKTRIK UNIVERSm MALAYA

Lab Microprocessor
Experiment Ml'l : Introduction to Microprocessor INTRODUCTION:
The purpose of this experiment is to introduce you to the fundamentals of microprocessor. Before performing the experiment, it is advisable to read Unit 1 through Unit 5 of the Heathkit EE3401 notes on microprocessors accompanying the ET-3400 microprocessor trainer available in the laboratory. Make sure that you have an idea of the basic arrangement of a microcomputer. the architecture of a microprocessor, the execLltion of a program, and the basics for machine language and assembly language programming.

REFERENCE:
Heathkit EE-3401 Microprocessor Course

PROCEDURE:
1. Familiarise yourself with the operation of Ihe ET-3400 Illlcroprocessor trainer. A
manual of the trainer is available in the laboratory. 2. Simplc addition The following program adds two numbers stored in mcmory locations $0000 and $0001 and store the sum in location $0002. The program begins at location $0010. Enter the machine code program into the ET-3400 and verify the operation of the program.

0010 0014 0016

ADDRESS M/C CODE INSTRUCTION COMMENTS LOAD ADDEND LDAA SOO 9600
91l 01 9702 3E

INTO ACC.A

0012

ADDA $01
STAA $02

ADD AUGEND TO ACC.A STORE SUM IN LOCATION $0002 STOP OR WAIT rOR INTERRUPT

IVAI

3. Double precision addition. This program illustrates how to add two 2-bYle unsigned binary numbers to produce a sum of two bytes or three bytes tong. Adding in double precision basically involves saving the carry status from the lower byte and adding it to the highest byte in the least significant bit position. An instruction of the 6800, ADC. permits an add with carry to be performed with a single instruction. [n the following program. the addend is originally slored at location $0000 and $000 [ with the MSI3 at $0000 and the augend at location $0002 and $0003. The sum. in three bytes. is stored at the next three locations with the first byte as the MSB.

. DOUIlLE PRECISION ADDITION 0000 0000 0001 0002 0003 0004 0005 0006 0010 0010 0013 0015 0017 0019 OOIB 001D 7F 96 98 97 96 99 97 24 7C 3E 0004 01 03 06 00 02 05 03 0004 DONE 0001 0001 0001 0001 0001 0001 0001 ORG ADD I RMB ADD2 RMB AUGI RMB AUG2 RMB SUMI RMB SUM2 RMB SUM3 RMB ORG CLR LDA A ADD A STA A LDA A ADC A STAA BCC I 'C WAI I I I 0 FIRST BYTE OF ADDEND SECOND BYTE OF ADDEND FIRST BYTE OF AUGEND SECOND BYTE OF AUGEND FIRST BYTE OF SUM SECOND BYTE OF SUM THIRD BYTE OF SUM

SOOIO
SUM I CLEAR MSB OF SUM ADD2 GET 2-BYTE OF ADDEND AUG2 ADD 2BYTE OF AUGEND TO SUM3 STORE RESULT IN SUM2 ADDI GET FIRST BYTE OF ADDEND AUG2 ADD I-BYTE OF AUGEND TO I SUM2 STORE RESULT IN SUM2 DONE NO CARRY, DO E. SUM I CARRY, SET MSIl OF SUM

OOIF
0021 0024

4. Add five numbers. This is a program to add five numbers stored at lo cations $0000 through $0004 and Siore a single byte Slim allocation $0005, i gnoring any overflow of the sum. It illustrates how the accumulator B is used as a counter and the indexed Key in the program and verify. . ADD 5 NUMBERS IN LOCATIONS 50000-50004 . STORE ANSWER IN LOCATION S0005 0000 0000 0001 0002 0003 0004 0005 0010 0010 0011 0013 0016 0018 0019 ODIC 4F C6 05 ABOO 08 5A 97 05 A S TRT A II LOOP 0001 0001 0001 0001 0001 0001 A FIRST A SECOND A TlIIRD A FOURTH A fiFTH ORG RMB RMB RMB RMB RMB I ORG CLRA LDAB LDX ADD A INX DECB BNE STAA WAI LOOP ANSWER S05 $0000 X $0000
a ddressing

mode

used in [etching a list of numbers. The following is an assembly listing orthe program.

A ANSWER RMB

SOOIO
CLEAR TEMP, STORAGE ACCA INITIALIZE COUNTER POINT X TO LOCATION $0000 ADD ONE LOCATION TO ACCA POINT X TO NEXT LOCATlON DONE ALL fiVE LOCATIONS? BRANCH IF NOT STORE ANSWER

CE 0000 A

OOIA 26 FA ODI E 3E

5. Multiplication by shirting. In the following program a method identical with the penciland paper method is used for multiplication. It involves examining each bit of the multiply: from the right and if the bit is one. the multiplication is added to the product and then shifted one bit to the left; if the bit is a zero, the multiplication is merely shifted one bit to the left; the following is an example of multiplying decimal 130 and 5. DECIMAL 130 IJINARY 10000010 X 00000101 10000010 10000010 1010001010 Key in the program into the ET3400 and verify.

K.....2 --22Q

ROUTINE: TO MULTIPLY TWO 8-BIT BYTES ORG $0000 :MULTIPLICAND :MULTIPLIER :UPPER BYTE OF RESULT I I $0010 SIIiFT UPBYTE LOI3YTE PillER LOOP I PLCND SHIFT NOADD LOI3YTE PLCND LOBYTE UPBYTE SIIiFT UPI3YTE LOOP 2 MULT SHIFT MULTIPICAND LEFT UP. BYTE OF MULTICAND CLR ANSWER & SHIFT AREA :LOWER BYTE OF RESULT ;SHIFT MULTIPLICAND

0000 0000 0001 0002 0003 0004 0005 0010 0013 0016 0019 00113 0010 0020 0023 0024 0026 0028 002A 002C 002E 0030 0032 0033 0035 0036 71' 71' 7F 96 20 78 79 44 24 D6 DB D7 D6 D9 D7 4D 26 3E 00 10 E8 NOADD OD 03 00 03 02 04 02 00 00 00 00 00 04 02 03 01 06 00 04 LOOP I LOOP 2 MULT PLCND PLiER UPBYTE LOI3YTE SHIFT

RMB RMB RMB RMI3 RMB ORG CLR CLR CLR lOA A BRA ASL ROL LSR A BCC lOA 13 ADD B STA B LOA B ADC 13 STA 13 BNE WAI END

Potrebbero piacerti anche