## Card reader HP-67 conversion functions

The Beta programme is where a device becomes fully formed. If you have any suggestions for features to integrate into the DM41X then feel free to make them here. We can't guarantee that they'll all end up in the final product but we'll certainly consider all sensible proposals.
rprosperi
Posts: 1070
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

### Re: Card reader HP-67 conversion functions

The ROMs in modules w/integrated hardware always touch the h/w when they are initialized (each turn-on of the device) to ensure that everything is working properly (e.g. no card is inserted, barcode scanner LED isn't burned-out, etc.), so the problems alluded to above will occur before you could do anything, so it's more difficult than simply avoiding certain commands. Plus sooner or later someone would use the 'bad' commands, leading to data loss and other troubles.
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
dlachieze
Posts: 261
Joined: Thu May 04, 2017 12:20 pm
Location: France

### Re: Card reader HP-67 conversion functions

I tried to see if there was a minimum list of changes needed for the existing Card Reader module to make it compatible with the 41X and it was indeed quite quick and simple to get the 67 conversion functions working on the 41X

Here is what I've done:
• extract the ROM from the Card Reader mod file with the MODFile utility
• with SDK41 running in DOSBox:
• disassemble the .rom file with D41 to get a source file located in page E
• replace the polling vectors at EFF6 and EFF8 with nop, to remove the calls to the hardware initialization routines
• pach the non-67 functions with RTN as the first instruction to ensure any hardware related code cannot be executed inadvertently
• change the module revision to 1X (for the 41X )
• change the functions address in the FAT from Exxx to 0xxx to ensure the linker will correctly locate all the code on page E. I stumbled on that issue after doing all the changes to the source file and found that changing the addresses in the FAT was a quick and simple solution to the linker moving these addresses out of page E in the final ROM.
• assemble the modified source file with A41 to get a .obj file
• link the .obj file to create a .rom file in page E with L41
• with the MLDL2K utility, create a new MOD file with the patched rom, duplicating the original MOD file settings with the exception of the Hardware field set to 0 - No Additional hardware
So, here is the new Card Reader 1X module for the DM41X. I've tested it quickly under V41 and then on my 41X and it seems to work fine with the dice67.raw file from the hpmuseum library which includes some of the 67 conversion functions.

This module which loads on page E as the original one, includes all the Card Reader functions with the same XROM numbers, however all functions related to the card reader operations are just plain NOPs, when called they just return without executing any code as there is no associated hardware emulated in the DM41X.

CR1X.bmp (12.31 KiB) Viewed 600 times
Card-rdr1X.zip
DM42: 00425 - DM41X: β00066
EM41
Posts: 162
Joined: Mon Mar 30, 2020 12:10 am
Location: Overijssel Netherlands

### Re: Card reader HP-67 conversion functions

Thanks a lot, I will give it a try as soon as possible.
I assumed something like this could be done but I could never have done this easily myself.

Erik
HP41C (2x), HP41CV, HP41CX, DM41X β, DM41X, DM42, HP11C, HP48G, HP97
rprosperi
Posts: 1070
Joined: Mon Apr 24, 2017 7:48 pm
Location: New York

### Re: Card reader HP-67 conversion functions

Nice work Didier!!

I'm fully confidant that "quite quick and simple" is deep understatement, so please admit it was not simple and take credit where it is well-deserved.

I must say I didn't really think anyone would take up this challenge, but also must admit I didn't expect to find it cool that the DM41X can actually run HP-67/97 programs unchanged. But I do find it cool!

Well done and my impressed thanks for sharing this!
--bob p

DM42: β00071 & 00282, DM41X: β00071 & 00656, DM10L: 071/100
dlachieze
Posts: 261
Joined: Thu May 04, 2017 12:20 pm
Location: France

### Re: Card reader HP-67 conversion functions

rprosperi wrote:
Sat Jul 25, 2020 12:38 am
Nice work Didier!!
Thanks !
rprosperi wrote:
Sat Jul 25, 2020 12:38 am
I'm fully confidant that "quite quick and simple" is deep understatement
Well not really, you nailed it down in your previous post :
rprosperi wrote:
Sun Jun 28, 2020 7:43 pm
The ROMs in modules w/integrated hardware always touch the h/w when they are initialized (each turn-on of the device) to ensure that everything is working properly [...] Plus sooner or later someone would use the 'bad' commands, leading to data loss and other troubles.
So there was two things to change: remove the calls to the initialization routines and patch the "bad" commands to ensure that the card reader hardware related code could not be executed, for that a simple RTN replacing the first command instruction does the job.

Then to implement the changes you just need to be familiar with the HP 41 ROM structure and with a m-code development tool such as SDK41 which includes the detailed ROM structure in its documentation. I didn't develop any personal ROM but I got some knowledge through this project a few years back. I had to refresh my memory and reinstall the tools but it was all done in a couple of hours.

The SDK41 disassembler (D41) creates nice source listings making very easy to locate each function and replace the first instruction with a RTN. For example with RDTA, the function starts with the name in reverse order before the function entry point followed by the instructions, I replaced the instruction at address E204 with RTN, and I did just that for each of the non-67 functions.

Code: Select all

				.NAME	"RDTA"
*E200 081			#081		; "A"
*E201 014			#014		; "T"
*E202 004			#004		; "D"
*E203 012			#012		; "R"
E204 3E0			RTN
E205 03B			GONC	+7 E20C
For the initialization routines the calls locations are documented in the SDK41 appendix C.

So I encourage everyone to play with the 41 ROMS and development tools, you can try to reproduce what I did with the card reader ROM and you'll learn a lot just doing that.
rprosperi wrote:
Sat Jul 25, 2020 12:38 am
Well done and my impressed thanks for sharing this!
Well. it's peanuts compared to the achievements of m-code gurus such as Ángel or Håkan !
DM42: 00425 - DM41X: β00066
EM41
Posts: 162
Joined: Mon Mar 30, 2020 12:10 am
Location: Overijssel Netherlands

### Re: Card reader HP-67 conversion functions

Tested with a few different programs and it works fine.
This rom should be standard included with the DM41X.
Thanks again Didier absolutely brilliant.

Erik
HP41C (2x), HP41CV, HP41CX, DM41X β, DM41X, DM42, HP11C, HP48G, HP97
pcscote
Posts: 142
Joined: Tue May 02, 2017 12:12 pm

### Re: Card reader HP-67 conversion functions

HP-82104A Card Reader Owner's Manual Compatibility Details

Execute SIZE 026 to provide 26 registers R00 through R25 for HP-67/HP-97 compatibility.

Following is a list of the specific operations that cannot be translated or that will not operate the same on the HP-41C as they do on the HP-67/HP-97.
1. Any program attempting rapid reverse branching will result in the NONEXISTENT display when execution is attempted.
2. Programs that must be initialized manually by storing data into the A, B, C, D, E, or I registers will work properly only if the data values are placed into the corresponding HP-41C data storage registers according to the register correspondence table shown on page 38.
3. The HP-67/HP-97 program sequence
X = Y ?
1
2
normally results (in the HP-67/HP-97) in the number 12 in X if the test is true and the number 2 in X if the test is false. This sequence will not work properly on the HP-41C since it skips the entire number string instead of the individual digits of the number.
4. Programs that call more than three subroutine levels on the HP-67/HP-97 will not function the same way on the HP-41C. The HP-41C accepts subroutine calls up to six levels deep.
5. When merge is followed by a pause in an HP-67/HP-97 card program, once translated the pause is not useful. The HP-41C always stops and prompts for a card when programmable read functions are executed in programs.
6. The pause length on the HP-67/HP-97 is extended by any keystroke. PSE on the HP-41C is continued only if the keys pressed are normally used for data entry (e.g., numbers, ALPHAs, CHS EEX , etc.)
7. As the result of the standard deviation function approaches zero, the validity of the result decreases. For standard deviations near zero the HP-67/HP-97 could give meaningless small values. In these cases, the HP-41C displays OUT OF RANGE and program execution halts.
8. HP-67/HP-97 write data will be translated to a standard HP-41C WDAT . Programs that do not do standard sequential writes of the primary and secondary storage registers will not execute properly.
9. Programs that merge data using the HP-67 I-register will not operate properly. The HP-41C uses RDTAX and the X-register for similar purposes.
10. HP-67/HP-97 data or program cards cannot be merged.
11. When the HP-41C automatically switches from fixed notation to scientific notation for the display of small or large numbers, the number of digits displayed is determined by the current fix format (FIX 0 through FIX 9). The HP-67/HP-97 uses SCI 9 for this purpose.
12. The HP-41C compatibility function 7PRTX reformats just-keyed-in numbers before printing them on the optional system printer. The HP-97 function PRINTX prints the number just as it was keyed in.
[DM1x/DM1xL/DM41/DM41L/DM41X/DM42]
daShier
Posts: 3
Joined: Thu Nov 19, 2020 1:39 am

### Re: Card reader HP-67 conversion functions

What great work!

I have been playing with a few old 41 programs that were written with the 67 functions in place. Your module saves a fair bit of time translating.

This would be a great addition to the DM41X built-in set of modules.

--David
dlachieze wrote:
Fri Jul 24, 2020 5:39 pm
I tried to see if there was a minimum list of changes needed for the existing Card Reader module to make it compatible with the 41X and it was indeed quite quick and simple to get the 67 conversion functions working on the 41X

CR1X.bmp

Card-rdr1X.zip