Displaying String on Free42 & DM42
02-04-2018, 10:30 PM (This post was last modified: 02-04-2018 10:33 PM by Bill (Smithville NJ).)
Post: #1
 Bill (Smithville NJ) Senior Member Posts: 347 Joined: Dec 2013
Displaying String on Free42 & DM42
This is a cross post that I did on the Swiss Micros Forum. I normally do not cross post, but I felt there might be some people here who might be interested in this also and who might not visit the other forum. The routines described here will also work on the Free42 but are of course limited to the smaller screen.

While the DM42 has a beautiful screen and capability to display multiple lines to it, the HP-42S programming leaves a lot to be desired in the way information can be presented to the screen.

I’ve been wondering how I was going to make use of this additional screen real estate when wawachief posted his Sudoko program demonstrating that numeric digits could be drawn on the screen. I have taken this idea further by creating some font and screen display routines.

FONTS –

Creates a 1 x 128 Matrix Table “CH” for storing the alpha characters.
Each element had the five alpha characters that are used to draw a Font Character to the screen.
Note: “CH” starts at 1 and not zero. So each Character is stored at one higher than its character code.
Label “99” is used.

DISPLAY –
Displays the Alpha Register onto the screen.
Upon entry, the Alpha Register contains the string to display and Register “P” contains a complex number which is the screen coordinate.
Labels 97 and 98 are used.
Register “00” is used for the ISG looping.
Registers 101 to 145 are used indirectly for storing the index value into the “CH” matrix array.
Note: SIZE must be set to at least 150.

I have created a sample program STRING that calls FONTS, then loops 15 times displaying the value of PI at various points on the screen.

Code:
 00 { 78-Byte Prgm } 01▸LBL "STRING" 02 XEQ "FONTS" 03 2 04 STO "GrMod" 05 CLLCD 06 1.015 07 STO 01 08▸LBL 01 09 CLA 10 8 11 RCL× 01 12 7 13 - 14 ENTER 15 COMPLEX 16 STO "P" 17 "PI= " 18 RCL 01 19 2 20 ÷ 21 FIX IND ST X 22 PI 23 ARCL ST X 24 XEQ "DISPLAY" 25 ISG 01 26 GTO 01 27 END

Code:
 00 { 82-Byte Prgm } 01▸LBL "DISPLAY" 02 ALENG 03 X=0? 04 RTN 05 100 06 + 07 1ᴇ3 08 ÷ 09 101 10 + 11 ENTER 12 STO 00 13▸LBL 97 14 ATOX 15 1 16 + 17 STO IND 00 18 R↓ 19 ISG 00 20 GTO 97 21 R↓ 22 STO 00 23 INDEX "CH" 24▸LBL 98 25 CLA 26 1 27 RCL IND 00 28 STOIJ 29 RCLEL 30 ARCL ST X 31 RCL "P" 32 AGRAPH 33 6 34 STO+ "P" 35 ISG 00 36 GTO 98 37 RTN 38 END

Code:
 00 { 1374-Byte Prgm } 01▸LBL "FONTS" 02 1 03 128 04 NEWMAT 05 STO "CH" 06 INDEX "CH" 07 "¿¿*¿¿" 08 XEQ 99 09 ""Å¿Å"" 10 XEQ 99 11 "← " 12 127 13 XTOA 14 ├"××" 15 XEQ 99 16 " @>×√" 17 XEQ 99 18 "U*U*U" 19 XEQ 99 20 "AcUIc" 21 XEQ 99 22 127 23 XTOA 24 XTOA 25 ├">Ö¿" 26 XEQ 99 27 "▒|▒|▒" 28 XEQ 99 29 "0HE@ " 30 XEQ 99 31 "PXTRQ" 32 XEQ 99 33 "→¿÷x(" 34 XEQ 99 35 "QRTXP" 36 XEQ 99 37 "Å4ÖÄÅ" 38 XEQ 99 39 " p" 40 168 41 XTOA 42 ├" ?" 43 XEQ 99 44 "← ├ ←" 45 XEQ 99 46 "¿¿*Ö¿" 47 XEQ 99 48 "¿Ö*¿¿" 49 XEQ 99 50 "~  " 51 30 52 XTOA 53 ├" " 54 XEQ 99 55 "H~IA√" 56 XEQ 99 57 "÷↓[LF]↓÷" 58 XEQ 99 59 "xÄÑÄx" 60 XEQ 99 61 "|[LF]μ"}" 62 XEQ 99 63 "|°£°|" 64 XEQ 99 65 "PXdB" 66 XEQ 99 67 ">**"÷" 68 XEQ 99 69 "~≤├IA" 70 XEQ 99 71 "÷÷" 72 XEQ 99 73 "•ÑqPP" 74 XEQ 99 75 "<CBC<" 76 XEQ 99 77 "<A@A<" 78 XEQ 99 79 "U*U*U" 80 XEQ 99 81 "<<<<<" 82 XEQ 99 83 "÷÷÷÷÷" 84 XEQ 99 85 "÷÷_÷÷" 86 XEQ 99 87 "÷π÷π÷" 88 XEQ 99 89 "Å├Å├Å" 90 XEQ 99 91 "$*├*£" 92 XEQ 99 93 "#°¿db" 94 XEQ 99 95 "6IV P" 96 XEQ 99 97 "÷÷π÷÷" 98 XEQ 99 99 "÷Ö"A÷" 100 XEQ 99 101 "÷A"Ö÷" 102 XEQ 99 103 "¿*Ö*¿" 104 XEQ 99 105 "¿¿>¿¿" 106 XEQ 99 107 "÷" 108 176 109 XTOA 110 ├"p÷÷" 111 XEQ 99 112 "¿¿¿¿÷" 113 XEQ 99 114 "÷÷÷" 115 XEQ 99 116 " ←¿▒√" 117 XEQ 99 118 ">QIE>" 119 XEQ 99 120 "÷B├@÷" 121 XEQ 99 122 "bQIIF" 123 XEQ 99 124 ""III6" 125 XEQ 99 126 "ᴇÅ£├←" 127 XEQ 99 128 "'EEE9" 129 XEQ 99 130 "<JII0" 131 XEQ 99 132 "×q≤Σ∫" 133 XEQ 99 134 "6III6" 135 XEQ 99 136 6 137 XTOA 138 ├"II)" 139 30 140 XTOA 141 XEQ 99 142 "÷66÷÷" 143 XEQ 99 144 "÷" 145 182 146 XTOA 147 ├"v÷÷" 148 XEQ 99 149 "¿Å"A÷" 150 XEQ 99 151 "ÅÅÅÅÅ" 152 XEQ 99 153 "A"Å¿÷" 154 XEQ 99 155 "√×Q≤▸" 156 XEQ 99 157 ">A]U↑" 158 XEQ 99 159 "~≤≤≤~" 160 XEQ 99 161 127 162 XTOA 163 ├"III6" 164 XEQ 99 165 ">AAA"" 166 XEQ 99 167 127 168 XTOA 169 ├"AA"Ö" 170 XEQ 99 171 127 172 XTOA 173 ├"IIIA" 174 XEQ 99 175 127 176 XTOA 177 ├"≤≤≤×" 178 XEQ 99 179 ">AAQr" 180 XEQ 99 181 127 182 XTOA 183 ├"¿¿¿" 184 127 185 XTOA 186 XEQ 99 187 "÷A├A÷" 188 XEQ 99 189 "0@@@?" 190 XEQ 99 191 127 192 XTOA 193 ├"¿Å"A" 194 XEQ 99 195 127 196 XTOA 197 ├"@@@@" 198 XEQ 99 199 127 200 XTOA 201 ├"√≠√├" 202 XEQ 99 203 127 204 XTOA 205 ├"▒¿←├" 206 XEQ 99 207 ">AAA>" 208 XEQ 99 209 127 210 XTOA 211 ├"≤≤≤▸" 212 XEQ 99 213 ">AQ!↑" 214 XEQ 99 215 127 216 XTOA 217 ├"≤Æ)F" 218 XEQ 99 219 "&III2" 220 XEQ 99 221 "××├××" 222 XEQ 99 223 "?@@@?" 224 XEQ 99 225 "πᴇᴇπ" 226 XEQ 99 227 127 228 XTOA 229 ├" ᴇ ├" 230 XEQ 99 231 "cÅ¿Åc" 232 XEQ 99 233 "∫▒x▒∫" 234 XEQ 99 235 "aQIEC" 236 XEQ 99 237 "÷├AA÷" 238 XEQ 99 239 "√▒¿← " 240 XEQ 99 241 "÷AA├÷" 242 XEQ 99 243 "▒√├√▒" 244 XEQ 99 245 128 246 XTOA 247 XTOA 248 XTOA 249 XTOA 250 XTOA 251 XEQ 99 252 "÷∫▒÷÷" 253 XEQ 99 254 " TTTx" 255 XEQ 99 256 127 257 XTOA 258 ├"DDD8" 259 XEQ 99 260 "8DDDD" 261 XEQ 99 262 "8DDD├" 263 XEQ 99 264 "8TTTX" 265 XEQ 99 266 "÷¿~≤√" 267 XEQ 99 268 "ᴇ" 269 164 270 XTOA 271 XTOA 272 XTOA 273 ├"x" 274 XEQ 99 275 127 276 XTOA 277 ├"▒▒▒x" 278 XEQ 99 279 "÷D}@÷" 280 XEQ 99 281 "÷@" 282 128 283 XTOA 284 132 285 XTOA 286 ├"}" 287 XEQ 99 288 127 289 XTOA 290 ├"←(D÷" 291 XEQ 99 292 "÷A├@÷" 293 XEQ 99 294 "|▒8▒|" 295 XEQ 99 296 "|▒▒▒x" 297 XEQ 99 298 "8DDD8" 299 XEQ 99 300 252 301 XTOA 302 ├"$$ᴇ" 303 XEQ 99 304 "ᴇ$$$" 305 252 306 XTOA 307 XEQ 99 308 "|¿▒▒▒" 309 XEQ 99 310 "HTTT\$" 311 XEQ 99 312 "÷▒?D " 313 XEQ 99 314 "<@@@|" 315 XEQ 99 316 "Ö @ Ö" 317 XEQ 99 318 "<@0@<" 319 XEQ 99 320 "D(←(D" 321 XEQ 99 322 "Ö   |" 323 XEQ 99 324 "DdTLD" 325 XEQ 99 326 "¿6AA÷" 327 XEQ 99 328 "÷÷├÷÷" 329 XEQ 99 330 "÷AA6¿" 331 XEQ 99 332 "¿▒¿←¿" 333 XEQ 99 334 127 335 XTOA 336 ├"¿¿¿¿" 337▸LBL 99 338 ASTO ST X 339 STOEL 340 J+ 341 CLA 342 RTN 343 END`

NOTE: I used the DM42 decoder/encoder page to directly edit the byte codes for where the "append" character was in the string. I may also have edited other bytes (can't remember which ones) for some of the other special characters.

Attachment includes RAW files for FONTS, DISPLAY & STRING, plus PDF of Source with comments.

I would appreciate any comments, corrections, suggestions that you may have.

I would also like to thank Thomas Okken for making FREE42 and sharing the source code where I obtained the Character Code font data: bigchars.

Bill
Smithville, NJ

Attached File(s)
02-06-2018, 02:55 AM
Post: #2
 Ken S Junior Member Posts: 4 Joined: Jan 2018
RE: Displaying String on Free42 & DM42
Bill,

Great work! A couple of possibly stupid questions.

Once you have a font matrix on the 42 do you need the 'Fonts' program installed or is it only used to create the matrix?

Does this have to take over the entire screen? Probably not possible but I would love it if you could set the DM42 display to the default X Y or X Menu used by the HP42S and use the upper part of the display for information and status display for the programs you create.

Either way this is an interesting bridge giving more control of the display similar to the HP48.

Ken
02-06-2018, 09:58 PM
Post: #3
 Bill (Smithville NJ) Senior Member Posts: 347 Joined: Dec 2013
RE: Displaying String on Free42 & DM42
(02-06-2018 02:55 AM)Ken S Wrote:  Bill,

Great work! A couple of possibly stupid questions.

Once you have a font matrix on the 42 do you need the 'Fonts' program installed or is it only used to create the matrix?

Does this have to take over the entire screen? Probably not possible but I would love it if you could set the DM42 display to the default X Y or X Menu used by the HP42S and use the upper part of the display for information and status display for the programs you create.

Either way this is an interesting bridge giving more control of the display similar to the HP48.

Ken

Hi Ken,

FONTS is run to create and fill the Matrix with data. Once run, it would not need to be run again, unless you cleared the Matrix variable or did a clear all.

It appears to take over the entire screen. But I haven't really played with it enough to know if there are settings that change that behavior.

Like you, I was looking for a way to more conveniently display multiple results on the screen, instead of doing r/s to see each result or recalling registers to review results.

I'm looking at incorporating the smallchar fonts from the Free42 code. this would allow for subscripts, etc. So it might be possible to say "X2=" where the 2 would subscripted.

Bill
Smithville, NJ
02-07-2018, 02:13 AM
Post: #4
 Ken S Junior Member Posts: 4 Joined: Jan 2018
RE: Displaying String on Free42 & DM42
Bill,

I would really love to be able to use something like this while still having access to the custom program menu keys and the X register. Maybe a new display setting which emulates the original HP42S dispay exactly leaving everything above the display for custom information created by your program.

Something which Swiss Micros would probably have to do, I don't believe Thomas Okken had anything to do with the programming for the large display since his emulator does display exactly as the 42s does.

I will try to experiment with this when I have a bit more time and see what the limitations are.

Thanks again for your work on this,

Ken
02-13-2018, 02:48 AM (This post was last modified: 02-13-2018 02:51 AM by Bill (Smithville NJ).)
Post: #5
 Bill (Smithville NJ) Senior Member Posts: 347 Joined: Dec 2013
RE: Displaying String on Free42 & DM42
I have updated the routines to now include both "Big Char" and "Small Char" fonts as specified in Free42.
I have also changed the way the programs interface. So if you have previously tried these, please download these and review the changes below.
There are two routines:

FONTS.raw: Creates 2 x 128 Matrix "CHARS" for storing alpha characters. Row 1 contains "Big Chars", Row 2 contains "Small Chars"

FONTS just needs to be run once. As long as Matrix "CHARS" remains in memory, no need to rerun.

DISPLAY.RAW: Displays the Alpha Register on the screen at a specific location

Upon entry to DISPLAY, the Alpha Register contains the string to display, and X and Y registers contains screen coordinates, X=Row, Y=Column

The calling program should initialize FONTS (if needed), put a string in the Alpha Register and the screen coordinates into X & Y.

The Display routine includes the ability to switch back and forth between the two Char sizes and to display subscripts and superscripts. The ARROW characters are used as "Mode Change" characters. Just place an Arrow Character in the Alpha String where you wish to switch modes.

Modes are as follows:
Left Arrow - Switch to "Small Chars"
Right Arrow - Switch to "Big Chars"
Up Arrow - Switch to Superscript
Down Arrow - Switch to Subscript

To display the arrows in lieu of doing a mode switch, then put two of them in sequence. Fir example, two Left Arrows in a row would print the Left Arrow on the screen in lieu of switching to "Small Chars".

NOTE 1: DISPLAY ALWAYS starts out in "Big Chars".
NOTE 2: DISPLAY includes a "SIZE 150" command. If your calling program requires a larger SIZE, then you need to change this.
NOTE 3: DISPLAY uses Register 97-99 and 101 - 145.

The attached ZIP file contains FONTS.raw, DISPLAY.raw, S1.raw and S2.raw plus screen images for S1 and S2.

S1 is a sample program that displays both "Big Chars" & "Small Chars" on the screen for comparison purposes.
S2 is a sample program that demonstrates subscripts and superscripts.

Attached file XLS.zip includes excel program listings with my comments.

I would appreciate any comments, suggestions, recommendations that you may have.
There has been no attempt to preserve the Stack. Likewise there are no tricky stack manipulations.

Bill
Smithville, NJ