advanced_6502_programming.pdf

(6566 KB) Pobierz
Advanced
ADVANCED
6502
PROGRAMMING
RODNAY ZAKS
BERKELEY • PARIS • DUSSELDORF
SYM is a trademark of Synertek Systems, Inc.
KIM is a trademark of MOS Technology, Inc.
AIM65 is a trademark of Rockwell International, Inc.
“ COMPUTEACHER” and “ GAMES BOARD” are trademarks of Sybex, Inc.
Cover design by Daniel Le Noury
Technical illustrations by Guy S. Orcutt and j. trujillo smith
Every effort has been made to supply complete and accurate information. However,
Sybex assumes no responsibility for its use, nor for any infringements of patents or other
rights of third parties which would result. No license is granted by the equipment
manufacturers under any patent or patent rights. Manufacturers reserve the right to
change circuitry at any time without notice.
© 1982 SYBEX Inc., 2344 Sixth Street, Berkeley, CA94710. World rights reserved. No
part of this publication may be stored in a retrieval system, transmitted, or reproduced in
any way, including but not limited to photocopy, photograph, magnetic or other record,
without the prior agreement and written permission of the publisher.
Based on
6502 Games
by Rodnay Zaks, © 1980 SYBEX Inc.
Library of Congress Card Number: 82-160235
ISBN 0-89588-089-X
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
C ontents
Preface
Introduction
Optional Hardware Support
2
Connecting the System
4
Games Board IjileiKanaecC.,.^ 7
jT h c K e y b tm rd ln p u jj^ ^ n e | 13
2
Generating Square Waves (Music Player)
Introduction
20
The Rules
20
A Typical Game
22
The Connections
22
The Algorithm
22
The Program
23
Pseudo Random Number Generator (Translate)
Introduction
41
The Rules
41
A Typical Game
42
The Algorithm
43
The Program
43
Hardware Random Number Generator
(Hexguess)
Introduction
59
The Rules
59
A Typical Game
59
The Algorithm
60
The Program
60
^
Simultaneous Input/Output (Magic Square)
Introduction
73
The Rules
73
A Typical Game
76
The Algorithm
78
The Program
80
^
Simple Real Time Simulation (Spinner)
Introduction
87
The Rules
87
The Algorithm
88
The Program
89
87
73
59
41
vu
1
20
Real Time Simulation (Slot Machine)
Introduction
99
The Rules
99
A Typical Game
100
The Algorithm
101
The Program
112
Real Time Strategies (Echo)
Introduction
137
The Rules
137
139
A Typical Game
The Algorithm
141
The Program
144
Using Interrupts (Mindbender)
Introduction
162
The Rules
162
162
A Typical Game
The Algorithm
165
The Program
167
Complex Evaluation Technique (Blackjack)
Introduction
189
The Rules
189
A Typical Game
190
The Program
194
Artificial Intelligence (Tic-Tac-T oe))
Introduction
218
The Rules
218
A Typical Game
218
The Algorithm
224
The Program
247
Appendices
A. 6502 Instructions—Alphabetic
287
B. 6502 Instruction Set—Hex and Timing
Index
288
99
137
162
189
218
287
290
Zgłoś jeśli naruszono regulamin