APocket Handbook· . for the -
COMMODORE 64
A Pocket Handbook for the Commodore 64
A Pocket Handbook
for the Commodore 64
Peter Gerrard & Danny Doyle
Duckworth
First published in 1983 by Gerald Duckworth & Co. Ltd. The Old Piano Factory 43 Gloucester Crescent, London NW1
© 1983 by Peter Gerrard All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the publisher. ISBN 0 715617877
British Library Cataloguing in Publication Data Gerrard, Peter A pocket handbook for the Commodore 64. 1 . Commodore 64 (Computer) I . Title 001 .64' 0A76.8.C64 ISBN 0-7156-1787-7
Printed in Great Britain by Redwood Burn Ltd., Trowbridge and bound by Pegasus Bookbinding, Melksham
Contents Preface
6
ASCII tables Basic keywords Basic error messages Colour memory Conversion tables Disk commands Disk error messages Disk formats Extramon listing Flow charting Hex/Dec convertor Hyperbol ic functions Memory maps Memory architecture M/C instruction set M/C mnemonics Powers tables Cartridge slot Joystick slot RS232 standards Centronics standards Other output Screen memory Sound chip registers Musical notes values Sprite memory diagram
7
Index
9 12 14 15 19 21
26 35
40 42
43 44 51
54 74 76 77 78 79
86 87
89
90 91
93 95
Preface
This book is a collection of relevant facts and figures about your Commodore 64 computer. As well as including full memory maps, microprocessor instruction set, computer glossary, interface tables, disk formats, Basic commands, input/output tables, memory architecture, and much more, this conveniently sized book tells you, at a glance, any important fact you need to know when programming and using your computer. We've tried to include as much relevant material as possible in as small a space as possible. As a result, the majority of this book is simply facts and figures: one day we might write a book with words in it! We'd like to thank Jim Butterfield (without whom ... ) for getting the whole Commodore scene rolling in his own inimitable style, anyone who's given us any help, advice and information in compiling this book, the New Inn in Gawcott for providing excellent pints of Marston ales in times of stress, and finally our wives, Penny and Beryl, for putting up with us. P.G. and D.O.
6
ASCII tables
Standa.-d ASCII characters (7- bit cod .. ) -------- ------------------------------------------- - ------- --:; 7 0 2 3 4 6 ------+-----+-----+-----+ -----+-----+-----+----MSD LSD 000 00 1 010 011 100 101 110 111 -----------+------+----------------------------------------@ 0 0000 NUL OLE SP 0 P P Q A 1 0001 SOH DCl 1 a q 0010 STX DC2 2 B R b 2 3 0011 ETX DC3 £ 3 C 5 co 5 $ 4 0100 EDT DC4 4 0 T d t :; :; ENQ 0101 NAK 'l. E U u F V f v 6 0110 ACK SYN !< 6 0111 BEL ETB 7 G W w 7 9 8 1000 BS CAN 8 H X h x 9 100 1 HT EM 9 I Y y j A 1010 LF J Z z SUB * [ 10 11 VT ESC K k B + 1100 FF FS L 1 C < 0 1101 CR GS M m ) E 1110 SO RS N n F 1111 51 US / ? 0 0 DEL +-- --------------- -------------------------------------------+
.-
.
Th .. ASCII symbols. NUL SOH STX ETX EDT ENQ ACK BEL BS HT LF VT FF CR SO 51
-
Null Sta.-t of H.. ading Sta.-t of T.. x t End of T.. xt End of T.-ansmission Enqui.-y Acknowl .. dg .. Bell (audibl .. al ...-t) Backspac .. Ho.-izontal Tabulation Lin .. F .... d V.. .-tical Tabulation Form F .... d Car.-iag .. R.. tu.-n Shift Out Shift In
DLE DC NAK SYN ETB CAN EM SUB ESC FS GS RS US SP DEL
- Data Link Escap ..
-
Device Cont.-ol N.. gativ .. Acknowl .. dg .. - Synchronous Idl .. - End of Transmission Block
- Cancel
-
-
-
-
-
End of Medium Substitut .. Escap .. Fil .. S .. pa.-ato.G.-oup S .. pa.-ato.Reco.-d Separator Unit S .. pa.-ator Spac .. (Blank) D.. I .. t ..
7
Key b oa~d
NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO
8
-
CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL CNTL
1
A B C 0
E F G H/BS I1TAB J/LF K L M/CR N
CNTL Seq uences. OLE - CNTL P OCl/2/3/4 - CNTL Q/RIS/T NAK - CNTL U SYN - CNTL V ETB - CNTL W CAN - CNTL X EM - CNTL Y SUB - CNTL Z ESC ESC FS - CNTL BACKSLASH CNTL GS - CNTL RS - CNTL US SP - Space - CNTL 0 SI
Basic keywords
BASIC Commands Command ABS AND ASC ATN CHR$ CLOSE CLR CMD CONT COS DATA DEF FN DIM END EXP FN FOR FRE GET GET£ GOSUB GOTO IF INPUT INPUT£ INT LEFT$ LEN LET LIST LOAD LOG MID$ NEW NEXT NOT ON OPEN OR PEEK POKE
Format ABS«expression ) l ( expression ) AND ( e x pression > ASC « string » ATN « number » CHR$ «number ) l CLOSE
CLR CMD ( file number > [,string] CONT COS « number ) l DATA ( list of constants ) DEF FN DIM «subscripts ) l[, «subscripts ) l •.. ] END EXP«number > l FN( number ) «number >l FOR = <start > TO < limit > [STEP < increment ) FRE « dummy » GET ( variable list > GET£ , < variable list > GOSUB < line number > GOTO < line number ) IF <expression ) THEN < line number > IF ( expression ) GOTO < line number > IF <expression > THEN <statement > INPUT [" <prompt ) "]; ( variable list ) INPUT£, I NT « numer i c » LEFT$«string >, < integer >l LEN « stri ng » LET = <expression > LIST [[ ( first-line ) ] - [ ( last-line >]] LOAD [" "][, <device >] LOG«numeric >l MID$«string > , [, ][, ] ••• NOT <expression > ON < variable > GOTO/GOSUB [, ( line-number ) ] .•• OPEN ,[ <device >][, < address >] [," ( file - name >[, ( type >][, <mode >]"] OR < operand > PEEK «numeric >l POKE < location >,
9
POS PRINT PRINT£ READ REM RESTORE RETURN RIGHT$ RND RUN SAVE SGN SIN SPC SQR STATUS STOP STR$ SYS TAB TAN TIME TIME$ USR VAL VERIFY WAIT
POS «dummy » PRINT [ [, ( variable ) ] [<,I; > [, ] RESTORE RETURN RIGHT$«string ) , ( numeric » RND«numeric » RUN [line number] SAVE ["
USR«numeric » VAL « string» VERIFY WAIT ( location ) , <mask - l >[, <mask-2 ) ]
[] indicates optional. <> indicates mandatory. () indicates brackets required.
10
OUT OF MEMORY
There is no more RAM available for program or
variables . This may also occur when too many FOR loops have been nested, or when there are too many GOSUBs in effect .
OVERFLOW
The result of a computation is larger than the largest
number allowed, which is 1.70141884E+38 .
REDIM'D ARRAY
An array may only be DIMensioned once . If an array
variable is used before that array is DIM' d , an automatic DIM operation is performed on that array setting the number of elements to ten , and any subsequent DIMs will cause this error .
REDO FROM START
Character data was typed in during an INPUT
statement when numeric data was expected . Just re-type the entry so that it is correct , and the program will continue by itself .
RETURN WITHOUT GOSUB
A RETURN statement was encountered,
and no GOSUB command has been issued .
STRING TOO LONG A string can contain up to 255 characters . ?SYNTAX ERROR A statement is unrecognizable by the Commodore 64 . A missing or extra parenthesis , misspelled keywords , etc .
TYPE MISMATCH
This error occurs when a number is used in pla ce of a
string, or vice-versa.
UNDEF'D FUNCTION
A user defined function was referenced , but it
has never been defined using the DEF FN statement.
UNDEF'D STATEMENT
An attempt was made to GOTO or GOSUB or
RUN a line number that doesn't exist.
VERIFY
The program on tape or disk does not match the program cur-
rently in memory.
13
Colour memory
COLUMN
30
10
10
39 55335
~
55196 55336 55376 55416 55456 55496 55536 55576 55616 55656 55696 55736 55776 55816 55856 55896 55936 55976 56016 56056 56096 56136 56176 56116 56156
I
,
I
z
10 ~
,
I
,
4-+-.' , I
10
14
t
56195
14
ARITHMETIC OPERATORS SYMBOL
]
EXAMPLE
PURPOSE
---------+ ---------------------+------ --------------------- ---------- ] ]
+
10 X
Y
]
10
Y
Z
DIVISION.
10 X
Y
Z
MULTIPLICATION.
10 X
Y + Z
ADDITION .
10 X
Y -
SUBTRACTION.
*
Z
10 IF X = Y THEN
<>
ASSIGNS VALUE TO VARIABLE .
10 IF X 10 IF
TEST FOR EQUALITY.
<> Y THEN
10 IF
TEST FOR INEQUALITY.
Y THEN
TEST FOR LESS THAN.
> Y THEN
(=
10 IF X <= Y THEN
>=
] ]
TEST FOR GREATER THAN. TEST FOR LESS THAN OR EQUAL TO.
10 IF X )= Y THEN
TEST FOR GREATER THAN OR EQUAL TO
AND
10 IF X AND Y THEN
LOGICAL AND .
OR
10 IF
LOGICAL OR .
NOT
10 IF NOT X
[]
10 PRINT X[]Y
OR Y THEN THEN
LOGICAL NEGATION . EXPONENTIATION .
ARITHMETIC FUNCTI ONS FUNCTION ] EXAMPLE
DESCRIPTION
- --------+------ ---------------+------ - ------------- ----------------- ] ABS
] ]
10 Z
= ABS ( X)
] RETURNS MAGN I TUDE OF ARGUMENT ] IRRESPECTIVE OF SIGN.
]
]
ATN
10 Z
AT N(X)
] RETUR NS ARCTANGENT OF ARGUMENT. Z GIVEN I RADIANS.
COS
10 Z
COS (X)
RETURNS COSINE OF ARGUMENT. X MUST BE IN RADIANS.
EXP
10 Z
EXP(X)
RETURNS MATHEMATICAL CONSTANT RAISED TO POWER OF X.
T "
INT
10 Z
INT(X)
RETURNS INTEGER PART OF X.
LOG
10 Z
LOG(X)
RETURNS NATURAL LOG OF ARGUMENT. X MUST BE GREATER OR EQUAL TO o.
RND
10 Z
RND (X)
RETURNS RANDOM NUMBER BETWEEN ZERO AND ONE.
SGN
10 Z
SGN(X)
RETURNS MATHEMATICAL SIGN OF ARGUMENT .
SQR
10 Z
SQR(X)
RETURNS SQUARE ROOT OF ARGUMENT .
TAN
10 Z
TAN (X)
RETURNS TANGENT OF ARGUMENT. X MUST BE IN RAD I ANS .
11
Basic error messages
BAD DATA
String data was received from an open file , but the pro -
gram was expecting numeric data .
BAD SUBSCRIPT
The program was trying to reference an element of
an array whose number is outside of the range specified in the DIM statement.
CAN 'T CONTINUE
The CONT command will not work , either because
the program was never RUN, there has been an error, or a line has been edited.
DEVICE NOT PRESENT
The required I/ O device was not available for
an OPEN , CLOSE , CMD , PRINT#, INPUT# , or GET# .
DIVISION BY ZERO
Division by zero is a mathematical oddity and not
allowed .
EXTRA IGNORED
Too many items of data were typed in response to
an INPUT statement . Only the first few items were accepted .
FILE NOT FOUND
If you were looking for a file on tape, and END- OF-
TAPE marker was found . If you were looking on disk , no file with that name exists .
FILE NOT OPEN
The file specified in a CLOSE, CMD , PRINT# , INPUT# ,
or GET# , must first be OPENed.
FILE OPEN
An attempt was made to open a file us ing the number of
an already open file.
FORMULA TOO COMPLEX
The string expression being evaluated
should be split into at least two parts for the system to work with .
ILLEGAL DIRECT
The INPUT statement can only be used within a pro-
gram, and not in direct mode .
ILLEGAL QUANTITY
A number used as the argument of a function or
statement is out of the allowable range .
LOAD There is a problem with the program on tape. N EXT WITHOUT FOR This is caused by either incorrectly nesting loops or having a variable name in a NE XT statement that doesn't corres po nd with one in a FOR statement.
NOT INPUT FILE
An attempt was made to IN PUT or GET d a ta from a
file which was specified to be for output o nly .
NOT OUTPUT FILE
An attempt was made to PRI NT data to a file which
was specified as input only .
OUT OF DATA
A 'READ statement was executed but there is no d ata
left u nR EA D in a DATA statement .
12
Conversion tables Code Conv.,.-si on T.b!_
------------------------------------------------------------------------------6502 Instruction
Poke
Token Binary CHR$ Asc H•• I 2 Oct o.c -----+-----+-----+ ----------- ----+---+---+------+ -----+---------+----------@. @ NUL 0000 0000 00 BRK 0 000 SOH 0000 000 1 A a I 001 01 ORA (Ind,X) 0000 0010 STX B b 2 002 02
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
003 004 005 006 007 010 Oil 012 0 13 014 015 016 0 17 020 02 1 022 023 024 025 026 027 030 031 032 033 03 4 035 036 037
03 04 05 06 07 08 09 OA OB OC 00 OE OF 10 II 12 13 14 15 16 17 18 19 IA 18 lC 10 IE IF
ETX EDT ENe ACK BEL BS HT LF VT FF CR SO
c d e
ORA Absolute ASL Absolute
C 0 E F G H I J K L M N
BPL ORA ( In ) ,Y
P
P
Q
q
CRSR ON
5
5
RVS ON HOME
t
ORA O-Page,X ASL O- Page,X
T U V
CLC ORA Abs,Y
'YX"
ORA O-PAg. ASL O- Page
PHP ORA Imm.diat.e ASL Ac cum.
f
9 h j
k
I
0 000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000 1 0001 000 1 000 1 000 1 000 1 000 1
51
0
R
DEL
y
Z [
ORA Abs, X ASL Abs,X
OLE DCI DC 2 DC 3
DC4 NAt< SY N ET8 CAN EM SUB ESC FS GS RS US
0011 0 100 0101 0110 0 111 1000 1001 10 10
l Oll 11 00 1101 111 0 1111 0000 000 1 00 10 00 11
0 100 010 1
0 11 0 000 1 0 111
000 1 1000 0001 100 1 000 1
1010
000 1 l Oll 000 1 1 100 0001 11 0 1 000 1 111 0 000 1 1111
Code Conversion Table
-----------------------------------------------------------------------------6502 Dec
Oct
H• •
In§t.r uc tion
040 0 41 042 0 43 0 44 0 45 046 047 050 051 052 053 054 055 056 057 060 061 062 063 064 065
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 20 2E 2F 30 31 32 33 34 35 36 37 38 39
JSR AND (Ind , X)
Poke tJ L
CHR$ U L
Std A.c
SPC SPC
SPC
Token
Binar y
-----+-----+-----+---------------+---+---+--------+-----+---------+----------32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 59
59 60 61 62 63
Obb
067 070 071 072 073 074 075 076 077
SPC SPC £
BIT O-Page AND O-Page ROL O-Pag e PLP AND Immed iate ROL Accum.
£
£
£
£
$
$
$
$
$
1-
7.
1-
1-
1-
" " " " "
BIT Ab s o lut. AND Absolut. ROL Absolute BMI AND (In d ) . Y
AND O-PagtlyX ROL O-P .Otl , X SEC AND Ab s,Y
I
I
I
I
I
0 1 2 3 4
9
0 I 2 3 4 5 6 7 8 9
0 I 2 3 4 5 6 7 8 9
0 I 2 3 4 5 6 7 8 9
0 I 2 3 4 5 6 7 8 9
?
?
?
?
?
5
6 7 B
3A
3B 3C
3D 3E 3F
AND Ab s,X ROL Abs,X
>
0000 00 10 0001 0010 0010 0010 0011 0010 0 100 0010 0101 0010 OliO 00 10 0111 001 0 1000 00 10 1001 0010 1010 0010 lOll 00 10 1100 0010 1101 0010 1110 0010 1111 0011 0000 0011 0001 0011 0010 0011 0011 0011 0100 0011 0101 0011 OliO 0011 0111 0011 1000 0011 1001 0011 1010 0011 lOll 0011 1100 0011 1101 0011 1110 0011 1111 00 1 0
15
Code Conversion Table
-----------------------------------------------------------------------------6:502 Poke CHRS Std DR"
Od
HR.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 B2 B3 B4 B5 B6 B7 BB B9 90 91 92 93 94 95
103 104 105 106 107 110
43 44 45 46 47 48 49 4A 4B 4C 40 4E 4F 50 51 52 53 54 55 56 57
Instruction
U
L
U
L
A""
C
"d
E F
C 0 E F
f
C 0 E F
G
G
9
G
Token
BinAry
-----+ -----+-----+---------------+ ---+---+--------+-----+---------+----------64 100 40 RT! 0100 0000 • •• A• 65 101 41 EOR (Ind,X) A A 0100 0001 66 102 42 B B b B 0100 0010
III
112 113 114 115 116 117 120 121 122 123 12 4 125 126 127 130 13 1
132 133 13 4 135 13 6 13 7
~18
59 SA 5B 5C 50 5E SF
0
EOR O-Page LSR O-Page
R
PHA EOR IMmediat. LSR Ac:c:um.
H I
H I
h
;
H I
J
J
j
J
K
K
k
JIiP Absolute EOR Absolut. LSR Absolute
L
L
1
t1 N
t1 N
0
0
BVC EOR (rnd) ,Y
P
EOR O-Page,X LSR O-Page,X CLI EOR Abs,Y
0100 0100 0100 0100 0100 0100 0100 0100 0100 0100 0100 0100 0100 010 1 0 101 0 101 0 101 0101
0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 0000 000 1 00 10 00 11 0 100 Or01 0101 0 101 0 110 0 101 0111 0 101 10 00 0 101 10 01 01 0 1 10 10 0 10 1 1011 0101 11 0 0 0101 11 0 1 0101 111 0 0 101 1111
K
L t1 N
0
P
P
P
Q
Q
q
Q
R S T
R S T
t
R S T
U
U
V
V
V
W
W
W
X
X
V
V
Z
Z
U
X
V
Y
Z [
EOR Abs,X LSR Abs,X
Code Conversion Table
---------------------------------------------------------------------------6502 Poke OR"
Od
HR.
Instruc:ti on
97 9B 99 100 10 1 102 103 104 105 106 107 lOB 109 110 111 112 113 114 115 116 117 liB 119 120 121 122 123 124 125 126 127
141 142 143 144 145 146 147 ISO 151 152 153 154 15:5 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 175 176 177
61 62 63 64 65 66 67 6B 69 6A 6B 6C 60 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 70 7E 7F
AOC (lnd,X)
I
2
CHRS
As"
Token
Binary
-----+ -----+-----+---------------+---+---+------+-----+---------+----------96 RTS 0110 0000 140 60
16
b
." d
ADC o-Page ROR O-page PLA ADC IlMlediat. ROR Ac:cUfn. JIiP Indirect
f 9 h
; j
k 1
ADC Absolut. ROR Absolute BVS ADC (rnd) ,V
P q
"
t ADC O-P.,g_,X ROR O-Page, X SEI ADC Abs,V
y
z ?
ADC Abs,X ROR Abs,X
? ? ?
DEL
0110 0001 0110 0010 01100011 0110 0100 0110 0101 0110 0110 0110 0111 0110 1000 0110 1001 0110 1010 0110 1011 0110 1100 0110 1101 0110 1110 0110 1111 0111 0000 0111 0001 0111 0010 0111 0011 0111 0100 0111 0101 0111 0110 0111 0111 0111 1000 0111 1001 0111 1010 0111 1011 0111 1100 0111 1101 0111 1110 0111 1111
Code Conversion Table
---------------------------- - - ------------------------------------------------Dec
Oct
He x
6502 Instruction
Poke 1 2
CHRt:
Asc
Token
8inary
-----+-----+-----+-------------- - +---+---+------+-----+---------+----------128 129 130 13 1 132 133 13 4 13 5 13 6 137 138 13 9 140 141 142 14 3
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
174 175 176 177 178 179 180 181 182 183
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
200 20 1 202 203 20 4 205 206 207 2 10
2 11 212 2 13 21 4 215 216 2 17 220 221 222 223 22 4 225 226 227 230 231 232 233 23 4 235 236 237 2 40 241 2 42 243 24 4 245 2 46 247 250 251 25 2 253 25 4 255 256 257 260 261 262 263 2 64 2 65 2 66 267 270 271 272 273 274 275 276 277 300 30 1 302 303 304 3 05 306 307 3 10 3 11 3 12 3 13
80 81 82 83 84 85 86 87 88 89 8A 8B 8C 80 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 90 9E 9F AO Al A2 A3 A4 AS A6 A7 A8 A9 AA AB AC AD AE AF BO BI B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BO BE BF CO Cl C2 C3 C4 C5 C6 C7 C8 C9 CA CB
STA (Ind,X) STY a-P age STA O-Page STX a- Page DEY TXA STY Absolute STA Absolute STX Absolute BCC STA (Ind) ,V STY O-Page,X STA O-Page,X STX O-Page,Y TYA STA Abs,Y TXS STA Abs,X LOY Immedi ate LOA
END FOR NEXT DATA INF'UH INPUT DIM READ LET GOTO RUN IF RESTORE GOSUB RETURN REM STOP ON WAI T LOAD SAVE VER IF Y DEF POKE PRINH PRINT CONT LIST CLR CMO SYS OPEN CLOSE GET NEW TAB( TO FN SPC( THEN NOT STEP
LOY Absolute LOA Absolute LOX Absolute BCS LDA
1000 1000 1000 1000 1000 1000 1000
0000
000 1 (1010
00 11 0 100
0 10 1 0 11 0
1000 011 1
1000 1000 1000 100 1 1000 10 10 1001) 1011 1000 11 00
1000 1101 1000 111 0 1000 1111 l Oul 0000 1001 0001 1001' 0010 1001 0011 100 1 0100
100 1 0 10 1 100 1 01 10
100 1 0 111 1001 1000 1001 1001 100 1 10 10 100 1 1011 100 1 11 00 1001 1101 1001
1110
100 1 1111 101 0 0000 10 10 000 1 1010 00 10 10 10 00 11 1010 0100 101 0 010 1 1010 0110 1010 0111 1010 1000 1010 1001 10 10 1010 1010 10 11 1010 11 00 1010 1101 1010 111 0
AND DR
<
SGN INT ABS USR FRE POS StiR RND LOG EXP CDS SI N TAN ATN PEEK LEN STR$ VAL ASC CHR$ LEFU RIGHT$ HIDS
1010 1111 I OU 0000 10 11 0001 1011 0010 1011 0011 10 11 0 100 1011 0101 1011 0110 1011 0111 1011 1000 1011 1001 1011
101 0
1011 1011 1011 1011 1011 11 00 11 00
1011 11 00 1101 1110 1111 0000 0001
11 00 00 10 1100 00 11
1 100 1100 11 00 11 00 1100 1100 11 00 11 00
0 100 0101 0 11 0 0 111
1000 1001 10 10
1011
17
Code Con v l!r si on Table
------------------------------- ------------ ----------------------------- ------'lee
Oct
Hex
6 502 In s truc t i o n
Poke 1 2
CHR$
Ase
Token
Bi nary
-----+-----+-----+---------------+---+- - - +------+-----+---------+----------204 205 206 207 208 209 210 2 11 2 12 2 13 2 14 2 15 2 16 2 17 2 18 2 19 220 22 1 222 223 22 4 225 226 227 228 229 230 23 1 232 233 23 4 235 236
237 238 239 240 2 41 242 2 43 2 44 2 45 2 46 2 47 2 48 2 49 25 0 2 51 252 25 3 25 4 2 55
18
3 14
3 15
3 16 3 17
320 32 1 322 323 324 325 326 327 330 33 1 332 333
334 335 336 337 3 40
3 41 3 42 3 43 3 44 3 45 3 46 3 47 350 3 51 352 353 3 54 355 356 357 360 3 61 362 363 364 3 65 3 66 3 67 370 37 1 372 373 374 375 3 76 37 7
CC CD CE CF DO 01 02 03 04 05 06 07 08 09 DA DB DC DO DE OF EO E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF FO FI F2 F3 F4 F5 F6 F7 F8 F9 FA FS FC FD FE FF
CPV Ab so lute CMP Absolut e DEC Absolute
BNE CMP
CMP O- P,.ge, X DEC O- Page,X CLD CMP Abs, V
CMP Ab s , X DEC Abs,X CP X Immediate SBC ( Ind, X) CPX O-Page S BX O- Page INC O-P age IN X SBC Immediate NOP CP X Ab s olute SSC Absolute INC Absolute
11 0 0 11 00
11 00
1100 11 00 1101 11 0 1 1101 11 0 1 11 0 1 11 0 1 11 0 1 11 0 1 1101 1101 1101 1101 1101 1101 1101 1101 1 1 10 111 0 111 0 111 0 1 110 111 0 1 110 111 0 1 11 0 111 0 111 0 111 0 111 0 111 0 111 0 111 0
SEQ SSC (Ind ) , V
1 111 1111 111 1 1111
SSC O-Page , X INC O-P.ge,X SED SSC Abs,Y
SSC Ab s ,X INC Abs,X
1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
11 0 1
111 0 1111
0000 0001 001 0 0011 01 00 0 101 0110 0111 10 0 0 1001 10 10 1011 1100 1101 1110 1111 0000 000 1 00 10 00 11 0100
0 101 0 110 0 111 1000 100 1 1010 10 11 11 00 11 0 1 ·11 10 1111 0000 0 001 00 10 00 11 0 100 0 101 0 110 0 111 100 0 1001 10 10 1011 1 1.00 11 0 1 111 0 1111
Disk commands DISKETTE COMMAND SUMMARY BASIC 4.0 APPEND £ , " " : ,0<:<) ; :ON U< y >; Append data to the end of a sequential f i I e.
BACKUP D< x > TO D< y > :ON U; Duplicate entire contents of one disk onto another. CATALOG / DIRECTORY :D<x >;:ON U; Display disk directory on screen. COLLECT :D <x >;:ON U< y >; Release space allocated to improperly closed files. CONCAT :D ,;" < namel ) 1I
TO :D< y > ,;"name2 > II:ON U{ z > ;
Concatenate sequential files. COPY
:D <}~ > ,;t' < namel > 1I
TO :D< y > ,;" < name2 > ":
ON U< z > ;
Ma ke a copy of a file within a disk unit. DC LOSE : £ < 1 >; : ON U(:< >; Close disk files. DLOAD " < name > ": ,D < :-: > ;
:ON U< y > ;
Load BASIC program file from disk. DOPEN £ < l > ," < name ) " :,L< y >;:,D( :<> ; :ON U( z >; :,W; Declare a sequential or random access file for read or write. DSAVE " ( name >": ,D<x >; :ON U( y >; Save a BASIC program file to disk. HEADER " <: di sk name ) ", D( }: >: ,I ; : ON U< y >; To format a blank disk or clear an old disk. RECORD £ ( logical file > , : , < b yt e >; Used before GET£,INPUT£ or PRINT£ to position record pointer in a random access file. RENAME :0<:< >.; " ( old name >" TO " ( new name ) " :ON U< y ) J Change the name of a disk file. SCRATCH " < name ) ": ,0:<; :ON U; Delete a dis k file.
19
DISKETTE COMMAND SUMMARY BASIC 2 . 0 (APPEND)
Not available.
(BACKUP)
PRINT£15,"D = x"
( CATALOG I LOAD "$D<x ) :? . . name:*; : =P/S;; DIRECTORY) (COLLECT) PRINT£15, "VD<:<>" (CONCAT)
PRINT£15,"CD : =D : ,D<x ) : < name1 ) 11
(COPY)
PRINT£15,"CD: ( name2 >=D<x >:
(DCLOSE)
CLOSE
(DLOAD)
LOAD "D<x >: : *;"
IDOPEN)
OPEN ,; <device >;:, ; :. u< filename > : , < type > ;: , < mode > ; II;
(DSAVE)
SAVE :" ( filename >";:, <device ) ;
(HEADER)
PRINT£15, "ND<:<>: fi lename, I "
(RECORD)
Not available .
(RENAME)
PRINT£15,"RD<x >: ="
(SCRATCH) PRINT£15,"SD<x ) : :*;I*"
20
Disk error messages
DOS ERROR MESSAGES OK (00 00 00) No errors encountered. FILES SCRATCHED (00 £ Files 00) Files scratched. BLOCK HEADER NOT FOUND (20 T S) Disk controller is unable to locate the header of the requested data block. Caused by an illegal sector number, or the header has been destro y ed. NO SYNC CHARACTER (21 T S) Disk controller is unable to detect a sync mark on the desired track. Caused by misalignment of the read/write head or no diskette is present. Can also in di cate a hardware failure. DATA BLOCK NOT PRESENT (22 T S) Disk controller has been req uested to read or verify a data block which was not properly written. This error message occurs in con j unction with the BLOCK COMMANDS and indicates an illegal track and/or sector request. CHECKSUM ERROR IN DATA BLOCK (23 T S) This error message indicates that there is an error in one or more of the data b yt es. The data has been read into the DOS memor y , but the checksum over the data is in error. This message may also indicate grounding problems. BYTE DECODING ERROR (24 T S) The data or header has been read into the DOS memory, but a hardware error has been created due to an invalid bit pattern in the data b y te. This message ma y also indicate grounding problems.
21
CHECKSUM ERROR IN HEADER (27 T S) Disk controller has detected an error in the header of the requested data block. The block has not been read into the DOS memory. This message ma y also indicate grounding problems. WRITE - VERIFY ERROR (25 T S) This message is generated if the controller detects a mis - match between the written data and the data in the DOS memor y . WRITE PROTECT ON (26 T S) This message is generated when the controller has been requested to write a data block while the write protect switch is depressed. Typically, this is caused by using a diskette with a write protect tab over the notch. LONG DATA BLOCK (28 T S) The controller attempts to detect the sync mark of the ne x t header after writing a data block. If the sync mark does not appear within a pre-determined time, the error message is generated. The error message is caused by a bad diskette format (the data extends into the next block), or by a hardware failure. DISK 10 MIS-MATCH (29 T S) This message is generated when the controller has been requested to access a diskette which has not been initialised. This error can also occur if a diskette has a bad h~ader. GENERAL SYNTAX
(30 00 00)
The DOS cannot interpret the command sent to the command channel. Typically, this is caused by an ill egal number of file names, or patterns are illegally used. For example, two fi Ie names may appear on the left side of the COPY command. INVALID COMMAND (31 00 00) The DOS does not recognise the command. command must start in the first position.
22
The
LONG LINE ( 32 00 00) ter s . The comma nd sent is longer than forty c harac INVALI D FILE NAME (33 00 00) Patter n match ing is invali dly used in the OPEN, SAVE comma nd.
or
NO FILE GIVEN (3 4 00 00) the or The file name was left out o f the comma nd, a ally, Typic such. s a it nise recog not DOS does ut o left been has ) : ( quota tion mar k (oo) or colon of the comma nd. INVALI D DOS COMMAND (39 00 00) An unrec ognisa ble DOS comma nd wa s receiv ed. RECORD NOT PRESEN T (50 00 00) GET£ stateme nt An INPUT£ or beyond the curren t end of file. if you are attem pting to read a neces sarily an error if you are end of the file in order to add old file.
record select ed a error This is an is not record ; it positi oning to the new record s to an
OVERFLOW IN RECORD (51 T S) to write more than A PRINT £ statem ent attemp ted relat iv e to a cters chara of the allowe d numbe r is counte d The termin ating carria ge return file. . as one chara cter when compu ting record length FILE TOO LARGE (52 T S) in resul t The curren t record positi on will overfl ow on the nex t write - to-dis k opera tion.
d isk
WRITE FILE OPEN (60 00 00) that write file This messag e is genera ted when a g. has not been closed is bei n g opened for readin FILE NOT OPEN (61 00 00) file a This messag e is genera ted when in opened access ed that has not been messag e a this case, in Somet imes,
is be i ng the DOS. not is
23
generated; the request is simply ignored. FILE NOT FOUND (62 00 00) The requested file does not e x ist on the drive. FILE EXISTS The file name of the file e x ists on the diskette.
indicated
(63 00 00) being
created
already
FILE TYPE MIS-MATCH (64 00 00) The file type does not match the file type directory entry for the requested file.
in
the
NO BLOCK (65 T 5) This message occurs in conjunction with the B-A command. It indicates that the block to be allocated has been previously allocated. The parameters indicate the next higher in number available track and sector. If the parameters are zero, then all blocks higher in number are in use. ILLEGAL TRACK L SECTOR (66 T 5) An attempt has been made to access a sector that does not physically e x ist. The track and/or sector number specified is out of the allowed range for the current diskette. Unless you are see using random access files, you should never this error code. ILLEGAL SYSTEM TRACK L SECTOR (67 T 5) When accessing program or data files, an attempt has been made to access a sector that is reserved for use by the DOS. NO CHANNEL (70 00 00) is not The requested c hannel channels are in use. A ma xi mum at one files ma y be opened Direct access channels may have
available, or all of five sequential time to the DOS. six open files.
DIR (71 00 00) The BAM does not match the internal count. There is a problem in the BAM allocation or the BAM has
24
been over-written in DOS memory. To correct this problem re-initialise the diskette to restore the be BAM in memory. Some active files may terminated by the corrective action. DISK FULL (72 00 00) Either the blocks on the diskette are used, or directory is at its limit (152 entries).
the
DOS MIS- MATCH (73 00 00) Data written to a diskette using anyone version of DOS may be read using any other version of DOS. However, you must write to a diskette using the same DOS version with which the diskette was initialised . Error 73 is reported if you attempt to write to a diskette using a different version of DOS from the one which created and initialised the diskette. DRIVE NOT READY
(74 00 00)
An attempt has been made to access diskette unit with the selective drive.
the
8050
25
en
N
1- 2 3 - 18 19- 20 21 22-25 26-27 28-29
o
BYTE
File flag OR ' ed with $80 o DELETED 1 = SEQ 2 = PR6 3 = REL First data block track and sector. Reserved for file name. Track and sector of first side sector block (REL files only). Record size for REL files. Not used. Track and sector of replacement file using ' @' operations. Number of blocks in file.
DEFINITION
STRUCTURE OF INDIVIDUAL DIRECTORY ENTRIES.
Disk formats
N -..J
Track and sector of next seqential block. Reserved for file storage.
DEFINITION
4
0_'
.,..
1 2
o
BYTE
Number of available sectors. Bit map for sectors 00- 07. Bit map for sectors 08- 15 . Bit map for sectors 16- 2 3 . 8050 only: Bit map for sectors for 2 4 -3 1.
DEFINITION
STRUCTURE OF BAM ENTRY.
0- 1 2-255
BYTE
STANDARD FILE FORMATS.
N
00
3 4-5 6-7 8-9 10-11 12-13 14-15 16-255
.:...
,.,0-1
BYTE
Track and sector of ne>: t side sector block. Side sector number. Record length. Track and sector of first side sector. Track and sector of second side sector. Track and sector of third side sector. Track and sector of fourth side sector. Track and sector of fifth side sector. Track and sector of si>:th side sector. Track and sector pointers to data blocks.
DEFINITION
Side sector blocks.
RELATIVE FILES ONLY.
to
N
7-10 11 -255
67
51
1
o
38,3
2 3 4 5 6
CONTENTS
(;-1
BYTE
8050 BAM FORMAT. Track 38, Sector 00.
Track and sector of second BAM block. Indicates 8050. NULL flag. Lowest track number in this BAM block. Highest track number plus 1 in this BAM block. Number of unused blocks on track 1. Bit map of available blocks on track 1. 5 bytes each for BAM of tracks 2-50.
DEFINITION
w
o
4 5 6 7-10 11 - 140 144- 255
~.
<
0- 1 2
BYTE
39,1 67 0 51 78
CONTENTS
8050 BAM FORMAT. Track 38, Sector 03.
Track and sector of first directory block. Indicates 8050. NULL flag. Lowest track number. Highest track number plus 1. Number of unused block on track 51. Bit map of available blocks on track 51. 5 bytes each for BAM of tracks 52-77. Not used.
DEFINITION
w .....
0-1 2-31 34-63 66-95 98-127 130-159 162-191 194-223 226-255
BYTE
Track and sector of next directory block. File entry £1. File entry £2. File entry £3. File entry £4. File entry £5. File entry £6. File entry £7. File entry £8.
DEFINITION
For 2040/3040/4040/1540/1541: Track 18, Sector 01. For 8050: Track 39, Sector 01
COMMON DIRECTORY FORMAT
W N
NULL flag.
The BAM bit map of available blocks for tracks 1-35. Reserved for disk name. Reserved for disk 10. Shifted SPACES. Not used.
1
0
160 0
3 4 - 143 144- 161 162-163 164- 170 171-255
Track and sector of first directory block. Indicates DOS 1.
18,1
DEFINITION
2
CONTENTS
0- 1
BYTE
2 040/ 30 40 BAM & HEADER. Trac k 18. Sect o r 00.
DISK FORMATS
tv tv
3 4 - 143 144-161 162- 163 164 165- 166 166-170 171 - 255
?2
0- 1
BYTE
o
160 50,65 160
18,1 65 0
CONTENTS
DEFINITION
Track and sector of first directory block. Indicates 4 0 40/1540/1541 NULL byte. BAM bit map of available blocks for tracks 1-35. Reserved for disk name. Reserved for disk 10. Shifted SPACE. Indicates DOS version (2A) and format. Shifted SPACES. Not used.
4040/1540/1541 BAM & HEADER. Track 18, Sector 00
w
.f;>.
I)
(I
3
4-5 6-21
160 50,67 160
I)
160
"''"'J_'''~ LL .L.,,-o
24-25 26 27-28 29-32 33-255
L
'-:>
38,0 67
CONTENTS
0-1
BYTE DEFINITION
Track and sector of first BAM block. Indicates 8050. NULL flag. Not used. Indicates disk name. Shifted SPACES. Indicates disk 10. Shifted SPACE. Indicates DOS version (2C) and format. Shifted SPACES. Not used.
8050 DIRECTORY HEADER. Track 39, Sector 00.
Extramon listing 100 110 120 1 :::;0 140 150 160 17 0 180 190 200 2 10 220 230 240 250 260 270 280 :'::00 310 :S20 330 3 40 350 :'::60 370 :'::80 390 400 410 4-2 0 4 30 440 500 510 520 550 560 600 610 620 630 640 650 660 6 70 680
PR I NT" T I I'~ Y PEEKEFU POKER" X$="*": IhIPUT Xct: I FXcf-"' '' -' -''THENE hiD OOSUB500 If" E GOT0280 A= V IFJ ) LEN ( X$)OOT0300 F(JRI=OTD7 P'-'J:GOSLJB550 C (I) ='-1
IF E GOTO 280 NEXTI T=O FORI=OT07 POKE A+I,CII) T=' T +C ( I ) NEXT I F'f~ I NT" CHECKSLJl'l=" ; T GOTD110 F'RINTMIDct (X:*" 1 ,J) ; " 'Y;-" ': [10T01. 10 T=O FORI=OT07 V=PEEK (A+ I ) T=T+V V=')/16 PRINT" "; FOR.J=1T02 \/'I."'V \) = (V--V"I. ) * 16 IFV"I. ) 9THENV'I.=V'/.+ 7 PRINTCHR$(\)'I.+48 ) ; NEXT J NEXT I PRINT " / " ; T [1 CIT 0 11 0 P=1 L.=4 GDT0600 P=J L.=2 E=O V='O FORJ=P TO LEN(XS) X=ASC(MIDSIXS,J» IFX =32 THEN NEXT J IFJ ) LENIXS)THEN790 P=J FORJ =PTDLEN (X $ ) X=ASC(MIOS(XS,J »
35
690 IF X·o· >32 THEN NEXT J 7 00 IF J . _p < >L THEN 790 7 10 FORk=F'TOJ-1 7:20 X=ASCIMID$(X$,k )) 7:30 IF X<58 THENX = X--4 8 7 4 0 IF X>64 THEN X=X-~i5 7~jO IF X 15 THEN7 90 760 V=V*16+ X 77 0 NEXT k 7 8 0 RETURN 790 E=- l 80 0 RETURN
•• " ••"
1A 04 6 <1 0~ 99 12 93 00 0BUB 12 10 I D I D 10 '») SS S. 2. 36 J4 20 '0 4F 31 .4 61': 00 99 22 0818 4f. "8 20 II 2. III 2. 2. 2. 2. 2. 08 2 8 20 20 2 0 2. 20 20 2. 20 ~~8
1i810
0830 0838 08010
0848 08')0 08'>8
aefie 11868 \18111 ~87~
••
4. 20 2E 2E 55 5< 54 4C 44 O. 28 C2 28 J5 J6 AC AA 31 32 AA AA AA AA AA AA AA AA AA
"
"8B~ A> 20 0888 AS 37 .5 AS ~89U AO "898 C6 22 81 D' . 2 rf> ~8A8 f. 21 8S ~8B" C6 23 C6 1!811H 2 4 AA A5 ~' 8C0 17 D. 02 U8 C8 91 17 De Oil C6 38 c6 iHW8 9' 86 C9 \:18 ~: " .5 J) AS 081':8 "0 OF 08f~ .Il BD 16 08F8 80 17 • J
••
.,SA"
"
,.
.
II 42 45 9E 32 2. 00 00 00 AA AA AA AA AA AA AA- AA AA AA. AA AA AA
78 00 4A 49 45 52 66 04 34 33 C2 37 29 AA AA
'"
,. 24 22 22 23 26 22 26 C6 48 17
99 40 46 82 29 34
22 20 49 00 AA l4
A> 2t::
as
38
8~
AS
C6 A5 B1 65 J.
22 22 12 25 C6 AS 37 68 91 0" ED
81 D. 18 48 37 DO 37 AS or 3a 8~ )4 6C U ' 4F AD 1::6 ~ 1 AD £ 7 fF A9 80 2 •
00 3D 3B £9 00 20 20 E6 E6 00 ff A9 20 2E
DO OA AA
68 80 3E .2 68 80 3C .2 68 AA 68 A8 BD 3A 02 98 )9 02 SA SE FD00A242 fA 00 A9 52 D0 06 £6 C2 6. 20 Cf fF fi8 68 A9 90 00 00 85 26 fA 00 2. ff 2 0 ]E F8 F9 C9 20 F0 B7 ff 00 00 eo C7 Ff 00
BD EC ]A A9 54 00 Fl A2 03 00 A9 48 4C F'F 20 .0
C6 4C 02 08 fD 20 60 00 4C C6 .2 20 57 A2 02 3'
004860 fA 00 AS C2 80 39 10 A0 00 Bl CI 2 0 F8 00 C6 88 FA eo 81 Cl Cl FA 00 20 60 A9 38 C2 0'.9 0 5 FO 09 68 00 A9 90 00 80 EA £S £0 16 e2 F8 00
0980 0988 0990 0998 091-.0
09A8 0980 0ge8 09C0 0g e 8 0900 9908 09E0 09E8 09F0 09F S
36
.E
08 02 02 . 2 80
""
C1 26 F8 A9 2' 02 f0
H
ED A5 85 O.
JJ 2. 00 ED 10 85 57 FA IiJ0 Ff'
10
.,
"
CA C1 02 00 48 1D 90 Cl 33 BS 60 A2 20 FF 00 AD
~'A~8
0A \0 9Al 8
,.
", ,. •••• ". ,. '",. " •• r."
',. "
,.'"
fA
f • • Il 69 fA "A20 fA "AlB ~A]~I fA IHI Ag , I 0A38 0MB AS C] e50 0A48 9. 2£ "'0 0ASU 2. 41 fA 4e "t,sa f. 1'A60 FA 9. 0A68 2 • • 7 f. 0A70 fA 90 0,, 7tj JE f8
79 fA
... .,"" JA
"" 90
] ~:
33
••
JO f8 .Il 9. 28 20 69
,.
90 JC CI 3A .0 ED
,. ••
"e
••
AU
2 1t! h7 ... Ii ,)C 20
fA
HD f8
2. D2 ff 2. A6 )6 00 J8 AS Col ES C2 20 C2 f. .0 2e sa f. fA 2. 79 2. • Il f. O• IHI D~ .7 2. 79 t::1:i 1\9 .8 85 10 ]\oi Al f. .0
••
".
"'
0AB0 D. f. 4C 47 fe "e 2. 0AB8 ~' f C9 DO F0 Be C9 2. 79 FA909B0) 0A90 01 0A98 B. f 8 00 A9 90 20 02
,.
3F 02 9/\ 78
r.o
Cf D. 21l H
39 .2
22
0A.1\0 AE
65
0AA8 48 AD 3/\ 02 48 AD )8 02 0ABe 48 AD 3C 02 AE 3D 02 AC 0AB8 Jf .2 41' A9 90 20 02 r.-
AS
6. 112 18 J7 J7
0AC0 AE 3f 02 9A 6C 1:12 A0 A0
H
0A00 0A08 0AE0 0AE8 0Afe OAF8
84 A9 2" 22 fO E6
B4 90 02 f. DO I. 87
68 68 38 E9 3F A9 DO 00 C9 20 A2 A9 O. FS 0C 48
0800 0808 0B10 0818 0820 0928 0930 0938 0 B4 0 0848 0850 0B58 0860 0868 0870 0878
ED f. fA fO eo 20 20 r9 4C C9 20 2C CI 69 DB f2
16 O. ES 60 96 02 00 47 2C 69 DO 85 fA 98 f9
10 80 60 20 fA 00 0B FO F8 el 98 2E 02 00 fS 39
0880 0888 0890 0898 08A0 08A8 0880 0888 08C0 BBCS eB00 0808 08£0 08£8 08F0 0eFS
C2 4A 1\A 48 FF .6 e2 F3 85 85 2. 2e 18 0A 20 C9
r.-
•• ••
00 80 BD 8A 00 . 2 2A 14 ~J940 0 2 0948 0 0 0950 02 0958 00 0960 os 0968 C9 0970 A2 0978 BA
0900 0908 0910 0918 0920 0928 09]0 0938
23 25
0" Id l C6 23 00 )C AS 22
"!\lI~
0ACB 01
BA 84 85 F9 14 e9 C8
84 93 BC C9 20 eo C0
FA O. 21:1 C9 2C 29 0F 85 8A 6C 30
20 4A 68 8A 09 60 95 60 e2 el )£
3E 60 0A AF )A
f9 .0 A9 9. O. 8A .0 2. A5 2. A9 9. .0 4C H
A5 fB 00 FA AD AE
••
48 4A 29 20 )0 A2 e0 20 20 60 Fe F8 20 85 FA 90
89 A9 29 00 Cf fe 10
84 85 FF 38 C9 91 EC
.7 BB C9 C9 22 BB 4C
CF FF C9 00 00 DC 20 88 Fe E9 C9 03 20 CF F'F C9 0) 6C )2 03 DO 04 A9 90 .0 .0 20 Ef 29 10 D0 C4 20 96 f9 00 20 79 fA 00 20 CF ff C9 79 FA 00 A5 C285AF20 Cf FF C9 00 20 02 Ff 20 47 F8 00 AS
fA 00 4A 20 20 fF )A BS 95 FA FA 0. C9 C9 FA 20 05 69
Of 02 e9 02 68 8B 88 A9 00 00 AF 2A 00 02
88 40 CF F0 FF 29 00
AS 60 60 68 90 C0 C2 00 00 0e 20 20 00 JE 2A 08
Cl FA FA. 4C .2 48 CA 90 90 B5 00 00 01\ fB 38 29
4B 00 00 02 69 B5 De 02 02 2A 09 0£ 0" .0 60 .f
,.
0<.:0" 0C08 C I 0 e10 26 0elB f8 0e20 .0 0e28 FA 0C)0 FA ee)s O. 0C40 3F
A2 00 06 00 00
••
00 2. 02
.2 08 C2 C9 80 20
2C A2 Ok! 00 84
B' 06 2. 00 Bf 90 09 79 FA 9/\ .0\9 20 02 54 FO
0C48 A9 3F 0eS0 00 2. 0e58 60 £6 C] 0e60 A2 02 BS 0e68 c. 68 9s 0e70 AS CJ A4
00
C. 27
C4 0C78 .f 88 90 08
0CB0 4C 0C88 J8 0e90 A8 0e98 2. 0~A0 2. 0CA8 2. 0CB0 9. 0CB8 fB 0CC0 20 0CC8 D. 0eD0 1£ 0C08 85 0CE0 DO 0CE8 fe eCFO 20 "CF8 20
J3 ES 85 69 8C 2f IS 00 05
fB CI IE fA f. f8 A6 9. fB
EB 20
65 C4 30 00 8B 04
e3 20 Al 80 FA FA
C20 002£6 CI 6., 20 JE Fe F9 60 A9 00 In 20 CC FA 00 20 7C 6" 20 3E: Fa 00 B0 DE AE 90 20 02 fF fF 4e 47 f8 U CA 00 fA 02 E6 C <1 60 48 BS 27 9S CA 00 f3 60 J8 E9 02 AS 28 A4 29
B.
00 AS C3 A4 BS lE 98 £5 60 20 04 FA 2 • E5 fA 2e ES fA O. 2~ 69 fA 26 00 64 2e Sf Al CI 81 .0 2. J3 fa 2. fB 00 18 85 C3 98 65 ec FB 00 A6 CI 81 C) 20 ) 4 20 88 fA 00 4C 70 f8 0e 20 69 fA
C4 C2 00 00 00 00 28 CJ .0 AS C4 26 28 130 O. .0
••••
0000 0008 0010 001S 0020 0028 0D)0 0D)S 0040 00 48 0050 0058 0060 0068 0070 0078
20 2. 9. 20 81 4C 20 20 20 JE JE Cf DO 20 . 2 09
ES FA 00 20 JE f8 O. 20 1 4 85 10 A6 2F f B 00 90 el 20 J) f8 £0 fA 00 4 C 04 fA 00 2. ES FA 00 20 3E FS 00 A2 f8 00 C9 27 F8 00 90 10 FF C9 00 F0 fl Fo lC 8E SF FA 00 90 EB 20 CF FF 20 88 fA 00
69 B8 26 0C 00 47 69 69 00 DO 02 22 00 e6 e9 90
fA FA 00 A5 00 FB fA fA 00 14 EB E0 00 90 00 86
00 O. 11 10 EE O. 00 00 2. 20 2. 2. el 10 fO EO
0080 0088 0090 0098 00A0 00AS 0080 0088 00C0 eDC8 0000 0008 00£0 00£S 00F0 00rs
20 02 00 02 f3 00 80 47 20 86 90 20 85 A9 00 54
DO Ee 86 lC FE 20 57 FO AO 00 81 DO OC CB £8 2 0 41 fA 00 20 JJ f8 00 20 2F FB 09 f8 O. 2e 04 A5 C28521 28 A9 93 20 20 02 FF A9 6A Fe 0e1 20 Cl 84 C2 e6 91 20 02 FF 1.0 2e 20 C2 fD .0 2e 41
A9 00 Cl E4 2.
90 1\ 2 DO lC 54 26 00 00 90 FF 85 Fe 00 47 00 00
20 00 10 00 fD 00 4C 85 00 A9 10 00 F2 F8 20 20
••
1\6 B0 FA 0'.2 02 16 CA 10 4C F8 FA
eE0e ~E08
eE10 0E18 13[213 13£:28 OE30 eE38 eE40 0E48 eE50 0ES8 0E6e 0E68 0E7" eE7B
."
fD 2. 09 6B E. 03 A5 2.11. 2. C2 2 A 90 AS F'D OJ 213 6' 20 01 C8 B6 lC 6' AS 01 88 A8 'A 22 f.
FC
De C9 FC eE 1313 A5 CD 98 2. IF 65 9'
13
AA 'A 8' 00 2. F, 2' 6. 01 9. 6. B9
eFee eF08 0Fl 0 eFIB 0F'20 OF28 eF30 eF38 0F40 0 F4 8 eF5e eF58 1'11"61'1 0F68 eni'! BF78
69 FA 00 69 FA A9 9. 20 213 72 8S Cl F0 as 213 .C <7 FB A9 03 85 20 A I f8 85 CI A5 FC 1313 CS ff 613 20 FA 00 BE CC FA 03 6B 3B 6E 11 02
BFSB 0F'88 0F9B eF98 eFAe eFA8 eFBe 0PBS eFce
f6 Ff FS 9C CI 10
e~C8
eFD" ePD8 eFEe eFE8 eFF0 eF F8
113013 113138 10 1 13 11318 113213 1028 113313 11338 10 413 11348 11350 11358 113613 1 1368 113713 unB
BD 2.11. F'F' ~o D. .S CA D. 2. BB FE 00 D. FE D' A6 A5 D. A0 69 FA F • 28 AS 29 C9 I C FB 00 9' AS lE 10 'A 00 C8 De FA AS A4 IF De OJ B9 91 C l 8B 0 ' FB CA FC Cl 02 C2 A9 9' 20 C2 F8 FA 00 20 2. A9 2. 02 FF
'A 04 A0
1eBe 11388 10913 113 98 113.11.13 leA8 leBe leB8 1ece 1eC8 113013 11308 IeEe 10E8 lape 10P8
00 A8 20 98 f' OE 02 '8 28 6' C9 6. 38 6' .8 40 .9 .8 .9 .9 .8 .9 D. 8C 44 8C 33 33 D' '8 33 0' OB A9 00 00 00 59 B5 90 2C
.
" O.
BD 09 FE B' 4A 4A 29 'F AA BD .11.9 013 85 2.11. 29 0J 85 8F' .11..11. 98 A. 133 e84Agee8 4.11. 88 0 0 FA C8 88 B! Cl 213 C2 FC 20 FE FA 130 C4 n A203 c0e 4 A8 B9 37 fF' 13 13 77 fF 013 85 29 .11.13 135 .6 29 26 8B D. F8 69 3F 213 CA o. EC A9 213 2C ' C 02 FF 213 0 4 FA
eE8e eEB8 eEge "E98 eEA0 eE AB 0Ese eES8 'lEee 0EC8 0E De 0E D8 0He eEE8 eH0 eH8
••
.
•• ••
CI F'D 136 DE IC .6 2. F0 os 0' BA lC 10 6. C9 'A
A2 1313 013 Al I F' 'S F'D 13" .11.2 12 A' IF' F'e EB BI CI B, 88 De F'2 SO 2.11. F'F' 1313 BD 30 F'f 1313 Fo 1313 CA 0 0 FC 130 AA £8 213 C2 FC 130 .8 FA 0 13 A6 38 A4 C2 AA C l 913 131 C8 'B 4A Be 17 29 137 139 8.
"' •• " " "
.
10 IF' Ee 4.11. De 1313 IF
.
85 .11.9 28 02 A9
O.
FF 98 8.11. 09 f2 A2 C8 F2 28 1313 2A FF '0 20
,."
."
,.
"
••"
" ., " "
20 01 AB 28 1313 90 13.11. 4C IE C2 AS 85 FF
"
B9 F. 213 C5 A4 De 98 ED 10 013 26 CI Ae
ro
54 FD 4C Be
O.
BF FE 130 B6 IC A6 10 E8 B6 10 .11.6 30 913 03 C9 02 4 5 133 30 22 4 5 33 40 02 45 33 02 45 B3 00 1313 22 44 11 22 44 9A Ie 22 '9 Ie 22 40 '9 62 13 21 81 82 1313 4 0 91 92 86 29 2C 23 28
"
..
" """ " O. " ••
FE 6A BB 10 If IA 00 FA F6 1313 91 B4 41 00
. ro
11 DO lC <7 D' 0'
D' D' 33 44 44 44 78
.
4A
24
•• ., . ." •• . •• . •• ,. •• •• •• ,. •• . •••• •• . ""' . •• . •• . .•• •• •• •• ." .. .. . •••• .. CA C9 20 FA A9 .2
eo
7S 26 20
29 FF .11.2 F. B. 213 EB
AA 1313 136
"
21 Cl 136
20 A2 02 FC 8' 2F
10
21 28 D.
11 'B E9 6E
O.
E5 FA 1313 1313 B6 FF 213 57 20 CA C2 20 El FB 20 D' fA 213 3E f8 F8 AS as C2 ' C Fa e) FA 131'1 20 1'1 2 .11.2 CA 013 '9 3 F' Ae 05 10 02 8B
O.
00 ED .11. 2 02 . 0 f0 IE C9 D' FE 1'113 B0 A4 Cl B' 3. 90 Ie 02 EB De DB B6 86 26 F • A> 86 DO Fe 1'10 .11.6 BC 37 FF 131'1 2. B9 FE 1'11'1 EO 133 De I. AS 2.11. C9 £8 2. SF FE 1313 fE 013 De C7 2A 913 138 BC
Enteri ng
20 28
ro
FC Ff E9
.6 02 69 2. A>
4A
O.
20 cr 20 f'
eF C2 E8 28 E6 10 2A Bo
O. A9 O. 88
21'1 85 90 .11. 2 26 A5 86 77
E3 A4 If
30
CC D' 313 FF
E :~ tramon
:
58 23 23 19 lB lA AE AE 00 29 53 23 A, 9' B8 E8 9' 8' 2B f 2 A4
111313 1 1138 1 1113 1 118 112. 1128 113 13 1138 1 140 1148 lIse 1158 11613 1168 tl70 1178
59 IC 90 013 23 Al 24
1180 1188 1 19 13 1198 11Ae
lA lA 26 26 C4 CA 26 4B 3A l 8 52 40 '6 'B 44 F9 35 1"9 F7 FB 56 F • F9 fB 9 2 FB 3B FC SB AC FD 1313 F7 ED 1"7 20 50 43 20 41 43 20 SB 20 53 sa AA
lIAS
llBe I1B8 lIce llC8 11013 1108 llEe 11E8
A5
AS 2. 6B B.
4A A>
B2
24 24 1313 1313 50 8B 18 Al 90 8B 10 Al AE 69 A8 19 23 24 53 19 5B5BA569 00 24 A8 AD 29 1313 7C 15 9C 60 9C 69 B4 13 34 11 69 08625.11.48 62 54 44 C8 54 .4 B• OB 74 'E 74 F. CC 8A 72 M A2 74 74 74 72 44 68 32 B2 22
SA 8A 1313 24
lC 10 29 53
72 44 47 50 1313 F9 ec 1313 FD '6 1313 213 52 AA
72 88 CB 44 A2 CB 58 4 C 53 2C 41 42
CC 1'113 FA ce 1313 F8 eo 53 21'1 AA
F8 89 1313 FB 8A 1313 21'1 52 59 AA
F9 3E
fo ff 2. 2. 52 AA
Commodore 64 versi on
Use the program Tiny Peeker / Poker as follows. Type POKE 8192 , O: POKE44, 32 (return ) Enter and run the peeker / poker orogram . In response to the program pr o mp ts, t y pe in the data as gi v en fo ll owing ta bles . Wh e n v ou ' ve finish ed, POKE4 4, B: POKE45 , 232 :POKE46 , 17:CLR .
in
the type
Save E:< tramon wi th a nor mal SAVE before attemptin g to r un i t .
37
Then t y pe NEW . and use the following checksum program to enable y ou identif y and locate an y error s :
to
100 REM E XTRAMON64 CHECKSUM PROGRAM 110 DATAt Ot7 0 , 13676, 15404, 14997,151 3 6,1622 1,16696
115 DATA12816, 16228 ,1455 4 120 DATA14 677, 15039,1455 1,15104, 155 22 4 16414,15914
125 130 140 150 160
DATA8958,11945 ,S=2048 FOR B=ITOI9,READX , FOR I=ITOS , N=PEEK( I ) , Y=Y +N NE XT! , IF Y<> XTHEN? "ERROR IN BLOCK " B,GOTOI60 PRINT"BLOCK "B" CORRECT" S= I , y=O ,NE XTB,REM CHECK LAST BLOCK BY HAND
Th is program must be run after the fir st set of POKEs, a nd second s et.
before
the
If error s are found, type NEW (you won ' t lose Ex tramon!), re -Ioad Tiny Peeker /Poker , enter bloc k of memor y aga1.n, t y pe NEW, re - loa.d c hecksum program, r un it, if error s found t v pe NEW and re - l oad Tiny Peeker / Poker, and so on until no errors remai n. Then, issue last s et of POKEs and SAVE Ex tramon!
E:: tramon I ns tru c tion Set
This will be gi v en in the fo rm CO MMAND, fo llowed b v the synta x . 1}
Simple Assembler
. A 2000 LDA£1 2 s tart assembl y at 2000 he x . 2}
Di sassembler
. D 2000 disassem ble hex from 2000 onwards . Printing Disassembler . P 2000 , 204 0 engage printer beforehand with OPEN4,4:CMD4 . 3}
4)
Fi 11
memor y
.F 1000 11 00 FF fi ll memor y from 1000 to 1100 he x with the b yte FF .
5 } Go run
.G 1000 go to hex 1000 and e x ecutre program there. 6}
Hunt memor y
.H COOO DOOO · READ look f r om COOO to 0000 f or the ASCII string READ. 7)
Load
. L "FRED", 08 B) Memor y display . M 0 8 00 0 8 20 di spl ay memor y from he:< OBOO to 0 8 20 . 9) Register displa y .R
displays register va lues when Ex tramon wa s entered . I O} Save
.5 ""O:FRED"",08,0800,0820 save memor y from he x 0800 to 0 820 onto device that portion of memory FRED.
38
08
dri ve
1,
and
call
11 ) Tr a ns fer memor y . T 1000 11 00 5000 transfer memor y in the range he x 1000 to 11 00 and start storIng hex 5 000 onwards.
it
at
12) Ex it to Basic .Q
return to Basic read y mode.
Perform a CLR before doing an y thing .
39
Flow charting
F l ow fo
left
) F lOk) ~ r ight
U
t
o
+ + Crossin9
Flo w lin. es
Co/1.J,ecCor
D<>DD
8as;.:_ Process
OecJ:S , 'o q
A-e-d"f''7d /T-oce.ss Aa;i&a.ry OpeniLOIJ
VQ7Z JI1~
£xCn:u:.t.
Sort:
R-tXe55I/:9. fund/on. !b.m..hoLs
40
Co lJ..a..Ce..
/1
~
¢ ~L
O~c.bJr on Xl.
/"UU1noc.bY on
)(2.
·- - - c
41
Hex/Dec convertor
Decimal II< He:< adecimal Conversi ons
--- -------------------------------------------- ---------------------HE XA DECIMAL COLUMNS
------------- - --- ------- ------ - - ------------ ------------------------6
5
4
3
2
----- ---------------------------- - ---- ------------ - ------- ------ ----HE X
DEC
HEX
DEC
HEX
DEC
HEX DEC
HEX DEC
HEX DEC
-------- - - - - -- ----- - -------- ----- -------- ---------------- --- --------0 2 3 4 5 6 7 8 9
0 1 ,048 ,576 2,097,152 3 ,145,728 4,194, 304 5,242,880 6,291,456 7 , 340 , 032 8, 3 88,60 8 9,437,184
A 10,485,760 B 11,53 4, 336 C 12,582,912 D 13 ,631,488 E 14,680,064
F 15 , 728 ,64 0
0 1 2 3 4 5 6 7 8 9 A B
C D E F
0 65,536 13 1, 072 196,60 8 2 6 2 ,144 327, 680 393 , 2 16 458, 752 5 2 4,288 589,824
655,360 720 ,897 786,432 851,968 917,504 983,040
0 1 2 3 4 5 6
"7
8 9 A
0 4, 0 96 8,192 12 , 2 88
16, 3 84 20 ,480 2 4,57 6 28,672 32 ,768 3 6,864 40,960
B
45, 0 56
C D E
49,152 53,248 57,344 61 ,440
F
0 256 512 768 1,024 1,280 1,53 6 1,792 2 , 0 48 2 , 304 A 2 ,560 B 2, 816 C 3 , 072 D 3,328 E 3 ,584 F 3, 840 0 1 2 3 4 5 6 7 8 9
0 2 3 4 5 6 7 8 9 A B
C D E F
0 16 32 48 64 80 96 11 2 128 144 160 176 192 208 224 240
0 1 2 3 4 5 6 7 8 9 A
B
C D E F
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
- ------ - - ---------- ------------------------------- ------ ------------Notes. To c on vert from hex adecimal to decimal, first find the corresponding co lumn pos ition for each h e ..:adec i mal digit .. Ma ke a note of the decimal equi va lents, then add the noted va lues together to obtain the con v erted decimal v alue. To convert from dec ima l to he:< adecimal, find the largest decimal value in the table that will fit into the number to be converted .. Ne x t make a note of the he x equivalent and co lumn position. Calculate the d eci mal remainder, an d repeat the process on this and any su b s equent rem a in de r s .
42
Hyperbolic functions
FUNCTION
BASIC EQUIVALENT
SECANT
SEC(X)= l /COS(X)
COSECANT
CSC(X)= l / SIN (X)
COTANGENT
COT (X)= liTAN (X)
INVERSE SINE
ARCSIN(X)= ATN (X/ SQR( -
INVERSE COSINE
ARCCOS(X)= - ATN (X/ SQR
INVERSE SECANT
ARCSEC(X)= ATN (X/ SQR (X * x- 1))
INVERSE COSECANT
ARCCSC(X)= ATN (X/ SQR(X * x- 1))
INVERSE COTANGEN T
ARCOT(X)= ATN (X)+ rr/ 2
HYPERBOLIC SINE
SINH (X)= (EXP(X)- EXP(- X))/2
x* x+
1))
(- X* X + 1)) + rr/ 2
+(SGN (X)- 1* rr/ 2
HYPERBOLI C COSINE
COSH (X)= (EXP(X)+ EXP( - X))12
HYPERBOLIC TANGENT
TANH (X)= EXP( - X)/( EXP(x)+ EXP
HYPERBOLI C SECANT
SECH (X)= 2/( EXP(X)+ EXP( - X))
HYPERBOLIC COSECANT
CSCH(X)= 2/( EXP(X)- EXP(- X ))
HYPERBOLIC COTANGENT
COTH (X)= EXP(- X)/( EXP(X) - EXP(- X))* 2+ 1
INVERSE HYPERBOLI C SINE
ARCSINH (X)= LOG(X + SQR(X * X + 1))
INVERSE HYPERBOLI C COSINE
ARCCOSH (X)= LOG(X + SQR (X * X - 1))
I
(- X))* 2+ 1
INVERSE HYPERBOLI C TANGENT
ARCTANH (X)= LOG(( 1 + X)/( 1- X))/2
INVERSE HYPERBOLI C SECANT
ARCSECH(X)= LOG(( SQR (- X* X + 1)+ l / X)
INVERSE HYPERBOLIC COSECANT
ARCCSCH (X)= LOG((SGN (X)* SQR
INVERSE HYPERBOLIC COTAN-
ARCCOTH (X)= LOG(( X + 1)/(x - 1))/2
(X* X + l/x) GENT
43
Memory maps 0000 0001 0003 0005 0007 0008 0009 OOOA OOOB OOOC 0000 OOOE OOOF 0010 00 11 0012 0013 0014 0016 0017 0019 0022 0026 002B 0020 002F 0031 0033 0035 0037 0039 003B 0030 003F 0041 0043 0045 0047 0049 004B 0040 004E 0054 0057 0061 0062 0066 0067 0068 0069 006F
44
- 0004 - 0006
-0015 -00 18 -0021 -0025 -002A -002C -002E -0030 -0032 -0034 -0036 -0038 -003A -003C -003E -0040 -0042 -0044 -0046 -0048 -004A -004C -0053 -0056 -0060 -0065
-006E
0 I 3-4 5-6 7 8 9 10 II 12 13 14 15 16 17 18 19 20-2 1 22 23-24 25-33 34-37 38-42 43- 44 45- 46 47-48 49-50 51-52 53-54 55-56 57-58 59-60 61-62 63-64 65-66 67-68 69-70 71-72 73-74 75-76 77 78-83 84-86 87-96 97 98-101 102 103 104 105- 110 III
Ch ip directional reg iste r Chip 110 ; memory & tape control Fl oat - Fix ed vector Fi xed- Float vector Search character Scan- qu otes flag TAB column save 0 ; LOAD , I = VERIFY Input buffer pointer/ - sub~c rpt Default DIM flag Type: FF = string, 00 =numeric Type: 80 =integer, 00 =fl oating point DATA scan / LIST qlJote/ memry flag Subscript / FNx fl ag 0 = INPUT;$40 = GET;$98 =READ ATN sign / Comparison eval flag Current !l0 prompt flag Integer value Pointer: temporary string stack Last temp string vector Stack for temporary strings Utility pointer area Product area for multiplication Pointer: Start- of- Basic Pointer: Start-of-Variables Pointer: Start-of-Arrays Pointer: End-of-Arrays Pointer: String-storage(moving down) Utility string pointer Pointer: Limit-of- me mory Cu rrent Basic line number Previous Basic line number Pointer: Basic statement for CONT Current DATA line number Curre nt DATA address Input vector Current variable name Current variable address Variable pointer for FOR/ NEXT V-save; op-save; Basic pointer save Comparison symbol accumulator Misc work area, pointers, etc Jump vector for fun ctio ns Mise numeric work area Accum"'l : Exponent Accum"'l : Mantissa Accum N l : Sign Series evaluation constant pointer Accum#1 hi-order (overflow) Accum#2 : Exponent , etc. Sign comparison, Acc"l vs #2
0070 007 1 0073 OU7A U08B 0090 009 1 0092 0093 0094 0095 0096 0097 0098 0099 009A 009B 009C 0090 009E 009F OOAO 00A3 OOM 00A5 00A6 00A7 00A8 00A9 OOAA OOAB OOAC OOAE OOBO 00B2 00B4 00B5 00B6 00B7 00B8 00B9 OOBA OOBB OOBD OOBE OOBF OOCO OOCI 00C3 OOCS 00C6 00C7 00C8 00C9 OOCB
-0072 -008A - 007B - 008F
-00A2
-OOAD -OOAF -OOBI -00B3
-OOBC
- 00C2 -OOC4
-OOCA
112 113- 114 115 - 138 1:?2- 123 139 - 14 3 144 14 5 14 6 14 7 148 149 150 15 1 152 153 154 155 156 157 158 159 160- 162 163 164 165 166 167 168 169 170 17 1 172- 173 174- 175 176-177 178- 179 180 18 1 182 183 184 185 186 187- 188 189 190 19 1 192 193- 194 195- 196 197 198 199 200 201-202 203
Accum"l lo-o rd er (rounrling) Cas;eltc buff l e n / Se ri e~ point er CHRGET suiJrout ine, get Basic char Basic point er (within subnn) RND se!'d value Status word ST Ke)'switch PIA : STOP and RVS flags Timing constant for tape Load = 0, Verify = I Se ri al output : deferred char flag Serial deferred ch aracter Tape EOT received Register save How many open files Input devi ce, normally 0 Output CMD device, normally 3 Tape character pa rity Byte- received fl ag Direct = $80/ RUN = 0 outpu t con trol Tp Pass 1 error log/ char buffer Tp Pass 2 err log corr ected Jiffy Clock HML Serial bit cou nt/EOI flag Cycle cou nt Countdown,tape write/ bit count Tape buffer pointer Tp Wrt Idr count / Rd pass/ in bit Tp Wrt new byte/ Rd error/inbi t cnt Wrt start bit / Rd bit err/ stbit Tp Scan;Cnt ;Ld ;End/byte assy Wr lead length/ Rd checksum/ parity Point er: tape bufr, scrolling Tape end adds/End of program Tape timing constants Pntr: start of tape bu ffer I = Tp timer enabled ; bit count Tp EOT/RS232 next bit to send Read character error/outbyte buf " characters in fi le name Current logical file Current secndy address Current device Pointer to fil e name Wr shift word / Rd i nput char " blocks remaining to Wr/ Rd Serial word buffer Tape motor int erl ock I/O start address Kernel setup poinler Last key pressed .. chars in keybd buffer Screen reverse flag End-<>f-line for input pointer Input cursor log (row, col umn) Wh ich key: 64 if no key
45
OOCC OOCO OOCE OOC F 00 0 0 0001 0003 0004 0005 0006 0007 0008 0009 00F3 00F5 00F7 00F9 OOFF 0100 0100 0200 0259 0263 0260 0277 028 1 0283 0285 0286 0287 0288 0289 028A 028B 028C 0280 028E 028F 029 1 0292 0293 0294 0295 0297 0298 0299 029B 029C 0290 029E 029F 02A I 02A2 02A3 02A4
46
- 0002
- 00F2 - 00 F4 -OOF6 -OOF8 - OOFA -O IOA -0 13E -OI FF -0258 -0262 -026C -02 76 -- 0280 -0282 -0284
-0290
-0296
-029A
-02AO
204 205 206 207 208 209-2 10 21 1 212 213 214 215 216 217- 242 243-244 245-246 247 - 248 249-250 256- 266 256-3 18 256-5 11 512-600 601-6 10 611 -620 62 1- 630 63 1-640 64 1-642 643-644 645 646 647 648 649 650 651 652 653 654 655-656 657 658 659 660 66 1-662 663 664 665 667 668 669 670 671-672 673 674 675 676
(l -
fl rl<11 cu rsor
Cllrsu r liming (()unidLlw n
(,11;"rlcl('r lind .. , eur~u r (u"ur in blin k phase Inpul fl' OI1l ,ot'l'n/ fr,"n k( 'd)(),IId Poinl er 10 ~(/{'('n lin e Posilion of Cl,,,o r on ;,l>ol'r linl' o~ dir,'cl cursor. else progr ~l11mt'd Cu rr(' nl scrren li ne lenglh Row where curosr li ves Utsl ink t'y/c hecksum / buffer • of INSERTs olJ lsliind ing Screen lint' link I ~ble Screen color poinler KeytJoard poinler RS-232 Rev pn tr RS-23 2 Tx pntr Floatin g to ASCII work area Tape error log Processo r stack area Basic input buffer Logical file tahle Device ' table Sec Adds table Keybd buffer Sla rt of Basic Memory Top of Basic Memory Serial bus timeout fla g Current color code Color und er cu rsor Screen memory page Max size of keybd buff er Repeat all keY.,s Repeat speed count er Repeat delay count er Keyboard Shift / Con trol fl ag Last shift patlern Keyboard table setu p pointer Keyboard sh ift mode 0 = sc roll enable RS-232 control reg RS-232 co mmand reg Bit timing RS-232 status " bits to send RS-232 speed/code RS232 receive point er RS232 input poin ter RS232 transmit pointer RS232 output pointer IRQ save during tape I/ O CIA 2 (NMI) In terrupt Control CIA I Timer A control log CIA I Interru pt Log CIA I Timer A enabl ed fl ag
02A5 02CO -02FE 0300 -030 1 0302 -0303 0304 -0305 0306 -0307 0308 -0309 030A -030B 030C 0300 030E 030F 03 10 -03 12 03 14 -03 15 03 16 - 0317 03 18 -03 19 031A -03 1B 03 1C -0310 031E -03 1F 0320 -032 1 0322 -0323 0324 -0325 0326 -0327 0328 -0329 032A -032 R 032C -0320 032E -032 F 0330 -033 1 0332 -0333 033C -03FB 0340 -037E 0380 -03BE 03CO -03FE 0400 -07FF 08(10 -9FFF !lOOO -9 f-TF AOOO -B FFF AOOO -BFFF COOO -CFFF 0000 -D02E 0400 -D4 1C 00 -DBFF DCOO - DCOF DDOO - DDOF DO()O -DFFF EOOO - FFFF EOOO - FFFF FF81 - FFF5 FFCG ITC9 FFCC FFCF
o
FFD2 FFEI f-HA'
Screen roI\ marker (Sp rile 11) Error message link Basic warm sta ri link Crunch Basic lokt"ns link Prinl lokens link Slarl new B~sic rode link Gel arilhmelic ~Iemen t link SYS A - reg save SYS X- reg save SYS V- reg save SYS slatus reg save USR fUll ction jump Hardware interrupl vector Break inlerrupl "eclo r NMI inlerrupt veclor OPEN veclor CLOSE veclor Sel-inpul vec tor Sel-outpUI vector Restore I/O vector INPUT vector Oulput vector Test-STOP vector GETveclor Abo n 1/0 'ector Warm slari vector LOAD link SAVE link Cassette buffer (Sprite 13) (Sprite 14) (Sprite 15) Screen mtmory Basi c RAM memory Allernate: ROM plug-in area ROM : Basic All ernale : RAM RAM memory, in cludi ng all ern ate Video Chip (6566) Sound Chip (6581 SID) Color nybble memory Int erface chip 1, IRQ (6526 CIA) Inl erface chip 2, NMI (6526 CIA) Ahernate: Character set ROM : Operaling System 573~~-65535 Ahernale: RAM 05 409-65525 Jump Table. Incillding: - SCi In pul chan nel - SPI ()lllrUI channel - Rcslore ocfau h I/O chan nels - INPUT - PRINT - Tesl SlOp key - (jET
677 704-766 708-769 770-771 772-773 774-775 776-777 778-779 780 78 1 782 783 784-785 788-789 790-79 1 792-793 794-795 796-797 79S-799 800-80 1 802-803 804-805 806-807 S08-S09 810-8 11 8 12-813 8 14-8 15 8 16-817 818-8 19 R2S- 10 19 !!32-894 896-958 960- 1022 1024-2047 2048-40959 32768- 40959 40960-49 151 49060-59 151 49152-532 47 5:3248- 53294 51272-54 300 5S29G-563 19 56320-56335 5G575-56591 53248-53294 57344-65535
(B248) (EA3 1) (FE66) (FE47) (F34A) (F29 1) (F20E) (F250) (F333) (F I 57) (F I CA) (F6ED) (FI3E) (F32F) (FE66) (F4A5) (F5ED)
47
Commodore 64 - ROM Memory Map AOOO; AOOC; A052 ; A080; A09E; AI9E; A328; A365; A38A; A3B8; A3FB; A408; A435; A437; A4 69; A474; A4 80; A49C; A533; A560; A579 ; A613; A642; A65E; A68E; A69C; A742; A7ED; A81D; A82C; A82F; A831; A857 ; A87 1; A883 ; A8AO; A8D2; A8F8; A906; A928; A93B; A94B; A96B ; A9A5 ; AA80; AA86; AAAO; ABlE; AB 3B; AB4D ; AB7B ; ABA5 ; ABBF; ABF9 ; AC06; ACFC ;
48
ROM control vectors Keyword action vectors Function vectors Operator vectors Keywords Error messages Error message vectors Misc messages Scan stack for FOR/ GOSUB Move memory Check stack depth Check memory space 'out of memory' Error routine BREAK entry ready . Rea dy for Basic Handle new line Re-chain lines Receive input line Crunch tokens Find Basic line Pe rform [NEW] Perform [CLR] Back up text pointer Perform [LIST] Perform [FOR] Execute statement Perform [RESTORE] Break Perform [STOP] Perform [END] Pe rform [CONT] Perform [RUN] Perform [GOSUB] Perform [GOTO] Perform [RETURN] Perform [DATA] Scan for next statement Perform [IF] Perform [REM] Perform [ON] Get fixed point number Perform [LET) Perform [PRINT"] Pe rform [CMD] Perform [PRINT) Print string from (y.a) Print format character Bad input routine Perform [GET] Perform [INPUP'] Perform [INPUT) Prompt & input Perform [READ] Input error messages
ADIE; AD78; AD9E; AEA8; AEFl; AEF7 ; AEFF; AF08; AFI4; AF28; AFA7; AFE6; AFE9; B016; B081; B08B; Bl13; B11O; B194 ; BIAS; B1B2; B101; B245; B:248; B34C; B370; B391; B39 E; B3A6; B3B3; B3E1; B3F4; B465; B475; B487; B4F4; B526; B5BD; B606; B63D; B67A; B6A3; B6DB; B6EC; B700; B72C; B737; B761; B77C; B782; B78B; B79B; B7AD; B7EB; B7F7; B80D; B824; B82D;
Pe rform [NEXT] Type match check Evaluate expression Constant - pi Evaluat e within brackets ')' comma .. Syntax error Check range Sea rch for variable Setup FN refere nce Perform [OR] Perform [AND] Compare Perform [DIM] Locate variable Check alphabe tic Create variable Array poi nter subrtine Value 32768 Float-fixed Set up array 'bad subscri pt' 'illegal quantity ' Compute array size Perform [FRE] Fix-float Pe rform [POS] Check direct Perform [DEF] Check fn syntax Perform [FN] Perform [STR$] Calculate string vector Set up string Make room for strin g Garbage collection Check salvageability Collect string Concatenate Build string to memory Discard unwanted string Clean desc riptor stack Perform [CHR$] Perform [LEFl'$] Perform [RIGHT$] Perform [MID$] Pull st rin g parame ters Perform [LEN) Exit string-mode Perform [ASe) Input byte paramte r Perform [VAL] Parameters for POKE/ WAIT Float-fixed Perform [PEEK] Perform [POKE) Pe rform [WAIT)
B849; B850; B853; B85A; B947; B!:J7E; B983; B9EA ; RA 2B; BA59; BA8C; BAB7 ; BAD4 ; BAE2 ; BAF9; BAFE; BBI2 : BBA2 ; BBC7; BBFC ; BCOC; BCIB; BC2 B; BC39; BC58; BC5B ; BC9B; BCCC; BCF3 ; BD7E ; BOG; BDCD; BODO: BFI5 ; BF3A ; BF71 ; BF7B ; BFB4 ; BFED; E043 ; E059; E097 ; EOf9; [12A; E1 55; E155 ; E158; EIBE; EIC7; EID4 ; E205 ; E20E; E219 ; E254 ; E25B; E2B4 ; £30E; E37B;
Add 0.5 Subtract- from Perform [subtract] PE'rform [add] Complemen t FAC' I overflow Mult iply by ze ro byte Perform [LOG] Perform [multiply ] Multiply-a-bit Memory to FAC'2 Adjust FAC'I / '2 Underfl ow/overfl ow Mu lti ply by 10 + l Oin fl oating pt Divide by 10 Perform [divide] Memory to FAC"I FAC"'I to memory FAC'2 to FAC"I FAC'I to FAC"2 Round FAC"I Get sign Perform [SGN] Perform [ABS] Compare FAC" I to mem Float-fixed Perform lint] String to FAC Get ascii digit Print 'IN ..' Print line number Float to ascii Decimal constants TI const ants Perform [SQRj Perform [power] Perform [negative] Perform [EXP] Series eval I Series eva I 2 Perform IRND] T! breakpoints T! Perform [SYS] Perform [SAVE] Perform IVERIFY] Perform [LOAD] Perform [OPEN] Perform [CLOSE] Parameters for LOAD/ SAVE Check default parameters Chec k for comma Parameters lor open / close Perform [COS] Perform [SIN] Perform [TAN] Perform [ATN] Warm restart
E39 4; E3A2 ; E3BF: E447 ; E453; E45 F; E500; E505 ; E50A ; E5 18; E544 ; E555; E55C; E5AO ; E5B4 ; E532 ; E584 ; E591 ; E5B5; E5ED; E70 1; E715 ; E87C; E891 ; E8A I ; E8B3; E8CB; E8DA ; E8EA; E955; E9C8; E9EO; E9FO; E9FF; EA1 3; EA24 ; EA 31; EA87 ; EB79; EB81 ; EBC2; EC03; EC44 ; EC4 F; EC78; ECB9; ECE7; ECFO; ED09 ; EDOC; ED40; EDB2 ; £oB9 ; £OBE; EDC7 ; £OCC; EDDD; EDEF;
Initialize CHRGET for ze ro page Init ia li ze Bas ic Vpctors for $300 Initialize vectors Power- up message Get I/ O address Get screen size Put /ge t row/colu mn Initializel / O Clear screen Home cursor Set scree n poi nt ers Set I/ O defaul ts Input from keyboard Input from screen Quote test Setup screen print Advance cursor Retreat cu rsor Back into previous line Output to screen Go to next line Perform Ch ec k lin e decrement Check line in crement Set color code Color code table Scroll screen Open space on screen Move a screen line Sy nchronize colo r tran sfer Set start-of- lin e Clear screen line Print to screen Sy nchronize color poi nt er Interrupt - clock etc Read keyboard Keyboard select vectors Keyboard I - unshift ed Kevboard 2 - shifted Keyboa rd 3 - 'co mm ' Graphics/ text cont rl Set graphics/ text mode Keyboard 4 Video chi p setup Shift/ run equivalent Screen In address low Send 'talk' Send 'listen ' Send to serial bus Serial timeout Send listen SA Clear ATN Send talk SA Wait for clock Send se rial deferred Send 'untalk '
49
EDFE ; EE13: EE8S; EE8E; EE97; EEAO; EEA9; EEB3 ; EEBB; EF06 ; EF2E; EF3 l ; EF3B ; EF4A; EF59 ; EF7E ; EFCS ; EFCA ; EFCD ; EFDO; EFE1 ; FOOD ; FOI7 ; F04D; F086; FOA4 ; FOB D; F12B ; F13E; F14E; F157 ; F1 99; FI CA; FlDD; F20E; F2S0 ; F291 ; F30 F; F31F; F32F; F333; F34A ; F3D5; F409; F4 9E; FSAF; FSCI ; FSD2 ; FSDD; F68F; F69B; F6BC; F6DD ; F6E4; F6ED; F6FB; F72D ; F76A ;
50
Spnd 'unlisten ' Rt:ceive Ir om seria l bus Serial clock on Serial clock off Serial output ']' Serial output '0' Get serial in & clock Delay 1 ms RS-232 send Send new RS-232 byte No-DSR error No-CTS error Disable timer Compute bit count RS232 receive Setup to rece ive Rece ive parity error Receive overfl ow Receive break Framing error Submit to RS232 No-DSR error Send to RS232 buffer Input lrom RS232 G",t Irom RS232 Ch",ck serial bus idle Messages Print il direct Get .. .. Irom RS232 Input Get.. tape/se rial / rs232 Output .. .. to tape Set input device Set ou tput device Close file Find file Set fil e values Abort all files Restore default I/ O Do file open Send SA Open RS232 Load program 'searching' Print fil enam e 'loading/ verifying' Save program Print 'saving' Bump clock Log PIA key reading Get time Set time Check stop key Output error messages Find any tape head r Write tape header
1'700; F7D7 ; F7EA ; FROD; FB17 ; F82E; F838; F84l ; F864; F87S; F8DO: F8E2 ; F92C; FA60 ; FB8E; FB97 ; FBA6; FBC8; FBCD; FCS7 ; FC93 ; FCB8: FCCA; FCD1 ; FCDB; FCE2; FD02 ; FD10; FD1S ; FD1A ; FD30; FDSO; FD9B; FDA3; FDDD; FDF9; FEOO; FE07; FE I 8; FE1C; FE21 ; FE2S ; FE27; FE2D; FE34 ; FE4 3; FE66 ; FEB6; FEBC; FEC2 , FED6; FF07 ; FF43 ; FF48; FF81 ; FFFA ;
(I('t buffer ildrlrl'Ss S" t buffer stMt /e nd poi nters Find specilic hl'ilder Bump tili>'" pointer 'press play .. ' Ch",ck tilpe stat us 'pr('ss rt'cord .. ' Initiilte tape r",ad Initiate tape write Common taJ.!'" code Check tape stop Set read timing Read tape bits Store tape chars Reset pointer ew character setup Send transition to tape Writ e data to tape IRQ en try point Writ", tape leader ReslOre normal IRQ Set IRQ vector Kill tape nlotor Check r/ w pointer Bump r/ w pointer Power reset ent ry Chec k 8-rom 8- rom mask Kernal reset Kernal move Vectors Initialize system co nstnts IRQ vectors Initialize I/ O Enable timer Save fil ena me data Save file d",tails Get status Flag status Set status Set timeou t Read / set top of memory Read top 01 memory Set top 01 memory Read /set bottom 01 memory NMI entry Warm start Reset IRQ & exi t Int errupt exit RS-232 timing tab le NMI RS- 232 in NMI RS-232 out Fake IRQ IRQ entry Jumbo jump table Hardwilre vecto rs
Memory architecture
Commodore-64 Architecture Map }FFFF
((;5535) -
-- . 8 t\ HI RAM
(bill 01SOOO I)
KERr-.: ." L ROM
0 - RA M 1 '" K[RNAL ROM
CHARACTER SET (b112ol SOOOI)
[
0", CHAR ROM
!-F.OOO
U)COO
.D8OO
f - - --
151JU' - - - - -
CIA 1. CIA 1;~~20~us. PUp)
4KRAM
Colour Ram Nibbles
maps to SDOOO when
1----1~ 5~1,
_ _ ____1
VIC II . SID
I .. I/O ROM/ RAM
' DOOO
bllsO& 1 01 10001 .. 0
--1~J2481------4
4K RAM
. COOO
(49152) 8K LO RAM
BASIC
(bit 001 10001)
I~TF..RPRF.TER
O:c RAM I _ BASIC ROM
ROM
'AOOO
,'0960)EXROM 8K ROM Cdnlidge maps here
.~ooo
(32i68)
BASIC U~r RAM
14000
(38912 Byles)
(16384)
HI-RES $crf'f'n maVS hert'
$2000
VIC 11 Chip 5E't'S
(8192)
this 16t\ blt>l:k on powt"r-up
L
10800
(2 fl 48)---
---1
Sfft"en(IK) S,04UO
~ESCOIO",T'bl'
(I0~4)------4 Wo( k~I'I
........ __ ........ . ' (1000
PHl(t'!'sor ~~~
51
Processor I/ O Po rt (6510) ~()()OO
f)OR
~UOOI
PR
SID (6581) 3
VOice 1
Voice 2
Voice
W400
$0 407
W4 0E
$0401
~0408
S040F
$0 402
W409
$041 0
$040A
$0411
$04 04
W4 0B
$0412
$0405
S040C
$0413
~ 0 406
$0400
$0414
Voice 2
Voice 3
54272
54279
54286
H
54273
54280
54287
L
54274
54281
54288
H
542 75
54282
54289
54276
54283
54290
Decal' TIme 6ms - 24 sec
54277
54284
5429 1
~~~aSjrj=
54278
54285
54292
-
Frequency
1-
S04 03
Voice 1
L
Pulse Width 0 NSE
0
0
0
Voice Type: PUL SAW
-
I
Key
TRI
Attack Time ---------=2 m'-8ms Sustain U!vel
Voices (wri te only)
$041 5
0
0
0
0
$0 41 6
0
I
Filter Frt"quenc),
$0417
Resonance
$0418
Passband: HI BP
Ext V3 off
LO
Filter Voices V3 V2 Master Vol me
L
54293
H
54294
VI
54295 54296
Filter & Volume (write only)
$0419
Paddle X (A/ O'I )
54297
$041 A
Paddle Y (AID ' 2)
54298
S041 B
Noise 3 (random)
54299
Envelope 3
54300
$0 41 C
Sense (read on ly) Note: Special Voi ce Features
rrEST. RING MOD. SYNC) are omitted fr om th e above diagram .
52
CIA 1 (IRQ) (652 6)
HX OO
PHA
SfiOlIi
SQCOI
I'R B
,fi:12 1
So(02
SFF - All OUIPUI
DOR.; S6312
SOC03
SOO - Allinpul
DDRH S[.323
- - - - - - - - ----1
~----------------------- -
SDC04
-
SDC05 SDC06
~
'"
S(i:t! 4
TAH
56~2S
TBL
S6126
THII
S(i~:! 7
ICR
50313
CRA
56334
CRB
S63:15
PRA
56576
PRB
5657i
-
Timer B
SDC07
'"
I InTapepul
SDCOD
TAL
-
Timer A
T ime r Int t:: rru pl
-~ - ~-
One Shol One Shol
SDCOE SDCOF
Oul Tune Tllner Mode PIl60uI AS.!~ T,mE'r Oul Time Mode PBi Oul B Sian
CIA 2 (NMI) (6526) SDOOO SDOOl
Serial IN DSR IN
1 I I CTS I Clock IN IN
Serial OUT
I
Clock OUT , DCDo IN
SDOO2
I
I I
I
ATN RS-232 VIC II • VIC II OUT OUT add. 15 addr 14 RIO, DTR RTS ' RS- 232 IN OUT OUT IN
DDRA 56578
S3F - Serial
SDOO3 SDD04
I I
SOO - P.U.P_All inpul ~
or
S06 - RS- 232
DORB 56579
-
Timer A
SDOO5 SDD06 ~
IRS-IN232 I
I TimeT Interru pl B
A
Timer
SDOOE
ASian Timer
SDOOF
56580
TAH
5658 1
TBL
56582
TBH
565R3
ICR
565R9
CRA
56590
CRB
56591
-
TimerS
SDD07
SDOOD
TAL
BSlan ° Connecled bUI nol used by 0.5.
53
M/C instruction set
The following notation applies to this summary: A X, Y M P S j
+ 1\
v ¥ PC
PCR PCL #dd aa aaaa t l
54
Accumulator Index registers Memory Processor status register Stack Pointer Change No change Add Logical AND Subtract Logical Exclusive-oR Transfer to Logical (inclusive) OR Program counter Program counter high Program counter low 8-bit immediate data value (2 hexadecimal digits) 8-bit zero page address (2 hexadecimal digits) 16-bit absolute address (4 hexadecimal digits) Transfer from stack (Pull) Transfer onto stack (Push)
ADC Operation :
Add to Accumulator with Carry A + M + C ~ A, C
NZCIDV j
Assembly Language
Addressing Mode
Form
ADC ADC ADC ADC ADC ADC ADC ADC
Imm ediate Zero Page Zero Page, X Absolute Absolute, X Absolute , Y (Indirect , X) (Indirect), Y
#dd aa aa ,X aaaa aaaa,X aaa a, Y (a a, X) (aa),Y
jj -- j
OP CODE
No . Bytes
No. Cycles
69 65 75 6D 7D 79 61 71
2 2 2 3 3 3 2 2
2 3 4 4 4' 4' 6 5*
-Add 1 jf page boundary is crossed .
AND AND Memory with Accumulator Logi cal AND to the accumulator Operation : A 1\ M ~ A
NZCIDV jj---Addressing Mode
Assembly L.nguage Form
Immediate Zero Page Zero Page, X Absolute Absolute, X Absolute, Y (Indirect, X) (I ndi rect), Y .. Add 1
If
page boundary
AND AND AND AND AND AND AND AND IS
#dd aa aa,X aaaa aaaa,X aaaa,Y (aa ,X) (aa),Y
OP CODE
No. Bytes
No. Cycles
29 25 35 2D 3D 39 21 31
2 2 2 3 3 3 2 2
2 3
--
4
4 4* 4* 6 5*
crossed .
55
ASL Accumulator Shift L eft Opera tion : C <-
17161514 131 211 10 1<- 0 :\Z C IDV ///- --
Addressing Mode A ccumulator Zero Page Zero Page, X Absolute Absolu te, X
Assembly language Form
ASL ASL ASL ASL ASL
A aa aa,X aaaa
aaaa /X
OP CODE
No. Bytes
No. Cycles
OA 06 16 OE 1E
1 2
5
2 3 3
6 6 7
2
Bee Branch on Carry Clear Operation: Branch on C
Addressing Mode Relative
=0
:\Z C IDV
Asse mbly language Form
Bee
aa
OP CODE
No . Bytes
No . Cycles
90
2
2'
... Add I if branch occurs fa same page . Add 2 if branch occu rs to differen t page. Note: AIM 65 will accept an abso lute address as the opera nd (i ns truction format
Bee
aaaa), and
convert it to a re lafive address .
Bes Branch on Carry Set Opera tion: Branch on C
Addressing ·Mode Relative
=1
NZCIDV
Assembly language
OP
Form
CODE
No . Bytes
No . Cycles
BO
2
2*
BeS
aa
"Add 1 If branch occurs to same page. Add 2 jf branch occurs to nex t page . Note: AIM 65 will accept an absolute address as the operand (i nstruct io n forma t BCS aaaa), and convert it fa a relat ive add re ss.
56
BEQ
Branch on Result Equal to Zero Opera tion : Branch on Z
Addressing Mode
=1
NZCIDV
Assembly language Form BEQ
Relative
aa
OP CODE
No. Bytes
No . Cycles
FO
2
2*
.. Add 1 if branch occurs to same page . Add 2 if branch occurs to next page. Note: AIM 65 will accept an absolute address as the operand (instruction format BEQ aaaa ), and convert it to a relative address .
BIT Test Bits in Memory with Accumulator Operation: A M, M 7 ..... N, M 6 ..... V Bit 6 and 7 are transferred to the Status Register. If the 1, otherwise Z 0 result of A M is zero then Z
=
=
NZCIDV M7 j -
Addressing Mode Zero Page Absolute
Assembly language Form
aa aaaa
BIT BIT
-M6
-
OP CODE
No. Bytes
No. Cycles
24 2C
2
3
3
4
BMI Branch on Result Minus Operation : Branch on N = 1
NZCIDV Addressing Mode Relat ive
Assembly language Form
BMI
aa
OP CODE
No. Bytes
No. Cycles
30
2
2*
• Add 1 If branch occurs to same page. Add 2 if branch occurs to different page. Not.: AIM 65 will accept an absolute address as the operand (instruction format 8M1 aaaa), and convert it to a relative address.
57
BNE Branch on Result Not Equal to Zero Operation: Branch on Z = 0
NZCIDV Addressing Mode Rel ati ve
Assembly language Form
BNE
aa
OP CODE
No . Byles
No. Cycles
DO
2
2*
• Add 1 If branch occurs to same page. Add 2 if branch occurs to different page. Note: AIM 65 will accept an absolute address as the operand (instruction format BNE aaaa ), and convert it to a re lative address .
BPL
Operation:
Branch on Result Plus Branch on N = 0 NZCIDV
Addressing Mode Relative
Assembly language Form
BPL
aa
OP CODE
No. Bytes
No . Cycles
10
2
2*
• Add 1 If branch occurs to same page. Add 2 if branch occurs to different page. Note : AIM 65 will accept an absolute address as the operand (instruction format BPl aaaa), and convert it to a relative address.
BRK Force Break Operation: Forced Interrupt PC
+ 2 J, P J, BNZCIDV 1---1--
58
Addressing Mode
Assembly Language Form
OP CODE
No. Bytes
No. Cycles
Implied
BRK
00
1
7
BVC Branch on Overflow Clear =0
Opera tion: Branch on V
Assembly Lang uage
Address ing Mode
Form
BVC
Relalive
aa
:,\Z C IDV
OP CODe
No . Byl.s
No . Cycl.s
50
2
2*
... Add 1 jf branch occurs to same page . Add 2 jf branch occurs to different page . Note: AIM 65 will accept an absolufe address as the operand (i nstruction format BVe aaaa ), :lnd convert it to a relative address .
BVS Branch on Overflow Set Operati on: Branch on V
Add r.ss ing Mod. Relative
=1
:,\ZCID V
Assembl y Language Form
BVS
aa
OP CODe
No . Byles
No . Cycles
70
2
2*
,. Add 1 .f branch occu rs to same page. Add 2 if bra nch occurs to different page. Note: AIM 65 will accept an absolute address as the operand (inst ruction format BVS aaaa ). and convert it to a relative address .
CLC Clear Carn} Flag Operation : 0 ~ C
NZCIDV --0-- Add ressing Mode
Assembly La nguage Fo rm
OP CODe
No Byles
No . Cycl.s
Implied
CLC
18
1
2
59
ClD Clear Decimal Mode Opera tion: 0
~
D
NZCIDV ----0Addressing Mode
Assembly language Form
OP CODE
No . Byles
No. Cycles
Implied
CLO
08
1
2
CLI Clear Interrupt Disable Bit Operation : 0
~
I
;-';ZCIDV ---0-Addressing Mode
Assembly language Form
OP CODE
No . Byles
No . Cycles
Implied
CLI
58
1
2
ClV Clear Overflow Flag Operation: 0
~
V
N Z CIDV - - - --0
60
Ad dressing Mode
Assembly language Form
OP CODE
No . Byles
No . Cycles
Implied
CLV
aa
1
2
CMP Compare Memory and Accumulator Operation: A - M
:\,ZCIDV jjj - -Assembly Language
Addressing Mode
Form
CMP CMP CMP CMP CMP CMP CMP CMP
Immed iate
Zero Page Zero Page, X Absolute Absolute, X Absolute, Y (Indirect , X) (Ind irect), Y -Add 1
If
#dd aa aa, X aaaa aaaa,X aaaa, Y (aa,X ) (aal.Y
OP CODE
No. Bytes
No . Cycles
C9 C5 05
2 2 2 3 3 3 2 2
2 3
CO 00 09 Cl 01
4 4 4" 4" 6 5"
page boundary I S crossed .
CPX Compare Memory and Index X Op ~ rati o n:
X- M
:\,ZCIDV jjj --Add ressing Mode Immediate
Zero Pa ge Absolute
Assem bly Language Form
CPX CPX CPX
#dd aa aaaa
OP CODE
No. Byles
No . Cycles
EO E4 EC
2 2 3
2 3 4
Cpy
Compare Memory and Index Y Op~ ration :
Y- M
NZCIDV j./j -- Addressing Mode Immed ia te Zero Page Absolute
Asse mbly Language Form
Cpy Cpy CPY
#dd aa aaaa
OP CODE
No . Byles
No . Cycles
CO C4 CC
2 2 3
2 3 4
61
DEC Decrement Memory by One Opera tion :
~
- 1 -+
~
;\,ZCIDV jj---Addressing Mode
Assembly language Form
Zero Pa ge
DEC DEC DEC DEC
Zero Page, X
Abso lute A bsolute, X
aa aa, X
aaaa aaaa, X
OP CODE
No . Bytes
No . Cycles
C6 D6 CE DE
2 2
5
3 3
6 6 7
DEX Decrement Index X by One Opera tion: X - 1-+ X
NZCIDV jj---Addressing Mode
Assembly language Form
OP CODE
No . Bytes
No. Cycles
Implied
DE X
CA
1
2
DEY Decrement Index Y by One Operation : Y - 1 -+ Y
NZCIDV jj-- --
62
Addressing Mode
Assembly language Form
OP CODE
No. Bytes
No . Cycles
Implied
DEY
88
1
2
EOR Exclusive-O R Memory with Accumulator Operation: A V M -+ A
l\ Z CIDV jj-- -Assembly language
Addressing Mode
Form
EOR EOR EOR EOR EOR EOR EOR EOR
Immed ia te Zero Pa ge Ze ro Pa ge, X Absol ute Abso lu te, X Abso lute, Y (Indirect, X) (Ind irec t), Y • Ad d 1
If
page boundary
IS
#dd aa aa,X aaaa aaaa ,X
aaaa ,Y (aa,X ) (aa),Y
OP CODe
No . Bytes
49 45 55 4D 5D 59 41 51
2 2 2 3
No . Cycles 2
3 3
3 4 4 4' 4'
2 2
5'
6
crossed .
INC Increment Memory by One Operation: M
+ 1-+ M
NZCIDV jj ----
Addressing Mode
Assembly language Form
Ze ro Page Zero Page, X Absolute Absolute, X
INC INC INC INC
aa aa,X aaaa aaaa,X
OP CODe
No . Bytes
No . Cycles
E6 F6 EE FE
2 2 3 3
6 6
5
7
INX Increment Index X by One Operation : X
+ 1 -+
X
NZCIDV jj- --Addressing Mode
Assembly language
OP
Form
CODe
No. Bytes
No. Cycles
Implied
INX
E8
1
2
63
INY Increment Index Y by One Operation : Y + 1 --+ Y l\Z C IDV jj---Addressing Mode
Assembly Language Form
OP Code
No . Byles
No. Cycles
Implied
INY
CB
1
2
JMP Jump Operation : (PC ( PC
+ 1) --+ PCL + 2) --+ PCR NZ C IDV
Addressing Mode Absolute Indirect
Assembly Language Form
JMP JMP
aaaa (aaaa)
OP CODE
No . Bytes
No . Cycles
4C 6C
3 3
3 5
JSR Jump to Subroutine Operation : PC
+ 2 ,I., (PC + I) --+ PCL (PC + 2) --+ PCR NZCIDV
Addressing Mode Absolute
64
Assembly Language Form JSR
aaaa
OP CODE
No . Bytes
No .· Cycles
20
3
6
LDA
Load Accumulator with Memory Operation : M ~ A
I'\ZCIDV jj ---Assembly Language
Addressing Mode
Form
Immed iate Zero Page Zero Page, X Absolute Absolute, X Absolute, Y (Indirect, X) (Indirect), Y • Add 1
If
page
boundary
LOA LOA LOA LOA LOA LOA LOA LOA IS
#dd aa aa,X aaaa aaaa ,X aaaa,Y (aa,X) (aa),Y
OP CODE
No . Bytes
No. Cycles
A9 AS BS AD Bo B9 A1 B1
2 2 2
3
3 3 3 2 2
2 4 4 4* 4* 6 S*
crossed.
LDX
Load Index X with Memory Operation: M ~ X
NZCIDV jj -- -Addressing Mode Immediate Zero Page Ze ro Page, Y Absolute Absolute, Y "AClCl
Assembly Language form
LOX LOX LOX LOX
#dd aa aa,Y aaaa
LOX
aaaa,Y
OP COO£
No. Bytes
A2 A6 B6 AE BE
2 2 ;l 3 3
No. Cycles 2
3 4 4 4'
When page boun ary is crossed .
65
LDY
Load Index Y with Memory Operation : M --+ Y
NZCIDV // - - -Addres.ing Mod.
A.sembly unguag. Form
Immediate Zero Page Zero Page, X Absolute Absolute, X ... Add 1 when page boundary
lOY lOY lOY lOY LOY IS
#dd aa aea,X aaaa aaaa,X
OP CODE
No. Byt••
No. Cycl ••
AO A4 B4 AC BC
2 2 2 3 3
2
3 4 4 4*
crossed .
LSR Local Shift Right Operation :
0--+ 171615141312111 01--+ C
NZCIDV
a ll - - Addressing Mode Accumulator Zero Page Zero Page, X Absolute Absolute, X
A•• embly language Form
lSR lSR lSR lSR lSR
A aa aa,X aaaa aaaa,X
OP CODE
No. Bytes
No . Cycle.
4A 46 56 4E 5E
1 2 2
2 5 6
3 3
6 7
NOP No Operation Operation: No Operation (2 cycles)
NZCIDV
66
Addr.uing Mod.
Au.mbly language Form
OP CODE
No. Byte.
No. Cycl ••
Implied
NOP
EA
1
2
ORA OR Memory with Accumulator Operation : A V M --+ A
N ZCIDV jj---Assembly Language Form
Addressing Mode
ORA ORA ORA ORA ORA ORA ORA ORA
Immediate Zero Page Zero Page, X Absolute Absolute, X Absolute, Y (Ind irect, X) (Indirect), Y
#dd aa aa,X aaaa
OP CODE
No. Bytes
No. Cycles
09 05 15 00
2 2 2 3 3 3 2 2
2 3 4 4 4* 4* 6 5*
aaaa,X
10
aaaa,Y
19 01 11
(aa,X) (aa}, Y
... Add 1 on page crossing.
PHA Push Accumulator on Stack Operation: A J.
NZCIDV Addressing Mode
Assembly bnguage Form
OP CODE
No . Byt.s
No. Cycl.s
Impl ied
PHA
48
1
3
PHP Push Processor Status on Stack Operation : pJ.
NZCIDV Addr..sing Mode
Assembly Language Form
CODE
No. Byt..
No. Cycles
Impl ied
PHP
08
1
3
OP
67
PLA
Pull AccumulatoT from Stack Operation : At
NZCIDV jj ---Addressing Mode
Assembly Language Form
OP CODE
No . Bytes
No . Cycles
Impli ed
PLA
68
1
4
PLP
Pull Process01' Status from Stack Operation : P t
NZCIDV From Stack Addressing Mode
Assembly Language Form
Of' CODE
No . Byles
No. Cycles
Impl ied
PLP
28
1
4
ROL
Rotate Left NZC ID V jjj--Addressing Mode Accum ulato r Zero Page Zero Page, X Absolute Absolute, X
68
Assembly Language Form
ROL ROL ROL ROL ROl
A aa aa,X aaaa
aaaa,X
OP CODE
No . Byles
No. Cycles
2A 26 36 2E 3E
1
2 5 6 6 7
2 2 3 3
ROR
Rotate Right Operation :
N Z CIDV /// --Addressing Mode Accumulator Zero Page Zero Page, X Absolute Absolute, X
Assembly language
OP
Form
CODE
No . Bytes
No . Cycles
6A 66 76 6E 7E
1
2 2 3 3
2 5 6 6 7
ROR ROR ROR ROR ROR
A aa aa,X aaaa
aaaa,X
RTI
Return from Interrupt Operation: Pt Pet
NZCIDV From Stack Addressing Mode
Assembly language Form
Of' CODE
No. Bytes
No. Cycles
Implied
RTI
40
1
6
RTS
Return from Subroutine Operation : PCt, PC + 1--+ PC
NZCIDV Addressing Mode
A.sembly language Form
CODE
No. Byte.
No. Cycl..
Implied
RTS
60
1
6
OP
69
SBC Subtmct from Accumulator with Carry Operation : A - M Note: C Borrow
=
C~
A
NZCIDV ///- - / Addressing Mode
Assembly Language Form
SBe SBe SBe SBe SBe SBe SBe SBe
Immediate Ze ro Page Zero Page, X Absolute Absolute, X Absol ute, Y (Ind irect, X) (Indirect), Y • Add 1 when page boundary
IS
OP CODE
No . Bytes
No . Cycles
E9 E5 F5
2 2 2 3 3 3 2 2
2 3 4 4 446
#dd aa aa,X aaaa aaaa ,X aaaa, Y (aa,X) (aa), Y
ED FD F9 El Fl
5-
crossed.
SEC Set Carry Flag Operation: 1 ~ C
NZCIDV - - 1--Addressing Mode
Assembly Language
Of'
Form
CODE
No . Bytes
No . Cycles
Implied
SEC
38
1
2
SED Set Decimal Mode Operation : 1 ~ D
NZCIDV ----1-
70
Addressing Mode
Assembly Language Form
OP CODE
No. Bytes
No. Cycles
Implied
SeD
F8
1
2
SE. Set Interrupt Disable Status Operation: 1 ~ I
N Z CIDV ---1--
Addressing Mode
Assembly language Form
OP CODE
No . Bytes
No. Cycles
Implied
SE I
78
1
2
STA
Store Accumulator in Memory Operation : A ~ M
NZCIDV Addressing Mode Zero Page Ze ro Page, X Absolute Absolute, X Abso lute , Y (Indirect, X) (Indirect), Y
Assembly language form
STA STA STA STA STA STA STA
aa aa,X aaaa aaaa,X aaaa ,Y (aa,X) (aa),Y
OP CODE
No . Bytes
No . Cycles
85 95 8D 9D 99 81 91
2 2 3 3 3 2 2
3
"" 5 5 6 6
STX
Store Index X in Memory Operation : X ~ M
NZCIDV Addressing Mode Zero Page Zero Page, Y Absolute
Assembly language Form STX STX STX
aa aa,Y aaaa
OP CODE
No. Bytes
No. Cycl..
86 96 8E
2 2 3
3
"" 71
SlY Stm'e Index Y 'in Memo ry Operation : Y ..... M
NZC l DY Addressing Mode
Assembly language Form
Zero Page Zero Page, X Absolu te
STY STY STY
aa aa,X aaaa
OP CODE
No. Byles
No . Cycles
84 94 8e
2 2 3
3 4 4
lAX Transfer Accumulatm' to Index X Operation: A ..... X
ZCIDY j j--- Addressing Mode
Assembly language Form
OP CODE
No . Byles
No . Cycles
Implied
TAX
AA
1
2
lAY Transfer Accumulator to Index Y Operation: A ..... Y
NZCIDY j j - - --
72
Addressing Mode
Assembly language Form
OP CODe
No. Byles
No . Cycles
Implied
TAY
A8
1
2
TSX
Transfer Stack Pointer to Index X Operation: S --+ X
NZCIDV jj- --Addressing Mode
Assembly Language Form
OP CODE
No. Bytes
No . Cycles
Implied
TSX
SA
1
2
TXA
Transfer Index X to Accumulator Operation : X --+ A
NZCIDV jj-- -Addressing Mode
Assembly Language
OP
Form
CODE
No. Bytes
No. Cycles
Impl ied
TXA
8A
1
2
TXS
Transfer Index X to Stack Pointer Operation: X --+ S
NZCIDV Addressing Mode
Assembly Language Form
OP CODE
No. Bytes
No. Cycles
Implied
TXS
9A
1
2
TYA
Transfer Index Y to Accumulator Operation : Y --+ A
NZCIDV jj-- -Addressing Mode
Assembly Language Form
OP CODE
No . Bytes
No. Cycles
Implied
TYA
98
1
2
73
M/C mnemonics
6502 INSTRUCTION REPERTOIRE MNEMONIC
74
FUNCTION
ADC AND ASL
Add memory to accumulator with carry. AND memory with acQumulator. Shift left 1 bit.
BCC BCS BEQ BIT BMI BNE BPL BRK BVC BVS
Branch on carry clear. Branch on carry set. Branch on O. Test bits in memory with accumulator . Branch on result negative. Branch on result <> O. Branch on result positive. Force break. Branch on overflow clear . Branch on overflow set.
CLC CLD CLI CLV CMP CPX CPY
Clear carry flag. Clear decimal mode. Clear interrupt disable. Clear overflow flag . Compare memory with accumulator. Compare memory with X register. Compare memory with Y register.
DEC DEX DEY
Decrement memory. Decrement X register. decrement Y register.
EOR
El< clusive OR memory with accumulator.
INC INX INY
Increment memory. Increment X register . Increment Y register.
JMP JSR
Jump to specified location . Jump to subroutine.
LOA LOX LDY LSR
Load accumulator. Load X register. Load Y register . Shift right 1 bit .
NOP
No operation.
ORA
OR memory with accumulator.
PHA PHP PLA PLP
Push Push Pull Pull
accumulator onto processor status accumulator from processor status
stack. onto stack. stack. from stack.
ROL ROR RTl RTS
Rotate Rotate Return Return
left 1 bit . right 1 bit . from interrupt. from subroutine.
sac SEC
Subtract memory with borrow from accumulator. Set carry flag .
SED SEl STA STX STY
Set d ecima l mod e . Set int e rrupt disable. Store accumulator . St o re X r e gister . Store Y register .
TAX TAY TSX TX A TXS TYA
Transfer Transfer Transfer Transfer Transf e r Transfer
accumulator to X register . accumulator to Y register. stack pointer to X register . X register to accumulator. X register to stack pointer . Y register to accumulator.
75
Powers tables
Powers of 2
Powers of 16 N
N
2
256 512 1,024 2,048 4,096 8,192 16,384 32,768 65,536 131,072 262,144 524,288 1,048,576 2,097,152 4,194,304 8,388,608 16,777,216
76
N
16
N
8
1
o
9
16 256 4,096 65,536 1,048,576 16,777,216 268',435,456 4,294,967,296 68,719,476,736 1,099,511,627,776 17,592,186,044,416 281,474,.976,710,656 4,503,599,627,370,496 72,057,594,037,927,936 1,152,921,504,606,846,976
1 2 3 4 5 6
10 11
12 13 14 15 16 17 18 19 20 21 22 23 24
7 8 9
10 11
12 13 14 15
Cartridge slot
Cartridge Ex pan sion Slot Pin
I
22 21 20 19
I
I
I I
I
I
Pin
Type
GND
11
CDO
10
ROML 1/02
CD1
9
EXROM
CD2
8
GAME 1/01 Do l Cloc k
18
CD3
17
CD 4
6
16
CD5
5
C R/w
15 14
CD6
4
IRQ
CD7
3
+ 5V
13
DMA
2
12
BA
Type
j 7 in
II I I!
Type
+ 5V
Ff
Type
Z y
GND
X
CAl
W
CA2
V
CA3 CA4
H
CA14
U
F
CA15
T
CA5
E
S02
S
CA6
D
NMI
R p
CA7
C
RE SET
CA8
B
N
CA9
A
1 2 3 < 5
CAD
e
I
_ G~~ ~
CA10 CAll CAl2 CA13
7 8 9 1011 12131< 15 16 17 18 1920 2122
I :::::::::::::::::::::: I A B CD EFHJ KL M NPASTUVWXYZ
77
Joystick slot
1) Gam e I/ O
4) Seri al I/ O (Disk/Printe r)
2) Ca rtridg e Slot
5) Modu lat o r Ou tput
3) Aud io/Vi d eo
6) Co ssette 7) User Port
Control Port 1 Pin
Type
I
JO YAO
2
J OYA l
3
JOYA2
"5
JOYA3
o
o
o
o
POT AY
6
7
8
9
6 7
BUTTON A/ lP
8 9
GND
+ 5V
Not.
o
MAX. lOOmA
POT AX
Control Port 2 Pin
Type
I
JOY BO
2
JOY B I
3
J OYB2
"
JOY B3
5 6
78
Not.
POT BY BUTTO N B
7
+5V
8
GND
9
POT BX
MAX. lOOmA
2
3
4
o
o
o
5
o
RS232 standards
EIA RS 23 2-C ( CCITT V2 4 ) Notes
Tran s mis s ion is serial (asynchronous). MARK = binar y 1 = OFF = - 3 to -25 volts. SPACE = b i nar y 0 = ON = +3 to +25 v olts . 2 S - p i n "0 " type conn e ctor . Data Control Equipment (DeE) has female connector. Dat a Terminal Equipmen t (OTE) has male c onnector . Open c ir c uit dri v e v oltage cannot e x ceed 2 5 v olts . Terminator resist a n c e 3-7 K ohms. 5 0 foot ma x imum DeE, DTE sep.ration. 2 500 pica farad max conductor capacitance.
PI N
NAME
DIRECTION
CIRCUIT CCITT EIA
FUNCTION
---- + -------- + ----------- + -- - --- - - -------+--- - ---- - ~- - ---- --------- --- -- -- -
01 02 03 04 OS 06 07 OB 09 10 II 12 13 14 IS 16 17 IB 19 20 21 22 23 24 25
F6 TD RD RTS CTS DSR S6 DCD QM (S)DCD (S )CTS (S) TD NS TC (S)RD DCT RC DCR (S ) RTS DTR SQ RI TC
To To To To To
DCE DTE DCE DTE DTE
To To To To To To To To To To To To To To To To To To To To To
DTE DTE DTE DTE DTE DTE DCE DCE DTE DTE DTE DTE DTE DCE DCE DTE DTE DCE DTE DCE DCE
10 1 10 3 10 4 l OS 10 6 10 7 102 10 9
AA BA BB CA CB CC AB CF
Bell 20BA
122 SCF 12 1 SCB 118 SBA Bell 208A 114 DB 11 9 SBB Bell 20BA li S DD Bell 20BA SCA 12 0 I OB. 2 CD 11 0 C6 12 5 CE 1I1 CH 112 CI DA 11 3 Bell 11 3 B
Frame Ground. Tran . mitt.ed Data. Rec ei v ed Data. Reques t To Send. Clear To Send. Data Set Ready. S i gnal Ground. Data Carrier Detect. Positi v e DC Test Voltage. Negat i v e DC Tes t Voltage. Equaliser Mode. Secondary Data Ca rrier Detect. Secondar y Clear To Send. Secondar y Transmi t ted Data. New Synch . Trans mi tter Cloc k . Sec ondar y Rec ei v ed Data. Di v ided Clock Trans mi t t er. Receiver Clock. Divided Clock Receiver. Sec ondary Request to Send. Data Terminal Read y . Signal Quality Detect . Ri ng Indicator . Data Rate Selector. Data Rate Selector. EXT Transmi tter Clock . Bus y .
79
CCITT V24 Ci~cuit
102 - Si gnal
G~o und
103 -
T~ansmitted
The data signals
Common
o~
Thi s con d u ctor establi s hes interchange c ir cu it s . Ci~cuit
the
t~ansfe~~ed
Ci ~ c uit
a~e
105 -
Cont~ols Ci~cuit
DTE,
more
ci~cuit
return
to
t~ansmitted
gene ~ ated
on this
b y the DCE, in
ci ~cuit
106 -
Rea d y
fo~
a
~esponse
r emote
data
to
data
station,
function of the DCE.
Sending t~ansmit
data
on
107 - Data Set Read y whethe~
the DCE is
to
~eady
ope~ate.
10 Bl l - Connect Data Set to Line
10 B/2 - Data
Te~minal
Cont~ol s switching of the equipment to o~ f~om the line . Ci~cuit
stations,
to the DTE.
t ~an sm i t
Cont~ols swi tching of the equipment to o~ f~om the line. Ci~cuit
data
Request to Send
t he dat a channel
Indicates Ci~cuit
be
remote
Indicates whet he~ the DCE is conditioned to the data channel. Ci~cuit
for
to DCE.
line signals received from
t~ansfe~red
Ci~cuit
c ommon
10 4 - Recei ved Data
The dat a signals cha nnel
signal
by the
o~iginated
on this
Retu~n
Data
v ia the data channel to one or a~e
Definit i ons
Ci~cuit
10 9 -
Ca~~ie~
signal-conve~sion
o~
similar
o~
similar
Ready signal - conve~sion
Detect
Indicates whethe~ the ~eceived data channel line signal is with i n app~op~iate limits, as specified by the ~elevant recommendation for DeE. Ci~cuit
110 -
Indicates
80
Data Signal Quality
whethe~
the~e
is a
Detecto~
~easonable
p~obability
of
an
error in the data recei v ed on the data channel . Cir c uit 111 - Data Signalling Rate Selector Used to
s elect
one
or
two
dual - rate s y nchronous DeE ,
signalling
data
or
to
select
ranges of data signalling rates of a DCE.
one
rates of a of the two
dual-range
synchronous
Circuit 112 - Data Signalling Rate Selector Used to select one of the two data signalling ranges of rates in the DTE to coincide with signalling rate or range of
rates
in
us e
in
a
rates
or
the data dual-rate
s ync hronous or dual -r ange asynchronous DCE. Circuit 113 - Transmitter Signal Element Timing Prov ides the DCE with s ignal element timing information. Circ uit 114 - Transmitter Signal Element Timing Pr ovi des the DTE with si gnal element timing information . Circuit 115 - Receiver Si gnal Element Timing Provides the DTE with signal element timing informat i on . Circuit 116 - Select Sta ndb y Used to select the
n or mal
or
standb y
facilities
such
as
signal convertors and communication channels.
Circuit 117 - Standby Indi c ator Indicates whether the DCE is conditioned in its standby mode with the pre - determ i ned fa ci lities replaced by their reserves.
Circuit 118 - Transmitted Backward Channel Data Equi v alent to circuit 103, e x cept that it is
used
for
data
recei v ed on the bac kwar d channel .
Cir c uit 120 - Transmit Backward Channel Line Signal Eq uiva lent to circuit 105, e xc ept that it is used to the backward channel transmit function of the DCE.
control
Circuit 121 - Backward Channel Read y Equi va lent
to
circuit
1 6 6,
e x cept
that
it
is
used
to
81
indicate whether t he DCE is c ondit i oned to transmit the backward c hannel.
data
on
Circuit 122 - Supervisory Carrier Detect Equiva len t to circuit 109, except that it i ndicate whether the received b ack ward channel i s within appropr iate limits.
is used to line signal
Circuit 123 - Backward Chann e l Signal Quality Detector Equivalent to circuit 110, e xc ept that it is used to i ndi cate the signal qualit y of the received bac k ward channel line sig nal. Circuit 124 - Select Frequency Groups Used to selec t DCE.
t he desired frequency groups avai lable on
the
Circuit 125 - Calling Indicator Indicates whether a cal l i ng sig nal is being received DCE .
by
Circuit 126 - Select Transmit Fr equenc y Used to select the required t r ansmit frequency of the DCE. Circu i t
127 - Select Receive Frequency
Used t o selec t
the required receive frequenc y of the DCE.
Circuit 128 - Receiver S i gnal Element Timing Provi des the DCE with signal element timing information. Circuit 129 - Reque st to Receive Used to control the receive fun cti on of the DCE. Circuit 130 - Transmit Backwar d Tone Controls the transmission of a backward channel tone. Circuit 13 1 - Received Character Timing Provides the DTE wi th char acter timing information. Circuit 132 -
82
Return to Non - Data Mode
the
Used to restore the non -data mode provided with the DCE, without releasing the line connection to the remote station. Circuit 133 - Ready for Receiving Controls the transfer of data on circuit 104, whether the DTE is capabl e of accepting a given data, specified in the intermediate equipment,
indicating amount of
appropriate recommendation for for e xample, error control
equipment. Circuit 134 - Received Data Present Used to separate information messages messages, transferred on circuit 104 .
from
supervisory
Circuit 191 - Transmitted Voice Answer Signals generated by a voice answer unit transferred on this circuit to the DCE. Circui t
192 -
in
the
DTE
are
Received Voice Answer
Received voice signals, generated by a voice answering unit at the remote data terminal, are transferred on this circuit
to the DTE. Other CCITT "V" . Interfaces V10 Electrical characteristics for unbalanced double- current interchange circuits for general use with integrated circuit equipment in the field of data communications.
V1I Electrical characteristics for balanced double-current interchange circuits for general use ~ith integrated circuit equipment in the field of data communications.
VIS Use of acoustic coupling for data transmission.
V16 Medical analogue data transmission modems.
V19
83
Modems
for
parallel
data
transmission
telephone
using
signalli ng frequencies.
V20 Paralle l dat a transmission modems standardised for use in the general s witch telephone network.
universal
V21 200-baud modem standardised for use in the
switched
general
telephone network. V22 Defines the procedures
and
standards
for
1200
baud
full
duplex communications over the public s witched network.
V23 600/1200-baud modem standardised s witched telephone network.
for
use
in
the
general
V24 List of definitions for interchange circuits between data terminal equipment and data circuit terminating equipment.
V25 Automatic calling and/or answering equipment on the general switched telephone networ k, including disabling of echo-suppressors on manual ly established calls. V26 2 400 bits per second modem standardised leased telephone- type circuits .
for
use
on
4 - wire
V26 (a lternat ive) 2400/1200 bits per second modem stan dardised for use general switched telephone network.
in
the
V27 4800 bits per second modems with manual equaliser standardised for use on leased telephone-type circuits. V27 (alter nati ve 1) 4800
84
bits
per
second
modems
with
automatic
equaliser
standardised for use on leased telephone- type circuits. V27 (a lternati v e 2) 4800/2 400 bits per second modems standardised for use in general sw itc hed telephone network.
the
V28 Electrical
characteristics
for
unbalanced
double-c urrent
interchange circuits.
V29 9600 bits per second modems standardised for
use
in
leased
telephone circuits.
V31 Electrical c haracteristics for single circuits controlled b y contact closure.
current
interchange
V3 5 Data transmission at 48 k ilobits per second using 6 0- 10 8
KHz
g roup band circuits.
V3 6 Modems for synchronous transmission using
6 0-108
KHz
group
band ci rcuits.
85
Centronics standards
CENTRONICS PARALLEL INTERFACE Notes Busy is set if: 1) 2) 3) 4)
Data is being received. Printer is printing. Printer is offline. An error condition is present.
On pins 02-09 a high level represents binary ONE, a low level represents binary ZERO. All printable characters ( i.e. codes having a ONE in DATA 6 or DATA 7) are st ored in the printer buffer. Control characters (i.e . codes ZERO in both DATA 6 an d DATA 7) are used to specify special control functions. These codes are not stored in the buffer e x cept when they specify a print command and are preceded by at least one printable character in that line. PIN
CODE
FUNCTION
--------+------------+-------------------------- ---------- 01 02 03 04 05 06 07 08 09 10 11
12 13 14 15 16 17 18 19-30 31 32
33 34 35 36
86
STROBE DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 DATA 6 DATA 7 DATA 8 ACKNLG BUSY PE +5V AUTO FEED NC GND LOGIC GND CASE NC GND INT ERROR GND NC +5V SLCT IN
Read Data Pulse . Data lines. ditto. di tto. ditto. ditto. ditto. ditto. ditto. Data Received and Ready for More. Not Ready for Data. SET high when Out-of-Paper. Switch Set gives e x tra line-feed. No Connection.
Logic Ground. Chassis Ground. No Connection.
Signal Grounds. Reset and Buffer Clear . See Notes on BUSY. Signal Ground. No Connection. Optional DClIDC3 .
Other output
Aud iolVideo Pin 1 2
GND
3 4
AUDIO OUT
5
~
Note
Type LUMINANCE
VIDEO O UT AUDIO IN -.
Serial J/O
~~-A-L=S=R=Q=IN~--~TYUpe~----------~
I
2 3 4
i
GND SERIAL ATN IN/O UT SE RIAL CLK IN/O UT
5
SERIAL DATA IN/OU T
6
RESET
Cassette Pin
Type
A- l
GND
B-2
+5V
C-3 D-4
CASS ETTE READ
E-5
CASS ETTE W RITE
F-6
CA SS ETTE SENSE
CASSETTE M OTO R
1 2
3 458
:::::: "
B C D E F
87
User 1/0
Type
Pin
Note
G ND
1 2
+ 5V
3
RESET
4
CNTl SPl
S 6
MAX . 100 mA
CNT2 SP2
7
-
8
PC2
SER . ATN IN
9 10
9 VAC
MAX . 100 mA
11
9 VAC
MAX . 100 mA
12
GND
Type
Pin A
Note
GND
--
B
FLAG2
C
PBO
0 E
PB 2
F
PB3
PB l
H
PB4
J K L M
PBS PB6 PB7 PA2 GND
N
2
3
4
5
6
7
8
9 10 11 12
:::::::::::: ABC 0 E F H J K L M N
88
Screen memory
COLUMN
10
20
30
39 1063
~
1024 1064 1104 1144 1184 1224 1264 1304 1344 1384 1424 1464 1504 1544 1584 1624 1664 1704 1744 1784 1824 1864 1904 1944 1984
10
""0:0;
20
24
t
2023
89
Sound chip registers
Byte
Description
00
Low Frequency value of note for voice 1 High Frequency value of note for voice 1 Low Pulse Rate for voice 1 High Pulse Rate for voice 1 Waveform for voice 1 Attack / Decay for voice 1 Sustain / Relese for voice 1 Low Frequency value of note for voice 2 High Frequency value of note for voice 2 Low Pulse Rate for voice 2 High Pulse Rate for voice 2 Waveform for voice 2 Attack / Decay for voice 2 Sustain / Release for voice 2 Low Frequency value of note for voice 3 High Frequency value of note for voice 3 Low Pulse Rate for voice 3 High Pulse Rate for voice 3 Waveform for voice 3 Attack / Decay for voice 3 Sustain / Release for voice 3 High Frequency Cut-Off Low Frequency Cut-Off Turn on filtering Set volume for all three voices Plus select filter type Access To Output of envelope generator of voice 3 Digitised output from voice 3 Digitised output from envelope generator 3
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28
90
Musical notes values Note 0
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
Note- Octave C- O C# - O 0- 0 0# - 0 E- O F- O F# - O G- O G# - O A- O A# - O B- O C- l C# - 1 0- 1 0# - 1 E- l F- l F# - 1 G-l G# - 1 A- I A# - 1 B- 1 C- 2 C# - 2 0- 2 0# - 2 E- 2 F- 2 F# - 2 G- 2 G# - 2 A- 2 A# - 2 B- 2 C-3 C# - 3 0- 3 0# - 3 E-3 F- 3 F# - 3 G- 3
Hi Freq
1
1 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 6 6 6 7 7 8 8 9 9 10 10 11 12 12
low Freq 18 35 52 70 90 11 0 132 155 179 205 233 6 37 69 104 140 179 220 8 54 103 155 210 12 73 139 208 25 103 185 16 108 206 53 163 23 147 21 159 60 205 114 32 216
91
Note
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
93 94
92
Note- Octa ve
G#-3 A- 3 A#-3 B- 3 C- 4 C#-4 0- 4 0# - 4 E- 4 F- 4 F# - 4 G- 4 G#-4 A- 4 A#-4 B- 4 C-5 C# - 5 0- 5 0# -5 E- 5 F- 5 F#-5 G- 5 G#-5 A- 5 A# -5 B-5 C- 6 C# - 6 0- 6 0#-6 E- 6 F6 F#- 6 G- 6 G# - 6 A- 6 A# - 6 B- 6 C- 7 C# - 7 0- 7 0# - 7 E- 7 F- 7 F# - 7 G- 7 G# - 7 A- 7 A# - 7
Hi Freq
13 14 15 16 17 18 19 20 21 22 24 25 27 28 30 32 34 36 38 40 43 45 48 51 54 57 61 64 '68 72 76 81 86 91 96 102 108 115 122 129 137 145 153 163 172 183 193 205 217 230 244
low Freq 156 107 70 47 37 42 63 100 154 227 63 177 56 214 141 94 75 85 126 200 52 198 127 97 111 172 126 188 149 169 252 161 105 140 254 194 223 88 52 120 43 83 247 31 210 25 252 133 189 176 103
Sprite memory diagram
Address
Description
(53248 + ) 00 01 02-15 16
17 18 19 20 21
23 24 25
26 27 28 29 30 31
32 33 34
35 36 37 38 39 40-46
X position of sprite 0 Y position of sprite 0 Ditto for sprites 1 through 7 Most Significant Bit of X position Most Significant Bit of Y position Raster Register X position of Light Pen Y position of Light Pen Turn Sprite On Expand Sprite in Y direction Memory Pointers Interrupt Register Enable Interrupt Sprite Data Priority Multi-colour Sprites! Expand Sprite in X direction Sprite to Sprite collision Sprite Data collision Exterior colour Background Colour 0 1 "
I I
2 3
Sprite multi-colour 0 Sprite multi-colour 1 Colour for sprite 0 Ditto for sprites 1 through 7
93
DUCKWORTH HOME COMPUTING a new series All books written by Pete Gerrard, former editor of Commodore Computing International, author of two top-selling adventure games for the Commodore 64 and a regular contributor to Personal Computer News, Which Micro? and Software Review.
USING THE COMMODORE 64 A complete look at the latest home computer from Commodore Business Machines. Starting with a refresher course in Basic Programming, it moves on through machine code, before considering in great detail sprites, graphics and sound. A section on peripherals, and then the heart of the book: an in-depth look at the chips that make it work, including the 6581 Sound Interface Device and the 6566 Video Controller Chip, as well as the heart of the computer, the 6510. The comprehensive appendices cover the full Basic and Machine Code Instruction sets, as well as several useful reference tables, and a complete machine code assembler/disassembler listing. Available now
£9.95
EXPLORING ADVENTURES ON THE COMMODORE 64 The complete guide to computer adventure games: playing, writing and solving them. Starting with an introduction to adventures, and their early history, it takes you gently through the basic programming necessary on the 64 before you can start writing your own games. inputting of information, room mapping, movement, vocabulary, and everything required to write an adventure game are explored in full detail. Then follow a number of adventure scenarios, and finally three complete listings, written specially for the 64. The three games listed in this book are available on one cassette at £7.95. Available now
£6.95
Other titles in the series include The Beginner's Gui de to Computers & Computing, Sprites & Sound on the 64, 12 Simple Electronic Projects for the VIC, Will You Still Love Me When I'm 64, Advanced Basic & Machine Code Programming on the VIC. Advanced Basic & Machine Code Programming on the 64, Exploring Adventures on the VIC, as well as Pocket Handbooks for the VIC, 64, Dragon, Spectrum and BBC Model B. Write in for a descriptive leaflet.
s!
DUCKWORTH The Old Piano Factory, 43 Gloucester Crescent, London NWI 7DY Tel: 01-485 3484
94
Index
Arithmetic operators: 11 Arithmetic functions : 11 ASCII tables : 7 BAM formats : 29,30,32,33 Basic commands : 9, 10 Cartridge slot : 77 CCITT V24 definitions: 80-83 CCITT V interfaces: 83-85 Centronics standards: 86 Code conversion tables : 15-18 Colour memory: 14 Dec/hex convertors: 42 Directory format : 31,34 Directory structure: 26 Disk commands Basic 4: 19 Disk commands Basic 2: 20 Disk file formats: 27,28 DOS error messages: 21 -25 Error messages : 12,13 Extramon listing: 35-39 Flow charting : 40,41 Hyperbolic functions : 43 Input/output: 87,88 Joystick slot : 78 Keyboard sequences: 8 Machine Code instruction set: 54-73 Machine Code mnemonics : 74, 75 Memory architecture: 51 -53 Memory map: 46,47 Musical note values : 91,92 Page zero memory map: 44,45,46 Powers table: 76 ROM memory map: 48-50 RS232 standards : 79 Screen memory: 89 Sound chip registers : 90 Sprite memory diagram: 93
95
Duckworth Home Computing A POCKET HANDBOOK FOR THE COMMODORE 64 by Peter Gerrard and Danny Doyle This book contains all the vital information you will need when using your 64. There are sections on : ASCII tables - Basic keywords - Basic error messages - Colour memoryConversion tables - Disk commands - Disk error messagesDisk formats - Extramon listing - Flow charting - Hex/Dec convertor - Hyperbolic funct ions - Memory maps - Memory architecture- M / C instruction set-M/C mnemonics-Powers tables - Cartridge slot - Joystick slot - RS232 standardsCentron ics standa rds - Other output - Screen memory - Sou nd chip registers-Musical notes values-Sprite memory diagram . In short, everything you need to know about your machine.
ISBN 0-7156-1787-7
17878
Duckworth The Old Piano Factory 43 Gloucester Crescent, London NW1
ISBN 0715617877 IN UK ONLY £2 .95 NET