A86: questions re random #s and assembling


[Prev][Index][Thread]

A86: questions re random #s and assembling




I'm new to this list, and new to assembly. I still don't understand
things like the VAT and stack, but I figure I can learn those from
tutorials and from other people's source code, so I won't bother people
with them unless I get really stuck on some point. I do have two
questions that I have been unable to find satisfactory answers to,
however.

	My first question regards the random-number-generator in the TI
calculators. Basically, how does it work? A couple of years ago, I
determined the formula for getting the first random number from a given
seed. The BASIC program I created is reprinted below (I had an 82 back
then, but the code is basically the same except for the double equal-sign
the 86 uses).

	;note the decimal points in the first two lines (they might be hard to
see with certain fonts)
:.25443922769332 \->\ M	;constant (not exact, because it doesn't work
well for high seeds)
:.94359740249213 \->\ L	;# for seed=0
:Input "SEED:",N
:int N \->\ N		;it also takes absolute value, but I can't remember if
before or after int( )
:1-fPart (NM) \->\ J	;*****this line contains the actual formula*****
:If N=0
:L \->\ J			;because the # for seed=0 doesn't sync up
:Disp J

However, I was never able to determine how the subsequent numbers were
calculated, only the first for a given seed. I had asked this question a
multitude of times to the Calc-TI list (to which I was formerly
subscribed), but they were, of course, not helpful. I figured there would
be people on this list who have disassembled the ROM and know how these
things work.

	My second question relates to how the assemblers work. I have recently
become intrigued by the possibility of self-modifying programs. After
seeing programs that wrote high scores and save states into their own
code, I figured that it would be possible to create a program that
changed its own code. Although I can't think of any practical
applications for this outside of AI (which would be very difficult), I'm
sure there are many. I figure that I can just get AssemblyStudio86 to
give me hex listings for programs so I can determine the hex
equivalencies of the various commands (and thus know what to write in to
change). However, I don't understand how labels work in machine code.
Could someone explain what an assembler does to a label when it's
building the code? And, if there is a reference for hex equivalencies
somewhere, could someone direct me to it?

	One last thing: I'm not sure if I'm using the right terms for these
concepts. As I understand it,
machine code=hex code=1s and 0s compressed into bytes
compiling=converting from a high-level language to a low-level language
(as in BASIC to Intel asm)
assembling=building=converting from a low-level language into hex code
If these terms are incorrect or mixed-up, please correct me for future
reference.

Thanks for all of your help and patience. Sorry the letter is so long.

Ben Przybyla
syzygy.bp@juno.com
Nimajne (AIM)

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]