Proper way to print text in SCREEN 12

By Eugeny_Brychkov

Paragon (1127)

Аватар пользователя Eugeny_Brychkov

29-01-2020, 16:23

Simple program:

10 screen 12
20 open"grp:"as#1
30 print #1,"test"
40 goto 40

produces something unreadable. Printing in screens 2 and 8 puts characters on the screen properly.
Without digging into how it works in machine deeps, what is needed to have characters properly displayed (e.g. colors around them, positioning etc.)?

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By Parn

Champion (485)

Аватар пользователя Parn

29-01-2020, 16:56

That happens because in then 9958's graphic mode 9 (used by SCREEN 12 and supporting 19268 YJK colors) you can't set each pixel's color independently. In graphic mode 8 (used by SCREEN 10 and 11) you have only 12499 YJK colors, but you can also set each pixel to any of 16 colors out of the 512-color palette.

The difference between SCREEN 10 and SCREEN 11 is that in SCREEN 10, BASIC simply treats every pixel as it normally would in SCREEN 5, so you can set colors, draw shapes and write text normally, but can't access YJK information in any way. In SCREEN 11, BASIC considers every pixel as raw 8-bit data (like SCREEN 8, for example), but you'll have color bleed due to the way YJK encodes color.

By Eugeny_Brychkov

Paragon (1127)

Аватар пользователя Eugeny_Brychkov

29-01-2020, 17:17

Thanks. Let me ask differently. Is it possible to display decent white text on black background in screen 12?

By Jipe

Paragon (1374)

Аватар пользователя Jipe

29-01-2020, 17:26

YJK mode
try this program on MSX2+

10 color15,0
20 screen12
30 open"grp:"as"#1
50 preset(0,0)
60 fori=0to255
70 color i
80 print#1,"test",i
90 forj=0to100:next
100 next
110 goto 110
and you see the good colors

By Eugeny_Brychkov

Paragon (1127)

Аватар пользователя Eugeny_Brychkov

29-01-2020, 17:41

Excellent, thank you so much. Appears the best colors are the factors of 8, with 248 is the brightest. This is what I actually needed!

Edit: I have one more issue: in screens 8 and 12 BIOS puts characters on the background defined by second argument of COLOR, in screen 2 it just puts foreground color onto existing one. Is there any easy way to force initialization to some other color (e.g. black) - e.g. by setting some bit somewhere (and not first drawing black polygon behind).

By Parn

Champion (485)

Аватар пользователя Parn

29-01-2020, 18:07

You can try writing to another page with a black background and then copying back from that page with TPSET as the operation. I'm not sure if that will or won't mess up the colors underneath, though; I can't personally test this right now.

Edit: Yes, it does mess up the colors underneath, but it may be workable. I used this program to test it:

10 COLOR ,0,0
20 SCREEN 12
30 SET PAGE 1,1:CLS
40 OPEN"grp:"FOROUTPUTAS#1
50 PRESET(0,0)
60 COLOR 248
70 PRINT#1,"This is only a very simple test."
80 SET PAGE 0,0
90 BLOAD"test.scc",S
100 FOR Y=0 TO 211 STEP 10
110 COPY(0,0)-(255,7),1 TO (0,Y),,TPSET
120 NEXT
130 I$=INPUT$(1)
140 COLOR 15

By Eugeny_Brychkov

Paragon (1127)

Аватар пользователя Eugeny_Brychkov

29-01-2020, 18:13

I am talking about screen 2 now, not screen 12 as it seems screens 8/12 behaves the way I need (puts background under the characters). Screen 2 does differently, it just writes above the existing image. As I recall when programming in BASIC we were always putting BF polygon behind before printing the text in screen 2 mode. Is it the only way to achieve white text on local black background?

By Grauw

Ascended (8735)

Аватар пользователя Grauw

29-01-2020, 18:22

Parn wrote:

That happens because in then 9958's graphic mode 9 (used by SCREEN 12 and supporting 19268 YJK colors) you can't set each pixel's color independently. In graphic mode 8 (used by SCREEN 10 and 11) you have only 12499 YJK colors, but you can also set each pixel to any of 16 colors out of the 512-color palette.

Just for the record, there is no mention of graphic modes 8 and 9 in the V9958 application manual. They are called YJK and YJK+YAE mode. So I would use those names or SCREEN 12 and 10/11 to refer to them.

By Parn

Champion (485)

Аватар пользователя Parn

29-01-2020, 18:26

@Eugeny: Oh, sorry for misunderstanding. In BASIC, that's the most straightforward way, yes.

Grauw wrote:

Just for the record, there is no mention of graphic modes 8 and 9 in the V9958 application manual. They are called YJK and YJK+YAE mode. So I would use those names or SCREEN 12 and 10/11 to refer to them.

I'm sorry for the misinformation. I was in a hurry and didn't check the reference I used, which was wrong.

By Eugeny_Brychkov

Paragon (1127)

Аватар пользователя Eugeny_Brychkov

30-01-2020, 18:59

I was hoping to use GRPPRT routine to print text on the image during video playback, but it did not work out. This routine resets VDP registers, and image gets corrupt. I will have to design my own routine to print text in screens 2, 8 and 12 (two latter ones having same routine, but with different color byte value).