Displaying Strings on the Screen

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: https://technical.swissmicros.com/decoders/dm42/

You can then copy/paste the listing and post it in "code" tags.
User avatar
Guenter
Posts: 168
Joined: Wed May 24, 2017 6:26 pm
Location: Germany

Re: Displaying Strings on the Screen

Post by Guenter »

Michael wrote:
Fri Feb 09, 2018 8:29 pm
Guenter wrote:
Fri Feb 09, 2018 8:21 pm
... subfolders at least in the Programme folder would be nice for the users and a nice challenge for David ;)
There will be subfolders. No problem for David the magician!
Looks like you had this in the pipeline already.

Günter
Günter
DM42 SN:00004 and SN:00184 -- DM41X SN:00013 and SN:00955
Michael
Site Admin
Posts: 261
Joined: Wed Apr 05, 2017 11:31 pm

Re: Displaying Strings on the Screen

Post by Michael »

Guenter wrote:
Fri Feb 09, 2018 8:34 pm
Looks like you had this in the pipeline already.
Not until today. We discussed it this afternoon and made the decision.
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Displaying Strings on the Screen

Post by mcc »

Hi Michael, hi David,

"yabba dabba doo!"
-- Fred Flintstone

GREAT!
Thanks a lot!

Cheers
Meino
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Displaying Strings on the Screen

Post by mcc »

Hi Bill,

so...weekend-time is DM42-time! :)

Thank you very much for writing the graphics programs! This is the kind of stuff, the DM42 screen needs!

But it seems that I am doing something wrong and cannot figure out, what it is.
As far as I understand, FONTS creates the data (bitpattern) for the characters, and
DISPLAY fetches the current contents of the ALPHA register and "paint" it on the graphics screen.

Beside the contents of the ALPHA register...what else do I need to provide to get an output onto the screen of my DM42?

Cheers!
Meino

(By the way: In a PM Michael says, that only a complete thread can be moved, not a single posting (the one with the file browser problems)...)
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Bill (Smithville NJ)
Posts: 34
Joined: Sat Jul 22, 2017 9:14 pm

Re: Displaying Strings on the Screen

Post by Bill (Smithville NJ) »

Hi Meino,

To display a string:
Load the Alpha Register with the String that is to be displayed
Store a complex number in Register "P". This complex number is the
screen coordinates where you wish the string displayed.
Then XEQ "DISPLAY"


Following is a simple program that would initialize the Font matrix,
initialize the screen resolution, and display the string "HELLO WORLD!"
at screen position 20, 25:

LBL "SAMPLE"
XEQ "FONTS"
2
STO "GrdMod"
CLLCD
CLA
"HELLO WORLD!"
20
25
COMPLEX
STO "P"
XEQ "DISPLAY"
END

Let me know if this doesn't work for you.

Bill
Smithville, NJ
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Displaying Strings on the Screen

Post by mcc »

Hi Bill,

thanks for the explanation and the SAMPLE program, which I typed in.

After starting it, I got a "size error" at line 17 of "DISPLAY". This is command STO IND 00.

What I am doing wrong?

Cheers
Meino
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Bill (Smithville NJ)
Posts: 34
Joined: Sat Jul 22, 2017 9:14 pm

Re: Displaying Strings on the Screen

Post by Bill (Smithville NJ) »

mcc wrote:
Sat Feb 10, 2018 7:21 pm

After starting it, I got a "size error" at line 17 of "DISPLAY". This is command STO IND 00.

What I am doing wrong?

Cheers
Meino
You need to set the number of storage registers to 150.

SIZE command is in the MODES menu.

Select SIZE 150

That will allow for 150 storage registers.

Bill
Smithville, NJ
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Displaying Strings on the Screen

Post by mcc »

Hi Bill,

OH YEAH! Done that and it works GREAT (your library, not only the SIZE-command :) ! )
Thanks a lot for your help and the software!

Cheers
Meino
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Bill (Smithville NJ)
Posts: 34
Joined: Sat Jul 22, 2017 9:14 pm

Re: Displaying Strings on the Screen

Post by Bill (Smithville NJ) »

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, plese 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
Attachments
Fonts-Display-S1-S2.zip
(4.07 KiB) Downloaded 356 times
xls.zip
(47.34 KiB) Downloaded 336 times
Krauts In Space
Posts: 85
Joined: Wed Jan 03, 2018 3:48 pm
Location: Nuremberg, Germany

Re: Displaying Strings on the Screen

Post by Krauts In Space »

Bill (Smithville NJ) wrote:
Tue Feb 13, 2018 3:41 am
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, plese 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
Hi Bill!
I'm working on a program with your character generator. It helps a lot. Hopefully I can release it into the forum in the near future.
Just the stack filled with complex numbers and the alpha register with some weird characters gives me some headaches.
For the moment I'd love to get a line delete. Is it in your code, do I miss something?

Best wishes,
Gernot
DM15L S/# 10584 FW v25
DM42 S/# 01015 FW v3.5
Post Reply