Académique Documents
Professionnel Documents
Culture Documents
Introduction
The purpose of this experiment is to show the method used to develop and test
68000 microprocessor assembly language programs.
Procedure
1. First, go to the author's web site and download the newest versions of ASM68K
and EMU68K. The web site is located at
http://web.sunybroome.edu/~antonakos_j/68ktoc.html
Note: Save the files in a directory or folder specified by the instructor.
2. Place a copy of the program HELLO.ASM into the software folder from step 1.
HELLO.ASM is located on the companion CD in the ch01 folder.
3. Open a DOS window and navigate to the software directory from step 1.
4. Enter the following command at the DOS prompt:
edit hello.asm
You should see the following code:
ORG
DC.B
DC.B
ORG
START MOVEA.L
TRAP
TRAP
END
HMSG
$8000
'Hello!'
0
$8100
#HMSG,A3
#3
#9
START
HELLO.OBJ,
and
HMSG
START
ORG
DC.B
DC.B
ORG
MOVEA.L
TRAP
TRAP
END
$8000
'Hello!'
0
$8100
#HMSG,A3
#3
#9
START
Note that the ASM68K assembler has determined all the addresses and opcodes for
the source instructions.
9. Exit the editor by pressing Alt, then F, then X.
10. Simulate the execution of the HELLO code by loading it into the EMU68K
emulator with the following DOS command:
emu68k hello
You should see something like this:
68000 Emulator V4.1, 8/12/03
54984 (0xD6C8) bytes allocated for emulator memory.
S008000068656C6C6FE3
S10A800048656C6C6F210060
S10D8100267C000080004E434E4927
S90381007B
Starting address: 8100
hello.hex loaded into emulator memory.
Enter '?' for help
-
The four lines of text beginning with S are the Motorola S-records that represent the
68000 machine code and data for the HELLO program. The program is
automatically loaded into the correct memory locations for emulation.
11. Simulate the program by entering g at the EMU68K command prompt:
-g
Hello!Program exit at address 00008108
DODIGIT
ORG
MOVE.W
MOVE.W
MOVE.W
BSR
MOV.W
BSR
MOVE.W
BSR
MOVE.W
BSR
MOVE.B
ADDI.B
TRAP
RTS
$8100
#54321,D7
D7,D6
#10000,D5
DODIGIT
#1000,D5
DODIGIT
#100,D5
DODIGIT
#10,D5
DODIIT
D6,D1
#$30,D1
#1
ANDI.L
DIVU
MOVE.B
ADDI.B
TRAP
SWAP
RTS
#$FFFF,D6
D5,D6
D6,D1
#$30,D1
#1
D6
END
SHOWDECI
;init D7 to 54321
;make copy of input number
;do 10,000's digit
;do 1,000's digit
;do 100's digit
;do 10's digit
;load 1's digit
;add ASCII bias
;and display
;clear upper word of D6
divide D6 by D5
;load result digit
;add ASCII bias
;display digit
;get remainder
Note: Enter the program exactly as shown here. There are deliberate errors within
the source statements that will need correction after their errors are reported by the
ASM68K assembler. When the program assembles without errors, use EMU68K to
simulate it. You should see the correct output of '54321' displayed, followed by an
error message. What is the error message? Can you explain the reason for the error?
14. Change the RTS instruction at the end of the SHOWDECI code to TRAP #9.
15. Reassemble the program and simulate it. Has the error gone away?
A Little Deeper
16. Compare the information found in HELLO.HEX with the address/opcode
information contained in HELLO.LST. What can you discover about the Motorola Srecords?
S008000068656C6C6FE3
S10A800048656C6C6F210060
S10D8100267C000080004E434E4927
S90381007B