Geoff Winkless wrote:
> OK, so my memory isn't too hot. Given that this code will 
> probably execute in screen time, is it quicker to do:

Ok, my first post here in ages, here goes...

Simplistic rule of thumb for timings on SAM - an instruction's cycles is
the official Z80 cycles rounded up to the next multiple of 4 (or 8 in
screen time), or,  4 (or 8) times the number of memory accesses;
whichever is greater.  When INs and OUTs are involved things get more
complicated!

E.g. (official/SAM normal/SAM screen)
INC A  - 4/4/8
INC HL - 6/8/8

So -
LD A, (HL)  - (2 memory accesses) - 8/16
AND C       - (1 memory access)   - 4/8
LD (HL), A  -                     - 8/16
                                  = 20/40
Or -
RES 0, (HL) - (4 memory accesses) - 16/32
RES 4, (HL) -                     - 16/32
                                  = 32/64

> It seems that method 2 runs quicker. I'd like to know why :)

Mmm, I'd have thought the first method would run quicker, even when it
was AND &EE.  I'm confused now.  Anything else going on in the loop?

Hi all,
Dave.

Reply via email to