dot 2 pixels together

2019-07-15 12:31发布

问题:

I dot a pixel right next first pixel but the result is different. Second pixel is far away from first one.

What's wrong?

org 100h
;change to 320x200 graphic mode
mov ax, 13
int 10h

;frame buffer location
push 0xa000
pop es
xor di, di

;dot 2 pixels
mov ax, 1
mov [es:di], ax
inc di
mov [es:di], ax

;prevent ending
a:
jmp a

thanks!

回答1:

There are two bugs.

First, BIOS 320x200 at 8 bits/pixel is video mode 13h (19d), not 13d as you have.

To fix it:

mov ax,13h
int 10h

The other bug is that you write ax instead of al to video memory. Replace ax with al or any other 8-bit register (ah, bl, bh, cl, ch, dl, dh):

mov al,1
mov [es:di],al
inc di
mov [es:di],al

That should do it.