Page 2 of 3

Re:FAT12...

Posted: Mon Feb 23, 2004 6:19 am
by bubach
I can not remember how i did that.. Hmm.. i guess i just tried to add a bit more to 0000:7E00 so that it?s enoght space before the next thing at 0000:AAAA...
Or something, i think that i feel as confused as you prblably are right now..

Re:FAT12...

Posted: Tue Feb 24, 2004 2:27 pm
by bubach
I have just deleted my FAT12 bootsector and started to use a modifed version of Neo?s instead.
So now all "FAT addresses" is problably right. But the bootsector code hangs at the first "readsector" call, and bochs is saying something about a crtitical fdd error and that the sec, cyl and head values are incorrect or something..

Neo: Whats wrong with your code dude? :-P

And the "mov di, temp" what?s that? there is no temp var declared.. anyway i commented it away..
Was the code really working on your computer?

anyone that wants to look throw the code, it would be nice..
you can find it here http://www.geocities.com/meyn_phantom/fat12.htm

/ Christoffer

Re:FAT12...

Posted: Tue Feb 24, 2004 3:18 pm
by Therx
Neo's doesn't look like a boot sector to me but like a second stage loader (hint: the [ORG 0x8000])

Pete

Re:FAT12...

Posted: Tue Feb 24, 2004 3:39 pm
by bubach
I got the link in my post.. It?s not [ORG 8000]
And it IS a bootsector...
Hard to click on right link, eh? ;D

/ Christoffer

Re:FAT12...

Posted: Tue Feb 24, 2004 3:45 pm
by Therx
Uh, sorry I used Neo's original link.

Pete

Re:FAT12...

Posted: Wed Feb 25, 2004 2:59 am
by bubach
I understood that.. :-)

Any suggestions on how to fix it?
I will attach the modified version i have made...

/ Christoffer

[attachment deleted by admin]

Re:FAT12...

Posted: Wed Feb 25, 2004 11:47 am
by Neo
Sorry wasnt checking for a while. Chris u need to use both the my primary and secondary together for it to work as the primary has a hack that enables the secondary to work( this happened because it took me too long to debug the secondary after i made a change in the primary so i ended up just adding a hack to make it similar to what the secondary wanted in the old primary). Sorry if all this is confusing. ::)

<edit>
I just realised that the temp var must have got deleted when i was formatting the code with color for display in my website. Ive attached the correct file here. Thanks for letting me see that bubach
</edit>

[attachment deleted by admin]

Re:FAT12...

Posted: Wed Feb 25, 2004 2:35 pm
by bubach
Could that have something to do with the code not working for me? Becasue it hangs at the very first discread...
The par. that are passed to the "discread" are incorrect...

Hmm.. i will check for any other changes in the (working?) code.
I hope i was allowed to use your code in my file? did you see it? i added your name (that i based it on code from you), but it may contain old notes saying that i wrote it all. if so i will remove it.. :-)

thanks
/ Christoffer

Re:FAT12...

Posted: Wed Feb 25, 2004 3:17 pm
by Neo
yes i think it was exactly that which made the code unusable.
And yeah no prob you can use my code (it was nice to see the credit. 8) )

Re:FAT12...

Posted: Wed Feb 25, 2004 5:49 pm
by mr. x
I would like to know how to get the the rest of the dir entries, I've managed to read the first file/entry in a directory.

Re:FAT12...

Posted: Wed Feb 25, 2004 8:21 pm
by Neo
each dir entry occupies 32 bytes of Root Dir space so you must keep adding 32 bytes to read the next entry. (This is what i've done anyway so the code should help you). however in Windows long filenames they occupy 64 bytes this should be a prob as long though.

Re:FAT12...

Posted: Wed Feb 25, 2004 11:31 pm
by Candy
Neo wrote: however in Windows long filenames they occupy 64 bytes this should be a prob as long though.
100% BS

Long file names are implemented using the file table entries before the DOS named one and they are marked with a set of invalid flags (so most DOS software jumps over them).

BTW, you can still use my code as a reference... it does not have the temp hack ;)

Re:FAT12...

Posted: Thu Feb 26, 2004 3:02 am
by bubach
Does the "mov di,temp" really have to be there? becasue right after that you mov another value into di..
and having a dd var. takes up vailible space..
but as it is now i just replaced the old readsect function and added a "pucha" "popa" so that the register values sent to readsect was correct..
it seams to work. the bootsector finds the file but hangs at 4 "progressdots" (that i print in readsect).
this may be becasue i deleted the temp stuff.. :-P
ahh, it?s so hard to fit in a decent "disc error: press any key to reboot.." message with that temp dd var..

/ Christoffer

Re:FAT12...

Posted: Thu Feb 26, 2004 11:20 am
by Neo
Candy wrote:
Neo wrote: however in Windows long filenames they occupy 64 bytes this should be a prob as long though.
100% BS
*lol* This is exactly what happens when you try to reply at 3 in the morning.

Anyway may i present my new and latest primary bootloader (and yeah there is no 'temp hack') so much lesser code.<drum roll....>

[attachment deleted by admin]

Re:FAT12...

Posted: Fri Feb 27, 2004 3:21 am
by bubach
What are the diffrens? Becasue i actually got the older one working yesterday; without the temp dd 0 and "mov di, temp"..
Now my version got excatly 0 bytes free space.. :-)
I only got one more problem. I "stoal" the your function for checking memory and make a memorymap aswell.. ;)
It doesn?t work.. Everything in my sec loader is f***ed up with that memory code.. for example, after running the memory code it won?t print anything more until the code reaches pmode. And other things seams to be acting very weird with that code aswell..

here it goes:

Code: Select all

; at the data area:

     MEMORY_SIZE     dd 0
     mem_map         dd 0

;.. later on; in the "function" area:

     ; INT 15h, E820h to get memory map and determine memory.
     ;--------------------------------------------------------
     mem_e820:
          pusha
          mov     ebx, 0                              ; EBX clear
          mov     ebp, ebx                            ; EBP clear
          mov     edi, mem_map+4                      ; ES:DI buffer to read info into

     .again
          mov     eax, 0x0e820                        ; EAX service no
          mov     edx, 0x534d4150                     ; EDX with 'SMAP'
          mov     ecx, 0x14                           ; 20 bytes to read
          int     15h
          jc      .end                                ; If carry then END

          cmp     eax, 0x534d4150                     ; If EAX!=SMAP
          jne     .end                                ; then END

          mov     dword eax, [di+8]                   ; else get the length of segment
          add     ebp, eax                            ; add it to EBP
          add     edi, 20+4
          inc     dword [mem_map]
          cmp     ebx, 0                              ; If EBX==0 then END
          jne     .again                              ; Else continue

     .end
          mov     dword [MEMORY_SIZE], ebp            ; Store the result in the variable
          popa                                        ; restore all registers
          mov     eax, [MEMORY_SIZE]
          ret                                         ; Return.

; .. and later; when i call the function:

     ; Determine all installed memory and make a memory map.
     ;-------------------------------------------------------
     MemCheck:
          mov     si, msgCheckMem                     ; Print
          mov     bl, 07h                             ; lightgrey
          call    DisplayMessage                      ; message.

          call    mem_e820                            ; use INT 15h,E820
          jnc     mem_done

          mov     si, msgMemFailed                    ; Print
          mov     bl, 04h                             ; red
          call    DisplayMessage                      ; message.

          mov     si, msgFailure                      ; Print reboot msg and wait to reboot
          mov     bl, 04h                             ; red
          call    DisplayMessage                      ; message.

          mov     ah, 0x00
          int     0x16                                ; Wait for keypress

          db      0EAh                                ; Machinecode, jmp to FFFF:0000 (reboot)
          dw      0000h
          dw      0FFFFh

     mem_done:                                        ; Memory check complete
          cmp     eax,1024*1024*15                    ; At least 16MB should be present
          jl      .needmore
          jmp     A20

     .needmore:
          mov     si, msgMemLess                      ; Print
          mov     bl, 04h                             ; red
          call    DisplayMessage                      ; message.

          mov     si, msgFailure                      ; Print reboot msg and wait to reboot
          mov     bl, 04h                             ; red
          call    DisplayMessage                      ; message.

          mov     ah, 0x00
          int     0x16                                ; Wait for keypress

          db      0EAh                                ; Machinecode, jmp to FFFF:0000 (reboot)
          dw      0000h
          dw      0FFFFh

can anyone see the problem?

/ Christoffer

[attachment deleted by admin]