New Problem with Screen
-
Matze2002
New Problem with Screen
Hi @ all,
now my keyboard driver works perfect. But now i have a new problem. When i use my own printf() function to print out on the screen, and the full screen is full with text, my pc reboot. I think i must write a function to scroll. But how works this function ?
thanks
Matze
now my keyboard driver works perfect. But now i have a new problem. When i use my own printf() function to print out on the screen, and the full screen is full with text, my pc reboot. I think i must write a function to scroll. But how works this function ?
thanks
Matze
-
PlayOS
Re:New Problem with Screen
Anyway, how you implement your scrolling routine depends on if you want to be able to scroll back down and still have the same data there.
I can tell you a way for both, but I will wait for you to decide as I dont want to type up both.
I can tell you a way for both, but I will wait for you to decide as I dont want to type up both.
-
PlayOS
Re:New Problem with Screen
OK then, all you have to do is copy each line to the line before it. For example, copy line 2 to line 1, line 3 to line 2, etc. When you get to the last line simply clear it and then write the new text to it. You will need to do this each time you add a line of text.
Even though you only want scroll down like DOS it is really just as easy to have scroll up and down.
You will be best to copy dword's for maximum speed, so to scroll the screen do this:
_Scroll:
mov ebx, 0xb80a0 ; Start of line 2
mov ecx, 0xb8000 ; start of video memory
.ScrollLoop:
mov eax, dword [ebx] ; Get the DWORD
mov dword [ecx], eax ; Copy it
add ebx, 4 ; Increment address 1
add ecx, 4 ; Increment address 2
cmp ebx, 0xb8fa0 ; compare for the end
je .ScrollDone
jmp .ScrollLoop ; still going
.ScrollDone:
mov dword [ecx], 0x00070007 ; clear the first dword of the last line (ecx = the start of the last line)
add ecx, 4 ; Increment the address
cmp ecx, 0xb8fa0 ; compare for the end
jl .ScrollDone
ret
this code will move everything up one line and the clear the last line, ready for some new text.
Hope this helps.
Even though you only want scroll down like DOS it is really just as easy to have scroll up and down.
You will be best to copy dword's for maximum speed, so to scroll the screen do this:
_Scroll:
mov ebx, 0xb80a0 ; Start of line 2
mov ecx, 0xb8000 ; start of video memory
.ScrollLoop:
mov eax, dword [ebx] ; Get the DWORD
mov dword [ecx], eax ; Copy it
add ebx, 4 ; Increment address 1
add ecx, 4 ; Increment address 2
cmp ebx, 0xb8fa0 ; compare for the end
je .ScrollDone
jmp .ScrollLoop ; still going
.ScrollDone:
mov dword [ecx], 0x00070007 ; clear the first dword of the last line (ecx = the start of the last line)
add ecx, 4 ; Increment the address
cmp ecx, 0xb8fa0 ; compare for the end
jl .ScrollDone
ret
this code will move everything up one line and the clear the last line, ready for some new text.
Hope this helps.
-
PlayOS
Re:New Problem with Screen
Also just as a note if you want to scroll multiple lines at a time all you have to do is add 160 (decimal) to ebx for every extra line you want to scroll. This is all you will need to change, so to scroll up 5 lines, just change
mov ebx, 0xb80a0
to
mov ebx, 0xb8320
and everything will go according to plan.
mov ebx, 0xb80a0
to
mov ebx, 0xb8320
and everything will go according to plan.
-
Whatever5k
Re:New Problem with Screen
By the way, how many chars can be printed in one line, and how many lines can be printed in the whole screen?
-
PlayOS
Re:New Problem with Screen
Just another note if you want help making this compatible with c code just say so, you probably should make this accept one parameter on the stack (the number of lines to scroll), I can do this for you if you need me to.
-
PlayOS
Re:New Problem with Screen
The standard screen mode 80x25x16 can have 80 chars across and 25 lines down the screen.
-
AlanO
Re:New Problem with Screen
Matze2002,
I was wondering would it be possible to see your keyboard drivers source?? I'm havoing such a problem trying to get mine to work! thanks in advanced
I was wondering would it be possible to see your keyboard drivers source?? I'm havoing such a problem trying to get mine to work! thanks in advanced
-
Matze2002
Re:New Problem with Screen
Hi,
yes, write me an email, and i send you the source.
bye
Matze
yes, write me an email, and i send you the source.
bye
Matze