简体   繁体   English

在8086上通过TASM将ASCII符号写入视频存储器

[英]Writing ASCII symbols to video memory in assembly with TASM on 8086

I need to write a program for writing ASCII symbols to the video memory. 我需要编写一个将ASCII符号写入视频存储器的程序。

.model tiny
.stack
.data
.code
main: 

mov ax, 0b800h
mov ds, ax

mov aL, 'x'
mov es, bx
mov es:[1], aL

mov ah, 4ch
int 21h

end main

This code is inert as of yet; 到目前为止,该代码是惰性的; it compiles, runs and then exits without printing anything. 它会编译,运行然后退出而不打印任何内容。 I think i'm missing a line. 我想我错过了一条线。

To be able to write to the video memory, set ES to 0b800h Specify the place (Offset), on the screen where you want to write. 为了能够写入视频存储器,请将ES设置为0b800h在要写入的屏幕上指定位置(偏移)。 Set DI to (row*(max. rows (80))+col)*2 (ROW and COL are null-based). 将DI设置为(行*(最大行(80))+列)* 2(行和COL基于空值)。 For example to write to the third char in the 10th line use "mov di, (2*80+9)*2" Specify the colors in AH. 例如,要写入第10行中的第三个字符,请使用“ mov di,(2 * 80 + 9)* 2”以AH指定颜色。 Set AH to (backgroundcolor*16+foregroundcolor) for example to write light gray (7) letters on a black (0) background use "mov ah, 7" Use the STOSW instruction instead of "mov es:[adress]", al. 例如,将AH设置为(backgroundcolor * 16 + foregroundcolor),以便在黑色(0)背景上书写浅灰色(7)字母,请使用“ mov ah,7”,而不是“ mov es:[adress]”,请使用STOSW指令。 This way you can dynamically write to different places on the screen. 这样,您可以动态地写入屏幕上的不同位置。

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

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