Subject: Re: [TI994A] How about a little help....

From: Marc Hull <[email-masked]>
Date: Thu, 30 Sep 2010 12:34:35 -0700 (PDT)

Ok then that is the source of my confusion. 

I assumed that the VDP allowed the pattern table and color tables to be mapped as 2048 byte blocks in this mode but instead the VDP is making you set them up as if they were 6144 bytes long. 

So indeed the tables have to start @ 0 and >2000 even though they don't need that kind of separation.  Clear and simple now....

So for the future benefit of mankind and I hope this is correct........

Half Bit Map mode with 256 characters...

Your Pattern table must be placed at  either memory block >0 or >2000 and  your color table must occupy the other unused block.  IE.. PDT @ >0  and COLOR @ >2000 or vice verse even thought the VDP only operates on the first 2048 bytes of each.  (See question after your color Reg example...)

The other tables can be set up at will provided that they are clear of >0 to >7FF and >2000 to >3813

Your display can consist of 256 individual characters that can appear anywhere on the screen. 

Each character will have it's own 8 byte color code that follows it regardless of where it appears on the screen

FROM MIKE....

VDP Register # - value - purpose (sample from VDP Programmer's Guide)

0 - >02 - select bitmap graphics mode 

1 - >C2 - 16k, enabled, double-size sprites, you can set the 
interrupt and 

sprite bits as you like

2 - >0E - put the screen image table at >3800 (>400 * >E). 
Can put it 

anywhere free, but this works in full bitmap too.

3 - >9F - Color table at >2000, mask of >07FF for 256 chars 
(ok, a little 

magic here)
_______________________________________________________________________

Could you break down this magic a bit ?  What would the value be if I wanted this table at >0  and the PDT at >2000 and why ???
_______________________________________________________________________ 

4 - >00 - Pattern table at >0000 - mask comes from Register 3

5 - >76 - Sprite table at >3B00 (>80 * >76). Can be put 
anywhere free.

6 - >03 - Sprite pattern table at >1800 (>800 * 3). Can be put 
anywhere free 

or overlap other pattern table as normal.

7 - >0F - white background color. Any value is fine.

Thanks for the lessons...... ;-)

--- On Thu, 9/30/10, Tursi <[email-masked]> wrote:

From: Tursi <[email-masked]>
Subject: Re: [TI994A] How about a little help....
To: [email-masked]
Date: Thursday, September 30, 2010, 1:29 PM

  

      > Am I free to put the tables anywhere I wish ?  This factoid appears no 

> where I can find.  Everyone uses examples with no explanation. And they 

> all have the pattern table @ 0 and the color table @ >2000 (IIRC.)  I 

> don't know if this is an integral part of the mode or  just people 

> rehashing others examples.  That is the largest source of confusion on my 

> part and perhaps others who may explore this mode.

This is nothing to do with "half-bitmap" mode, it's simply a fact of life in 

bitmap at all. Only one bit of the register is used to set the address of 

the pattern and color table. So you get a choice of >0000, or >2000 for each 

table.

---

From: mark wills <[email-masked]>
Date: Thu, 30 Sep 2010 21:07:46 +0000 (GMT)

While we're sharing the love and generally having a big group hug, does anyone 
know the VDP register settings for the 9938 to come up as a normal 9918?

I've found out that when you have a 9938, just setting the 9918's registers 
isn't enough... You get a blank screen.

I would like TurboForth to be able to support 80 column cards. Detecting the 
9938 is easy enough, but I don't have a *clue* how to set it up in 80 column 
mode (which is what I'm particularly interested in).

I could do with some hand holding here.

Mark

---

From: Marc Hull <[email-masked]>
Date: Thu, 30 Sep 2010 14:38:23 -0700 (PDT)

get back in line Mark. No cuts ;-)

--- On Thu, 9/30/10, mark wills <[email-masked]> wrote:

From: mark wills <[email-masked]>
Subject: Re: [TI994A] How about a little help....
To: [email-masked]
Date: Thursday, September 30, 2010, 4:07 PM

  

      While we're sharing the love and generally having a big group hug, does anyone know the VDP register settings for the 9938 to come up as a normal 9918?

I've found out that when you have a 9938, just setting the 9918's registers isn't enough... You get a blank screen.

I would like TurboForth to be able to support 80 column cards. Detecting the 9938 is easy enough, but I don't have a *clue* how to set it up in 80 column mode (which is what I'm particularly interested in).

Mark

---

From: "Tursi" <[email-masked]>
Date: Thu, 30 Sep 2010 14:54:06 -0700

> Your Pattern table must be placed at  either memory block >0 or >2000 and 
> your color table must occupy the other unused block.  IE.. PDT @ >0  and 
> COLOR @ >2000 or vice verse even thought the VDP only operates on the 
> first 2048 bytes of each.  (See question after your color Reg example...)
>

They can both be at the same address. But since they both use the character 
index as the lookup, it's hard to say whether you can make that overlap 
useful. ;) (That is, the same bytes that define the pattern would also 
define the colors).

> to >7FF and >2000 to >3813

Again, unless you want deliberate overlap for some reason. Although, the 
 >3813 is a strange address. The color table and the pattern table both take 
only >800 bytes in this mode, so patterns from >0 to >7FF and colors from 
 >2000 to >27FF in this example.

Note it's legal to make those tables smaller than 256 characters, too.

> Your display can consist of 256 individual characters that can appear 

Yes.

> Each character will have it's own 8 byte color code that follows it 
> regardless of where it appears on the screen

Yes.

> VDP Register # - value - purpose (sample from VDP Programmer's Guide)

Not from Mike, from VDP Programmer's Guide. ;)

> (ok, a little magic here)
> Could you break down this magic a bit ?  What would the value be if I 
> wanted this table at >0  and the PDT at >2000 and why ???

VDP Register 3, the MSB sets the start address of the color table. When 0, 
it starts at 0, when set, it starts at >2000. Think of it as ((VDPREG3 & 
0x80) << 6). So set or clear the MSB (value >80) to change the start address 
of the table. The same is true of VDP register 4 for the pattern table, 
except the bit used is bit 5 (value >04) and so the shift is larger.

The other 7 bits represent the most significant bits of the pattern mask. 
This is the "magic" that creates "half-bitmap" mode. The normal value that 
EA and the Datasheet tells you to enter is >7F (making the register either 
 >7F for starting at >0000, or >FF for starting at >2000). These 7 bits are 
shifted up 6 bits, filling the LSBs with 1s, to create a mask for the 
address of the character. Thus, for >7F, the recommended value, the mask is 
 >1FFF, actually giving an 8k table. Character patterns are internally 
numbered from >000 to >2FF in bitmap mode, with the top two bits set by 
which third of the screen they are in, and the lower 8 bits set by the user. 
This value is shifted up by 3 bits (multiplied by 8) to get the address 
offset. That address offset is then AND'd with the calculated mask to get 
the actual address offset in VDP RAM (which is then added to the base.)

I find it easiest to think of bitmap as dividing the screen into three 
zones, numbered from 0 to 2. These zones represent a fixed offset added to 
the character pattern when it is looked up in the screen image table.

Zone 0 - lines 0-7, add >000
Zone 1 - lines 8-15, add >100
Zone 2 - lines 16-23, add >200

For instance, let's assume that I put ASCII 33 at position 0 in the Screen 
Image Table. I have set up the color table with the recommended value of 
 >FF, which puts the color table at >2000 at it's full size. ASCII 33 is >21. 
It's in the first third of the screen, so the offset bits are 0, giving a 
final character index of >021. Multiplied by 8, gives us an offset of >0108. 
Apply the mask: >0108 AND >1FFF is still >0108. Now add the base, and the 
address for the color data is >2000 + >0108, giving >2108. We add the same 
offset to the pattern table base to find the pattern data, >0000 + >0108 is 
 >0108.

In the same setup, if I put character >85 on the bottom line of the screen, 
it looks like this:

>85 plus screen offset - zone 2 - gives character >285
Multiply by 8 for address, gives >1428
Apply mask of >1FFF - still gives >1428.
Add to color base >2000 - gives >3428.
Add to pattern base >0000 - gives >1428.

Note that although the full size of the mask is >1FFF, which is 2k, the 
maximum character is >2FF, which gives a maximum address of >17F8, and 
that's why the table is 6k instead of 8k. The next smaller mask is 4k, which 
is valid, but would give different results.

Now in half-bitmap mode, when we set up for a mask of >7FF, the examples 
look like this:

>21 plus screen offset - zone 0 - gives character >021
Multiply by 8 for address, gives >0108
Apply mask of >7FF, still have >0108
Add to color base >2000 - gives >2108.
Add to pattern base >0000 - gives >0108.

Second example:

>85 plus screen offset - zone 2 - gives character >285
Multiply by 8 for address, gives >1428
Apply mask of >07FF - gives >0428 <<-- only difference!! note this forces it 
to stay inside the first pattern table!
Add to color base >2000 - gives >2428.
Add to pattern base >0000 - gives >0428.

And yes, you can use other masks. Masks with all '1' bits are about all it 
seems to make sense to use, but the video chip doesn't care. You can make it 
as small as 8 characters long (64 bytes) by setting all the configurable 
mask bits to 0. Though you can still write characters from 0-255 in the 
pattern table - they will end up masking down to the first 8 characters - if 
you look at where the masking occurs, you will see it's easy to calculate 
the result.

---

From: fdos <[email-masked]>
Date: Thu, 30 Sep 2010 15:01:16 -0700

Hi Mark,

I don't know off the top of my hat (I have to cover up the hair loss), 
but X4th99 does it near daily.  However, it's all based on TI Forth 
option Screens and this time around Lutz Winkler's code that was in 
MICROpendium years ago (although I did do it myself way back before 
then, but I never published it, so I thought it best to do it his way). 
  I should have time to run it all down tomorrow for you, if someone 
doesn't pipe up with the info before then.

Bill S

---

From: mark wills <[email-masked]>
Date: Thu, 30 Sep 2010 22:33:45 +0000 (GMT)

Fantastic, that would be a great help, Bill.

Thank you

Mark

----- Original Message ----
> From: fdos <[email-masked]>
> Sent: Thu, 30 September, 2010 23:01:16
> ------------------------------------
> 
> Yahoo!  Groups Links
> 
> 
> 
>

---

From: Insane Multitasker <[email-masked]>
Date: Thu, 30 Sep 2010 23:50:32 -0500

Since Bill is going to rummage up some code, I'll only offer a few thoughts ;)-

1. The V9938 does use bits and registers not found on the TI.  If you are getting a blank
screen you are most likely setting or clearing bits which the 9918 registers would note as
"unused".  There are a number of carts, I believe Atarisoft was a prime offender, which
twiddled bits like this.  There are various cart dumps that were corrected over time
to address this problem; I do not know if those were preserved over the non-fixed
dumps. 

2. When using 80 column mode (TEXT II), you will want to not only set up the screen,
character,and other "usual" tables, you'll want to set the blinking attributes (color, blink
times) via the proper registers.  Failure to do so will lead to curious displays.  

3. If you are using a Geneve and disable video wait states, it is possible to generate
artifacts.  It is advantageous to control this on your own and tailor routines accordingly. 

4. The V9938 manual is helpful though written poorly (IMHO).  I recommend you
locate a copy and read through the register and port information.  

5. The V9938 has a banking register (0x0e?  not positive here) which facilitates
VRAM banking. Some modes will flip banks automatically upon reaching the end
of the preceeding bank ( address 0x3fff).  

To: [email-masked]
From: [email-masked]
Date: Thu, 30 Sep 2010 21:07:46 +0000
Subject: Re: [TI994A] How about a little help....

Mark

---

From: fdos <[email-masked]>
Date: Fri, 01 Oct 2010 10:24:45 -0700

Mark,

I suspect the formatting of the forth code below will all be screwed up 
before it gets to you, so I will attach it in a text file to your 
private e-mail address also.  I have some errands to do this morning, so 
I will be out, but back this afternoon, but I also get my 4 grand-kids 
for the night, so my response to any questions may be skimpy until 
tomorrow afternoon.

I think most of the code, with comments, will be easy for you to 
understand except for X4th99 specifics.  If you are only switching 
between 40 column (TEXT) and 80 column (TEXT2) you don't need to erase 
any tables and reload the character sets as I do.  I'm set up to do all 
text and graphic modes like TI Forth and also for V9938 paging of all 
text and graphic modes, so a necessity if you don't want to track which 
text or graphic mode you are switching from.

HEX
: SETVDP1  0B0 1 VWTR		( Blank the screen )
      800 800 0FF VFILL		( INIT 256 Character patterns )
      900 834A ! 18 GPLLNK	( Load upper case characters )
      B00 834A ! 4A GPLLNK ;	( Load lower case - TI-99/4A only! )
: SETVDP2  ( n ---) 460 PABS !	( Location of PABS )
      1000 DISK_BUF !		( 1K buffer location - Set VDP regs )
      0 0 VWTR  0 2 VWTR  OE 3 VWTR  1 4 VWTR  6 5 VWTR
      3E0 836E			( VSPTR )
      1 PABS @ VSBW  16 PABS @ 1+ VSBW  3 ( file # ) 834C C!
      PABS @ 8356 !  0A 0E SYSTEM  ( SR type DSRLNK sets 3 disk buffers )
      0 0 GOTOXY  0 837A C!  DUP 83D4 C!  1 VWTR ;
: TEXT  0 300 20 VFILL 		( Blanks to screen image area )
      28 SCRN_WIDTH !  0 SCRN_START !  3C0 SCRN_END !  ( Set screen limits )
      SETVDP1  1 VDPMDE !	( Set editor mode - Set VDP regs )
      0 9 VWTR  F4 7 VWTR  0F0 SETVDP2 ;
: TEXT2  7 VDPMDE !  C80 PABS !	( Set editor mode and location of PABS )
      1800 DISK_BUF !  0 870 20 VFILL  ( 1K buffer location & blank the 
screen )
      50 SCRN_WIDTH !  0 SCRN_START !  820 SCRN_END !  ( Set screen limits )
       4 0 VWTR  3 2 VWTR  2F 3 VWTR  00 A VWTR   2 4 VWTR
      F4 7 VWTR  A 8 VWTR  80 9 VWTR  19 C VWTR  00 D VWTR
      F0 DUP 83D4 C!  1 VWTR  C00 836E !  ( VSPTR )
      A00 10F 0 VFILL  1000 800 FF VFILL  0 0 GOTOXY
      1100 834A !  18 GPLLNK	( Load upper case characters )
      1300 834a !  4A GPLLNK ;	( Load lower case - TI-994/A only! )

Bill S

---

From: fdos <[email-masked]>
Date: Fri, 01 Oct 2010 10:42:55 -0700

I just noticed.  I also set 80 column mode to 26 lines, but I'm sure 
you'll figure out what you want and how to get it.

Bill S

On 10/1/2010 10:24 AM, fdos wrote:
>        1800 DISK_BUF !  0 870 20 VFILL  ( 1K buffer location&  blank the
> screen )