Mail Archives: djgpp/2009/02/20/03:31:57
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | Jim Michaels <jmichae3 AT yahoo DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | help on using dosmemput, dosmemget, anything like it
|
Date: | Fri, 20 Feb 2009 00:23:53 -0800 (PST)
|
Organization: | http://groups.google.com
|
Lines: | 100
|
Message-ID: | <ee2cff56-e99b-4028-a775-5bb3917bf8d2@b38g2000prf.googlegroups.com>
|
NNTP-Posting-Host: | 76.115.70.155
|
Mime-Version: | 1.0
|
X-Trace: | posting.google.com 1235118233 23634 127.0.0.1 (20 Feb 2009 08:23:53 GMT)
|
X-Complaints-To: | groups-abuse AT google DOT com
|
NNTP-Posting-Date: | Fri, 20 Feb 2009 08:23:53 +0000 (UTC)
|
Complaints-To: | groups-abuse AT google DOT com
|
Injection-Info: | b38g2000prf.googlegroups.com; posting-host=76.115.70.155;
|
| posting-account=05hOMwoAAAB6R8xtiQKzEljSMzgOhVF1
|
User-Agent: | G2/1.0
|
X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6)
|
| Gecko/2009011913 Firefox/3.0.6,gzip(gfe),gzip(gfe)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Background:
I have no revision control (my fault), and I did something to make my
bios disk routines not work. it has gone through several fixes and
revisions.
problem may be that I am using a different compiler (djgpp current
instead of 2.03 or 2.04), or it may be the code change.
The code seemed (?) to work on an IDE based computer, but not with my
SATA drive. SATA drives used to work with this program (I wrote to
the SATA drive
with this program once).
question:
what are the steps for doing BIOS disk I/O, for a write and a read?
what I currently have is the following:
write:
//constructor
setup structure
allocate buffer in memory (malloc)
point structure to __tb{seg,ofs}
bufallocated=true
//member function
set starting absolute block number
//put buffer x to class member function
if buffersize >
_go32_info_block.size_of_transfer_buffer-2*BYTES_PER_SECTOR then
reject
realloc buffer based on buffersize
if not successful then reject
memcpy(buffer, x, buffersize)
//putToDosMem member function
dosmemput(buffer, numdiskblocks*BYTESPERSECTOR, __tb
+BYTES_PER_SECTOR)
dosmemput(&structure, sizeof(structure), __tb)
structure.addressoftransferbuffer=__tb
//ExtendedWrite function
//putdostomem function
dosmemput(buffer, numdiskblocks*BYTESPERSECTOR, __tb
+BYTES_PER_SECTOR)
dosmemput(&structure, sizeof(structure), __tb)
structure.addressoftransferbuffer=__tb
//get segment and offset calls (member functions)
setup registers for int 13h call
dpmi_int(0x13, ®isters)
//updateafterdiskio member function
//getfromdosmem member function
dosmemget(__tb+BYTES_PER_SECTOR, numdiskblocks*BYTESPERSECTOR,
buffer)
dosmemget(__tb, sizeof(structure), &structure)
set number of blocks read or written
if registers' carry flag set,
return error code in ah
else
return true
delete buffer
read (pretty much same except for setting up registers is different
for read than write):
//constructor
setup structure
allocate buffer in memory (malloc)
point structure to __tb{seg,ofs}
bufallocated=true
//member function
set starting absolute block number
//put buffer x to class member function
if buffersize >
_go32_info_block.size_of_transfer_buffer-2*BYTES_PER_SECTOR then
reject
realloc buffer based on buffersize
if not successful then reject
memcpy(buffer, x, buffersize)
//putToDosMem member function
dosmemput(buffer, numdiskblocks*BYTESPERSECTOR, __tb
+BYTES_PER_SECTOR)
dosmemput(&structure, sizeof(structure), __tb)
structure.addressoftransferbuffer=__tb
//ExtendedRead function
//putdostomem function
dosmemput(buffer, numdiskblocks*BYTESPERSECTOR, __tb
+BYTES_PER_SECTOR)
dosmemput(&structure, sizeof(structure), __tb)
structure.addressoftransferbuffer=__tb
//get segment and offset calls (member functions)
setup registers for int 13h call
dpmi_int(0x13, ®isters)
//updateafterdiskio member function
//getfromdosmem member function
dosmemget(__tb+BYTES_PER_SECTOR, numdiskblocks*BYTESPERSECTOR,
buffer)
dosmemget(__tb, sizeof(structure), &structure)
set number of blocks read or written
if registers' carry flag set,
return error code in ah
else
return true
delete buffer
- Raw text -