Post here to share useful tips and tricks, to ask questions about using your DM42 or to report softwarerelated problems

railwayman
 Posts: 4
 Joined: Thu Jan 24, 2019 3:22 pm
Post
by railwayman » Thu Jan 24, 2019 9:16 pm
Hi guys,
Nice to be here. I am an engineer and PhD student from Manchester UK, having fun with DM42. I had 42s few years ago but I sold it and cannot regret it. However, hope to have a good fun here.
I am playing with coding. I am about the make pixel drawing program which I called D.raw
With DM42 capablitities to print to image, it could be interesting.
For now I have a cursor/pointer, which I can move around. I would like to use keys "PUT" to put pixel and "DEL" to delete pixel from particular location. But I have no idea how to do that. I am playing with flags 34 and 35 but does not work. So I need your help.
CODE:
Code: Select all
00 { 174Byte Prgm }
01▸LBL "DRAW"
02 INPUT "X"
03 STO "X"
04 INPUT "Y"
05 STO "Y"
06▸LBL "MAIN"
07 "←"
08 KEY 1 XEQ "ML"
09 "→"
10 KEY 6 XEQ "MR"
11 "↑"
12 KEY 2 XEQ "MU"
13 "↓"
14 KEY 5 XEQ "MD"
15 "PUT"
16 KEY 4 XEQ "PUT"
17 "DEL"
18 KEY 3 XEQ "DEL"
19 MENU
20 STOP
21 XEQ "XS"
22 GTO "MAIN"
23 RTN
24▸LBL "MR"
25 RCL "Y"
26 1
27 +
28 STO "Y"
29 RTN
30▸LBL "MD"
31 RCL "X"
32 1
33 +
34 STO "X"
35 RTN
36▸LBL "ML"
37 RCL "Y"
38 1
39 
40 STO "Y"
41 RTN
42▸LBL "MU"
43 RCL "X"
44 1
45 
46 STO "X"
47▸LBL "XS"
48 RCL "X"
49 ENTER
50 RCL "Y"
51 "μ←←←•"
52 AGRAPH
53 .END.
Thanks

whuyse
 Posts: 59
 Joined: Thu Dec 21, 2017 12:23 pm
Post
by whuyse » Tue Jan 29, 2019 11:35 am
Unfortunately, it seems that pressing a menu button clears the LCD as well..
so you can:
 create the menu grobs yourself and work with GETKEY (don't know if that will work)
 save all 'written' pixel coordinates in a matrix and rewrite them each and every loop.
 (kindly) ask Swissmicros to change this behaviour  it is already different from a real 42S anyway
Werner
42S #3249S01123
DM42 #00345

railwayman
 Posts: 4
 Joined: Thu Jan 24, 2019 3:22 pm
Post
by railwayman » Tue Jan 29, 2019 3:05 pm
Thanks.
How to save all location in matrix and print them on screen? Never did such a thing.
Cheers

whuyse
 Posts: 59
 Joined: Thu Dec 21, 2017 12:23 pm
Post
by whuyse » Wed Jan 30, 2019 7:57 am
AGRAPH and PIXEL accept a complex matrix of coordinates as argument as well. Beware that complex arguments and real arguments have their order reversed. Complex arguments are (X,Y) with X the horizontal coordinate and Y the vertical (your program has X and Y reversed btw)
Then, to add a coordinate to a Nx1 matrix, do (with the matrix in X and the new coordinate in Y):
You may end up with a pretty big matrix, however.
Cheers, Werner
42S #3249S01123
DM42 #00345

whuyse
 Posts: 59
 Joined: Thu Dec 21, 2017 12:23 pm
Post
by whuyse » Wed Jan 30, 2019 12:20 pm
Just for completeness: the GETKEY approach does work, but it doesn't catch EXIT or the new softkeys.
This is what I used to try it out, with the up/down arrow keys and S+ for left and XEQ to go right:
Code: Select all
00 { 48Byte Prgm }
01▸LBL "TRY"
02 CLLCD
03 1
04 ENTER
05 "×"
06▸LBL 10
07 AGRAPH
08 GETKEY
09 R↓
10 GTO IND ST T
11▸LBL 01
12 1
13 
14 GTO 10
15▸LBL 06
16 1
17 +
18 GTO 10
19▸LBL 18
20 DSE ST Y
21 ABS
22 GTO 10
23▸LBL 23
24 ISG ST Y
25 ABS
26 GTO 10
27 END
Now you can use SF 34 to wipe out pixels again.
Cheers, Werner
42S #3249S01123
DM42 #00345

railwayman
 Posts: 4
 Joined: Thu Jan 24, 2019 3:22 pm
Post
by railwayman » Wed Jan 30, 2019 4:08 pm
Great. Thanks. Just finished it.
However does not work on DM42 as it should. Tested on Free42 and it works fine.
It just does not to draw properly in up direction. Have any idea why? What I can see that when I press UP, it does not keep the flag set...it works only if I hold UP while moving around with directional buttons. On Free42 works properly.
(Moderator note: listing below placed in "code" tags for reasons of legibility)
Code: Select all
00 { 115Byte Prgm }
01▸LBL "Draw"
02 CLLCD
03 1
04 ENTER
05 "×"
06▸LBL 10
07 AGRAPH
08 GETKEY
09 R↓
10 GTO IND ST T
11▸LBL 18
12 SF 34
13 GTO 10
14▸LBL 23
15 CF 34
16 GTO 10
17▸LBL 26
18 1
19 +
20 GTO 10
21▸LBL 24
22 1
23 
24 GTO 10
25▸LBL 30
26 ISG ST Y
27 ABS
28 GTO 10
29▸LBL 20
30 DSE ST Y
31 ABS
32 GTO 10
33▸LBL 31
34 1
35 +
36 ISG ST Y
37 ABS
38 GTO 10
39▸LBL 29
40 1
41 
42 ISG ST Y
43 ABS
44 GTO 10
45▸LBL 21
46 1
47 +
48 DSE ST Y
49 ABS
50 GTO 10
51▸LBL 19
52 1
53 
54 DSE ST Y
55 ABS
56 GTO 10
57▸LBL 17
58 GTO "Draw"
59▸LBL 25
60 GTO 10
61 .END.

grsbanks
 Posts: 917
 Joined: Tue Apr 25, 2017 9:23 am
 Location: Preston, Lancs, UK

Contact:
Post
by grsbanks » Wed Jan 30, 2019 5:56 pm
Just a wild guess here... Have you configured the screen resolution correctly? See the "GrMod" virtual variable in the documentation.
There are only 10 kinds of people in the world: those who understand binary and those who do not.