Discussion:
Reading/writing hard disks directly in LBA mode
(too old to reply)
Ruud
2011-06-07 06:20:43 UTC
Permalink
Hallo allemaal,


I have a project that enables someone to replace the floppy drive of a
Commodore 1541 drive with an IDE hard disk drive. 170 KB versus up to
128 GB :) To keep the workload for the onboard computer ( 1 MHz 6502,
2 KB RAM) to a minimum I only use LBA drives and kept the original
Commodore file system.

First problem: filling the HD with data. Copying floppies in the old
way is sloooow. I made images of most of my floppies anyway and these
are stored on my PC. So I solved the problem by using a removable hard
disk. I bought two and placed one case in the 1541 and the other in a
PC. Of course the PC is not familiar with the Commodore FS so I wrote
a Pascal program that enables me to exchange data with the HD using
direct I/O programming.

It has occured to me to use INT 13h to read/write sectors but AFAIK
INT 13h only supports only the Cylinder/Head/Sector mode. But
yesterday I found out about AH=42h: Extended Read Sectors From Drive,
source: Wikipedia. Promising but.... what is it counterpart; writing
sectors?

Any other ideas are welcome as well!


Kind regards, Ruud Baltissen
Frank Kotler
2011-06-07 07:09:40 UTC
Permalink
Ruud wrote:

...
Post by Ruud
It has occured to me to use INT 13h to read/write sectors but AFAIK
INT 13h only supports only the Cylinder/Head/Sector mode. But
yesterday I found out about AH=42h: Extended Read Sectors From Drive,
source: Wikipedia. Promising but.... what is it counterpart; writing
sectors?
AH=43h.

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


Best,
Frank
Ruud
2011-06-07 13:11:06 UTC
Permalink
Hallo Frank,
Post by Frank Kotler
http://www.ctyme.com/intr/rb-0710.htm
Thank you !!!


Groetjes, Ruud Baltissen
Rick C. Hodgin
2011-06-07 07:18:41 UTC
Permalink
Are you trying to read/write from/to the hard disk directly from the C64? Or just update the commodore file system from the PC?

If you want to bypass standards and make your own custom solution, here's an idea: Write a tiny app on the C64 which reads media from the floppy drive locally, and then sends it through some port (serial? parallel?) externally to the regular PC, which then serves as a network storage device. The same app can be used to read data from the external PC, which requests files.

Apart from that, I'm not sure how you'll handle the timing issues associated with direct I/O writes without using some custom ARM-like chip which you can program as the go-between to reads the burst data to a cache, and then feed it to the C64 as the far slower device is able to receive. Especially with only 2KB RAM, as LBA is large block addressable, which is a cluster of 512-byte sectors, which I believe are minimally 4KB each.

The external network solution seems to be the far better solution because that way your data is easily accessible to/from other machines using a standard file system, and the server handles the requests and conversion on a machine that's far easier to program in than the C64. In fact, you could use a C64 emulator to run code from your system to develop everything on the PC before installing it on the C64 for execution.

Also, are there any native C64 ethernet devices? I remember it had plug-in cartridge modem support. If you can find a cartridge that does Ethernet, you'll be there. And you could probably build one pretty cheap using a tiny off-the-shelf ARM motherboard that supports programmable input/output ports and already has a built-in ethernet. A person would just need to setup a protocol between C64 and the external ARM I/O device, and read/write within that protocol to/from the C64 app which is running in memory.

Sounds like an interesting project though.

- Rick
Ruud
2011-06-07 13:09:34 UTC
Permalink
Hallo Rick,
Post by Rick C. Hodgin
Are you trying to read/write from/to the hard disk directly
from the C64?
No. In 1999 I developed an interface that can do just that:
http://www.baltissen.org/newhtm/c64ide.htm but due to compatibility
problems, software accessing directly the hardware instead through the
BIOS, I dropped this project. Instead I installed the HD inside the
1541 floppydrive: http://www.baltissen.org/newhtm/1541ide.htm .
Basicaly I replaced all routines that accessed the hardware related to
the original floppy with routines that accessed the IDE HD. So in the
beginning I only had a 170 KB harddisk :) Then I added some commands
enabling me to divide an HD into as many partitions of 170 KB I
needed.
The Commodore file system is able to support "floppies" up to 16 MB.
This was done by telling the drive that was dealing now with a
"floppy" with 254 tracks and 256 sectors/track. To handle this amount
of data I introduced subdirectories. And still using the original file
system as base!

Star Commander, http://sta.c64.org/ , enable people to create images
of their floppies. These imagines were originally meant for back-up
purposes but the moment emulators were developed, they were used as
"floppies" as well. Having thousands of images myself, I didn't even
think of using another file system for my hard disk system.
Post by Rick C. Hodgin
Apart from that, I'm not sure how you'll handle the timing issues
associated with direct I/O writes without using some custom ARM-like
chip which you can program as ....
My project is already old fashioned. Please have a look at:
http://1541ultimate.net/content/index.php and scroll down. The little
PCB emulates a 1541 plus some extras and uses SD-cards or USB-media as
storage. The onbard FPGA doesn't only emulate the original 6502 but
another CPU that handles the data.
My 1541IDE is 95% compatible, 1541Ultimate 99,9%.
Post by Rick C. Hodgin
Also, are there any native C64 ethernet devices?
http://home.ica.net/~leifb/commodore/ethernet.html for example. But
they never became popular.


Groetjes, Ruud Baltissen
Rod Pemberton
2011-06-07 21:15:06 UTC
Permalink
Post by Ruud
[...]
I dropped this project. Instead I installed the HD inside the
1541 floppydrive: http://www.baltissen.org/newhtm/1541ide.htm
From your newer page:
http://www.baltissen.org/newhtm/1541ide8.htm

"The first one was that there wasn't a well documented
source code of the 1541 file system available.
It turned out that I had to create it myself first."

And here is your 1541 ROM Listing:
http://www.baltissen.org/files/1541.asm

Wow! Are you serious?

I guess you weren't aware of Abacus' 1980's books for the C64 and 1541.
They have complete ROM listings. I've got both books packed up in the
basement somewhere. No, I'm not digging them out. I have them, the C64
programmers reference manual, and 1541/C64 schematics from Sams.

Wikipedia lists the books as:

"The Anatomy of the 1541 Disk Drive" by Lothar Englisch and Norbert
Szczepanowski, Abacus Software, 1984
"The Anatomy of the Commodore 64" by Lothar Englisch, Dr. Achim Becker, and
Michael Angerhasuen, Abacus Software, 1983-4

Apparently, they are English translations of the books from German versions
published by Data Becker GmbH & Co.

In the early '90's a online magazine for C64 hardware modification called
C=Hacking was available.
http://www.ffd2.com/fridge/chacking/
http://www.csbruce.com/~csbruce/cbm/hacking/

Of course, Transactor, which I never got to read, was the major C64 hardware
modification magazine.
Post by Ruud
The Commodore file system is able to support "floppies" up to 16 MB.
This was done by telling the drive that was dealing now with a
"floppy" with 254 tracks and 256 sectors/track. To handle this amount
of data I introduced subdirectories. And still using the original file
system as base!
Interesting ... I always thought the C64 filesystem was scalable to higher
capactities. Commodore's filesystem apparently was used in business class
computing machines which used larger capacity drives. Of course, the
filesystem and your extensions is suitable topic for alt.os.development.
Post by Ruud
My 1541IDE is 95% compatible, 1541Ultimate 99,9%.
Isn't that the solutiion: buy the commercial product? I.e., you're putting
effort into this stuff, but you could just throw some money at the problem
and have it just go away ... Whatever C64 software is produced by other
people for the hardware, will be produced for the commercially available
hardware.


Rod Pemberton
Rod Pemberton
2011-06-07 22:48:06 UTC
Permalink
Post by Rod Pemberton
Post by Ruud
[...]
My 1541IDE is 95% compatible, 1541Ultimate 99,9%.
Isn't that the solutiion: buy the commercial product? I.e., you're putting
effort into this stuff, but you could just throw some money at the problem
and have it just go away ... Whatever C64 software is produced by other
people for the hardware, will be produced for the commercially available
hardware.
Now that we're way OT... These C64 projects may interest you:

This seems to be a C64 floppy USB adapter.

xum1541
http://rdist.root.org/2009/01/21/introducing-xum1541-the-fast-c64-floppy-usb-adapter/

This one appears to be a C64 for USB mass-storage devices. It looks like a
1541 cable is connected too...

USB-64
http://www.luigidifraia.com/c64/usb-64/index.html

HTH,


Rod Pemberton
Ruud
2011-06-28 14:44:50 UTC
Permalink
Hallo Rod,
Post by Rod Pemberton
Wow! Are you serious?
I guess you weren't aware of Abacus' 1980's books for the C64 and 1541.
They have complete ROM listings.  
I know of these and many more books, even in Dutch. But they all have
one problem: the source is on paper. I needed one in E-form so i could
change it :)


Groetjes, Ruud
Lasse Reichstein Nielsen
2011-06-30 18:05:39 UTC
Permalink
Post by Ruud
Hallo Rod,
Post by Rod Pemberton
Wow! Are you serious?
I guess you weren't aware of Abacus' 1980's books for the C64 and 1541.
They have complete ROM listings.  
I know of these and many more books, even in Dutch. But they all have
one problem: the source is on paper. I needed one in E-form so i could
change it :)
A quick search for "commodore 1541 rom listing" found lots of rom
disassemlies on the web. :)

I think I still have my photocopy of a book version of that somewhere :)
/L
--
Lasse Reichstein Holst Nielsen
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Ruud
2011-06-29 18:27:33 UTC
Permalink
Post by Rod Pemberton
I guess you weren't aware of Abacus' 1980's books for the C64 and 1541.
They have complete ROM listings.
I know them and many others, even in Dutch. Problem: it are books and
I needed the sources in e-form so I could change them to create my own
ROMs/BIOSes.

Ruud
Rod Pemberton
2011-06-07 21:12:17 UTC
Permalink
Post by Ruud
I have a project that enables someone to replace the floppy drive of a
Commodore 1541 drive with an IDE hard disk drive. 170 KB versus up to
128 GB :) To keep the workload for the onboard computer ( 1 MHz 6502,
2 KB RAM) to a minimum I only use LBA drives and kept the original
Commodore file system.
Their are/were a number of such solutions on the internet years ago. In my
opinion, what's really needed is a modern interface, such as USB. Then, you
could connect your C64 directly to a x86 PC which would act as file storage
device. There'd be no need for custom serial, parallel, or other
interfaces. There'd be less need for special software (serial) or drivers
(Ethernet). Or, you could access USB sticks, USB harddrives, or Ethernet
NAS (network attached storage) directly from the C64, if it had USB. A few
years ago I determined that every device in an x86 PC has a version that
uses USB, except for the cpu and memory: keyboards, mice, soundcards, video
cards, ethernet, dvd/cdrom, etc. What that means is an embedded x86 PC only
needs USB ports. The same would be true for C64. So, USB is the way to
go... There are lots of cheap, simple, and popular home project
microcontrollers that have a single USB port or Etherent port on their
cards. You might look for Arduino, BASIC Stamp, Parallax, PICAXE, etc.


Rod Pemberton
Ruud
2011-06-29 19:28:19 UTC
Permalink
Post by Rod Pemberton
I guess you weren't aware of Abacus' 1980's books for the C64 and 1541.
They have complete ROM listings.
I know these books, and many others as well, even in Dutch. But they are books and I needed the sources as ASM so I could alter them to my taste.

Ruud
Loading...