Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2 > #26738
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | awanderin <awanderin@gmail.com> |
| Newsgroups | comp.sys.apple2 |
| Subject | Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS |
| Date | Wed, 13 Jan 2016 23:12:42 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 185 |
| Message-ID | <m337u0bsf9.fsf@gmail.com> (permalink) |
| References | <9e054763-c065-493a-8b57-1bc7abe93cd7@googlegroups.com> <8fa4554d-e86b-4f60-8282-39960a6834bd@googlegroups.com> <fa355c8c-64c2-4639-8beb-47ae827127d3@googlegroups.com> <m37fjgbqqd.fsf@gmail.com> <3a8b9739-0f8a-497e-8168-cc93b6d84956@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="3f7daab8c080c0d7ccea7a857596d713"; logging-data="5506"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/zysE26Q73TCkTRWDSySxaruW8N2hudnA=" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:YSTqu3K66T6FgEx2Pj3fiskrz7s= sha1:zHSc27VPgXsUl2uFQo8vstVzAE4= |
| Xref | csiph.com comp.sys.apple2:26738 |
Show key headers only | View raw
Frank Schnorbus <fandr76@aol.com> writes:
[...quoting snipped...]
>
> Thanks Jerry. Yes, I do have Beneath Apple DOS, but while it describes
> the bit stuffing in great detail, it gets very hazy on how the
> now-rearranged bytes get stacked into memory, and then in what order
> they get called up to be exclusive or'ed and written to disk. AAL
> (Apple Assembly Line) had some good articles, as does hackzapple.org,
> but again, the order they get written to disk is very unclear. The
> best that I could find is a May 25, 1978 Disc-II 13-Sector Format Read
> and Write Subroutines by Woz and R. Wigginton
> (https://s3.amazonaws.com/s3data.computerhistory.org/atchm/documents/Apple_DOS_RW_30May1978.txt)
> where the comments say "First, NBUF6 to NBUF8, high to low, then,
> NBUF1 to NBUF5, low to high". That, combined with other docs I found,
> make me think I have it right, but I'm looking for outside
> confirmation.
>
> I have been quite surprised that I haven't found an In and Out listing
> for DOS 3.2 somewhere. At least in the Beneath Apple ProDOS, in
> Appendix C, there was a listing that I could use to confirm my ProDOS
> spreadsheet. I'm hoping someone out there has one for DOS 3.2, or can
> run one using the programs (such as fadden's), or can tell me how to
> run the program so I can do it myself.
>
Here's some Python code with comments that describes how to map bytes
into 5&3 "5-bit" nibbles, and the reverse.
Hopefully this sheds some more light on the situation.
The text between the lines with three quotes """ are comments.
def preNib53(inbuf):
"""
Map 256 8-bit bytes to 410 5-bit nibbles.
Output is 410 bytes in range 0..31.
Input Output (bits 4:0)
0.7:3 50 0x32 0.7:3
5.7:3 49 0x31 5.7:3
...
250.7:3 0 0x00 250.7:3
1.7:3 101 0x65 1.7:3
6.7:3 100 0x64 6.7:3
...
251.7:3 51 0x33 251.7:3
2.7:3 152 0x98 2.7:3
7.7:3 151 0x97 7.7:3
...
252.7:3 102 0x66 252.7:3
3.7:3 203 0xcb 3.7:3
8.7:3 202 0xca 8.7:3
...
253.7:3 153 0x99 253.7:3
4.7:3 254 0xfe 4.7:3
9.7:3 253 0xfd 9.7:3
...
254.7:3 204 0xcc 254.7:3
306 0x132 0.2:0, 3.2, 4.2
305 0x131 5.2:0, 8.2, 9.2
...
256 0x100 250.2:0, 253.2, 254.2
357 0x165 1.2:0, 3.1, 4.1
356 0x164 6.2:0, 8.1, 9.1
...
307 0x133 251.2:0, 253.1, 254.1
408 0x198 2.2:0, 3.0, 4.0
407 0x197 7.2:0, 8.0, 9.0
...
358 0x166 252.2:0, 253.0, 254.0
255.7:3 255 0xff 255.7:3
255.2:0 409 0x199 255.2:0
"""
INCR = 0x33 # 51
y = 0
out = bytearray(410)
for x in range(INCR - 1, -1, -1):
t1 = inbuf[y]
out[x] = t1 >> 3
y += 1
t2 = inbuf[y]
out[INCR + x] = t2 >> 3
y += 1
t3 = inbuf[y]
out[INCR * 2 + x] = t3 >> 3
y += 1
a = inbuf[y]
out[INCR * 3 + x] = a >> 3
t3 = (t3 << 1) | (a & 1)
t2 = (t2 << 1) | ((a & 2) >> 1)
t1 = (t1 << 1) | ((a & 4) >> 2)
y += 1
a = inbuf[y]
out[INCR * 4 + x] = a >> 3
t3 = (t3 << 1) | (a & 1)
t2 = (t2 << 1) | ((a & 2) >> 1)
t1 = (t1 << 1) | ((a & 4) >> 2)
out[0x100 + x] = t1 & 0x1f
out[0x100 + INCR + x] = t2 & 0x1f
out[0x100 + INCR * 2 + x] = t3 & 0x1f
y += 1
a = inbuf[y]
out[0x100 + INCR * 3] = a & 0x07
out[0xff] = a >> 3
return out
def postNib53(buf):
"""
Reverse the above transformation, with the caveat that input
nibbles have data in bits 7..3; bits 2..0 are clear. This is
because of the way the disk-nibble values are converted.
Input bytes.bits Output bytes
50.4:0, 306.4:2 0
101.4:0, 357.4:2 1
152.4:0, 408.4:2 2
203.4:0, 306.1, 357.1, 408.1 3
254.4:0, 306.0, 357.0, 408.0 4
49.4:0, 305.4:2 5
100.4:0, 356.4:2 6
151.4:0, 407.4:2 7
202.4:0, 305.1, 356.1, 407.1 8
253.4:0, 305.0, 356.0, 407.0 9
...
0.4:0, 256.4:2 250
51.4:0, 307.4:2 251
102.4:0, 358.4:2 252
153.4:0, 256.1, 307.1, 358.1 253
204.4:0, 256.0, 307.0, 358.0 254
255.4:0, 409.2:0 255
"""
out = bytearray(256)
y = 0
x = 0x32
while x >= 0:
a = buf[0x100 + x]
t2 = a >> 3
t1 = a >> 4
out[y] = buf[x] | (a >> 5)
y += 1
a = buf[0x133 + x]
t2 = (t2 << 1) | ((a >> 3) & 1)
t1 = (t1 << 1) | ((a >> 4) & 1)
out[y] = buf[0x33 + x] | (a >> 5)
y += 1
a = buf[0x166 + x]
t2 = (t2 << 1) | ((a >> 3) & 1)
t1 = (t1 << 1) | ((a >> 4) & 1)
out[y] = buf[0x66 + x] | (a >> 5)
y += 1
out[y] = buf[0x99 + x] | (t1 & 0x7)
y += 1
out[y] = buf[0xcc + x] | (t2 & 0x7)
y += 1
x -= 1
out[y] = (buf[0x199] >> 3) | buf[0xff]
return out
--
Jerry awanderin at gmail dot com
Back to comp.sys.apple2 | Previous | Next — Previous in thread | Next in thread | Find similar
DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-09 21:24 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS fadden <thefadden@gmail.com> - 2016-01-09 21:58 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-10 10:15 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS awanderin <awanderin@gmail.com> - 2016-01-10 23:00 -0700
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-10 23:56 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS awanderin <awanderin@gmail.com> - 2016-01-13 23:12 -0700
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-15 23:21 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-16 00:02 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS awanderin <awanderin@gmail.com> - 2016-01-17 00:00 -0700
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS ultramagnus_tcv <mikew@thecomputervalet.com> - 2016-01-17 09:55 -0600
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS awanderin <awanderin@gmail.com> - 2016-01-17 23:29 -0700
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-18 07:08 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS ultramagnus_tcv <mikew@thecomputervalet.com> - 2016-01-18 10:56 -0600
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-19 01:13 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS awanderin <awanderin@gmail.com> - 2016-01-19 22:58 -0700
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-18 07:05 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS fadden <thefadden@gmail.com> - 2016-01-11 09:30 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS D Finnigan <dog_cow@macgui.com> - 2016-01-11 19:34 +0000
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS scott@alfter.diespammersdie.us (Scott Alfter) - 2016-01-11 21:18 +0000
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-11 21:33 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS gids.rs@sasktel.net - 2016-01-12 09:30 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-13 20:48 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS ultramagnus_tcv <mikew@thecomputervalet.com> - 2016-01-14 16:36 -0600
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Denis Molony <denisbytezone@gmail.com> - 2016-01-15 20:09 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS "Michael 'AppleWin Debugger Dev'" <michael.pohoreski@gmail.com> - 2016-01-18 10:06 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Denis Molony <denisbytezone@gmail.com> - 2016-01-18 11:14 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS "Michael 'AppleWin Debugger Dev'" <michael.pohoreski@gmail.com> - 2016-01-19 23:09 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-15 23:29 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS ultramagnus_tcv <mikew@thecomputervalet.com> - 2016-01-16 14:15 -0600
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Raymond Wiker <rwiker@gmail.com> - 2016-01-12 21:47 +0100
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS "Michael 'AppleWin Debugger Dev'" <michael.pohoreski@gmail.com> - 2016-01-10 07:56 -0800
Re: DOS 3.2, 3.3 and ProDOS GCR in RWTS Frank Schnorbus <fandr76@aol.com> - 2016-01-10 10:22 -0800
csiph-web