Page 1 of 1

A Question about "The Matrix" ;)

Posted: Sat Dec 30, 2017 8:06 pm
by mcc
Hi,

I still have not arrived at my DM42... (still on Christmas holidays...)...
In the meantime I am programming the Free42 on my Android tablet.

I have a question about flag 76 and 77. Reading the HP42 manual about these two flags I
think to understand -- and please correct me, if I am wrong -- that flag 76 gets set, if the
column counter wraps from max. to 1 and flag 77 gets sets if the row and column counter
wraps from max.,max. to 1,1.

Based on this I wrote this example, which does not work:

LBL "MATFIL"
CLV "TMPMAT"
2
2
DIM "TMPMAT"
INDEX "TMPMAT"
LBL01
RAND
STOEL
<LEFT>
FS? 76
<DOWN>
FS? 77
GTO 99
GTO 01
LBL 99

Purpose is to fill the created matrix with random values.
If this work, I will extend this to fill any matrix in the X-register....

(this is not a dump of the program of the Free42...I have limited possibilities here and cant transfer anything....)

Any help is very appreciated!
Thanks a lot and happy New Year 2018!
Cheers!
Meino

Re: A Question about "The Matrix" ;)

Posted: Sat Dec 30, 2017 8:20 pm
by Thomas Okken
mcc wrote:
Sat Dec 30, 2017 8:06 pm
I have a question about flag 76 and 77. Reading the HP42 manual about these two flags I
think to understand -- and please correct me, if I am wrong -- that flag 76 gets set, if the
column counter wraps from max. to 1 and flag 77 gets sets if the row and column counter
wraps from max.,max. to 1,1.
Not quite. Flag 76 signals "edge wrap," i.e. when "right arrow" or J+ go past the end of a row, or when "down arrow" or I+ go past the end of a column; flag 77 signals "end wrap," when you go past the corner (row and column wrap at the same time).
So, you can fill a matrix with a single loop, no double nested loop needed; just use "right arrow" and check flag 77.
mcc wrote:
Sat Dec 30, 2017 8:06 pm
(this is not a dump of the program of the Free42...I have limited possibilities here and cant transfer anything....)
As long as you have email on your tablet, you can share programs using Copy and Paste.

Re: A Question about "The Matrix" ;)

Posted: Sat Dec 30, 2017 8:58 pm
by mcc
Hi,

trust me....my tablet is not a smartphone (no way to connect to the mobile net) and no WLAN here...
as I said: Limited resources...
Therefore: good ole handcrafted code...

Thanks for the infos... :)

Cheers
Meino