X68 compatible/Convenient/Card functions


[Return]
All functions list is here.


// X68 compatible functions

X-BASIC' was developed for the purpose of execute the X-BASIC itself on the iOS.
To run the program of X-BASIC / 68 on iOS was not my purpose.
Therefore, there are a lot of functions which have same name but have different arguments and operation.

In practice, however, new program created on iOS is little.
Moreover, for porting the 68 edition, it is necessary to understand the differences between each other, it took considerably effort.

X68-compatible functions was made in order to reduce this effort.
It has almost the same arguments and operations to the X-BASIC/68.
I thought I will make the X68-compatible operating mode.
But it is so hard, so I made the different set of functions.
For this reason, it will be required of rewriting of the function's name.
And if you do so, I think porting work becomes much easier.

If you use the X68 compatible functions, you may need knowledge of X-BASIC/68.

Note that if you want to use X68 compatible functions, you must set "X68 compatible functions" to on in settings.
Name tColorX68
Format tColorX68(n;int)
Function Set text color and attribute.
Argument If you want to change display color, you use tColorPaletX68().
nColor and attribute are set value from 0 to 15.
It consists of the following components, and you can specify them OR.
bit0,1Color ; 0=black,1=cyan,2=yellow,3=white
bit2Bold
bit3Reverse
Example:5=Bold cyan , 15=Revesed bold white
Return value None
X-BASIC/68's name color
SampleafuncX68Test.bas

Name tColorPaletX68
Format tColorPaletX68([c0;int][,c1;int][,c2;int][,c3;int])
Function Set real drawing color for tColorX68().
Argument
c0Color's composite RGB value to be displayed in tColorX68(0)
c1Color's composite RGB value to be displayed in tColorX68(1)
c2Color's composite RGB value to be displayed in tColorX68(2)
c3Color's composite RGB value to be displayed in tColorX68(3)
If you omit each argument, the color is left previous value.
Return value None
NoteThis is initialized at every time of run.
X-BASIC/68's name color[]
SampleafuncX68Test.bas

Name vpageX68
Format vpageX68(page;int[,fsprite;int])
Function Specify the graphics display page and sprites.
Argument
pageDisplay graphic page
You can specify more than one page at a time corresponding bit. Non specified pages will be hidden.
bit0 Graphic screen0
bit1 Graphic screen1
bit2 Graphic screen2
bit3 Graphic screen3
fspriteWhether or not to display the sprite
YES display
NO not display(default)
Return value None
NoteText screen is always displayed
X-BASIC/68's name vpage
Samplep68-246g.bas

Name apageX68
Format apageX68(page;int)
Function Set graphics accesable page.
Argument
pagegraphic page0 to 3
Return value None
X-BASIC/68's name apage
Samplep68-246g.bas

Name homeX68
Format homeX68(page;int,hx;int,hy;int)
Function Set graphics display start position
Argument
pagegraphic page0 to 3
hx,hydisplay start positiongraphic coordinate
Return value None
X-BASIC/68's name This is same as home(), but the essence is different.
On the X68, the actual screen size may not same to display screen size.
So home() set display start position where from the coordinate of the actual screen.
On the iOS, always the actual screen size is equal to the display size, so this set display start position.
In addition, when the actual screen size = display screen size in X68 it will be spherical scroll,
but it will not be on the iOS.
Samplep68-246g.bas

Name gColor16X68
Format gColor16X68(pal;int)
Function Set graphics drawing color by the 16-colors pallet code.
This set the drawing color for graphic functions without X68 compatible functions.
Argument
palpallet code0 to 15
If you change real drawing color, you may use setgPalet16X68().
Return value None
X-BASIC/68's name None
SampleafuncX68Test.bas

Name gColorX68
Format gColorX68(pal;int)
Function Set graphics drawing color by the X68-color code.
This set the drawing color for graphic functions without X68 compatible functions.
Argument
colX68-color code0 to 65535
Return value None
X-BASIC/68's name None
SamplergbX68X68.bas,hsvX68X68.bas

Name setgPalet16X68
Format setgPalet16X68(pal;int,col;int)
Function Set real drawing color to 16-colors pallet code in the X68 compatible functions.
Argument
palpallet code0 to 15
colComposite RGB value of real drawing color.
Return value None
NoteThis is initialized at every time of run.
X-BASIC/68's name palet
Samplec13down.bas

Name getgPalet16X68
Format int getgPalet16X68(pal;int)
Function Read real drawing color corresponding to 16-colors pallet code.
Argument
palpallet code0 to 15
Return value Composite RGB value of real drawing color
NoteDefault pallet's real drawing color is as same as actual X68000's color.
X-BASIC/68's name None
SampleafuncX68Test.bas,cPyramid.bas

Name pset16X68
Format pset16X68(x;int,y;int,pal;int)
Function Draw dot with 16 colors pallet code.
Argument
x,ycoordinate
pal16 colors pallet code
Return value None
X-BASIC/68's name pset
However, Coordinate does not correspond to the clipping.
SampleafuncX68Test.bas

Name line16X68
Format line16X68(sx;int,sy;int,ex;int,ey;int,pal;int[,style])
Function Draw line with 16-colors pallet code.
Argument
sx,systart coordinate
ex,eyend coordinate
pal16 colors pallet code
styleSet line style
A place of bit=1 is drawn (16bit).
Default is &hffff.

Note:
On iOS, it must always start from the rendering.
If 0 is continuous from the most significant bit(If you start from the non-rendering),
the bits are moved to the least significant bit.
Example : &h5555 (01010101 01010101) is translated to &haaaa (10101010 10101010).
Return value None
X-BASIC/68's name line
However, the line style has a restriction written in above.
The coordinate does not correspond to the clipping.
SampleafuncX68Test.bas

Name box16X68
Format box16X68(sx;int,sy;int,ex;int,ey;int,pal;int[,style;int])
Function Draw box with 16-colors pallet code.
Argument
sx,systart coordinate
ex,eyend coordinate
pal16 colors pallet code
styleline style.
For detail see line16X68() style.
Default is &hffff.
Return value None
X-BASIC/68's name box
However, the line style has a restriction written in above.
The coordinate does not correspond to the clipping.
SampleafuncX68Test.bas

Name fill16X68
Format fill16X68(sx;int,sy;int,ex;int,ey;int,pal;int)
Function Draw and fill box with 16-colors pallet code.
Argument
sx,systart coordinate
ex,eyend coordinate
pal16 colors pallet code
Return value None
X-BASIC/68's name fill
However, Coordinate does not correspond to the clipping.
Samplep68-246g.bas,afuncX68Test.bas

Name circle16X68
Format circle16X68(cx;int,cy;int,r;int,pal;int[,st;int][,ed;int][,hv;int])
Function Draw circle or arc with 16-colors pallet code.
Argument
cx,cycenter coordinate
r radius
pal16 colors pallet code
stThe angle to starting point of the arc(degree).
This is set to counterclockwise from horizontal as 0.
default is 0.
If you set negative angle, it will draw fan-shaped.
If you set Aspect ratio, st is set to 0 always.
edThe angle to end point of the arc(degree).
Default is 360.
If you set negative angle, it will draw fan-shaped.
If you set Aspect ratio, ed is set to 360 always.
hvAspect ratio:0〜65535
>256the virtical long ellipse
<256the horizontal long ellipse
=256 or 0Both the virtical and horizontal =r;True circle
Default is 256(True circle).
Return value None
X-BASIC/68's name circle
However, the coordinate does not correspond to the clipping.
And the virtical aspect result is not same as X68( to 4096 is as same as X68).
Samplep68-246g.bas,afuncX68Test.bas

Name symbol16X68
Format symbol16X68(sx;int,sy;int,mes;str,bai;float,pal;int,font;str[,fontsz;int])
Function Draw string with 16-colors pallet code.
Argument
sx,systart coordinate
messtring
baiDrawing magnification
Unlike X68, and it acts on both for vertical and horizontal.
pal16 colors pallet code
fontFont name
fontszFont size
Default is 16.
Return value None
Note If it can not find the specified font, it uses the default font.
X-BASIC/68's name symbol
However, the magnification, fontname and font size is not same as X68.
The coordinate does not correspond to the clipping.
Samplep68-246g.bas,afuncX68Test.bas

Name psetX68
Format psetX68(x;int,y;int,col;int)
Function Draw dot with X68-color.
Argument
x,ycoordinate
colX68-color code
Return value None
X-BASIC/68's name pset
However, Coordinate does not correspond to the clipping.
Samplep68-246g.bas

Name lineX68
Format lineX68(sx;int,sy;int,ex;int,ey;int,col;int[,style])
Function Draw line with X68-color.
Argument
sx,systart coordinate
ex,eyend coordinate
colX68-color code
styleline style.
For detail see line16X68() style.
Default is &hffff.
Return value None
X-BASIC/68's name line
However, the line style has a restriction written in above.
The coordinate does not correspond to the clipping.
Samplep68-246g.bas

Name boxX68
Format boxX68(sx;int,sy;int,ex;int,ey;int,col;int[,style;int])
Function Draw box with X68-color.
Argument
sx,systart coordinate
ex,eyend coordinate
colX68-color code
styleline style.
For detail see line16X68() style.
Default is &hffff.
Return value None
X-BASIC/68's name box
However, the line style has a restriction written in above.
The coordinate does not correspond to the clipping.
Samplep68-246g.bas

Name fillX68
Format fillX68(sx;int,sy;int,ex;int,ey;int,col;int)
Function Draw and fill box with X68-color.
Argument
sx,systart coordinate
ex,eyend coordinate
colX68-color code
Return value None
X-BASIC/68's name fill
However, Coordinate does not correspond to the clipping.
SampleafuncX68Test.bas

Name circleX68
Format circleX68(cx;int,cy;int,r;int,col;int[,st;int][,ed;int][,hv;int])
Function Draw circle or arc with X68-color.
Argument
cx,cycenter coordinate
r radius
colX68-color code
stThe angle to starting point of the arc(degree).
This is set to counterclockwise from horizontal as 0.
default is 0.
If you set negative angle, it will draw fan-shaped.
If you set Aspect ratio, st is set to 0 always.
edThe angle to end point of the arc(degree).
Default is 360.
If you set negative angle, it will draw fan-shaped.
If you set Aspect ratio, ed is set to 360 always.
hvAspect ratio. For details, see here please..
Return value None
X-BASIC/68's name circle
However, the coordinate does not correspond to the clipping.
And the virtical aspect result is not same as X68.
Samplep68-246g.bas

Name symbolX68
Format symbolX68(sx;int,sy;int,mes;str,bai;float,col;int,font;str[,fontsz;int])
Function Draw string with X68-color.
Argument
sx,systart coordinate
messtring
baiDrawing magnification
Unlike X68, and it acts on both for vertical and horizontal.
colX68-color code
fontFont name
fontszFont size
Default is 16.
Return value None
Note If it can not find the specified font, it uses the default font.
X-BASIC/68's name symbol
However, the magnification, fontname and font size is not same as X68.
The coordinate does not correspond to the clipping.
SampleafuncX68Test.bas

Name rgbX68
Format int rgbX68(r;int,g;int,b;int)
Function Calc composite RGB value from X68's each RGB value.
Argument X68's R/G/B component
rRed component0 to 31
gGreen component0 to 31
bBlue component0 to 31
Return value composite RGB value
The least significant 8 bits of the return value is Alpha value &hff.
Therefore, the expression rgb(r,g,b)+1 which come out well in the processing of X68 must be changed rgbX68(r,g,b).
Since the iOS does not have brightness bits , so + 1 is no longer required.
X-BASIC/68's name rgb
Samplep68-246g.bas

Name hsvX68
Format int hsvX68(h;int,s;int,v;int)
Function Calc composite RGB value from X68's hsv value.
Argument X68's HSV component
hHue component0 to 191
sSaturation component0 to 31
vBrightness component0 to 31
Return value composite RGB value
The least significant 8 bits of the return value is Alpha value &hff.
Therefore, the expression hsv(h,s,v)+1 which come out well in the processing of X68 must be changed hsvX68(h,s,v).
Since the iOS does not have brightness bits , so + 1 is no longer required.
X-BASIC/68's name hsv

Name rgbX68X68
Format int rgbX68X68(r;int,g;int,b;int)
Function Calc X68's 65536 color code from X68's each RGB value.
Argument X68's R/G/B component
rRed component0 to 31
gGreen component0 to 31
bBlue component0 to 31
Return value X68's 65536 color code
X-BASIC/68's name rgb
SamplergbX68X68.bas

Name hsvX68X68
Format int hsvX68X68(h;int,s;int,v;int)
Function Calc X68's 65536 color code from X68's hsv value.
Argument X68's HSV component
hHue component0 to 191
sSaturation component0 to 31
vBrightness component0 to 31
Return value X68's 65536 color code
X-BASIC/68's name hsv
SamplehsvX68X68.bas,p68-246g.bas

Name randX68
Format int randX68([type;int])
Function Get integer random number from 0 to 32767.
Argument
type Generation method of the random number.
NO or Default Same as less than V3.00.
YES Use the sequence with more long period
Return valuerandom interger number
X-BASIC/68's name rand

Name contrastX68
Format contrastX68(ns;int,ne;int,spd;float[,mode;int])
Function Set screen contrast
Argument
ns Initial value of contrast0 to 15
ne Final value of contrast0 to 15
spd Rate of changeSame as wait()'s argument
mode Screen of acting It specified with OR by the following constants.
CONTRAST_GRAPHIC Graphic screen
CONTRAST_TEXT Text screen
CONTRAST_SPRITE Sprite screen
Default is all screen.
Return value None
X-BASIC/68's name This is similar to contrast().
X68's contrast () vary in an analog manner from the current brightness until the specified value.
But since iOS have not saved the current brightness, you need to give both the start and end values.
SampleafuncX68Test.bas

Name bg_fillX68
Format int bg_fillX68(pg;int,pd;int)
Function Fill up the BG text page with a pattern.
Argument
pg BG text page number 0/1
pd Pattern data. You may consist with the following bit configuration.
bit0 to 7 pattern number 0 to 255
bit8 to 11 pallet block 1 to 15
0 is not usable.
bit14 Horizontal reverse 1=reverse,0=normal
bit15 Vertical reverse 1=reverse,0=normal
Return value Always 0
Note
X-BASIC/68's name bg_fill

Name bg_putX68
Format int bg_putX68(pg;int,x;int,y;int,pd;int)
Function Set a pattern with the coordinate of specified BG text page.
Argument
pg BG text page number 0/1
x,yBG text page coordinate Both x,y are 0 to 127
pd Pattern data. You may consist with the following bit configuration.
bit0 to 7 pattern number 0 to 255
bit8 to 11 pallet block 1 to 15
0 is not usable.
bit14 Horizontal reverse 1=reverse,0=normal
bit15 Vertical reverse 1=reverse,0=normal
Return value Always 0
Note
X-BASIC/68's name bg_put

Name bg_getX68
Format int bg_getX68(pg;int,x;int,y;int)
Function Get a pattern number with the coordinate of specified BG text page.
Argument
pg BG text page number 0/1
x,y BG text page coordinate Both x,y are 0 to 127
Return value Pattern data. This is consisted by the following bit configuration.
bit0 to 7 pattern number 0 to 255
bit8 to 11 pallet block 1 to 15
bit14 Horizontal reverse 1=reverse,0=normal
bit15 Vertical reverse 1=reverse,0=normal
Note
X-BASIC/68's name bg_get

Name sp_colorX68
Format int sp_colorX68(pc;int,col;int[,pb;int])
Function Define palette block with X68000 color code.
Argument
pc palette code 0 to 15
Basically, Don't change palette 0 (it is fixed to transparency).
colcolor X68000's color code
pb palette block number 1 to 31
Default is 1.
0 can not use.
Return value iOS color(composite RGB value) before changing
Note
X-BASIC/68's name sp_color

Name sp_setX68
Format int sp_setX68(pl;int[,x;int][,y;int][,pd;int][,prw;int])
Function Set sprite pattern to plane and set displaying coordinate.
It can set finer than sp_move().
Argument
pl Plane number 0 to 255
x,yCoordinate Freely in int range (negative to over the screen width)
Default, the coordinate is not changed (initial value is x,y=16,16).
Upper left coordinates of the screen is (16,16) (not same as sp_move()).
pd Pattern data. You may consist with the following bit configuration.
bit0 to 7 pattern number 0 to 255
bit8 to 11 pallet block 1 to 15
0 is not usable.
bit14 Horizontal reverse 1=reverse,0=normal
bit15 Vertical reverse 1=reverse,0=normal
prwdisplay priority
0=SPRITE_PRW_HIDE hide
1=SPRITE_PRW_BG0BG1SPBG0>BG1>sprite
2=SPRITE_PRW_BG0SPBG1BG0>sprite>BG1
3=SPRITE_PRW_SPBG0BG1sprite>BG0>BG1(default)
Return value always 0
Note
X-BASIC/68's name sp_set



// Convenient functions

The convenient functions have the commonly used processing on the program description.

If you want to use convenient functions, you must set "X68 compatible functions" to on in settings.
Name localizedString
Format str localizedString(js;str,es;str)
Function Depending on the iOS language settings, This returns the string.
Argument
js String for Japanese environment.
es String for without Japanese environment.
Return value either js or es.
Samplev3test.bas

Name hitKey
Format hitKey([fcls;int][,js;str][,es;str])
Function Wait until your tap.
Argument
fcls Whether to clear the Text screen after you tap.
YES=clear(default),NO=not clear
js Display string for Japanese environment. Default is "ここをタップしてください".
es Display string for without Japanese environment. Default is "Tap Here".
Return value None
Note
  • While waiting for the tap, a random number is mixed.
  • This This is changing the function key. If you use it before and after, you must re-set it.

Name getch
Format int getch()
Function Wait until key code return , and then return its code.
Argument None
Return value key code
Note Previously, it is necessary to set the key code by a touch area or function keys.

Name vwait
Format int vwait(tm;int)
Function Wait during the time specified by 1/60sec=16.6ms.
Argument
tm Wait time specified by 1/60sec
Return value None
Examplevwait(60) :// wait a second

Name rand2
Format int rand2(seed;int[,type;int])
Function Get integer random number from 0 to seed-1
Argument
seed Upper limit number of random number
type Generation method of the random number.
NO or Default Same as less than V3.00.
YES Use the sequence with more long period
Return value random integer number

Name srand2
Format srand2()
Function Initialize rand()/ rnd()/ rand2() by internal clock.
They are initialized from the clock, different series is automatically set for each call.
And it is always different series at any call.
Argument None
Return value None

Name bell
Format bell(tim;int)
Function Specified number of times, it plays beep2(1) sound.
Argument
tim Number of times to play
Return value None

Name circle16X68b
Format circle16X68b(x;int,y;int,r;int,pal;int)
Function Draw circle in the bitmap with 16 colors pallet code.
Argument
cx,cycenter of bitmap coordinate
r radius
pal16 colors pallet code
Return value None
SampleafuncX68Test.bas,cTen.bas

Name paint16X68b
Format paint16X68b(x;int,y;int,pal;int)
Function Paint monochromatic area in the bitmap with 16 colors pallet code.
Argument
x,ybitmap coordinate
pal16 colors pallet code
Return value None
SampleafuncX68Test.bas,cTen.bas

Name circleX68b
Format circleX68b(x;int,y;int,r;int,col;int)
Function Draw circle in the bitmap with X68 color.
Argument
cx,cycenter of bitmap coordinate
r radius
colX68 color code
Return value None
SampleafuncX68Test.bas

Name paintX68b
Format paintX68b(x;int,y;int,col;int)
Function Paint monochromatic area in the bitmap with X68 color.
Argument
x,ybitmap coordinate
colX68 color code
Return value None
SampleafuncX68Test.bas

Name x68Color2iOSColor
Format int x68Color2iOSColor(col;int[,r;int,g;int,b;int,alpha;int])
Function X68000 16bit color code is converted to the iOS color code.
Argument
colX68000 16bit color code. However, the intensity bit is ignored.
rreturn separate iOS red-component. You must specify a int variable.
greturn separate iOS green-component. You must specify a int variable.
breturn separate iOS blue-component. You must specify a int variable.
alphareturn separate iOS transparency-component. You must specify a int variable.
If you omitted r/g/b/alpha, it means that return value only use.
Return value composite RGB value
Note This is simply arithmetic conversion, result may be different from the real X68000's hue.
SamplespSet.bas,p68-246g.bas

Name x68256Color2iOSColor
Format int x68256Color2iOSColor(col;int[,r;int,g;int,b;int,alpha;int])
Function X68000 256-color code is converted to the iOS color code.
Argument
colX68000 256-color code. However, the intensity bit is ignored.
rreturn separate iOS red-component. You must specify a int variable.
greturn separate iOS green-component. You must specify a int variable.
breturn separate iOS blue-component. You must specify a int variable.
alphareturn separate iOS transparency-component. You must specify a int variable.
If you omitted r/g/b/alpha, it means that return value only use.
Return value composite RGB value
Note This function returns the color code to match the coloration on real X68000.
Samplec256.bas,ChrisGray.bas

Name x6816Color2iOSColor
Format int x6816Color2iOSColor(col;int[,r;int,g;int,b;int,alpha;int])
Function X68000 16-color code is converted to the iOS color code.
Argument
colX68000 16-color code. However, the intensity bit is ignored.
rreturn separate iOS red-component. You must specify a int variable.
greturn separate iOS green-component. You must specify a int variable.
breturn separate iOS blue-component. You must specify a int variable.
alphareturn separate iOS transparency-component. You must specify a int variable.
If you omitted r/g/b/alpha, it means that return value only use.
Return value composite RGB value
Note This function returns the color code to match the coloration on real X68000.
Samplep68-246g.bas,フラクタルグラフィックス.bas

Name ptrn16X68toiOS
Format ptrn16X68toiOS(wxy;int,ptrnX68();char,ptrniOS();int[,fdouble;int][ftoumei;int])
Function Convert the pattern data constructed by 16-color of X68 to iOS full-color.
Argument
wxyThe number of element of pattern data
x-width * y-height
ptrnX68Array containing the pattern data constructed by 16-color of X68.
One dot describe by 4bit of 16-colors pallet code. So, 2 dots is stored in one byte.
Number of elements are required wxy/2 bytes or more.
ptrniOSArray containing converted iOS full colored pattern data.
Each element has composite RGB value converted from 16-colors pallet code to real color.
The number of element need wxy bytes at fdouble=NO, or wxy*2bytes ay fdouble=YES.
fdoubleWhether horizontal doubling
YES=do、NO=not do(default)
ftoumeiWhether a palette code 0 to transparent
YES=do、NO=not do(default)
Return value None
SampleafuncX68Test.bas,cBJ.bas

Name ptrn8to16
Format ptrn8to16(ptrnX68();char,ptrn16();char)
Function Convert 8*8 pattern data to 16*16 pattern data.
X68 sprite pattern size is depend on screen mode. There are 8*8 or 16*16 sizes.
But iOS sprite has only 16*16 size. This function convert 8*8 size pattern data to 16*16.
Argument
ptrn88*8 pattern data
It needs over 8*8=64 bytes elements.
ptrn1616*16 pattern data
It needs over 16*16=256 bytes elements.
Return value None
Samplep40.bas

Name PCMplay
Format PCMplay(no;int,fwait;int)
Function Play registered sound.
Argument
nobuffer number
fwaitWhether you wait for the play finish
YES=wait,NO=not wait
Return value None

Name WaitPCM
Format WaitPCM(no;int)
Function Wait for the end of the audio playback by PCMplay() or a_play() issued just before.
Argument
nobuffer number
Return value None

Name deg2rad
Format float deg2rad(deg;float)
Function Convert degree to radian
Argument degree
Return value radian
Samplev3test.bas

Name rad2deg
Format float rad2deg(rad;float)
Function Convert radian to degree
Argument radian
Return value degree
Samplev3test.bas

Name setTouchKeys
Format int setTouchKeys(sx;int,sy;int,xc;int,yc;int,k1x;int,k1y;int,keys();int[,disps();str][,fnt;str][,touchNo();int][,dx;int][,dy;int])
Function Set and display touch-keys.
Argument
sx,syStart coordinate of touch-keys
xcHorizontal number of touch-keys
ycVirtical number of touch-keys
k1x,k1yDisplay width and height of 1 touch-key
keysThe array which elements include setting information as follows:
0This is not displayed.
&h01 to &hffkey code
+FKEY_NOT_BEGANONLYTo respond when you came into the area from outside the area.
(If you do not set this, it only respond when you touch within the area.)
+FKEY_NOT_REPEATThis key is not repeat.
+FKEY_WAKUONLYOnly drawing area rectangle(this does not become touch key)
The keys must have xc*yc elements.
dispsThe array which elements include key string for display.
If you omit disps, it means to set all touch area without draw area rectangle and key strting.
The element contents "" means to set this touch area without draw area rectangle and key strting.
fntdisplay font name
Only when you omit disps, fnt is able to omit too.
touchNoThe array to store the set touch area number (setting result is stored here).
You must declear this by dim int touchNo(constant of xc*yc) in advance.
If you omit this, it displays keys only(does not set touch area.)
dx,dyDisplay interval of each key.
Default is 0.
The meaning of each argument are as follows:

When the argumennt xc=4 and yc=3.(It needs 4*3=12 keys()s.)
Return value The actual number of settings. The touchNo(0 to return value-1) have been used.
Note
  1. The touch-keys are displaed in graphics screen. So you must prepare to displaying and writint to graphic screen.
  2. After you call this function, system will be kBackgroundAlpha(0.9) and lineWidth(2).
Sample keyMap.bas,snake2.bas

Name resetTouchKeys
Format int resetTouchKeys(sx;int,sy;int,xc;int,yc;int,k1x;int,k1y;int,keys();int[,touchNo();int][,dx;int][,dy;int])
Function Erase touch-key display.
Argument Basically each argument is same as giving to setTouchKeys().
sx,syStart coordinate of touch-keys
xcHorizontal number of touch-keys
ycVirtical number of touch-keys
k1x,k1yDisplay width and height of 1 touch-key
keysThe array which elements include setting information
touchNoThe array which is stored the result of touch area number
If you omit, only key display is erased(the setting of touch-key area is not release).
dx,dyDisplay interval of each key.
Default is 0.
Return value None
Note The touch-keys are displaed in graphics screen. So you must prepare to displaying and writint to graphic screen.
NoteThe resetTouchKeys() always erase touch-key display.
Therefore, when you set only touch area in setTouchKeys(),
please release the touch area by resetAllTouchKeys() instead of resetAllTouchKeys().
Sample keyMap.bas,snake2.bas

Name resetAllTouchKeys
Format resetAllTouchKeys(touchNo();int,cnt;int)
Function Release touch-keys which have been set by setTouchKeys()(display is not erased).
Argument
touchNoThe array with touch area number. This is stored from setTouchKeys().
cnt The return value of setTouchKeys().
The touchNo(0~cnt-1) have been used.
Return value None
Sample keyMap.bas,snake2.bas

Name checkCompatible
Format int checkCompatible(deviceType;int[,fdisplay;int])
Fuunction It is checked whether the running device contained in the specified device group.
If it does not, display a message that it is a non-executable.
Primarily, this is the purpose of confirming whether the execution by the screen size.
Argument
deviceTypeDevice type. Specified in the or value of the following constants:
COMPATIBLE_IPADAll iPad
COMPATIBLE_IPODTOUCH4iPod touch4
COMPATIBLE_IPODTOUCH56iPod touch5 and 6
COMPATIBLE_IPODTOUCHAll iPod touch
COMPATIBLE_IPHONE4iPhone 4
COMPATIBLE_IPHONE5iPhone 5
COMPATIBLE_IPHONE6iPhone 6
COMPATIBLE_IPHONE6PLUSiPhone 6 Plus
COMPATIBLE_IPHONEAll iPhone
COMPATIBLE_ALLAll type device
COMPATIBLE_IPODTOUCH4_IPHONE4iPod touch4 and iPhone4
COMPATIBLE_IPODTOUCH56_IPHONE5iPod touch5/6 and iPhone5
The devices X-BASIC does not support are not included.
fdisplay Whether you give a confirmation message when this device is imcompatible.
YES(Default)display
NOnot display
Return value
YESThis device is compatible
NOThis device is incompatible
Sample checkCompatible.bas

Name versionXBiOSX68$
Format versionXBiOSX68$()
Function Return X68 compatible and convenient functions's version
Argument None
Return value The version string of the X68 compatible and convenient function



// Card functions

Card function is a set of functions to simplify the display processing of the card to be used in such as playing card.
This is a port of the CARD.FNC published in the Oh! X May 1990 issue.
For convenience, the name of the function has been modified, but almost the same behavior.

If you want to use card functions, you must set "X68 compatible functions" to on in settings.

*Usage
The card function uses bitmap for display. So you must initialize the bitmap.

if cardInit()<>0 then {
    print "Can't read card pattern."
    end
}
// The black in the card is painted with the pallet 1, so it is necessary to change the palette for display in black.
setgPalet16X68(1,&h000000ff)

vpriority(TPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3)
vpage(B_TPAGE+B_GPAGE0+B_GPAGE1+B_GPAGE2+B_GPAGE3,YES)
apage(GPAGE0)
bitmapOpen(0,0,YES)
     ... 
    cardPut(x,y,cno,NO)
     ...
bitmapClose()
Name cardInit
Format int cardInit([userFile;str])
Function Initialize card functions.
Argument
userFile Pattern data file
If omitted, it is initialized with the standard playing card's data.
Return value
=0Successful completion
<>0Error (The card functions are not enable.)
Note The pattern data must have following data structure.
  • One card has 48dot width and 96dots height.
  • One dot describe by 4bit of 16-colors pallet code. So, 2 dots is stored in one byte.
  • One card data has 48/2*96 bytes.
  • 60 cards pattern are stored in a file.
In tha default playing card pattern data, black is painted with the pallet 1, so it is necessary to change the palette for display in black.
setgPalet16X68(1,&h000000ff)
SampleCardTest.bas

Name cardCalcNo
Format int cardCalcNo(suit;int,no;int)
Function Get a series of card number with suit and number of the card.
Argument
suitSuit number SUIT_SPADE/SUIT_HEART/SUIT_DIA/SUIT_CLUB
nonumber 1 to 13
Return value A series of card number
If the number is illegal, it returns 0(as back of the card).
Note You specify the back of the card by CARD_BACK which is a series of card number.
And You specify the joker card by CARD_JOKER which is a series of card number.
If you use the card functions for unconcerned with the playing card, you can not use cardCalcNo().
SampleafuncX68Test.bas

Name cardPut
Format cardPut(x;int,y;int,cno;int,fdouble;int)
Function Display card
Argument
x,ycoordinate
cnoA series of card number
fdoubleDisplay the card with the horizontal doubling.
Since the default pattern looks long in the vertical on the iOS, there is this option.
Return value None
X-BASIC/68's name c_put
SampleCardTest.bas,afuncX68Test.bas

Name cardGet
Format int cardGet(cno;int,ptrn();char)
Function Get card pattern
Argument
cnoA series of card number
ptrnX68's pattern
Return value None
X-BASIC/68's name c_get
SampleafuncX68Test.bas

Name cardSet
Format int cardSet(cno;int,ptrn();char)
Function Set card pattern
Argument
cnoA series of card number
ptrnX68's pattern
Return value None
X-BASIC/68's name c_set
SampleafuncX68Test.bas

Name versionXBiOSCard$
Format versionXBiOSCard$()
Function Return card function's version
Argument None
Return value The version string of the card function


All functions list (alphabetical order)
X68 compatible functions / Convenient functions
Card functions
[Return]