*********

Welcome to Project 64!

The goal of Project 64 is to preserve Commodore 64 related documents
in electronic text format that might otherwise cease to exist with the
rapid advancement of computer technology and declining interest in 8-
bit computers on the part of the general population. If you would like
to help by converting C64 related hardcopy documents to electronic
texts please contact the manager of Project 64, Cris Berneburg, at
<74171.2136@compuserve.com>.

Extensive efforts were made to preserve the contents of the original
document.  However, certain portions, such as diagrams, program
listings, and indexes may have been either altered or sacrificed due
to the limitations of plain vanilla text.  Diagrams may have been
eliminated where ASCII-art was not feasible.  Program listings may be
missing display codes where substitutions were not possible.  Tables
of contents and indexes may have been changed from page number
references to section number references. Please accept our apologies
for these limitations, alterations, and possible omissions.

Document names are limited to the 8.3 file convention of DOS. The
first characters of the file name are an abbreviation of the original
document name. The version number of the etext follows next. After
that a letter may appear to indicate the particular source of the
document. Finally, the document is given a .TXT extension.

The author(s) of the original document and members of Project 64 make
no representations about the accuracy or suitability of this material
for any purpose.  This etext is provided "as-is".  Please refer to the
warantee of the original document, if any, that may included in this
etext.  No other warantees, express or implied, are made to you as to
the etext or any medium it may be on.  Neither the author(s) nor the
members of Project 64 will assume liability for damages either from
the direct or indirect use of this etext or from the distribution of
or modification to this etext.

*********

The Project 64 etext of two 1541 drive memory maps. Please see the
header of the particular document for original sources. These etexts
were concatenated into one file to create this document.

C1541RAM.DOC
C1541ROM.DOC

154MAP10.TXT, June 1996, etext #43.

*********

The Project 64 etext of C1541RAM.DOC

*********

;	Commodore 1541 / OC-118 Disk Drive Memory Map
;	V1.3	18 Jan 1995

;	Covered in this file:
;	   1541 / OC-118 Disk Drive RAM Map
;	   1541 / OC-118 Disk Drive I/O Area
;


 The following text was grabbed from "The anatomy of the 1541" by
 Lothar Englisch and Norbert Szczepanowski.
 Additions from "1541 levyasema".


Layout of the 2Kb RAM area
==========================

;	Commodore 1541 Disk Drive RAM Map
;
; The number in brackets after description is the default value after
; power-up.


; Work queue

0000		Command code for buffer 0
0001		Command code for buffer 1
0002		Command code for buffer 2
0003		Command code for buffer 3
0004		Command code for buffer 4
0005		Command code for buffer 5 (unused)

; ***

0006 - 07	Track and sector for buffer 0
0008 - 09	Track and sector for buffer 1
000a - 0b	Track and sector for buffer 2
000c - 0d	Track and sector for buffer 3
000e - 0f	Track and sector for buffer 4
0010 - 11	Track and sector for buffer 5 (unused)

0012 - 13	Disk ID, drive 0
0014 - 15	Disk ID, drive 1
0016		Header block: ID
0018		Header block: Track
0019		Header block: Sector
001a		Header block: Parity

001b		Not used (Disk Controller work)
001c		Flag for disk change, drive 0 [01]
001d		Flag for disk change, drive 1 [01]
001e		Flag for write protect sense, drive 0 [01]
001f		Flag for write protect sense, drive 1

0020		Drive 0 status (disk and step motor)
;		   bit 7: Disk drive ready (1 = No, 0 = Yes)
;		   bit 6: Read/Write head moving (1 = Yes, 0= No)
;		   bit 5: Motor on (1 = Yes, 0 = No)
;		   bit 4: Switch off motor (1 = Yes, 0 = No)

0021		Drive 1 status (disk and step motor)

0022		Current track for drive 0
0023		Flag for 1541 (0), 1540 (not 0)
;		Not used (track for drive 1)

0024		Scratch pad of GCR conversion
;		Storage for BIN -> GCR conversions

002e		Pointer for temporary storage			WORD
0030		Buffer pointer for disk controller		WORD
;		Pointer: Active buffer

0032		Pointer: *** active track
0033		Pointer: *** active sector
0034		Pointer to last converted byte
0035		Not used (decode error, GCR)
0036		Byte counter for GCR/BIN conversion
0037		Not used (bit counter)
0038		Constant 7, ID mark for start of data block
0039		Constant 8, ID mark for start of block header
003a		Parity for data buffer
003b		Not directly used
003c		Not directly used
003d		Motor flag
;		Disk drive number, on 1541 always 00

003e		Active drive (FF, if not active)
003f		Buffer number for disk controller
;		Previous work place in queue (0 - 5)

0040		Byte counter for GCR conversion
0041		Number of next work in queue (0 - 5)
0042		Destination track (to move R/W head to)		DATA
0043		Number of sectors per track for formatting	DATA
0044		Temp. work area; Scratch pad			DATA
0045		Work code temp. storage
0046		Not used
0047		Data block ID char, default 07.
;	By changing this value, a data block can be written
;	with different ID. The value must be less than 10.

0048		Counter for head movement
;		Timer: R/W head acceleration

0049		Stack pointer temp. storage [39]
004a		Step counter for head transport
;	Values 0 - 127 move the head outside and values over
;	 128 move towards the centre.

004b		? (Temp. storage)				DATA
004c		Last read sector				DATA
004d		Next sector					DATA
004e - 4f	Pointer to buffer for GCR->BIN conversion	WORD
0050		Flag for GCR format (0=BIN, 1=GCR)		DATA
0051		Current track number for formatting [FF]	DATA
0052 - 55	Storage for 4 BIN bytes for GCR coding		DATA
0056 - 5d	Storage for 5 GCR bytes				DATA
005e		Number of steps for head motor accelerating/decl. [04]
005f		accelerating/decl. factor [04]
0062 - 63	Pointer to routine for head movement [FA05]	WORD
0064		Minimum number of steps [C8]
0065 - 66	UI vector [$EB22]				WORD
0067		Flag: NMI
0068		Flag for disk initialisation			DATA
;       Automatic disk initialisation if ID MISMATCH occurred
;       (1 = no, 0 = yes)

0069		Step size for sector division [0A]
;	Sector number interleave for SEQ files, default 10 (0A)

006a		Number of read attempts [5]			DATA
006b - 6c       Pointer: Start of Jump table for U commands [FFEA]   WORD
006d - 6e	Pointer: Start of bitmap [0400]

006f - 70	Pointer to address for M & B commands		WORD
0071		Temp. work area
0072		Temp. work area [FF]
0073		Temp. work area
0074		Temp. work area

0075 - 76	Indirect pointer [0100]

0077		Listener address (Device number + $20) [28]
0078		Talker address (Device number + $40) [48]
0079		Flag: Active listener
007a		Flag: Active talker
007b		?
007c		Flag for ATN from serial bus receiving
;		ATN interrupt
007d		Flag for ATN on serial bus active
007e		Last handled program
007f		Drive number (on 1541 always 00)
0080		Current Track number
0081		Current Sector number
0082		Channel number (Logical index)
0083		Secondary address
0084		Original Secondary address [6F]
0085		Current Data byte [3F]


0086 - 8a	Temp Results
008b - 8e	Work storage for division
;		Result, Multiply and divide
008f - 93	?

0094 - 95	Current buffer pointer				WORD
;		Pointer: Directory buffer (0204)

0096		?
0099 - 9a	Pointer: Next byte in buffer 0 [0300]
009b - 9c	Pointer: Next byte in buffer 1 [0400]
009d - 9e	Pointer: Next byte in buffer 2 [0500]
009f - a0	Pointer: Next byte in buffer 3 [0600]
00a1 - a2	Pointer: Next byte in buffer 4 [0700]
00a3 - a4	Pointer: Next byte in command buffer [0200]
00a5 - a6	Pointer: Next byte in error message buffer [02D6]

00a7 - ad	Table: Non-active channel numbers for each buffer
00ae - b4	Table:
00b5 - ba	Table: Record # low , block # low
00bb - c0	Table: Record # high, block # high
00c1 - c6	Write pointer for REL file
;		Table: next record numbers

00c7 - cc	Table: Record length for REL file
00cd - d2	Table: Side sectors

00d3		?

00d4		Pointer in record for REL file
00d5		Side sector number
00d6		Pointer to data block in side sector
00d7		Pointer to record in REL file

00d8 - dc	Directory sectors
00dd - e1	Index: Directory
00e2 - e6	Default disk drive [00]
00e7 - eb	File type (wild cards, @, closed)
00ec - f1	File type (channel)
00f2 - f7	Channel status
00f8		Flag for EOI
00f9		Current work (Buffer number)

00fa - fe	Last used table
00ff		Flag: FF = drive 0 not ready (No disk), 00 = ready
0100		Flag: FF = drive 1 not ready (No disk), 00 = ready
0101		Format marker, drive 0
;		DOS version (from track 18 sector 0)

0102		Format marker, drive 1
0103		Not used
0104 - ff	Stack area

0146		?
01ba		Buffer for GCR code

0200 - 29 	Buffer for command string
022a		Command code

;022b - 2d	Array: Logical index (LINDX)
;		Array of status bytes for each channel (secondary address)
;		Possible values:
;			FF = inactive
;			81 = opened for writing
;			41 = read/write
;			01 = opened for reading

022b		Logical index, channel 0
022c		Logical index, channel 1
022d		Logical index, channel 2

022e - 43	Last read/written byte for each channel
0244 - 49	Pointer: Last char on channel.
;		Points to the last character read/written in buffer.

024a		Type of active file
024b		String length
024c		Temp. channel number (secondary address)
024d		Current work with drive number
024e		Work area to find the best sector

024f - 50	Buffer allocated
0251		Flag: BAM changed, drive 0
0252		Flag: BAM changed, drive 1
0253            Flag for directory entry found (FF = Not found,
                00 = Found)     DATA
0254		Flag for directory output
0255		Flag: Waiting for command
0256		?
0257		Last used buffer
0258		Record length
0259		Track of side sector
025a		Sector of side sector

025b - 5f	Last work (buffers)
0260 - 65	Directory sector (buffers)
0266 - 6b	File's index in directory (buffers)

026c		Counter for LED flash
;		Error Message

026d		Error LED
026e		Drive for last program
026f		sector for last program
0270		Write LINDX
0271		Read LINDX

0272 - 73	Number of blocks (temp)
0274		Length of input line
0275		Char to interpret
0276		Index: End of filename in command buffer
0277		?
0278		Number of file names
0279		?
027a - 7f	Pointer table: Filenames
0280 - 84	Track of a file
0285 - 89	Sector of a file
028a		Flag: wild cards
028c		Number of drive(s ?) to look for
028d		Flag: Looking for drive
028e		drive with last write/open error, used as default drive
028f		Flag: Found in directory
0290		Directory sector
0291		Sector for first available file
0292		Index (in directory) for first available file
0293		For the last directory entry 0
0294		Current buffer-index
0295		Counter: Files
0296		Flag: Name matching wild cards
0297		Active operating mode (R or W)
0298		Flag: Work return
0299		Pointer: Re-read error
029a		Total tracks

029b - 9c	Pointer: BAM last update
029d - a0	BAM: image sector (drives 0 and 1)
02a1 - b0	BAM image
02b1 - d4	Buffer for directory output
02d5 - f8	Buffer for error message

02f9		Flag: Don't write BAM
;		This flag is reset to zero before and after each command

02fa - fb	Number of free blocks, low byte for drives 0 ja 1
02fc - fd	Number of free blocks, hi byte for drives 0 ja 1
02fe - ff	Stepper motor sequence

0300		Buffer 0
0400		Buffer 1
0500		Buffer 2
0600		Buffer 3
0621 - 22	Formatting counter
0700		Buffer 4
07ff		End of RAM




Layout of the I/O Ports (VIA 6522)
==================================

VIA 1: 6522, port for serial bus
-------------------------------

$1800	PB, port B
$1801	PA, port A
$1802	CB, data direction port B
$1803	CA, data direction port A

$1805	Timer

    PB 7, CB2:	ATN IN
    PB 6,5:	Device address preset switches
    PB 4:	ATN acknowledge OUT
    PB 3:	CLOCK OUT
    PB 2:	CLOCK IN
    PB 1:	DATA OUT
    PB 0:	DATA IN


VIA 2: 6522, port for motor and read/write head control
------------------------------------------------------

$1C00	PB, control port B
$1C01	PA, port A (data to and from read/write head)
$1C02	CB, data direction port B
$1C03	CA, data direction port A


    PB 7:	SYNC IN
    PB 6,5:	Bit rate D1 and D0
    PB 4:	WPS - Write Protect Sense (1 = On)
    PB 3:	ACT - LED on drive
    PB 2:	MTR - drive motor
    PB 0,1:	step motor for head movement

    CA 1:	Byte ready
    CA 2:	SOE - Set Overflow Enable for 6502
    CA 3:	read/write




Disk Controller Routines
========================

This table contains the addresses and the assigned buffers:

	JOB	TRACK  SECTOR	 BUFFER
	00	  06	  07	  0300-03FF
	01	  08	  09	  0400-04FF
	02	  0A	  0B	  0500-05FF
	03	  0C	  0D	  0600-06FF
	04	  0E	  0F	  0700-07FF
	05	  10	  11	  -no ram-

If a disk controller routine is to be performed in the interrupt, one
writes the job code and the track and sector numbers of the block to be
processed (if necessary) in the appropriate memory locations. Now the
job code can be passed. This job code has a value greater than 127 (the
7th bit is set). In order to wait until the job is finished, only the
seventh bit need be tested. If this bit is cleared, the job is completed.
The disk controller can perform the following jobs:

	JOB   NAME	DESCRIPTION
	80    READ	Read sector
	90    WRITE	Write sector
	A0    VERIFY	Verify sector
	B0    SEEK	Find sector
	C0    BUMP	Bump, Find track 1
	D0    JUMP	Execute program in buffer
        E0    EXECUTE   Execute program, first switch drive on and find
                        track

The verify job (A0) is performed automatically after writing a blcok.

If the job ends in an error then the memory location with job command
code is replaced with and error code. Here is a list of the error numbers:

	CODE	MEANING				DOS ERROR MESSAGE
	01	Everything OK			00, OK
	02	Header block not found		20, READ ERROR
	03	SYNC not found			21, READ ERROR
	04	Data block not found		22, READ ERROR
	05	Checksum error in data block	23, READ ERROR
	07	Verify error			25, WRITE ERROR
	08	Disk write protected		26, WRITE PROTECT ON
	09	Checksum error in header block	27, READ ERROR
	0B	Id mismatch			29, DISK ID MISMATCH
	0F	Disk not inserted		74, DRIVE NOT READY

  Error codes 06 and 0A do not occur on the 1541.



*********

End of the Project 64 etext of C1541RAM.DOC

*********

The Project 64 etext of C1541ROM.DOC

*********

;	Commodore 1541 / OC-118 Disk Drive ROM Map
;	V1.1	18 Jan 1995


; Note: This Memory map is collected from the 1541 diassembly
;   which was made by Peter Weighill.
;

; Data types in headers (for reassembler):
;
;	DATA		Misc data
;	TEXT		String terminated with 00
;	WORD		Vectors in LO/HI byte pairs
;	CHIP		I/O Area
;	EMPTY		ROM containing AA's or FF's
;


c000	Unused					EMPTY

;c100	File Manager Routines

c100	Turn LED on for current drive
c118	Turn LED on
c123	Clear error flags
c12c	Prepare for LED flash after error
c146	Interpret command from computer
c194	Prepare error msg after executing command
c1bd	Erase input buffer
c1c8	Output error msg (track and sector 0)
c1d1	Check input line
c1e5	Check ':' on input line
c1ee	Check input line
c268	Search character in input buffer
c2b3	Check line length
c2dc	Clear flags for command input
c312	Preserve drive number
c33c	Search for drive number
c368	Get drive number
c38f	Reverse drive number
c398	Check given file type
c3bd	Check given drive number
c3ca	Verify drive number
c440	Flags for drive check			DATA
c44f	Search for file in directory
c48b	?
c4d8	?
c5ac	?
c63d	Test and initalise drive
c66e	Name of file in directory buffer
c688	Copy filename to work buffer
c6a6	Search for end of name in command
c6ce	?
c6de	?
c7ac	Clear Directory Output Buffer
c7b7	Create header with disk name
c806	Print 'blocks free.'
c817	'Blocks free.'				DATA
c823	Perform [S] - Scratch command
c87d	Erase file
c8b6	Erase dir entry
c8c1	Perform [D] - Backup command (Unused)
c8c6	Format disk
c8f0	Perform [C] - Copy command
c9a1	?
c9a7	?
c9d5	?
c9fa	?
ca35	?
ca88	Perform [R] - Rename command
cacc	Check if file present
caf8	Perform [M] - Memory command
cb20	M-R memory read
cb50	M-W memory write
cb5c	Perform [U] - User command
cb84	Open direct access channel, number
cc1b	Perform [B] - Block/Buffer command
cc5d	Block commands "AFRWEP"			DATA
cc63	Block command vectors			WORD
cc6f	Get parameters form block commands
ccf2	Decimal values  1, 10, 100		DATA
ccf5	B-F block free
ccfe	?
cd03	B-A block allocate
cd36	Read block to buffer
cd3c	Get byte from buffer
cd42	Read block from disk
cd56	B-R block read
cd5f	U1, Block read without changing buffer pointer
cd73	B-W block write
cd97	U2, Block write without changing buffer pointer
cda3	B-E block execute
cdbd	B-P block pointer
cdd2	Open channel
cdf2	Check buffer number and open channel
ce0e	Set pointer for REL file
ce2c	?
ce6e	Divide by 254
ce71	Divide by 120
ced9	Erase work storage
cee2	Left shift 3-byte register twice
cee5	Left shift 3-byte register once
ceed	Add 3-byte registers
cefa	?
cf09	?
cf1e	?
cf8c	Change buffer
cf9b	Write data in buffer
cff1	Write data byte in buffer
d005	Perform [I] - Initalise command
d00e	Read BAM from disk
d042	Load BAM
d075	Calculate blocks free
d09b	?
d0af	?
d0c3	Read block
d0c7	Write block
d0eb	Open channel for reading
d107	Open channel for writing
d125	Check for file type REL
d12f	Get buffer and channel numbers
d137	Get a byte from buffer
d156	Get byte and read next block
d19d	Write byte in buffer and block
d1c6	Increment buffer pointer
d1d3	Get drive number
d1df	Find write channel and buffer
d1e2	Find read channel and buffer
d227	Close channel
d25a	Free buffer
d28e	Find buffer
d2ba	?
d2da	?
d307	Close all channels
d313	Close all channels of other drives
d339	?
d37f	Find channel and allocate
d39b	Get byte for output
d44d	Read next block
d460	Read block
d464	Write block
d475	Allocate buffer and read block
d486	Allocate new block
d48d	Write dir block
d4c8	Set buffer pointer
d4da	Close internal channel
d4e8	Set buffer pointer
d4f6	Get byte from buffer
d506	Check track and sector numbers
d552	Get track and sector numbers for current job
d55f	Check for vaild track and sector numbers
d572	DOS mismatch error
d586	Read block
d58a	Write block
d599	Verify execution
d5c6	Additional attempts for read errors
d676	Move head by half a track
d693	Move head one track in or out
d6a6	Attempt command execution multiple times
d6d0	Transmit param to disk controller
d6e4	Enter file in dir
d7b4	OPEN command, secondary addr 15
d7c7	-Check '*' Last file
d7f3	-Check '$' Directory
d815	-Check '#' Channel
d8f5	Open a file with overwriting (@)
d940	?
d9a0	Open file for reading
d9e3	Open file for writing
da09	Check file type and control mode
da2a	Preparation for append
da55	Open directory
dac0	Close routine
db02	Close file
db62	Write last block
dba5	Directory entry
dc46	Read block, allocate buffer
dcb6	Reset pointer
dcda	Construct a new block
dd8d	Write byte in side-sector block
dd95	Manipulate flags
dda6	?
ddab	Verify command code for writing
ddb7	?
ddf1	Write a block of a REL file
ddfd	Write bytes for following track
de0c	Get following track and sector numbers
de19	Following track for last block
de2b	buffer pointer to zero
de3b	Get track and sector
de50	Write (?)
de57	R
de5e	W
de65	R
de6c	W
de73	R
de95	Get following track and sector from buffer
dea5	Copy buffer contents
dec1	Erase buffer Y
ded2	Get side-sector number
dedc	Set buffer pointer to side-sector
dee9	Buffer pointer for side-sector
def8	Get side sector and buffer pointer
df1b	Read side-sector
df21	Write side-sector
df45	Set buffer pointer in side-sector
df4c	Calculate number of blocks in a REL file
df66	Verify side-sector in buffer
df93	Get buffer number
df9e	?
dfb7	?
dfc2	?
dfd0	Get next record iin REL file
e03c	Write block and read next block
e07c	Write a byte in a record
e0ab	Write byte in REL file
e0f3	Fill record with 0s
e105	Write buffer number in table
e120	Get byte from REL file
e1cb	Get last side-sector
e207	Perform [P] - Position command
e2e2	Divide data blocks into records
e304	Set pointer to next record
e31c	Expand side-sector
e44e	Write side-sector and allocate new

e4fc	Table of error messages			DATA
;	(with start and end letters +$80)  If value AND $7F less
;	 than $10 then look up text in pointer table.
;
;	Format: Error numbers, Description
;
;e4fc	00,	Ok
;e500	20,21,22,23,24,27, Read error
;e50b	52,	File too large
;e517	50,	Record not present
;e522	51,	Overflow in record
;e52f	25,28,	Write error
;e533	26,	Write protect on
;e540	29,	Disk id mismatch
;e546	30,31,32,33,34, Syntax error
;e552	60,	Write file open
;e556	63,	File exists
;e55f	64,	File type mismatch
;e567	65,	No block
;e570	66,67,	Illegal track or sector
;e589	61,	File not open
;e58d	39,62,	File not found
;e592	01,	Files scratched
;e59f	70,	No channel
;e5aa	71,	Dir error
;e5af	72,	Disk full
;e5b6	73,	Cbm dos v2.6 1541
;e5c8	74,	Drive not ready
;

e5d5	Indexed words				DATA
;	Format: Index number  Description
;
;e5d5	09 Error
;e5db	0A Write
;e5e1   03 File
;e5e6   04 Open
;e5eb   05 Mismatch
;e5f4   06 Not
;e5f8   07 Found
;e5fe   08 Disk
;e603   0B Record
;

e60a	Prepare error number and message
e645	Print error message into error buffer
e680	TALK
e688	LISTEN
e69b	Convert BIN to 2-Ascii (error message buffer)
e6ab	Convert BCD to 2-Ascii (error message buffer)
e6bc	Write OK in buffer
e6c1	Print error on track 00,00 to error buffer
e6c7	Print error on current track to error buffer
e706	Write error message string to buffer
e754	Get character and in buffer
e767	Get a char of the error message
e775	Increment pointer
e77f	Dummy subroutine
e780	Check for auto start - removed
e7a3	Perform [&] - USR file execute command
e84b	Generate checksum
e853	IRQ routine for serial bus
e85b	Service the serial bus
e909	Send data
e99c	DATA OUT lo
e9a5	DATA OUT hi
e9ae	CLOCK OUT hi
e9b7	CLOCK OUT lo
e9c0	Read IEEE port
e9c9	Get data byte from bus
e9f2	Accept byte with EOI
ea2e	Accept data from serial bus
ea59	Test for ATN
ea6e	Flash LED for hardware defects, self-test
eaa0	Power-up RESET routine
ebff	Wait loop
ec9e	Load dir
ed23	?
ed59	Transmit dir line
ed67	Get byte from buffer
ed84	Perform [V] - Validate command
edb3	?
ede5	Allocate file blocks in BAM
ee0d	Perform [N] - New (Format) command
eeb7	Create BAM
eef4	Write BAM if needed
ef3a	Set buffer pointer for BAM
ef4d	Get number of free blocks for dir
ef5c	Mark block as free
ef88	Set flag for BAM changed
ef90	Mark block as allocated
efcf	Erase bit for sector in BAM entry
efe9	Powers of 2				DATA
eff1	Write BAM after change
f005	Erase BAM buffer
f011	?
f05b	?
f0d1	Crear BAM				?
f0df	?
f10f	Get buffer number for BAM
f119	Buffer number for BAM
f11e	Find and allocate free block
f1a9	Find free sector and allocate
f1fa	Find free sectors in current track
f220	Verify number of free blocks in BAM
f24b	Establish number of sectors per track
f258	Dummy subroutine

;
;f259	Disk Controller Routines
;

f259	Initialise disk controller
f2b0	IRQ routine for disk controller
f2f9	Head transport
f36e	Execute program in buffer
f37c	Bump, find track 1 (head at stop)
f393	Initialise pointer in buffer
f3b1	Read block header, verify ID
f410	Preserve block header
f418	Work Return value 01 (OK) into queue
f41b	Work Return value 0B (READ ERROR) into queue
f41e	Work Return value 09 (READ ERROR) into queue
f423	Job optimisation
f4ca	Test command code further
f4d1	Read sector
f50a	Find start of data block
f510	Read block header
f556	Wait for SYNC
f56e	Test command code further
f575	Write data block to disk
f5e9	Calculate parity for data buffer
f5f2	Convert buffer of GCR data into binary
f691	Test command code further
f698	Compare written data with data on disk
f6ca	Command code for find sector
f6d0	Convert 4 binary bytes to 5 GCR bytes
f77f	GCR (5-bit) nybble table		DATA
f78f	Convert 260 bytes to 325 bytes group code
f7e6	Convert 5 GCR bytes to 4 binary bytes
f8a0	Conversion table GCR to binary - high nybble
;	$FF means invalid
f8c0	Conversion table GCR to binary - low nybble
;	$FF means invalid
f8e0	Decode 69 GCR bytes
f934	Convert block header to GCR code
f969	Error entry disk controller
f97e	Turn drive motor on
f98f	Turn drive motor off
f99c	Job loop disk controller
f9cb	?
f9d9	?
fa05	Move head to next track
fa1c	Calculate number of head steps
fa3b	Move stepper motor short distance
fa4e	Load head
fa63	?
fa7b	Prepare fast head movement
fa97	Fast head movement
faa5	Prepare slow head movement
fac7	Formatting
fda3	Write SYNC 10240 times, erase track
fdc3	Read/write ($621/$622) times
fdd3	Attempt counter for formatting
fde5	?
fdf5	Copy data from overflow buffer
fe00	Switch to reading
fe0e	Write $55 10240 times
fe30	Convert header in buffer 0 to GCR code
fe67	Interrupt routine

;fe85	Constands for disk format

fe85	Directory track				DATA
fe86	Start of bam				DATA
fe87	Length of bam per track			DATA
fe88	End of bam				DATA
fe89	Table of command words			DATA
;	"VIDMBUP&CRSN"
;	Validate, Initialise, D(Backup unused),
;	Memory, Block, User,
;	Position, &and;USR execute, Copy,
;	Rename, Scratch, New (Format).

fe95	Low  byte of command addresses		DATA
fea1	High byte of command addresses		DATA
fead	Bytes for syntax check			DATA
feb2	File control methods "RWAM"		DATA
feb6	File types "DSPUL"			DATA
febb	Names of file types			DATA
febb	1st letter "DSPUR"			DATA
fec0	2nd letter "EERSE"			DATA
fec5	3rd letter "LQGRL"			DATA
feca	Error LED bit value			DATA
fecd	Masks for bit command			DATA
fed1	Number of sectors per track		DATA
fed5	Constands for disk format		DATA
fed5	'A' marker for 1541 format		DATA
fed6	4 track ranges				DATA
fed7	Number of tracks			DATA
fed8	Tracks on which sector numbers change	DATA
fedb	Control bytes for head postion		DATA
fee0	Buffer address high bytes		DATA
fee6	ROM checksum				DATA

fee7	From UI command $EB22, to reset
;	Without RAM/ROM test
feea	Patch for diagnostic routine from $EA7A
fef3	Delay loop for serial bus in 1541 mode, from $E97D
fefb	Patch for data output to serial bus, from $E980
ff01	U9 vector, switch 1540/1541
ff10	Patch for reset routine, from $EAA4
ff20	Patch for listen to serial bus, from $E9DC
ff2f	Unused					EMPTY

ffe6	Format	[C8C6]				WORD
ffe8	Turn motor off [F98F]			WORD

ffea	USER vectors
ffea	UA, U1	[CD5F]				WORD
ffec	UB, U2	[CD97]				WORD
ffee	UC, U3	[0500]				WORD
fff0	UD, U4	[0503]				WORD
fff2	UE, U5	[0506]				WORD
fff4	UF, U6	[0509]				WORD
fff6	UG, U7	[050C]				WORD
fff8	UH, U8	[050F]				WORD
fffa	UI, U9	[FF01]				WORD

fffc	Hardware vectors
fffc	RESET [EAA0]				WORD
fffe	IRQ   [FE67]				WORD

*********

End of the Project 64 etext of C1541ROM.DOC

*********

End of the Project 64 etext 154MAP10.TXT, 1541 memory maps.

*********
