Re: coding the Z80 and 6510 From: w_gayk@NOSPAMbielefeld.netsurf.de (Brix) Reply to: Brix Date: Tue, 3 Nov 1998 21:13:51 +0100 Organization: [Customers of] IS Internet Services GmbH & Co, Hamburg References: <70r5ec$8jp$17@newsreader1.core.theplanet.net> <3635b416.21822437@news.telepac.pt> <16476-agent.imc@comlab.ox.ac.uk> <489DCD8503%news@youmustbejoking.demon.com.uk> In article <489DCD8503%news@youmustbejoking.demon.com.uk>, news@youmustbejoking.demon.com.uk says... > In message > w_gayk@NOSPAMbielefeld.netsurf.de (Brix) wrote: > > [snip] > > So now let's fill the Memory-Area $1000 - $1100 with the Byte $44. The > > Code: > > > LDA #$44 (2 Cycles) > > LDX #$00 (2 Cycles) > > -loop STA $1000,X (5 Cycles) > > DEX (decrement X-register, 2 Cycles) > > BNE loop (Branch if not equal Zero, 2 Cycles) > > Ahem. That only fills &1000 to &10FF. (OK, so you want STA &1100, taking > another four cycles...) Sorry, but on C-64 we don't include the last byte when refering to memory adres ses. Means: A program between $1000-$1100 and one between $1100 and $1200 do NOT ove rlap. If I wanted to fill $101 bytes ($1000-$1001) I could also say: I want to fill $ 1000-$1100 including $1100.. :) This is just a little misunderstanding. > > LD HL,&1000 ; 10 > LD A,&44 ; 7 > LD B,0 ; 7 > loop LD (HL),A ; 10 > DJNZ loop ; 13/8 ; dec B, branch if non-zero > > Timings taken from Z80Em v3.00 (dev) source. If I'm not mistaken those would be 24 cycles+ 23x255 cycles + 18 cycles = 5907 Cycles.. let's say the Z80 is clocked 3.5 times as fast as the 6510 then it would be abo ut 1687.7 cycles for a 6510 to beat. My routine has 2335 cycles so you got me there. That routine looks even more similar to the 6510 code, than the others I saw. (I can even understand it partly.. wow!) But one question left: What effect has the decreasing of B to the adress in HL ? How are they connected? Oh, just read in a later posting, that the inc HL command is missing. In this case we have 6x256 cycles more, means: 7443 cycles (div by 3.5 = 2126.6 cycles to beat for 6510.. still a bit faster, but comparab le) > BTW, noting your A3010 ownership, I must point you at > ... thanx. -Brix/Plush-