A86: Re: Z80 & new game preview


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

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


----- Original Message -----
From: Robin Harbron <macbeth@psw.nu>
To: <assembly-86@lists.ticalc.org>
Sent: Saturday, November 27, 1999 7:17 PM
Subject: A86: Z80 & new game preview


> While I'm typing, I just had to mention how easy it is to
> code the Z80 after spending years with the 6502.  The Z80
> has loads of registers to play with, and being able to
> test conditions *and* branch/jump/call all in one instruction
> is so nice - man, it feels like I'm programming in BASIC :)
>
> At the same time, boy these instructions take a lot of cycles,
> but I guess that doesn't matter so much since the Z80 always
> had proportionally much higher clock speeds compared with the
> 65xx.
>
> Anyway, I really can't sympathize with the folks complaining
> about how hard and unforgiving ASM on the TI is - not that
> any of you here are saying that here - but I agree with
> whoever said on the Spasmic or Basmic or whatever debate on
> ticalc.org that "Z80 is one of the easiest ASMs to learn".
>
> The preview of my first ever Z80 or TI game (3 nights of work so
> far, after I put the kids to bed :) is available for download at:
> http://www.psw.nu/ti86.htm
>
> I uploaded it to ticalc a few nights ago, but still haven't
> seen it there.  And no, the game doesn't really erase your
> calculator's memory, that's meant to be a joke.
> --
> Robin Harbron     macbeth@psw.nu
>  http://www.tbaytel.net/macbeth
>        http://www.psw.nu/



Follow-Ups: References: