BASE()
This page was last modified 14:51, 20 December 2016 by Mars2000you. Based on work by Gdx.

Contents

Effect

This instruction can be used in

- reading mode for all supported screen modes : it returns then the first VRAM address for a specific purpose

In SCREEN 5 to 8 and 10 to 12, you'll get the offset value from the starting address of the active page.

- writing mode only for table numbers from 0 to 19, corresponding to SCREEN 0 to 3 : it allows then to change the first VRAM address for a specific purpose

Note that a change in table numbers from 10 to 14 for SCREEN 2 will also change the corresponding VRAM address for SCREEN 4.

Syntax

BASE(<tablenumber>)

<tablenumber> is a number corresponding to table addresses in VRAM. (see below)

BASE
SCREEN Type Name Table Color Table Pattern Table Sprite Attribute Table Sprite Pattern Table
MSX 0 Text 0 - 2 - -
1 Text (*) 5 6 7 8 9
2 Graphic 10 11 12 13 14
3 Graphic 15 - 17 18 19
MSX2 4 Graphic 20 21 22 23 24
5 Graphic 25 - - 28 29
6 Graphic 30 - - 33 34
7 Graphic 35 - - 38 39
8 Graphic 40 - - 43 44
9 Text (**) - - - - -
MSX2+ 10 Graphic 50 - - 53 54
11 Graphic 55 - - 58 59
12 Graphic 60 - - 63 64


(*) SCREEN 1 is a text screen, but the charset can be filled with game graphics and sprites can also be used
(**) SCREEN 9 is a text screen, initially conceived for Korean characters, and using graphic mode SCREEN 5 or SCREEN 6

The Sprite Color Table, available only on MSX2 and higher and used for the sprites type 2 on screens 4 to 8 and 10 to 12 is located "strictly above" the sprite attribute table, having base address of sprite attribute table minus 512 (200 in hexadecimal).

Examples

PRINT BASE(2)
2048
10 COLOR 15,4,7: KEYOFF
20 BASE(5)=BASE(6)
30 SCREEN 1
40 FOR I = 0 TO 38
50 PRINT"A TEST OF THE BASE COMMAND"
60 FOR J = 0 TO 100
70 NEXT J
80 NEXT I
90 LIST
100 END

Returned values

Name Table

SCREEN Decimal Hexadecimal
0 0 0000
1-2 6144 1800
3 2048 0800
4 6144 1800
5-8 0 0000
10-12 0 0000


Color Table

SCREEN Decimal Hexadecimal
1-2 8192 2000
4 8192 2000


Pattern Table

SCREEN Decimal Hexadecimal
0 2048 0800
1-4 0 0000


Sprite Attribute Table

SCREEN Decimal Hexadecimal
1-3 6912 1B00
4 7680 1E00
5-6 30208 7600
7-8 64000 FA00
10-12 64000 FA00


Sprite Pattern Table

SCREEN Decimal Hexadecimal
1-4 14336 3800
5-6 30720 7800
7-8 61440 F000
10-12 61440 F000


Sprite Color Table

SCREEN Decimal Hexadecimal
4 7168 1C00
5-6 29696 7400
7-8 63488 F800
10-12 63488 F800


References

Related to

SCREEN, VDP()

Compatibility

MSX-BASIC 1.0 or higher