GP32 Matkeupon's Fastasmblit Functions


Blah

Wanna Be Programmer
Joined
Dec 18, 2003
Messages
3,253
Age
35
Location
Oregon, USA
Website
Visit site
I've been having trouble getting the "asmclip" functions included in the latest version of Mirko's to work. I've figure out by trial and error and inference, that it needs lcd style 90 degree rotated 16 bit raw data, and I've figured out *most* of the variables which the functions take, but the image never shows up correctly. I'm getting about half of the 320x240 picture horizantally (full vertically) to show up almost correctly (colors a little bit different). The old sdk functions work fine, but I'm trying to figure out these ones because they're faster.

So here is the simplest code I could come up with to test it.
Code:
#include "gp32.h"
#include "data.h"

int main() {

  unsigned short *framebuffer1;
  framebuffer1 = (unsigned short*) FRAMEBUFFER1;
  gp_setCpuspeed(133);
  gp_initFramebuffer(framebuffer1,16,85);
  gp_clearFramebuffer16(framebuffer1,0xFFFF);
  gp_FastTransBlit(framebuffer1,0,0,320,240,wasteland,0);
while (1) {
}
}
But it gives the above problems.

Anybody there?
 
Ok, I still can't get it to work, trying with Unit3's very good DemonicaGameLib instead...Still don't know how good Matkeupons functions are and would like to know. Also DemonicaGameLib lacks zoom support.
 
Well, the problem is, I don't really know what exactly Mr Mirko changed in my function, and how it is implemented.

I didn't bother to make an asm clipping routine, so maybe a c version could help you.

Here's how I do it for my ASMFastTransBlit function. But you should ask Mr Mirko directly if there is still my asm version, or only the clipped version.

Code:
void FastTransBlit(const int numsurface, int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans) {
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(dx < 0) {
  xmin = -dx;
	} else xmin = 0;
	if( (dx++ + width) > screen_width) {
  xmax = screen_width - dx;
	} else xmax = width - 1;
	if(dy < 0) {
  ymax = height + dy - 1;
	} else ymax = height - 1;
	if( (dy + height) > screen_height) {
  ymin = dy + height - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
	src += (xmax * height2 + ymin);
	ASMFastTransBlit(src, dst4, xmax - xmin, ymax - ymin, height2, trans);
}

So this is just the clipping routine I use, but I don't know what ASMFastTransBlit is called and if it is available in Mr Mirko's sdk.
 
Its in the source.addons directory in the latest distro if you want to check it out.

edit: Here...

gp_clipped.c:
Code:
/*
 * Blitting lib - gp_clipped.c
 *
 * Copyright © 2003,2004,2005  CARTIER Matthieu <matkeupon@wanadoo.fr>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Changelog:
 *
 *  25 Jan 2005 - CARTIER Matthieu <matkeupon@wanadoo.fr>
 *   first release
 *
*/


//Some global variables and macros

#define	screen_width	320
#define	screen_height	240

#define	mulzoom(nb)	( ( (nb) * zoomf) >> 10)
#define	divzoom(nb)	( ( (nb) * zoominv) >> 10)

int zoomf, zoominv;

void changezoom(int newzoom) {
	zoomf = newzoom;
	zoominv = 1048576 / zoomf + 1;
}

//No zoom

//void FastTransBlit(const int numsurface, int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans) {
void gp_FastTransBlit(void *framebuffer, int dx, const int dy, const int width2, const int height, const unsigned char *src, const int trans) {
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;
             int width = ( (width + 3) >> 2) << 2;
	if(dx < 0) {
  xmin = -dx;
	} else xmin = 0;
	if( (dx++ + width) > screen_width) {
  xmax = screen_width - dx;
	} else xmax = width - 1;
	if(dy < 0) {
  ymax = height + dy - 1;
	} else ymax = height - 1;
	if( (dy + height) > screen_height) {
  ymin = dy + height - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
	unsigned char *dst4 = framebuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
	src += (xmax * height2 + ymin);
	ASMFastTransBlit(src, dst4, xmax - xmin, ymax - ymin, height2, trans);
}

//void FastSolidBlit(const int numsurface, int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul) {
void gp_FastSolidBlit(void *framebuffer, int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul) {
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(dx < 0) {
  xmin = -dx;
	} else xmin = 0;
	if( (dx++ + width) > screen_width) {
  xmax = screen_width - dx;
	} else xmax = width - 1;
	if(dy < 0) {
  ymax = height + dy - 1;
	} else ymax = height - 1;
	if( (dy + height) > screen_height) {
  ymin = dy + height - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
	unsigned char *dst4 = framebuffer + (dx + xmax) * screen_height - height - dy + 1 + ymin;
	src += (xmax * height2 + ymin);
	ASMFastSolidBlit(src, dst4, xmax - xmin, ymax - ymin, height2, trans, coul);
}

//Zoom

//void ZoomBlit(const int numsurface, const int dx, const int dy, const int width, const int height, const unsigned char *src) {
void gp_ZoomBlit(void *framebuffer, const int dx, const int dy, const int width, const int height, const unsigned char *src) {
	int x2 = divzoom(dx);
	int y2 = divzoom(dy);
	int w2 = divzoom(dx + width) - x2;
	int h2 = divzoom(dy + height) - y2;
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(x2 < 0) {
  xmin = -x2;
	} else xmin = 0;
	if( (x2++ + w2) > screen_width) {
  xmax = screen_width - x2;
	} else xmax = w2 - 1;
	if(y2 < 0) {
  ymax = h2 + y2 - 1;
	} else ymax = h2 - 1;
	if( (y2 + h2) > screen_height) {
  ymin = y2 + h2 - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	unsigned char *dst4 = framebuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	src += mulzoom(xmin) * height2 + mulzoom(ymin);
	ASMZoomBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf);
}

//void ZoomTransBlit(const int numsurface, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans) {
void gp_ZoomTransBlit(void *framebuffer, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans) {
	int x2 = divzoom(dx);
	int y2 = divzoom(dy);
	int w2 = divzoom(dx + width) - x2;
	int h2 = divzoom(dy + height) - y2;
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(x2 < 0) {
  xmin = -x2;
	} else xmin = 0;
	if( (x2++ + w2) > screen_width) {
  xmax = screen_width - x2;
	} else xmax = w2 - 1;
	if(y2 < 0) {
  ymax = h2 + y2 - 1;
	} else ymax = h2 - 1;
	if( (y2 + h2) > screen_height) {
  ymin = y2 + h2 - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	unsigned char *dst4 = framebuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	src += mulzoom(xmin) * height2 + mulzoom(ymin);
	ASMZoomTransBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans);
}

//void ZoomSolidBlit(const int numsurface, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul) {
void gp_ZoomSolidBlit(void *framebuffer, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul) {
	int x2 = divzoom(dx);
	int y2 = divzoom(dy);
	int w2 = divzoom(dx + width) - x2;
	int h2 = divzoom(dy + height) - y2;
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(x2 < 0) {
  xmin = -x2;
	} else xmin = 0;
	if( (x2++ + w2) > screen_width) {
  xmax = screen_width - x2;
	} else xmax = w2 - 1;
	if(y2 < 0) {
  ymax = h2 + y2 - 1;
	} else ymax = h2 - 1;
	if( (y2 + h2) > screen_height) {
  ymin = y2 + h2 - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	unsigned char *dst4 = framebuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
	src += mulzoom(xmin) * height2 + mulzoom(ymin);
	ASMZoomSolidBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans, coul);
}



//These can be flipped horizontally with cote (cote = 1 => normal, cote = -1 => flipped

//void ZoomTransBlit(const int numsurface, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int cote) {
void gp_ZoomTransBlitFlip(void *framebuffer, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int cote) {
	int x2 = divzoom(dx);
	int y2 = divzoom(dy);
	int w2 = divzoom(width);
	int h2 = divzoom(height);
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(y2 < 0) {
  ymax = h2 + y2 - 1;
	} else ymax = h2 - 1;
	if( (y2 + h2) > screen_height) {
  ymin = y2 + h2 - screen_height;
	} else ymin = 0;
	if(ymin > ymax) return;

	unsigned char *dst4;
	if(cote > 0) {
  if(x2 < 0) {
  	xmin = -x2;
  } else xmin = 0;
  if( (x2++ + w2) > screen_width) {
  	xmax = screen_width - x2;
  } else xmax = w2 - 1;
  if(xmin > xmax) return;

  //dst4 = gpDraw[numsurface].ptbuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
  dst4 = framebuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
  src += mulzoom(xmin) * height2 + mulzoom(ymin);
  ASMZoomTransBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans);
	} else {
  if(x2 < 0) {
  	xmax = w2 + x2 - 1;
  } else xmax = w2 - 1;
  if( (x2 + w2) > screen_width) {
  	xmin = x2 + w2 - screen_width;
  } else xmin = 0;
  if(xmin > xmax) return;

  //dst4 = gpDraw[numsurface].ptbuffer + (x2 + w2 - xmax) * screen_height - h2 - y2 + ymin;
  dst4 = framebuffer + (x2 + w2 - xmax) * screen_height - h2 - y2 + ymin;
  src += mulzoom(xmin) * height2 + mulzoom(ymin);
  ASMZoomTransInvBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans);
	}
}

//void ZoomSolidBlit(const int numsurface, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul, const int cote) {
void gp_ZoomSolidBlitFlip(void *framebuffer, const int dx, const int dy, const int width, const int height, const unsigned char *src, const int trans, const int coul, const int cote) {
	int x2 = divzoom(dx);
	int y2 = divzoom(dy);
	int w2 = divzoom(width);
	int h2 = divzoom(height);
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(y2 < 0) {
  ymax = h2 + y2 - 1;
	} else ymax = h2 - 1;
	if( (y2 + h2) > screen_height) {
  ymin = y2 + h2 - screen_height;
	} else ymin = 0;
	if(ymin > ymax) return;

	unsigned char *dst4;
	if(cote > 0) {
  if(x2 < 0) {
  	xmin = -x2;
  } else xmin = 0;
  if( (x2++ + w2) > screen_width) {
  	xmax = screen_width - x2;
  } else xmax = w2 - 1;
  if(xmin > xmax) return;

  //dst4 = gpDraw[numsurface].ptbuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
  dst4 = framebuffer + (x2 + xmax) * screen_height - h2 - y2 + 1 + ymin;
  src += mulzoom(xmin) * height2 + mulzoom(ymin);
  ASMZoomSolidBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans, coul);
	} else {
  if(x2 < 0) {
  	xmax = w2 + x2 - 1;
  } else xmax = w2 - 1;
  if( (x2 + w2) > screen_width) {
  	xmin = x2 + w2 - screen_width;
  } else xmin = 0;
  if(xmin > xmax) return;

  //dst4 = gpDraw[numsurface].ptbuffer + (x2 + w2 - xmax) * screen_height - h2 - y2 + ymin;
  dst4 = framebuffer + (x2 + w2 - xmax) * screen_height - h2 - y2 + ymin;
  src += mulzoom(xmin) * height2 + mulzoom(ymin);
  ASMZoomSolidInvBlit(src, dst4, xmax - xmin, ymax - ymin, height2, zoomf, trans, coul);
	}
}

//Copy from framebuffer to dest

//void SaveBitmap(const int numsurface, int dx, const int dy, const int width, const int height, const unsigned char *dest) { //Sur l'écran
void gp_SaveBitmap(void *framebuffer, int dx, const int dy, const int width, const int height, const unsigned char *dest) { //Sur l'icran
	int xmin, ymin, xmax, ymax;
	int height2 = ( (height + 3) >> 2) << 2;

	if(dx < 0) {
  xmin = -dx;
	} else xmin = 0;
	if( (dx++ + width) > screen_width) {
  xmax = screen_width - dx;
	} else xmax = width - 1;
	if(dy < 0) {
  ymax = height + dy - 1;
	} else ymax = height - 1;
	if( (dy + height) > screen_height) {
  ymin = dy + height - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	//unsigned char *src4 = gpDraw[numsurface].ptbuffer + (dx + xmax) * screen_height - height - dy + ymin;
	unsigned char *src4 = framebuffer + (dx + xmax) * screen_height - height - dy + ymin;
	dest += (xmin * height2 + ymin + 1);
	ASMSaveBitmap(src4, dest, xmax - xmin, ymax - ymin, height2);
}

//Clears area with color #0, should not trigger clicky noise

//void FastClear(int numsurface, int dx, int dy, int width, int height) {
void gp_FastClear(void *framebuffer, int dx, int dy, int width, int height) {
	int xmin, ymin, xmax, ymax;

	if(dx < 0) {
  xmin = -dx;
	} else xmin = 0;
	if( (dx++ + width) > screen_width) {
  xmax = screen_width - dx;
	} else xmax = width - 1;
	if(dy < 0) {
  ymax = height + dy - 1;
	} else ymax = height - 1;
	if( (dy + height) > screen_height) {
  ymin = dy + height - screen_height;
	} else ymin = 0;
	if( (xmin > xmax) || (ymin > ymax) ) return;

	int decaly = screen_height - height - dy;

	//unsigned char *dst4 = gpDraw[numsurface].ptbuffer + (dx + xmax) * screen_height - height - dy + ymin;
	unsigned char *dst4 = framebuffer + (dx + xmax) * screen_height - height - dy + ymin;
	ASMFastClear(dst4, xmax - xmin, ymax - ymin);
}

gp_asmlib.s:
Code:
@ ******** ASMZoomBlit(unsigned char *src, unsigned char *dst4, int nbx, int nby, int height2, int zoom) ********

	.ALIGN
	.GLOBAL ASMZoomBlit
	.TYPE   ASMZoomBlit, function
	.CODE 32

@r0 = src
@r1 = dst4
@r2 = nbx
@r3 = nby

@r6 = height2
@r7 = zoom
@r8 = tmp
@r9 = tmp
@r10 = tmpnby
@r11 = src4

ASMZoomBlit:

	sub  sp,sp,#8
        stmfd  r13!,{r6-r11}
        ldr  r6,[r13,#32]
        ldr  r7,[r13,#36]

_bx:
	MUL  r8,r7,r2  @Calcul de src4
	MOV  r9,r8,LSR #10
	MLA  r11,r9,r6,r0
	MOV  r10,r3
	MUL  r8,r7,r10

_by:
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]
	BMI  _fincol
	LDRB  r9,[r11,+r8,LSR #10]
	SUBS  r10,r10,#1
	MULPL	r8,r7,r10
	STRB  r9,[r1,+r10]

	BPL  _by

_fincol:
	SUB  r1,r1,#240
	SUBS  r2,r2,#1
	BPL  _bx

        ldmfd  r13!,{r6-r11}
	add  sp,sp,#8
	bx  lr



@ ******** ASMZoomTransBlit(unsigned char *src, unsigned char *dst4, int nbx, int nby, int height2, int zoom, int trans) ********

	.ALIGN
	.GLOBAL ASMZoomTransBlit
	.TYPE   ASMZoomTransBlit, function
	.CODE 32

@r0 = src
@r1 = dst4
@r2 = nbx
@r3 = nby

@r5 = trans
@r6 = height2
@r7 = zoom
@r8 = tmp
@r9 = tmp
@r10 = tmpnby
@r11 = src4

ASMZoomTransBlit:

	sub  sp,sp,#12
        stmfd  r13!,{r5-r11}
        LDR  r6,[r13,#40]
        LDR  r7,[r13,#44]
        LDR  r5,[r13,#48]

_bx2:
	MUL  r8,r7,r2
	MOV  r9,r8,LSR #10
	MLA  r11,r9,r6,r0
	MUL  r8,r7,r3
	SUBS  r10,r3,#1
	BMI  _fincol2

_by2:
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol2
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1

	BPL  _by2

_fincol2:    	@Dernier pixel
	LDRB  r9,[r11,+r8,LSR #10]
	SUB  r1,r1,#240
	TEQ  r5,r9
	STRNEB	r9,[r1,#239]

	SUBS  r2,r2,#1
	BPL  _bx2

        ldmfd  r13!,{r5-r11}
	add  sp,sp,#12
	bx  lr



@ ******** ASMZoomTransInvBlit(unsigned char *src, unsigned char *dst4, int nbx, int nby, int height2, int zoom, int trans) ********

	.ALIGN
	.GLOBAL ASMZoomTransInvBlit
	.TYPE   ASMZoomTransInvBlit, function
	.CODE 32

@r0 = src
@r1 = dst4
@r2 = nbx
@r3 = nby

@r5 = trans
@r6 = height2
@r7 = zoom
@r8 = tmp
@r9 = tmp
@r10 = tmpnby
@r11 = src4

ASMZoomTransInvBlit:

	sub  sp,sp,#12
        stmfd  r13!,{r5-r11}
        LDR  r6,[r13,#40]
        LDR  r7,[r13,#44]
        LDR  r5,[r13,#48]

_bx3:
	MUL  r8,r7,r2
	MOV  r9,r8,LSR #10
	MLA  r11,r9,r6,r0
	MUL  r8,r7,r3
	SUBS  r10,r3,#1
	BMI  _fincol3

_by3:
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol3
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r9,[r1,+r10]
	SUBS  r10,r10,#1

	BPL  _by3

_fincol3:    	@Dernier pixel
	LDRB  r9,[r11,+r8,LSR #10]
	ADD  r1,r1,#240
	TEQ  r5,r9
	STRNEB	r9,[r1,#-239]

	SUBS  r2,r2,#1
	BPL  _bx3

        ldmfd  r13!,{r5-r11}
	add  sp,sp,#12
	bx  lr



@ ******** ASMZoomSolidBlit(unsigned char *src, unsigned char *dst4, int nbx, int nby, int height2, int zoom, int trans, int coul) ********

	.ALIGN
	.GLOBAL ASMZoomSolidBlit
	.TYPE   ASMZoomSolidBlit, function
	.CODE 32

@r0 = src
@r1 = dst4
@r2 = nbx
@r3 = nby

@r4 = coul
@r5 = trans
@r6 = height2
@r7 = zoom
@r8 = tmp
@r9 = tmp
@r10	= tmpnby
@r11 = src4

ASMZoomSolidBlit:

	sub  sp,sp,#16
        stmfd  r13!,{r4-r11}
        LDR  r6,[r13,#48]
        LDR  r7,[r13,#52]
        LDR  r5,[r13,#56]
	LDR  r4,[r13,#60]

_bx4:
	MUL  r8,r7,r2
	MOV  r9,r8,LSR #10
	MLA  r11,r9,r6,r0
	MUL  r8,r7,r3
	SUBS  r10,r3,#1
	BMI  _fincol4

_by4:
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol4
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1

	BPL  _by4

_fincol4:    	@Dernier pixel
	LDRB  r9,[r11,+r8,LSR #10]
	SUB  r1,r1,#240
	TEQ  r5,r9
	STRNEB	r4,[r1,#239]

	SUBS  r2,r2,#1
	BPL  _bx4

        ldmfd  r13!,{r4-r11}
	add  sp,sp,#16
	bx  lr



@ ******** ASMZoomSolidInvBlit(unsigned char *src, unsigned char *dst4, int nbx, int nby, int height2, int zoom, int trans, int coul) ********

	.ALIGN
	.GLOBAL ASMZoomSolidInvBlit
	.TYPE   ASMZoomSolidInvBlit, function
	.CODE 32

@r0 = src
@r1 = dst4
@r2 = nbx
@r3 = nby

@r4 = coul
@r5 = trans
@r6 = height2
@r7 = zoom
@r8 = tmp
@r9 = tmp
@r10	= tmpnby
@r11 = src4

ASMZoomSolidInvBlit:

	sub  sp,sp,#16
        stmfd  r13!,{r4-r11}
        LDR  r6,[r13,#48]
        LDR  r7,[r13,#52]
        LDR  r5,[r13,#56]
	LDR  r4,[r13,#60]

_bx5:
	MUL  r8,r7,r2
	MOV  r9,r8,LSR #10
	MLA  r11,r9,r6,r0
	MUL  r8,r7,r3
	SUBS  r10,r3,#1
	BMI  _fincol5

_by5:
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1
	BMI  _fincol5
	LDRB  r9,[r11,+r8,LSR #10]
	MULPL	r8,r7,r10
	TEQ  r5,r9
	STRNEB	r4,[r1,+r10]
	SUBS  r10,r10,#1

	BPL  _by5

_fincol5:    	@Dernier pixel
	LDRB  r9,[r11,+r8,LSR #10]
	ADD  r1,r1,#240
	TEQ  r5,r9
	STRNEB	r4,[r1,#-239]

	SUBS  r2,r2,#1
	BPL  _bx5

        ldmfd  r13!,{r4-r11}
	add  sp,sp,#16
	bx  lr



@ ******** ASMFastTransBlit(unsigned char *src4, unsigned char *dst4, int nbx, int nby, int height2, int trans) ********

	.ALIGN
	.GLOBAL ASMFastTransBlit
	.TYPE   ASMFastTransBlit, function
	.CODE 32

@r0 = src4
@r1 = dst4
@r2 = nbx
@r3 = nby

@r4 = height2
@r5 = trans
@r6 = tmp
@r7 = tmpnby
@r8 = tmp2

ASMFastTransBlit:

	sub  sp,sp,#8
        stmfd  r13!,{r4-r8}
        ldr  r4,[r13,#28]
        ldr  r5,[r13,#32]

_bx7:
	ldrb  r8,[r0,+r3]  @lecture 1er pixel
	subs  r7,r3,#1
	bmi  _sauty2

_by7:
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2
	LDRB  r6,[r0,+r7]
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUBS  r7,r7,#1
	BMI  _sauty2b
	LDRB  r8,[r0,+r7]
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUBS  r7,r7,#1

	BPL  _by7

_sauty2:    	@ecriture r8
	TEQ  r8,r5
	STRNEB	r8,[r1,+r7]
	SUB  r0,r0,r4
	SUB  r1,r1,#240
	SUBS  r2,r2,#1
	BPL  _bx7

        ldmfd  r13!,{r4-r8}
	add  sp,sp,#8
	bx  lr

_sauty2b:    	@ecriture r6
	TEQ  r6,r5
	STRNEB	r6,[r1,+r7]
	SUB  r0,r0,r4
	SUB  r1,r1,#240
	SUBS  r2,r2,#1
	BPL  _bx7

        ldmfd  r13!,{r4-r8}
	add  sp,sp,#8
	bx  lr



@ ******** ASMFastSolidBlit(unsigned char *src4, unsigned char *dst4, int nbx, int nby, int height2, int trans, int coul) ********

	.ALIGN
	.GLOBAL ASMFastSolidBlit
	.TYPE   ASMFastSolidBlit, function
	.CODE 32

@r0 = src4
@r1 = dst4
@r2 = nbx
@r3 = nby

@r4 = height2
@r5 = trans
@r6 = coul
@r7 = tmp
@r8 = tmpnby
@r9 = tmp2

ASMFastSolidBlit:

	sub  sp,sp,#12
        stmfd  r13!,{r4-r9}
        ldr  r4,[r13,#36]
        ldr  r5,[r13,#40]
        ldr  r6,[r13,#44]

_bx8:
	ldrb  r9,[r0,+r3]  @lecture 1er pixel
	subs  r8,r3,#1
	bmi  _sauty2

_by8:
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3
	LDRB  r7,[r0,+r8]
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1
	BMI  _sauty3b
	LDRB  r9,[r0,+r8]
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUBS  r8,r8,#1

	BPL  _by8

_sauty3:    	@ecriture pour r9
	TEQ  r9,r5
	STRNEB	r6,[r1,+r8]
	SUB  r0,r0,r4
	SUB  r1,r1,#240
	SUBS  r2,r2,#1
	BPL  _bx8

        ldmfd  r13!,{r4-r9}
	add  sp,sp,#12
	bx  lr

_sauty3b:    	@ecriture pour r7
	TEQ  r7,r5
	STRNEB	r6,[r1,+r8]
	SUB  r0,r0,r4
	SUB  r1,r1,#240
	SUBS  r2,r2,#1
	BPL  _bx8

        ldmfd  r13!,{r4-r9}
	add  sp,sp,#12
	bx  lr



@ ******** ASMSaveBitmap(unsigned char *src4, unsigned char *dst, int nbx, int nby, int height2) ********

	.ALIGN
	.GLOBAL ASMSaveBitmap
	.TYPE   ASMSaveBitmap, function
	.CODE 32

@r0 = src4
@r1 = dst + 1
@r2 = nbx
@r3 = nby

@r7 = height2
@r8 = tmp
@r9 = tmpnby
@r10 = dst4

ASMSaveBitmap:

	sub  sp,sp,#4
        stmfd  r13!,{r7-r10}
        LDR  r7,[r13,#20]

_bx6:
	MLA  r10,r2,r7,r1
	MOV  r9,r3

_by6:
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]
	BMI  _fincol6
	LDRB  r8,[r0,+r9]
	SUBS  r9,r9,#1
	STRB  r8,[r10,+r9]

	BPL  _by6

_fincol6:
	SUB  r0,r0,#240
	SUBS  r2,r2,#1
	BPL  _bx6

        ldmfd  r13!,{r7-r10}
	add  sp,sp,#4
	bx  lr



@ ******** ASMMix(unsigned short *buf, s_mix *pmix, int len) ********

	.ALIGN
	.GLOBAL ASMMix
	.TYPE   ASMMix, function
	.CODE 32

@r0 = buf
@r1 = pmix
@r2 = len

@r3 = tmp
@r6 = tmpi
@r7 = #32768
@r8 = tmp
@r9 = tmp
@r10 = tmp
@r11 = sample

@LDMDB - pre-decrement
@LDMIA - post-increment

ASMMix:

        stmfd  sp!,{r6-r11}
	MOV  r7,#32768

bouclemix:
	LDMIA	r1,{r8-r9}  @canal 0
	MOV  r6,#14
	ADD  r3,r1,#16
	CMP  r8,r9
	BEQ  sautboucle0	@Le son boucle peut-être
	LDRMIH	r9,[r8],#2
	STRMI	r8,[r1]
	SUBMI	r11,r9,#32768
	MOVPL	r11,#0

bouclevoix:
	LDMIA	r3,{r8-r9}  @autres canaux
	ADD  r3,r3,#16
	CMP  r8,r9
	BEQ  sautbouclen	@Le son boucle peut-être
	LDRMIH	r9,[r8],#2
	STRMI	r8,[r3,#-16]
	SUBMI	r9,r9,#32768
	ADDMI	r11,r11,r9

	SUBS  r6,r6,#1
	BPL  bouclevoix

sautbouclevoix:
	ADD  r8,r11,#262144
	RSB  r11,r7,r8,LSR #2
	CMP  r11,#65536  @Saturation
	MVNPL	r11,#0
	CMPMI	r11,#0
	MOVMI	r11,#0
	STRH  r11,[r0],#2
	SUBS  r2,r2,#1
	BNE  bouclemix

        ldmfd  sp!,{r6-r11}
	bx  lr

sautboucle0:
	LDMDB	r3,{r9-r10}  @On regarde s'il faut répéter
	SUBS  r9,r9,#1
	STRPL	r10,[r1]  @On boucle
	STRPL	r9,[r1,#8]
	BPL  bouclemix
	ADD  r8,r8,#2  @On marque le son comme fini
	STR  r8,[r1]
	MOV  r11,#0
	B  bouclevoix

sautbouclen:
	LDMDB	r3,{r9-r10}  @On regarde s'il faut répéter
	SUBS  r9,r9,#1
	STRPL	r10,[r3,#-16]	@On boucle
	STRPL	r9,[r3,#-8]
	SUBPL	r3,r3,#16
	BPL  bouclevoix
	ADD  r8,r8,#2  @On marque le son comme fini
	STR  r8,[r3,#-16]

	SUBS  r6,r6,#1
	BPL  bouclevoix
	B  sautbouclevoix



@ ******** ASMFastClear(unsigned char *dst4, int nbx, int nby) ********

	.ALIGN
	.GLOBAL ASMFastClear
	.TYPE   ASMFastClear, function
	.CODE 32

@r0 = dst4
@r1 = nbx
@r2 = nby

@r3 = #0
@r4 = tmpnby

@optimisé pour h=20

ASMFastClear:

	str  r4,[sp,#-4]!
	MOV  r3,#0

_bx9:
	MOV  r4,r2

_by9:
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1
	BMI  _sauty4
	STRB  r3,[r0,+r4]
	SUBS  r4,r4,#1

	BPL  _by9

_sauty4:
	SUB  r0,r0,#240
	SUBS  r1,r1,#1
	BPL  _bx9

	ldr  r4,[sp],#4
	bx  lr
 
Erm, just noticed something.
Mr Mirko inverted the width and width2 vars in the c code, and that's what might cause the trouble. Try replacing gp_FastTransBlit by what I posted before, calling directly ASMFastTransBlit.

By the way, my routines are more interesting for blitting objects to screen and not to copy a full screen from ram to display memory. The transblit in there would be a lot slower than just a gm_memcpy (or than DMA). (This is the case where the whole screen is copied, or the whole screen vertically).
 
Try Changing this:
Code:
void gp_FastTransBlit(void *framebuffer, int dx, const int dy, const int width2, const int height, const unsigned char *src, const int trans) {
 int xmin, ymin, xmax, ymax;
 int height2 = ( (height + 3) >> 2) << 2;
             int width = ( (width + 3) >> 2) << 2;

TO:

Code:
void gp_FastTransBlit(void *framebuffer, int dx, const int dy, const int width2, const int height, const unsigned char *src, const int trans) {
 int xmin, ymin, xmax, ymax;
 int height2 = ( (height + 3) >> 2) << 2;
             int width = ( (width2 + 3) >> 2) << 2;
 
Hmm...It still doesn't work. Oh well, I'll just work on other stuff and get back to this if/when DemonicaGameLib becomes too slow for my uses.
 
The code pretty screwed up. Does anybody want to take a shot at fixing it? (the asmclip code) I've tried several times but to no avail.
 
Back
Top