There are so many services which can be used with the interrupt 10h,
I’d like to ask the question about two of them whom with i am confused
First is,
AH = 06H SCROLL UP WINDOW
AH = 07H SCROLL DOWN WINDOW
While coding in DOS what is meant by Scroll up / Scroll down ?
Have a look at this,
; AL = NUMBER OF LINES BY WHICH TO SCROLL UP (00H = CLEAR ENTIRE WINDOW)
; BH = ATTRIBUTE USED TO WRITE BLANK LINES AT BOTTOM OF WINDOW
; CH,CL = ROW,COLUMN OF WINDOW'S UPPER LEFT CORNER
; DH,DL = ROW,COLUMN OF WINDOW'S LOWER RIGHT CORNER
Here it says that BH is used to write blank lines at the bottom of the window,
but when i am using this code,
MOV AH, 06H
MOV AL, 00H
MOV CX, 00H
MOV DH, 25
MOV DL, 80
INT 10H
and not defining the value of BH, my results won’t display on the screen and as soon as i declare the value of Bh, it is actually controlling the Foreground and Background color of DOS screen.
so why does it says that BH is used to write blank lines at the bottom of the window ?
The Second is,
;AH = 02 USED To SET CURSOR POSITION
;BH = PAGE NUMBER
;CH,CL = ROW,COLUMN OF WINDOW'S UPPER LEFT CORNER
;DH,DL = ROW,COLUMN OF WINDOW'S LOWER RIGHT CORNER
Here BH is equal to page number :confused: ? what is meant by a page number in a normal DOS screen ?
I don’t have access to tools to test right now — in fact, what are you doing in real mode assembly on DOS anyway? — but from memory, these should be your answers:
“Scroll up” would be “take all the stuff that’s on the screen and move it upwards”. The value in AL determines by how much. For example when AL=2, “Scroll up” would move all the text on the screen two lines up.
“Scroll down” would be moving it in the other direction.
You can move arbitrary pieces/windows of the screen by setting CX and DX appropriately. For example, since the screen presumably has 80×25 characters, when CH=1, CL=1, DH=23, DL=78, the portion that would be moved would be the entire screen except a border of one character along each edge.
As a special case, AL=0 will cause the entire window to be cleared out.
It says that BH is the attribute used when writing the blank lines. In text mode, even-numbered addresses hold the characters to display, while odd-numbered addresses hold the attributes used for display. BH will give the attribute for each new character written by this call.
The attributes are mostly foreground and background color for the character. By setting the background color and clearing the screen, you can effectively fill the screen with one color.
I would like to clear up a point about hardware registers. You say
Please be aware that BH always has a value! You are just using the one that’s lying around, by chance. Please set BH to whatever you need it to be. For example 0x07 for normal white on black colors.
It is similar to multiple screen buffers (front buffer, back buffer) in modern graphics programming. You can switch pages by calling
int 10hwith AH=05. See Ralf Brown’s Interrupt list.