• Viernes 19 de Abril de 2024, 06:14

Autor Tema:  Leer En Unidad Fat  (Leído 1625 veces)

vegesoft

  • Nuevo Miembro
  • *
  • Mensajes: 4
    • Ver Perfil
Leer En Unidad Fat
« en: Viernes 23 de Febrero de 2007, 03:08 »
0
Hola a todos , bueno vuelvo a recurrir a este foro por mas ayuda , jajaja , bueno lo que deseo ahora es saber como puedo leer de una unidad FAT [12 or 16 or 32] , lo que sucede es que yo he creado un programa booteable que corre de un diskette , entonces quiero agregar a mi programa esa opcion , algo asi como el comando dir (MS-DOS) ò ls(UNIX),
pero no se como hacerlo apezar que tengo la documentacion de la estructura del Sector de Carga www.zator.com , bueno espero que hayan entendido mi problema , quisiera que me den el link de la documentacion o sus propios ejemplos , fracias por su ayuda de antemano , bye

Bicholey

  • Moderador
  • ******
  • Mensajes: 1234
    • Ver Perfil
Re: Leer En Unidad Fat
« Respuesta #1 en: Viernes 23 de Febrero de 2007, 03:14 »
0
:P  :P

http://www.ctyme.com/intr/rb-2896.htm

creo que es eso lo que buscas, espero te ayude

ahh por cierto alguna vez se trato algo similar en el foro checate esto:

http://foros.solocodigo.com/index.php?showtopic=16756
[size=109]LOS GATOS SIEMPRE CAEMOS DE PIE !!![/size]


Eternal Idol

  • Moderador
  • ******
  • Mensajes: 4696
  • Nacionalidad: ar
    • Ver Perfil
Re: Leer En Unidad Fat
« Respuesta #2 en: Viernes 23 de Febrero de 2007, 09:21 »
0
Cita de: "Bicholey"
http://www.ctyme.com/intr/rb-2896.htm

creo que es eso lo que buscas, espero te ayude

En este caso esa interrupcion no esta disponible, si las de la BIOS, ya que el carga su propio S.O.


En cuanto a FAT empeza por aca:
http://en.wikipedia.org/wiki/File_Allocation_Table

Nacional y Popular En mi país la bandera de Eva es inmortal.


Queremos una Argentina socialmente justa, económicamente libre y  políticamente soberana.
¡Perón cumple, Evita dignifica!


La mano invisible del mercado me robo la billetera.

pabloreda

  • Miembro MUY activo
  • ***
  • Mensajes: 125
    • Ver Perfil
    • http://www.reda4.org
Re: Leer En Unidad Fat
« Respuesta #3 en: Viernes 23 de Febrero de 2007, 13:01 »
0
o usando ports !!!

Código: Text
  1.  
  2. ;       Reading the harddisk using ports!
  3. ;       +-------------------------------+   by qark
  4. ;
  5. ;
  6. ;  This took me months to get working but I finally managed it.
  7. ;
  8. ;  This code only works for the 286+ so you must detect for 8088's somewhere
  9. ;  in your code.
  10. ;
  11. ;  Technical Information on the ports:
  12. ;      Port    Read/Write   Misc
  13. ;     ------  ------------ -------------------------------------------------
  14. ;       1f0       r/w       data register, the bytes are written/read here
  15. ;       1f1       r         error register  (look these values up yourself)
  16. ;       1f2       r/w       sector count, how many sectors to read/write
  17. ;       1f3       r/w       sector number, the actual sector wanted
  18. ;       1f4       r/w       cylinder low, cylinders is 0-1024
  19. ;       1f5       r/w       cylinder high, this makes up the rest of the 1024
  20. ;       1f6       r/w       drive/head
  21. ;                              bit 7 = 1
  22. ;                              bit 6 = 0
  23. ;                              bit 5 = 1
  24. ;                              bit 4 = 0  drive 0 select
  25. ;                                    = 1  drive 1 select
  26. ;                              bit 3-0    head select bits
  27. ;       1f7       r         status register
  28. ;                              bit 7 = 1  controller is executing a command
  29. ;                              bit 6 = 1  drive is ready
  30. ;                              bit 5 = 1  write fault
  31. ;                              bit 4 = 1  seek complete
  32. ;                              bit 3 = 1  sector buffer requires servicing
  33. ;                              bit 2 = 1  disk data read corrected
  34. ;                              bit 1 = 1  index - set to 1 each revolution
  35. ;                              bit 0 = 1  previous command ended in an error
  36. ;       1f7       w         command register
  37. ;                            commands:
  38. ;                              50h format track
  39. ;                              20h read sectors with retry
  40. ;                              21h read sectors without retry
  41. ;                              22h read long with retry
  42. ;                              23h read long without retry
  43. ;                              30h write sectors with retry
  44. ;                              31h write sectors without retry
  45. ;                              32h write long with retry
  46. ;                              33h write long without retry
  47. ;
  48. ;  Most of these should work on even non-IDE hard disks.
  49. ;  This code is for reading, the code for writing is the next article.
  50.  
  51.  
  52.  
  53.         mov     dx,1f6h        &#59;Drive and head port
  54.         mov     al,0a0h        &#59;Drive 0, head 0
  55.         out     dx,al
  56.  
  57.         mov     dx,1f2h        &#59;Sector count port
  58.         mov     al,1           &#59;Read one sector
  59.         out     dx,al
  60.  
  61.         mov     dx,1f3h        &#59;Sector number port
  62.         mov     al,1           &#59;Read sector one
  63.         out     dx,al
  64.  
  65.         mov     dx,1f4h        &#59;Cylinder low port
  66.         mov     al,0           &#59;Cylinder 0
  67.         out     dx,al
  68.  
  69.         mov     dx,1f5h        &#59;Cylinder high port
  70.         mov     al,0           &#59;The rest of the cylinder 0
  71.         out     dx,al
  72.  
  73.         mov     dx,1f7h        &#59;Command port
  74.         mov     al,20h         &#59;Read with retry.
  75.         out     dx,al
  76. still_going:
  77.         in      al,dx
  78.         test    al,8           &#59;This means the sector buffer requires
  79.                                &#59;servicing.
  80.         jz      still_going    &#59;Don't continue until the sector buffer
  81.                                &#59;is ready.
  82.  
  83.         mov     cx,512/2       &#59;One sector /2
  84.         mov     di,offset buffer
  85.         mov     dx,1f0h        &#59;Data port - data comes in and out of here.
  86.         rep     insw
  87.  
  88. ;   ------
  89.  
  90.         mov     ax,201h        &#59;Read using int13h then compare buffers.
  91.         mov     dx,80h
  92.         mov     cx,1
  93.         mov     bx,offset buffer2
  94.         int     13h
  95.  
  96.         mov     cx,512
  97.         mov     si,offset buffer
  98.         mov     di,offset buffer2
  99.         repe    cmpsb
  100.         jne     failure
  101.         mov     ah,9
  102.         mov     dx,offset readmsg
  103.         int     21h
  104.         jmp     good_exit
  105. failure:
  106.         mov     ah,9
  107.         mov     dx,offset failmsg
  108.         int     21h
  109. good_exit:
  110.         mov     ax,4c00h       &#59;Exit the program
  111.         int     21h
  112.  
  113.         readmsg db      'The buffers match.  Hard disk read using ports.$'
  114.         failmsg db      'The buffers do not match.$'
  115.  
  116. buffer  db      512 dup ('V')
  117. buffer2 db      512 dup ('L')
  118.  
  119.  
  120.  
  121.  
  122. ;
  123. ;       Writing to the hard disk using the ports!     by qark
  124. ;       +---------------------------------------+
  125. ;
  126. ;  The only differences between reading and writing using the ports is
  127. ;  that 30h is sent to the command register, and instead of INSW you
  128. ;  OUTSW.  
  129. ;
  130.  
  131.  
  132.         mov     dx,1f6h        &#59;Drive and head port
  133.         mov     al,0a0h        &#59;Drive 0, head 0
  134.         out     dx,al
  135.  
  136.         mov     dx,1f2h        &#59;Sector count port
  137.         mov     al,1           &#59;Write one sector
  138.         out     dx,al
  139.  
  140.         mov     dx,1f3h        &#59;Sector number port
  141.         mov     al,1          &#59;Wrote to sector one
  142.         out     dx,al
  143.  
  144.         mov     dx,1f4h        &#59;Cylinder low port
  145.         mov     al,0           &#59;Cylinder 0
  146.         out     dx,al
  147.  
  148.         mov     dx,1f5h        &#59;Cylinder high port
  149.         mov     al,0           &#59;The rest of the cylinder 0
  150.         out     dx,al
  151.  
  152.         mov     dx,1f7h        &#59;Command port
  153.         mov     al,30h         &#59;Write with retry.
  154.         out     dx,al
  155. oogle:
  156.         in      al,dx
  157.         test    al,8           &#59;Wait for sector buffer ready.
  158.         jz      oogle
  159.  
  160.         mov     cx,512/2       &#59;One sector /2
  161.         mov     si,offset buffer
  162.         mov     dx,1f0h        &#59;Data port - data comes in and out of here.
  163.         rep     outsw          &#59;Send it.
  164.  
  165. ;    ------------
  166.  
  167.         mov     ax,201h                &#59;We'll read in sector 1 using
  168.         mov     bx,offset buffer2      &#59;int13h and see if we are successful.
  169.         mov     cx,1
  170.         mov     dx,80h
  171.         int     13h
  172.  
  173.         mov     cx,512
  174.         mov     si,offset buffer
  175.         mov     di,offset buffer2
  176.         repe    cmpsb                  &#59;Compare the buffers.
  177.         jne     failure
  178.  
  179.         mov     ah,9
  180.         mov     dx,offset write_msg
  181.         int     21h
  182.         jmp     w_exit
  183. failure:
  184.         mov     ah,9
  185.         mov     dx,offset fail
  186.         int     21h
  187.  
  188. w_exit:
  189.         mov     ax,4c00h       &#59;Exit the program
  190.         int     21h
  191.  
  192.         write_msg       db      'Sector one written to using the ports, OH NO! there goes XP.$'
  193.         fail            db      'Writing using ports failed.$'
  194.  
  195. buffer  db      512 dup ('A')
  196. buffer2 db      512 dup ('D')
  197.  

Eternal Idol

  • Moderador
  • ******
  • Mensajes: 4696
  • Nacionalidad: ar
    • Ver Perfil
Re: Leer En Unidad Fat
« Respuesta #4 en: Viernes 23 de Febrero de 2007, 13:10 »
0
Cita de: "pabloreda"
o usando ports !!!
¿O a que? Y no pongas tres signos de exclamacion a menos que quieras indicar que estas gritando.

Nacional y Popular En mi país la bandera de Eva es inmortal.


Queremos una Argentina socialmente justa, económicamente libre y  políticamente soberana.
¡Perón cumple, Evita dignifica!


La mano invisible del mercado me robo la billetera.