Page 1 of 1

hidden variable values?

Posted: Thu Apr 22, 2021 5:26 am
by roo1234
hi sinclair friends,

i had some fun tonight by keying in a commercial zx81-tk82c program into the spectrum emulator. calendario from brazilian microdigital.

the program was all correct but refused to work properly. by debugging the variables, i discovered some initial variables had a different value than stated in basic. so, the keyed in program had their list value, but the original program has a different initial value, even if you type ´run´, clearing them. does anybody know how is this even possible?
so, i had to correct the initial ´let´ statements with the internal values, and the program miracurously ran.
this seems to be a very antique copy protection.
variables in the pic. true values x=2, y=4, z=1, w=0

sorry about no capital letters, shift key problem :lol:

Re: hidden variable values?

Posted: Thu Apr 22, 2021 9:43 am
by XavSnap
HI,

On Zx81 or Spectrum, the decimal text value is not read while Basic running !
The value is take form the encoded value after it…
If you manually edit this value, you can run the basic program 8=6 and 6=8...
If the program tokens are saved as is… the value will be wrong.
You had to Edit (shift+1) to refresh the right decimal value.

Probably a text to binary encoding /or/… a Microsoft copy protected device, to avoid to change the program values.
:oops:

Cap0000.jpg
Cap0000.jpg (9.36 KiB) Viewed 2577 times
Capture0001.JPG
Capture0002.JPG

Re: hidden variable values?

Posted: Thu Apr 22, 2021 11:38 am
by 1024MAK
The fact that you have three lines with a line number of zero tells you that the programmer was happy poking different values directly into the area of RAM where the program is stored.

So as Xav says, it appears the programmer has poked different numeric symbols in place of the original numeric symbols to confuse anyone trying to copy the program from a listing.

When you enter a program line, the ZX computers and their clones not only perform a syntax check, they also convert any literal number (unless part of a variable name, or part of text) into it’s floating point value. This is stored after the numeric symbols. Listing shows the numeric symbols, but when the interpreter processes the line (in a running program), it only uses the hidden floating point value.

And of course, both get stored when the program is saved.

Mark

Re: hidden variable values?

Posted: Thu Apr 22, 2021 4:16 pm
by roo1234
yes, yes, this must be the case. it seems to have extra values in the memory dump.
very clever yet easily defeatable if you just print the variables.... :D

anyway here is the program if anyone is interested. it asks for year and month and prints the month calendar.
i had this proggy back in 1983 but lost it, now some kind soul recovered it ;)

Re: hidden variable values?

Posted: Thu Apr 22, 2021 4:46 pm
by BarryN
Could you Kindly repost this as a .P file? I can't seem to load it...

Re: hidden variable values?

Posted: Thu Apr 22, 2021 10:01 pm
by XavSnap
CALENDARIO.P
(1.96 KiB) Downloaded 187 times

Re: hidden variable values?

Posted: Thu Apr 22, 2021 10:24 pm
by BarryN
Thanks. Now I have to translate it to English... :)