David Frucht
David Frucht

Reputation: 23

emu8086 graphics mode delay

i'm trying to draw a box in emu8086, using graphics mode (vga). for some reason there is a delay between pixel to pixel, which make it looks like animation, instead drawing the box at once.

is there away to overcome this ? the delay in the debugger set to 0.

if needed, please see relevant code below:

BORDER:

    mov ax, 13h                     ;; vga mode
    int 10h

    mov cx, 640

BORDER_LOOP:

    push cx 
    mov bh, 0h     
    inc borderX
    mov cx, [borderX]

    mov dx, [borderY]
    mov al, [color]
    mov ah, 0ch
    int 10h
    pop cx
    LOOP BORDER_LOOP

Upvotes: 1

Views: 270

Answers (1)

hobbs
hobbs

Reputation: 239980

INT 10h / AH=0Ch is just not a fast way of drawing to the screen. Since you're doing mode 13h, you may as well just write to video memory directly. The segment is A000, the address is 320 * y + x (one byte per pixel, row major order, starting at the top left) — and you can draw horizontal lines (or fill the whole screen) with REP STOS and copy chunks of data with REP MOVS. In many cases you can go hundreds of times faster than calling the BIOS to draw pixels.

Upvotes: 2

Related Questions