Hey
I am fairly new to assembler and I need to be able to create a window of specified co-ordinates and fill it with a certain colour. It needs to be able to do sizes from 1 line to the full screen. I am not allowed to use interupts in my code. My attempt so far does this but does not do the right number of columns.
ASM Code:
void ClearWindow(BYTE Left, BYTE Top, BYTE Right, BYTE Bottom, BYTE Char,BYTE Colour)
{
asm {
mov ax, SCREEN_SEG
mov es, ax
xor ax, ax
mov al, Top
xor bx, bx
mov bl, SCREEN_WIDTH*2
mul bl
xor bl, bl
mov bl, Left
shl bl, 1
add ax, bx
mov di, ax
xor ax, ax
mov al, Bottom
sub al, Top
push ax
xor ax, ax
mov al, Right
sub al, Left
xor bx, bx
xor dx, dx
mov bx, ax
mov bh, 1
}
Begin:
asm {
xor ax, ax
mov al, SCREEN_WIDTH*2
sub al, bl
mov cx, ax
sub cx, 1
mov bh, 1
xor ax, ax
mov al, Char
mov ah, Colour
}
Paint:
asm {
mov es:[di], ax
add di, 2
cmp bh, bl
je Line
inc bh
loop Paint
}
Line:
asm {
inc di
loop Line
}
asm {
cmp dh, 1
jl End
cmp dh, dl
je Exit
inc dh
jmp Begin
}
End:
asm {
pop dx
mov dh, 1
jmp Begin
}
Exit:
}
Any help at all would be greatful.
Thanks, Ian