Type of Matrix (C.Basic)
Type of Matrix
This content is checked by fx-9860GII (OS 2.04).
This is on-going project, any changes may be made.
Model
fx-9860G Series
Description
i. C.Basic provides deferent type of matrix; a bit integer type, a byte integer (8bit) type, a word integer (16bit) type, a long integer (32bit) type and a double real number (64bit) type.
ii. Those smaller bit type of matrix helps to save allocated memory size. This feature gives faster matrix access, handling bitmap data and direct access to VRAM.
Syntax
1. Mat A.p / Mat A.P defines as a bit type (1 bit)
2. Mat A.v / Mat A.V defines as a bit type for direct access to VRAM (1 bit)
3. Mat A.b / Mat A.B defines as a byte type (8 bit, byte integer)
4. Mat A.w / Mat A.W defines as a word type (16 bit, word integer)
5. Mat A.l / Mat A.L defines as a long type (32 bit, long integer)
6. Mat A.f / Mat A.F defines as a double-precision real number type (64 bit, double real)
* Elements of each matrix is defined as the above type.
- Definition of matrix type is available at matric allocation.
- Definition of matrix type is also available at initialization. User can change the matrix type which is once allocated or initialized in deferent type of matrix (see Example 1).
- Excepting a bit type, all other type of matrix Mat A[m,n] is Mat A[<row>,<column>].
- A bit type matrix is designed to handle bitmap, then the matrix is Mat A[X,Y] = Mat A[<coloum>,<row>] (see Example 2).
- Mat A.v / Mat A.V is a special matrix that directly reflect VRAM bitmap (see Example 2).
Example 1
[[1,2,3,4][5,6,7,8]]→Mat A.b
Locate 1,1,ElmSize(A)
Mat A→Dim Mat A.w
Locate 1,2,ElmSize(A)
This code display as follows;
8
16
The third line it to change matrix type.
ElmSize( ) returns bit size of elements. Defined by Mat A.b, a bit size of the elements is 8 bit. Transferring the matrix type from byte type to word type, the bit size of the elements is 16 bit.
Example 2
ClrGraph
For -1→Y To 1 Step 0.1
PlotOn 0,Y
Next
{127,63}→Dim Mat A.v
0→P
For 1→Y To 63
For 1→X To 127
P+A[X,Y]→P
Next
Next
Locate 1,1,P
This code display as follows;
21
{127,63}→Dim Mat A.v sets bitmap data of VRAM in Mat A. When a graphics command is processed automatically the VRAM bitmap reflected to the Mat A.
This code draws 21 dots at first then define Mat A.v. At this time the Mat A is directly reflected to bitmap data of VRAM. An element of the Mat A is 0 or 1,
After allocating the Mat A, interestingly this matrix has already bitmap data of VRAM. Then calculating summary of all the elements should be a number of drawn dots. The dysplayed result shows the number of total drawn dots is 21.
Example 3
Exampl 2 is a sample to read out VRAM bitmap data. This Example 3 is to reflect VRAM bitmap data to LCD screen.
ClrGraph
Screen.G
{127,63}→Dim Mat A.v
For 53→X To 73
1→A[X,31]
Next
PutDispDD
Before running a graphics drawing command, automatically text screen is selected, then swap to graphics screen by Screen.G. Mat A is allocated after ClirGraph then every element of the matrix is 0. Following code sets 21 pixels to 1. PutDispDD command transfers the VRAM data to LCD screen.
Copyright (C) 2013 - 2016 Krtyski / egadget.blog.fc2.com All Rights Reserved.
- 関連記事
-
-
VRAM Access by 1bit Matrix 2014/08/01
-
Expression of Matrix (C.Basic) 2014/08/01
-
Type of Matrix (C.Basic) 2014/08/01
-
Type of Number (C.Basic) 2014/08/01
-
Initialize & Substitute to Matrix (C.Basic) 2014/08/01
-