Lab 1 Complete
Lab 1 Complete
Lab 1 Complete
MATRIX
NUMBER
16DTK14F1019
DTK5A
CLASS
LECTURE
GROUP 2
CONTENTS
GROUP 2
INTRODUCTION
Theory:
LAB1.L68K
LAB1.S68
(listing
file)
(S-record file)
Sim68K
(simulato
r)
program
execution
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
Mandatory
Optional
3
; COMMENTS
GROUP 2
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
GROUP 2
Objectives:
Equipment:
1. Computer
2. Easy68K software
3. Calculator
4. Flash drive
GROUP 2
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
GROUP 2
Figure 2: LAB1A.X68
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.
GROUP 2
GROUP 2
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
ex: Input 8-bit data from register D6 into D7
MOVE.B D6,D7
Input decimal value 69 into D6
MOVE.B #69,D6
Input 32-bit $1200 into register D0
MOVE.L #$1200,D0
Input 16-bit -1 (Negative one) into register D1
MOVE.W #(-1),D1
Input octal value 753 into D2
MOVE.L #@753,D2
Input binary value 11001001011 into D3
MOVE.L #%11001001011,D3
Input character A into D4
MOVE.L $A,D4
Input character QUIT into D5
MOVE.L #QUIT,D5
Input hexadecimal value 1350 into A0
MOVE.W #$1350,A0
Copy data from register D5 into D6
MOVE.L D5,D6
Copy value from register A0 into A1
MOVE.L A0,A1
GROUP 2
10
GROUP 2
LEN
TABLE1
TABLE2
ORG
EQU
DC.B
DS.B
$0900
$0902
$23,$17,$F2,$A3
6
11
LEN
Example
EQU 100
ORG $0800
VAR
DC.B 2,18
TAB
DS.B 10
GROUP 2
VAR
DC.W
$43AF
12
GROUP 2
Figure 2: LAB1A.X68
13
GROUP 2
3. Click View > Memory. Go to address $0900 and analyze the content inside memory. Put your
analysis into Table 3 below.
Address
$0900
$0902
$0904
$0906
$0908
Data (Hex)
23
F2
FF
FF
FF
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
Table 2
14
GROUP 2
QUESTION
1. Using Easy68K to debug the error coding below. Write down the correct coding.
ORG
DC.B
DS.W
HOUSE
BLOCK
STAIR DC.W
25AC
START
ORG
MOVE.B
MOVE
MOVE.L
MOVEA.L
MOVE.W
END
1200
$57AE,$44DC,@1313,$A3
2
1400
#$1234,D0
D0,D1
$04B0,D2
#$04B6,A0
(A0),D3
START
15
GROUP 2
16
GROUP 2
17
GROUP 2
18
GROUP 2
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
CONCLUSION
19
GROUP 2
i. . Discovery Issues
that there are problems in the course of practical training is a coding error that can
not be run the next process.
This problem is solved by identifying coding wrong and corrected.
20