A86: Re: More beginner questions
[Prev][Next][Index][Thread]
A86: Re: More beginner questions
>As I said before, I'm still a beginner. How do I add the mem address that
HL
>points to with the value in the accumulator, so that HL points to a new
>address?
>Like this:
>HL points to $9000
>and A has the value 200
>add them so that HL now points to $90C8
23 clocks cycles
----
add a, l ; 4T - Add it to L, carry modified
ld l, a ; 4T - Save changes
ld a, 0 ; 7T - Clear A - xor a clears carry; cannot use
adc a, h ; 4T - A = H + Carry
ld h, a ; 4T - Save changes
-----
However there is a bug in the emulator that doesnt seem to modify the carry
on either the add or adc instruction
I used this program on my calc to test it out and the routine works fine:
---------------
#include "ti86asm.inc"
.org _asm_exec_ram
ld a, 250
ld hl, 9000
;23 clocks
;--------
add a, l ; 4T - Add it to L
ld l, a ; 4T - Save changes
ld a, 0 ; 7T - Clear A - xor a clears carry; cannot use
adc a, h ; 4T - A = H + Carry
ld h, a ; 4T - Save changes
ld a, 0
call $4A33
ret
.end
It displays 9250
-Matt
http://www.dogtech.com/cybop/ti86/
Follow-Ups: