简体   繁体   English

用fasm在装配中绘制一个三角形

[英]Draw a triangle in assembly with fasm

I'm trying to draw a triangle in assembly using fasm but I just can't make it. 我正在尝试使用fasm在装配中绘制一个三角形,但我无法做到。 I have the following code to draw a rectangle and I thought that I should just decrease the [comp] value inside the cycle "ciclopinta" but that just doesn't work (or I'm doing it wrong). 我有以下代码来绘制一个矩形,我认为我应该只减少循环“ciclopinta”中的[comp]值,但这不起作用(或者我做错了)。

org 100h
mov ah,4fh
mov al,02h
mov bx,13h
int 10h
mov [alt],50
mov [comp], 100
mov dx, 100
mov cx,100
ciclopinta:
ciclo1:
mov ah,0ch
mov al,23h
mov bh, 0
int 10h
dec cx
dec byte[comp]
jnz ciclo1
mov cx, 100
mov [comp],100
dec dx
dec byte [alt]
jnz ciclopinta

mov ah, 07h
int 21h
mov ah,4ch
int 21h

comp rb 1
alt rb 1
 mov ah,4fh mov al,02h mov bx,13h int 10h 

Why are you using a VESA function to set a legacy video mode? 为什么使用VESA功能设置传统视频模式? Normally that shouldn't work. 通常这不应该工作。 Better use the following: 更好地使用以下内容:

mov ax, 0013h  ;320x200 256-colors
int 10h

Near the end of the program you use the BIOS function 07h to ScrollWindowUp but you don't setup all the parameters for it to work. 在程序结束时,您使用BIOS功能07h到ScrollWindowUp,但您没有设置所有参数使其工作。 Best remove these lines mov ah, 07h int 21h 最好删除这些行的动作mov ah, 07h int 21h


Your idea to decrement the comp variable is good. 你减少comp变量的想法是好的。 I suggest you write: 我建议你写一下:

dec dx
mov [comp], dl  ;It's a byte-sized variable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM