3

I'm using 8086 assembly on DOSBox which is on Windows.
I want to print a char in graphics mode, and I know it goes like this:

mov ah, 0eh           ;0eh = 14
mov al, 'x'
xor bx, bx            ;Page number zero
mov bl, 0ch           ;Color is red
int 10h

The code above prints the letter 'x' in the left side of the top of the screen.
I don't know how to print 'x' char in specific location in my screen. What should I do in order to print 'x' in specific location?

Sep Roland
  • 33,889
  • 7
  • 43
  • 76
Or. muha
  • 71
  • 1
  • 2
  • 6

1 Answers1

4

What should I do in order to print 'x' in specific location?

First know that on a graphics screen, BIOS will not be able to print your character at any (X,Y) spot you desire. You can only get characters on every (Col,Row) spot you can position the cursor.

So to display the "x" character in the center of the 320x200 256 colors graphical screen (mode 19), you can code:

mov  dl, 20   ;Column
mov  dh, 12   ;Row
mov  bh, 0    ;Display page
mov  ah, 02h  ;SetCursorPosition
int  10h

mov  al, 'x'
mov  bl, 0Ch  ;Color is red
mov  bh, 0    ;Display page
mov  ah, 0Eh  ;Teletype
int  10h
Fifoernik
  • 9,779
  • 1
  • 21
  • 27