Getting back into z80 programming (code included)

2009-10-24 Thread Thomas Harte
Having prototyped my new polygon filler to my satisfaction in C, today I've been converting it to assembler. With the iPhone stuff and an Acorn Electron project I've been working on, I haven't done any z80 in far too long and am not particularly optimistic that I'm writing good stuff. Actually, it

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Chris Pile
Just a quick glimps of the code shows you can save 8-clocks every itteration of your plotloop by getting rid of the SET 7,D instructions and putting a SCF before a RR D instruction. Replacing the SRL D's with RR D's. But as you're not likely to be using this particular plotloop in the final

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Thomas Harte
Oh, yeah, the plotloop is a complete placeholder, just so I can compare output to the C prototype. That said, I'd done exactly the same thing on scf versus set 7,d in my line drawing code (don't worry: just once, outside the loop). I must find time to finish documenting my vector drawing code as

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Andrew Collier
On 24 Oct 2009, at 20:08, Thomas Harte wrote: Anyway, if some of you z80 experts could have a quick look and tell me if I'm making any obvious style errors or otherwise missing obvious optimisations — even if only on a peephole level — I'd be infinitely grateful. One trick I almost always

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Thomas Harte
One trick I almost always use, is instead of: [...] Oh, yes, smart move! I'm pretty sure I had at least one copy of Electron User that thought this technique so magnificent that it got a front page mention as discover extra registers or something like that. By the way: ld d,

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Andrew Collier
On 24 Oct 2009, at 23:46, Thomas Harte wrote: By the way: ld d, (NUMVERTS) I don't think you can do this? No, you're right, you can't. It silently substituted ld a, (NUMVERTS), so that loop was running quite a bit longer than it needed to and the result not being visibly different

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Thomas Harte
With most of Andrew's comments not yet incorporated, the source code that at least does a complete poly fill is below. So I've implemented the scanning for x negative and written a quick DrawScanline function. I guess the latter is going to be the only new interesting bit. And I know I'm posting

Re: Getting back into z80 programming (code included)

2009-10-24 Thread Thomas Harte
Oh, your implied guess was quite right, I was a version behind. I'd say you fooled me by leaving Version 1.1, released 13 April 2007 at the top of the read me despite having updated the version history but actually I spotted 1.2, downloaded it and then failed to do anything more whatsoever.