zx81 filesystem interface with commodore 1541 drive (zx1541)

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Hi all,

I've seen recently folks discussing how to access files on an SD card with a ZX81. I've had some luck doing this with the ZX1541 interface and a SD2IEC device (such as from https://www.tfw8b.com/product/sd2iec-vi ... ight-grey/).

Pre built ZX1541 inferfaces crop up on sellmyretro.com from time to time and someone posted one to pcbway a while ago but the page doesn't seem to exist any more https://web.archive.org/web/20210125204 ... rface.html

The device lets you load or save .p files to the interface, and can also be invoked from a running BASIC program. As a lot of the filesystem access stuff is offloaded to the device itself and it's a fairly standard device for the ZX81 owners that remain in 2024, I thought I might be a good thing to write code for. :)

I can't find the zip file containing the schematic and rom .asm file on the original website any more, but I've got it saved locally so I thought it would be useful to attach it here. I've had to put it in a multipart zip archive as this forum has a limit of 256kb. You'll also have to rename the parts to 1541.zip.001 and 1541.zip.002 then open 1541.001 in 7zip or something else that can open multipart zip files. This forum also only allows certain extensions. Gah!

By the way, can the attachment size limit be raised from 256kb? That's too low even for retro computer stuff. 512kb or even 1 mb would be nicer as the original file I have is 321.3kb
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

No. This is a forum, but you can create a pull request on github. When pertaining to the z88dk project we are accepting documentation in z88dk-docs, in example.

The 1451 drive was also interfaced to the Sharp MZ computers. I think I still have the Z80 code somewhere for both the ZX81 and Sharp stuff.
Are you offering to test the code on your hardware ?

If, so, we could give it a try.
User avatar
dom
Well known member
Posts: 2223
Joined: Sun Jul 15, 2007 10:01 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by dom »

256kb is a bit low even for some screenshots (crazy!), so I've bumped it up to 512kb. I'd certainly prefer attachments to be here rather than an rate-limiting 3rd party download site.
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Thanks Dom. Sorry for being a pain (again)

I wasn't aware the zx81 target already has support for the ZX1541. I was just thinking about talking to the interface via the zx_line function.

Can this support in z88dk let you do byte by byte file reading? The rom on the interface only has functionality to load or save the whole program as a .p file.

What headers and functions are available? When I was tidying up the zx81 library pages on the wiki a year or so ago I didn't see it mentioned.
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

I probably must rephrase. When I say I have the code, I'm referring to the zx81 and sharp mz specific projects, not to z88dk.
In my information the 1541 is a serial peripheral. possible non-block modes depend on the disk drive capability, probably some sort of random access is either natively possible or it can be emulated with file segments.

Do you have a 1541 connected to a ZX81?
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

I don't actually own a real 1541 drive.

I use a sd2iec device instead with the computers I own. My understanding is on cbm-dos you can read files byte-by-byte, write files byte-by-byte or (in theory) seek disk between 128 byte blocks. This comes from my experience working with the file io functions in cc65 for my zxedit project: https://sourceforge.net/p/zxedit/code/ci/master/tree/

Also, I'm not asking for any new functionality or anything. I just thought I'd point out that zx1541 exists as a vague kind of standard for zx81 disk access because of comments user pdr0663 recently made on this forum about accessing an SD card with a ZX81.

Although if z88dk has specific support for zx1541 devices that are plugged into either a real drive, sd2iec device or uno2iec cable or anything else that talks the commodore serial protocol I'd be interested to learn of it for my future projects. But as z88dk lets you invoke zxbasic on a zx81 a zx1541 will be useable at the basic level without any special support being needed right?

from ZX1541.TXT in zx154man.zip in that zip file I posted:
LOADING AND SAVING FROM WITHIN A PROGRAM
------- --- ------ ---- ------ - -------
To load a program from Basic type this line.
LOAD CHR$ USR 8192"FILENAME"

To save a program from Basic type this line.
SAVE CHR$ USR 8192"FILENAME"
This should with zx_line in the z88dk c libs right?
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

Yes, crossing fingers.
The zx81 BASIC is very close to the Spectrum one but its main loop is way more delicate.
If you have a real zx81 and the 1541 interface it's great news.
You surely can experiment with the z88dk functions for interfacing with basic, the string variables (zx_setstr) should work for a dynamic filename.
By the way I'd try to do more if we're able to test it!
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Cool, thanks. I'm not working on any z80 related projects at present. I just like to check this forum every now and again for interesting stuff. But now I might dig out my zx1541 and do some tests.

For reference, the version I have is the same as the one on this thread: https://sinclairzxworld.com/viewtopic.p ... 0&start=20

I think zx1541 devices are neat as they only need a rom, ram and some 74 series logic to build. I could probably build one myself on a piece of breadboard with the schematic in 1541.zip
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

they are. I find that this Commodore <> zx81 connection requiring PETSCII to ZX81 (non ASCII) conversion for the filenames is a great example on how the personal computing was I the early eighties.
the fact that a similar interface existed for the sharp mz made me think a general driver could be done
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Apparently a 1541 adapter existed for the Mattel Aquarius as well, but I've not been able to find out a lot about it except a brief mention of it at https://www.vdsteenoven.com/aquarius/aquaricart.php and an apparent dump of its rom from an old defunct yahoo groups group. For archival purposes I've attached it here. I'd love to find a schematic or better yet a real device on ebay, but like many retro computing things maybe its just lost to time.

It makes sense many computers had some kind of adapter as 1541 drives are fairly easy to come by and a computer unto themselves that handle the difficult parts of disk handling. Similar to Atari's AIO cabling the commodore IEC protocol was akin to USB in the 1980s. Printers also were available that used it I recall.

Looking at the zx1541 schematic, the pins remind me a bit of the pins on an SD card as well.
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

Interesting, it looks like it extends the BASIC interpreter. IIRC the BASIC ROM was weakely obfuscated, clearly this wasn't preventing extension modules.
1541.png
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

Since we're digging into the micro computing history: this ROM was part of a 1988 project from the Australian HW guru Ron Koenig.

The 6502 is slightly off-topic (unless we think at the Z80Softcard) Rebecca Heineman had her own custom interface for transferring programs between Apple II and Atari
https://www.reddit.com/r/c64/comments/b ... cing_with/
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

IIRC the BASIC ROM was weakely obfuscated
It seems the rom decryption mechanism was know to hobbyists even back then. And there's a rom checksum generator at https://www.vdsteenoven.com/aquarius/romcheck.html
this ROM was part of a 1988 project from the Australian HW guru Ron Koenig
Looking again I've found reference to it in MAME as well, but the commit where the code was added lists it as non working. The Aquarius had a quick disk drive that used extended basic. I wonder if this rom is a modified version of that.

https://github.com/mamedev/mame/blob/ma ... /c1541.cpp
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

I'm still hoping to find someone able to test it in hardware :P
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Wait, that was you? Sorry man I had no idea. Well I'm still looking for that hardware as well. :) I thought that monkey avatar looked familiar.
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

? I just mean that, to be able to progress with z88dk, we need to have a good emulation (it is not the case with MAME) or someone with the right hardware and available for the annoying role of the betatester... better having both.
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by pjshumphreys »

Oh ok. Well like I said, maybe its just lost to time.
velibor
New member
Posts: 2
Joined: Thu Feb 26, 2009 12:05 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by velibor »

Sorry, no english but look at this link:
https://speccy4ever.speccy.org/rom/SDI/ ... oatian.pdf
stefano
Well known member
Posts: 2271
Joined: Mon Jul 16, 2007 7:39 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by stefano »

Wow, It Is yet another disk interface for the spectrum based on a shadow ROM ! :D
velibor
New member
Posts: 2
Joined: Thu Feb 26, 2009 12:05 pm

Re: zx81 filesystem interface with commodore 1541 drive (zx1541)

Post by velibor »

Yes. Historically, idea from ex Yugoslavia, Magazine "Moj Mikro" (Mine Micro). Original prints are here:

1/3 https://retrospec.elite.org/users/tomca ... =MMH_86_05
2/3 https://retrospec.elite.org/users/tomca ... =MMH_86_06
3/3 https://retrospec.elite.org/users/tomca ... =MMH_86_07
Post Reply