0

The code here is for Hello World simple program in assembly

.model small
.stack 100h
.data
msg db 0AH,0DH,"Hello World","$"
.code
mov ax,@data
mov ds,ax
mov ah,09h
mov dx,offset msg
int 21h

mov ah,4ch
int 21h

I want the code to change the color of console background and text color also. I am using Dosbox to run this code.

nrz
  • 10,435
  • 4
  • 39
  • 71
Muneeb Hassan
  • 125
  • 12

1 Answers1

0

I just figured out that it is solved by

 mov bl,9; this is for color
 mov cx, 11; this is for number of characters
 int 10h; puts the color behing

Just up on the mov dx, offset msg Also add

 mov ax,4C00h
    int 21h

The working snippet

.model small
.stack 100h
.data
    msg db "Hello World!","$"
.code

main proc
    mov ax,@data
    mov ds,ax

    mov ah,09h
    mov bl,9; this is for color
    mov cx, 11; this is for number of characters
    int 10h; puts the color behing

    mov dx,offset hello_message
    int 21h

    mov ax,4C00h
    int 21h

main endp
end main
Muneeb Hassan
  • 125
  • 12