2016.12.10
前へ
次へ
ホームページトップへ戻る

マイコン独立大作戦
SDカードインターフェースの製作

〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
WindowsパソコンにUSB接続して使う現行方式はそれなりに便利ではありますが、ときとしてWindows
のしがらみから開放されて、小さいながらも独立した一個のパソコンとして機能したいと思うこともあります。
独立大作戦の作戦その1はCRTインターフェースボードの製作です。
作戦その2はキーボードインターフェースです。
そして作戦その3は、SDカードインターフェースです。
〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜

[第30回]


●FAT32システム(2) ファイルシステム情報セクタとBPBのバックアップセクタ

前回のBPB(Bios Parameter Block)の解析のなかで、ファイルシステム情報セクタの番号が0001になっているのですが、確認したところセクタbPではなくてセクタbQ001にありました、と書きました。
また同様に、BPBのバックアップセクタの番号が0006になっているのですが、確認したところセクタbUではなくてセクタbQ006にありました、と書きました。
今回は参考までにその確認を行なっているログを示します。
セクタの読み込みは前回までのプログラムをそのまま使います。
先頭に初期化の部分が表示されますが、その部分は冗長なのでログのその部分はカットして示します。

まずは念のためにセクタbPを読んでみました。

logfile nd80zlog\12072244.txt open

ND80ZVに接続しました
0001 0000 - z
1000 00C3 - 
*** nd80z3 basic ****
ndwr2h.bin loaded,from E23F to E535
>cm 8103
8103 00-
8104 00-
8105 20-00
8106 00-01
8107 00-
>jp 8100

[00000001]
8800  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8810  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8820  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8830  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8840  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8850  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8860  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8870  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8880  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8890  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8900  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8910  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8920  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8930  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8940  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8950  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8960  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8970  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8980  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8990  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................

セクタbPには何も書かれていません。

次に念のためにセクタbUを読んでみました。

>cm 8103
8103 00-
8104 00-
8105 00-
8106 01-06
8107 00-
>jp 8100

[00000006]
8800  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8810  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8820  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8830  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8840  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8850  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8860  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8870  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8880  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8890  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8900  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8910  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8920  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8930  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8940  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8950  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8960  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8970  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8980  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8990  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................

セクタbUにも何も書かれていません。

今度はセクタbQ001を読んでみました。

>cm 8103
8103 00-
8104 00-
8105 00-20
8106 06-01
8107 00-
>jp 8100

[00002001]
8800  52 52 61 41 00 00 00 00-00 00 00 00 00 00 00 00  RRaA............
8810  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8820  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8830  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8840  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8850  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8860  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8870  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8880  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8890  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88E0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
88F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8900  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8910  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8920  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8930  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8940  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8950  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8960  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8970  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8980  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8990  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89A0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89B0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89C0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89D0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89E0  00 00 00 00 72 72 41 61-3B B4 03 00 07 00 00 00  ....rrAa;エ......
89F0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 55 AA  ..............Uェ

ファイルシステム情報セクタの先頭4バイト(000〜003)には識別情報として52 52 61 41が書かれることになっています。
確かにそのようになっています。
また01E4〜01E7には同じく識別情報として72 72 41 61が書かれることになっています。
ここもそのようになっています。
そして最後の2バイトには識別情報の55 AAが書かれています。
思った通りファイルシステム情報セクタはセクタbQ001にありました。

今度はセクタbQ006を読んでみました。

>cm 8103
8103 00-
8104 00-
8105 20-
8106 01-06
8107 00-
>jp 8100

[00002006]
8800  EB 58 90 4D 53 44 4F 53-35 2E 30 00 02 40 2E 11  .X.MSDOS5.0..@..
8810  02 00 00 00 00 F8 00 00-3F 00 FF 00 00 20 00 00  ........?.... ..
8820  00 30 ED 00 69 07 00 00-00 00 00 00 02 00 00 00  .0..i...........
8830  01 00 06 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8840  80 00 29 C1 50 73 6E 4E-4F 20 4E 41 4D 45 20 20  ..)チPsnNO NAME  
8850  20 20 46 41 54 33 32 20-20 20 33 C9 8E D1 BC F4    FAT32   3ノ.ムシ.
8860  7B 8E C1 8E D9 BD 00 7C-88 4E 02 8A 56 40 B4 41  {.チ.ルス.|.N..V@エA
8870  BB AA 55 CD 13 72 10 81-FB 55 AA 75 0A F6 C1 01  サェUヘ.r...Uェu..チ.
8880  74 05 FE 46 02 EB 2D 8A-56 40 B4 08 CD 13 73 05  t..F..-.V@エ.ヘ.s.
8890  B9 FF FF 8A F1 66 0F B6-C6 40 66 0F B6 D1 80 E2  ケ....f.カニ@f.カム..
88A0  3F F7 E2 86 CD C0 ED 06-41 66 0F B7 C9 66 F7 E1  ?...ヘタ..Af.キノf..
88B0  66 89 46 F8 83 7E 16 00-75 38 83 7E 2A 00 77 32  f.F..~..u8.~*.w2
88C0  66 8B 46 1C 66 83 C0 0C-BB 00 80 B9 01 00 E8 2B  f.F.f.タ.サ..ケ...+
88D0  00 E9 2C 03 A0 FA 7D B4-7D 8B F0 AC 84 C0 74 17  ..,..}エ}..ャ.タt.
88E0  3C FF 74 09 B4 0E BB 07-00 CD 10 EB EE A0 FB 7D  <.t.エ.サ..ヘ....}
88F0  EB E5 A0 F9 7D EB E0 98-CD 16 CD 19 66 60 80 7E  ...}...ヘ.ヘ.f`.~
8900  02 00 0F 84 20 00 66 6A-00 66 50 06 53 66 68 10  .... .fj.fP.Sfh.
8910  00 01 00 B4 42 8A 56 40-8B F4 CD 13 66 58 66 58  ...エB.V@..ヘ.fXfX
8920  66 58 66 58 EB 33 66 3B-46 F8 72 03 F9 EB 2A 66  fXfX.3f;F.r...*f
8930  33 D2 66 0F B7 4E 18 66-F7 F1 FE C2 8A CA 66 8B  3メf.キN.f...ツ.ハf.
8940  D0 66 C1 EA 10 F7 76 1A-86 D6 8A 56 40 8A E8 C0  ミfチ...v..ヨ.V@..タ
8950  E4 06 0A CC B8 01 02 CD-13 66 61 0F 82 75 FF 81  ...フク..ヘ.fa..u..
8960  C3 00 02 66 40 49 75 94-C3 42 4F 4F 54 4D 47 52  テ..f@Iu.テBOOTMGR
8970  20 20 20 20 00 00 00 00-00 00 00 00 00 00 00 00      ............
8980  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
8990  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
89A0  00 00 00 00 00 00 00 00-00 00 00 00 0D 0A 52 65  ..............Re
89B0  6D 6F 76 65 20 64 69 73-6B 73 20 6F 72 20 6F 74  move disks or ot
89C0  68 65 72 20 6D 65 64 69-61 2E FF 0D 0A 44 69 73  her media....Dis
89D0  6B 20 65 72 72 6F 72 FF-0D 0A 50 72 65 73 73 20  k error...Press 
89E0  61 6E 79 20 6B 65 79 20-74 6F 20 72 65 73 74 61  any key to resta
89F0  72 74 0D 0A 00 00 00 00-00 AC CB D8 00 00 55 AA  rt.......ャヒリ..Uェ

おお。
思った通りBPBのバックアップセクタはセクタbQ006にありました。

SDカードインターフェースの製作[第30回]
2016.12.10upload

前へ
次へ
ホームページトップへ戻る