HPLOT

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.
User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

HPLOT

Post by revwillie » Tue Dec 19, 2017 3:27 pm

here's a modified version of DPLOT from the original HP42s manual but with three changes:

1)input 0,2 or 3 as GrMod to choose the display resolution.
2)a vertical axis is always displayed at the 'x=0' of the plot window. (thanks to Keith Dalby for help)
3)if GrMod is not zero, extra pixels are plotted to make the result bolder and easier to see.

that's it. Feel free to use or modify further.

Code: Select all

00 { 328-Byte Prgm }
01▸LBL "HPLOT"
02 MVAR "YMIN"
03 MVAR "YMAX"
04 MVAR "AXIS"
05 MVAR "XMIN"
06 MVAR "XMAX"
07 MVAR "GrMod"
08▸LBL A
09 VARMENU "HPLOT"
10 "Ready"
11 PROMPT
12 CLA
13 SF 25
14 RCL "FCN"
15 CF 25
16 STR?
17 ARCL ST X
18 AON
19 STOP
20 AOFF
21 ALENG
22 X=0?
23 GTO A
24 ASTO "FCN"
25 CLA
26 CF 81
27 SF 25
28 VARMENU IND "FCN"
29 FC?C 25
30 SF 81
31 FC? 81
32 STOP
33 EXITALL
34 ALENG
35 X=0?
36 SF 81
37 ASTO 03
38 RCL "ResY"
39 1
40 -
41 RCL "YMAX"
42 RCL- "YMIN"
43 ÷
44 STO 00
45 RCL "XMIN"
46 STO 01
47 RCL "ResX"
48 1ᴇ3
49 ÷
50 1
51 +
52 STO 02
53 CLLCD
54 XEQ "AXIS"
55▸LBL 01
56 RCL 01
57 FC? 81
58 STO IND 03
59 XEQ IND "FCN"
60 XEQ 02
61 RCL 02
62 PIXEL
63 RCL "GrMod"
64 X=0?
65 GTO B
66 R↓
67 R↓
68 1
69 -
70 RCL 02
71 PIXEL
72 R↓
73 1
74 -
75 RCL 02
76 PIXEL
77 R↓
78 1
79 -
80 RCL 02
81 PIXEL
82▸LBL B
83 RCL "XMAX"
84 RCL- "XMIN"
85 RCL "ResX"
86 ÷
87 STO+ 01
88 ISG 02
89 GTO 01
90 PRLCD
91 RTN
92 GTO A
93▸LBL 02
94 RCL- "YMIN"
95 RCL× 00
96 RCL "ResY"
97 -
98 X>0?
99 CLX
100 ABS
101 RTN
102▸LBL "AXIS"
103 RCL "AXIS"
104 XEQ 02
105 +/-
106 1
107 PIXEL
108 0
109 RCL "XMIN"
110 -
111 RCL "XMAX"
112 RCL "XMIN"
113 -
114 ÷
115 RCL "ResX"
116 ×
117 +/-
118 PIXEL
119 END
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

keithdalby
Posts: 545
Joined: Mon Apr 24, 2017 6:38 pm

Re: HPLOT

Post by keithdalby » Tue Dec 19, 2017 6:48 pm

revwillie wrote:
Tue Dec 19, 2017 3:27 pm
(thanks to Keith Dalby for help)
You're welcome, I think. I can't remember doing anything and anything I did do was probably wrong anyway, I'm far too amateur, but it's always nice to see your name in lights.

User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

Re: HPLOT

Post by revwillie » Tue Dec 19, 2017 6:58 pm

Yes that was way, way back in September
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

dlachieze
Posts: 174
Joined: Thu May 04, 2017 10:20 am
Location: France

Re: HPLOT

Post by dlachieze » Tue Dec 19, 2017 11:14 pm

That's interresting, I've also been working on a version of the DPLOT program for the DM42, but I started from the DPLOT version from Thomas, included with the DM42:
dplot_thomas: Modified version of DPLOT; like the original, with SOLVE support added
As you, I added the support of the different graphic modes, but by leveraging the soft keys from the m3435 program (HP for the 131x16 original resolution, 200 for 200x120 and 400 for 400x240), I also added a vertical axis at x=0, as well as some rough zoom in and zoom out capability with the + and - keys.

As an example, here is a plot of the FNX function from the Solver section in the HP-42S manual, with the same parameters: YMIN=-50, YMAX=25, XMIN=-3, XMAX=7.
Image

Code: Select all

00 { 29-Byte Prgm }
01▸LBL "FNX"
02 MVAR "X"
03 RCL "X"
04 ENTER
05 X↑2
06 LASTX
07 5
08 ×
09 -
10 10
11 -
12 ×
13 20
14 +
15 END
And here is my version of DPLOT for the DM42, comments and improvements are welcome:

Code: Select all

00 { 813-Byte Prgm }
01▸LBL "DPLOT"
02 MVAR "YMIN"
03 MVAR "YMAX"
04 MVAR "AXIS"
05 MVAR "XMIN"
06 MVAR "XMAX"
07▸LBL A
08 RCL "GrMod"
09 "HP"
10 X=0?
11 ├"•"
12 KEY 1 GTO 12
13 "200"
14 2
15 -
16 X=0?
17 ├"•"
18 KEY 2 GTO 13
19 1
20 -
21 "400"
22 X=0?
23 ├"•"
24 KEY 3 GTO 14
25 CLA
26 KEY 4 GTO A
27 KEY 5 GTO A
28 "Next▸"
29 KEY 6 GTO B
30 KEY 9 GTO 17
31 MENU
32 STOP
33 GTO A
34▸LBL 12
35 CLX
36▸LBL 16
37 STO "GrMod"
38 GTO A
39▸LBL 13
40 2
41 GTO 16
42▸LBL 14
43 3
44 GTO 16
45▸LBL 17
46 EXITALL
47 STOP
48 GTO A
49▸LBL 18
50 RCL "YMAX"
51 RCL- "YMIN"
52 0.1
53 ×
54 STO+ "YMAX"
55 STO- "YMIN"
56 RCL "XMAX"
57 RCL- "XMIN"
58 0.1
59 ×
60 STO+ "XMAX"
61 STO- "XMIN"
62 GTO 05
63▸LBL 19
64 RCL "YMAX"
65 RCL- "YMIN"
66 0.1
67 ×
68 STO- "YMAX"
69 STO+ "YMIN"
70 RCL "XMAX"
71 RCL- "XMIN"
72 0.1
73 ×
74 STO- "XMAX"
75 STO+ "XMIN"
76 GTO 05
77▸LBL B
78 VARMENU "DPLOT"
79 "Enter limits; t"
80 ├"hen R/S"
81 PROMPT
82▸LBL 00
83 "FCN=?"
84 SF 25
85 RCL "PFCN"
86 FC?C 25
87 GTO 01
88 ├" <"
89 ARCL ST X
90 ├">"
91▸LBL 01
92 AVIEW
93 CLA
94 SF 25
95 ARCL "PFCN"
96 CF 25
97 AON
98 STOP
99 AOFF
100 ALENG
101 X=0?
102 GTO 00
103 ASTO "PFCN"
104 SF 25
105 VARMENU IND "PFCN"
106 FS?C 25
107 GTO 02
108 CLA
109 ASTO "PIND"
110 GTO 05
111▸LBL 02
112 "Set vars; selec"
113 ├"t 'x'"
114 PROMPT
115 ASTO "PIND"
116 ALENG
117 X=0?
118 GTO 02
119 CLMENU
120 "EVAL"
121 KEY 1 GTO 03
122 "SOLVE"
123 KEY 2 GTO 04
124 MENU
125 "Evaluate or sol"
126 ├"ve?"
127 PROMPT
128▸LBL 03
129 CLA
130 ASTO "PDEP"
131 GTO 05
132▸LBL 04
133 VARMENU IND "PFCN"
134 "Select 'y'"
135 PROMPT
136 ASTO "PDEP"
137▸LBL 05
138 EXITALL
139 CLLCD
140 RCL "YMAX"
141 RCL- "AXIS"
142 LASTX
143 RCL- "YMIN"
144 ÷
145 X<0?
146 GTO 20
147 1
148 X<>Y
149 X>Y?
150 GTO 20
151 RCL "ResY"
152 1
153 -
154 ×
155 1
156 +
157 +/-
158 1
159 PIXEL
160▸LBL 20
161 RCL "XMAX"
162 ENTER
163 RCL- "XMIN"
164 ÷
165 X<0?
166 GTO 06
167 1
168 X<>Y
169 X>Y?
170 GTO 06
171 -
172 RCL "ResX"
173 1
174 -
175 ×
176 1
177 +
178 +/-
179 PIXEL
180▸LBL 06
181 RCL "XMAX"
182 RCL "XMIN"
183 STO 00
184 -
185 RCL "ResX"
186 1
187 -
188 ÷
189 STO 01
190 RCL "ResX"
191 1ᴇ-3
192 ×
193 1
194 +
195 STO 02
196 RCL "YMIN"
197 RCL- "YMAX"
198 STO 03
199 CLA
200 ARCL "PIND"
201 ALENG
202 X≠0?
203 GTO 07
204 8
205 STO 04
206 GTO 08
207▸LBL 07
208 CLA
209 ARCL "PDEP"
210 ALENG
211 X≠0?
212 GTO 07
213 9
214 STO 04
215 GTO 09
216▸LBL 07
217 10
218 STO 04
219 PGMSLV IND "PFCN"
220 GTO 10
221▸LBL 08
222 RCL 00
223 XEQ IND "PFCN"
224 GTO 11
225▸LBL 09
226 RCL 00
227 STO IND "PIND"
228 XEQ IND "PFCN"
229 GTO 11
230▸LBL 10
231 RCL 00
232 STO IND "PIND"
233 RCL "YMIN"
234 STO IND "PDEP"
235 RCL "YMAX"
236 SOLVE IND "PDEP"
237▸LBL 11
238 RCL- "YMAX"
239 RCL÷ 03
240 RCL "ResY"
241 1
242 -
243 ×
244 1
245 +
246 X<0?
247 GTO 07
248 RCL 02
249 PIXEL
250▸LBL 07
251 RCL 01
252 STO+ 00
253 ISG 02
254 GTO IND 04
255 GETKEY
256 32
257 X=Y?
258 GTO 18
259 5
260 +
261 X=Y?
262 GTO 19
263 END
dplot_dm.zip
(732 Bytes) Downloaded 114 times
DM42 SN: 00425

User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

Re: HPLOT

Post by revwillie » Wed Dec 20, 2017 3:49 pm

I was just trying your version. Is the solve support still enabled? I really like the soft key selection of graphics mode. DJPLOT2 uses that same method.
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

Re: HPLOT

Post by revwillie » Thu Dec 21, 2017 3:43 am

After a couple of days thinking about this and re-reading the manual's explanation of AGRAPH, I think there's a simple and easy solution to the PLOT program's thin plot lines. Instead of using PIXEL to try to draw more pixels, a big pixel 3x3 pixels in size can be drawn by AGRAPH with three pi characters in the alpha register. It's easiest to just enter 7 in the X register and repeat XTOA three times. Then roll the 7 out of the way and call AGRAPH.

I'm testing a different version of HPLOT with this change and I'll post the code if it looks good. I'll try to incorporate the change into a modified DJPLOT too.
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

User avatar
Walter
Posts: 1100
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: HPLOT

Post by Walter » Thu Dec 21, 2017 4:15 am

revwillie wrote:
Thu Dec 21, 2017 3:43 am
After a couple of days thinking about this and re-reading the manual's explanation of AGRAPH, I think there's a simple and easy solution to the PLOT program's thin plot lines. Instead of using PIXEL to try to draw more pixels, a big pixel 3x3 pixels in size can be drawn by AGRAPH with three pi characters in the alpha register. It's easiest to just enter 7 in the X register and repeat XTOA three times. Then roll the 7 out of the way and call AGRAPH.
Luckily for you, I didn't patent my big dot idea some months ago.

Just kidding ...
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

Re: HPLOT

Post by revwillie » Thu Dec 21, 2017 4:33 am

Walter wrote:
Thu Dec 21, 2017 4:15 am

Luckily for you, I didn't patent my big dot idea some months ago.

Just kidding ...
was it something you posted in the beta test board? Sorry if I missed it. I've been trying to find a good solution to this for a while.
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

User avatar
Walter
Posts: 1100
Joined: Tue May 02, 2017 9:13 am
Location: Close to FRA, Germany

Re: HPLOT

Post by Walter » Thu Dec 21, 2017 4:52 am

revwillie wrote:
Thu Dec 21, 2017 4:33 am
Walter wrote:
Thu Dec 21, 2017 4:15 am

Luckily for you, I didn't patent my big dot idea some months ago.

Just kidding ...
was it something you posted in the beta test board? Sorry if I missed it. I've been trying to find a good solution to this for a while.
No, this was something I wrote in the WP43S manual. ;)
DM42 SN: 00041 --- Follower of Platon.

HP-35, HP-45, ..., HP-50, WP 34S, WP 31S, DM16L

User avatar
revwillie
Posts: 120
Joined: Mon Apr 24, 2017 5:48 pm

Re: HPLOT

Post by revwillie » Thu Dec 21, 2017 4:57 am

Walter wrote:
Thu Dec 21, 2017 4:52 am

No, this was something I wrote in the WP43S manual. ;)
Ahhh. Someday I will read all of that one...
DM42 SN: 00076
DM15, HP 28c, HP 12c, HP 10b, HP 20b, HP 30b, HP 17bII, HP 42s, HP 35s, WP 34s, NP-25, TI-83+, teenix multicalc

Post Reply