logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

[AVR][Bascom] Dwie funkcje Drivecheck i Gbfilesystem

pier 05 Sty 2011 19:00 1556 4
REKLAMA
  • #1 8962246
    pier
    Poziom 24  
    Witam
    Koledzy możecie mi wytłumaczyć dlaczego bascomowa funkcja dotyczaca karty SD, Drivecheck daje zawsze w odpowiedzi 0 czyli brak błędów, nawet jeśli karta jest niepodłączona?
    I dlaczego taki zapis:
    
    If Gbfilesystem = 1 Then System = "FAT32" Else System = "FAT16"
    

    daje zawsze odpowiedź że system karty to FAT16 nawet jeśli jest to FAT32?

    Nie jest mi to niezbędne ale nie daje mi to spokoju.
    Czy jest może tak że działa to tylko z kartami CF?

    Dodam że odczyt karty i cała reszta programu działają bez zarzutu.
  • REKLAMA
  • #2 8963787
    piotrva
    VIP Zasłużony dla elektroda
    Nie testowałem tego z kartami cf, ale z tego co wiem to do ich obsługi pierwotnie była ta biblioteka, więc pewnie sd ma takie niedoróbki, bo u mnie efekt taki sam. A problemy z kartą rozpoznaję z funkcji Initfilesystem()
  • REKLAMA
  • #3 8964524
    elektrofil
    Poziom 17  
    jak to pomoże myśleć to wklejam kawałek kodu DOS'a:
    
    CheckFileSystemType:
    clt ; FAT16 Flag
    cpi r24, &H04 ; FAT16 <= 32 MB
    breq _CheckFileSystemType8
    cpi r24, &H06 ; FAT16 >= 32MB
    breq _CheckFileSystemType8
    cpi r24, $H0E ; FAT16 with Bios Extension
    breq _CheckFileSystemType8
    set ; FAT32 Flag
    cpi r24, &H0B ; FAT32 End of partition below 8GN
    breq _CheckFileSystemType8
    cpi r24, &H0C ; FAT32 End of partition over 8GB
    breq _CheckFileSystemType8
    * ldi r25 , cpFileSystemNotSupported ; no supported file system found
    rjmp _SetDOSError
    _CheckFileSystemType8:
    lds r0, {gbFileSystemStatus} ; store FAT16/32 Flag to gbFileSystemStatus
    * bld r0, dFileSystemStatusFAT
    sts {gbFileSystemStatus}, r0
    clc
    ret
    
  • REKLAMA
  • #4 8964896
    pier
    Poziom 24  
    Czyli rozumiem że Kolega wie dlaczego jest tak z rozpoznawaniem systemu?

    Ale mi nie pomaga ten kawałek kodu w zrozumieniu tego.
    Można by było jaśniej?
  • #5 8967909
    elektrofil
    Poziom 17  
    Dos odczytuje MBR i bierze info z tablicy partycji a dokładnie z pierwszego slotu(są 4-ry) który jest aktywny (w adresie $00 ma wartość $80 (ustawiony bit nr.7))

    W bajcie o adresie $04 w tym slocie jest typ strefy:
    
    Bajt#	Rodzaj strefy
    00h 	empty
    01h 	DOS 12-bit FAT
    02h 	XENIX root file system
    03h 	XENIX /usr file system (obsolete)
    04h 	DOS 16-bit FAT (up to 32M)
    05h 	DOS 3.3+ extended partition
    06h 	DOS 3.31+ Large File System (16-bit FAT, over 32M)
    07h 	QNX, OS/2 HPFS, Windows NT NTFS or Advanced Unix
    08h 	AIX bootable partition, SplitDrive, OS/2 (v1.0-1.3), Commodore DOS or DELL partition spanning multiple drives
    09h 	AIX data partition or Coherent filesystem
    0Ah 	OS/2 Boot Manager, OPUS, Coherent swap partition or Partition Magic
    0Bh 	Windows 95 with 32-bit FAT
    0Ch 	Windows 95 with 32-bit FAT (using LBA-mode INT 13 extensions)
    0Eh 	logical-block-addressable VFAT (same as 06h but using LBA-mode INT 13)
    0Fh 	logical-block-addressable VFAT (same as 05h but using LBA-mode INT 13)
    10h 	OPUS
    11h 	OS/2 Boot Manager hidden 12-bit FAT partition
    12h 	Compaq Diagnostics partition
    13h 	Reliable Systems FTFS
    14h 	Hidden sub-32M 16-bit FAT partition
    15h 	Hidden extended partition
    16h 	Hidden over-32M 16-bit FAT partition
    17h 	Hidden HPFS/NTFS partition
    18h 	AST special Windows swap file
    19h 	Willowtech Photon coS
    1B 	Hidden FAT-32
    1Ch 	Hidden FAT-32 LBA
    1Eh 	Hidden FAT-16 LBA
    1Fh 	Hidden Extended LBA
    20h 	Willowsoft OFS1
    21h 	officially listed as reserved
    23h 	officially listed as reserved
    24h 	NEC MS-DOS 3.x
    26h 	officially listed as reserved
    31h 	officially listed as reserved
    33h 	officially listed as reserved
    34h 	officially listed as reserved
    36h 	officially listed as reserved
    38h 	Theos
    3Ch 	PowerQuest PartitionMagic recovery partition
    40h 	VENIX 80286
    41h 	Personal RISC Boot
    42h 	SFS (Secure File System) by Peter Gutmann
    50h 	OnTrack Disk Manager, read-only partition
    51h 	OnTrack Disk Manager, read/write partition or NOVEL
    52h 	CP/M or Microport System V/386
    53h 	OnTrack Disk Manager, write-only partition???
    54h 	OnTrack Disk Manager (DDO)
    55h 	EZ-Drive
    56h 	GoldenBow VFeature
    61h 	SpeedStor
    63h 	Unix SysV/386, 386/ix, Mach, MtXinu BSD 4.3 on Mach or GNU HURD
    64h 	Novell NetWare 286
    65h 	Novell NetWare (3.11)
    67h 	Novell
    68h 	Novell
    69h 	Novell
    70h 	DiskSecure Multi-Boot
    71h 	officially listed as reserved
    73h 	officially listed as reserved
    74h 	officially listed as reserved
    75h 	PC/IX
    76h 	officially listed as reserved
    77h 	QNX 4.x
    78h 	QNX 4.x
    79h 	QNX 4.x
    80h 	Minix v1.1 - 1.4a
    81h 	Minix v1.4b+, Linux or Mitac Advanced Disk Manager
    82h 	Linux Swap partition, Prime or Solaris x86
    83h 	Linux native file system (ext2fs/xiafs)
    84h 	OS/2-renumbered type 04h partition (related to hiding DOS C: drive)
    85h 	Linux Extended
    86h 	FAT-16 volume/stripe
    87h 	HPFS Fault-Tolerant mirrored partition, NTFS volume/stripe
    93h 	Amoeba file system
    94h 	Amoeba bad block table
    A0h 	Phoenix Power Management
    A1h 	officially listed as reserved
    A3h 	officially listed as reserved
    A4h 	officially listed as reserved
    A5h 	FreeBSD, BSD/386
    A6h 	officially listed as reserved
    B1h 	officially listed as reserved
    B3h 	officially listed as reserved
    B4h 	officially listed as reserved
    B6h 	officially listed as reserved
    B7h 	BSDI file system (secondarily swap)
    B8h 	BSDI swap partition (secondarily file system) or Syrinx
    C1h 	DR DOS 6.0 LOGIN.EXE-secured 12-bit FAT partition
    C4h 	DR DOS 6.0 LOGIN.EXE-secured 16-bit FAT partition
    C6h 	DR DOS 6.0 LOGIN.EXE-secured Huge partition, Windows NT corrupted FAT16
    C7h 	Syrinx Boot, Windown NT corrupted NTFS
    D8h 	CP/M-86
    DBh 	CP/M, Concurrent CP/M, Concurrent DOS, CTOS (Convergent Technologies OS)
    E1h 	SpeedStor 12-bit FAT extended partition
    E3h 	DOS read-only, Storage Dimensions
    E4h 	SpeedStor 16-bit FAT extended partition
    E5h 	officially listed as reserved
    E6h 	officially listed as reserved
    EBh 	BeOS
    F1h 	Storage Dimensions
    F2h 	DOS 3.3+ secondary partition
    F3h 	officially listed as reserved
    F4h 	SpeedStor, Storage Dimensions
    F6h 	officially listed as reserved
    FEh 	LANstep or IBM PS/2 IML
    FFh 	Xenix bad block table
    

    proponuje pogooglać na temat budowy MBR.
    Jeżeli to możliwe poproszę o MBR z tej karty, może w DOS'ie jest bład... to się poprawi :D
REKLAMA