To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 2940
2939  |  2941
Subject: 
Re: Help in Assembler
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 6 Nov 1997 04:10:52 GMT
Original-From: 
Brian S Jappinen <JAPPINEN@CSspamless.UMT.EDU>
Viewed: 
1562 times
  
From mar@cooper.edu Wed Nov  5 18:33:16 1997

Consider a part of a program:

var1   FCB   1
var2   FCB   7
var3   FCB   4
     .
     .
     .
varN   FCB   ?

If I want to use a variable (say X) to determine when to use "var1" to
"varN", how can I do this (other than a whole bunch of CMP's).
(i.e. when X = 3, I want to access var3)

I guess what I'm asking is...Is there a way to indicate the address var3
as "the address of var1 plus an offset"?

I think this might be what you want to do:

varind FCB $00 * 0 <= varind <= FF

ORG $c100 * some location of table
var1    FCB   1
var2    FCB   7
var3    FCB   4
     .
     .
     .
varN    FCB   ?
     .
     .
tabadr  FDB #$c100 * address where table is stored

start ORG $c000
LDX tabadr
     .
     .
     .
        INC num
     .
     .
        LDAA num,x


Note: 0,x would access the first element of the table.

You might think about a hash table.

Scott



Message has 1 Reply:
  Re: Help in Assembler
 
What is "ORG"? Does it matter what number you use? Is the number a memory location? Thanks for any help! :) ---...--- ericson mar Master of Engineering Candidate Project: Mobile Robotics mar@cooper.edu (212)353-4356 Department of Mechanical (...) (27 years ago, 7-Nov-97, to lugnet.robotics.handyboard)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR