Wednesday, 6 April 2016

Make Color words / Characters in operating system

Program


; boot.asm
   mov ax, 0x07c0
   mov ds, ax


mov ah,09h ; write a character at cursor position(function)
mov bl,0Dh ; Font Character colour (Pink)
int 10h

mov ah, 0x0e;
mov al,'W'
int 0x10;

mov ah,09h ; write a character at cursor position(function)
mov bl,0Ah ; Font Character colour (Green)
int 10h

mov ah, 0x0e;
mov al,'E'
int 0x10;

   times 510-($-$$) db 0
   db 0x55
   db 0xAA 


In that above program Green color text are your Known codes.(Explained codes) But the pink color codes, you didn't know before . I will explain how to make color in your operating system first set of code i will explain down.

So that you can understand the other and you can make how to plan colorful texts in your 16 bit operating system.

explaining for
mov ah,09h ; write a character at cursor position(function)
mov bl,0Dh ; Font Character colour (Pink)
int 10h

As I already mentioned, in register AH we should store the functions (Mind AX is divided by AH, and AL). So 09h function in interrupt 10 is write a character at cursor position. So It tells the assembler whatever the character you write at cursor position. The next BL register holds the color of text. In the above example i gave the constant for character 'W' is pink, and for character 'E' is Green. So in screen after booting it will be appeared W in pink color E in Green color. As you like you can make other colors for other texts.

Please practice if you have any doubt. Please give me a comment. I will reply for you. 

Watch the video for the above program:


Please write comments if you have any suggestions.






No comments:

Post a Comment