02-16-2005, 12:22 PM
somebody gave me this piece of code and said its faster than "cls"
is it true?
is it true?
Code:
line (0,0)-(320,200),0,bf
url=http://www.random-seed.net][/url]
cls queston
|
02-16-2005, 12:22 PM
somebody gave me this piece of code and said its faster than "cls"
is it true? Code: line (0,0)-(320,200),0,bf
url=http://www.random-seed.net][/url]
02-16-2005, 12:23 PM
oops, almost forgot..i understand how the piece of code worx..but i dont understand why it might be any faster than cls
url=http://www.random-seed.net][/url]
02-16-2005, 04:29 PM
Because that piece of code fills the screen memory with 0s
Whereas CLS reinitialize and do other stuff
02-16-2005, 04:54 PM
If you're really concerned about speed in screen 13, you can use this asm code...
[syntax="asm"] mov ax, 0xA000 mov es, ax xor di, di mov cx, 0xFA00 xor al, al rep stosb retf [/syntax] Which is specialised to fill the entire screen in mode 13 (thus it is faster than the LINE method... no mode checking, no clipping). Here is a SUB you can add to your program implementing this: [syntax="QBASIC"] SUB ClearScr asm$ = CHR$(&HB8) + CHR$(&H0) + CHR$(&HA0) + CHR$(&H8E) asm$ = asm$ + CHR$(&HC0) + CHR$(&H31) + CHR$(&HFF) + CHR$(&HB9) asm$ = asm$ + CHR$(&H0) + CHR$(&HFA) + CHR$(&H30) + CHR$(&HC0) asm$ = asm$ + CHR$(&HF3) + CHR$(&HAA) + CHR$(&HCB) DEF SEG = VARSEG(asm$) CALL ABSOLUTE(SADD(asm$)) DEF SEG END SUB [/syntax] Remember to start QB with the /L switch to use this. To make it even faster, make 'asm$' a global constant, so the top part of the code doesn't have to be executed each time. It won't work in FreeBASIC, by the way. -shiftLynx
img]http://www.cdsoft.co.uk/misc/shiftlynx.png[/img]
02-16-2005, 05:21 PM
Quote:[syntax="QBASIC"] Don't use intermodule globals You can solve the speed issue with this: Code: SUB ClearScr Btw, the above is PDS code, not QB45 (note the SADD thingo )
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio underBASIC, homegrown musicians [img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
02-16-2005, 05:59 PM
Shouldnt it be SSEG() too?
Or that doesent matter? FB has shadowed my QB knowledge
02-16-2005, 09:49 PM
How come you guys are clearing the screen a single byte at a time? :lol:
xteraco: If you do use line: line (0, 0)-(320 - 1, 200 - 1), 0, bf X ranges from 0 to 319 and y from 0 to 199 in screen 13. But their way will probably be much faster (even faster if they'd use dwords...).
02-17-2005, 01:19 AM
Double Words
4 bytes A word is 2 bytes If I'm not misstaken... some compilers has it so words are 4 bytes and double words are 8 bytes... silly... |
« Next Oldest | Next Newest »
|