Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
2Activity

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
Programmanual

Programmanual

Ratings: (0)|Views: 5,295|Likes:
Published by neptuneknight

More info:

Published by: neptuneknight on Jan 25, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/13/2011

pdf

text

original

 
  Programming the 65816 
 Including the 6502, 65C02 and 65802
Distributed and published underCOPYRIGHT LICENSE AND PUBLISHING AGREEMENTwithAuthors David Eyes and Ron LichtyEFFECTIVE APRIL 28, 1992
 Copyright © 2007 by The Western Design Center, Inc.
2166 E. Brown Rd. Mesa, AZ 85213480-962-4545 (p) 480-835-6442 (f)www.westerndesigncenter.com 
 
The Western Design Center
2
Table of Contents1)Chapter One..........................................................................................................12
Basic Assembly Language Programming Concepts..................................................................................12
Binary Numbers
....................................................................................................................................................12
Grouping Bits into Bytes
.......................................................................................................................................13
Hexadecimal Representation of Binary
................................................................................................................14
The ACSII Character Set
.....................................................................................................................................15
Boolean Logic
........................................................................................................................................................16Logical And........................................................................................................................................................16Logical Or..........................................................................................................................................................17Logical Exclusive Or...........................................................................................................................................17Logical Complement...........................................................................................................................................17
Signed Numbers
....................................................................................................................................................18
Storing Numbers in Decimal Form
.......................................................................................................................19
Computer Arithmetic
............................................................................................................................................20
Microprocessor Programming
..............................................................................................................................20Machine Language..............................................................................................................................................20Assembly Language............................................................................................................................................22
Writing in Assembly Language
............................................................................................................................22
Basic Programming Concepts
...............................................................................................................................23Selection Between Paths......................................................................................................................................24Looping..............................................................................................................................................................24Subroutines.........................................................................................................................................................24
 2)Chapter Two..........................................................................................................26 
Architecture of the 6502............................................................................................................................26
Microprocessor Architecture
................................................................................................................................26
The 6502 Registers
................................................................................................................................................26The Accumulator................................................................................................................................................27The X and Y Index Registers...............................................................................................................................29The Status Register.............................................................................................................................................29Abbrev................................................................................................................................................................30Name..................................................................................................................................................................31The Stack Pointer................................................................................................................................................31The Program Counter..........................................................................................................................................33
Addressing Modes
.................................................................................................................................................33
Instructions
...........................................................................................................................................................35
The 6502 System Design
........................................................................................................................................38Pipelining...........................................................................................................................................................38Memory Order of Multiple-Byte Values..............................................................................................................39Memory-Mapped Input/Output............................................................................................................................39Interrupts............................................................................................................................................................39
NMOS Process
......................................................................................................................................................40
Bugs and Quirks
...................................................................................................................................................40
 3)Chapter Three.......................................................................................................41
Architecture of the 65C02.........................................................................................................................41
The 65C02 Architecture
........................................................................................................................................41
Addressing Modes
.................................................................................................................................................41
Instructions
...........................................................................................................................................................42
CMOS Process
......................................................................................................................................................42
Bugs and Quirks
...................................................................................................................................................42
 4)Chapter Four.........................................................................................................44
Sixteen-Bit Architecture The 65816 and the 65802...................................................................................44
 
The Western Design Center
3
Power-On Status: 6502 Emulation Mode..................................................................................................45The Full-Featured 65x Processor: The 65816 in Native Mode................................................................45
The Program Bank Register
.................................................................................................................................47
The Data Bank Register
........................................................................................................................................48
The Direct Page Register
......................................................................................................................................48
The Stack Pointer
..................................................................................................................................................48
Accumulator and Index Registers
........................................................................................................................48
Switching Registers Between Eight and Sixteen Bits
............................................................................................50
The Status Register
...............................................................................................................................................50
6502/65C02 Addressing Modes on the 65816
........................................................................................................51
New 65816 Addressing Modes
..............................................................................................................................52
Instructions
...........................................................................................................................................................54
Interrupts
..............................................................................................................................................................55
The 65802 Native Mode.............................................................................................................................55
Emulation Mode
....................................................................................................................................................58
Emulation Mode Registers
....................................................................................................................................60
Switching Between 6502 Emulation and Native Modes............................................................................61
Switching from Emulation to Native Mode
..........................................................................................................61
Switching from Native to Emulation Mode
..........................................................................................................61
65802/65816 Bugs and Quirks...................................................................................................................62
 5)Chapter Five..........................................................................................................64
SEP, REP, and Other Details....................................................................................................................64
The Assembler Used in This Book
........................................................................................................................66
Address Notation
...................................................................................................................................................68
6)Chapter Six............................................................................................................69
First Examples: Moving Data....................................................................................................................69
Loading and Storing Registers
.............................................................................................................................71Effect of Load and Store Operations on Status Flags............................................................................................73Moving Data Using the Stack..............................................................................................................................73Push....................................................................................................................................................................74Pushing the Basic 65x Registers..........................................................................................................................76Pull.....................................................................................................................................................................76Pulling the Basic 65x Registers...........................................................................................................................76Pushing and Pulling the 65816’s Additional Registers..........................................................................................78Pushing Effective Addresses................................................................................................................................79Other Attributes of Push and Pull........................................................................................................................79
Moving Data Between Registers
...........................................................................................................................79Transfers.............................................................................................................................................................79Exchanges...........................................................................................................................................................86
Storing Zero to Memory
.......................................................................................................................................86
Block Moves
..........................................................................................................................................................87
7)Chapter Seven.......................................................................................................89
SimpleAddressing Modes..........................................................................................................................89
Immediate Addressing
..........................................................................................................................................90
Absolute Addressing
.............................................................................................................................................92
Direct Page Addressing
.........................................................................................................................................94
Indexing
.................................................................................................................................................................95
Absolute Indexed with X and Absolute Indexed with Y Addressing
...................................................................98
Direct Page Indexed with X and Direct Page Indexed with Y Addressing
........................................................101
Accumulator Addressing
....................................................................................................................................103
Implied Addressing
.............................................................................................................................................103
Stack
....................................................................................................................................................................104
Direct Page Indirect Addressing
.........................................................................................................................104
Absolute Long Addressing
..................................................................................................................................105

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->