home *** CD-ROM | disk | FTP | other *** search
-
- APPLE II DISK SOFT SECTORING - January 25, 1981
- by Gary Morris
- further editing by Bill Blue
-
-
- DISKETTE NIBBLIZING
-
- Data stored on a diskette is encoded into nibbles. There
- are 128 possible nibbles (because bit 7 must always be a 1),
- however some are reserved for markers and sync. When encoding
- data, the 256-8 bit bytes are split up into 342-6 bit nibbles.
-
- When writing nibbles it takes 32 microseconds to shift out
- the 8 bits, plus one extra shift produces the trailing zero.
-
- A nibble is read from the shift register by waiting until
- the byte in the shift register is negative (bit 7 is 1).
- This signals that the nibble is fully shifted in. The shift
- register is zeroed before the shift is started, and all
- nibbles have a 1 in bit 7 so it is easy to tell when the shift
- is complete. One bit is shifted every 4 microseconds, so it
- takes 32 microseconds to fill the shift register plus an extra
- 4 for the 0 after the nibble, for a total time of 36 micro-
- seconds.
-
- SELF SYNC
-
- The self sync feature allows the software to search the data
- coming from the disk entering at any point. The program looks
- until it finds the sync field. Then it locks on and steps
- into the true data and address information. The bit pattern
- is then read in the proper sequence. Zeroes act as a frame
- for the 8 bit sync byte. See the diagram at the end of this
- article.
-
- The following dump is of actual nibbles that were stored on
- a diskette. It is from a 16 sector disk. The actual data
- contents of the sector was 256 bytes of 0's.
-
- *1328.14AF
-
- 1328- FF FF FF FF FF FF FF FF
- 1330- FF FF FF D5 AA 96 AA AB
- 1338- AB BA AA AB AB BA DE AA
- 1340- E9 83 FE FF FC FF FF FF
- 1348- FF D5AA AD 96 96 96 96
- 1350- 96 96 96 96 96 96 96 96
- 1358- 96 96 96 96 96 96 96 96
- 1360- 96 96 96 same....
- 14A0- 96 96 96 DE AA EB EE FF
- 14A8- FF FF FF FF FF FF FF FF
-
-
- SOFT SECTOR FORMAT
-
- -------------
- | SYNC | all $FF's
- |-----------|
- | ADDRESS | $D5,$AA,$96
- | MARKERS |
- |-----------|
- | ADDRESS | 4 pairs of nibbles, vol,
- | FIELD | track, sector, checksum
- |-----------|
- | TRAIL MARK| $DE,$AA,$EB
- |-----------|
- | | inter-record gap,
- | | contains sync nibbles.
- |-----------|
- | SYNC | all $FF's
- |-----------|
- | DATA MARK | $D5,$AA,$AD
- | |
- |-----------|
- | DATA |
- | FIELD | actual data nibbles
- | |
- |342 NIBBLES|
- | 256 BYTES |
- | |
- | |
- |-----------| checksum of data,
- | CHECKSUM | EOR of all data nibbles
- |-----------|
- |TRAIL MARK | $DE,$AA,$EB
- |-----------|
- | | inter-record gap,
- | | leading to next sector
- 'vvvvvvvvvvv'
-
- SELF-SYNC DIAGRAM
-
- bit
- stream -->
-
- 0111111110111111110111111110111111110111111110111111110111111110
- ||||
- ^ FB FD FE ^ FF FF FF FF
- ^ ^
-
- (1) (2)
-
- Notes:
-
- (1) Coincidental entry point with state-machine reading data.
-
- (2) Found sync, 8 bit bytes all ones tells software that data
- is properly framed to sync into data field.
-
- ------------------------------------------------
-
-
- APPLE DISK CONTROLLER PROM'S - January 25, 1981
- written by Gary Morris
- further editing by Bill Blue
-
-
- (1) Standard PROM configuration
-
- The two PROMs on the Apple Disk Controller are refered to as
- PROM P5 and P6. These PROMs (Programmable Read Only Memory)
- have 256 - 8 bit bytes. In the standard Apple (is there
- really such a thing?) they are the original PROMs designed
- when the controller card was and at that time called P5 and
- P6. When Pascal was released two new PROMs came with the
- package, known as PROM P5A and P6A. These allowed users to
- use the Pascal system diskettes which were 16 sectors per
- track instead of the old 13 sectors per track standard. Then
- recently DOS 3.3 became available which also came with PROM
- P5A and P6A, allowing 16 sector density for use with Basic and
- turnkey capability (under DOS 3.3 with Basic) for language
- card users.
-
- (2) What's on those PROMs?
-
- The purposes of the two PROMs are completely separate. PROM
- P5 (or P5A) is mapped into the Apple at the 256 byte area for
- the slot the controller is in. In slot 6 that would be from
- $C600-$C6FF. The actual contents is a 6502 machine language
- program that is the first step in the sequence to start the
- drive and load DOS into RAM memory (known as booting). Once
- the boot is complete this code is not used unless you reboot.
-
- The P6 (or P6A) is not accessible by the 6502 processor.
- It's purpose is that of a state machine controller. In re-
- sponse to commands from the 6502 address bus decoders (they
- determine when a specific address is on the bus) it performs
- actions on the disk drive hardware, such as turning on the
- motor, controlling the shift register, and other things. It
- is used every time anything is done with the disk hardware,
- every time you access a disk file.
-
- (3) Differences between P5, P6 and P5A, P6A
-
- The P5 PROM contains a machine language program that boots
- a 13 sector diskette. It starts the drive, reads nibbles and
- can decode the nibbles to find the correct address and data
- field markers for a 13 sector diskette.
-
- The P6 PROM is the logic table for the state machine. With
- this PROM in place you can access 13 sector diskettes re-
- liably. 16 sector diskettes can be accessed but it is unre-
- liable and occasionally a read cannot be done at all.
-
- The P5A PROM contains the code necessary to boot a 16 sector
- diskette. It operates much the same as the P5 except the
- nibble decoding is different, and the third address field
- nibble is changed from a $B5 to a $96.
-
- The P6A PROM is the logic table for an improved state
- machine. With this PROM the hardware has the capability of
- accessing either 13 or 16 sector density reliably.
-
- (4) Mixing up PROMs
-
- What can we do with this new knowledge? Let me explain the
- configuration of controller cards on my Apple and why it's
- best for me. I have 3 drives, two in slot 6 and one in slot 5.
- I have a language card so I want 16 sector density. PASCAL is
- nice to work with with three drives so I need 16 sector den-
- sity on all three drives. However, I have some diskettes that
- have protected software that will only boot on a 13 sector
- controller card.
-
- To be able to have the best of both worlds, I have put PROMs
- P5A and P6A on the controller in slot 6 and PROMs P5 and P6A
- in slot 5. In slot 5 I have the P5 with the boot code to read
- a 13 sector diskette, and the P6A to work with either a 13 or
- 16 sector density. This gives me the capability to boot those
- protected disks by doing a PR#5. In slot 6 I have P5A and P6A
- so it boots 16 sector density and can access either 16 or 13.
- When running Pascal or DOS 3.3 I can use the drive in slot 5
- with no errors caused by the P6. If you try to use the P6 on
- 16 sector density it will read slower because of the number of
- retries necessary to get a correct read (try a bad block scan
- of a 16 sector disk on a controller with a P6 and then try it
- with a P6A)
-
- ------------------------------------------------
- Ö≡