Using-6502-Assembly-Language-by-Randy-Hyde.pdf
(
504 KB
)
Pobierz
HOW TO PROGRAM THE APPLE II
USING 6502
ASSEMBLY LANGUAGE
With an Introduction to Sweet-16
DATAMOST
by Randy Hyde
Apple II is a trademark of Apple Computer, Inc.
DATAMOST
8943 Fullbright Ave., Chatsworth, CA 91311
cover
*****************************************************************
USING 6502
ASSEMBLY
LANGUAGE
*****************************************************************
USING 6502 ASSEMBLY
LANGUAGE
How Anyone Can Program the Apple II
By Randy Hyde
A Product of
DATAMOST, INC.
8943 Fullbright Avenue
Chatsworth, CA 91311
(213) 709-1202
1st Printing October 1981
2nd Printing December 1982
*****************************************************************
-ACKNOWLEDGMENTS-
This book represents many hours of dedicated work by myself
and everyone involved in its generation. While their names do not
appear on the cover, special credit is due to David Gordon, Larry
Bouyer, and my wife Mandy. The management and marketing
efforts by Dave made this book possible (although it took a long
time...). Larry and Mandy transformed a computer program-
mer's "illiterate" rough draft into this document. Many thanks also
to Glynn Dunlap, whose wonderful cartoons added greatly to this
book. I owe these four people a great deal.
(213) 709-1201
The material included in Appendix A is reproduced with the
permission of Apple Computer, Inc. It is originally printed in "The
Apple II Reference Manual" copyrighted by Apple Computer.
Thanks is hereby given to Apple Computer for allowing repro-
duction herein.
COPYRIGHT (C) 1981 BY DATAMOST
This manual is published and copyrighted by DATAMOST. All
rights are reserved by DATAMOST. Copying, duplicating, selling
or otherwise distributing this product is hereby expressly forbid-
den except by prior written consent of DATAMOST.
The word APPLE and the Apple logo are registered trademarks
of APPLE COMPUTER, INC.
APPLE COMPUTER, INC. was not in any way involved in the
writing or other preparation of this manual, nor were the facts
presented here reviewed for accuracy by that company. Use of
the term APPLE should not be construed to represent any en-
dorsement, official or otherwise, by APPLE COMPUTER, INC.
i
*****************************************************************
TABLE OF CONTENTS
NOTE
An alphabetical index is located in the back of this manual.
Chapter 1
INTRODUCTION
Purpose of Manual
Scope of Manual
General
Chapter 2
SYMBOLISM
General
Bit Strings
Binary Arithmetic
Unsigned Integers
Nibbles (NYBBLES?), Bytes, and Words
Signed Integers
Hexadecimal Numbers
Radix and Other Nasty Diseases
ASCII Character Set
Using Bit Strings to Represent Instructions
Chapter 3
REGISTERS, INSTRUCTION FORMATS,
AND ADDRESSING
General
Accumulator (A or ACC)
X-Register (X)
1-1
1-1
1-1
1-1
2-1
2-1
2-3
2-8
2-9
2-10
2-11
2-13
2-14
2-14
2-16
3-1
3-1
3-3
3-3
Y-Register (Y)
Stack Pointer (SP)
Program Status Word (P or PWS)
Program Counter (PC)
Instruction Format (6502)
Two and 3-Byte Instructions
6502 Addressing Modes
iii
3-3
3-4
3-4
3-4
3-4
3-6
3-8
*****************************************************************
Chapter 4
SOME SIMPLE INSTRUCTIONS
General
Assembly Language Source Format
Introduction to Real Instructions
Register Increments and Decrements
Labels and Variables
Expressions in the Operand Field
Chapter 5
ASSEMBLY LANGUAGE
General
Example Program
JMP Instruction
Processor Status (P) Register
Break Flag (B)
Decimal Flag (D)
Interrupt Disable Flag (Z)
Condition Code Flags (N, V, Z, C)
Branch Instructions (6502)
Loops
Comparisons
IF/THEN Statement Simulation
FOR/NEXT Loop Revisited
Testing Boolean Values
Chapter 6
ARITHMETIC OPERATIONS
General
Unsigned Integer (Binary) Arithmetic
Subtraction
Signed Arithmetic
Signed Comparisons
Binary Coded Decimal Arithmetic
Unsigned BCD Arithmetic
Signed BCD Arithmetic
Arithmetic Review
iv
*****************************************************************
Chapter 7
SUBROUTINES AND STACK PROCESSING
7-1
4-1
4-1
4-1
4-4
4-8
4-9
4-11
5-1
5-1
5-2
5-3
5-5
5-6
5-6
5-6
5-7
5-9
5-10
5-11
5-14
5-14
5-18
6-1
6-1
6-1
6-4
6-5
6-7
6-8
6-8
6-10
6-10
General
Variable Problems
Passing Parameters
Chapter 8
ARRAYS, ZERO PAGE, INDEXED, AND
INDIRECT ADDRESSING
General
Zero Page Addressing
Arrays in Assembly Language
Initializing Arrays at Assembly Time
Using Index Registers to Access Array Elements
Indirect Addressing Mode
Indirect Indexed Addressing
Indexed Indirect Addressing Mode
Chapter 9
LOGICAL, MASKING, AND BIT OPERATIONS
General
Complement Function
AND Function
OR Function
EXCLUSIVE-OR Function
Bit String Operations
Instructions for Logical Operations
Masking Operations
Shift and Rotate Instructions
Shifting and Rotating Memory Locations
Using ASL to Perform Multiplication
Using Shifts to Unpack Data
Using Shifts and Rotates to Pack Data
Chapter 10
MULTIPLE-PRECISION OPERATIONS
General
Multiple-Precision Logical Operations
v
7-1
7-4
7-13
8-1
8-1
8-1
8-3
8-8
8-10
8-13
8-16
8-18
9-1
9-1
9-2
9-2
9-3
9-4
9-4
9-5
9-7
9-13
9-16
9-17
9-19
9-20
10-1
10-1
10-1
*****************************************************************
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Multiple-Precision
Signed Comparisons
Chapter 11
BASIC I/O
General
Shifts and Rotates
Logical Shift-Right Sequences
Rotate-Left Sequences
Rotate-Right Sequences
Unsigned Arithmetic
Unsigned Subtraction
Signed Arithmetic
Decimal Arithmetic
Increments
Decrements
Unsigned Comparisons
10-3
10-4
10-4
10-5
10-6
10-8
10-9
10-9
10-9
10-10
10-11
10-14
11-1
11-1
Character Output
Standard Output and Peripheral Devices
Character Input
Inputting a Line of Characters
Chapter 12
NUMERIC I/O
General
Hexadecimal Output
Outputting Byte Data as a Decimal Value
Outputting 16-Bit Unsigned Integers
Outputting Signed 16-Bit Integers
An Easy Method of Outputting Integers
Numeric Input
Unsigned Decimal Input
Signed Decimal Input
Chapter 13
MULTIPLICATION AND DIVISION
General
Multiplication
Division Algorithms
vi
11-1
11-9
11-11
11-13
12-1
12-1
12-1
12-2
12-4
12-6
12-6
12-8
12-11
12-17
13-1
13-1
13-1
13-7
*****************************************************************
Chapter 14
STRING HANDLING OPERATIONS
String Handling
Declaring Literal Strings
String Assignments
String Functions
String Concatenation
Substring Operations
String Comparisons
Handling Arrays of Characters
Chapter 15
SPECIALIZED I/O
Apple I/O Structure
Chapter 16
AN INTRODUCTION TO SWEET-16
Sweet-16
Sweet-16 Hardware Requirements
Chapter 17
DEBUGGING 6502 MACHINE LANGUAGE
PROGRAMS
General
GO Command (G)
Initializing Registers and Memory
Modifying Instruction Code (Patching)
Program Debugging Session
Appendix A
14-1
14-1
14-5
14-5
14-7
14-9
14-11
14-12
14-17
15-1
15-1
16-1
16-2
16-10
17-1
17-1
17-2
17-3
17-6
17-10
Plik z chomika:
jacekplacekjacek
Inne pliki z tego folderu:
Zrozumieć Asembler - Jeff Duntemann.pdf
(101942 KB)
64-ia-32-architectures-software-developer-manual-325462.pdf
(22676 KB)
The.Art.of.Assembly.Language.2nd.Edition.pdf
(22431 KB)
r20ut0570ej0100_rxc_101u.pdf
(20027 KB)
8086_family_Users_Manual_1_.pdf
(9438 KB)
Inne foldery tego chomika:
Arduino
C++
DirectX
GDB
Gdi
Zgłoś jeśli
naruszono regulamin