如何打印与中断彩色文本? [英] How to print text in color with interrupts?

查看:172
本文介绍了如何打印与中断彩色文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的code将其以白色为主色调这是默认的打印。我知道如何在彩色打印照片,无需中断,但我并不想这样做。我想打印在使用我interrupts.How可以做任何其他的色彩?任何想法?提前致谢
我使用EMU8086作为汇编

 数据段
    惠康DB'惠康网友!,13,10,$
    如何DB'你好',13,10,$
结束堆栈段
    DW 64 DUP(0)
结束code段    开始:
        推斧
        MOV AX,数据
        MOV DS,AX
        MOV ES,AX
        流行斧        LEA SI,惠康
        调用打印        LEA DX,如何
        调用打印
    MOV AH,00H;等待任意键
    INT 16H    MOV AX,0x4c00;终止
    INT 21H
打印:
            ;印刷线
            MOV啊,9
            INT 21H
    RET
结束


解决方案

下面是解决方案,我知道了。使打印子程序以下更改

 打印:
       ;印刷线
       MOV BL,2;颜色属性
       MOV啊,9
       MOV人,0; avoding多余的字符
       INT 10H;印刷颜色
       INT 21H
RET

This is my code it print in white color which is the default one. I know how to print in color without interrupts, but I don't want to do that. I want to print it in any other color using interrupts.How can I do that?? Any Idea? Thanks in advance I am using emu8086 as an assembler

data segment
    wellcome db 'Wellcome User !',13, 10 ,'$'
    how    db 'how are you',13,10,'$'
ends

stack segment
    dw  64 dup(0)
ends

code segment 

    start:
        push ax      
        mov ax,data
        mov ds,ax
        mov es,ax    
        pop ax     

        lea si, wellcome
        call print

        lea dx, how
        call print  
    MOV  AH, 00h;wait for any key
    INT  16h

    mov ax, 0x4c00; terminating 
    int 21h                                                        
print: 
            ;printing the line
            mov ah, 9
            int 21h
    ret                                  
ends 

解决方案

Here is the solution, I got it. Make the following changes in print subroutine

print: 
       ;printing the line
       mov bl,2  ;color attribute
       mov ah, 9 
       mov al,0  ;avoding extra characters
       int 10h   ;printing colors
       int 21h
ret    

这篇关于如何打印与中断彩色文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆