Re: A86:OnTemp.asm


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

Re: A86:OnTemp.asm




One byte smaller :-)

 ld hl,_alt_on_exec
 ld a,(hl)
 dec hl
 push hl
 ld de,40
 ld b,5
getchecksum:
 add hl,de
 add a,(hl)
 djnz getchecksum
 pop hl
 ld (hl),a


In a message dated Thu, 13 Jan 2000  1:13:24 AM Eastern Standard Time, "David Phillips" <david@acz.org> writes:

> 
> > Of course, there are much more efficient ways of getting checksums, but...
> 
> I might have screwed this up a bit, it's been a while and I did this from
> memory.  This should be the most efficient way to calculate checksums.  Note
> that the ROM uses the method you posted: loading constant values into HL (of
> course it does it backwards).
> 
> CalcChecksum:
>  ld hl,alt_on_exec
>  ld a,(hl)
>  dec hl
>  ld b,5
>  ld de,$28
> @loop:
>  add hl,de
>  add a,(hl)
>  djnz @loop
>  ld (alt_on_chksum),a




Follow-Ups: