Post Reply 
Undocumented card reader function?
07-02-2024, 08:09 AM
Post: #1
Undocumented card reader function?
Hi all,

When examining the ROM code for the 82104 Card Ceader, I have stumbled upon an undocumented instruction (at least I have found no reference to it).
The main source for the specific peripheral instructions that I have found is the Programmers Handbook (page 17).

But in the Card Reader ROM, and also in the Service ROM they are also using the instruction 0x268 (WRIT 9 aka REGN=C 9).

My conclusion is that this instruction checks if the motor is running, and if so sets the interrupt flag:

Code:
268 WRIT 9(Q) - set CardReader interrupt flag if the motor is running

But, this is only an educated guess - it might be something completely different!
Maybe "set flag while hardware is busy" ... ?

E.g., see the following part of the code, the comments are added by me (the definitions of the instructions are taken from the Handbook), but the interpretation of REGN=C 9 is mine.

Code:
 EBE0 2E53B0                GSUBNC  ECB9           Select CardReader
 EBE2 028                   REGN=C  0              End write cycle
 EBE3 0A8                   REGN=C  2              End read cycle

 EBE4 328                   REGN=C  12             Stop the motor

 EBE5 268                   REGN=C  9              Set flag if motor is running? (TBD)
 EBE6 32C                   ?CDRD                  CardReader interrupt flag?
 EBE7 03B                   GONC    +7  EBEE       No, lets continue ...
 EBE8 226                   C=C+1   X              Increment timeout value
 EBE9 02F                   GOC     +5  EBEE       Continue if timeout (after 3843 loops)
 EBEA 160                   ?LLD                   Set flag on Low Bat
 EBEB 3CF                   GOC     -7  EBE4
 EBEC 368                   REGN=C  13             Start the motor (restart?)
 EBED 3C3                   GONC    -8  EBE5       Try again ...

 EBEE 328                   REGN=C  12             Stop the motor

 EBEF 268                   REGN=C  9              Set flag if motor is running? (TBD)
 EBF0 32C                   ?CDRD                  CardReader interrupt flag?
 EBF1 3F7                   GOC     -2  EBEF       Loop forever while flag is set ...

Is there another source for the Card Reader instructions?
The Service Manual for the card reader doesn't contain details like this, and I have not seen any documented VASM listings for the ROMs (82104 Card Reader or the Service Module).

Does anyone have any more detailed information about the peripherals instructions?

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
07-02-2024, 11:19 AM
Post: #2
RE: Undocumented card reader function?
I got a hint from Mike, that the instruction is mentioned in the Zenrom Manual (p 127).
That manual indicates that the instruction checks if a card is inserted ("Fetch Card IN Flag").

Then the code would be interpreted like this:

Code:
 EBE0 2E53B0                GSUBNC  ECB9           Select CardReader
 EBE2 028                   REGN=C  0              End write cycle
 EBE3 0A8                   REGN=C  2              End read cycle

 EBE4 328                   REGN=C  12             Set card trip flag

 EBE5 268                   REGN=C  9              Is card inserted? (TBD)
 EBE6 32C                   ?CDRD                  CardReader interrupt flag?
 EBE7 03B                   GONC    +7  EBEE       No card, lets continue ...
 EBE8 226                   C=C+1   X              Increment timeout value
 EBE9 02F                   GOC     +5  EBEE       Continue if timeout (after 3843 loops)
 EBEA 160                   ?LLD                   Set flag on Low Bat
 EBEB 3CF                   GOC     -7  EBE4
 EBEC 368                   REGN=C  13             Test and clear card trip flag
 EBED 3C3                   GONC    -8  EBE5       Try again ...

 EBEE 328                   REGN=C  12             Set card trip flag

 EBEF 268                   REGN=C  9              Is card inserted? (TBD)
 EBF0 32C                   ?CDRD                  CardReader interrupt flag?
 EBF1 3F7                   GOC     -2  EBEF       Loop forever while card is inserted ...

That makes a little more sens ...

* Wait until a card is inserted with a timeout (EBE5-EBED).
* Set card trip flag.
* Then wait while card is inserted.


Looking at the two lists, there are some differences (e.g. instruction 328 and 368).
The Zenrom list looks a little bit more likely and closer to the real thing.

Code:
Inst| Mnemonic from Zenrom Manual               | Programmers Handbook
----+---------+---------------------------------+---------------------------------------------
028 | ENDWRIT | End write cycle                 | end write cycle
068 | STWRIT  | Start write cycle               | start write cycle when motor is running
0A8 | ENDREAD | End read cycle                  | end read cycle
0E8 | STREAD  | Start read cycle                | set read mode
168 | CRDWPF  | Fetch CaRD Write Protect Flag   | set CardReader interrupt flag if card is write protected
1E8 | CRDOHF  | Fetch CaRD Over Head Flag       | set CardReader interrupt flag if there is a card and the motor is running
268 | CRDINF  | Fetch Card IN Flag              | (missing)
2E8 | TSTBUF  | TeST card read BUFfer           | read mode: clears interrupt flag if a record can be read
2E8 | TSTBUF  | TeST card write BUFfer          | write mode: sets interrupt flag if a record can be written to buffer
328 | SETCTF  | SET Card Trip Flag              | stop the motor
368 | TCLCTF  | Test and CLear Card Trip Flag   | start the motor
3E8 | CRDEXF  | Fetch CaRD reader EXternal Flag | set CardReader interrupt flag if the CardReader external flag is set
----+---------+---------------------------------+---------------------------------------------

I will try to map the flags to the actual switches and sensors in the reader, maybe it will make more sense.

Anyone else who have some more info on these instructions?

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
07-03-2024, 03:43 AM
Post: #3
RE: Undocumented card reader function?
It's very sad that the Card Reader VASM listing, once available from PPC, does not seem to have survived anywhere accessible. One of the Australian clubs listed it as being in their library, but I've never managed to contact anyone associated with the club.

After I reverse-engineered the HP-67/97 CRC (Card Reader Controller), with help from the late Jacques Laporte, I intended to add 82104A support to Nonpareil, but unfortunately never got around to it (as with many of my intended projects).
Find all posts by this user
Quote this message in a reply
07-03-2024, 03:46 AM
Post: #4
RE: Undocumented card reader function?
(07-03-2024 03:43 AM)brouhaha Wrote:  late Jacques Laporte ?
I didn't know he passed away !. I had quite a few email conversations with him in the past, his knowledge of the classic series, especially HP35 and the classic power supply were extraordinaty. When did he pass away ?

Thanks
John
Find all posts by this user
Quote this message in a reply
07-03-2024, 06:07 AM (This post was last modified: 07-04-2024 06:52 AM by ThomasF.)
Post: #5
RE: Undocumented card reader function?
Hi Eric,

Yes, that is a pity, would have been a nice document to have along with the other VASMs.

(07-03-2024 03:43 AM)brouhaha Wrote:  I intended to add 82104A support to Nonpareil, but unfortunately never got around to it

My intention is not to emulate the card reader, it is more that I like to understand how the Card Reader ROM works - and improve my own MCode skills ... Wink
To emulate (which I think would be quite easy with the Pico41), one would need an easy way to read the cards somehow - e.g. some kind of card-reader attached to the Pico41 or a PC.

When I did the Wand emulation it was much more obvious - creating a software bar code scanner was easy and made sense - i.e. I can scan any bar code from any scanned document and send it to the 41 with just the Pico41 and a piece of software.

But how could that be done with magnetic cards ... ? Maybe a "magic carpet" could do the trick?
I searched for "Magnetic Field Viewer" and found some "Card Magnet Detector Pattern Display" - but I guess that the resolution is not good enough to see the pattern on these cards.

Update: Maybe this could be a solution?
The resolution seems good enough - but still quite some work (and expensive) to be done for each card ...

With the amount of cards out there it would be a great idea - but I can't visualize a simple solution ...

That is to say apart from just because we can ... Wink

Cheers,
Thomas

[35/45/55/65/67/97/80 21/25/29C 31E/32E/33E|C/34C/38E 41C|CV|CX 71B 10C/11C/12C/15C|CE/16C 32S|SII/42S 28C|S 48GX/49G/50G 35S 41X]
Find all posts by this user
Quote this message in a reply
07-04-2024, 03:39 PM (This post was last modified: 07-04-2024 03:47 PM by BobVA.)
Post: #6
RE: Undocumented card reader function?
(07-03-2024 06:07 AM)ThomasF Wrote:  Update: Maybe this could be a solution?

I see what you did there :-)

(Very interesting discussion! A box that could adapt an HP-41 card reader to a USB or serial interface would be extremely useful. Besides archiving cards it would be nice to write programs on the PC and export them to the 67/97.)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)