[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 4-4 Format for GCR Question



Bryan Parkoff <BParkoff@satx.rr.com> wrote:

> 4-4 Format for GCR Question
> 
>     I know how to use ASL and AND opcode to put two bytes into one byte.
> 
> For example:
> 
> c0 c1 c1 c0
> c1 c1 c1 c0
> 
> With ASL
> 
> 0c 1c 1c 0c
> c1 c1 c1 c0
>
> With AND
> 
> 01111100

Presumably each 'c' is a clock bit, i.e. a 1.

Your method (and example) is wrong.  After the ASL, the first byte in
your example will be '0c1c1c00' (note that the low order bit is zero),
because the ASL always shifts a zero into the low order bit.  In order
to get the correct value, you must use SEC then ROL instead of ASL.

>     It is how I can see above.  My question is -- How can I add '1' to each
> bit before one byte can become two bytes?  Which instruction (opcode) do I
> use?  Please advise.

I don't quite understand the question.  Are you asking how to split a
single byte into two bytes for writing as 4-and-4 encoding?

Assuming the bytes are written such that the odd numbered data bits are
in the first disk byte (I'd have to look up Beneath Apple DOS to
confirm):

1. Save a copy of the original data byte (e.g. PHA).
2. For the first disk byte, do LSR then ORA #$AA.
3. Restore the original data byte (e.g. PLA).
4. For the second disk byte, do ORA #$AA.

-- 
David Empson
dempson@actrix.gen.nz