CLS and SCREEN are bugged!

By gdx

Enlighted (6445)

gdx さんの画像

10-02-2021, 09:46

I'm surprised this program returns 4 instead of F4. Shocked!

10 COLOR15,4:SCREEN2
20 A%=VPEEK(&H2000)
30 COLOR15,4:CLS
40 B%=VPEEK(&H2000)
41 '
50 COLOR15,4:SCREEN4
60 C%=VPEEK(&H2000)
70 COLOR15,4:CLS
80 D%=VPEEK(&H2000)
90 SCREEN0
100 PRINT HEX$(A%);" "; HEX$(B%)
110 PRINT HEX$(C%);" "; HEX$(D%)
ログイン/登録して投稿

By Metalion

Paragon (1629)

Metalion さんの画像

10-02-2021, 09:52

I think 04h is the normal value, not F4h.
When you clear the screen, the only sure thing is the background color.
The MSX does not "preset" the foreground color.

By gdx

Enlighted (6445)

gdx さんの画像

10-02-2021, 10:10

In SCREEN 2/4, MSB 4 bits of the pattern colors are for the plotting color and LSB 4 bits are for the background. So MSB 4 bits should take the default plotting color and not the border color, but maybe zero was chosen to simplify the plotting in BASIC. (?)

By Wolverine_nl

Paragon (1160)

Wolverine_nl さんの画像

10-02-2021, 10:13

just to check, isn't it also needed to print string with a for next loop to look for the next character to print, so 4 might be the last/first ? Also what happens if you read out the system variables #F3E9, #F3EA? Didnt do basic in a long while, so just might be a stupid question which you can ignore ;-)

By Metalion

Paragon (1629)

Metalion さんの画像

10-02-2021, 10:24

gdx wrote:

So MSB 4 bits should take the default plotting color and not the border color, but maybe zero was chosen to simplify the plotting in BASIC. (?)

As I said, there's no practical reason to "preset" the plotting color, since we are in a multicolor mode.
The user will specify the color he wants to plot anyway, so why "preset" a specific one ?
I think it's a simplification chosen by the BIOS/BASIC programmers.

By gdx

Enlighted (6445)

gdx さんの画像

10-02-2021, 10:46

Because if we set a bit to 1 without specify the color (by using VPOKE for example), this point should take the default color. Even if that was no longer the case alone after an image load for example. CLS and SCREEN are supposed to initialize the screen as specified, there they are not doing their job correctly.

By Wolverine_nl

Paragon (1160)

Wolverine_nl さんの画像

10-02-2021, 10:59

So what happens of you set the colours after the screen init instead of first colours and then init screen mode? CHGCLR and CHGMOD affects all registers,maybe the issue is there to be found?

By gdx

Enlighted (6445)

gdx さんの画像

10-02-2021, 11:25

It's a minor bug that doesn't change much thing in most cases because the BASIC interpreter is based on system variables, but it's still a bug.

By Wolverine_nl

Paragon (1160)

Wolverine_nl さんの画像

10-02-2021, 11:29

I did have a situation that when I switched screens, not even using the basic int. , that my borders weren't black anymore after changing VRAM page and using CLR, eventhough I put this in the right sys variable and commited using CHGCLR, that could be the same issue?