Page 1 of 1

I would like to hear your opinion !!

Posted: Mon Jun 10, 2002 12:13 pm
by FlashBurn
[attachment deleted by admin]

Re:I would like to hear your opinion !!

Posted: Mon Jun 10, 2002 2:55 pm
by Schol-R-LEA
You might want to handle tabs at a higher level, or have a parameter or global variable to let the programmer set tab stops, but for a kernel level program this will rarely come up. Also, you might want to include a gotoxy() or equivalent, to allow you to move the cursor at will. Finally, if you intend to call this from a non-assembly language (e.g., C), you'll have to remember to put a wrapper around it to handle the appropriate calling convention(s).

Finally, it is a bit too large to use in a boot loader, if that was your intention, but I'm assuming that this isn't relevant.

Beyond that, though, it looks to be pretty good, and tests out (in real mode) without any problems I could find. Perhaps some of our assembly gurus can help you optimize it better, but it seems OK to me.

Re:I would like to hear your opinion !!

Posted: Mon Jun 10, 2002 3:19 pm
by FlashBurn
I would like to know how I set the hardware cursor . I know that I have to do it with registers , but this is all I know . Not a lot ! Where can I have info about that ? It would be very friendly of you , if you can post some optimations !!

Re:I would like to hear your opinion !!

Posted: Tue Jun 11, 2002 2:35 am
by Pype.Clicker
I suggest you take advantage of the full video ram and use the 'screen offset' to do speed-lightning scrolling rather than copying memory ...

just think about it: rather than scrolling, imagine you're writing in a circular buffer, and adjust the display window (80x25) in your larger memory area (80x50 or even 80x100) ... unfortunately, there isn't a full 64K for text VRAM, so you'll have to do the copy at each buffer rollover, but think it'll happen once every 100 newlines rather than every line :D

Os wizardry: use with caution :p

Re:I would like to hear your opinion !!

Posted: Wed Jun 12, 2002 10:21 pm
by FlashBurn
Can you give me code examples , because I don?t understand what you want to say me .

Re:I would like to hear your opinion !!

Posted: Mon Jun 17, 2002 1:45 pm
by Pype.Clicker
okay, time to make myself clear.
VGA has about 16K of text VRAM, which is enough for 4 screens of 80x25. It also has a registerfor selecting from which address in this VRAM the actual screen rendering starts. Here's a small example assuming you have in bx the
offset within 0xb800 segment where your screen begins (bx=0 -> starting at 0xb800:0 to 0xb800:0f9f is visible, bx=80 you have skipped one row, etc.)
show:
mov ah,bh      ; first the low byte of the address
   mov al,0x0c
   mov dx,0x03D4      ; CRTC port
   out dx,ax
   mov ah,bl
   inc al
   out dx,ax      ; then the high one
ret

Now, there are several way to use this, but in OS programming, you mainly have 2 interresting ones:
- use each 80x25 vram space to store different infos (normal progress screen, administrator console, log, debug console, whatever :) and implement a keyboard handler that can (for instance) hook ALT+Fx to switch to the xth virtual screen by just setting bx=0x1000 * x and then call show.

- use a single 80x50 vram space to simulate scrolling: when you arrive with your cursor at line 25, instead of scrolling everything, you just move to bx=80 and go on, then bx=160 and call show, etc. until you reach line 50 (or 100, that's like you want).
When that final limit is reached, you'll have to do a real scroll by copying [0xb800:bx..0xb800:bx+f00] to [0xb800:0..0xb800:f00] and resetting bx=0.
As this copy occurs once every 50 or 100 rows instead of every row in the usual scrolling techinque, you will speed up your console output dramatically !!

This is higher ASM, so use it wisely ;)

For hardware infos, check your fav' docs about CRT controller (i think that's the chip ...)