Help handling text on SCREEN 2

Page 1/2
| 2

By Code Witcher

Resident (43)

Code Witcher's picture

16-03-2019, 23:34

Hi guys... I'm a bit ashamed to ask, but I can't find the answer anywhere, I checked on books too lol
How do I update text on SCREEN 2? All the references say how to write it... but I need to update player points... Crying
(This is in plain BASIC)

Login or register to post comments

By thegeps

Paragon (1190)

thegeps's picture

16-03-2019, 23:58

Different solutions. If you want to use system default fonts, you simply have to:
open"grp:" foroutputas#1
Print#1,"SCORE";yourscorevariable
You can set position and color of text using "preset" istruction.

If you want to use your redefined characters (multicolor tiles), you have to define them writing shape data in vram (vpoke) from 0 to 6143 and color attributes from 8192 to 14335. Remember that in screen2 you have 3 banks of 256 chars. First bank own chars for the first 8 rows, second bank rows from 9th to 16th and third bank last 8 rows. So you can vpoke from 6144 to 6911 (768 chars, 32 columns x 24 rows)these tiles. If you have same tiles in all banks it simple to vpoke wherever you want. But you can have 3 diferent bank so you'll have to vpoke only their tiles.

By ToriHino

Paladin (858)

ToriHino's picture

17-03-2019, 00:21

For redefined characters on screen 2 also see this thread

By Code Witcher

Resident (43)

Code Witcher's picture

17-03-2019, 03:28

What happens is that text is written on top of the old one and both get mixed, I probably didn't use the PRESET instruction correctly?

By ARTRAG

Enlighted (6935)

ARTRAG's picture

17-03-2019, 11:24

DanielTkach, in basic you need to plot a small filled box of background color on the previous text and print the new string using open"grp:".
The other way is to print the previous text in background color to make it disappear.
No other solutions, screen 2 in basic is a bitmap mode, so the text you print is changing the tile definitions with bit "or"

By MsxKun

Paragon (1124)

MsxKun's picture

17-03-2019, 12:11

Frak!
Just VPOKE the characters into the name table on VRAM, as thegeps said. So simply use the VDP as it really is, a pattern based videochip. This way you won't make the CPU waste resources and you'll gain speed (specially using Basic) and (once used to it) ease of use.

Oh, and one last thing Big smile
Once you're used to SC2 pattern mode in the way the VDP is designed, and you know how it works, how VRAM is mapped and so... You'll be a step closer to jump to Assembler, as the way to use the VDP is basically the same. Hannibal

By PingPong

Enlighted (4140)

PingPong's picture

17-03-2019, 19:54

MsxKun wrote:

Frak!
Just VPOKE the characters into the name table on VRAM, as thegeps said. So simply use the VDP as it really is, a pattern based videochip. This way you won't make the CPU waste resources and you'll gain speed (specially using Basic) and (once used to it) ease of use.

Oh, and one last thing Big smile
Once you're used to SC2 pattern mode in the way the VDP is designed, and you know how it works, how VRAM is mapped and so... You'll be a step closer to jump to Assembler, as the way to use the VDP is basically the same. Hannibal

But using the vdp as a pattern based chip, will loose the ability to use it as a bitmapped gfx since the patterns are arranged to have a 1:1 corrispondence with screen pixels

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

17-03-2019, 20:48

PingPong wrote:

But using the vdp as a pattern based chip, will loose the ability to use it as a bitmapped gfx since the patterns are arranged to have a 1:1 corrispondence with screen pixels

Naah... Draw something like " SCORE: 01234 HI-SCORE: 56789 "
Now you have all the tiles you need for pattern based score editing on screen and all parts of screen except those numbers can still be used for BASIC bitmapped gfx. = Take best from both worlds Smile

By thegeps

Paragon (1190)

thegeps's picture

18-03-2019, 00:16

Yeah, he has to define only few tiles, and only in first bank (usually scoreboard are on top of the screen). So there is a lot of room for bitmap...
Btw Daniel, tell us about your project and we can help you more and better Smile

By NYYRIKKI

Enlighted (6067)

NYYRIKKI's picture

18-03-2019, 01:40

Here is little example of how such "mixed mode" could work in practice:

10 DEFINT A-Z:SCREEN 2
20 FOR I=0 TO 9:D(I)=8+I-(I>4)*12:NEXT
30 OPEN "GRP:" FOR OUTPUT AS #1
40 PSET (0,0),0:PRINT#1," SCORE: 01234  HI-SCORE: 56789"
50 SC=3300:OF=30:GOSUB 130
60 OF=13
70 FOR SC=4 TO 500 STEP 8
80 GOSUB 130
90 CIRCLE (128,96),SC/6,8
100 NEXT
110 A$=INPUT$(1)
120 END
130 T$="000"+STR$(SC)
140 FOR I=1 TO 5:VPOKE BASE(10)+OF-I,D(ASC(RIGHT$(T$,I))AND15):NEXT
150 RETURN

By Code Witcher

Resident (43)

Code Witcher's picture

18-03-2019, 02:03

Thanks for all your help, I'm amazed at how much you know, and I understand 50% of what you said, only because I'm faintly familiar with the technicalities having skimmed throw the dozen books I downloaded. And when I understand it I know how to put into practice 10% of it.

The project to start is, to gradually get to understand what you just wrote and then being able to put it into practice 100%, and then come up with my own original stuff. So what I'm doing is reading, reading and reading and experimenting to the best of my current abilities. I had started reading machine code programming books, which is what I always wanted to learn, then I realized I better start with the basics of BASIC. I read a couple of Basic manuals and I'm looking up "dice games" and implementing those in BASIC, to practice and really let the BASIC and basics sink in.

I had programmed on my Talent MSX DPC-200 about 25 years ago, only in BASIC, and I did a bunch of things over the period of 4 years or so, little games, music transcriptions, "cool apps", only with the BASIC manual that came with it, no internet, no magazines, and I remember reading in its 257 page manual that one could do stuff like "programming the Z80", "writing on the VPD registers" for which it referred you to "their respective manuals"... and I realized that games like Buck Rogers, Road Fighters, Kung Fu Master, Star Force, Thexter, and even the simple demo that came with it, were so much different than what I was achieving with my MSX.

Finding myself out of clue after programming for 4 years, I gave up, to find my MSX again in a move a few weeks ago, now I'm full throttle with it, having downloaded a few hundred magazines and books of all sorts. I've finished to a certain extent a short and simple dice game, which you can find here: https://youtu.be/4jDecYEkFt8
My next projects will be more complex table games, until I find inspiration in something else, and I've gathered enough knowledge of the MSX architecture to do stuff at a lower level.

So that's what it is for now, reading, studying, and practicing implementing stuff. I'm still not sure how to do what you suggest with the VDP, but I got the manuals :D so while I use less elegant solutions like drawing a filled square on top of letters, I will keep studying and learn all I can from your answers and the forum here.

Thank you so much guys, you rock, I look up to you, and it's great to read you. Your guidance and recommendations are highly appreciated. Am I in the right path? What do you recommend for reading and practising?

Page 1/2
| 2