- } else {
- my $v = unpack('v',(substr($card, 0x10 + ( $i * 2 ), 2)));
+
+ # MAD
+ $ADV = $GBP & 0b00000011;
+ $MA = $GBP & 0b01000000;
+ $DA = $GBP & 0b10000000;
+ printf "ADV (MAD version code): %d %s\n", $ADV;
+ printf "MA (multiapplication): %s\n", $MA ? 'yes' : 'monoaplication';
+ printf "DA (MAD available): %s%s\n", $DA ? 'yes' : 'no',
+ substr($card,$pos+0x30,6) eq "\xA0\xA1\xA2\xA3\xA4\xA5" ? ' public' : '';
+
+ printf "Info byte (publisher sector): %x\n", ord(substr($card,0x11,1));
+ } elsif ( $DA ) {
+ my $mad_offset = 0x10 + ( $sector * 2 );
+ my $v = unpack('v',(substr($card, $mad_offset, 2)));