Advertisement

Win32Asm Scrolltext

Started by January 30, 2000 03:58 PM
0 comments, last by stem 24 years, 10 months ago
Hi! I''m just learning assembler. Does somebody have a source for Win32Asm which scrolls a text from bottom to top? Thanx stem
Hey. Ok try something like this. This function will scroll a 800x600x32 surface up one pixel.

void ScrollUp(DWORD *dwSurface)
{
__asm
{
// point EDI to the first line in the surface
mov edi,dwSurface

// point ESI to the next next line in the surface
mov esi,dwSurface

// one line is 800*4 pixels long
add esi,800*4

// ECX is the number of 32-bit pixels to copy minus
// one line
mov ecx,800*600-800*4

// now copy from ESI to EDI, ECX number of times
rep movsd
}
}

That should do it. I may have missed something because I just coded it off the top of my head but the basic idea is that you are copying from one line to the line just above.

The surface looks like this (# is one 32-bit pixel):

0 799
0 ################################################
1 ################################################
2 ################################################
.
.
599 ################################################

So, in the code I just gave you, EDI starts at line 0 and EDI starts at line 1. It then copies from EDI to ESI and keeps going until ESI reaches line 599. This gives the effect of the screen scrolling up.

I hope that helps you out.


~-------------------------------------------------------~
Fred Di Sano
System Programmer - Artech Studios (Ottawa.CA)
~-------------------------------------------------------~
~-------------------------------------------------------~ Fred Di Sano System Programmer - Artech Studios (Ottawa.CA)~-------------------------------------------------------~

This topic is closed to new replies.

Advertisement