如何使用循环绘制正方形(int 10h)? [英] How to draw a square (int 10h) using loops?
本文介绍了如何使用循环绘制正方形(int 10h)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您可以使用设置为10h的21h的新行吗?
如果没有,那么如何通过8086为10h设置一条新线?
我想做的是使用类似于正方形的循环.
Can you use new line that has 21h on a setting of 10h?
if not then how would it be possible to set a new line for 10h via 8086?
What im trying to do is to use loops that would resemble a square.
org 100h
mov ah, 0 ; set display mode function.
mov al, 13h ; mode 13h = 320x200 pixels, 256 colors.
int 10h ; set it!
mov cx, 10
mov dx, 10
mov ah, 0ch ; put pixel
int 10h
colcount:
inc cx
int 10h
cmp cx, 20
JNE colcount
rowcount:
inc cx
int 10h
cmp cx, 20
JNE rowcount
推荐答案
mov ah, 0 ; set display mode function.
mov al, 13h ; mode 13h = 320x200 pixels, 256 colors.
int 10h ; set it!
mov cx, 10 ;col
mov dx, 10 ;row
mov ah, 0ch ; put pixel
colcount:
inc cx
int 10h
cmp cx, 30
JNE colcount
mov cx, 10 ; reset to start of col
inc dx ;next row
cmp dx, 30
JNE colcount
(根据您的代码) 这应该画一个正方形,
(Based on your code) this should draw a square,
每次绘制连续20个像素(通过增加cx-col),然后转到下一行(增加dx-row) 并在该行中绘制20个像素.
each time drawing 20 pixels in a row(by increasing cx-col), then going to the next row(increase dx-row) and drawing 20 pixels in that row.
这将通过在20行中每行绘制20个像素来创建一个正方形
This will create a square by drawing 20pixels each row in 20 rows
这篇关于如何使用循环绘制正方形(int 10h)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文