A86: Re: Re: Add hl,a


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

A86: Re: Re: Add hl,a




What I usually do (because it comes up a lot) is define a call _add_hl_a
that looks like this:

add_hl_a:
 add a,l
 ld l,a
 ret nc
 inc h
 ret


>
>For constants:
> ld a,l      ; 4
> add a,N     ; 7       N is the constant
> ld l,a      ; 4
> jp nc,skip  ; 10 or 1
> inc h       ; 4
>skip:        ; = 20 or 29
>
>For A:
> add a,l     ; 4
> ld l,a      ; 4
> jp nc,skip  ; 10 or 1
> inc h       ; 4
>skip:        ; = 13 or 22
>
>If you can trash DE (or BE):
> ld d,0      ; 7
> ld e,a      ; 4 (or 7, if you load it with N)
> add hl,de   ; 11
>             ; = 22 for A, 25 for constants
>
>
>-----Original Message-----
>From: InFuZeD <zoneti@home.com>
>To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
>Date: Thursday, October 29, 1998 3:30 PM
>Subject: A86: Add hl,a
>
>
>>
>>How could I add a to hl? Is it a call? I actually need to use it to add
>>hl by $10 or 122. It's for a super small putsprite.
>>
>>-InFuZeD
>