This is the code I wrote it works perfectly except that I can't figure out how to remove the console thing( d:\ ). The code prints hello in the middle of the screen.
IDEAL
MODEL small
STACK 100h
DATASEG
; --------------------------
msg db 'hello'
; --------------------------
CODESEG
start:
mov ax, @data
mov ds, ax
; --------------------------
;fullscreen
MOV AL, 13H
MOV AH,0
INT 10H
mov si,@data;moves to si the location in memory of the data segment
mov ah,13h;service to print string in graphic mode
mov al,0;sub-service 0 all the characters will be in the same color(bl) and cursor position is not updated after the string is written
mov bh,0;page number=always zero
mov bl,00001111b;color of the text (white foreground and black background)
; 0000 1111
;|_ Background _| |_ Foreground _|
;
mov cx,5;length of string
;resoultion of the screen is 244x126
mov dh,63;y coordinate
mov dl,122;x coordinate
mov es,si;moves to es the location in memory of the data segment
mov bp,offset msg;mov bp the offset of the string
int 10h
; --------------------------
exit:
mov ax, 4c00h
int 21h
END start
There is a black background as intended and white text in the middle but on the top left corner there is d:\
Thanks for helping!
When your program finishes displaying the message, you let it return to the operating system through using the DOS function 4Ch. This means that DOS will again put its prompt on the screen. That's the "d:\" that you're seeing.
To get enough time to view the message you need to postpone returning to DOS.
Just wait for the user to press any key:
mov ah, 07h ;Input from keyboard without echo to the screen
int 21h
mov ax, 4C00h ;Terminate
int 21h
;resoultion of the screen is 244x126 mov dh,63;y coordinate mov dl,122;x coordinate
I don't see where you got this peculiar resolution data.
The screen 13h that you are using has a graphical resolution of 320x200, but the BIOS function 13h that you've used for displaying the text expects cursor coordinates in the DL
and DH
registers. These range from 0 to 39 for the column and from 0 to 24 for the row.
To display the text "hello" in the middle of the screen then you would need:
mov dl, 18 ;Column
mov dh, 12 ;Row