A86: Using Table


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

A86: Using Table




I'm trying to adapt the usage of a table, as discussed recently in the
Efficiency Problem thread, to my program.  It's eventually going to be
generating a random (but weighted) number, and retriving the data coresponding
to that number in a table.  However, I guess I really don't understand the
concept behind this, so what's wrong with this?  How should I use the table?

#include "ti86asm.inc"
#include asm86.h

.org _asm_exec_ram

	call _clrLCD
	ld a,2
	ld hl, table
	add a,a
	ld e,a
	ld d,0
	add hl,de
	call $33
	call _puts

table:
	.dw one
	.dw two
	.dw three

one:
	"one",0

two:
	"two",0

three:
	"three",0
.end