faster PSET for SCREEN 12 / memory layout of SCREEN 12 
Author Message
 faster PSET for SCREEN 12 / memory layout of SCREEN 12

Hello BASIC experts,

I'm working on a simple oscilloscope with a fast AD card (with DMA
transfer of the measured data and QB library) and QB for a bicycle
generator efficiency test bench. The results are shown graphically on a
500x400 pixel part of SCREEN12 the rest is used for displaying
aggregated numerical results (voltage: rms, max/min, frequency; current:
rms, max/min; mechanical input power, electrical output power,
efficiency, ...) and status informations. The graphics are done with
first clearing the area with

LINE (0, 0)-(501, 439), 0, BF                      'black rectangle

and then generating the new plot with

    LINE (0, 0)-(0, 400), 1                        'y axis blue
    LINE (0, 200)-(500, 200), 1                    'x axis blue

    FOR i = 0 TO 499
        PSET (i + 1, 200! - wert(i, 1) * 200!), 4  'current red
        PSET (i + 1, 200! - wert(i, 0) * 20!)      'voltage white
    NEXT

On the old 386DX33 PC this results in a distinct flicker of the graphics
(you notice the time it takes to build up the new curves). It is no
problem for me, that the graphics are only updated once per second, but
a constant sine wave should not flicker!

The way to go could be to use a faster version of PSET (by writing
directly to the video memory). I didn't find a usenet posting about this
in dejanews (searching for "PSET" and "SCREEN 12"). Can someone please
point me to information about the memory layout of screen12 or existing
routines for a faster PSET?

Even smoother results might be possible with generating the coming video
page somewhere else in memory and copying the complete page fast to the
video memory. Has someone done this before and is willing to give some
hints?

An other question is, if there is a faster way to clear the area than
my   LINE ()-(),0,BF ?

The problem is, that I don't have much experience with assembler and the
details of memory layout of PC's...

TIA
Andreas Oehler - from the rainy south of Germany



Wed, 03 Jan 2001 03:00:00 GMT  
 faster PSET for SCREEN 12 / memory layout of SCREEN 12

Quote:

> Hello BASIC experts,

> I'm working on a simple oscilloscope with a fast AD card (with DMA
> transfer of the measured data and QB library) and QB for a bicycle
> generator efficiency test bench. The results are shown graphically on a
> 500x400 pixel part of SCREEN12 the rest is used for displaying
> aggregated numerical results (voltage: rms, max/min, frequency; current:
> rms, max/min; mechanical input power, electrical output power,
> efficiency, ...) and status informations. The graphics are done with
> first clearing the area with

> LINE (0, 0)-(501, 439), 0, BF                      'black rectangle

> and then generating the new plot with

>     LINE (0, 0)-(0, 400), 1                        'y axis blue
>     LINE (0, 200)-(500, 200), 1                    'x axis blue

>     FOR i = 0 TO 499
>         PSET (i + 1, 200! - wert(i, 1) * 200!), 4  'current red
>         PSET (i + 1, 200! - wert(i, 0) * 20!)      'voltage white
>     NEXT

> On the old 386DX33 PC this results in a distinct flicker of the graphics
> (you notice the time it takes to build up the new curves). It is no
> problem for me, that the graphics are only updated once per second, but
> a constant sine wave should not flicker!

> The way to go could be to use a faster version of PSET (by writing
> directly to the video memory). I didn't find a usenet posting about this
> in dejanews (searching for "PSET" and "SCREEN 12"). Can someone please
> point me to information about the memory layout of screen12 or existing
> routines for a faster PSET?

> Even smoother results might be possible with generating the coming video
> page somewhere else in memory and copying the complete page fast to the
> video memory. Has someone done this before and is willing to give some
> hints?

> An other question is, if there is a faster way to clear the area than
> my   LINE ()-(),0,BF ?

> The problem is, that I don't have much experience with assembler and the
> details of memory layout of PC's...

> TIA
> Andreas Oehler - from the rainy south of Germany

  I've got 2 things to say, First I'll explain how pset using video memory
is done, then I'll give another suggestion

sub vmpset (xpos%,ypos%,colorr%)

DEF SEG=&HA000   'define as memory segment, the video memory (address
&HA000)
pos%=(ypos%-1)*640 'total width of the screen times the x position minus one

pos%=pos% + xpos%  'plus the X position
poke pos%,colorr% 'att that offset, poke the color
def seg 'and back to the default segment

end sub

But I wouldn't suggest just plotting to the video memory,
you where right about the reason for the flicker, but not about he solution
the new curve IS built up to slow, while the screen stays empty antil the
curve is built,
so you could build the new curve into another part of the memory, then copy
that part of the memory to the video screen, so avoiding flicker, this takes
care
of the ACTUAL REASON FOR FLICKER, where every QB porgrammer is
looking for, I'll demonstrate:

rem dynamic$
do
dim buffer%(31999) 'here the screen will be built up temporarely
' now put in your statements wich will build jup the screen, but replace
evey PSET (use only pset's)
'with PBSET varseg(buffer%(0)), xposition,yposition,color
'ill define pbset later
for locat%=0 to 31999
def seg=varseg(buffer%(0)) 'define as segment: the buffer
peek locat%,dump% 'get dump%
def seg=&HA000 'define the video memory as segment
poke locat%,dump% 'and put it here, like this copy the buffer to the video
memory
DEF SEG
next locat%

redim buffer%(0) 'easy way to clear it
redim buffer%(0)'and we're ready to repeat

sub PBSET (segm%,xpos%,ypos%,colorr%)
def seg=segm%
offs%=(ypos%-1)*640
offs%=offs%+xpos%
poke offs%,colorr%
def seg
end sub

'that should do it, but don't forget, poking into memory can always crash
you computer when there's a bug in the prog, so save frequently !


http://qbmax.mypage.org
http://come.to/qbmax
Visit my site!



Wed, 03 Jan 2001 03:00:00 GMT  
 faster PSET for SCREEN 12 / memory layout of SCREEN 12


Quote:
>Hello BASIC experts,

>I'm working on a simple oscilloscope with a fast AD card (with DMA
>transfer of the measured data and QB library) and QB for a bicycle
>generator efficiency test bench. The results are shown graphically on a
>500x400 pixel part of SCREEN12 the rest is used for displaying
>aggregated numerical results (voltage: rms, max/min, frequency; current:
>rms, max/min; mechanical input power, electrical output power,
>efficiency, ...) and status informations. The graphics are done with
>first clearing the area with

>LINE (0, 0)-(501, 439), 0, BF                      'black rectangle

>and then generating the new plot with

>    LINE (0, 0)-(0, 400), 1                        'y axis blue
>    LINE (0, 200)-(500, 200), 1                    'x axis blue

>    FOR i = 0 TO 499
>        PSET (i + 1, 200! - wert(i, 1) * 200!), 4  'current red
>        PSET (i + 1, 200! - wert(i, 0) * 20!)      'voltage white
>    NEXT

>On the old 386DX33 PC this results in a distinct flicker of the graphics
>(you notice the time it takes to build up the new curves). It is no
>problem for me, that the graphics are only updated once per second, but
>a constant sine wave should not flicker!

>The way to go could be to use a faster version of PSET (by writing
>directly to the video memory). I didn't find a usenet posting about this
>in dejanews (searching for "PSET" and "SCREEN 12"). Can someone please
>point me to information about the memory layout of screen12 or existing
>routines for a faster PSET?

The flickering is caused by clearing the entire aresa each time.

There are two work-arounds:

1) Instead of psetting directly to the screen, prepare your image somewhere
else in memory, and then copy this to the screen buffer. Screen 12 is a bit
complex, though, since it's split into several memory planes.

2) Keep an array with the location of the pixels you set. Then, just before
plotting the new value to the screen, pset this spot with the background
color again, and save the location of the 'new' pixel in the array so you
can clear _that_ one, the next round.

--
Marc van den Dikkenberg
-----------------------
The powerbasic Archives
http://www.xs4all.nl/~excel/pb.html



Wed, 03 Jan 2001 03:00:00 GMT  
 faster PSET for SCREEN 12 / memory layout of SCREEN 12

Quote:
>2) Keep an array with the location of the pixels you set. Then, just before
>plotting the new value to the screen, pset this spot with the background
>color again, and save the location of the 'new' pixel in the array so you
>can clear _that_ one, the next round.

I will try this in combination with the faster PSET method described by
"qbmax" tomorrow.

Thanks to all contributers!

Andreas



Thu, 04 Jan 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. save/load SCREEN 12 screens in QBasic?

2. Screen 12 Memory

3. Screen 12 backgrounds in QB 4.5

4. 80x60 in PowerBASIC Screen 12

5. Screen 12

6. Address for Screen 11,12,13?

7. Getting screen 12 in ASIC

8. QBasic Screen 12 Text

9. Bload and bsave in screen 12

10. Background Colour in QBasic screen mode 12

11. :Need Help, Fading screen 12

12. palette in screen 12

 

 
Powered by phpBB® Forum Software