home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CBM Funet Archive
/
cbm-funet-archive-2003.iso
/
cbm
/
maps
/
C1541ram.doc
< prev
next >
Wrap
Text File
|
1995-03-08
|
12KB
|
414 lines
;cOMMODORE 1541 / oc-118 dISK dRIVE mEMORY mAP
;v1.318 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
0000cOMMAND CODE FOR BUFFER 0
0001cOMMAND CODE FOR BUFFER 1
0002cOMMAND CODE FOR BUFFER 2
0003cOMMAND CODE FOR BUFFER 3
0004cOMMAND CODE FOR BUFFER 4
0005cOMMAND CODE FOR BUFFER 5 (UNUSED)
; ***
0006 - 07tRACK AND SECTOR FOR BUFFER 0
0008 - 09tRACK AND SECTOR FOR BUFFER 1
000A - 0BtRACK AND SECTOR FOR BUFFER 2
000C - 0DtRACK AND SECTOR FOR BUFFER 3
000E - 0FtRACK AND SECTOR FOR BUFFER 4
0010 - 11tRACK AND SECTOR FOR BUFFER 5 (UNUSED)
0012 - 13dISK id, DRIVE 0
0014 - 15dISK id, DRIVE 1
0016hEADER BLOCK: id
0018hEADER BLOCK: tRACK
0019hEADER BLOCK: sECTOR
001AhEADER BLOCK: pARITY
001BnOT USED (dISK cONTROLLER WORK)
001CfLAG FOR DISK CHANGE, DRIVE 0 [01]
001DfLAG FOR DISK CHANGE, DRIVE 1 [01]
001EfLAG FOR WRITE PROTECT SENSE, DRIVE 0 [01]
001FfLAG FOR WRITE PROTECT SENSE, DRIVE 1
0020dRIVE 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)
0021dRIVE 1 STATUS (DISK AND STEP MOTOR)
0022cURRENT TRACK FOR DRIVE 0
0023fLAG FOR 1541 (0), 1540 (NOT 0)
;nOT USED (TRACK FOR DRIVE 1)
0024sCRATCH PAD OF gcr CONVERSION
;sTORAGE FOR bin -> gcr CONVERSIONS
002EpOINTER FOR TEMPORARY STORAGEword
0030bUFFER POINTER FOR DISK CONTROLLERword
;pOINTER: aCTIVE BUFFER
0032pOINTER: *** ACTIVE TRACK
0033pOINTER: *** ACTIVE SECTOR
0034pOINTER TO LAST CONVERTED BYTE
0035nOT USED (DECODE ERROR, gcr)
0036bYTE COUNTER FOR gcr/bin CONVERSION
0037nOT USED (BIT COUNTER)
0038cONSTANT 7, id MARK FOR START OF DATA BLOCK
0039cONSTANT 8, id MARK FOR START OF BLOCK HEADER
003ApARITY FOR DATA BUFFER
003BnOT DIRECTLY USED
003CnOT DIRECTLY USED
003DmOTOR FLAG
;dISK DRIVE NUMBER, ON 1541 ALWAYS 00
003EaCTIVE DRIVE (ff, IF NOT ACTIVE)
003FbUFFER NUMBER FOR DISK CONTROLLER
;pREVIOUS WORK PLACE IN QUEUE (0 - 5)
0040bYTE COUNTER FOR gcr CONVERSION
0041nUMBER OF NEXT WORK IN QUEUE (0 - 5)
0042dESTINATION TRACK (TO MOVE r/w HEAD TO)data
0043nUMBER OF SECTORS PER TRACK FOR FORMATTINGdata
0044tEMP. WORK AREA; sCRATCH PADdata
0045wORK CODE TEMP. STORAGE
0046nOT USED
0047dATA 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.
0048cOUNTER FOR HEAD MOVEMENT
;tIMER: r/w HEAD ACCELERATION
0049sTACK POINTER TEMP. STORAGE [39]
004AsTEP COUNTER FOR HEAD TRANSPORT
;vALUES 0 - 127 MOVE THE HEAD OUTSIDE AND VALUES OVER
; 128 MOVE TOWARDS THE CENTRE.
004B? (tEMP. STORAGE)data
004ClAST READ SECTORdata
004DnEXT SECTORdata
004E - 4FpOINTER TO BUFFER FOR gcr->bin CONVERSIONword
0050fLAG FOR gcr FORMAT (0=bin, 1=gcr)data
0051cURRENT TRACK NUMBER FOR FORMATTING [ff]data
0052 - 55sTORAGE FOR 4 bin BYTES FOR gcr CODINGdata
0056 - 5DsTORAGE FOR 5 gcr BYTESdata
005EnUMBER OF STEPS FOR HEAD MOTOR ACCELERATING/DECL. [04]
005FACCELERATING/DECL. FACTOR [04]
0062 - 63pOINTER TO ROUTINE FOR HEAD MOVEMENT [fa05]word
0064mINIMUM NUMBER OF STEPS [c8]
0065 - 66ui VECTOR [$eb22]word
0067fLAG: nmi
0068fLAG FOR DISK INITIALISATIONdata
;aUTOMATIC DISK INITIALISATION IF id mismatch OCCURRED (1 = NO, 0 = YES)
0069sTEP SIZE FOR SECTOR DIVISION [0a]
;sECTOR NUMBER INTERLEAVE FOR seq FILES, DEFAULT 10 (0a)
006AnUMBER OF READ ATTEMPTS [5]data
006B - 6CpOINTER: sTART OF jUMP TABLE FOR u COMMANDS [ffea]word
006D - 6EpOINTER: sTART OF BITMAP [0400]
006F - 70pOINTER TO ADDRESS FOR m & b COMMANDSword
0071tEMP. WORK AREA
0072tEMP. WORK AREA [ff]
0073tEMP. WORK AREA
0074tEMP. WORK AREA
0075 - 76iNDIRECT POINTER [0100]
0077lISTENER ADDRESS (dEVICE NUMBER + $20) [28]
0078tALKER ADDRESS (dEVICE NUMBER + $40) [48]
0079fLAG: aCTIVE LISTENER
007AfLAG: aCTIVE TALKER
007B?
007CfLAG FOR atn FROM SERIAL BUS RECEIVING
;atn INTERRUPT
007DfLAG FOR atn ON SERIAL BUS ACTIVE
007ElAST HANDLED PROGRAM
007FdRIVE NUMBER (ON 1541 ALWAYS 00)
0080cURRENT tRACK NUMBER
0081cURRENT sECTOR NUMBER
0082cHANNEL NUMBER (lOGICAL INDEX)
0083sECONDARY ADDRESS
0084oRIGINAL sECONDARY ADDRESS [6f]
0085cURRENT dATA BYTE [3f]
0086 - 8AtEMP rESULTS
008B - 8EwORK STORAGE FOR DIVISION
;rESULT, mULTIPLY AND DIVIDE
008F - 93?
0094 - 95cURRENT BUFFER POINTERword
;pOINTER: dIRECTORY BUFFER (0204)
0096?
0099 - 9ApOINTER: nEXT BYTE IN BUFFER 0 [0300]
009B - 9CpOINTER: nEXT BYTE IN BUFFER 1 [0400]
009D - 9EpOINTER: nEXT BYTE IN BUFFER 2 [0500]
009F - A0pOINTER: nEXT BYTE IN BUFFER 3 [0600]
00A1 - A2pOINTER: nEXT BYTE IN BUFFER 4 [0700]
00A3 - A4pOINTER: nEXT BYTE IN COMMAND BUFFER [0200]
00A5 - A6pOINTER: nEXT BYTE IN ERROR MESSAGE BUFFER [02d6]
00A7 - ADtABLE: nON-ACTIVE CHANNEL NUMBERS FOR EACH BUFFER
00AE - B4tABLE:
00B5 - BAtABLE: rECORD # LOW , BLOCK # LOW
00BB - C0tABLE: rECORD # HIGH, BLOCK # HIGH
00C1 - C6wRITE POINTER FOR rel FILE
;tABLE: NEXT RECORD NUMBERS
00C7 - CCtABLE: rECORD LENGTH FOR rel FILE
00CD - D2tABLE: sIDE SECTORS
00D3?
00D4pOINTER IN RECORD FOR rel FILE
00D5sIDE SECTOR NUMBER
00D6pOINTER TO DATA BLOCK IN SIDE SECTOR
00D7pOINTER TO RECORD IN rel FILE
00D8 - DCdIRECTORY SECTORS
00DD - E1iNDEX: dIRECTORY
00E2 - E6dEFAULT DISK DRIVE [00]
00E7 - EBfILE TYPE (WILD CARDS, @, CLOSED)
00EC - F1fILE TYPE (CHANNEL)
00F2 - F7cHANNEL STATUS
00F8fLAG FOR eoi
00F9cURRENT WORK (bUFFER NUMBER)
00FA - FElAST USED TABLE
00FFfLAG: ff = DRIVE 0 NOT READY (nO DISK), 00 = READY
0100fLAG: ff = DRIVE 1 NOT READY (nO DISK), 00 = READY
0101fORMAT MARKER, DRIVE 0
;dos VERSION (FROM TRACK 18 SECTOR 0)
0102fORMAT MARKER, DRIVE 1
0103nOT USED
0104 - FFsTACK AREA
0146?
01BAbUFFER FOR gcr CODE
0200 - 29 bUFFER FOR COMMAND STRING
022AcOMMAND CODE
;022B - 2DaRRAY: 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
022BlOGICAL INDEX, CHANNEL 0
022ClOGICAL INDEX, CHANNEL 1
022DlOGICAL INDEX, CHANNEL 2
022E - 43lAST READ/WRITTEN BYTE FOR EACH CHANNEL
0244 - 49pOINTER: lAST CHAR ON CHANNEL.
;pOINTS TO THE LAST CHARACTER READ/WRITTEN IN BUFFER.
024AtYPE OF ACTIVE FILE
024BsTRING LENGTH
024CtEMP. CHANNEL NUMBER (SECONDARY ADDRESS)
024DcURRENT WORK WITH DRIVE NUMBER
024EwORK AREA TO FIND THE BEST SECTOR
024F - 50bUFFER ALLOCATED
0251fLAG: bam CHANGED, DRIVE 0
0252fLAG: bam CHANGED, DRIVE 1
0253fLAG FOR DIRECTORY ENTRY FOUND (ff = nOT FOUND, 00 = fOUND)data
0254fLAG FOR DIRECTORY OUTPUT
0255fLAG: wAITING FOR COMMAND
0256?
0257lAST USED BUFFER
0258rECORD LENGTH
0259tRACK OF SIDE SECTOR
025AsECTOR OF SIDE SECTOR
025B - 5FlAST WORK (BUFFERS)
0260 - 65dIRECTORY SECTOR (BUFFERS)
0266 - 6BfILE'S INDEX IN DIRECTORY (BUFFERS)
026CcOUNTER FOR led FLASH
;eRROR mESSAGE
026DeRROR led
026EdRIVE FOR LAST PROGRAM
026FSECTOR FOR LAST PROGRAM
0270wRITE lindx
0271rEAD lindx
0272 - 73nUMBER OF BLOCKS (TEMP)
0274lENGTH OF INPUT LINE
0275cHAR TO INTERPRET
0276iNDEX: eND OF FILENAME IN COMMAND BUFFER
0277?
0278nUMBER OF FILE NAMES
0279?
027A - 7FpOINTER TABLE: fILENAMES
0280 - 84tRACK OF A FILE
0285 - 89sECTOR OF A FILE
028AfLAG: WILD CARDS
028CnUMBER OF DRIVE(S ?) TO LOOK FOR
028DfLAG: lOOKING FOR DRIVE
028EDRIVE WITH LAST WRITE/OPEN ERROR, USED AS DEFAULT DRIVE
028FfLAG: fOUND IN DIRECTORY
0290dIRECTORY SECTOR
0291sECTOR FOR FIRST AVAILABLE FILE
0292iNDEX (IN DIRECTORY) FOR FIRST AVAILABLE FILE
0293fOR THE LAST DIRECTORY ENTRY 0
0294cURRENT BUFFER-INDEX
0295cOUNTER: fILES
0296fLAG: nAME MATCHING WILD CARDS
0297aCTIVE OPERATING MODE (r OR w)
0298fLAG: wORK RETURN
0299pOINTER: rE-READ ERROR
029AtOTAL TRACKS
029B - 9CpOINTER: bam LAST UPDATE
029D - A0bam: IMAGE SECTOR (DRIVES 0 AND 1)
02A1 - B0bam IMAGE
02B1 - D4bUFFER FOR DIRECTORY OUTPUT
02D5 - F8bUFFER FOR ERROR MESSAGE
02F9fLAG: dON'T WRITE bam
;tHIS FLAG IS RESET TO ZERO BEFORE AND AFTER EACH COMMAND
02FA - FBnUMBER OF FREE BLOCKS, LOW BYTE FOR DRIVES 0 JA 1
02FC - FDnUMBER OF FREE BLOCKS, HI BYTE FOR DRIVES 0 JA 1
02FE - FFsTEPPER MOTOR SEQUENCE
0300bUFFER 0
0400bUFFER 1
0500bUFFER 2
0600bUFFER 3
0621 - 22fORMATTING COUNTER
0700bUFFER 4
07FFeND OF ram
lAYOUT OF THE i/o pORTS (via 6522)
==================================
via 1: 6522, PORT FOR SERIAL BUS
-------------------------------
$1800pb, PORT b
$1801pa, PORT a
$1802cb, DATA DIRECTION PORT b
$1803ca, DATA DIRECTION PORT a
$1805tIMER
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
------------------------------------------------------
$1c00pb, CONTROL PORT b
$1c01pa, PORT a (DATA TO AND FROM READ/WRITE HEAD)
$1c02cb, DATA DIRECTION PORT b
$1c03ca, 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:
jobtrack 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 namedescription
80 readrEAD SECTOR
90 writewRITE SECTOR
a0 verifyvERIFY SECTOR
b0 seekfIND SECTOR
c0 bumpbUMP, fIND TRACK 1
d0 jumpeXECUTE PROGRAM IN BUFFER
e0 executeeXECUTE 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:
codemeaningdos error message
01eVERYTHING ok00, ok
02hEADER BLOCK NOT FOUND20, read error
03sync NOT FOUND21, read error
04dATA BLOCK NOT FOUND22, read error
05cHECKSUM ERROR IN DATA BLOCK23, read error
07vERIFY ERROR25, write error
08dISK WRITE PROTECTED26, write protect on
09cHECKSUM ERROR IN HEADER BLOCK27, read error
0biD MISMATCH29, disk id mismatch
0fdISK NOT INSERTED74, drive not ready
eRROR CODES 06 AND 0a DO NOT OCCUR ON THE 1541.