MSX1: printing changed characters on Screen2?

Page 1/3
| 2 | 3

By RSS

Rookie (17)

RSS's picture

23-04-2014, 14:06

Hello All,

I have a question about printing characters onto SCREEN2 (on an MSX1 machine).
For printing characters one normally uses
> OPEN “GRP:” FOR OUTPUT AS #1
> PRINT#1,”Test”
But with this I can only print the standard characters. What I want to do is print characters that I defined myself (like when you modify characters in SCREEN0 or SCREEN1) using VPOKEs?
> BASE(2)+I or VPOKE BASE(7)+I
However, sitching to SCREEN2 seems to undo all character modifications.
How can I solve this?

Greetings,
Ron.

Login or register to post comments

By TheSpecialist

Expert (113)

TheSpecialist's picture

23-04-2014, 14:21

pro tip: don't switch screen modes after modifying the characters. differently put, modify the characters after selecting the desired screen mode.

By Manuel

Ascended (16966)

Manuel's picture

23-04-2014, 14:27

D'ah, why didn't I think of that Sad

By RSS

Rookie (17)

RSS's picture

23-04-2014, 18:10

Hello Specialist,
Tried it, doesn't work. From what I'm seeing the pattern-tables that one usually uses for altering characters (BASE2 for SCREEN0 and BASE7 for SCREEN1) overlap with the pattern-table of SCREEN2. It's all the same 16kB of memory after all.

Still, when using the OPEN"GRP:" in SCREEN2 the characters are coming from somewhere; I'm wondering WHERE FROM, and is that a place where I can change them...?

Greetings, Ron.

By TheSpecialist

Expert (113)

TheSpecialist's picture

23-04-2014, 18:40

O rite, this is because screen2 is a bitmap mode in MSX-BASIC.
OPEN"GRP:" reads the characters from memory, at an address specified in RAM variables F91F-F921.

An example:

AD = &HC000 ' the address where you store the pattern table in RAM.
POKE &HF91F, PEEK(&HF341 + AD \ &H4000):POKE &HF920,AD AND 255:POKE &HF921,AD \ 256

Untested, but should work. This example needs a DiskROM present (so doesn't work on MSX with only cassette).

By hit9918

Prophet (2897)

hit9918's picture

23-04-2014, 19:12

Can you need a tile mode? Then you can pretend to BASIC a screen 1 with a poke.
And then fast PRINT the graphics.
With a charset that you painted on your own.
Just make sure the 3 screen areas of screen 2 got identic pixels.

Look:

10 screen 1: width 32: key off : color ,1,1
20 screen 2 : draw"bm0,0"

21 open "grp:" as #1
22 for n = 1 to 3
23 for i = 0 to 255
24 color 8 : if i >= 64 then color 2
25 ?#1,chr$(i); : next i : next n

130 for i = 1 to 30
140 x1 = rnd(1)*31 : y1 = rnd(1)*31+4*8
150 x2 = rnd(1)*31 : y2 = rnd(1)*31+4*8
160 c = rnd(1)*13+2
170 line(x1,y1)-(x2,y2),c
180 line(x1,y1+64)-(x2,y2+64),c
190 line(x1,y1+128)-(x2,y2+128),c
200 next

210 poke &hFCAF,1

300 w = 4 : h = 4

310 for y = 0 to h-1
320 for x = 0 to w-1
330 a$=a$+chr$(x+y*32+4*32)
340 next x
350 for x = 0 to w-1
360 a$=a$+chr$(29) 'cursor go left
370 next x 
380 if NOT (y = h - 1) then a$=a$+chr$(10) 'cursor go down
390 next y

410 locate rnd(1)*(32-w),rnd(1)*(24-h)
420 ?a$
430 goto 410

By kuro

Resident (36)

kuro's picture

24-04-2014, 12:38

sample Basic source & description
you download grfntspl.lzh

http://beach.biwako.ne.jp/~beaver/msx/msxtecho/grfntspl.htm

By RSS

Rookie (17)

RSS's picture

24-04-2014, 12:47

Hello Specialist
Thanks for the feedback, let's see if I understand correctly: In that way I would be using 2kb of RAM to define my own characters, and use PEEK and VPOKE to get them onto SCREEN2?

My theory is that somewhere in the ROM to RAM copy (at power-up) the characters are put into RAM, and those are the characters used in the SCREEN2 - OPEN"GRP:" method. I'm hoping to directly changes those primary RAM characters.

What I want to do this evening is do a complete RAM-dump (PEEK the RAM and VPOKE it to SCREEN2) to see if I can find the character set in there...

@ hit9918: I'l be trying your code too, but not sure if I understand what you're doing until I do...

Thanks again for your input!
Greetings, Ron.

By RSS

Rookie (17)

RSS's picture

24-04-2014, 13:02

Hello Again,

Just tried to dump RAM to SCREEN2, and lo and behold the character-set appeared somewhere between Address 6000 and 9000. I'll see if I can change them, and what happens if I then PRINT#1 them to SCREEN2.

I'll keep you updated!
Ron.

By NYYRIKKI

Enlighted (5595)

NYYRIKKI's picture

24-04-2014, 13:38

RSS wrote:

Hello Specialist
Thanks for the feedback, let's see if I understand correctly: In that way I would be using 2kb of RAM to define my own characters, and use PEEK and VPOKE to get them onto SCREEN2?

You don't need to VPOKE anything. This explains, how you can change default font. This means that you can use PRINT #1 like you originally planned. (Using SCREEN 2 as text mode is much, much faster, but then you need to think how to make graphics and text live together)

ROM font address is always stored in address #0004
Current font address is stored in address #F920
Current font SlotID is stored in address #F91F

You may want to check out this video.

By Metalion

Paragon (1203)

Metalion's picture

24-04-2014, 14:02

If I remember correctly, it is impossible.
The BASIC uses the font in ROM when using PRINT #1 in SCREEN2.

Page 1/3
| 2 | 3