This plot program is my first attempt in programming the DM42. So there is room for improvement and all hints are highly welcome.

"Fastplot" plots a function f(x) very fast but rough (50 4x4 dots in 200x120 GrMod 2). It scales automatically and provides zooming and (horizontally) shifting.

Call pPLOT with the x-axis-range (Y:from X:to), shift left/right with keys 1/3 or zoom out/in with keys 2/5. After plotting you can see the recent x-range stored in the variables a and b:

Code: Select all

```
00 { 124-Byte Prgm }
01▸LBL "pPLOT" @ Plot f(x) in Y,X - KEYS: 5/2 - zoom in/out
02 STO "b" @ to 1/3 - shift left/right
03 R↓
04 STO "a" @ from
05 2 @ set resolution of 400x120
06 STO "GrMod"
07▸LBL 14 @ plot f(x)
08 CLLCD
09 RCL "a"
10 RCL "b"
11 XEQ "pF(X)"
12▸LBL 13 @ calculate scale for shift/zoom
13 RCL "b"
14 RCL "a"
15 -
16 4 @ scale of 25%
17 ÷
18 STO 06 @ 06:scale
19 GETKEY @ Menu
20 29 @ key1:left
21 X=Y?
22 GTO 01
23 R↓
24 31 @ key3:right
25 X=Y?
26 GTO 02
27 R↓
28 30 @ key2:out
29 X=Y?
30 GTO 03
31 R↓
32 25 @ key5:in
33 X=Y?
34 GTO 04
35 GTO 13
36▸LBL 01 @ shift left
37 RCL 06
38 STO- "a"
39 STO- "b"
40 GTO 14
41▸LBL 02 @ shift right
42 RCL 06
43 STO+ "b"
44 STO+ "a"
45 GTO 14
46▸LBL 03 @ zoom out
47 RCL 06
48 STO- "a"
49 STO+ "b"
50 GTO 14
51▸LBL 04 @ zoom in
52 RCL 06
53 STO+ "a"
54 STO- "b"
55 GTO 14
56 END
```

Code: Select all

```
00 { 127-Byte Prgm }
01▸LBL "pF(X)" @ Plot f(x) between Y and X
02 X<>Y
03 STO 00 @ 00:Fa
04 -
05 50
06 ÷
07 STO 01 @ 01:dx
08 RCL 00 @ initial Fmin and Fmax
09 XEQ "f(x)"
10 STO 02 @ 02:Fmin
11 STO 03 @ 03:Fmax
12 1.049 @ calculate Fmin and Fmax
13 STO 04 @ 04:index
14▸LBL 14
15 RCL 04
16 RCL 01
17 ×
18 RCL 00
19 +
20 XEQ "f(x)"
21 STO 05 @ 05:y
22 RCL 03
23 X<>Y
24 X>Y?
25 STO 03
26 RCL 02
27 RCL 05
28 X<Y?
29 STO 02
30 ISG 04
31 GTO 14
32 0.049 @ Plot
33 STO 04
34▸LBL 13
35 RCL 04
36 RCL 01
37 ×
38 RCL 00
39 +
40 XEQ "f(x)"
41 XEQ 12
42 "→→→→"
43 AGRAPH @ print dot (4x4)
44 0
45 XEQ 12
46 "√√√√"
47 AGRAPH @ print x-axis
48 ISG 04
49 GTO 13
50 RTN
51▸LBL 12 @ scale y
52 RCL 02
53 -
54 RCL 03
55 RCL 02
56 -
57 ÷
58 120
59 ×
60 +/-
61 119
62 +
63 RCL 04 @ scale x
64 4
65 ×
66 RTN
67 END
```

Code: Select all

```
00 { 23-Byte Prgm }
01▸LBL "f(x)" @ Calculate X=f(X)
02 STO 20
03 3
04 Y↑X
05 RCL 20
06 X↑2
07 5
08 ×
09 +
10 8
11 -
12 END
```

Regards

deetee