83 ASM: storing to an outside variable


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

83 ASM: storing to an outside variable



Does anyone know how to store to a non-asm variable such as 'X'
I want to do the following:
 
ld a,'X'
cp 1
jp z,loop1
ld a,'X'
cp 4
jp z,loop2
 
But, in other parts of the program, I need to store 1 to X and 4 to X. I've tried doing:
ld 'X',1 and
ld 'X',4
 
I cannot seem to find any registers unaffected by the calls I used in the rest of the program, so I turned to an outside variable.  To those of you who might suggest storing the values to X using a basic program, I absolutely have to be able to do within the ASM program in order to change which label the program goes to, to alter the execution if another part has already been done and that the program is repeating itself.
 
Any help is appreciated.
 
NE