A86: building arrays


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

A86: building arrays




> From: MikeT843@aol.com
> Subject: A86: arrays
> 
> How would i create an array with Asm?
check out:
http://guide.iwarp.com/advanced/tabl.htm.
for some routines and info.

let's say you want to make an
array of 10 random values
anywhere from 0-255 and
integers (so we
can keep each element in the
array as one byte without
having to go into
fixed/floating point stuff). the
array would look like
=====code start=====
array:	.db 4,23,100,245,0,23,157,209,98,148
=====code end=======
we use the assembler
directive .db
(http://guide.iwarp.com/advanced/asse.htm#db)
to designate bytes in a
linear fashion along with
commas.

if you want to load the
accumulator (register a)
with the 1st element, you
would do the following:
=====code start=====
	ld a,(array+0)
=====code end=======
the 3rd element would be
=====code start=====
	ld a,(array+2)
=====code end=======

notice that the numbers
are one less than the element
you want. that's because
the address 'array' is
the byte of the first
element (array+0=1st
element).

jimi malcolm
malcolmj1@juno.com
http://guide.iwarp.com

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.