Replacements for in DM42 not yet implemented Free42/Plus42 extensions

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
ame
Posts: 7
Joined: Sat Sep 17, 2022 4:42 pm

Replacements for in DM42 not yet implemented Free42/Plus42 extensions

Post by ame »

The Plus42 app provides two very useful commands:
WIDTH and HEIGHT [S][DISP][^] (softkey 5 and 6).

These allow querying the resolution of the graphics display.
The DM42 does not know these commands, but two virtual variables ResX and ResY.
However, it is possible to write a program to run on Free42, Plus42 and DM42 without changes.

You can copy the followng code and paste it in Free42 or Plus42 (on Android, or on your PC). If you import the resulting .raw file in DM42 WIDTH will apears as XROM 09,50

Code: Select all

00 { 30-Byte Prgm }
01▸LBL "ResX"
02 SF 25
03 WIDTH
04 FS?C 25
05 RTN
06 SF 25
07 RCL "ResX"
08 FS?C 25
09 RTN
10 131
11 END
The same thing with HEIGHT:
DM42 displays XROM 09,51 instead of HEIGHT
But both programs are working as expected.

Code: Select all

00 { 29-Byte Prgm }
01▸LBL "ResY"
02 SF 25
03 HEIGHT
04 FS?C 25
05 RTN
06 SF 25
07 RCL "ResY"
08 FS?C 25
09 RTN
10 16
11 END
Since Free42 version 3.0.10 the SKIP command is available. It is a useful addition to the NOP command.
It allows to change a condition like e.g. X=0?
X=0?
SKIP
is equivalent to
x<>0?
It becomes useful when using a condition that has no inverse.
For example, after the HEAD command the following statement is skipped only if the list (or string) in the argument is empty.
In certain cases, this can save a GTO and an LBL, for example.
As follows a replacement for SKIP can be implemented on DM42 with the current firmware.

Code: Select all

00 { 10-Byte Prgm }
01▸LBL "SKIP"
02 RTNNO
03 END
Here is an example for the SKIP command.

Code: Select all

00 { 35-Byte Prgm }
01▸LBL ".TMP"
02 XSTR "TEST!"
03 0
04▸LBL 00
05 HEAD ST Y
06 XEQ "SKIP"
07 RTN
08 C→N
09 +
10 GTO 00
11 END
I hope these are useful tips and tricks ;)
Attachments
FreeExtensions42.raw
(116 Bytes) Downloaded 143 times
Post Reply