Anyone out there know the details of nibblizing for the very early Apple 5x3 GCR? There's a description in "Beneath Apple Dos" (BAD) but it is rather weak, and not very precise. I'm looking for the details of the nibblizing process that separate the bits from the target 256 bytes into the 410 "bytes" that will then be mapped to GCR5x3. The BAD (no pun intended) description of the process indicates that the 256-byte source data is split into 5 sections 0 - 51 - section "A" bytes (52 total bytes) 52 - 102 - section "B" bytes (51) 103 - 153 - section "C" bytes (51) 154 - 204 - section "D" bytes (51) 205 - 256 - section "E" bytes (52) This is taken from the diagram on 3-16 of BAD. Note that there appears to be one extra byte in this range according to the diagram. One guess is that this is off by one in the E section, changing it to: 205 - 255 - section "E" bytes (51) However, if this is the case, there are too many bytes in the A section such that the "secondary" buffer wouldn't balance when constructing the bytes made up of 3 A bits, and one bit from the D's and E's. Another guess is that the size of the sections are all 51 bytes, with one byte left over. This would make everything balance well. EXCEPT that there is still one byte left over (original byte 255) that would have to be nibblized and stashed somewhere in the secondary buffer in 2 nibblized bytes. Anyone know anything about this? The 6x2 description in BAD was pretty poor and not terribly accurate either. In the second addition of BAD, BAPD, 6x2 is described correctly, but 5x3 is not covered. Thanks, Eric Eric J. Rothfus wrote: > Anyone out there know the details of nibblizing > for the very early Apple 5x3 GCR? There's > a description in "Beneath Apple Dos" (BAD) but it is > rather weak, and not very precise. Googled around a bit and here's what I found: http://alfter.us/aal.shtml Look down until you find: AAL.8105.BXY This issue contains articles on a hi-res SCRN function for Applesoft, conquering paddle jitter, a shift-key modification, the 6502 programming model and a commented listing of DOS 3.2.1 from $B800 through $BCFF. Get the file DOS321.B800BCFF. It has the code of interest, and more. To make it easy, here is just the code that does what you want: 1000 * .LIF 1010 *--------------------------------- 1020 * DOS 3.2.1 $B800 - $BCFF 1030 *--------------------------------- 1040 .OR $B800 1050 .TA $0800 1060 *--------------------------------- 1070 BUF.PNTR .EQ $3E,3F 1080 CURRENT.TRACK .EQ $0478 1090 *--------------------------------- 1100 * DISK CONTROLLER ADDRESSES 1110 *--------------------------------- 1120 PHOFF .EQ $C080 PHASE-OFF 1130 PHON .EQ $C081 PHASE-ON 1140 MTROFF .EQ $C088 MOTOR OFF 1150 MTRON .EQ $C089 MOTOR ON 1160 DRV0EN .EQ $C08A DRIVE 0 ENABLE 1170 DRV1EN .EQ $C08B DRIVE 1 ENABLE 1180 Q6L .EQ $C08C SET Q6 LOW 1190 Q6H .EQ $C08D SET Q6 HIGH 1200 Q7L .EQ $C08E SET Q7 LOW 1210 Q7H .EQ $C08F SET Q7 HIGH 1220 * 1230 * Q6 Q7 USE OF Q6 AND Q7 LINES 1240 * ---- ---- ---------------------- 1250 * LOW LOW READ (DISK TO SHIFT REGISTER) 1260 * LOW HIGH WRITE (SHIFT REGISTER TO DISK) 1270 * HIGH LOW SENSE WRITE PROTECT 1280 * HIGH HIGH LOAD SHIFT REGISTER FROM DATA BUS 1290 .PG 1300 *--------------------------------- 1310 * CONVERT 256 BYTES TO 410 5-BIT NYBBLES 1320 *--------------------------------- 1330 PRE.NYBBLE 1340 LDX #50 51 BYTES PER SECTION 1350 LDY #0 INDEX INTO 256-BYTE BUFFER 1360 *---BUFFER PART 1, SECTION 1----- 1370 .1 LDA (BUF.PNTR),Y GET BYTE FROM BUFFER 1380 STA $26 SAVE HERE FOR LOWER 3 BITS 1390 LSR USE TOP 5 BITS 1400 LSR 1410 LSR 1420 STA RWTS.BUFFER.1.1,X 1430 *---BUFFER PART 1, SECTION 2----- 1440 INY NEXT REAL BYTE 1450 LDA (BUF.PNTR),Y GET BYTE FROM BUFFER 1460 STA $27 SAVE HERE FOR LOWER 3 BITS 1470 LSR USE TOP 5 BITS 1480 LSR 1490 LSR 1500 STA RWTS.BUFFER.1.2,X 1510 *---BUFFER PART 1, SECTION 3----- 1520 INY NEXT REAL BYTE 1530 LDA (BUF.PNTR),Y GET BYTE FROM BUFFER 1540 STA $2A SAVE FOR LOWER 3 BITS 1550 LSR 1560 LSR USE TOP 5 BITS 1570 LSR 1580 STA RWTS.BUFFER.1.3,X 1590 *---BUFFER PART 1, SECTION 4----- 1600 INY NEXT REAL BYTE 1610 LDA (BUF.PNTR),Y GET BYTE FROM BUFFER 1620 LSR USE TOP 5 BITS 1630 ROL $2A BIT 0 INTO $2A 1640 LSR 1650 ROL $27 BIT 1 INTO $27 1660 LSR 1670 ROL $26 BIT 2 INTO $26 1680 STA RWTS.BUFFER.1.4,X 1690 *---BUFFER PART 1, SECTION 5----- 1700 INY NEXT REAL BYTE 1710 LDA (BUF.PNTR),Y GET BYTE FROM BUFFER 1720 LSR USE TOP 5 BITS 1730 ROL $2A BIT 0 INTO $2A 1740 LSR 1750 ROL $27 BIT 1 INTO $27 1760 LSR HOLD BIT 2 IN CARRY-BIT 1770 STA RWTS.BUFFER.1.5,X 1780 *---BUFFER PART 2, SECTION 0----- 1790 LDA $26 APPEND BIT 2 TO $26 1800 ROL 1810 AND #$1F 5-BIT MASK 1820 STA RWTS.BUFFER.2.1,X 1830 *---BUFFER PART 2, SECTION 1----- 1840 LDA $27 1850 AND #$1F 1860 STA RWTS.BUFFER.2.2,X 1870 *---BUFFER PART 2, SECTION 2----- 1880 LDA $2A 1890 AND #$1F 1900 STA RWTS.BUFFER.2.3,X 1910 *--------------------------------- 1920 INY NEXT REAL BYTE 1930 DEX NEXT BYTE IN EACH SECTION 1940 BPL .1 LOOP UNTIL EACH SECTION FULL 1950 *--------------------------------- 1960 LDA (BUF.PNTR),Y GET LAST REAL BYTE 1970 TAX 1980 AND #7 USE LOWER 3 BITS 1990 STA RWTS.BUFFER.2.4 2000 TXA NOW GET 5 UPPER BITS 2010 LSR 2020 LSR 2030 LSR 2040 STA RWTS.BUFFER.1.6 2050 RTS