diswithend
diswithend

Reputation: 71

How do I print text on the blue screen?

I have one of problem. How do I print text on the blue screen?

start:
        mov ax, 07C0h
        add ax, 288
        mov ss, ax
        mov sp, 4096
        mov ax, 07C0h
        mov ds, ax
;-------------------------------------------------
        mov ah, 09h
        mov cx, 1000h
        mov al, 20h
        mov bl, 17h
        mov si, text_string
        int 10h
        jmp $
        text_string db 'This is my Operating System!', 0
print_string:
        mov ah, 0Eh
.repeat:
        lodsb
        cmp al, 0
        je .done
        int 10h
        jmp .repeat
.done:
        ret
        times 510-($-$$) db 0
        dw 0xAA55           

This is my code. I write mov si, text_string but it not works. Please help me.

Upvotes: 1

Views: 382

Answers (1)

Sep Roland
Sep Roland

Reputation: 39166

Your print_string routine uses the BIOS teletype function to put characters on screen. Unfortunately this function will not output in any particular color when dealing with the text mode screens.

Since your aim is to print characters on the blue screen, first make sure the screen is actually blue.

        mov dx, 184Fh   ; lower right (79,24)
        xor cx, cx      ; upper left (0,0)
        mov bh, 1Fh     ; brightwhite on blue
        mov ax, 0600h   ; clear screen
        int 10h

Hereafter you can call your print_string routine that uses the BIOS teletype function:

        mov  si, text_string
        call print_string
        jmp  $

        text_string db 'This is my Operating System!', 0

print_string:
        mov  ah, 0Eh
        jmp  .first
.print: int  10h
.first: lodsb
        test al, al
        jnz  .print
        ret

Upvotes: 2

Related Questions