Re: A86: How do you store variables?


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

Re: A86: How do you store variables?



QmH writes:

> 
>  How do you store variables in 86 assembly?  For example, I made a program
>  that calculates something for my chemistry class, but I want the answer to
>  also be stored in A.
>  

As long as A already exists (and I'm hoping your output is real, and A is
also already a real), you can use the following code:

;# to be stored in A is in OP1

ld hl,Struct1   ;Not entirely sure...  Think so, tho
rst 20h
rst 10h           ;Now bde->A
ex de,hl
ld a,b             ;Now ahl->A
call _ABS_MOVFROP1_SET_D   ;$5241

Struct1:
   .db $??,1,'A',0       ;$?? is the code for real # (don't know what, tho)
and the 0 might not be needed.

That should do it...  I'm pretty sure.  Unless rst 20h doesn't use hl...?

~Stephen Hicks