From: Ruud <Ruud.Ba...@MUNGED.microcosmotalk.com>
Subject: Accessing large Hard disks
Nntp-posting-date: Fri, 30 Oct 2009 13:28:19 +0000 (UTC)
Nntp-posting-host: 82.168.49.241
Hallo allemaal,
I am a Commodore fan, especially of the older CBM and PET models. Two
hard disks have been produced for these models but a) they are rare
and b) therefore expensive. So I made my own one using an obsolete PC
running W98-DOS and a program written in Turbo Pascal:
http://www.baltissen.org/newhtm/cbmhd.htm
My next project, http://www.baltissen.org/newhtm/1541ide.htm ,
provides an hard disk for the well known Commodore 64, 128 and other
types using the 1541 floppy drive as base. This is all done in 6502
ML.
I decided to do my CBM-HD over again and to create a PC-drive that
starts up from EPROM, just like the other drives. Thus not using a
DOS, TP or whatever, just the BIOS. As a starter I decided to boot
from floppy disk first as that makes me much more flexible in
developing the software.
If you wonder why I want to do it, it is just for fun :) So far the
back ground.
Using Turbo Pascal, I let TP do the dirty work when I needed to access
the HD in one or anther way. In the 1541IDE project I access the disks
using LBA in (if I'm correct) in the PIO mode. Checking my literature
I found out that the original INT 13h is unaware of LBA. Not such a
problem, I'm known with CHS. The first problem is the well known 504
MB barrier. OK, there is something like the INT 13h Extensions. But my
test PC, a what older Toshiba laptop, doesn't have it. Even stranger,
my three year old Dell laptop hasn't it either. (checked with using
INT 13h AH=41h)
I know I can access the HD on the PC in PIO mode as well. But the then
CPU is doing all the work. what about DMA? So my main question: in
what other way can I access the HD and how? And how is my Dell doing
it?
Thank you for your time and help!
Kind regards, Ruud Baltissen
http://ruud.c64.org
"Nathan" <nathan...@MUNGED.microcosmotalk.com> wrote in message
news:4aeafc63$0$4947$9a6e...@unlimited.newshosting.com...
well, it has been a long time since I have messed with the BIOS.
however, most BIOS'es can access the first 8.4GB of the disk via the
1023x255x63 virtual layout.
beyond this:
well, then your BIOS would need to support LBA...
and, further, your BIOS would need to know about the 'double pumping' needed
to access drives > 128GB. I don't know if the people maintaining the BIOS
likely care enough about all this...
I am vaguely remembering a set of BIOS extensions with a much higher
interrupt number (not 0x13) which did support LBA, but I don't remember the
details...
one may be better off writing their own IDE driver to access the entire
drive if needed.
also, for safety sake, be sure there is nothing important on the drive
before trying to implement something like this (an HD driver), as a bug
could easily mess up the contents of ones' drive (actually, this has even
happened with the Windows installer before, where I had an early XP CD which
had managed to play rather badly with the SATA drives I was using...).
(I am vaguely also remembering that when I wrote an OS a number of years
back, I wrote an IDE driver, which I may see if it could be reusable, if
wanted...). if I remember, it was PIO based (did not stall waiting though,
rather it waited for the interrupt and then read).
(or also maybe a VGA driver based on 'tweak', or I think maybe an S3 Virge
driver...).
then again, VESA may be a better bet, ...
another possibility is, if one has free reign over the disk, partitioning it
so that the first 8.4GB or so is left for your emulator/... allowing one to
use the good old BIOS.
In the mean while I changed my mind:
1) Running the program from EPROM sounds nice but undoable for people
not having such a card. And, BLUSH, I forgot that I cannot equip my
laptop with such a car either.
2) Testing with the floppy sounds nice handling real data means
accessing the hard disk anyway.
So I decided to start directly from the hard disk.
But while doing some tests with the floppy, I ran into some trouble:
things went wrong when saving or loading more then 32 sectors to/from
the floppy disk. In that case I gaot error #9, meaning: DMA out of the
64 KB boundary. But 32 sectors =E0 512 bytes is only 16 KB. Did I miss
something ???
Any info is appreciated!
Kind regards, Ruud Baltissen
"Ruud" <Ruud.Ba...@MUNGED.microcosmotalk.com> wrote in message
news:4aec5cf6$0$5670$9a6e...@unlimited.newshosting.com...
It really doesn't matter that it is only 16 KB. The error is that
one of those bytes crossed a physical 64k boundary. You must make
sure that your 16k is within a physical 64k block.
For example, if I were to transfer only 16 bytes, the following
would still give the error:
mov es,00FFFh
mov bx,0000Fh
mov cx,10h
Since the physical address is ((0FFFh<<4)+000Fh) or 0x0FFFFh.
The first byte would still be in the first 64k of RAM, but as soon
as it tried to transfer the second byte, it would error since
0FFFFh + 1 is now 10000h (65536d), in the second 64k of RAM.
Do you see what it means by 64k boundary?
Ben
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Forever Young Software
http://www.frontiernet.net/~fys/index.htm
http://www.frontiernet.net/~fys/collections.htm
To reply by email, please remove the zzzzzz's
Batteries not included, some assembly required.
Oops! I live in terror of doing that. Good job recovering it!
> From: Ruud <Ruud.Ba...@MUNGED.microcosmotalk.com>
> Subject: Accessing large Hard disks
> Nntp-posting-date: Fri, 30 Oct 2009 13:28:19 +0000 (UTC)
> Nntp-posting-host: 82.168.49.241
>
>
> Hallo allemaal,
Hi Ruud,
Fancy running into you here! :)
> I am a Commodore fan, especially of the older CBM and PET models.
My very first computer experience was a VIC-20. 8k ram, of which ~5k was
eaten up by BASIC... No drive at all, intended to save to cassette
recorder, which I didn't have. I made a homemade connector to an
ordinary audio cassette. Worked exactly once - managed to save and
reload a program. Never got it to work again - not a very good
connector, and needed to be at earsplitting volume. I can't say I'm
exactly a "fan", but it brings back memories.
Next came an Atari 8-bitter. Wilhelm Zadrapa sent me an emulator he'd
written for that. Included a 6502 emulator. Let me know if you'd be
interested in looking at that.
On the 64k DMA boundary problem, Deb Wiles has written a
bootsector/loader that checks for 64k boundaries, and reads "as many
sectors as possible" at a time. She makes some assumptions about load
segment alignment, so the exact code may not work for you. Can look at
that here:
http://www.ukcpu.net/Programming/OS/bootsect.asm
It's a really nicely commented bootsector - FAT12 compatible - for
anyone interested in that kind of thing...
Cool "intro" to your page!!!
Best,
Frank
Just for the guys that are helping out with comp.lang.asm.x86...
First, thanks Nathan !!!
Next, thanks Frank !!!
Finally, thanks Ruud !!!
In addition, to Nathan and Frank, I probably should email this,
but that's OK. I am posting it here inline with the thank you
messages. The messages can be saved and stuck into the LIMBO
first. Once they're in LIMBO something else might need to get
done, but I know you guys approve messages in LIMBO all the
time without me having to do anything else. This just goes to
FRANK and NATHAN. Send me an email if you can not get it to
work. Feel free to test it out and try it by sending a reply
inline with this thread. If worst comes to worst, NATHAN has
the right idea, by starting up the newsreader and then doing
the copy and paste as a new message. It's possible I've over-
looked something, so feel free to blame me if it fails!
--
Jim Carlock