On Tue, Nov 8, 2011 at 10:50 AM, IVP wrote: >> Unless you are booting an os or equivalent structure from the card, >> boot sector is not necessary > > Yes, I have a couple of uses where the dsPIC's is the only s/w > involved and I don't have to make the data FAT compatible (ie the > card is just a big dumb block of memory and I can write anywhere). > However, I'm working on applications where card files will be written > by a PC so I had to know how to find them Food for thought ; you don't need to partition the card to write/read from, you can bulk write/read as long as the device is recognized by the os (not the filesystem). A filesystem is not necessary but it surely will make things simpler. > >> I use a tool for these kinds of stuff "dd" > > Me too, after it was recommended here not so long ago. AFAIK it > doesn't have a GUI, just Command prompt > > I'm using frhed to view file generated by dd. Together they are very > helpful for testing s/w and diagnosing problems. It's how I found that > the Boot Sector wasn't where I expected it dd lacks gui but it's so straightforward that I doubt you will need one.It's output will be written to a file and file can be viewed with vi, pico, kwrite, notepad, frhed and so on. I live in bash usually thus it's easy to do any kind of manipulation for directing input/output of dd. > >> u can force the format to put the Boot Sector at 0x000000 but that >>wouldn't be a bootable disk unless it contains the necessary flags > > I've got the other two cards to refer to for how a Boot Sector at 0x0 > is put together if I need to. Now that I understand that these cards have > a partition it's simple enough to work with that > Each SSD card I have played with allowed multi partition on it even the old MMC ones. I remember I got ext3, reiserfs and jfs on the same card. > > -------------------------------------- > > I've written the below, but not tried it yet. The numbers check out > for the first directory sector at byte 0xBAE000 > > Boot Sector at 0x2000 * 0x200 =3D byte 0x40000 > numfat =3D 0x2, fatsz32 =3D 0x1EA7, resvdsec =3D 0x22 > > (0x400000 + 0x200*((2*1EA7 + 22))) =3D 0xBAE000 > > =A0read_fat: =A0clr =A0 =A0 sec_adr_lo =A0 =A0 =A0 =A0 =A0 =A0 =A0;sector= 0 > =A0 =A0 =A0 =A0 =A0 clr =A0 =A0 sec_adr_hi > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 #ram2,w8 > =A0 =A0 =A0 =A0 =A0 call =A0 =A0getsector =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;re= ad 512 bytes, store data at > ram2 > > ;find Boot Sector / Root Directory > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 ram2,w0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;= read first byte of sector > =A0 =A0 =A0 =A0 =A0 bra =A0 =A0 z,partition =A0 =A0 =A0 =A0 =A0 =A0 ;if 0= , then Boot Sector is not at > 0x0 > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 ;else E9 or EB > boot: =A0 =A0 =A0mov =A0 =A0 ram2+numfat,w0 =A0 =A0 =A0 =A0 =A0;BPB_NumFA= Ts > =A0 =A0 =A0 =A0 =A0 mul =A0 =A0 ram2+fatsz32 =A0 =A0 =A0 =A0 =A0 =A0;*BPB= _FATSz32 > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 ram2+resvdsec,w0 > =A0 =A0 =A0 =A0 =A0 add =A0 =A0 w0,w2,w0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0;= +BPB_ResvdSecCnt > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w0,dir_sector =A0 =A0 =A0 =A0 =A0 ;start = sector of directory > =A0 =A0 =A0 =A0 =A0 add =A0 =A0 w0,#8,w1 > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w1,offset =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;of= fset to next cluster > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w0,sec_adr_lo =A0 =A0 =A0 =A0 =A0 ;fetch = non-00 directory sectors > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 #dir_ram,w8 > =A0 =A0 =A0 =A0 =A0 call =A0 =A0getsector =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;st= ore at dir_ram > dir_loop: =A0inc =A0 =A0 sec_adr_lo > =A0 =A0 =A0 =A0 =A0 skpnz > =A0 =A0 =A0 =A0 =A0 inc =A0 =A0 sec_adr_hi > =A0 =A0 =A0 =A0 =A0 call =A0 =A0getsector > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 temp0,w0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0;= test first byte of sector > =A0 =A0 =A0 =A0 =A0 bra =A0 =A0 nz,dir_loop > > =A0 =A0 =A0 =A0 =A0 return > > ;if nothing at sector 0 then look for Boot Sector > > partition: mov =A0 =A0 #1,w0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;Boot Se= ctor address at 0x1be + 8 > (0x1c6) > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w0,sec_adr_lo > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 #ram2,w8 > =A0 =A0 =A0 =A0 =A0 call =A0 =A0getsector > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 ram2+#0xc6,w0 =A0 =A0 =A0 =A0 =A0 ;fetch = 0x1c6 and 0x1c7, LSW > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w0,sec_adr_lo > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 ram2+#0xc8,w0 =A0 =A0 =A0 =A0 =A0 ;fetch = 0x1c8 and 0x1c9, MSW > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 w0,sec_adr_hi > > =A0 =A0 =A0 =A0 =A0 mov =A0 =A0 #ram2,w8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0;= get Boot Sector > =A0 =A0 =A0 =A0 =A0 call =A0 =A0getsector > > =A0 =A0 =A0 =A0 =A0 bra =A0 =A0 boot =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0;examine > Your code will check if 0xBAE000 is occupied or not, give it a try. --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .