Big Font - bigX

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: http://www.swissmicros.com/dm42/decoder/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
deetee
Posts: 16
Joined: Mon Jul 22, 2019 6:01 am
Location: Vienna

Big Font - bigX

Post by deetee » Thu Aug 01, 2019 9:26 am

Hi there!

The DM42 lacks a (really) big font for bad eyes. So I wrote a program to print the (numerical) content (up to 11 digits) of the X register in really big letters:
bigX.bmp
bigX.bmp (12.31 KiB) Viewed 347 times

Unfortunately I have 2 problems:
* It's slow (up to 1 s for long terms).
* It can be called with "XEQ bigX" or more comfortable with some assigned custom key (see picture). But I'm looking for a solution to stay in bigfont-mode permanently.

Any hints are highly welcome.

Before you can use bigX you have to start (one time only) mkFNT which produces the font variable (matrix) FNT.

Code: Select all

00 { 223-Byte Prgm }
01▸LBL "mkFNT" @ Provides FNT (1x14-matrix) to print numbers 
02 1
03 14
04 NEWMAT
05 STO "FNT"
06 INDEX "FNT"
07 CLA

08 127 @ 0
09 XTOA
10 ├"AAA"
11 127
12 XTOA
13 XEQ 01

14 "÷÷√" @ 1
15 127
16 XTOA
17 ├"÷"
18 XEQ 01

19 "yIIIO" @ 2
20 XTOA
21 XEQ 01

22 "AIII" @ 3
23 127
24 XTOA
25 XEQ 01

26 "→¿¿¿" @ 4
27 127
28 XTOA
29 XEQ 01

30 "OIIIy" @ 5
31 XEQ 01

32 127 @ 6
33 XTOA
34 ├"IIIy"
35 XEQ 01

36 "∫×××" @ 7
37 127
38 XTOA
39 XEQ 01

40 127 @ 8
41 XTOA
42 ├"III"
43 127
44 XTOA
45 XEQ 01

46 "OIII" @ 9
47 127
48 XTOA
49 XEQ 01

50 "÷@@÷÷" @ .
51 XEQ 01

52 "¿¿¿¿¿" @ -
53 XEQ 01

54 "÷" @ ,
55 160
56 XTOA
57 ├"`÷÷"
58 XEQ 01

59 "÷>**"" @ E

60▸LBL 01 @ write to matrix (FNT)
61 ASTO ST X
62 STOEL
63 J+
64 CLA
65 RTN
66 END
Then run bigX:

Code: Select all

00 { 164-Byte Prgm }
01▸LBL "bigX" @ Print X
02 CLLCD
03 CLA
04 STO 14 @ 14:X ... save stack
05 R↓
06 STO 15 @ 15:Y
07 R↓
08 STO 16 @ 16:Z
09 R↓
10 STO 17 @ 17:T
11 -14
12 STO 10 @ 10:x
13 CLX
14 STO 11 @ 11: index to ATOX
15 STO 12 @ 12:exit program if 1
16 STO 13 @ 13:counter for printed characters

17▸LBL 14
18 1
19 STO+ 11
20 RCL 14
21 CLA
22 ARCL ST X @ X to alpha

23 RCL 11
24 STO 12 @ 12 index
25▸LBL 12
26 ATOX @ shift to appropriate character
27 DSE 12
28 GTO 12

29 ALENG @ end of string?
30 X≠0?
31 GTO 11
32 1 @ set exit flag
33 STO 12
34 R↓
35▸LBL 11

36 R↓
37 48
38 X>Y? @ no number
39 GTO 01

40 R↓ @ number
41 47
42 -
43 GTO 13

44▸LBL 01 @ .
45 R↓
46 46
47 X≠Y?
48 GTO 02
49 11
50 GTO 13

51▸LBL 02 @ ,
52 R↓
53 44
54 X≠Y?
55 GTO 03
56 13
57 GTO 13

58▸LBL 03 @ -
59 R↓
60 45
61 X≠Y?
62 GTO 04
63 12
64 GTO 13

65▸LBL 04 @ E
66 R↓
67 24
68 X≠Y?
69 GTO 14 @ goto next char
70 14
71 GTO 13

72▸LBL 13 @ print char Y (index) at pos Y,X
73 50 @ y
74 RCL 10
75 18
76 +
77 STO 10
78 XEQ "pChar" @ print char
79 1 @ counter++
80 STO+ 13
81▸LBL 10
82 RCL 13 @ exit? (no space)
83 11
84 X≤Y?
85 GTO 09
86 RCL 12 @ exit? (no char left)
87 X≠0?
88 GTO 09
89 GTO 14 @ goto next char

90▸LBL 09 @ restore stack and exit
91 RCL 17
92 RCL 16
93 RCL 15
94 RCL 14
95 RTN
96 END
For printing bigX calls pChar:

Code: Select all

00 { 69-Byte Prgm }
01▸LBL "pChar" @ Print character (FNT index in Z) at Y,X
02 STO 05 @ 05:x
03 R↓
04 STO 06 @ 06:y
05 R↓
06 INDEX "FNT"
07 1
08 X<>Y
09 STOIJ
10 RCLEL
11 STO 07 @ 07:char
12 3
13 STO- 05
14 0
15 STO 08 @ 08:steps for AROT
16 4ᴇ-3
17 STO 09 @ 09:loop index

18▸LBL 01
19 CLA
20 ARCL 07
21 RCL 08
22 AROT
23 1
24 STO+ 08
25 ATOX @ left byte of char
26 RCL 06
27 RCL 05
28 3
29 +
30 STO 05
31 XEQ "pByte" @ print byte (Z) at X,Y
32 ISG 09
33 GTO 01
34 END
And finally pChar calls pByte:

Code: Select all

00 { 53-Byte Prgm }
01▸LBL "pByte" @ Graph (long pixel) byte (Z) at coordinate Y,X
02 STO 01 @ 01:x
03 R↓
04 STO 02 @ 02:y
05 R↓
06 STO 00 @ 00:byte
07 7ᴇ-3
08 STO 04 @ 04:counter
09 2
10 1/X
11 STO 03 @ 03:power of 2

12▸LBL 01
13 2
14 STO× 03
15 RCL 03
16 RCL 00
17 AND
18 X=0?
19 GTO 02 @ no print if pixel=0
20 RCL 02
21 RCL 01
22 "???" @ 3x6 pixel
23 AGRAPH
24▸LBL 02
25 6
26 STO+ 02
27 ISG 04
28 GTO 01
29 END
And all in one file:
big.raw
(523 Bytes) Downloaded 14 times

Regards
deetee

Post Reply