Sunteți pe pagina 1din 8

POLITEKNIK TUANKU SULTANAH BAHIYAH

LAB 1 Introduction of Instruction Set for Easy68K


DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 1/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
Objectives:

1. Understanding instruction line up for each block and try simulate.


2. Understanding for simple for Address Register Direct
3. Determine the using for Define Variables and Define Constant

Equipment:

1. Computer
2. Easy68K software
3. Calculator
4. Flash drive

Theory:

Motorola 68000 Designed by Motorola Inc. in 1979 which is consists of 68,000


transistors (< 1 MIPS (Million Instructions per Second)). It is used in Apple Mac,
Sun, Silicon Graphics, and Apollo workstations. 16-bit microprocessor lends to
the 16-bit data bus and it introduced to replace 8-bit microprocessors. This 16-bit
microprocessor helps to overcome the lacking of instruction sets and addressing
capabilities. Motorola 68000 also known as multiprocessing and multitasking
microprocessor because it can executes many programs at one time.
EASY68K stand for Editor, Assembler, and Simulator for the 68000
microprocessor. This software able you to create and run 68000 assembly
language program on a Windows PC. EASY68K consists of:
1.
Edit68K Editor program for writing and assembling a program.
2.
Sim68K Simulator program for simulate or running a program.
LAB1.X68
(source
file)
Edit68K
(assemble
r)

LAB1.L68K
LAB1.S68
(S-record file)
Sim68K(listing file)
(simulato
r)

program
execution

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 2/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
Assembly Language Syntax stated that each line of a program must have an
instruction, an assembler directive (or pseudo-op) and a comment. Whitespace
(between symbols) and case are ignored. Comments (beginning with ;) are also
ignored. An instruction has the following format:
LABEL

OPCODE

OPERANDS

; COMMENTS

Mandatory
Optional
Opcodes - Reserved symbols that correspond to LC-3 instructions; for example:
ADD, AND, LD, LDR
Operands - Registers: specified by Rn, where n is the register number
- Numbers: indicated by numbers symbol typing
- Label: symbolic name of memory location (separated by comma)
Example:
MOVE.B
#$12,D2
Label - placed at the beginning of the line and assigns a symbolic name to the
address corresponding to line
Example:
LOOP
MOVE.B #$12,D2
Comment - anything after a semicolon is a comment and used by humans for
references because its ignored by assembler

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 3/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
Activity 1: Program Writing With Edit68K
1. Click: Start > All program > EASy68K > Edit68K.

Figure 1: Edit68K
2. Type the following program and saved as LAB1A.X68
*----------------------------------------------------------* Program Number: LAB1A.X68
* Written by
: (GROUP)
* Date Created : DD.MM.YYYY
* Description
: MOVE INSTRUCTION
*----------------------------------------------------------START ORG
$1000
MOVE.B
#$12,D0
; Instruction 1
MOVE.W
#$1234,D1
; Instruction 2
MOVE.L
#$12345678,D2 ; Instruction 3
MOVE.W
D2,D3
; Instruction 4
MOVE.B
D1,D4
; Instruction 5
MOVE.W
D1,D5
; Instruction 6
MOVE.B
D3,D6
; Instruction 7
MOVE.W
D5,D7
; Instruction 8
MOVE.W
D7,D0
; Instruction 9
MOVE.B
D3,D1
; Instruction 10
END
START

Figure 2: LAB1A.X68

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 4/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
3. Make sure every writing is in the right place for LABEL, OPCODE, OPERAND and
COMMENT
4. There are several way to assembling file, choose either one:
a. Click : Tools | Assembly Source or
b. Click button
c. Press F9
5.

or

EASy68K will check error and display it if available. If any, double click the Error
Message to locate and correct the error. Repeat step 1 until no error available.

ERROR
MESSAGE
Figure

3: Error in
program

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 5/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
6. If no error detected in assembly process, the following dialog will appear.

Figure 4 : No error in program


7. To simulate the LABORATORY1.X68, simply click EXECUTE button and SIM68K will
appear as figure below:
Register available in MC68000
microprocessor

Memory address for each


instruction

highlighted instruction is the instruction


to be execute

LAB1A.X68 (PROGRAM)

Machine code
(understand
by computer)

Figure 5: Sim68K

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 6/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
Activity 2: Address Register Direct
1. By referring to the instruction in Figure 2, manually do instructions according to the below
statements first without using Easy68K.
Table 1: Translation statement into code
Statement
Instruction Code
MOVE.B D6,D7
ex: Input 8-bit data from register D6 into D7
MOVE.B #69,D6
Input decimal value 69 into D6
MOVE.L #$1200,D0
Input 32-bit $1200 into register D0
MOVE.W #(-1),D1
Input 16-bit -1 (Negative one) into register D1
MOVE.L #@753,D2
Input octal value 753 into D2
MOVE.L #%11001001011,D3
Input binary value 11001001011 into D3
MOVE.L $A,D4
Input character A into D4
MOVE.L #QUIT,D5
Input character QUIT into D5
MOVE.W #$1350,A0
Input hexadecimal value 1350 into A0
MOVE.L D5,D6
Copy data from register D5 into D6
MOVE.L A0,A1
Copy value from register A0 into A1
2. From the Table 1 above, write a complete running instruction code into a box below. Use
software Easy68K as your guide and debugging process.

Activity 3: Using Define Variable and Define Constant


1. Refer to the Table 2 below to get understanding of directive description.
Directive Name
Description
EQU
Give a value to a symbol
ORG
Set starting value of location counter

LEN

Example
EQU 100
ORG $0800

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 7/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54

DC[.size]

DS[.size]

where code or data will go


Allocate and initialize storage for
variables. Size can be b (byte), w (two
bytes) or l (4 bytes). If no size is
specified, b is uses
Allocate specified number of storage
spaces. size is the same as for dc directive

VAR

DC.B 2,18

TAB

DS.B 10

2. Key-in instruction below using Easy68K and RUN it.

LEN
TABLE1
TABLE2
VAR

ORG
EQU
DC.B
DS.B
DC.W

$0900
$0902
$23,$17,$F2,$A3
6
$43AF

3. Click View > Memory. Go to address $0900 and analyze the content inside memory. Put your
analysis into Table 3 below.
Address
Data (Hex)
$0900
23
$0902
F2
$0904
FF
$0906
FF
$0908
FF
$090A
43
$090C
FF
Question:
Answer all questions below.

Analysis
Data 23 into Address 900
Data F2 into Address 902
Data FF into Address 904
Data FF into Address 906
Data FF into Address 908
Data 43 into Address 90A
Data FF into Address 90C

1. Using Easy68K to debug the error coding below. Write down the correct coding.

HOUSE
BLOCK
STAIR
START

ORG
DC.B
DS.W
DC.W
ORG

1200
$57AE,$44DC,@1313,$A3
2
25AC
1400

POLITEKNIK TUANKU SULTANAH BAHIYAH


LAB 1 Introduction of Instruction Set for Easy68K
DEC 3043 Microprocessor Fundamentals
NAME
CLO 3
FULL MARK : 100 M
Mohd Syahir Bin Abd Sukor
REG NO
Page : 8/9
16DTK14F1019
CLASS
PREPARED : Nur Akhyar bin Nordin
DTK54
MOVE.B
MOVE
MOVE.L
MOVEA.L
MOVE.W
END

Answer :

2. What is the meaning of .B, .W and .L?


Answer:
B : Using Binary value
W :Using 16-bit of hexa
L : Using 32-bit of hexa

#$1234,D0
D0,D1
$04B0,D2
#$04B6,A0
(A0),D3
START