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:
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? Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement