Similar commands to ATTR and SCREEN$ (Spectrum BASIC) in MSX BASIC

بواسطة jonesypeter

Expert (74)

صورة jonesypeter

22-06-2017, 22:59


Is there anything similar to ATTR and SCREEN$ that is found in Spectrum BASIC in MSX BASIC?

ATTR tells you what colours are in a certain character position and SCREEN$ tells you what character is at a specified position. Thanks

Login أوregister لوضع تعليقاتك

بواسطة Manuel

Ascended (18776)

صورة Manuel

22-06-2017, 23:54

I guess you just need VPEEK.

بواسطة meits

Scribe (6498)

صورة meits

23-06-2017, 00:34

Finding out the color of a specific coordinate in a graphical screen goes with POINT.

بواسطة N.I

Master (173)

صورة N.I

23-06-2017, 05:55

VPEEK(&H1800+X+Y*32) will return the character code at the specified position.
In MSX, the characters have color attributes and the position doesn't have color attributes. The color attributes of the characters are located at &H2000 of VRAM.

بواسطة nitrofurano

Champion (300)

صورة nitrofurano

23-06-2017, 19:35

@jonesypeter it’s difficult to compare - zx-spectrum (from 16k/48k to +2) has no text display mode (text characters are usually drawn in 8 bytes in a kind of sequence) - and text on msx-basic is mostly written in text mode (and print#1 on screen2 is a totally different thing)

on the screen1, and screen2 poked as 1 (screen2 "cheated" to work as text mode), you have attributes associated to characters, not display area in a specific location - screen1 uses 1 attribute for each 8 characters (like from '@' to 'G'), and screen2 poked as 1 you have 1 attribute for each line of each character

if you want to somehow simulate zx-spectrum display on msx (like you might seen from some classic european zx-spectrum games for msx), using the whole screen2 as bitmap "graphic" area, you might want to create your own assembly/cm routines for that (i actually tried to make some experiences on Boriel’s ZX-Basic Compiler somewhere, i guess)

and see that screen$ is a kind of "guess" (a kind of boolean comparison with the bitmap written in rom?) of what character is written in a specific position (0x4000..0x57FF), it’s not exactly a peek or vpeek alone (i don’t know what zx-spectrum basic does for that exactly) - and attr is a peek from somewhere between 0x5800..0x5AFF