|Re: USB for HP41C - is it time?|
Message #4 Posted by Frank Wales on 24 July 2006, 8:26 p.m.,
in response to message #3 by mark murphy
Correct - as mentioned the 'primary' focus is simply to upload or download data to the calculator - my understanding was also that mcode could be downloaded into ram and executed.
Just to clarify, the RAM you're talking about here is in the proposed PIC-based module, right? There is no way to run 41 machine code from its own internal RAM.
The key is to be able to write/store/download data into the calculator.
Then might I suggest some alternatives, which could be considered steps on the way to a full-blown 41-USB-PC communications channel.
First, program the PIC to create what looks like available storage to the HP-41, perhaps like Extended memory files, for example. All the HP-41 machine code needed to make this kind of thing work is pretty straightforward.
Then program the PIC to allow those files to be copied to and from a standard memory chip, such as an MMC/SD card. A connection to one of these will run over a handful of wires, and there are probably PIC library modules aplenty that you can use to do the heavy lifting of talking to the memory card, and of exchanging data files with its FAT-format file system.
At this point, you have the means to exchange bulk data between the 41 and any PC via the card, which satisfies your major criterion, as well as giving you the ability to carry lots of data and backups in your wallet.
If you also want a writeable machine code store, implement a portion of the PIC's memory so that it behaves like one or more plug-in ROMs from the 41's point of view, allowing ROM modules to be 'plugged in to' or 'unplugged from' the HP-41 just by doing the right kind of file copy or deletion.
Then, if you program the PIC to expose the files it stores for the 41 as a FAT-format file system over the USB link, the PC can read or write them directly, and the memory card interface can be made optional or removed entirely.
Additionally, if you make the device appear to have multiple drive partitions over USB, some of those could be set up to map to the plug-in ROM addresses. This would allow the PC to write modules directly into the HP-41's address space, satisfying your requirement for downloadable machine code routines. (See further comments below.)
Following a path like the one above means that you don't have to wait until the end of the development process to get something you can use to satisfy your main desire.
Now, nowhere in this scheme is there a direct HP-41<->PC link; instead, the 41 and the PC each see a shared storage area in their own terms. But unless you feel the need to have them exchange data directly, this might be an adequate solution, and is probably much easier to implement than some kind of HP-IL/USB bridge, which I see as being potentially fraught with horrible corner cases in things like error handling and data interpretation.
I, for one, can't think of a single problem worth solving where the HP-41 and the PC have to communicate in real time over the USB link as peers. But, of course, you might want to solve that problem anyway for fun, an activity that I cannot possibly fault.
Finally, I interpret some of your comments to suggest that you'd like to see necessary machine code routines automatically accompanying HP-41 user code (Focal) programs that are downloaded into the module. If so, I strongly recommend that you pre-select the programs on the PC, and get it to build what appear to be fully-formed HP-41 modules with all the necessary machine code routines ready to go, which you then download.
Because of the severe restrictions placed upon you by the HP-41's XROM system design, incrementally updating machine code libraries on the fly for use by arbitrary HP-41 user programs would quickly become non-trivial, even where all the machine code routines have been written to be used in this way. Of course, if you weren't thinking of this, forget the last couple of paragraphs.