Sooooo I'm writing a program that involves a lot of writing to the screen and I want to do it at bios level. Mostly because the DOS calls can't do what I want to do, and also because I'm afraid to go all out and write directly to the vram. Anyways, I ran into trouble basically right away. The first thing I'm trying to do is mimic the 09h function of int 21h, to write a string to the screen from the memory. However, I want the string to terminate when it finds 00h 00h in the string instead of at a dollar sign. Similarly, when it finds 00h 01h, it will change the attribute byte to 00000111b (default gray on black), 00h 02h will change it to 00001010b, 00h 03h will change it to 00001011b, 00h 04h to 10110000b, etc. These will represent different text entry modes and the like.

So anyways I got it working on a single line, if I call the function to output "hello!!!",00h,02h," rawr!",00h,00h, it will output "hello!!! rawr!". But when it reaches a carriage return and line feed (0ah,0dh), it just prints two characters and continues along on the same line (I expected it to, but I was hoping it would just move the cursor by itself). Well I decided that when the procedure came across a carriage return, it would use the 03h function to get the cursor position, change dl to 00h and then call the 02h function to move the cursor to the beginning of the same line that it was on. So if I try to call the function to output "hello!!!",00h,02h,0ah,"rawr!",00h,00h, it will output "rawr!!!!". The big problem is the line feed though. I can't figure out how to make it work...

I figured I would just scroll the screen up one line using function 06h, then get the cursor position with 03h, increase dh by one and then call function 02h to move it down to the next line. But it's not working... It would scroll the window by one and then move the cursor down two lines... does scrolling the window move the cursor as well? Also, I realized that since I set the video mode at the beginning of the application (to 02h, which is 80x25 I think... I just wanted to KNOW how many rows and columns there were no matter what, since the prompt window was in a square shape instead of a rectangle and I didn't know why) the text starts at the top of the window. If I scrolled down on every line feed, there would only ever be one single line of text at the top of the window... How would I know when the cursor is outside of the buffer, and scroll it down?

nevermind, solved without help, bitches!

commented: With that pissy attitude, I'll leave you alone in future -5

what was the solution

I was just confused as to the use of the functions and my code was a bit buggy.

after I called ah,03h int 10h, I needed to check that dh was not equal to 24d. If it was, equal to it, I had to scroll the screen down by one line, and NOT move the cursor (the cursor stays in the same place at line 24, the text in the window moves up behind it). If it wasn't equal to 24d, then I could move the cursor down one line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.