[A83] Re: Defined Variables


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

[A83] Re: Defined Variables





>
>;This should put 7 in address 9872h, right?
>;Then I could assign the value to a register if I felt so inclined, like:
>ld a,(VAR)
>
>Obviously this is wrong, as TASM won't take it. The question for me then
>becomes, what's wrong? I hope you know the answer.


The thing is, you can't load a constant to memory.  You have to use the 
accumulator:

ld a,7
ld (var),a

BTW: TASM will allow you to write to any address in memory, not just 
saferam.  You need to be careful because of this, as you can do some damage 
to settings and programs by writing to the wrong place.  You can also use 
this capability to change your own data tables:

ld a,7
ld dat,a
dat:
db. 08d

Now the number that you get by lding from dat is 7 rather than 8.

Hpoe it helps:

-Gavin O.






Follow-Ups: References: