new hybrid mode found

Page 1/2
| 2

By hit9918

Prophet (2901)

hit9918's picture

27-02-2012, 12:03

Wow I didn't know the 9918 got character masking in VDP(3)!

VDP(3) = VDP(3) XOR 16 is snipping each charset down to halve a charset. So when using the chars 128-255, by enabling the mask register, 0-127 are shown.

This is charset switching / doublebuffering without writing the nametable!

Pippols, Malaika, dviks gng, I guess they all work by ADDing values to the chars and then write to the nametable.

Can replace this by a simple copy loop and do the switching with the mask register. Going further, you can spread the nametable workload across 8 scrollsteps. Like on C64 or on 9938. Getting rid of most of that 768 bytes workload.

And character masking does not affect the sprites! Heaven! LOL!

Login or register to post comments

By hit9918

Prophet (2901)

hit9918's picture

27-02-2012, 12:22

bluemsx and openmsx do character masking wrong Sad

Those bits are just simply a mask operation on the "ascii" values of nametable entries.
VDP(3) = VDP(3) XOR 16 masks the highest bit of the "ascii".

I got this from this cool TI99 users video, nicely describing the effect: http://www.youtube.com/watch?v=XJljSJqzDR0

I checked on Hit Bit 75 with 9929 PAL, it works like the TI99 in the video.
Like the video shows at 12:05 - character masking got no effect on the sprites.

I would never have expected that I would ever learn something totaly new about the 9918!
I think the feature is underrated because it is not clear how this enables switching between charsets.
e.g. when the "ascii" values always got top 3 bits set, then with the mask register you can switch between 8 charsets a 32 chars.

Here is a test app.

It got nametable contents different than the video to make clear that this time the mask is not about the scanline Y value but about the ascii value. Hit a key to switch to the other halve of the charset.

10 SCREEN 2,2
20 SPRITE $(0)="ldscktjhklstcdhpxksjdhksjhdskjhskjhsd"
30 FOR I = 0 TO 31
40 PUT SPRITE I,(I*8, I*5),I AND 15,0
50 NEXT
60 ON STRIG GOSUB 200
70 STRIG(0) ON
80 OPEN "grp:" AS #1
90 FOR I = 0 TO 2
100 LINE (255,I*64+63)-(0,I*64),I,BF : PRESET(0,I*64),I
110 FOR C = 0 TO 255 : PRINT#1,CHR$(C); : NEXT
120 NEXT
130 FOR I = 0 TO 127
140 VPOKE(6144+I),I+128
150 VPOKE(6144+I+256),I+128
160 VPOKE(6144+I+512),I+128
170 NEXT
180 GOSUB 200
190 GOTO 190
200 VDP(3) = VDP(3) XOR 16
210 RETURN

By Wolverine_nl

Paragon (1149)

Wolverine_nl's picture

27-02-2012, 15:03

Gonna test this lateron at home, I am curious now Wink

By hap

Paragon (2036)

hap's picture

27-02-2012, 16:58

That's pretty cool! =)
Does it work on V9938 too?

By MäSäXi

Paragon (1884)

MäSäXi's picture

27-02-2012, 17:37

about video: wow..... some sprites look like they are going behind the background....!

By hap

Paragon (2036)

hap's picture

05-03-2012, 22:56

I tried your test on a TMS9129, and it didn't mask characters, just the colors.
I suppose this issue only happens on TMS99xx chips then.

By Maggoo

Paragon (1212)

Maggoo's picture

08-03-2012, 16:21

Just a bit off topics: Should'nt  that type of information be part of the WIKI on programming and/or on the VDP ?

There are a number of other VDP "tricks" we could document that way and make it an easy reference for programmers.
I think one WIKI topic covering the "undocumented" or "hybrid" modes of the different VDPs would be a good addition.

By Wolverine_nl

Paragon (1149)

Wolverine_nl's picture

08-03-2012, 16:24

@ Maggoo:
This may or may not count for every systemconfig. So to put it in Wiki, it should be 100% clear how this works and in what circumstance.

By Maggoo

Paragon (1212)

Maggoo's picture

08-03-2012, 16:35

Agreed, this still requires investigation but the WIKI can also provide a compatibility Matrix with the different types of VDP.

By Wolverine_nl

Paragon (1149)

Wolverine_nl's picture

08-03-2012, 16:47

I agree on that 100% facts on vdp , registers and such could be in the wiki. 
But what are the boundries for the wiki?

By Maggoo

Paragon (1212)

Maggoo's picture

08-03-2012, 17:21

Not sure, it can be started and see what information comes in and then clean it up as needed.

But it would be nice to have a page for undocumented features of the TMS, V9938 (I'm thinking Overscan mode, Screen 4 with one tile set etc...), V9958 and perhaps even V9990 ?

Page 1/2
| 2