A86: Re: Re: Z80 & new game preview


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

A86: Re: Re: Z80 & new game preview




Heh I forgot to mention that the routine does BC = A * B

----- Original Message -----
From: Kirk Meyer <kirkmeyer@bigfoot.com>
To: <assembly-86@lists.ticalc.org>
Sent: Saturday, November 27, 1999 7:55 PM
Subject: A86: Re: Z80 & new game preview


> Turns out if you read further down the page, the one posted there doesn't
> work all the time. Okay here's our little routine (please don't post
> anywhere, it'll be posted in due time). Both table1 & table2 can be easily
> generated at runtime.
>
> ; 105 t-states (not counting ret), 23 bytes (in case you put it inline)
>
>      ld   h,table1   ;7
>      sub  b          ;4
>      ld   l,a        ;4
>      ld   l,(hl)     ;7
>      inc  h          ;4
>      add  a,b        ;4
>      add  a,b        ;4
>      ld   e,a        ;4
>      ld   a,table2/2 ;7
>      adc  a,a        ;4
>      ld   d,a        ;4
>      ld   a,(de)     ;7
>      sub  (hl)       ;7
>      inc  d          ;4
>      inc  d          ;4
>      inc  h          ;4
>      inc  h          ;4
>      ld   c,a        ;4
>      ld   a,(de)     ;7
>      sbc  a,(hl)     ;7
>      ld   b,a        ;4
>      ret
>
> table1: ;must be at even $200 address
> ;first $100 bytes is a table to take the abs of a byte
> table2: ;must immediately follow table1
> ; next $200 bytes is LSB of 0*0/4, 1*1/4, 2*2/4, ..., 511*511/4
> ; last $200 bytes is MSB of 0*0/4, 1*1/4, 2*2/4, ..., 511*511/4




Follow-Ups: References: