[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: Herc in Microwin
From: Greg Haerr ####@####.#### Date: 7 Sep 1999 16:32:47 -0000 Message-Id: <01BEF91B.A6ECE9D0.greg@censoft.com> [hercules ... snip] : You said that hline and vline need to be rewriten. I am volintering for the : task (unless someonee has allready done it). : Great! : I looked at the code and at the moment it just uses a loop to draw the line : pixel by pixel. How does it need to be improved?? : Are you familiar with the Herc memory/screen layout? Instead of looping for each bit, the C code needs to set up to 8 pixels at a time with a single MOV instruction. This entails pre-calculating the bits in the screen memory and writing it once. Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
SV: Herc in Microwin
From: Bjorn Eriksson ####@####.#### Date: 8 Sep 1999 17:52:04 -0000 Message-Id: <01BEFA32.89E13860@BJORN> >: I looked at the code and at the moment it just uses a loop to draw the line >: pixel by pixel. How does it need to be improved?? >: > Are you familiar with the Herc memory/screen layout? Instead of >looping for each bit, the C code needs to set up to 8 pixels at a time with a >single MOV instruction. This entails pre-calculating the bits in the screen memory >and writing it once. Oh, wait a second. I've got some very, very old C-code somewhere on my very old 386SX 16MHz PC somewhere. Nah, I wouldn't bother considering it's ten years old and I was fairly new to C at the time... :-) Well, if you're unfamiliar with the hercules screen-memory layout it might provide some guidance. Here's a bit of code for TurboC 2.0: (please don't comment the code-quality) #define US unsigned #define BYTE US char #define HERCADDR(column,row) \ ((BYTE far *) ( 0xB0000000L | (US long) (0x2000u*(row & 3u) + 90u*(row>>2u) + (column>>3u)) )) void vert_line(US x1, US x2, US y, const BYTE color) { BYTE far *addr1; BYTE far *addr2; BYTE byte1, byte2; byte1 = 128u >> (x1 & 7u); byte1 |= byte1-1; byte2 = 128u >> (x2 & 7u); byte2--; byte2 ^= 0xFF; addr1 = HERCADDR(x1, y); addr2 = HERCADDR(x2, y); if ( color ) { if ( FP_OFF(addr2) == FP_OFF(addr1) ) { *addr1 |= byte1 & byte2; } else { *addr1 |= byte1; *addr2 |= byte2; addr1++; while ( addr1 < addr2 ) *addr1++ = 0xFF; } } else { if ( FP_OFF(addr2) == FP_OFF(addr1) ) { *addr1 &= (byte1 & byte2) ^ 0xFF; } else { *addr1 &= byte1 ^ 0xFF; *addr2 &= byte2 ^ 0xFF; addr1++; while ( addr1 < addr2 ) *addr1++ = 0; } } } Hmmm. Wasn't hercules a four color graphics card? Maybe I decided a two color model was more "speed optimized". //Björn. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: SV: Herc in Microwin
From: Alex Holden ####@####.#### Date: 8 Sep 1999 17:55:29 -0000 Message-Id: <Pine.LNX.4.04.9909081854590.23796-100000@www.linuxhacker.org> On Wed, 8 Sep 1999, Bjorn Eriksson wrote: > Hmmm. Wasn't hercules a four color graphics card? Maybe I decided a > two color model was more "speed optimized". Hercules was mono. CGA was four colour. --------------- Linux- the choice of a GNU generation. -------------- : Alex Holden (M1CJD)- Caver, Programmer, Land Rover nut, Radio Ham : -------------------- http://www.linuxhacker.org/ -------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: Herc in Microwin
From: Greg Haerr ####@####.#### Date: 8 Sep 1999 20:00:47 -0000 Message-Id: <01BEFA01.D9F70B30.greg@censoft.com> On Wednesday, September 08, 1999 11:44 AM, Bjorn Eriksson ####@####.#### wrote: : >: I looked at the code and at the moment it just uses a loop to draw the line : >: pixel by pixel. How does it need to be improved?? : >: : > Are you familiar with the Herc memory/screen layout? Instead of : >looping for each bit, the C code needs to set up to 8 pixels at a time with a : >single MOV instruction. This entails pre-calculating the bits in the screen memory : >and writing it once. : : Oh, wait a second. I've got some very, very old C-code somewhere on my very old 386SX 16MHz PC somewhere. Nah, I wouldn't bother considering it's ten years old and I was fairly new to C at the time... :-) : : Well, if you're unfamiliar with the hercules screen-memory layout it might provide some guidance. Here's a bit of code for TurboC 2.0: (please don't comment the code-quality) : [snip] Totally cool! This is exactly the code that Thomas Stuart needs to speed up the Herc support. Thomas - go ahead and use Bjorn's code for the horizontal line draw speedup. Let me know if you have questions. BTW, Bjorn's code is incorrectly called "vert_line" it really draws a horizontal line. We won't get any speedups on the vertical line drawing. Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |