[NTLK] PCMCIA for the brave...

Victor Rehorst victor at chuma.org
Tue Nov 15 08:46:29 PST 2022


On 2022-11-14 15:41, Mark Kuberski wrote:
> I wanted to create a dump of a 256MB PCMCIA Card,
>
> To be used with Einstein you have made available under PC Cards + Add existing PCCard Image...

If the card is really a Linear Flash card and not an ATA or CompactFlash 
card, it is quite difficult to do this.

I have dabbled in this - the last time was a year or two ago I think - 
and it's not a simple thing to do.  My route was to setup a very old 
laptop (is c. 2006 "very old"?) with a CardBus slot and a vintage Linux 
distribution. After many attempts with ancient DOS/Windows software and 
somewhat newer Linux 4.x based distributions, I finally came across this 
page which had a lot of useful information on getting this setup working:

https://uop.whoi.edu/UOPinstruments/frodo/fedora2-pcmcia-setup.html

I managed to use this information with an install of Fedora 28 as Linux 
4.14 still has the PCMCIA MTD driver in the source tree. I was finally 
able to read the raw bytes off of a linear flash card, without any pesky 
file systems or other translation layers getting in the way. It was 
definitely not straightforward:

- I had to make changes to the Linux kernel driver (pcmciamtd.c) and 
recompile it to recognize my SRAM cards.
- Sometimes I would have to force load the right command set driver into 
Linux, similar to the procedure in the page linked above.
- Reading card memory in this way produced data that was byte-swapped in 
a weird way - the Newton's ARM CPUs are big-endian and read/write 32-bit 
words exclusively, but my card dumps from Linux seemed to assume 
little-endian 16-bit words.  Meaning, if NewtonOS had written these 
bytes in hex (32-bit word)

DE AD BE EF

to the flash card, when I dumped the card and viewed the file contents I 
was reading back

AD DE EF BE

Or to put it another way, the string "Untitled" would be read as 
"nUitltde" which is, like, hooray, now I get to write a script to 
byte-swap and hope that I get it right :/

I don't recall dumping a card and then successfully getting Einstein to 
use the image though.

On the other hand, if the card is an ATA or CompactFlash card, a Linux 
machine with a CardBus or PCMCIA slot will see it as a disk with no 
recognizable partition structure. Reading the raw blocks is relatively 
straightforward.  However I don't think you'll be able to use a dump of 
such a card with Einstein, as ATA Support for NewtonOS doesn't store 
data on such a card in the same format as linear flash. Also, Einstein 
would have to emulate an ATA card (supporting its command set etc) so 
that ATA Support can recognize it, and that has simply never been 
implemented.

Of course, if I'm wrong about any of the above, I'm sure that Matthias 
will correct me eventually...

-Victor



More information about the NewtonTalk mailing list