fachat / xd2031 Goto Github PK
View Code? Open in Web Editor NEWA filesystem server for Commodore 8-bit computers
A filesystem server for Commodore 8-bit computers
XD-2031 - Serial line filesystem server for CBMs ------------------------------------------------ V0.9.x, Feb 2022 NOTE: This software is in the middle of a re-org. Wear your hard hat This software enables to program an AVR AtMega device to play the role of a disk drive to a Commodore PET computer with IEEE488 interface, a disk drive for the serial-IEC-based machines like the C64, the C128 and others. XD-2031 consists of two main parts, an AtMega firmware, and a PC server. Both communicate via a serial line. Currently this hardware is supported: - XS-1541 Communication via serial line over USB - petSD Communication via serial line over USB - petSD2 Communication via serial line over USB For more information see the README files in the subdirectories Building -------- To build the firmware image, see the README file in the firmware directory. To build the server side code, see the README file in the pcserver directory. Testing ------- To build the tests, simply run "make tests" in this directory. Please note that the (growing) number of tests has some that fail - that is partly due to sampling test data from a CBM DOS, that is buggy itself (like the blkaf1/blkaf2 tests do not allocate blocks on disk on the 4040 emulation...) Using ----- To use the PC as disk drive, the Commodore must be connected to one of the supported devices running the firmware part. This device must be connected to the PC, usually with a serial-over-USB connection. The server can then be configured with some command line options: -d <devicepath> path to the serial device where the server communicates with the firmware -A<drv>:<provider-string> This "assign" command allows defining what is behind a "drive" in Commodore terms. The code allows for using ten different drive numbers (as opposed to the common two), so you can have drive numbers 0-9. The provider-string is special in that it defined what is then used as drive content. It consists of a provider name, and a parameter string for the provider. A provider can be "fs" for the local file system, "tcp" for a TCP/IP connection, or "ftp" or "http" for their respective protocols. Here are examples and descriptions of their parameters: fs=<directory-path> assigns a local directory to a drive tcp=<hostname> assigns a host name to a drive, any OPEN then opens the port given as OPEN file name ftp=<hostname>[/<path>] http=<hostname>[/<path>] assigns an FTP or HTTP path to the drive. Only FTP supports reading a directory though. -X<bus>:<cmd> send an 'X'-command to the specified bus, e.g. to set the IEC bus to device number 9 use: -Xiec:U=9 "<bus>" can normally be "iec" or "ieee" (or "sock488" for the socket-based test version of the firmware". Another interesting commands are -X<bus>:*=+ enable the use of advanced wildcards -X<bus>:*=- disable the use of advanced wildcards -X<bus>:E=- -X<bus>:E=+ disable/enable the drive number if the channel 15 error messages, also restrict number of digits for track and sector to two -XR Reset the device If the device as non-volatile configuration memory, these commands are also available: -XI restore default values from NV-RAM -XW write configuration to NV-RAM Please note that you can use the X and A commands also on the command channel, from the Commodore machine side. OPEN15,8,15,"A9:fs=foodir" or PRINT#15,"XU=9" You can leave out the bus here, as the command is given to the bus that receives the command. Notes ----- - With the XS1541 hardware all hardware attached to the device on the bus you want to use must be switched on on reset. I.e. if you want to use the IEEE bus, all IEEE devices must be switched on, the same holds for the IEC bus. You can switch on the devices on the other bus later, but if you switch a device off, the device hangs. This is due to the switched off devices pulling down the ATN line, blocking the XS1541 Copyright --------- The code is under GPL V2. Please note that the PC server part is also available on later versions of the GPL, the AtMega firmware is ONLY(!) available under GPL V2. (C) 2012,2014 Andre Fachat <[email protected]>, Ingo Korb, Thomas Winkler, Nils Eilers and others! Please see the individual files for specific copyright notices. ROADMAP -------- Here are some ideas about what can be implemented. For and more current information see also the github issues list on: https://github.com/fachat/XD2031/issues?state=open Planned features for Release 1.0 -------------------------------- - direct channel support (U1/U2 commands) -> done - SD card provider on the atmega side -> started - D64 support on the server side, to be able to use D64/D80/D82 etc files -> done - IEC support so C64 et al can use the device -> done for C64, done for C128, and VIC20 still to test - Use other providers without ASSIGN before, e.g. LOAD"sd:filename",8 -> done (for http/ftp/tcp) - bidirectional file support, together with TELNET functionality -> done - store configuration parameters in EEPROM -> beta - set configuration parameters from the PC -> done - and various other small improvements Further plans ------------- With the ASSIGN command it is possible to assign drive numbers (like the "0" in "$0") to different service providers. Some of those will be in the atmega, some will be on the PC side. Currently there is only one in the atmega, the one that connects via RS232-over-USB. On the PC side there currently are five, filesystem, disk images, plain TCP as well as FTP and HTTP. All those providers basically implement the "wireformat" protocol, so it is a clearly separated responsibility. If you are willing to help with one of these ideas, feel free to contact me! In the future these providers can be implemented: - A D64 provider on the atmega side, to use D64/D80/D82 etc files from the SD card - An iec provider - so a PET can "call out" to a serial IEC floppy - And vice versa, an ieee provider and a serial iec bus interface to allow e.g. the C64 to use an IEEE488 disk - A remote FS provider on the PC side: connect to a remote "wireformat" server On the XS1541 I'm actually willing to sacrifice the parallel user port connector (for C64 fastloaders) in favour of a device number switch, an SD card interface, and maybe a serial configuration PROM. Further ideas: - support a non-parallel fast loader for the C64 (e.g. Jiffy-DOS?) - M-R/W feature to mimic existing drives (to fool copy programs, possibly change unit address via M-W) REFERENCES ---------- XS-1541: The hardware by T. Winkler is described here: http://xd2031.petsd.net/xs1541.php petSD: The hardware by N. Eilers is described here: http://petsd.net sd2iec: Some files in this firmware are derived from the sd2iec project by I. Korb http://www.c64-wiki.com/index.php/sd2iec_%28firmware%29 cURL: The cURL library is used to implement internet communication, esp. the HTTP and FTP protocols. You can find it at http://curl.haxx.se/
Allow to use a ".xd2031" file to control the display of the directory. For example to define which file is first, order of other directory entries, etc.
Was hältst Du von der Idee, eine .xd2031 - Datei im aktuellen Verzeichnis zu unterstützen?
Das könnte eine reine Text-Datei sein, die beim Wechseln in das Verzeichnis eingelesen wird und neben #;Kommentaren eine Reihe von Befehlen beinhalten kann.
Mit *=DATEI könnte man dort die "erste Datei" zuweisen.
Später könnte man dort auch andere Optionen geben, die zum Betrieb des darin enthaltenen Programms notwendig sind, wie etwa Disk-Change-Informationen, wenn sich ein Programm über mehrere Disketten-Seiten erstreckt.
works on IEC though
If the device is powered by the CBM (e.g. petSD connected to tape port) and the CBM doesn't have a reset key, a power cycle will disconnect the device. fsser stops exection then without a word what happend.
A user might not expect that a "reset" (okay, it's a power cylce) will stop XD-2031.
fsser should try to re-open the device. This could be difficult if it started with root rights and droped rights later. At least, it should give a hint, why it stopped.
Looks like parse_filename() ignores '@'
cd:Projekte fails, cd 0:Projekte works.
-----8<----------8<----------8<----------8<----------8<----------8<-----
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
ERR:Did not find provider for cd:Projekte
: COMMAND: CD:{d0}ROJEKTE
: Setting status to: 68,GENERAL FAULT,00,00
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
INF:CHDIR(Projekte)
: COMMAND: CD 0:{d0}ROJEKTE
-----8<----------8<----------8<----------8<----------8<----------8<-----
should give a "file exists" error instead
Wanted: progress bar with some extra information (start address, % of file pointer) when loading files.
This would be especially useful for the rather slow IEC bus.
All we see at the moment is:
INF:OPEN_RD(16->fs:dangerfreak)
INF:open file for fd=16 in dir /home/pi/XD2031/tools with name dangerfreak
INF:CLOSE_SEND_EOF(16)
INF:CLOSE(16)
Wanted: fsser command line option that enables logging of the complete bus traffic / file contents.
This is the server output of a single '@':
-----8<----------8<----------8<----------8<----------8<-----
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
: COMMAND:
: Setting status to: 30,SYNTAX ERROR,00,00
: Received error on open/cmd!
-----8<----------8<----------8<----------8<----------8<-----
Haven't checked this yet--maybe an "empty" command doesn't contain a valid one and thus gives a 30,SYNTAX ERROR?
... because where is the EOF on those ones?
Just came from implementing FS_RENAME for the FAT provider.
It works just like Linux mv command, meaning: it can rename/move files/directories. Tested: yes, it can even move and rename directories at once, e.g: @r:/foo=/somewhere/else/bar
Instead of limiting the command capabilities by checking if the command contains a path separator, I'd further like to rename FS_RENAME to FS_MOVE and allow this "officially". This implies a few changes to pcserver/fs_provider, since rename() cannot move files across file systems.
Approval?
Commodore DOS obviously did.
This breaks Ctrl-D "toggle active drive"
Running the "u1test" test code, the IEC on the C128 gives DEVICE NOT PRESENT on random stages of the program. The program runs fine on the C64.
... to allow seek() for any file
Sending the -X command options automagically from the server to the device is not request/response and has problems with reentrancy.
Probably make it so that after RESET or trigger from the server, start pulling in the options one by one.
What about reloading the pcserver part - should the device always reset here to get the default values?
: COMMAND: CD:/
: CMD=CD
: DRIVE=-
: NAME={ff}/
: ACCESS=R
: TYPE=-
DBG:Change dir to: /
INF:Calculate new dir path: /Users/j/Projekte/tmp//
DBG:Checking that new path '/Users/j/Projekte/tmp' is under base '/Users/j'
file size 1541: 142 blocks
file size fsser: 140 blocks
... e.g. with an assign option to the directory path (see other issue about wildcard option)
Support direct buffers in the AtMega firmware, as this seems to be the only way to really support it - buffers can be shared across drives, so the firmware is the only place to do it.
CBM DOS allows multiple dir masks, separated by commas.
If three files TEST, TEST1 and TEST10 would exist, LOAD"$:TEST1?,TEST" would give TEST and TEST10, but not TEST1.
Beyond that, CMD and sd2iec interpret some dir masks allowing passing of options:
=H --> include hidden files (not included by default)
=T --> include time stamps
=B / =D --> show only directories
=P --> show partitions (IHMO not applicable for XD-2031), but
=A could show what is assigned to each drive
edit 2012-05-07:
Further options for sorting the directory (alphabetically / chronologically) would be nice.
Static "1 blocks free" breaks COPY-ALL, because it thinks there isn't sufficient free space.
Free space could be determined with statvfs(), but must not be greater than 63999 blocks free.
... so you can leave the "other" bus switched off when you only want to use one.
Currently IEEE hangs when switched off IEC devices are connected and vice versa, because ATN (and all other lines) are constantly pulled low
First implementation on server side, but such that it can be shared with firmware
Implement relative file support. Open files like relative files enables the FS_SEEK functionality
Maybe Pi?
But that there's at least the CBM UK business keyboard lacking the Pi.
The wireformat cmd IDs still reflect the original OS/A65 numbering, where the read/write/eof are added as an afterthought, as in OS/A65 they are on a separate channel. However, with the addition of the drive byte as first byte of a name, they are not compatible anymore anyway.
We should
a) straighten out the numbers of the FS_* to let them start from 1 and all positive
b) put wireformat.h and errors.h into a /common directory to be included in firmware as well as in pcserver
I think this should be done before any larger announced version, so we stay (more?) compatible in later releases.
Agreed?
SAVE"/NOTTHERE/",8 gives:
: OPEN FILE: FOR CHAN: 1 WITH NAME: /NOTTHERE/
: NAME=/NOTTHERE/
: ACCESS=R
: CMD=0
INF:open file for fd=1 in dir /Users/j with name /notthere/
DBG:malloc_path: base=/Users/j, name=/notthere/
INF:Calculate new dir path: /notthere/
DBG:Check that path '//' is under '/Users/j/'
ERR:Path '//' is not in base dir '/Users/j/'
ERR:ERROR RETURN: 67
: provider_lookup for {7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}{7f}
DBG:Got 0 options to send:
: Config read from EEPROM
: sent reset packet on fd 125
:
:
: ### PETSD/XD2031 v0.9.1 ###
: 14425 Bytes free, 18432 kHz
: Fuses: l=F7 h=D2 e=FF l=FF
:
:
:
: channel_close(0 -> 1), push_state=2
Like 'OPEN1,8,2,"HTTP:HOSTNAME:PATH" instead of the assignment to a drive and then the open on the drive.
Unlike *NIX/DOS/Windows, Commodore DOS ignores everything after *.
The user should have the option to choose among these behaviors with a X-command.
dr-xr-xr-x 2 j staff 68 23 Okt 00:08 newdir/
... because of prepended "0:" in the from path
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.