HP Forums
41CX's ED: Lower Case & Special Chars patch - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: Articles Forum (/forum-14.html)
+--- Thread: 41CX's ED: Lower Case & Special Chars patch (/thread-8775.html)



41CX's ED: Lower Case & Special Chars patch - Ángel Martin - 08-04-2017 05:33 AM

41CX: Adding Lower Case & Special Chars to ASCII File Editor.

The standard ASCII file Editor on the 41CX has no support for lower case and other special characters. As a consequence, those chars need to be entered first in ALPHA and then manually transferred to the ASCII file using APPCHR or APPREC; either way the user needs to exit the editor, make the manual transfer, and call ED again.

With this patch entering lower-case and special characters is simply done by typing the designated key from within ED itself, no need for intermediate cumbersome steps.

The special chars keyboard layout is the same one available for ALPHA mode on the OS/X Module (and in turn on the original CCD Module) with USER off. There are two conceptual differences though:

1. Since ED uses the USER key to move the cursor one position to the left, that cannot be the mode flag in this case. Activation of the lower case & special chars is done switching ALPHA off instead.

2. With ALPHA switched off, the "native" ED uses the numeric keys to enter digits , radix and the unary minus sign. That is not changed, and therefore imposes a design for the rest of available choices. This forces an inverted scheme for the layout compared to the OS/X, as follows:
  • Special characters are in the same positions as in the OS/X, but accessed using non-Shifted keys. The exception to this rule are the "little men" characters, which use letters [A], [B], [C], and [K] instead.
  • Lower-case letters are accessed using SHIFTED keys - from SHIFT-A for "a" thru SHIFT-Z for "z". The only exception being "l" and "m", which use the non-shifted keys "L" and "M" ( as LBL and GTO are reserved for the insertion mode and go-to-record functions within ED).

Easier to use it than to describe it - specially if you have the old CCD overlay at hand. The important thing is that none of the standard features or character layout of the original ED are altered in any way.

Patching the ROM.

All changes are confined within the bank-switched page of the CX-Extended Functions, i.e. ROM_5B. If you use the 41-CL or an emulator capable of altering the OS sector (like V41), then all you have to do is replace said ROM_5B with the new one containing the patch.

Patching instructions. Three steps are necessary:

Step #1. There are only three bytes to change in the original ED code, which is good news since that code is 1,001 bytes long!. The bytes to change are located at 0x5F62, 0x5EF0 and 0x5EF1; where:

0x5F62 has a jump-if-carry to address 5F51 (37F JC - 17d). The jump distance needs to be changed to point at 5F4C instead, i.e.

5F62 357 JC -22d

0x5EF0/F1 has a call to [BLINK] (265 , 020) - this needs to be replaced with a non-conditional jump to address 0x5BF1:

5EF0 3C5 ?NC GO
5EF1 16E ->5BF1


Step #2. Next we need to add the following code at the jumped-to location (which is conveniently empty in the original ROM), to process the key-presses and triage them accordingly:
Code:
5BDF    1B0     POPADR    get calling address
5BE0    170     PUSHADR   keep it in RTN stack
5BE1    03C     RCR 3     move pg# to C<3>
5BE2    0A6     A<>C S&X  get absolute TBL adr
5BE3    1BC     RCR 11    rotate to ADR field
5BE4    066     A<>B S&X  put reference in A[S&X]
5BE5    11A     A=C M     preserve this address
5BE6    330     FETCH S&X read KEYCODE
5BE7    2E6     ?C#0 S&X  value non-zero?
5BE8    14D     ?NC GO    NO,  Skip one line and RTN
5BE9    032     ->0C53    [SKIP1]
5BEA    23A     C=C+1 M   add offset until 
5BEB    366     ?A#C S&X  are they different?
5BEC    01B     JNC +03   no, exit loop
5BED    23A     C=C+1 M   next addr field
5BEE    3BB     JNC -09   loop back
5BEF    330     FETCH S&X get func. address
5BF0    3E0     RTN       and return
5BF1    066     A<>B S&X  sought-for value
5BF2    130     LDI S&X   beginning of table
5BF3    3F9     CON:      [LWRCAS]
5BF4    1F6     C=C+C XS  "6F9"
5BF5    106     A=C S&X   start of table
5BF6    37D     ?NC XQ    search ADDR in table
5BF7    16C     ->5BDF    [SRCHR1]
5BF8    02B     JNC +05   [GOTCHA]
5BF9    265     ?NC XQ    blink screen
5BFA    020     ->0899    [BLINK]
5BFB    3C9     ?NC GO    return to main code
5BFC    17A     ->5EF2    [CURSR2]
5BFD    106     A=C S&X   replaced char#
5BFE    075     ?NC GO    take over from here
5BFF    17A     ->5E1D    [VALID1]

Step #3. The code above relies on a character table that needs to be added to the ROM. We do this in another empty section, not to disturb any existing code - as follows:

Code:
56F9    041    shift-"A"
56FA    061    "a"
56FB    042    shift-"B"
56FC    062    "b"
56FD    043    shift-"C"
56FE    063    "c"
56FF    044    shift-"D"
5700    064    "d"
5701    045    shift-"E"
5702    065    "e"
5703    046    shift-"F"
5704    066    "f"
5705    047    shift-"G"
5706    067    "g"
5707    048    shift-"H "
5708    068    "h"
5709    049    shift-"I "
570A    069    "i"
570B    04A    shift-"J "
570C    06A    "j"
570D    04B    shift-"K"
570E    06B    "k"
570F    04C    "L"
5710    06C    "l"
5711    04D    "M"
5712    06D    "m"
5713    04E    shift-"N"
5714    06E    "n"
5715    04F    shift-"O"
5716    06F    "o"
5717    050    shift-"P"
5718    070    "p"
5719    051    shift-"Q"
571A    071    "q"
571B    052    shift-"7"
571C    072    "r"
571D    053    shift-"8"
571E    073    "s"
571F    054    shift-9"
5720    074    "t"
5721    055    shift-"U"
5722    075    "u"
5723    056    shift-4"
5724    076    "v"
5725    057    shift-"5"
5726    077    "w"
5727    058    shift-"6"
5728    078    "x"
5729    059    shift-"Y"
572A    079    "y"
572B    05A    shift-"1"
572C    07A    "z"
572D    03D    shift-"2"
572E    10C    "m"
572F    03F    shift-"3"
5730    021    "|"
5731    020    shift-"0"
5732    101    "pi"
5733    064    "D"
5734    05B    "["
5735    065    "E"
5736    05D    "]"
5737    07E    "F"
5738    01F    "spat"
5739    025    "G"
573A    040    "@"
573B    01D    "H"
573C    023    "#"
573D    03C    "I"
573E    028    "("
573F    03E    "J"
5740    029    ")"
5741    05E    "N"
5742    027    " ' "
5743    024    "P"
5744    022    " " "
5745    02D    "-"
5746    05F    "_"
5747    02B    "+"
5748    026    "&"
5749    02A    "*"
574A    060    "t"
574B    02F    "/"
574C    05C    "\"
574D    02C    shift-radix
574E    03B    ";"
574F    03F    shift-"?"
5750    021    "|"
5751    03A    shift-"/"
5752    100    upper "_"
5753    000    <end of table>

That's all there's to it folks - enjoy your enhanced ED+ !

PS. With this enhancement it's possible to enter any formula expression used by the Formula Evaluation module directly in an ASCII record. Refer to the following for details: http://www.hpmuseum.org/forum/thread-8622.html?highlight=formula+evaluation

PPS. To *visualize* the lower-case letters in the LCD you need to use a half-nut machine, and also apply the patch provided by JF-Garnier in the following link:
http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=1205