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

Re: help decoding address fields



Hi Jonno,

You have two 4-4 nibbles (nib1 and nib2) and you want to calculate the
original byte (volume# or track# or sector#)

Apply the following code:

SEC
LDA nib1
ROL
AND nib2

STA my_byte



E.g. sector: nib1 = $AF, nib2 = $AF

nib1 = 10101111
SEC+ROL => 01011111
01011111 AND 10101111 = 00001111 => sector $0F


E.g. volume: nib1 = $FF, nib2 = $FE

nib1 = 11111111
SEC+ROL => 11111111
11111111 AND 11111110 = 11111110 => volume 254




I always have a mapping table near me when I use nibble editors.

Mapping sector/4-4 nibbles:

Sector  4-4
$00     AA AA
$01     AA AB
$02     AB AA
$03     AB AB
$04     AA AE
$05     AA AF
$06     AB AE
$07     AB AF
$08     AE AA
$09     AE AB
$0A     AF AA
$0B     AF AB
$0C     AE AE
$0D     AE AF
$0E     AF AE
$0F     AF AF

Take care,
JM