FileSystemD for DOS HD&DVD&USB-and now usb debuger..

DOS specific questions.
Post Reply
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

FileSystemD for DOS HD&DVD&USB-and now usb debuger..

Post by Mihail_B »

Latest version : 2.61 : fixed a simple bug that would prevent user to use FAT16 partition. FAT16 can now be used again !

Notes for verion : 2.6 : fixed the cache : cache is now functional for drives up 2/8TB ...
Notes for version : 2.5 : added USB DVD/CD support in DOS using DOSUSB.COM, some fixes.
Note about version : 2.42: fixes for partition editor,it can now dump any drive (linux/win32 or int13_drv/vfile in dos) to local hard disk
(using OS's read/write to file)
Note about version : 2.41 : updated INT13 support, updated usbebe, bug fixes ... and me :
Image
Note about version 2.4:
- version 2.4 contains updated built-in UHCI USB controller driver !
you will now be able to setup any transaction with your usb devices !
for more info please read readme.txt file, inside fs-2.4.zip
- for now only for experts - i promise a higher level implemetation for future release -


I license my programs only if users agree to "The Universal Declaration of Human Rights"
AND ONLY for NON-CRIMINAL purposes (aka violation of laws/persons).

Code: Select all

   print "Thanks to following people for their good docs ( &tutorial sources)!"
	print " - Tilmann Reh - (IDE HD tutorial)"
	print " - IDE ATA HardDisk Specification"
   print " - Philip J. Erdelsky - ISO9660 Simplified"
	print " - ISO 9660 - Wikipedia, the free encyclopedia"
	print " - Joilet Spec - Microsoft"
	print " - An Introduction To Programming With ATA And ATAPI"
	print " - Ben Cadieux - WDE asm sources"
	print " - Jack R. Ellis - XCDROM.SYS sources"
	print " - Information Technology - AT Attachment Packet Interface (ATAPI)"
	print " - Hale Landis - How it Works -- Partition Tables"
	print " - Hsu-Ping Feng - SpfDisk : Values for operating system indicator"
	print " - Robert Vandervelde - How Windows 95 Stores Long Filenames"
	print " - Inbar Raz - FAT DIRs' document"
	print " - Galen C. Hunt(&Gordon Chaffee) -NOTES ON THE STRUCTURE OF THE VFAT FILESYSTEM"
	print " - Jozsef Hidasi -  How does Windows 95 stores LONG FILENAMES"
	print " - Thomas Kjoernes - File Allocation Table : How It Seems To Work, etc..."
	print " - Alex Verstak - FAT/PARTITION documents"
	print:	pause1 "press any key to print more ...": print
	print " - EXT2 Specification"
	print " - Wikipedia - EXT2"
	print " - EXT2 Overview"
	print " - John's spec of the second extended filesystem (EXPLORE2FS)"
	print " - Intel IA32/64 CPU Manuals"
	print " - Christopher Giese - protected-mode demo code"
	print " - Alexei A. Frounze - protected-mode tutorial"
	print " - Wim Osterholt - PORTLIST.TXT"
	print " - Ralph Brown - Interrupts Bible ..."
	print " - FreeDOS development team - Big thanks to all programmers, of all kind !"
	print " - FreeBASIC compiler team and forum member - Nothing of this would be possible without you !"
	print " - NASM - NASMDOC.TXT"
	print " - FASM - FASMDOC.TXT"
	print " - Glaciar P. Moreno I - Set's Editor (setedit)"
	print " - FbEdit"
	print " - NC, SCANDISK, Win9xDEFRAG for inspiration about GUI"
	print:	pause1 "press any key to print more ...": print
	print " - HOME.RO for free web page hosting"
	print " - google for being such a good 'searcher' :))"
	print " - AlphaX team members (for moral suport)"
	print " - wikipedia - most needed enciclopedia (as good as MS Encarta)"
	print " - all HOBIEST programmers all over the world - Thanks !"
	print " - A. Einstein , ICHB & MIT - good teachers"
NOTE: when I started writing FS, FreeDOS/Win98se haven't got multi-session DVD support !

Code: Select all

'- my second little dog DIED - today - Monday 8, December, 2008 - between 15:00->16:30
I wrote for FS source and associated sources more than 1.000.000 bytes.

Code: Select all

'STDNSL.SMD.STS signature
'WARNING: this program uses 686 (Pentium Pro/K6/CyrixMX2) specific instructions 
'(like CMOVxx,RDTSC, etc) It will not work with 586(Pentium/K5)/486/386 processors.

'NEW network drive ! (read/write sectors over the network ! cool !)

'From version 2.31 FS is now bug free for FAT32 and ISO9660 - completly functional

'- my second little dog DIED - today - Monday 8, December, 2008 - between 15:00->16:30
'- last modified 9/feb/2011 ; 11:10 ; Nenciulesti/Buzau/Romania/Eu/Earth/OurSolarSystem/MilkyWay/KnownUniverse :)
' Gnupyright (G) 1996-2011, AlphaX (R) Team
' Programmed by Ioan M. Barboi (aka Zdupy) , Romania, EU
' e-mail                        : mbarboi@home.ro //or// mbarboi@yahoo.com
' personal website              : http://mbarboi.home.ro
' FS's website                  : http://filesystemd.sourceforge.com 
' Please send bug reports to my e-mail adress !
' If you have questions about IDE,PCI,PIT,PIC,KBPORT,VESA,CMOS-RTC,ATA/ATAPI,USB,V86,PM32,MBR,FAT,ISO9660, FreeBASIC, VB, ASM, ...
' or any other please email me- and I will answer you (be sure).
'
' For license please read "The Universal Declaration of Human Rights" & GPL V2...
' Special thanls : OCW.MIT.EDU and many others ! 
' See thanks list : C:\>FS.EXE /thanks

'FS can be compiled with FreeBASIC32 compiler (0.20b,0.21,0.21.1) for DOS32(CWSDPMI)/WINDOWS/LINUX 
'To compile FS use: fbc -w 3 -arch 686 -t 20000 fs.bas    '(you will need :[mem.bas] ; [easy.bas] ; [mutex.bas] ; [myenum.bas] and [FS.BAS]
'To compile FS with USBebe support : fbc -w 3 -arch 686 -t 20000 -d usbebe_lib fs.bas  '(you will need [usbebe.bas] too)

'+=========================================+
'| TO INCLUDE FS.BAS IN YOUR PROGRAM USE : |
'|  #define USE_FS_LIB                     |
'|  #include "fs.bas"                      |
'+=========================================+
' Or easier : #include once "fs.bi"
------------------------------------------------------------------
Before you go on you should friendly know that this complex program:
1) is not a replacement for WDE(r), SPFDISK(r), FDISK(r), FORMAT(r),XCDROM(r),SCANDISK(r),CHKDSK(r),DEFRAG32(r) etc ...

2) it provides (version 2.31) support for ONLY STANDARD parallel ATA IDE HardDisks and ATAPI compatible CD-RW/DVD-RW drives

3) it has also stable built-in support for USB UHCI controllers. But for handleing USB Mass Storage Bulk-Only compatible devices it uses
3rd party driver: DOSUSB.COM(R) by Georg Potthast (see http://www.georgpotthast.de/usb/dosusb.pdf )

4) in linux in can handle drives using linux's drivers (simply : open "/dev/hda", "/dev/dvd", "/dev/sda")

5) you can damage your hard-disk if you handle it wrong ! (like any other disk-editor)
------------------------------------------------------------------
The notes below are related to an older version of FS. The newer version contains some bug fixes and some additional add-ons (like selecting which CD/DVD track to use, copying fat1 to fat2 (or 2 to 1) etc ...)

Latest release: FS-2.3 -> with framed cache (for drives up to 2TBytes)
Most stable release (no bug is known) : FS-2.299 (but no framed cache)
->Both latest releases have got cd/dvd session explorer and many bug fixes. etc ....


Well after one year of painful work and many times backing up my HD ... finnally FS is now ready for other users !

WEBPAGE: http://mbarboi.home.ro/project_fat.html

http://filesystemd.sourceforge.net/
/// or from my personal web page (see HOME SWEET HOME / FS)
http://mbarboi.home.ro

Source size (fs.bas: 730Kbytes) + additional functions (100kbytes).
Stack usage: at least 10MB (but better 30MB) - this values are for good results (can work with 1MB of stack).
Memory needed : If you want to copy big files from CD/DVD to a FAT drive , it's goot to have 128MB RAM. (improves speed a lot since is copying
~64 MB to ram at once).
The PC on which I've developed FS is a P3-450Mhz (160MB ram) (on win98 dos mode (because FreeDOS start NOT WORKING after compileing many times my source code [WHY ???].)
I've tested it on my P4(-2.5Ghz, 1gb ram) too.

It can be compiled with DOS FBC and LINUX FBC.
Win32 FBC compiling is under development since older versions of windows are using a different way of accessing harddisk (in NT4/2k/xp ... you can simple use CREATEFILE but with win98 you need to use INT 13h or VXDs ...)




New features and bug fixes:
- can handle FLASHES (FAT/EXT) using DosUSB - http://www.georgpotthast.de/usb
- can copy recursive from a Multi-Session DVD to a FAT32 drive ! (while MSCDEX/SHSUCDX/ WIN9x can't ! - THAT'S way I made this program ... I was mad WIN98se/DOS/FREEDOS can't see last DVD session ! I always had to use LINUX ! But know i'm free ! Only problem is that CACHEING is under devlopment and it takes a little longer for many small files (big files are okay ... because it uses same smart WRITE all FAT entries at once)
- can explore standard EXT2/3 (no hashing support yet - under development) ... Couldn't find the meaning of 32bit block number out of block range (for newer revisions of EXT2/3) ... When I'll find the meaning I'll include also COPY/DELETE/OTHERS.
- can do many others ... see by your self !

Samples included .
More GUI options and fixes.

It's final purpose is to create a Reactos DOS installer ( I hate installing from CD ... For each new release I have to burn new empty CD , because bootinf from MULTI-SESSION CDs not supported).

So FS should be a complete FILESYSTEM handler + exploring GUI support + defragmenter + disk check + provide access to advanced files system setting (like finding the file containing some cluster, viewing FAT linked list only for the file and modifing it as you wish)

And a second PURPOSE for it IS TO RECOVER your program sources for which you worked for years and suddenly because of some OS bug THEY ARE GONE !!! (imagine how painfull is to loss your program's SOURCE code just after adding to it the most important feature for which you worked for days !)

NOTE : Disable any DOS cacheing utility (like SMARTDRV/LBACACHE) since they keep a copy of FAT in RAM and FS doesn't tell them what FAT
entries it modified !!! (Be carefull you can get in big trouble if try inventing something :) !!)

P.S : I haven't checked well FAT16 ... but it's a little buggy because I developed FS to use FAT32, then I added FAT16 support.
But in FAT16 you can use CLUSTERS starting with 0 , while in FAT32 first cluster is 2... (this can give problems because I'm always check for a fat entry to be different from 0 (zero means free cluster ... :) )

About Georg's DOSUSB driver.... : it's preaty good you can use it to handle USB MOUSE/KEYBOARD/FLASHES/PRINTERS/ any king !
It contains also samples of how to implement drivers ....
FS uses BULK-only method ( CBW -> SCSI command -> DATA -> CSW)
It seams that this method doesn't work with some sophisticated USB mass storages .... only standard ones work (like MP3/MP4 digital players)

Image
Image
Image
Image
Image
Image
Image
Image[/img]
Last edited by Mihail_B on Dec 20, 2011 16:06, edited 17 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

I don't need it but it looks really good i know how many work are behind it.

Good Job
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Re: FileSystem for DOS HD&DVD&USB- and now usb debug

Post by Mihail_B »

Tutorial for USBebe [Main Menu-> USB Devices]
[you will need to download version 2.4 from http://filesystemd.sourceforge.net]

How to get a device descriptor from your device using USBeBe ?
step 1: start fs.exe
step 2: inside main menu go to -> USB devices
step 3: select your UHCI controller
step 4: press enter until you get inside the USBeBe debuger window
step 5: insert your LOW-SPEED/FULL-SPEED device into an aporpraite usb slot ... (take care to be one that is handled by the controller that you have selected, in case you have more controllers - an EHCI controlle might have 4, even 8 UHCI controllers... so choose wisely)
step 6: press [pgdown] for port 1 or [end] for port 2 to reset the device. YOU MUST DO THIS OTHERWISE THE DEVICE WILL NOT TALK TO YOU BY NO MEANS.
step 7: press [pgup] for port 1 or [home] for port 2 to enable the device. if device is
diabled you will not be able to talk to it ... - also the progrom will discover the type of your device(low-speed/full-speed) and set apropriate bits in TDs
step 8: ------- IF everything worked correctly you are now ready to send packets to your device
step 9: to setup a TD (transfer descriptor) you need select one from the list(s). select one using arrow keys (you can use "g" to goto a specific TD). press enter to select it-this will display information about TD and the about the data buffer to which it points
step 10: now goto the buffer bytes... and enter your usb request packets (there exists also predefined USB REQUESTS like at 50,100,150,200,250,500,600,700)
for GET_DESCRITOR use this : 0x80, 6, 0, 1, 0, 0, 0x12

good now you have the usb request : getdescriptor (6 at byte 2), for device(1 at byte 4)

step 11: now you will need to set up IN TD where data will be stored.
from your curent selected TD index add 10 and go to there.

select the new TD [press enter]
press [f3] and to toggle TD type (SETUP:0x2D, IN:0x69, OUT:0xE1) ... switch it to 0x69(in)
press [d] to toggle data0/data1 bit inside td.

----
select a new td (add 10 to the last selected td's index; press enter)
again press [f3] and to toggle TD type (SETUP:0x2D, IN:0x69, OUT:0xE1) ... switch it to 0x69(in)

NOW be carreful to toggle the data0/data1 bit to zero (press [d] once and see what changes; make sure you toggle that bit to ZERO for now)
----
select a new td (add 10 to the last selected td's index; press enter)
again press [f3] and to toggle TD type (SETUP:0x2D, IN:0x69, OUT:0xE1) ... switch it to 0x69(in)

NOW be carreful to toggle the data0/data1 bit to ONE (press [d] once and see what changes; make sure you toggle that bit to ONE for now)
------

now we are done with the IN buffer
we now need to set up an ACKNOWLEDGE (ack) TD.
to do that select a new td (add 10 to the last selected td's index; press enter)
again press [f3] and to toggle TD type (SETUP:0x2D, IN:0x69, OUT:0xE1) ... switch it to 0xE1(out) ... (rember now you change it to 0xE1 !!! if you send a usb_request and you receive data, the ACW TD must be OUT; otherwise if you send data to the device the ACW needs to be IN)

NOW be carreful to toggle the data0/data1 bit to ONE (press [d] once and see what changes; make sure you toggle that bit to ONE for now)

DONE WITH THIS !

step 12: pause the controller. GOTO first row inside the window and press ENTER the usb frames will stop change.

step 13: select first edited TD, the one with the usb_request. press enter. press [1].
pressing [1] will enable the TD-it means it will be transmitted to the divice)

do the same for all other TDs (there are 5 TDs in total)

step 14: un-pause the controller. GOTO first row inside the window and press ENTER (the frames will start again to me switched)

step 15: viewing the data that the device send.

You can now select a IN TD that we setted up before and view it's data bufer (the first row after the TDs list)

to view things in a human readable way

press [F2]

select [Device Descriptor]

enter the index of the first IN TD (the first IN not the first TD we've setted up) press enter

enter now the index of the second one; press enter

and finally enter the index of the third IN TD///

now we are ready to view the Device_Descriptor.

Have fun !
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Re: FileSystem for DOS HD&DVD&USB- and now usb debug

Post by Mihail_B »

keys list and the usage of keys inside USBebe

keys : !!! case-sesitive !!!
[q] - makes that selected frame to start with a Queue Head (QH)
[t] - makes that selected frame to start with a Transfer Descriptor (TD)
[0] - disables the selected TD/QH - it will not be parsed by the ctrl
[1] - enables the selected TD/QH transaction
[enter] - for row (21) : changes the look-up address for a custom TD
for row (22) : changes the look-up address for a custom QH
for row (13) : changes one byte inside the TD buffer.
for row ( 2) : toggles start/stop (pauses/un-pauses ctrl)
for rows ( 7 .. 12) : selects that TD
for row (19) : edits the TD manually
for row (20) : edits the QH manually
[d] - toggles data0/data1 bit inside TD (bit 19 of 4th dword)
- toggles interrupt_on_completition bit of the TD (bit 24 of 4th dword)
[R] - sets the "resed dword for AND operation" and the "reset dword for
or operation"; favorite TDs get automatically ANDed and ORed with
this dwords every 1 sec. - basically resets TD status and
makes TD active
[r] - resets TD status : uses the dwords defined with [R] to reset
the status and to make active that TD
[f] - makes favorite (5 favorites: the left TD list) from the left
list (frames list_
- reserved for future-implementation
[g] - go to TD index
[a] - toggle address of the TD (([address] and &h7f) shl 8) for
the 4th dword
[page up] - resets port 1 : must do this otherwise the device will
never talk to you by no means (do this after you plug in
the device)
[home] - resets port 2 : must do this otherwise the device will
never talk to you by no means (do this after you plug in
the device)
[page down] - enables port 1 & updated device type inside all TD
(low_speed/full_speed bit : bit 26 of 3rd dword)
device will not work unless it's eneabled !
[end] - enables port 2 & updated device type inside all TD
(low_speed/full_speed bit : bit 26 of 3rd dword)
device will not work unless it's eneabled !
[up]/[down] - moves selection cursor inside debugger window
[left]/[right] - switches between left list(favorites) and the
right list (frames' TDs)
[F4] - reserved
[F3] - toggle TD's PID (transfer type); it can only be :
0x2D - SETUP
0x69 - IN
0xE1 - OUT
(4th dword : bits 0..7)
[F2] - prints human-readable text out of data received from device
*) select your data type : for now only device_descriptor,
configuration_descriptor, interface_descriptor and
endpoint_descriptor are available
*) enter each TD's frame-index (in the corect order)
[F1] - will display help for each row
--------- that's all folks for now ---------------------
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Re: FileSystem for DOS HD&DVD&USB- and now usb debug

Post by Mihail_B »

I wrote the program, but it would not have been posible to do that without
good docs, tutorials and examples.

I would like to thank to the following people :
1) Bret Johnson (advices + USBDOS.ZIP + USBSRC.ZIP)
visit: ([url]http://bretjohnson.us) 2) Intel UHCI spec,Intel EHCI spec ... otthast.de
6) USB MASS STORAGE BULK_ONLY Docs
7) USB Made Simple Tutorial ! (good usb tutorial including a disection of usb mouse transactions - equivalent with a mouse driver !) http://www.usbmadesimple.co.uk/
8) SnoopyPro sourceforge.net/projects/usbsnoop/
9) ms win ddk
10) linux ddk
11) some other folks includeing OSDEV.ORG and WOTSIT.ORG!

Thank you all !
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

Post by integer »

Looks good.
you can damage your HD
hmmmmm.
Interesting.
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Post by Mihail_B »

integer wrote:Looks good.
you can damage your HD
hmmmmm.
Interesting.
integer,if you tried it in DOS,
if you have a standard IDE Parallel ATA controller,
and if you haveone of the following file systems : Fat32, Iso9660 or Ext2;
if you are willing,[then] please can you tell me:
- did the program worked ?
- were you able or un-able to do things ?
- have you seen any bugs[bunny] ?

[For me it works as expected, but different vendors might provide a tiny-little-bit-stuff-difference ... resulting in : program is not working ...]

best regards ...

[for USB Mass Storage Devices in DOS, my program uses DOSUSB.COM, but for the debuger uses my UHCI driver...]
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Re: FileSystemD for DOS HD&DVD&USB-and now usb debug

Post by Mihail_B »

When using FS with :
A) win32 nt ,
* you can select the desired PHYSICALDRIVE[num] by
entering IDE SLOT as [num]
using [TRUE_IDE] as driver name

* you can select the desired CD/DVD drive by
going to main_menu->explore_cd/hd_image, selecting ATAPI_DRIVE
as interface and entering win32 path "\\.\D:" (if D is the drive letter
for your CD/DVD) when you are asked for an iso9660 image name

B) dos ,
* for INT13H_DRV(aka BIOS standard read/write),
you can select desired by
entering IDE SLOT as [BIOS drive number]
for e.g. : 128(0x80) is the number for first fixed disk (or usb drive if
you booted from an usb flash) while 0 (0x00) is the number for the first floppy disk

*for DOSUSB_DRV
you need to enter the ADDRESS of the USB device as IDE SLOT

C) linux ,
* you will be asked for the name of disk ...
type there the linux path for it
(aka "/dev/hda1", "/dev/dvd", "/dev/sda1")
using [TRUE_IDE] as driver name (hardware_inteface)
[you can go directly to main_menu->explore_cd/hd_image
and write this when you are asked for an image filename]

When using DOS version of FS in DOS
you can use USBEBE from inside FS (main menu->USB Devices) or
start the standalone file USBEBE.EXE
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Re: FileSystemD for DOS HD&DVD&USB-and now usb debug

Post by DOS386 »

Mihail_B wrote:Latest versiob : 2.5 : added USB DVD/CD support in DOS using DOSUSB.COM, some fixes.

Note about version 2.4: - version 2.4 contains updated built-in UHCI USB controller driver ! you will now be able to setup any transaction with your usb devices ! for more info please read readme.txt file, inside fs-2.4.zip - for now only for experts - i promise a higher level implemetation for future release
Some tests:

- USB doesn't do too must useful, can't read out stick name nor capacity, then TripleFault ... :boom:
- Can read out HardDisk names ... but not capacity ... some (probably frauded) CHS values are listed
- Can't read out CD/optical drive names
- Still prints much garbage on various occasions, when displaying content of sectors or files, please provide "text" and "hex" modes, in both remove faulty chars (ZERO -> space | 1...31 and 127 to 255 -> dot), in hex organize in lines per 16 Byte's

Do you plan to remove the DOSUSB.COM dependency completely ?
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Re: FileSystemD for DOS HD&DVD&USB-and now usb debug

Post by Mihail_B »

DOS386 wrote:
Mihail_B wrote:Latest versiob : 2.5 : added USB DVD/CD support in DOS using DOSUSB.COM, some fixes.

Note about version 2.4: - version 2.4 contains updated built-in UHCI USB controller driver ! you will now be able to setup any transaction with your usb devices ! for more info please read readme.txt file, inside fs-2.4.zip - for now only for experts - i promise a higher level implemetation for future release
Some tests:

- USB doesn't do too must useful, can't read out stick name nor capacity, then TripleFault ... :boom:
- Can read out HardDisk names ... but not capacity ... some (probably frauded) CHS values are listed
- Can't read out CD/optical drive names
- Still prints much garbage on various occasions, when displaying content of sectors or files, please provide "text" and "hex" modes, in both remove faulty chars (ZERO -> space | 1...31 and 127 to 255 -> dot), in hex organize in lines per 16 Byte's

Do you plan to remove the DOSUSB.COM dependency completely ?
Huh ! hihihi

I'll start with the last part:
Q: "Do you plan to remove the DOSUSB.COM dependency completely ?"
A: No ! I'm planning a better support ! Using a piece of driver that you know that it is always going to be updated, get fixed, new features is a WISE choice !
I'll be provideing my own driver for UHCI[any maybe one day EHCI] but with limited support and warranty !
DOSUSB.COM is a comercial software, and Georg is always adding new features so it's a good choice for usb programmers !

the other stuff that you noticed ... :

N: CAN'T read out CD/DVD optical [DRIVE] names (aka LG,SAMSUNG,SONY,TRANSCEND, or what ever other provider) ?
A: It can read PATA ATAPI CD/DVD drive names [uses get_ide_atapi_info] it's an ide cmd sent to 0x1f7/0x177 ... !
it will display the information provided by command

Code: Select all

Type atapi_prop Field=1 'This record is returned BY IDE when ATAPI IDETIFY drive command is send to 0x1f7/0x177.
	As UShort general_cfg,_
	cylinders,_
	reserved1,_
	heads,_
	unformat_bytespertrack,_
	unformat_bytespersector,_
	num_sectorpertrack,_
	reserved2,_
	reserved3,_
	reserved4,_
	serial_num(1 To 10),_
	buffer_type,_
	buffer_size,_
	ecc_byte_avail,_
	firmware_rev(1 To 4),_
	model_num(1 To 20),_
	multiple_sector_command_count,_
	dword_io,_
	capabilities,_
	reserved5,_
	pio_transf_cycle,_
	dma_word_transf_cycle,_
	field_validity,_
	num_cylinders,_
	num_heads,_
	num_sector_per_track,_
	cap_sectors(1 To 2),_
	reserved6,_
	multiworddma,_
	enhancedpio_modes,_
	min_multiworddma,_
	recomand_multiworddma,_
	min_pioxferwofctrl,_
	min_pioxferfctrl,_
	reserved7(69 To 255)
End Type

Code: Select all

...
 mov al,&hA1 'ATA command ATAPI IDENTIFY
 mov dx,&h1f7
 Out dx,al
 ...
...
...
      mov dx,&h1f0
      mov edi,[p]
      mov ecx,255
      cld
      push edi
      rep insw ' finally read :)
      pop edi
this is going to be displayed ! and nothing else ...

(deh ... I could use INQUIRE for a discovered CD/DVD drive of any type PATA,SATA,USB and put the name out there .... can't I ? well I'll make that change as soon as I have time for it - I'd already planned that long time ago ... but ... USB cd/dvd suport was not ready at that time ...)

------
something else ....
HARDDRIVR LENGTH :

Code: Select all

      ...
      mov al,&hec
      mov dx,&h1f7
      Out dx,al
      ...
      ...
      ...
      mov dx,&h1f0
      mov edi,[p]
      mov ecx,255
      cld
      push edi
      rep insw ' finally read :)
      pop edi
      ....
and this it displays :

Code: Select all

Type ide_prop Field=1 'This record is returned BY IDE when IDETIFY drive command is send to 0x1f7/0x177.
	id1 As UShort '0
	cylinders As UShort '1
	id2 As UShort '2
	heads As UShort '3
	id3(1 To 2) As UShort '4
	sect_per_track As UShort '6
	id4(1 To 3) As UShort '7->9
	serial_number As String * ((19-10+1)*2) '10 -> 19
	controller_type As Ushort '20
	controller_buffer_size As Ushort '21 -> realsize = (dword) bufsize*512  
	ecc_transferred As UShort '22
	controller_number As String * ((26-23+1)*2) '23->26	
	model_number As String*((46-27+1)*2) '27->46
	num_sect_per_int As ushort '47
	dword_trasfer_flag As UShort '48	
End Type
...
...
...
Dim As ide_prop ip
...
...
...
...
get_ide_info(i,k,@ip)
..
..
...
..
*d2->identifier="("+z1+") {ide:"+Str(i)+", mast_bit:"+Str(k)+"} "+Str(culng(CULng(ip.cylinders)*CULng(ip.heads)*CUlng(ip.sect_per_track)) Shr (20-9))+" MB "

SO this stuff from my sources - I used them to display info about a PATA drive .
This is stuff from the spec ... and it works for my desktop computers ...

What can I say ? Can you send my your PC ?! ... a second hand P3-450Mhz costs only 33$ ....

just jokeing ! ah .... that life for PATA !

BUT ! you can use INT13_DRV instead ! it will use BIOS (but you will be restricted to the first 8gb of the HD and so on)

...
I am helpless ! and human too ... need more hardware to do tests on !
... hihihi

But the developmente continues ... With the version 2.6 released today at 9:00am(=my clock : EEST+2) ... which now has a functional
cache for big drives ....

Version 3.0 will have network support such that one can have access to partitions/tracks remotely ...
And also a GUI for chooseing easly the drive that you want (... who heard about TRUE_IDE, VFILE_IDE, INT13_DRV, DOSUSB_DRV ?! I'll use some friendly common names that anyone can understand what it is all about !)

PS:
for this reason I added up more support for WIN32/LINUX 'cause they have drivers for all kind of drives ... that's life ...

The purpose of my program is to enable users to recover files from cracked cd/dvd,from garbaged FAT32 drives ....
and for developers as a cross platform to apply advanced stuff on drives (like for a lib to help someone to build a defragmenter or a dosfsck, or a file recovery, or stuff like that ...)
PS2: i'm actually advertising DOSUSB ! yes ! go buy it ! you will get a good DOS USB driver ! with USB 3.0 support . if you pay more you can get the SOURCE CODES too ! You'll get suport on Georg's FORUM for any trouble that you have using it !
[anyone can download the demo version which is completly functional but it works only 15-20min and then game over !]
PS3: I'm glad you are back ! I googled for you and noticed some new releases ... I also googled for your facebook account ? is that you
"Jack R Ellis" ?
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

PS2: i'm actually advertising DOSUSB !
How do you detect for it ? I had a long discussion with Georg and finally convinced him to add a Sigi for this purpose (but still waiting for 2.0 final version).

Please add something like "detect DOSUSB.COM by Georg Potthast" into your tool, and explicit select/report USB suppport: native (UHCI only so far) or via DOSUSB driver.
PS3: I'm glad you are back ! I googled for you and noticed some new releases ... I also googled for your facebook account ? is that you
"Jack R Ellis" ?
I'm not "Jack R Ellis" and don't have an account at F*C*-BOOK.

PS: still using XDMA 3.1 from 2005 http://www.ibiblio.org/pub/micro/pc-stu ... udma/xdma/
Mihail_B
Posts: 273
Joined: Jan 29, 2008 11:20
Location: Romania
Contact:

Post by Mihail_B »

DOS386 wrote: I'm not "Jack R Ellis" and don't have an account at F*C*-BOOK.
DOS386 wrote:
Mihail_B wrote:xcdrom/udma ? they only have (?) suport for parallel ata controllers not to serial ata ...(?)
No, I wrote XDMA32 and XCDROM32 http://www.japheth.de/Download/Jemm/JEMM575S.zip and UIDE ...
??????!!!!!!!

Then who are you ... ?
in the file xcdrom32.asm it is written :"by Jack R Ellis"
------
I'll add that detection stuff [I think I'd already tried in the past, but the PC was getting BLOCK/STUCKED/etc when DOSUSB is not loaded ...
[When the stuff will be ready I'll look for a magic number inside the DOSUSB interupt]

------
My built in driver is only used for the debugger [main menu ->usb devices]
for usb devices I use DOSUSB -> USB Bulk only interface : [CBW - SCSI - DATA - CSW] ... and that's all.

PS: ok I got it it's written "based on" /// aha ! then you are DOS386 ?
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

Mihail_B wrote:
DOS386 wrote:No, I wrote XDMA32 and XCDROM32
??????!!!!!!!
I meant XDMA32 and XCDROM32 ;-) I'm not the author of those ...
I'll add that detection stuff [I think I'd already tried in the past, but the PC was getting BLOCK/STUCKED/etc when DOSUSB is not loaded ...
This was the bugged 1.xx "detection" method. 2.xx should have a Sigi that you can reliably inspect before firing the INT.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Post by DOS386 »

Code: Select all

        ; BP points to string "DOSUSB" "| "ccintind" is $60
        ; Check driver Sigi (reference pointed by ES=CS and BP set above)

        ; Driver can be at INT $60 to $67 giving addresses $0180 to $019C
        ; Don't accept "off" > $FFF0 to prevent GPF !!!

int_search:
        movntq ax, 0
        mov    al, [ccintind]     ; DS==CS
        shl    ax, 2              ; MUL by 4 | INT index -> IVCT address
        xchg   si, ax             ; MOVNTQ SI, AX | AX ???
        movntq ax, 0
        mov    ds, ax             ; ZERO-based | Trashing DS !!!
        lodsw                     ; AX off
        cmp    ax, $FFF0
        ja     short gpf_no_thanks
        xchg   dx, ax             ; DX off | AX ???
        lodsw                     ; AX seg | DX off
        mov    si, dx             ; SI off | DX off | AX seg
        mov    ds, ax             ; DS:SI found stuff | Trashing DS !!!
        xchg   bx, ax             ; SI off | DX off | BX seg | AX ???
        lodsw                     ; Skip JMP SHORT | SI off | DX seg | AX ???
        mov    cx, 3
        mov    di, bp
        repe   cmpsw              ; Sets flag(Z) like CMP
        pushf
        mov    di, dx             ; DI off | BX seg

        ; Peek date (can be invalid) into DX and CH

        lodsw                 ; AL Y | AH M
        xchg   dx, ax         ; DL Y | DH M | AX ???
        lodsb                 ; AL D | AH ???
        mov    ch, al         ; CH D
        movntq ds, cs         ; Restoring DS !!!

        ; Got target address in DI and BX (may be invalid)
        ; Got date in DX and CH (may be invalid)
        ; Got comparison status in PUSHF'ed flag(Z)

        popef
        je     short dr_found ; DS is already restored !!!

gpf_no_thanks:
        movntq ds, cs         ; Restoring DS !!!
        inc    byte [ccintind]
        cmp    byte [ccintind], $68
        jne    short int_search

        call   drv_evil_pr
        db     "Driver not found", 0
        ;---------------------------

dr_found:

        ; Got target address in DI and BX
        ; Got date in DX and CH (may be invalid)

        call   @f
        db     "Driver found at INT ", 0
@@:     pope   si
        call   ssprintsi
        mov    al, [ccintind]
        call   ssdhex8
Post Reply