[英]Assembly 8086 : How to Make thanks with a loop and video memory
I need a program that show at the center the write "Thanks" with heart symbols in left and right side of the text, but the hearts with red color and the text with green color. 我需要一个程序,该程序在中间显示在文本的左侧和右侧带有心形符号的“谢谢”,但是带有红色的心形和带有绿色的文本。 I have now this code:
我现在有以下代码:
mov ax, 0B800h
mov es, ax
mov di,spiazz
mov byte ptr es:[di+0], ' '
mov byte ptr es:[di+2], ' '
mov byte ptr es:[di+4], ' '
mov byte ptr es:[di+1], 20h
mov byte ptr es:[di+3], 70h
mov byte ptr es:[di+5], 40h
With a similar code like this, I need to show an "heart(symbol)Thanks heart(symbol)"; 使用类似的代码,我需要显示“ heart(symbol)Thanks heart(symbol)”; but with the hearts red and the text green.
但心是红色,文字是绿色。 Thank you in advance
先感谢您
There are many ways to achieve this. 有很多方法可以实现这一目标。 Below is one of these:
以下是其中之一:
mov ax, 0B800h ;Points to the 80x25 text screen
mov es, ax
mov di, (13-1)*160+(37-1)*2 ;Print At(37,13); //Column 37, Row 13
mov si, msg
cld ;This makes SI and DI move f o r w a r d as is needed
mov ax, 0403h ;AL=3 (heart character) AH=04h (RedOnBlack)
push ax ;(1) Preserve on the stack
LL:
stosw
mov ah, 02h ;GreenOnBlack
lodsb
cmp al, 0 ;Message was zero-terminated
jne LL ;Terminator not yet reached
pop ax ;(1) Restore from the stack
stosw ;This outputs the second heart character
...
msg db 'Thanks', 0
Do pay special attention to the comments! 请特别注意评论! Don't just copy-paste it.
不要只是复制粘贴它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.