APocket Handbook· . for the -
COMMODORE 64
A Pocket Handbook for the Commodore 64
A Pocket Handbook
for the Commod...
362 downloads
1413 Views
15MB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
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 > , [, 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 ) ] [ Y THEN
(=
10 IF X =
] ]
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 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 " " TO " ( new name ) " :ON U< y ) J Change the name of a disk file. SCRATCH " < name ) ": ,0:;:, ; :. u< filename > : , < type > ;: , < mode > ; II;
(DSAVE)
SAVE :" ( filename >";:, <device ) ;
(HEADER)
PRINT£15, "ND: ="
(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
~.
.
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 X64 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 ~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'" 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