Question screen 1 + 2 name table

Page 1/2
| 2

By MsXgAmEs

Rookie (17)

MsXgAmEs's picture

11-08-2004, 14:28

In screen 1 and 2 there is a difference that I don't understand. In screen 1 I put a character on the screen like this:

20 VPOKE BASE(5)+&H0,97
30 IF INKEY$="" THEN 30

This puts the letter "a" at the top-left side of the screen. When I change to screen 2 in line 10 and replace BASE(5) with BASE(10) in line 20, I get a blank screen. Where my letter "a" in this case?

I succeeded in making a letter in screen 2 by using BASE(12) for making a character pattern and BASE(11) for the colors. The location of the character in the character pattern base (BASE(12)) determines the location of the character on the screen. Why is that?

Login or register to post comments

By [D-Tail]

Ascended (8246)

[D-Tail]'s picture

11-08-2004, 15:06

The Pattern name table isn't defined by default in screen 2. Well, it's defined, but it doesn't contain a default character set. So you should first draw your own, and put it on the location designated by BASE(10). But if you just want to put a text line on screen 2, I suggest you use the following:

OPEN "GRP:" FOR OUTPUT AS #1: PRINT #1,"Screen 2 try thing ^^;";

I also suggest you get some information about the VDP registers, cos the BASE() function is a HELL in BASIC. For example, the V9938 Technical Data Manual (Yamaha corp/ASCII corp) would be a nice start.

By anonymous

incognito ergo sum (116)

anonymous's picture

11-08-2004, 15:33

Basically: In MSX-BASIC, SCREEN 2 is configured as a bitmap screen, not a pattern screen like SCREEN 1.

By MsXgAmEs

Rookie (17)

MsXgAmEs's picture

11-08-2004, 15:59

Thanks for the answers. Programming in MSX basic has been a long time ago.

I took this information from portar.txt:
SCREEN 1 (coloured text mode, 32 column):
Character patterns (font) 0000-07FF
Name table (char positions) 1800-1AFF
Sprite attribute table 1B00-1B7F
Characters colour table (8/byte) 2000-201F
Sprite character patterns 3800-3FFF

SCREEN 2 (256*192 Graphics mode):
Character patterns 0000-17FF
Name table (char positions) 1800-1AFF
Sprite attribute table 1B00-1B7F
PixelByte colour table 2000-37FF
Sprite character patterns 3800-3FFF

So my understanding was that screen 1 and 2 would behave the same except for the colors. I know that screen 2 is a bitmap screen, but because I saw the nice name table (character positions) at address 1800 for screen 2 I thought that it was possible (LIKE PRINT#1,"a") to VPOKE characters on screen 2 like screen 1.

Question: Can anyone explain why a character is printed on screen 2, when making a character at address 0000? This is a character pattern and not a Name table. In screen 1 you first make a character in the character pattern and with the Name table you put the character on the screen.

By BiFi

Enlighted (4348)

BiFi's picture

11-08-2004, 17:02

Since SCREEN 2 was set up by BASIC to be a bitmap screen, the name table is filled with 3 times the full character set.

By anonymous

incognito ergo sum (116)

anonymous's picture

11-08-2004, 17:47

thanks for repeating what I said Bifi Wink and here goes for the 3rd time.

MsXgAmEs, you should understand that there is a difference between the specifications of the screenmode for the VDP and the way BASIC handles them.

MSX-BASIC configures SCREEN2 to be a bitmap screenmode. That means a couple of things:
1. there's no character set
2. the nametable is already filled with values 0-255 (repeated 3 times), in stead of it being all 0's. In other words, all characters available are on the screen at the same time.

So if you write to the pattern table in pattern 0, it's the top-left pattern of the screen. If you write to pattern 1 it's the pattern next to the first, etc...

Having said that, it's possible to configure screen 2 to be similar to screen 1 (and in fact that's the most useful for games, because bitmapped screenmodes are often slower for games), but you will have to fill the pattern table with a characterset (3 times) and fill the name table with 0's (to clear the screen).

By Whizzy

Master (208)

Whizzy's picture

02-07-2010, 23:08

So... kicking a 6 years old thread... Tongue

I have recently started programming assembly again on the MSX LOL! But im a bit confused with the screen1 /2 mixture in assembly where you have the pattern mode with the multi color vpokes..

Somebody have a piece of assembly for me that sets the screen in the correct mode Question

Thx !

By Edwin

Paragon (1182)

Edwin's picture

03-07-2010, 00:25

You should probably realise that there is no mixed sc1/sc2 mode. This is basically a basic trick whereby basic thinks it's in sc1 mode while the vdp is really in sc2 mode. This allows basic to print characters like it would in sc1 mode, but using the sc2 tiles.

When doing assembly, just set sc2 mode and understand that the screen layout consists of three banks of 256 tiles for lines 0-7, lines 8-15 and lines 16-23. Each tile can have the it's patterns and colours set. And you select the tiles in the name table.

For reference, when basic sets sc2, it sets the name table to three times 0..255 and just modifies the patterns and colours. So it mimics a sort of bitmap mode in what is actually a tile mode.

By SLotman

Paragon (1236)

SLotman's picture

03-07-2010, 04:54

Actually there is such thing in ASM too, you can reduce the tileset from screen2 from 3 to just 1 set of 255 chars, which is basically what BASIC does - but unfortunately, not all 'compatible' VDP chips supports this, so it is going to fail on some MSXs (on ASM, the BASIC version works anywhere AFAIK).

I just tried the other day this trick - and managed to see that even screen 4 works with just 1 set of tiles! It's really nice since you can update the whole screen as a "limited bitmap" just by writting 2048 bytes Smile

By Yukio

Paragon (1540)

Yukio's picture

03-07-2010, 16:40

Somebody have a piece of assembly for me that sets the screen in the correct mode

Thx !

I have some (strange) code. It was used on Pascal and C to set up the screen modes. Later, I can upload to you.
There is a problem, the code is not tested because of problem with my television (does anyone know if there is a problem when running 50hz mode on a 60hz television?).

By Yukio

Paragon (1540)

Yukio's picture

03-07-2010, 18:01

Ok, I copy the patterns from Screen 0 or even from Screen 1 into a RAM buffer. Later, I upload the data for use on Screen 2. I even possess some wrappers for some commands like PRINTATX,VPOKE,POKE ...

It is possible to write text on Screen0,Screen1,Screen2,Screen4.
Maybe in the future,I need to test this with the name table trick.

Page 1/2
| 2