Post Reply 
faster DM42 Hitomezashi algorithm
08-27-2023, 03:45 PM
Post: #1
faster DM42 Hitomezashi algorithm
On a 1/23/22 post entitled "Calculator Graphics Drawing Benchmark", the Hitomezashi algorithm implemented for the DM42 takes 18.7 seconds on a 400x240 screen. Because the DM42 does not have a line command, a lot of time is consumed drawing lines pixel by pixel. However, using the AGRAPH command, this can be greatly increased in speed. There is the AGRAPH limitation of drawing 8 pixel vertical lines, however, a 200x120 screen can be used if longer looking lines are desired (still limited to a maximum of 8 pixels size). Store the size in the variable S (using a number from 3 to 8). On line 4, a 3 specifies a 400x240 screen, and a 2 specifies a 200x120 screen. I used the original benchmark posting code as a reference, but wrote my own implementation of the Hitomezashi algorithm, to make use of the AGRAPH command.

Here are the times using an unscientific method of a stopwatch:

400x240 using USB cable:
S=4 - 3.55 sec.
S=8 - 1.42 sec.

400x240 using battery:
S=4 - 8.55 sec.
S=8 - 2.58 sec.

Code:

00 { 230-Byte Prgm }
01▸LBL "HT"
02 "GrMod"
03 ASTO 03
04 3
05 STO IND 03
06 RCL "S"
07 1ᴇ3
08 ÷
09 STO "S1"
10 CLA
11▸LBL 01
12 1
13 XTOA
14 ISG "S1"
15 GTO 01
16 RCL "ResX"
17 1ᴇ3
18 ÷
19 RCL "S"
20 2
21 ×
22 1ᴇ5
23 ÷
24 +
25 STO "X1"
26 RCL "ResY"
27 1ᴇ3
28 ÷
29 RCL "S"
30 1ᴇ5
31 ÷
32 +
33 STO "A"
34▸LBL 02
35 RAN
36 2
37 ×
38 IP
39 RCL "S"
40 ×
41 RCL "X1"
42 +
43 STO "B"
44▸LBL 04
45 RCL "A"
46 RCL "B"
47 AGRAPH
48 ISG "B"
49 GTO 04
50 ISG "A"
51 GTO 02
52 CLA
53 2
54 RCL "S"
55 Y^X
56 1
57 -
58 XTOA
59 RCL "ResY"
60 1ᴇ3
61 ÷
62 RCL "S"
63 2
64 ×
65 1ᴇ5
66 ÷
67 +
68 STO "Y1"
69 RCL "ResX"
70 1ᴇ3
71 ÷
72 RCL "S"
73 1ᴇ5
74 ÷
75 +
76 STO "B"
77▸LBL 08
78 RAN
79 2
80 ×
81 IP
82 RCL "S"
83 ×
84 RCL "Y1"
85 +
86 STO "A"
87▸LBL 10
88 RCL "A"
89 RCL "B"
90 AGRAPH
91 ISG "A"
92 GTO 10
93 ISG "B"
94 GTO 08
95 END
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)