如何在DOS中打印彩色字符串?

问题描述 投票:-2回答:3

我想以不同于通常的白色文本颜色的其他颜色打印以下一组数据块,这可以通过使用另一个DOS中断来实现(dx:string-address; ah,08H; int 21h)。] >

Jan             db  "         January$          "     
string          db  "Sun Mon Tue Wed Thu Fri Sat$"
string1         db  "                 1   2   3$"
string2         db  " 4   5   6   7   8   9  10$"
string3         db  "11  12  13  14  15  16  17$"
string4         db  "18  19  20  21  22  23  24$"
string5         db  "25  26  27  28  29  30  31$"

我想以不同于通常的白色文本颜色的其他颜色打印以下一组数据块,这可以通过使用另一个DOS中断(dx:string-address; ah,08H; int 21h)来实现。一月...

assembly dos masm x86-16 tasm
3个回答
3
投票

有几种方法可以实现您的目标文本模式


1
投票

前景色和背景色的所有组合的代码:


0
投票
Include Irvine32.inc

.data

str1 BYTE "different color string",0dh,0ah,0        ;string initializing

counter dword ?                                     ;save loop value in counter

.code

main PROC

mov ecx,4                                          ;loop repeated 4 times

l1:
    mov counter,ecx                                ;counter save loop no

    mov eax,counter                          ;eax contain loop no 
                                                ;which is equal to counter
                                                                           ; color no

    call    SetTextColor                           ;Call color library

    mov edx,offset  str1                       ;string reference is moved to edx

    call    WriteString                            ;string is write from reference

loop l1                                            ; calling loop l1

    exit
main ENDP
END main
© www.soinside.com 2019 - 2024. All rights reserved.