dot 2 pixels together

浪子不回头ぞ 提交于 2019-12-11 00:55:45

问题


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.



来源:https://stackoverflow.com/questions/14081088/dot-2-pixels-together

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!