nanogui: Thread: Microwindows for Hercules


[<<] [<] Page 2 of 4 [>] [>>]
Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 15 Jul 1999 22:30:14 -0000
Message-Id: <01BECEDE.A7DCCE80.greg@censoft.com>

: 
: If someone's really going to take that approach (I assumed something
: like this was already being done), then I recommend modifying it a
: little for speed.  Instead of leaving NULL in the table and having to
: test it each time the function is being called, replace the NULL with
: a function pointer.  This can either be done in the device driver
: directly:
: 
:     struct driver herc_card[]={
:     	herc_hline,
:     	herc_vline,
:     	generic_line,
:     };
: 
	Good idea, Ben.  We certainly take that approach now, if the sources
are checked out.

	Before everybody gets the idea that this all needs rewriting, please look
at device.h, devdraw.c, and the drivers subdirectory.  The current design has
had a lot of thought put into it, and is preparing for the day when bitblt will be
added.  For instance, the mid level performs *all* clipping, not the low level.  Thus,
the low level can't replace the upper level, because there's no access to the
clipping functions.  Certain drivers, namely scr_bogl and scr_bios have commented
out generic functions that will come online in the way above described when
the speed/size tradeoff merits.  A close look at devdraw.c will show commented
out functions, like low level bresenham, that will also come to play.

Greg
Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 15 Jul 1999 22:36:10 -0000
Message-Id: <01BECEDF.7F940AF0.greg@censoft.com>

: Obviously it would be smart to fill it in.  However you must set it to NULL
: in the driver because of symbol resolution.
: 
: As long as the device driver header file version matches with the one that
: the microwin server uses, the offsets are known.
: 
: Locating the symbols inside the driver is the hard part.
: 
: Perhaps a separate file, created via an external program, which contains
: this structure, is the better way to go.  This way when the structure changes,
: you don't have to go around recompiling all the drivers that have been
: distributed, you just need a program to fixup your jumptable files.

	Currently this is all overkill, since the drivers are compiled into the 
microwin binary.  Also, due to inkd of a neat design, we don't have the problems
that require the driver symbol to be NULL.




: 
: Does anyone know if code exists to hunt for symbols inside a binary?  Does
: bcc generate any symbol information?

Sure, you can run nm86 on .o and a.out files.


: 
: If bcc doesn't generate any symbol info, then I would suggest that each driver
: be an archive of object files, with a manifest.  You would need the code from
: the linker to search the archive and something to read the manifest.
: 
: > 
: >     struct driver herc_card[]={
: >     	herc_hline,
: >     	herc_vline,
: >     	generic_line,
: >     };
: > 
: > or it can be done in a function that examines the structure at load
: > time and patches up any NULLs with real function pointers.  This is a
: > good way to reduce the special cases.

	All this would be solved with Al's DLL stuff, which he's working on.
Then we'd having dynamically linked libraries, of which each driver would be one.

Greg



: >

Subject: Re: Microwindows for Hercules
From: Chipzz ####@####.####
Date: 16 Jul 1999 16:54:25 -0000
Message-Id: <Pine.LNX.4.10.9907161844001.11098-100000@ace.ulyssis.student.kuleuven.ac.be>

On Thu, 15 Jul 1999, Jakob Eriksson wrote:

> From: Jakob Eriksson ####@####.####
> Subject: Re: Microwindows for Hercules
> 
> Excellent!
> 
> I have examples on how to draw fast lines horizontal, vertical and
> (x1, y1) -> (x2, y2) using Bresenham.

I got the VGA mode 13h Bresenham line code here (in asm), which I got from
SWAG (SourceWare Archival Group, Pascal Code). I don't know if it's of any
use, but I can post it here. If anyone is interested, there is some asm
Bresenhams circle code out there too. SWAG is not copyrighted.
Just let me know if you're interested.

Chipzz AKA
Jan Van Buggenhout

--------------------------------------------------------------------------
                  UNIX isn't dead - It just smells funny
                  ####@####.####
--------------------------------------------------------------------------

Subject: RE: Microwindows for Hercules
From: Chipzz ####@####.####
Date: 16 Jul 1999 16:59:08 -0000
Message-Id: <Pine.LNX.4.10.9907161849170.11098-100000@ace.ulyssis.student.kuleuven.ac.be>

> 	No need.  MicroWindows handles the Bresenham algorithm in the mid
> level code in devdraw.c.  It uses successive calls to drawpixel to make it work.

Hmm. A 8086 isn't quite a PC on which you want to loose performance. And
that's exactly what you're doing here. PutPixel is a short routine and you
loose way to much time if you don't inline it...

> In this way, people like you and me don't have to rewrite bresenham for every
> card someone wants....

You wouldn't have to rewrite it for every -CARD-, you would have to re-
write it for every BIT-DEPTH. Which isn't that much work anyway.

Chipzz AKA
Jan Van Buggenhout

--------------------------------------------------------------------------
                  UNIX isn't dead - It just smells funny
                  ####@####.####
--------------------------------------------------------------------------

Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 16 Jul 1999 17:19:26 -0000
Message-Id: <01BECF7C.7466A190.greg@censoft.com>

: I got the VGA mode 13h Bresenham line code here (in asm), which I got from
: SWAG (SourceWare Archival Group, Pascal Code). I don't know if it's of any
: use, but I can post it here. If anyone is interested, there is some asm
: Bresenhams circle code out there too. SWAG is not copyrighted.
: Just let me know if you're interested.
: 

	I would be interested in seeing the circle code...

	Also, some very fast non-bresenham horizontal line code would be interesting
to look at for the various pc video adapters.  (I have included one asm version
in microwindows for reference, but it's not normally compiled in)

Greg
Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 16 Jul 1999 17:24:04 -0000
Message-Id: <01BECF7D.2704CC00.greg@censoft.com>

 
: Hmm. A 8086 isn't quite a PC on which you want to loose performance. And
: that's exactly what you're doing here. PutPixel is a short routine and you
: loose way to much time if you don't inline it...

	The place where nano-X and microwindows spend at *least* 95% of their
pixel-pushing code is in drawing horizontal lines.  All the demos but one
*never* draw a diagonal line, the only case where bresenham is used.  I had
completed test cases to prove this...


: 
: > In this way, people like you and me don't have to rewrite bresenham for every
: > card someone wants....
: 
: You wouldn't have to rewrite it for every -CARD-, you would have to re-
: write it for every BIT-DEPTH. Which isn't that much work anyway.
: 
	A good idea, almost.  The BOGL library performs this for the packed pixel
modes, but the VGA requires OUT instructions inbetween memory accesses,
so it can't run on a generalized bit-depth algorithm in planes mode. (The VGA
design has to be seen/studied to be believed, I've never seen such a complicated
piece of hardware for something kinda-conceptually simple)

Greg
Subject: RE: Microwindows for Hercules
From: Chipzz ####@####.####
Date: 16 Jul 1999 17:45:48 -0000
Message-Id: <Pine.LNX.4.10.9907161924161.11098-100000@ace.ulyssis.student.kuleuven.ac.be>

On Fri, 16 Jul 1999, Greg Haerr wrote:

> From: Greg Haerr ####@####.####
> Subject: RE: Microwindows for Hercules
> 
>  
> : Hmm. A 8086 isn't quite a PC on which you want to loose performance. And
> : that's exactly what you're doing here. PutPixel is a short routine and you
> : loose way to much time if you don't inline it...
> 
> 	The place where nano-X and microwindows spend at *least* 95% of their
> pixel-pushing code is in drawing horizontal lines.  All the demos but one
> *never* draw a diagonal line, the only case where bresenham is used.  I had
> completed test cases to prove this...

OK, granted. Nevertheless, does this mean it has to be slow? Suppose in
the future someone writes a drawing program for ELKS, using the XOR algo
to draw lines (and erase them again as the mouse pointer moves).

> : > In this way, people like you and me don't have to rewrite bresenham for every
> : > card someone wants....
> : 
> : You wouldn't have to rewrite it for every -CARD-, you would have to re-
> : write it for every BIT-DEPTH. Which isn't that much work anyway.
> : 
> 	A good idea, almost.  The BOGL library performs this for the packed pixel
> modes, but the VGA requires OUT instructions inbetween memory accesses,
> so it can't run on a generalized bit-depth algorithm in planes mode. (The VGA
> design has to be seen/studied to be believed, I've never seen such a complicated
> piece of hardware for something kinda-conceptually simple)

Hmm then that's something that could be checked for in between STOSB
instructions (or the like). We could for example use something like this
(just an idea), where ? is a flag that isn't used (maybe the carry flag?):

PUSH flags register
CLI
...
{If out needed} ST?
...
{Bresenham}
...
STOSB {or something like that, like OR}
LOOPN?
JN? :End
...
{Perform OUT}
...
LOOP
...

:End
...
POP flags register

We could of course also use something else than a flag, like a register,
if Bresenham doesn't already use all of them...
Just an idea, I never did VGA 4 bit programming, I always used mode 13h.

Which may be more of a problem is if we would use res > 320x200x256. These
don't fit in one page, and we would have to do page swapping. (Except if
we got a linear framebuffer). But there won't be many 8088-80286 that sup-
port those res anyway..

Chipzz AKA
Jan Van Buggenhout

(Sorry for the rusty asm ;-) )

--------------------------------------------------------------------------
                  UNIX isn't dead - It just smells funny
                  ####@####.####
--------------------------------------------------------------------------

Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 16 Jul 1999 17:57:12 -0000
Message-Id: <01BECF81.C64AE340.greg@censoft.com>

: > 	The place where nano-X and microwindows spend at *least* 95% of their
: > pixel-pushing code is in drawing horizontal lines.  All the demos but one
: > *never* draw a diagonal line, the only case where bresenham is used.  I had
: > completed test cases to prove this...
: 
: OK, granted. Nevertheless, does this mean it has to be slow? Suppose in
: the future someone writes a drawing program for ELKS, using the XOR algo
: to draw lines (and erase them again as the mouse pointer moves).

	Yes, microwindows is ready for this, the code is already
commented out, waiting for somebody to add it.  I just hadn't heard complaints
about the diagonal line drawing speed yet.  (check out devdraw.c, and you'll
see that *if* the clipping routines see that the line can be drawn full speed
with no clipping, then a commented out low level routine can be called
to perform the function at blinding speed.) 

: Hmm then that's something that could be checked for in between STOSB
: instructions (or the like). We could for example use something like this
: (just an idea), where ? is a flag that isn't used (maybe the carry flag?):
: 
: PUSH flags register
: CLI

	(we don't want to draw lines with interrrupts off)

: ...
: {If out needed} ST?
: ...
: {Bresenham}
: ...
: STOSB {or something like that, like OR}
: LOOPN?
: JN? :End
: ...
: {Perform OUT}
: ...
: LOOP
: ...
: 
: :End
: ...
: POP flags register
: 
: We could of course also use something else than a flag, like a register,
: if Bresenham doesn't already use all of them...
: Just an idea, I never did VGA 4 bit programming, I always used mode 13h.
: 
	Generally, it would be nice to have everything in asm for blinding
speed.  I've already done this with microwindows and nano-X, see the file
asmplan4.s..  I also have everything written in C so that it's easily understandable,
and portable.

	Why don't various people play with this code, and maybe
it should be part of the standard make?

Greg
Subject: Re: Microwindows for Hercules
From: Ben Pfaff ####@####.####
Date: 16 Jul 1999 21:47:30 -0000
Message-Id: <87908gjmlz.fsf@pfaffben.user.msu.edu>

Greg Haerr ####@####.#### writes:

   : 
   : > In this way, people like you and me don't have to rewrite bresenham for every
   : > card someone wants....
   : 
   : You wouldn't have to rewrite it for every -CARD-, you would have to re-
   : write it for every BIT-DEPTH. Which isn't that much work anyway.
   : 
	   A good idea, almost.  The BOGL library performs this for the packed pixel
   modes, but the VGA requires OUT instructions inbetween memory accesses,
   so it can't run on a generalized bit-depth algorithm in planes mode. (The VGA
   design has to be seen/studied to be believed, I've never seen such a complicated
   piece of hardware for something kinda-conceptually simple)

Although it would still require special case code, I believe that a
line-drawing routine for VGA16 would be relatively simple, since each
pixel is the same color.  It's been a couple months since I've written
any VGA16 code, but IIRC writing a number of pixels all in one color
can be done with a specialized write mode that makes it easier.
Subject: RE: Microwindows for Hercules
From: Greg Haerr ####@####.####
Date: 16 Jul 1999 21:55:04 -0000
Message-Id: <01BECFA3.070835B0.greg@censoft.com>

	   A good idea, almost.  The BOGL library performs this for the packed pixel
:    modes, but the VGA requires OUT instructions inbetween memory accesses,
:    so it can't run on a generalized bit-depth algorithm in planes mode. (The VGA
:    design has to be seen/studied to be believed, I've never seen such a complicated
:    piece of hardware for something kinda-conceptually simple)
: 
: Although it would still require special case code, I believe that a
: line-drawing routine for VGA16 would be relatively simple, since each
: pixel is the same color.  It's been a couple months since I've written
: any VGA16 code, but IIRC writing a number of pixels all in one color
: can be done with a specialized write mode that makes it easier.

	This is what we need.  This special case code is already
in the driver scr_bios.c under VGA_drawhline().  It calls either the C entry
point in vgaplan4.c or the asm implementation in asmplan4.s called ega_drawhline.
This code isn't optimized for multiple pixels with the same color, yet, and would
most likely tremendously increase speed on slow systems like ELKS 8086's.

Greg

: 


[<<] [<] Page 2 of 4 [>] [>>]


Powered by ezmlm-browse 0.20.