Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Converting HGR to DHGR
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
BLuRry  
View profile  
 More options Jan 17, 10:32 am
Newsgroups: comp.sys.apple2.programmer
From: BLuRry <brendan.rob...@gmail.com>
Date: Tue, 17 Jan 2012 07:32:51 -0800 (PST)
Local: Tues, Jan 17 2012 10:32 am
Subject: Converting HGR to DHGR
I thought I had it figured out, but for some reason purple and green
are flipped around.  Does anyone have a good algorithm for converting
HGR to DHGR, accounting for half-pixels and other funky behaviors of
the video scanner?

JACE DHGR renderer is great and now lores and dhgr look spot-on (well,
maybe not as spot-on as open emulator, but well enough for me).
However, HGR has the frindge and NTSC artifacts correct but the low-
order colors need help.  I really don't want to have to hack an
alternate palette for green/purple.  Suggestions?

-Brendan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vladimir Ivanov  
View profile  
 More options Jan 17, 11:20 am
Newsgroups: comp.sys.apple2.programmer
From: Vladimir Ivanov <vlad...@XXXyahooXXX.com>
Date: Tue, 17 Jan 2012 18:20:43 +0200
Local: Tues, Jan 17 2012 11:20 am
Subject: Re: Converting HGR to DHGR

On Tue, 17 Jan 2012, BLuRry wrote:
> Does anyone have a good algorithm for converting HGR to DHGR, accounting
> for half-pixels and other funky behaviors of the video scanner?

Yes, it's actually dead simple - render always in DHGR.

Text and LORES - double each bit.

HIRES - double each bit. If HGR byte has bit7=1 then shift the result one
bit and append bit #6 from last HGR byte (not doubled). This is what the
hardware does - delaying for one 14 MHz clock. For the leftmost HGR bytes
on screen you can assume last latched bit #6 was zero if you don't want to
simulate the video scanner address generation.

Here's how HIRES looks in my emulator RA2:

        v = T_HLSB[p->dl & 0x7F];
        if (p->dl & 0x80)
                v = (v << 1) | p->dl6;

T_HLSB[128] is a bit-doubling table (7 bits -> 14 bits).
'v' is 14-bit result
'dl' is data latch, i.e. current HGR byte
'dl6' is bit #6 from last scanned HGR byte

Hope that helps,
   -- Vlad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Antoine Vignau  
View profile  
 More options Jan 17, 12:10 pm
Newsgroups: comp.sys.apple2.programmer
From: Antoine Vignau <antoine.vig...@laposte.net>
Date: Tue, 17 Jan 2012 09:10:14 -0800 (PST)
Local: Tues, Jan 17 2012 12:10 pm
Subject: Re: Converting HGR to DHGR
On 17 jan, 17:20, Vladimir Ivanov <vlad...@XXXyahooXXX.com> wrote:

Or use the Graphics Exchange program ;-)
antoine

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BLuRry  
View profile  
 More options Jan 17, 12:26 pm
Newsgroups: comp.sys.apple2.programmer
From: BLuRry <brendan.rob...@gmail.com>
Date: Tue, 17 Jan 2012 09:26:28 -0800 (PST)
Local: Tues, Jan 17 2012 12:26 pm
Subject: Re: Converting HGR to DHGR
On Jan 17, 10:20 am, Vladimir Ivanov <vlad...@XXXyahooXXX.com> wrote:

This is the strange part, when I do it that way then the hires palette
is totally flipped around, e.g. orange and blue appear as low-order
colors.  When I correct my color lookup (invert the nibble values),
HGR looks OK but then DHGR and Lo-res have completely shuffled
palettes.  I totally get what you're saying though.  I think my color
mixup was because I was shifting for low-order to conform to the
palette and the bug is in there somewhere.  It's tricky to implement
because I'm doing this as a table-lookup where the table represents
two consecutive bytes of HGR data and the resulting 28 bits of DHGR
that maps to it.  Anyway, I'll work on the assumption that DHGR and Lo-
res rendering were at fault and go from there.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vladimir Ivanov  
View profile  
 More options Jan 18, 4:17 am
Newsgroups: comp.sys.apple2.programmer
From: Vladimir Ivanov <vlad...@XXXyahooXXX.com>
Date: Wed, 18 Jan 2012 11:17:39 +0200
Local: Wed, Jan 18 2012 4:17 am
Subject: Re: Converting HGR to DHGR

On Tue, 17 Jan 2012, BLuRry wrote:
> This is the strange part, when I do it that way then the hires palette
> is totally flipped around, e.g. orange and blue appear as low-order
> colors.  When I correct my color lookup (invert the nibble values),
> HGR looks OK but then DHGR and Lo-res have completely shuffled
> palettes.

Check for MSB-LSB ordering? The code snippet I posted reverses the HGR bit
positions through the table and then assumes MSB on left and LSB on right
of screen for further processing.

> It's tricky to implement because I'm doing this as a table-lookup where
> the table represents two consecutive bytes of HGR data

For the part of the table that has MSB=1 there is reliance on the previous
byte. In other words you'd better index a table by [bit6_of_prev_byte,
cur_byte] pairs and produce only 14 bits of output. This is 512-entry
lookup table.

I'd suggest do it the slow way with the 'if' on a stream of bytes first,
then go optimizing.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BLuRry  
View profile  
 More options Jan 18, 2:04 pm
Newsgroups: comp.sys.apple2.programmer
From: BLuRry <brendan.rob...@gmail.com>
Date: Wed, 18 Jan 2012 11:04:19 -0800 (PST)
Local: Wed, Jan 18 2012 2:04 pm
Subject: Re: Converting HGR to DHGR
On Jan 18, 3:17 am, Vladimir Ivanov <vlad...@XXXyahooXXX.com> wrote:

When I look @ the bit patterns for the hires colors, I can see what
you mean.  Flipping bits so that LSB is on the left is how the
hardware does it.  And I was pretty sure that most of my conversion
logic worked that way, but for some reason it isn't flipping it around
in a few places.  Very strange.  Guess I'll need to put in some junit
tests to sort this out since I know what assertions should be
correct.  **scratches head**

-Brendan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BLuRry  
View profile  
 More options Jan 18, 11:34 pm
Newsgroups: comp.sys.apple2.programmer
From: BLuRry <brendan.rob...@gmail.com>
Date: Wed, 18 Jan 2012 20:34:43 -0800 (PST)
Local: Wed, Jan 18 2012 11:34 pm
Subject: Re: Converting HGR to DHGR
On Jan 18, 1:04 pm, BLuRry <brendan.rob...@gmail.com> wrote:

Ok -- Turns out there was one behavior of the video scanner I wasn't
aware of.  The difference between HGR and DHGR wasn't a conversion
problem.  I had the right algorithm.  Well, I wound up writing
something more efficient after rewriting it over and over.  When I
took my scanline renderer and had it shift the hires screen a half-bit
from the DHGR (or rather I should say that DHGR is shifted 1 bit right
compared to HGR) then everything works for both HGR and DHGR as it
should have in the first place -- no other hacks or workarounds
necessary.

1 bit shift for DHGR though??  I need to read Sather again I think.
I'm just glad the darn thing is working!  After I clean up my messy
coding hacks I'll check it in and issue an official build.

-B


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vladimir Ivanov  
View profile  
 More options Jan 19, 6:12 am
Newsgroups: comp.sys.apple2.programmer
From: Vladimir Ivanov <vlad...@XXXyahooXXX.com>
Date: Thu, 19 Jan 2012 13:12:16 +0200
Local: Thurs, Jan 19 2012 6:12 am
Subject: Re: Converting HGR to DHGR

On Wed, 18 Jan 2012, BLuRry wrote:
> 1 bit shift for DHGR though??

Not likely. If you have setup with color monitor just try it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jerry  
View profile  
 More options Jan 21, 4:53 am
Newsgroups: comp.sys.apple2.programmer
From: Jerry <awande...@yahoo.ca>
Date: Sat, 21 Jan 2012 02:53:56 -0700
Local: Sat, Jan 21 2012 4:53 am
Subject: Re: Converting HGR to DHGR

Vladimir Ivanov <vlad...@XXXyahooXXX.com> writes:
> On Wed, 18 Jan 2012, BLuRry wrote:

>> 1 bit shift for DHGR though??

> Not likely. If you have setup with color monitor just try it.

80-column mode, and DHGR actually starts seven bits (14.318180 MHz
periods) sooner (one 80-column character width) than 40-column mode,
which explains the shift in colors if either you don't do the shift to
compensate, or you don't simulate the whole dot stream coming out of the
shift registers.

Try this on a IIe or IIc to see the effect:

1 D = 500
2  PR# 3: PRINT " "
5  GOTO 100
10  PRINT  CHR$ (17);
20  FOR X = 1 to D: NEXT
30  PRINT  CHR$ (18);
40  FOR X = 1 to D: NEXT
50  GOTO 10
100  HGR : POKE 49246,0
101  DATA 160,0,132,0,162,32,134,1,141,84,192,177,0,141,85,192,145,0,200
    ,208,243,230,1,202,208,238,96
102  FOR A = 768 TO 794: READ X: POKE A,X: NEXT
110  HCOLOR= 3: HPLOT 0,0: CALL 62454
120  GOTO 10

You will see the left and right borders moving left and right a bit as
the display switches from 80 columns to 40 columns and back.

--
--
Jerry    awanderin at yahoo dot ca


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vladimir Ivanov  
View profile  
 More options Jan 21, 11:48 am
Newsgroups: comp.sys.apple2.programmer
From: Vladimir Ivanov <vlad...@XXXyahooXXX.com>
Date: Sat, 21 Jan 2012 18:48:32 +0200
Local: Sat, Jan 21 2012 11:48 am
Subject: Re: Converting HGR to DHGR

On Sat, 21 Jan 2012, Jerry wrote:
> 80-column mode, and DHGR actually starts seven bits (14.318180 MHz
> periods) sooner (one 80-column character width) than 40-column mode,
> which explains the shift in colors if either you don't do the shift to
> compensate, or you don't simulate the whole dot stream coming out of the
> shift registers.

I see what you mean - what I forgot was that the aux page video data is
displayed first. Thanks!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Kruszyna  
View profile  
 More options Feb 18, 3:58 pm
Newsgroups: comp.sys.apple2.programmer
From: Daniel Kruszyna <d...@krue.net>
Date: Sat, 18 Feb 2012 20:58:30 +0000 (UTC)
Local: Sat, Feb 18 2012 3:58 pm
Subject: Re: Converting HGR to DHGR

Jerry <awande...@yahoo.ca> wrote:
> 80-column mode, and DHGR actually starts seven bits (14.318180 MHz periods)
> sooner (one 80-column character width) than 40-column mode, which explains
> the shift in colors if either you don't do the shift to compensate, or you
> don't simulate the whole dot stream coming out of the shift registers.

I wanted to see how the IIgs does this, and of course it's different.  I used a
different program, but it still switches between 40 and 80 column modes. Text
page 1 in main ram contains 'X' characters, while text page 1 in aux ram
contains 'O' characters. Here are the results:

http://krue.net/junque/iigs_40_80_split_full.jpg
http://krue.net/junque/iigs_40_80_split_close.jpg

Also, I didn't take a picture, but each OX pair in 80 column mode is aligned
with the X of 40 column mode.

-- Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BLuRry  
View profile  
 More options Feb 18, 6:00 pm
Newsgroups: comp.sys.apple2.programmer
From: BLuRry <brendan.rob...@gmail.com>
Date: Sat, 18 Feb 2012 15:00:17 -0800 (PST)
Local: Sat, Feb 18 2012 6:00 pm
Subject: Re: Converting HGR to DHGR
Wow... that's trippy.  Thanks Daniel!

-B


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ict@ccess  
View profile  
 More options Feb 19, 10:05 pm
Newsgroups: comp.sys.apple2.programmer
From: "ict@ccess" <gids...@sasktel.net>
Date: Sun, 19 Feb 2012 19:05:26 -0800 (PST)
Local: Sun, Feb 19 2012 10:05 pm
Subject: Re: Converting HGR to DHGR
On Jan 17, 9:32 am, BLuRry <brendan.rob...@gmail.com> wrote:

> I thought I had it figured out, but for some reason purple and green
> are flipped around.  Does anyone have a good algorithm for converting
> HGR to DHGR, accounting for half-pixels and other funky behaviors of
> the video scanner?

> JACE DHGR renderer is great and now lores and dhgr look spot-on (well,
> maybe not as spot-on as open emulator, but well enough for me).
> However, HGR has the frindge and NTSC artifacts correct but the low-
> order colors need help.  I really don't want to have to hack an
> alternate palette for green/purple.  Suggestions?

> -Brendan

If still interested, I have 3 programs for converting HGR to DHGR.

One that does not take color into account, best for B/W
One that shows color correctly but only displays on half of the DHGR
screen
And the last one shows color correctly and fills the whole DHGR screen

Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »