1.5 BG/text/video system function

GETCHR fixed zero point type function
Function
The pattern name data is read from the character screen.
Format
(1)GETCHR([,] <論理BG>(> < Y character < X character position position >))
(2)GETCHR([<論理BG>],<開始VRAMアドレス>)
Example
X of A=GETCHR(4,(X,Y)) logic BG 4 → and the data of Y coordinates are read.
The data of VRAM address &800 of A=GETCHR(4,&H800) logic BG 4 → is read.
Parameter
<論理BG>… Numerical value type of fixed zero point type (The decimal parts are round-downs of all). The range of an effective numerical value depends on the screen mode set by the SCREEN instruction.
Position position ..< X character.. > ..< Y character.. > … Numerical value type of fixed zero point type. The range of an effective numerical value depends on the screen mode set by the SCREEN instruction.
<開始 VRAM アドレス>… Numerical value type of fixed zero point type. The range of an effective numerical value is a value of 0~65535.
Return value
Pa turn <開始VRAMアドレス>name data is returned by position ..< Y character.. > reading ..specified position.. drinking position ..< X character.. >.
Return value
It is a value of the fixed zero point type until peeling off 0~65535.
<開始 VRAM アドレス>When is specified, the data of the starting address is read.
Operation is detailed.
When > < Y character position > is position given, < X character specifies the reading starting position for a starting position by the character coordinates when it assumes on the left of the map of the object screen to be (0,0) in format (1). It is a range (maximum value -1 of the width of the screen in 0~ character) at the character position. It is a range of the position of < X character of > < Y character position >(maximum value -1 of the width of the screen in 0~ character). When the character position exceeds a value or the maximum value negative, it is treated as a surplus of the maximum value.
When format (2) is specified, the <開始VRAMアドレス>data of the starting address is read. Data takes &H1FFFF and AND for the odd number address and is treated as an address of the even number each word data (two bytes) because it is read. <開始VRAMアドレス>When this value is exceeded drinking though it is range (maximum values -1 of the number of characters of 0~ object screens), it is treated as surpluses of the maximum values of the number of characters.
Character logical BG specified by the ACTIVE instruction at the end is handled however about which format when <論理BG>omitted.
Structure of pattern name data
The structure of the pattern name data is one word data of the following bit configurations.
15~12 bit palette number
Bit 11 upper and lower reversing flag(The under is reversed 0= as it is. )
Bit 10 right and left reversing flag(1= right and left is reversed 0= as it is. )
09~00 bit character number

The palette number : for the character screen.
. 0 in case of 256 colors in number of colors of character screens.
. 0 or 1 in case of 512 colors in number of colors of character screens.
The palette of other screens must be referred to when you set the values other than these. The same thing as the value specified by the COLOR instruction is specified for the text screen (16 color mode). The value of pattern number X2 enters the character number for the text screen when the character code is a character screen.

PALETTE fixed zero point type function
Function
Acquisition of palette value
Format
PALETTE([<論理BG>],<パレット番号>)
Example
A= PALETTE( 0, 255 )
Parameter
<論理BG>… Numerical value type of fixed zero point type (The decimal parts are round-downs of all). The range of an effective numerical value depends on the screen mode set by the SCREEN instruction.
<パレット番号>… Numerical value type of fixed zero point type (All the decimal parts are rounded down). The range of an effective numerical value depends on the screen mode set by the SCREEN instruction.
Return value
<パレット番号>The palette value set to the palette that specifies is read and it returns it. The value of the RGB15 bit is returned. The relation between the bit position and the color of the returned value is as follows.
<赤成分>+ <緑成分>* 32+ <青成分>* 1024 (each value of five bits)
Operation is detailed.
<論理BG>The <パレット番号>range is the same as the PALETTE instruction. The palette number reaches the <論理BG>maximum value to which 0~ is permitted. In this function, it is also possible to examine the palette value of the polygon (sprite) specifying <論理BG>10.

POINT fixed zero point type function
Function
The color of coordinates that the bit map screen specified is detected.
Format
POINT(> < Y coordinates of < X coordinates >)
Example
A= POINT( X, Y )
Parameter
< Y coordinates < X coordinates > > … Numerical value type of fixed zero point type (All the decimal parts are rounded down).
Return value
The color at the position in which the bit map screen and the texture had been selected by the ACTIVE instruction were specified < X coordinates > by < Y coordinates > is examined now and it returns it.
Return value
In the fixed decimal point of ..peel.. Cata type, it becomes the following value by the color mode.
Operation is detailed.
At 32768 color mode
It is a value of 0~32768. In addition, -2 returns, except for -1 screen if it is a transparent color. In this case, color 0 shows the black of RGB(0,0,0).
At the palette mode of 256 colors
It is a value of 1~255. In addition, -2 returns, except for -1 screen if it is a transparent color. In this case, color 0 is returned as -1(transparent color). The screen size is decided for the bit map and the size and the texture of the bit map screen set by the SCREEN instruction depending on the size of the texture defined by the SETTEX instruction. The area of the WINDOW instruction doesn't influence the POINT instruction.

READCHR$ character string type function
Function
The pattern generator data is read from the character screen.
Format
READCHR$([<論理BG>],[<パターン番号>],<文字数>)
Example
A$= READCHR$( ,10, 10 )
Parameter
<論理BG>… Numerical value type of fixed zero point type. The range of an effective numerical value depends on the screen mode set by the SCREEN instruction.
<パターン番号>… Numerical value type of fixed zero point type. The range of an effective numerical value is a value of 0~511(Or, 0~1023).
<文字数>… Numerical value type of fixed zero point type. The range of an effective numerical value is a value of one or more.
Return value
The pattern generator data returns by the character string of the binary form.
Operation is detailed.
The pattern generator data is read from the character screen (text screen) and it returns it. The structure of the read pattern generator data becomes a row of the color data of each dot on the left of the pattern of 8X 8 dot in horizontal order. Therefore, it becomes 64 bytes (64 characters), and the size of one pattern generator data becomes 32 bytes (32 characters) for the text screen where 16 colors are treated. Moreover, it is necessary to note it on three axis rotation screen of screen mode 6 because the pattern generator table is shared on two screens of logic BG 8 and 9.
<論理BG>When is omitted, the setting of the ACTIVE instruction becomes effective. <パターン番号>When is omitted, it is applied just behind the pattern number to which it refers by the READCHR$ function or the SETCHR instruction executed before. However, when logical BG is changed, it is necessary to specify it.

READHEX$ character string type function
Function
The character string of the hexadecimal number is converted from the DATA initialization statement into the character string of the reading binary form.
Format
READHEX$(<変換バイト数>)
Example
PTN$= READHEX$( 16 )
Parameter
<変換バイト数>… Number of bytes for data read from DATA initialization statement. Numerical value type of fixed zero point type. The range of an effective numerical value is a value of 0 or more (All the decimal parts are rounded down).
Return value
<変換バイト数>The binary character string of the given number of bytes is returned.
Operation is detailed.
It returns it as a character string reading the <変換バイト数>data of the byte from the DATA initialization statement of the character string of the hexadecimal number. When data is insufficient in one DATA initialization statement, data is taken out of the following DATA initialization statement. Because even the last data is read without fail as for the DATA initialization statement, data is read from the following DATA initialization statement in the following READ instruction. When the read data is insufficient, Out of DATA is generated. It becomes the following either of the form of the DATA initialization statement permitted with READHEX$ (Apply to HEXBIN$).
1. Hexadecimal number character string delimited by comma.
DATA AA, BB, CC, DCD, EE, …FF
2. Consecutive hexadecimal number character string. It is converted as one byte every two characters. The last fraction converts 0 into the high rank in addition.
It is equal to DATA 12345678→DATA "12, 34, 56, and 78".
It is equal to DATA 123, 45, and 6→DATA "01, 23, 45, and 06".
Example
100 Three byte data is read from DATA of A$=READHEX$(3) →140 line and 150 lines.
110 PRINT BINHEX$( A$, "," )
120 One byte data is read from the DATA initialization statement of A$=READHEX$(1) →160 line.
130 PRINT BINHEX$( A$, "," )
140 DATA 1122
150 DATA 3, 4, 5
160 DATA 6, 7, 8
RUN
11, 22, and 4 and 5 of the 03→150 lines are skipped.
7 and 8 of the 06→160 lines are skipped.
Reference
BINHEX$, HEXBIN$

RGB fixed zero point type function
Function
The color specified at the palette value and 32768 color modes data is calculated from each color element and it returns it.
Format
RGB(<赤成分>,<緑成分>,<青成分>)
Example
A= RGB( R, G, B )
Parameter
<赤成分>,<緑成分>,<青成分>… Numerical value type of fixed zero point type. The range of an effective numerical value is a value of 0 or more (Only all of the five subordinate position bits of the numerical value ....effective.. fraction part.. are rounded down).
Return value
The return value type is a fixed zero point type.
Operation is detailed.
The value calculated by the following expression is returned.
(<赤成分> AND 31 )+(<緑成分> AND 31 )X 32+(<青成分> AND 31 )X 1024

RGBADD fixed zero point type function
Function
The increase and decrease value of each color element is calculated in addition and the color specified at the palette value and 32768 color modes data is returned.
Format
RGBADD(<RGB>,<赤増減値>,<緑増減値>,<青増減値>)
Example
A= RGBADD( PLT, 10, -4, 2 )
Parameter
<RGB> … Numerical value type of fixed zero point type(All the decimal parts are rounded down. )
<赤増減値>, <緑増減値>, <青増減値>… Numerical value type of fixed zero point type. Only the integer part of the numerical value is effective.
Return value
The return value type is a type of small number of fixation. The increase and decrease value of the specified each color element of each color element of the value specified by < RGB > is returned, and it calculates in addition, the value after it calculates is returned, and color element < RGB > is returned.
Operation is detailed.
In the calculation of each color element, it adjusts in 0 when falling below 0 and when 31 is exceeded, it is adjusted to 31. Moreover, the part of the value specified by < RGB > in 16 bits or more is not influenced, and reflected in the return value. The <各増減値>value in which it does by 15 bits is returned. The value is calculated as follows.
OTHER= AND ( NOT! &H7FFF )
= INT()
= INT()
= INT(/ 32 )
<B>= INT(<B>/ 1024 )
Reference
RGB, RGBTO

RGBTO fixed zero point type function
Function
The value in which the color specified at the palette value and 32768 color modes data is brought close to the value that aims is calculated and it returns it.
Format
RGBTO(<RGB>,<目標RGB値>)
Example
CUURRENT_COLOR= RGBTO( CURRENT_COLOR, TARGET_COLOR )
Parameter
< RGB > <目標RGB値>… Numerical value type of fixed zero point type (All the decimal parts are rounded down).
Return value
The return value type is a fixed zero point type. It drinks, the <目標RGB値>value of each color element of the value specified by < RGB > brought close to Iro is calculated, and it returns it.
Operation is detailed.
Color of ..showing.. < RGB > is brought close by 15 bits. <目標RGB値>The <目標RGB値>value that approaches by one is returned when differing from the element of each element Douiro of R, G, and < RGB B of >. It becomes data <目標RGB値>Onage other than the object bit. The way of each color the row is the same as the RGB() function.
Reference
RGB(), RGBADD()