1

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
1
  • 1
    Your loop could obviously be more efficient (e.g. use registers, not memory, and a different reg for the counter to avoid push/pop cx), but presumably most of the time is spent inside the handler for int 10h. How much delay? Like multiple seconds to paint the whole screen or a whole line, or a small fraction of a second for the whole screen? Commented Jun 12, 2020 at 20:29

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.