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
|
|||
|
|||
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:
Code:
Code:
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. SCREEN.bmp (Size: 12.31 KB / Downloads: 130) 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 |
|||
02-06-2018, 02:55 AM
Post: #2
|
|||
|
|||
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
|
|||
|
|||
RE: Displaying String on Free42 & DM42
(02-06-2018 02:55 AM)Ken S Wrote: Bill, 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
|
|||
|
|||
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
|
|||
|
|||
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 Fonts-Display-S1-S2.zip (Size: 4.07 KB / Downloads: 33) xls.zip (Size: 47.34 KB / Downloads: 25) |
|||
03-26-2018, 12:18 AM
Post: #6
|
|||
|
|||
RE: Displaying String on Free42 & DM42
(02-04-2018 10:30 PM)Bill (Smithville NJ) Wrote: 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. Hi Bill....very nice! I downloaded your program files, that displayed Pi, and ran it on my DM42. This is exactly what this large screen was destined to do! Now I'm off to play around with your other files to examine the display manipulation possibilities. Thanks! Jim J. |
|||
03-29-2018, 09:58 AM
Post: #7
|
|||
|
|||
RE: Displaying String on Free42 & DM42
Hi Bill,
nice & thanks already for the huge effort in creating the FONTS program. As a suggestion, I'd have 5 control characters: the 4 arrows and an 'escape' character to indicate that the following character is to be drawn, not interpreted, eg a quote. That way, there's no need to 'remember' the previous character. Also, (I'm rewriting DISPLAY for my own needs ;-), I use a matrix "CTRL" of control characters. To then determine whether the current char is a control character, I use [FIND], which verifies all of them in a single command. RCLIJ GTO IND ST X or Y can be used to branch to the specific control character code. If it's not found, [FIND] will skip the next instruction (should've been called [FIND?] instead). Thanks, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
03-29-2018, 11:04 PM
Post: #8
|
|||
|
|||
RE: Displaying String on Free42 & DM42
(03-29-2018 09:58 AM)Werner Wrote: Hi Bill, Hi Werner, Thanks for the suggestions. I had thought of using an "escape" character, but since I wished to be able to print all characters, didn't want to give up a character code. Which "escape" character do you have in mind to use? Using a Matrix to store the control codes sounds interesting. I'm not that familiar with the Matrix FIND function. I'd be interested in seeing your final version of the code. Thanks, Bill Smithville, NJ |
|||
03-30-2018, 07:04 AM
Post: #9
|
|||
|
|||
RE: Displaying String on Free42 & DM42
(03-29-2018 11:04 PM)Bill (Smithville NJ) Wrote: I had thought of using an "escape" character, but since I wished to be able to print all characters, didn't want to give up a character code. Which "escape" character do you have in mind to use? I thought of using a quote - to draw a quote you would then use two quotes of course, so you don't 'give up' any character. (03-29-2018 11:04 PM)Bill (Smithville NJ) Wrote: I'd be interested in seeing your final version of the code. I'd better get on with it, then ;-) Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
04-05-2018, 02:00 PM
Post: #10
|
|||
|
|||
RE: Displaying String on Free42 & DM42
My version, or, my first working version ;-)
Changes wrt. Bill's: - 128x2 matrix that holds the fonts is called FONTS. It is the transpose of Bill's CHARS. - escape char ' to indicate the next char is to be drawn - 5x1 matrix CTRL of control characters 14,15,16,94,39. To be created manually. - last char is always drawn - REGS is not used - 2 entries, one for double wide/high chars. Can be used to draw extra large text in 200x120, or normal text in 400x240. Or for a really big font on the 42S ;-) I also changed the name to DISPXY, to not interfere with your DISPLAY, but also because I was thinking along the lines of adding DISP that simply outputs text on a certain line, like on the 48/49/50. Code: { 295-Byte Prgm } Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
04-05-2018, 09:05 PM
Post: #11
|
|||
|
|||
RE: Displaying String on Free42 & DM42 | |||
04-06-2018, 07:02 AM
Post: #12
|
|||
|
|||
RE: Displaying String on Free42 & DM42
Hello Bill,
from having your matrix CHARS in memory do the following two things: Code: RCL "CHARS" and Code: 5 Then it will work. The reason it doesn't is probably because you don't have the matrix "CTRL", and since I use flag 25 it doesn't error out on not finding it. As for examples, yours work perfectly, all you need to do is to replace the calls to DISPLAY by DISPXY. And to replace the doubling of the control characters by preceding them with a quote. Of course, just specifying 3 for the GrMod and calling DSP2XY doesn't show well, as the coordinates are hardcoded for single-spaced fonts. That's where DISP (with lines) would come in. I'll try and add that in and a few examples as well. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
04-06-2018, 03:34 PM
Post: #13
|
|||
|
|||
RE: Displaying String on Free42 & DM42
Hi Werner,
Made the changes and it works great. Now to study the code to see how it works. I had looked at doubling the font size but wasn't quite sure how to approach it. I'll have to see how you did it. Thanks for the update. Bill Smithville, NJ |
|||
04-07-2018, 09:07 AM
Post: #14
|
|||
|
|||
RE: Displaying String on Free42 & DM42
Hi Bill.
To double the font's width and height, each pixel has to become a block of 4 pixels. Horizontally, that is simple: just draw the character twice. Vertically, however, it amounts to converting eg 53 = 110101b to 111100110011b or 3891. No need to figure out how I did in in the routine I posted as I found a faster, shorter and easier way (triple win!): Code: 128 The loop is used to space the bits apart, and the 3 * doubles them. DSP2XY is still quite slow though. Cheers, Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)