A82: Re: arrays and random numbers


[Prev][Next][Index][Thread]

A82: Re: arrays and random numbers



 If you want to define a matrix, just define a list of bytes. To define a
4x4 array you could do the following :

Matrix:
Q1:
.DB 0,0,0,0
Q2:
.DB 0,0,0,0
Q3:
.DB 0,0,0,0
Q4:
.DB 0,0,0,0

So if you wanted to set element 2,2 to 3 you could do the following  :

LD A,3
LD (Q2+1),A

If you want to set element H,L to A you could do the following :

CALL MUL_H_L ; This function is placed in the rom, but i could not remember
what i is usually called. HL=H*L
LD DE,Matrix
ADD HL,DE ; HL points to element
LD (HL),A

The easiest way to make random numbers is to use the R register, but this
does not give very random numbers. On ticalc you can find source code for
functions which uses both methods.


DInes

-----Original Message-----
From: The Weilers <gnsmv@midwest.net>
To: Assembly <assembly-82@lists.ticalc.org>
Date: 18. oktober 1997 21:34
Subject: A82: arrays and random numbers



> I am going to try to make a game that would probably be easier if I could
use a dimensional array, like the matrices on the
>calculator.  How would I go about making one, or is it even possible?
Also, how can I make random numbers in assembly?
>
>