Original Post
Hi could someone please help me set up the functions so that it works
void putHorizLine(int x1,int x2,int y2,int color)
{
int lineoffset = y2 * (g_cscreen->pitch >> 2;
asm
{
mov ax, [g_puiScreen] // move segment of Where to AX
mov es, ax // set ES to segment of Where
mov di, [lineoffset] // set di to Y offset
add di, [x1] // add the X1 offset to DI
mov al, [color] // move Col to AL
mov ah, al // move Col to AH (we want 2 copies for word moving)
mov cx, [x2] // move X2 to CX
sub cx, [x1] // move the change in X to CX
shr cx, 1 // divide change in X by 2 (for word moving)
jnc Start // if we have an even number of moves, go to Start
stosb // otherwise, move one byte more
}
Start: asm
{
rep stosw // do it!
}
}