hidden variable values?

Discussion about ZX80 / ZX81 Software
Post Reply
roo1234
Posts: 8
Joined: Wed Oct 14, 2020 8:15 am

hidden variable values?

Post 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:
Attachments
calend.gif
calend.gif (1.1 KiB) Viewed 2397 times
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: hidden variable values?

Post 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 2363 times
Capture0001.JPG
Capture0002.JPG
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
1024MAK
Posts: 5101
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: hidden variable values?

Post 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
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
roo1234
Posts: 8
Joined: Wed Oct 14, 2020 8:15 am

Re: hidden variable values?

Post 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 ;)
Attachments
calendario tk82c.z81
(5.69 KiB) Downloaded 128 times
User avatar
BarryN
Posts: 151
Joined: Thu Nov 09, 2017 11:34 pm

Re: hidden variable values?

Post by BarryN »

Could you Kindly repost this as a .P file? I can't seem to load it...
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: hidden variable values?

Post by XavSnap »

CALENDARIO.P
(1.96 KiB) Downloaded 181 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
BarryN
Posts: 151
Joined: Thu Nov 09, 2017 11:34 pm

Re: hidden variable values?

Post by BarryN »

Thanks. Now I have to translate it to English... :)
Post Reply