Heyllo here! I'm training with asm, and I wanted to make a vasm version of copysprite to optimize it.
So I started programming, and here my first version:
Code:
I'll try it after eating, but I'm sure that there's some errors. Is what I'm doing right?
So I started programming, and here my first version:
Code:
void CopySprite(const unsigned short* data, int x, int y, int width, int height) {
asm("mov #0xA8000000, r5; vram pointer"
"mul.l r2,LCD_WIDTH_PX; setting the coordonates shifting"
"add MACL, r1"
"add r1,r5; set"
"mov LCD_WIDTH_px,r6; setting the line shifting value"
"sub r3,r6"
"mov r6,r8 ; set"
"mov 0,r6; i var"
"mov 0, r7; j var"
";for each line, r6 used"
";for each pixel in line, r7 used"
"mov @r0, @r5; copying the sprite into the vram"
"add 1,r0; shifts the pointer to another pixel in the vram"
"add 1,r5; idem int the sprite"
"add 1,r6; ++j"
"cmpeq r6, r3; if j == width"
"bt -4; jumping to the second for"
";end of for each pixel in line"
"add r8,r0"
"add 1, r8; ++i"
"cmpeq r5,r4; if i == height"
"bt -9; jumping to the first for"
";en of for each line"
"");
}
I'll try it after eating, but I'm sure that there's some errors. Is what I'm doing right?