Print color char

Page 1/2
| 2

By fr3nd

Expert (112)

fr3nd's picture

17-01-2018, 14:43

Hi,

I'm currently trying to develop my first MSX application using SDCC and I'd like to print text using different colors and backgrounds. Something like what Multimente does.

Thanks to Javi Lanvandeira's article I've learned how to use the terminal escape codes on the MSX, but does it support ANSI colors without installing any special driver? Is it possible to print characters with different colors and backgrounds in text mode? How?

Login or register to post comments

By Grauw

Ascended (10699)

Grauw's picture

17-01-2018, 17:36

ANSI colours are not supported, because MSX only has monochrome text modes. Well, not entirely true, since TEXT2 does support an alternate colour, but that’s not enough to provide proper ANSI colour support.

The only way to get ANSI colours is to draw characters in screen 7. For MemMan there’s the JANSI driver which did this iirc.

By Manuel

Ascended (19273)

Manuel's picture

17-01-2018, 17:43

You recall correctly.

By Grauw

Ascended (10699)

Grauw's picture

22-01-2018, 21:10

I just noticed that the Kanji modes also support multiple colours on screen at the same time, just change the foreground colour with the COLOR command and all characters that follow will show in that colour. I don’t expect it understands ANSI colour codes though.

By fr3nd

Expert (112)

fr3nd's picture

27-01-2018, 13:04

Well, I've already started doing my first testing in screen7. I've been able to print chars in different colors but it's really slow... It takes few seconds to print the whole screen...

I'm using the NWRVRM bios call to write to the vram and I think this might not be the fastest way... When I see programs like multimente, it looks very fast instead. How does it do it? Can anyone point me to the right direction on how to emulate a text mode in screen 7?

By sd_snatcher

Prophet (3642)

sd_snatcher's picture

27-01-2018, 14:34

I think you best choice is to upload the fonts to a backbuffer in VRAM and use the blitter to copy the chars.

Remember to disable the sprites and set the screen to 192 lines so the blitter can run faster.

By Grauw

Ascended (10699)

Grauw's picture

27-01-2018, 15:23

Also scroll with r#23. Long, long ago I made a colour ANSI RS232 terminal program in screen 7 and it was pretty fast.

By Roland007

Expert (85)

Roland007's picture

04-03-2018, 20:29

Hi All,

This question continues to pop-up. I know there is some code on the forum to print colored characters in screen 5 (or 7) from Pascal with some help of in-line assembly. I've been playing with MSX-C 1.2 and wonder: is there an equivalent for an open "grp:" for output? In basic you can set the color for each character you type in screen 2

Thanks!

By N.I

Master (175)

N.I's picture

05-03-2018, 05:23

Roland007 wrote:

Hi All,

This question continues to pop-up. I know there is some code on the forum to print colored characters in screen 5 (or 7) from Pascal with some help of in-line assembly. I've been playing with MSX-C 1.2 and wonder: is there an equivalent for an open "grp:" for output? In basic you can set the color for each character you type in screen 2

Thanks!

This topic may be of help to you.
https://www.msx.org/forum/msx-talk/development/positioning-grahphical-cursor-in-screen-2

By zett

Hero (608)

zett's picture

05-03-2018, 14:27

there is a easy way to use collored caracters use call kanji ( if you got a jp msx or a ide cardrige or a kanji rom)
and on a msx2 is it easy when doing call kanji 3
nice 80 coloms full collor text screen
Big smile

By fr3nd

Expert (112)

fr3nd's picture

05-03-2018, 20:34

I wrote a simple test to write coloured text in screen 7:
https://github.com/fr3nd/msx-sdcc-tests/blob/master/color-te...

At the end I stopped developing this code because it was too slow for what I wanted to do, but it works.

What this code does:
* First copy the chartable to memory in text mode.
* Switch to screen 7.
* Write all the characters into a non visible area of the screen.
* Using LMMM, copy each character to the visible part of the screen when needed.

It can be tried online here: http://webmsx.org/?PRESETS=DOS2&DISKA_FILES_URL=https://gith...

It still has some bugs and it needs improvement, but it can be used as a start template.

Page 1/2
| 2