BIOS延迟功能出现问题(INT 15h/AH = 86h) [英] Problems with BIOS delay function (INT 15h / AH = 86h)
问题描述
我今年开始在学校学习汇编,我们才刚刚开始学习像素.
I began studying assembly this year in my school, and we just started learning about pixels.
我们的老师给了我们一些代码,并告诉我们弄乱它,他还告诉我们尝试在代码中实施延迟(ah = 86h | int 15h),但是当我尝试使用它的位置和颜色的一些像素发生了变化,我不明白为什么
Our teacher gave us some code and told us to mess around with it, he also told us to try and implement delay in the code(ah=86h|int 15h), but when i tried to use it the location and colors of some pixels got changed, and i don't understand why
代码:(只是一段代码,延迟之后,还有更多代码会毁掉)
code: (just a piece of the code, there is some more there also get's ruined after the delay)
mov cx, 20
add [y], 2
mov dx, [y]
paint1RowOf10:
mov bh, 0h
mov bx, cx
add [x], 1
mov cx, [x]
add [y], 4
mov dx, [y]
mov ax, [red]
mov ah,0ch
int 10h
; here is a delay part, it waits for 1 seconde
; from the help of assembly:
; INT 15h / AH = 86h - BIOS wait function.
;CX:DX = interval in microseconds (these are notes from my teacher)
mov ah, 86h
mov cx, 1
mov dx, 2
int 15h
mov cx, bx
loop paint1RowOf10
这是结果 http://prntscr.com/9a8lpw 您能告诉我为什么会这样吗?因为据我所知,像素应该排成一行,并且不会改变颜色.
This is the result http://prntscr.com/9a8lpw can you tell me why does this happen? because as far as i see, the pixels are supposed to go in one line, and not change colors.
推荐答案
有一个奇怪的事实,关于int 15h ah = 86h 您还需要设置al = 0,除非它出现不稳定的行为
There is a weird fact, about int 15h ah=86h you also need to set al=0, unless it get an erratic behavior
延迟代码:
mov al, 0
mov ah, 86h
mov cx, 1
mov dx, 2
int 15h
mov al, 0
mov ah, 86h
mov cx, 1
mov dx, 2
int 15h
我通过试错法发现了它,并且意识到当al = 0时 可以.
I discovered it with try-and-error method and I realize when al=0 it works.
这篇关于BIOS延迟功能出现问题(INT 15h/AH = 86h)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!