Nestor wrote:
> 
> > ld hl,DATA_AREA
> > ld de,DATA_AREA+1
> > ld bc,4096-1
> > ld (hl),0
> > ldir
> 
> Yes, it is the faster method to fill a memory area.

        It's surely the smallest way to fill a memory area,
but I believe there is a faster method:

        ld hl,DATA_AREA
        ld de,DATA_AREA+1
        ld (hl),0
        rept 4095
        ldi
        endm

        Remember that LDI=16+2 clocks and LDIR=21+2 clocks
except for the final iteration, where LDIR is just like LDI.

        I did use this loop expansion inside the core of
Fudebrowser for DOS, but I believe Adriano wrote it out 
when porting to UZIX, due to lack of space. This trick
is also used inside the game "Astro Marine Corps",
replacing LDIR/LDI for OTIR/OUTI.

----------------------------------------------------------------
Ricardo Bittencourt               http://www.lsi.usp.br/~ricardo
[EMAIL PROTECTED]         "Vitrum edere possum, mihi non nocet"
------ Uniao contra o forward - crie suas proprias piadas ------
--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html

Reply via email to