Re: Large loops (was: Z80 loops)

2001-11-15 Thread Patriek Lesparre
Freya wrote: >It's beeen a long time, but I seem to remember that the command LDIR was >really easy to use and very fast!?? LDIR is great for moving memory, but the loops described by Laurens are general purpose. Greetz, Patriek -- For info, see http://www.stack.nl/~wynke/MSX/listinfo

Re: Large loops (was: Z80 loops)

2001-11-15 Thread Freya
It's beeen a long time, but I seem to remember that the command LDIR was really easy to use and very fast!?? love Freya - Original Message - From: Laurens Holst <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 15, 2001 2:01 AM Subject: Re: Large loop

Re: Large loops (was: Z80 loops)

2001-11-14 Thread Laurens Holst
> In general, for a loop with more than 256 steps, I use the following > code: > > ld bc,ITERATIONS > LOOP: push bc > ... > (whatever must be done ITERATIONS times) > ... > pop bc > dec bc > ld a,b > or c > jr nz,LOOP Faster is: ld b,ITERATIONS mod 256 ld c,(ITERATIONS-1) / 256 +1 LOOP: {do

Re: Large loops (was: Z80 loops)

2001-11-14 Thread Laurens Holst
> > > 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

Re: Large loops (was: Z80 loops)

2001-10-22 Thread Adriano Camargo Rodrigues da Cunha
> ld hl,DATA_AREA > ld de,DATA_AREA+1 > ld (hl),0 > rept 4095 > ldi > endm > 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

Re: Large loops (was: Z80 loops)

2001-10-22 Thread Ricardo Bittencourt
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,DA

Large loops (was: Z80 loops)

2001-10-22 Thread Nestor
> 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. In general, for a loop with more than 256 steps, I use the following code: ld bc,ITERATIONS LOOP: push bc ... (whatever must be done ITERATIONS times) ... pop bc dec bc ld