Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Assembler optimalisation - how to avoid a jump? (Developers)

posted by Laaca Homepage, Czech republic, 13.05.2012, 20:38

I write some kind of RLE sprite routine with clipping.
I would like to write nice code. I know I could somehow remove the ugly jump "jnc @RLE_CLIP_MOVE_CONT" but I don't know how.

In EDX is length of displayable scanline (computed by clipping routine)
In ECX is number of pixels which could be copyied. It is always>0
After clipping I sometimes can't copy all ECX bytes but only EDX bytes.
That it what this code does.

@RLE_CLIP_MOVE:
sub edx,ecx
jnc @RLE_CLIP_MOVE_CONT

add ecx,edx

@RLE_CLIP_MOVE_CONT:
shr ecx,1;rep movsd;adc ecx,ecx;rep movsw {fast 32bit write}

cmp edx,0
jle @RLE_CLIP_END_LOOP
jmp @RLE_CLIP_SCANLINE_LOOP

---
DOS-u-akbar!

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 251 users online (0 registered, 251 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum