Screen performance comparisons
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
Screen performance comparisons
Hi everyone,
Has anyone ever tested the following:
In SCREEN 0 (80x25) writing to the screen, fuill screens of data to see hwo fast that happens and likewise in graphics mode. I'm trying to see if I'd be loozing speed by switching to a graphics mode instead of trying to stick to SCREEN 0 (assuming I want the same text character resolution in both modes.
Thanks in advance for any feedback.
Has anyone ever tested the following:
In SCREEN 0 (80x25) writing to the screen, fuill screens of data to see hwo fast that happens and likewise in graphics mode. I'm trying to see if I'd be loozing speed by switching to a graphics mode instead of trying to stick to SCREEN 0 (assuming I want the same text character resolution in both modes.
Thanks in advance for any feedback.
-
- Posts: 680
- Joined: May 28, 2005 1:11
- Contact:
using this test:
i got console to be consistently about 0.8 seconds faster than gfx mode.
Code: Select all
screen 7
s# = timer
for i = 32 to 255
locate 1,1
? string$(80*25,chr$(i));
next
st# = timer
locate 1,1
? st#-s#
sleep
-
- Posts: 680
- Joined: May 28, 2005 1:11
- Contact:
O_O
took .1 seconds... the other test had both console + gfxlib taking > .4 seconds. take the -1 out of the string$ command on this one though, and it takes > 3 seconds :*(
[edit] actually, the original console one runs faster that way too. the gfxlib one shows no change, even in a 80x25 text mode.
Code: Select all
width 80, 25
s# = timer
for i = 32 to 255
locate 1,1
? string$(80*25-1,chr$(i));
next
st# = timer
locate 1,1
? st#-s#
sleep
[edit] actually, the original console one runs faster that way too. the gfxlib one shows no change, even in a 80x25 text mode.
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
Thanks for that info dumbledore.
Since there's no screen buffering in text mode (and seemingly non planned right now) I'm looking into the other alternative and see if it's worth it with screen buffering in graphics mode.
Too bad though...text mode screen buffering would be kewl to TEXT app builders...like me ;-).
Since there's no screen buffering in text mode (and seemingly non planned right now) I'm looking into the other alternative and see if it's worth it with screen buffering in graphics mode.
Too bad though...text mode screen buffering would be kewl to TEXT app builders...like me ;-).
Win32 console routines do internal buffering, skipping updates and such, in windowed modes. Fullscreen, as Antoni said, uses the hardware VGA text mode, so its speed should be roughly equivalent to a DOS program using text mode.
BTW, if you really want text-mode buffering, I could throw together a routine for DOS, but I don't want to mess with the Win32 console API. :) Plus, I'm going to be reworking/rewriting the DOS console text output, because I'm too lazy to figure out why DJGPP's conio routines aren't working as expected, causing those nasty scrolling bugs. :)
BTW, if you really want text-mode buffering, I could throw together a routine for DOS, but I don't want to mess with the Win32 console API. :) Plus, I'm going to be reworking/rewriting the DOS console text output, because I'm too lazy to figure out why DJGPP's conio routines aren't working as expected, causing those nasty scrolling bugs. :)
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
-
- Posts: 680
- Joined: May 28, 2005 1:11
- Contact:
i wrote a simple one in fb, it's not using any api calls because it's simple. it doesn't have colors, but they could be added without much difficulty.
Code: Select all
'by dumbledore
'a lightweight text-mode blitter
'should give a pretty impressive speed boost to text-mode games
'because the console won't be updated every time you print
'instead, stick the call to the blitter in a thread, or just
'call it when you want to ;P
type mConsole
scr(80*25) as ubyte
cursor as ushort
end type
dim parent as mConsole
parent.cursor=0
dim cons as mConsole ptr=@parent
declare sub _Print(byval cons as mConsole ptr,byval text as string)
declare sub _Blit(byval cons as mConsole ptr)
declare sub _Cls(byval cons as mConsole ptr)
declare sub _Locate(byval cons as mConsole ptr,byval row as integer=-1,byval col as integer=-1)
_cls cons
_locate cons,4
_print cons,"text blitter test..."
_print cons,"testing teh 1337 text blitter"
_blit cons
sleep
sub _Print(byval cons as mConsole ptr,byval text as string)
dim mystr as ubyte ptr=sadd(text)
for i=0 to len(text)-1
cons->scr(cons->cursor)=mystr[i]
cons->cursor+=1
next
cons->cursor=((cons->cursor\80)+1)*80
end sub
sub _Blit(byval cons as mConsole ptr)
locate 1,1
for i=0 to ubound(cons->scr)
? chr$(cons->scr(i));
next
locate 1,1
locate (cons->cursor\80)+1,(cons->cursor-(cons->cursor\80)*80)+1
end sub
sub _Cls(byval cons as mConsole ptr)
for i=0 to ubound(cons->scr)
cons->scr(i)=32
next
cons->cursor=0
end sub
sub _Locate(byval cons as mConsole ptr,byval row as integer=-1,byval col as integer=-1)
if row=-1 then row=cons->cursor\80
if col=-1 then col=1
cons->cursor=(row-1)*80+(col-1)
end sub
Well, I'll be doing the mode-setting code with BIOS calls (because DJGPP's conio screen resize proc (_setscreenlines, iirc) doesn't allow a width parameter to be specified, only 80xN modes available - maybe use VESA text modes too) and the actual text output with the _far*() functions and/or movedata().MystikShadows wrote:Oh...well if you're rewriting it I'll wait...what's the new method though? what will you be using since conio don't work as expected?
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
SOunds good Dr_V :-) what are they agan
$0109 for 132x25
$010A for 132x43
$010B for 132x50
$010C for 132x60
right? :-)....move data should work...however that also means we'll need to code for the scrolling as moving data like this won't allow the screen to automatically scroll like it would with standard printing.
$0109 for 132x25
$010A for 132x43
$010B for 132x50
$010C for 132x60
right? :-)....move data should work...however that also means we'll need to code for the scrolling as moving data like this won't allow the screen to automatically scroll like it would with standard printing.
Yeah, those are the standard VESA text modes (plus 80x60 - 0x0108). The scrolling will be taken care of internally - just a simple movedata() to copy the portion of the screen that needs to be scrolled. From the user's point of view, it will work just like the Win32 version (except without the crazy resize-the-console-by-printing-beyond-it 'feature' :).
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact:
Here's a simple buffered text mode demonstration for DOS:
The buffer is in the same format as a regular text-mode screen, i.e. a character byte, a color byte, char byte, color byte, etc. It'll be in examples/DOS/textbuff.bas in the next release. (Run it in fullscreen mode on Windows)
Code: Select all
''
'' simple DOS text-mode example to demonstrate DOS-specific features
''
Option Explicit
#include "dos/go32.bi"
#include "dos/pc.bi"
#include "dos/sys/movedata.bi"
Sub TextBufferToScreen(buffer() As UByte, size As Integer)
Do Until inportb(&H3DA) And 8: Loop ' wait for vertical blank
dosmemput(@buffer(0), size, ScreenPrimary)
End Sub
Const ScreenWidth As Integer = 80
Const ScreenHeight As Integer = 50
Const ScreenBytes As Integer = ScreenWidth * ScreenHeight * 2
Dim buffer(ScreenBytes - 1) As UByte
Dim i As Integer
Width ScreenWidth, ScreenHeight
Locate , , 0 ' turn off cursor
Do Until Len(Inkey)
For i = 0 To ScreenBytes - 1 Step 2
buffer(i) = Int(Rnd * 3) + 176
Next i
For i = 1 To ScreenBytes - 1 Step 2
buffer(i) = Int(Rnd * 16)
Next i
TextBufferToScreen buffer(), ScreenWidth * ScreenHeight * 2
Loop
Cls
-
- Posts: 612
- Joined: Jun 15, 2005 13:22
- Location: Upstate NY
- Contact: