Post on 30-May-2018
transcript
mith College
Computer Science
Dominique Thiébaut dthiebaut@smith.edu
CSC270 Spring 2016Circuits and Systems
Lecture Notes — Week 8
D. Thiebaut, Computer Science, Smith College
The Motorola 6811 Processor
• M68HC11 CPU • 8 Kbytes ROM • 512 Bytes of On-Chip EEPROM • 256 Bytes of On-Chip RAM • 8-Channel, 8-Bit Analog-to-Digital (A/D) Converter • 38 General-Purpose Input/Output (I/O) Pins
D. Thiebaut, Computer Science, Smith College
The Motorola 6811 Processor
• M68HC11 CPU • 8 Kbytes ROM • 512 Bytes of On-Chip EEPROM • 256 Bytes of On-Chip RAM • 8-Channel, 8-Bit Analog-to-Digital (A/D) Converter • 38 General-Purpose Input/Output (I/O) PinsSystem On a Chip
(SOC)
D. Thiebaut, Computer Science, Smith College
A Sample of 6800 Instructions
http://www.science.smith.edu/dftwiki/images/9/9e/CSC270_Assembly_Instructions.pdf
D. Thiebaut, Computer Science, Smith College
LDAALDAA 0A ; AccA <— Mem[A] (direct)LDAA 0100 ; AccA <— Mem[100](extended)LDAA #3 ; AccA <— 3 (immediate)LDAA X,4 ; AccA <— Mem[X+4](indexed)
LDABLDAB F0 ; AccB <— Mem[F0] (direct)LDAB 0200 ; AccB <— Mem[200](extended)LDAB #3 ; AccB <— 3 (immediate)LDAB X,4 ; AccB <— Mem[X+4](indexed)
LDXLDX #0010 ; X <- 0010 (immediate)
D. Thiebaut, Computer Science, Smith College
STAA
STAA 00 ; Mem[0] <— AccA (direct)STAA 0000 ; Mem[0] <— AccA(extended)
STAB
STAB 00 ; Mem[0] <— AccB (direct)STAB 0000 ; Mem[0] <— AccB(extended)
D. Thiebaut, Computer Science, Smith College
ADDA
ADDA 00 ; AccA <— AccA + Mem[0](direct)ADDA 0000 ; AccA <— AccA + Mem[0](extended)ADDA #3 ; AccA <— AccA + 3 (immediate)
ADDB
ADDB 00 ; AccB <— AccB + Mem[0](direct)ADDB 0000 ; AccB <— AccB + Mem[0](extended)ADDB #3 ; AccB <— AccB + 3 (immediate)
ABA
ABA ; AccA <— AccA + AccB (inherent)
D. Thiebaut, Computer Science, Smith College
INCAINCA ; AccA <— AccA + 1 (inherent)
INCINC 0003 ; Mem[03] <— Mem[03]+1 (extended)
INCBINCB ; AccB <— AccB + 1 (inherent)
D. Thiebaut, Computer Science, Smith College
void main() { char a=2, b=3, result=0; result = a + b; }
ORG 0000a DB 3b DB 4result DB ? ORG 0010start: LDAA a ADDA b STAA result JMP start
D. Thiebaut, Computer Science, Smith College
Assembling By Hand
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
ORG 0000a DB 3b DB 4result DB ?
ORG 0010start: LDAA a
ADDA b STAA result JMP start
D. Thiebaut, Computer Science, Smith College
Assembling By Hand
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
ORG 0000a DB 3b DB 4result DB ?
ORG 0010start: LDAA a
ADDA b STAA result JMP start
What can you say about the different
bytes?
D. Thiebaut, Computer Science, Smith College
Side Notes• Motorola 6811 instruction set different from the
Pentium instruction set. Different register sets.
• Different architecture but same groups of instructions (data move, arithmetic and logic, control), and similar addressing modes.
• A note about C, C++, Java and Python programs running on different processors.
• Speed of execution C++, vs Java, vs Assembly http://www.science.smith.edu/dftwiki/index.php/Speed_of_Instructions:_Nasm,_Java,_C%2B%2B_and_Python_comparison
D. Thiebaut, Computer Science, Smith College
Assembling By Hand
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
ORG 0000a DB 3b DB 4result DB ?
ORG 0010start: LDAA a
ADDA b STAA result JMP start
D. Thiebaut, Computer Science, Smith College
Assembling By Hand
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
ORG 0000a DB 3b DB 4result DB ?
ORG 0010start: LDAA a
ADDA b STAA result JMP start
D. Thiebaut, Computer Science, Smith College
Assembling By Hand
http://www.ele.uri.edu/Courses/ele205/6811-Instructions/index.html
ORG 0000a DB 3b DB 4result DB ?
ORG 0010start: LDAA a
ADDA b STAA result JMP start
D. Thiebaut, Computer Science, Smith College
Assembling with an Assembler
Visit this page before continuing…
D. Thiebaut, Computer Science, Smith College
Assembling with an Assembler
http://www.science.smith.edu/dftwiki/index.php/CSC270_Assembling_6800_Assembly_Programs_on_OSX/Windows
D. Thiebaut, Computer Science, Smith College
www.science.smith.edu/dftwiki/index.php/CSC270_Assembling_6800_Assembly_Programs_on_OSX/Windows
D. Thiebaut, Computer Science, Smith College
www.science.smith.edu/dftwiki/index.php/CSC270_Assembling_6800_Assembly_Programs_on_OSX/Windows
D. Thiebaut, Computer Science, Smith College
www.science.smith.edu/dftwiki/index.php/CSC270_Assembling_6800_Assembly_Programs_on_OSX/Windows
0000 03 0001 04 0002 00 … 0010 96 0011 00 0012 9B 0013 01 0014 97 0015 02 0016 7E 0017 00 0018 10
D. Thiebaut, Computer Science, Smith College
ExerciseWrite and assemble a 6800 assembly program that computesy = 2*x + 3, where x and y are byte variables…
D. Thiebaut, Computer Science, Smith College
Instructions Cycles
http://www.science.smith.edu/dftwiki/images/7/71/6811CycleByCycle.pdfSection 10, Pages 10-6 and 10-13:
D. Thiebaut, Computer Science, Smith College
Example Program ORG 0000
a DB 0
ORG 0010start: INC a JMP start