问题
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
回答1:
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
来源:https://stackoverflow.com/questions/20811752/how-to-print-text-in-color-with-interrupts