I need to implement scrolling line up using function 06h of interrupt 10h. The problem is that I have the scrolled line, but symbols aren't showing up, cursor disappears and nothing is happening. Maybe I forgot something to consider? To write the code I use FASM
. The code is part of a bootloader. Here's piece of code that relates to the scrolling:
cmp cx, 2001
je ScrollLine
I have a counter and when it reaches 2001 (count from 1), control passes to ScrollLine.
ScrollLine:
mov ah, 06h
mov al, 1
mov bh, 07
mov cx, 0000h
mov dx, 184Fh
int 10h
ret
My complete bootloader code is as follows:
use16
org 7C00h
start:
mov ah, 00h
mov al, 02h
int 10h
mov ax, NewInt40
call ChangeIVT
mov cx, 0
wait_loop:
xor ax, ax
inc cx
cmp cx, 2001
je ScrollLine
mov ah, 0
int 16h
push ax
call PrintChar
jmp wait_loop
NewInt40:
sti
push ax
mov ax, msg
cmp bl, 3
je PrintChar
cmp bl, 2
je PrintString
cmp bl, 1
je Clear
cmp bl, 4
je Scroll
pop ax
iret
ChangeIVT:
push bx
xor bx, bx
mov es, bx
mov bx, 40h
shl bx, 2
mov word [es:bx], ax
mov word [es:bx+2], 0
pop bx
ret
PrintString:
push si
push bx
push es
mov si, ax
mov ax, 0B800h
mov es, ax
xor bx, bx
xor dx, dx
@@:
lodsb
cmp al, 0
je @f
mov byte [es:bx], al
mov byte [es:bx+1], 1Eh
mov ah, 0Eh
add bx, 2
inc dx
mov ah,02h
mov al,02h
int 10h
jmp @b
@@:
pop es
pop bx
pop si
ret
PrintChar:
push bp
mov bp, sp
push bx
push es
push cx
mov ax, 0B800h
mov es, ax
xor bx, bx
xor dx, dx
mov ah,3
int 0x10
movzx ax, dh
movzx bx, dl
mov cx, 80
push dx
mul cx
pop dx
add bx, ax ; bx = 80 * dh + dl
shl bx, 1 ; bx = 2 * (80 * dh + dl)
mov ax, [bp + 4]
mov byte [es:bx], al
mov byte [es:bx+1], 1Eh
cmp dl, 79
jl @f
inc dh
mov dl, -1
@@:
inc dl
pop cx
mov bh, 0
mov ah, 2
int 0x10
pop es
pop bx
mov sp, bp
pop bp
ret
Clear:
mov AH,0
mov AL,2
int 10H
ret
Scroll:
mov ah, 06h
mov al, 1
mov bh, 07
mov cx, 0000h
mov dx, 184Fh
int 10h
ret
ScrollLine:
mov bl, 4
int 40h
xor cx, cx
ret
msg db "Hello, world!", 0Dh, 0Ah, 0
db 510-($-$$) dup (0)
db 55h, 0AAh