This zip file is include other sample programs.
These are test for each function and statement mainly.
Zip file :
XBtests.zip
2013/05/26
2013/05/24
Development status of the next version "X-BASIC for iOS" (V2.1)
This is the development status of the next version of "X-BASIC for iOS" v2.1.
If you have reporting or requirements, please put a comment in this post.
Change in V2.1 (on sale)
Add : graphics page/sprite screen animation
Add : graphics/sprite screen transform
Add : graphics scroll
Add : text display control code (ClearLine)
Add : int constant definition statement(enum)
Add : measures against sound delaying of beep2()
Add : symbolt() for string draw virticaly
Add : isnan() for check NaN
Add : For function naming convention unification, add an alias name in some function
Add : gAntiAlias() for enable/disable graphics anti-aliasing
Add : getTouchStatus() for getting touch status
Add : getWidth()'s argument
Up : display speed up (a little)
Up : More easy to understand the errors in statement using.
Up : symbol() returns its draw size
Up : Sprite & BG system (small speed up)
Up : The number of functionkeys is extended to 20.
Up : tatrb() function
Fix : When you print string within tatrb(ATRB_REVESE), often there is a gap between character.
Add : ATRB_BOLD
Up : each attribute is able to OR specify
Fix : The abs()'s accuracy is not enough.
Fix : The tan(pi(1.0/4.0)) is displayed "0" (display only).
Fix : Fall at print NaN.
Fix : Drawing width of box() / fill() is not enough (1dot).
Fix : Display is not hidden at second argument is NO (manual mistake).
Fix : It is not reflected in the immediately when you set the vpage().
Fix : Default pallete block No. is not 1 in bg_fill().
Fix : Target of deleting file was incorrect (except top page) ; file.bas
Fix : When you print string with tatrb(ATRB_REVESE), often there is a gap between character.
Fix : sample bugs
Fix : displayFunctionKey()
Fix : There may remain the touch key portion is reversed.
Version up of the BASIC main body will be paused. And I will make a lot of BASIC program.
Of course, it will continue to add the necessary features and bug fixes that came out in the process.
Now, the samples in this site are for V2.00.
I will replace them for V2.1 gradually.
The manuals have been already updated to V2.1.
(There is no problem because corresponding version is written).
If you have reporting or requirements, please put a comment in this post.
Change in V2.1 (on sale)
Add : graphics page/sprite screen animation
Add : graphics/sprite screen transform
Add : graphics scroll
Add : text display control code (ClearLine)
Add : int constant definition statement(enum)
Add : measures against sound delaying of beep2()
Add : symbolt() for string draw virticaly
Add : isnan() for check NaN
Add : For function naming convention unification, add an alias name in some function
Add : gAntiAlias() for enable/disable graphics anti-aliasing
Add : getTouchStatus() for getting touch status
Add : getWidth()'s argument
Up : display speed up (a little)
Up : More easy to understand the errors in statement using.
Up : symbol() returns its draw size
Up : Sprite & BG system (small speed up)
Up : The number of functionkeys is extended to 20.
Up : tatrb() function
Fix : When you print string within tatrb(ATRB_REVESE), often there is a gap between character.
Add : ATRB_BOLD
Up : each attribute is able to OR specify
Fix : The abs()'s accuracy is not enough.
Fix : The tan(pi(1.0/4.0)) is displayed "0" (display only).
Fix : Fall at print NaN.
Fix : Drawing width of box() / fill() is not enough (1dot).
Fix : Display is not hidden at second argument is NO (manual mistake).
Fix : It is not reflected in the immediately when you set the vpage().
Fix : Default pallete block No. is not 1 in bg_fill().
Fix : Target of deleting file was incorrect (except top page) ; file.bas
Fix : When you print string with tatrb(ATRB_REVESE), often there is a gap between character.
Fix : sample bugs
Fix : displayFunctionKey()
Fix : There may remain the touch key portion is reversed.
Version up of the BASIC main body will be paused. And I will make a lot of BASIC program.
Of course, it will continue to add the necessary features and bug fixes that came out in the process.
Now, the samples in this site are for V2.00.
I will replace them for V2.1 gradually.
The manuals have been already updated to V2.1.
(There is no problem because corresponding version is written).
V2.00 on sale
X-BASIC for iOS is on sale.
It was a plan to charge for sprite function initially.
However, I could not understand implementation of the "In-App purchases".
So this is the thank-you price.
Updated portion of V1.71 or later is as follows.
Change in V1.80
Add : program list print out
Add : key screen is almost reproduce at RUN screen display
Add : Hard copy function(output to AirPrint/PDF/JPEG/PNG/Album)
Add : keysns()
Fix : beep2(13) sound is illegal
Change in V2.00
Add : sprite and BG functions
Add : Enable to display two-stage function key in the portrait of iPod touch and iPhone.
Add : bitmapImageFile()
Add : bitmap functions can use same area as usual graphics functions.
Add : Scroll in text screen
Fix : osVersion() sometime returns illegal value.
Fix : Display of float value is not same as X-BASIC/68.
Fix : It is not rounded when you display float with no decimal digit in the "using"
Fix : Illegal setting at keyRepeatTime()
Fix : At 3.5 inches devices (iPod touch 4 and iPhone 4), the bottom of the screen is cut off.
Fix : tborder() is not display until print any contents.
Fix : It may fall at using float arrays.
Fix : The startAngle and endAngle of circle() is misinterpreted.
Fix : It may fall with repeating the selection of program
Fix : minor bugs
Fix : Bugs of sample BASIC programs
Fix : Manual mistake(many)
Added 05/25/2013:
Some HTML grammar problem have been discovered in built-in manual on iPad.
I think that there is no hindrance to display the time being, but if there is a problem, refer to the latest version of the following:
It was a plan to charge for sprite function initially.
However, I could not understand implementation of the "In-App purchases".
So this is the thank-you price.
Updated portion of V1.71 or later is as follows.
Change in V1.80
Add : program list print out
Add : key screen is almost reproduce at RUN screen display
Add : Hard copy function(output to AirPrint/PDF/JPEG/PNG/Album)
Add : keysns()
Fix : beep2(13) sound is illegal
Change in V2.00
Add : sprite and BG functions
Add : Enable to display two-stage function key in the portrait of iPod touch and iPhone.
Add : bitmapImageFile()
Add : bitmap functions can use same area as usual graphics functions.
Add : Scroll in text screen
Fix : osVersion() sometime returns illegal value.
Fix : Display of float value is not same as X-BASIC/68.
Fix : It is not rounded when you display float with no decimal digit in the "using"
Fix : Illegal setting at keyRepeatTime()
Fix : At 3.5 inches devices (iPod touch 4 and iPhone 4), the bottom of the screen is cut off.
Fix : tborder() is not display until print any contents.
Fix : It may fall at using float arrays.
Fix : The startAngle and endAngle of circle() is misinterpreted.
Fix : It may fall with repeating the selection of program
Fix : minor bugs
Fix : Bugs of sample BASIC programs
Fix : Manual mistake(many)
Added 05/25/2013:
Some HTML grammar problem have been discovered in built-in manual on iPad.
I think that there is no hindrance to display the time being, but if there is a problem, refer to the latest version of the following:
2013/05/18
Sprite function test program #2
This is test program #2 for sprite functions.
The sp_image() can be defined sprite from the image at once.
And, when you move mass sprites at a time, sp_halt() is essential for preventing flickering.
Zip archive file within sample image: XBsprite.zip
// Sprite test2 // for V2.00 later only // Set graphics mode width(0) int wgx,wgy getWidth(wgx,wgy):// Get screen width by graphics mode //locate(0,2):print "Graphic Width:";wgx;"*";wgy // sp_init():// Hide sprite screen width(32) vpage(B_SPAGE+B_TPAGE,YES):// display sprite screen vpriority(TPAGE,SPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3) cls() tborder(1,CTHCYAN) // // Display sprite at touched position // str exit$,mes$ if isLocalizeJapan() then { exit$="中断" mes$="画面にタッチ&ドラッグしてください" } else { exit$="exit" mes$="Please touch & drag" } setFunctionKey(0, exit$ ,'!') setFunctionKey(1,"SPst" ,'S') setFunctionKey(2,"BGst" ,'B') setFunctionKey(3,"Dprw" ,'p') setFunctionKey(4,"disp" ,'d') setFunctionKey(5,"OFF" ,'F') setFunctionKey(6,"ON" ,'O') setFunctionKey(7,"BGget",'G') setFunctionKeyBackgroundImage("funcBack.png") displayFunctionKeyAll(YES,YES):// v2.0 // setTouchArea(0,0,0,0,0,YES):// Must need for getting any touch coordinate // // You can set 512 patterns, but can display 256 planes. sp_halt(YES):// Pause sprite display int pwx=16,pwy=16 int tsp=0,esp=0 esp=sp_image("IMG1.JPG",110,260,pwx,pwy,tsp,tsp,wgx/3,wgy/3,SPRITE_PRW_BG0SPBG1,YES):// pwx,pwy is adjusted locate(12,0):print "SP:";tsp;"〜";esp-1 //--------------------- // for functions test //dim int ptn(255) //sp_pat(tsp,ptn) //int fp //fp=fopen("pat.dat","w") //fwrite(ptn,255,fp) //fclose(fp) //--------------------- // // sprite pattern (X68 type) dim char ca(255) = { // mesh 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 , 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 , 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 } int pb1=3:// palette block No. int pb2=2:// palette block No. sp_color(0,&h00000000,pb1):// Transparency sp_color(0,&h00000000,pb2):// Transparency sp_color(1,&h000080ff,pb1) sp_color(1,&h800000ff,pb2) sp_def(esp,ca) sp_clr(esp+1) // int pg0=0:// BG text page number int pg1=1:// BG text page number int x,y bg_fill(pg0,esp,pb1,SPRITE_FLIP_NONE):// once fill all // wg?/16 : the number of sprite in screen width/height // pull out the center int bwx=wgx/16,bwy=wgy/16 for y=bwy/4 to bwy*3/4 for x=bwx/4 to bwx*3/4 bg_put(pg0,x,y,esp+1,pb1) next next bg_set(1,pg0,YES) // bg_fill(pg1,esp+1,pb1,SPRITE_FLIP_NONE):// once clear all // draw center for y=bwy*4/10 to bwy*5/10 for x=0 to bwx bg_put(pg1,x,y,esp,pb2) next next bg_set(0,pg1,YES) // //mapSprite(wgx/3,wgy/3,tsp,pwx,pwy) sp_halt(NO):// Resume sprite display // dim float tpoint(2) int touchCnt str cs int dt=0,t int ts=time():/* start time locate(0,1):print mes$ // int i int x0=-1,y0=-1 int fDisableBG0SPBG1=NO prfDisableBG0SPBG1(fDisableBG0SPBG1) int fdisp=YES sp_disp(fdisp) repeat // timer count until key input while (not kbhit()) t=time() if t-ts>dt then { :/* change second dt=dt+1 // locate(20,0):print dt; // beep2(0) // locate(20,1) } touchCnt=getTouchPoint(tpoint) if (touchCnt>0) then { x=tpoint(0):// float → int y=tpoint(1) if x<>x0 or y<>y0 then { locate(0,0):print x;",";y mapSprite(x,y,tsp,pwx,pwy) // x0=x y0=y } // Do not re-displayed when the coordinate is same. Sprite would flicker Failure to do so. } endwhile // key operation cs=inkey$() switch cs case "S":// Sprite stat for i=0 to 5 locate(0,2+i) print "i=";i;":";sp_stat(tsp,i) next break case "B":// BG stat for i=0 to 3 locate(16,2+i) print "i=";i;":";bg_stat(0,i) next break case "p":// Disable BG0SPBG1 if fDisableBG0SPBG1 then fDisableBG0SPBG1=NO else fDisableBG0SPBG1=YES prfDisableBG0SPBG1(fDisableBG0SPBG1) break case "d":// sp_disp if fdisp then fdisp=NO else fdisp=YES sp_disp(fdisp) break case "F":// sp_off sp_off(tsp,esp-1):// In this program, plane number is same as pattern number break case "O":// sp_on sp_on(tsp,esp-1,SPRITE_PRW_BG0SPBG1):// In this program, plane number is same as pattern number break case "G":// bg_get getBG(pg0,bwx,bwy) getBG(pg1,bwx,bwy) break endswitch until cs="!" print "Sprite version=";versionXBiOSSprite$() // end func mapSprite(gx;int,gy;int,tsp;int,pwx;int,pwy;int) int wx,wy sp_halt(YES):// Halt screen update until finish to change the values. for wy=0 to pwy-1 for wx=0 to pwx-1 // sp_image() ignores palette (because of iOS type) sp_setting(tsp,gx+wx*16,gy+wy*16) tsp=tsp+1 next next sp_halt(NO):// Resume display endfunc func prfDisableBG0SPBG1(fDisableBG0SPBG1;int) dim str strfDisableBG0SPBG1(1)={"-","D"} sp_disableBG0SPBG1(fDisableBG0SPBG1) locate(31,0):print strfDisableBG0SPBG1(-fDisableBG0SPBG1) endfunc func getBG(pg;int,x;int,y;int) int pb,flip,ptn ptn=bg_get(pg,x,y,pb,flip) locate(0,10+pg*2) :print "pg=";pg;":x=";x;"/y=";y locate(0,10+pg*2+1):print "pb=";pb;"/flip=";flip;"/ptn=";ptn endfunc
Zip archive file within sample image: XBsprite.zip
2013/05/16
Sprite function test program #1
This is test program #1 for sprite functions.
Zip archive file: XBsprite.zip
// Sprite test1 // for V2.00 later only // Set graphics mode width(0) int wgx,wgy getWidth(wgx,wgy):// Get scre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,0,0,1,0,0,0,2,0 ,3,0,0,0,0,4,0,0 ,0,0,1,0,0,0,2,1 ,0,0,0,0,0,3,0,0 ,0,0,0,1,0,0,2,0 ,0,0,0,3,4,0,0,0 ,0,0,0,0,1,2,0,0 ,0,3,4,0,0,0,0,0 ,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0 ,0,0,0,0,0,0,0,0 } int spB=spA+1:// pattern No. int pbB=pbA+1:// palette block No. int planeB=planeA+1:// plane No. // int i,x,y sp_init():// Hide sprite screen sp_clr() sp_def(spA,ptnA) sp_def(spB,ptnB) for i = 0 to 7 sp_color(i,rgb(0,i*256/8,0),pbA) next // sp_color(0,0,pbB) sp_color(1,&hff00ffff,pbB) sp_color(2,&hffff00ff,pbB) sp_color(3,&h800000ff,pbB) sp_color(4,&h8080ffff,pbB) sp_color(5,&hff8080ff,pbB) sp_color(6,&hff0000ff,pbB) sp_color(7,&h00ff00ff,pbB) sp_color(8,&h0080ffff,pbB) sp_color(9,&hffffffff,pbB) // int pbA2=pbB+1 :// palette block No. for i = 0 to 7 sp_color(i,rgb(i*256/8,0,0),pbA2) next // width(32) vpage(B_SPAGE+B_TPAGE,YES):// display sprite screen //vpriority(TPAGE,SPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3) vpriority(SPAGE,TPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3) cls() tborder(1,CTHRED) // // Display sprite at touched position // str exit$,mes$ if isLocalizeJapan() then { exit$="中断" mes$="画面にタッチ&ドラッグしてください" } else { exit$="exit" mes$="Please touch & drag" } setFunctionKey(0,exit$,'!') setFunctionKeyBackgroundImage("funcBack.png") displayFunctionKeyAll(YES,YES):// v2.0 // setTouchArea(0,0,0,0,0,YES):// Need for getting any touch coordinate // dim float tpoint(2) int touchCnt str cs int dt=0,t int ts=time():/* start time locate(0,1):print mes$ // sp_disp(YES) // if NO then { sp_halt(YES):// Halt screen update until finish to change the values. sp_setting(planeA+0,0,0,spA,pbA2,SPRITE_FLIP_NONE,SPRITE_PRW_SPBG0BG1) sp_setting(planeA+1,16,16,spA,pbA2,SPRITE_FLIP_NONE,SPRITE_PRW_SPBG0BG1) sp_setting(planeA+2,32,32,spA,pbA2,SPRITE_FLIP_NONE,SPRITE_PRW_SPBG0BG1) sp_halt(NO):// Resume display end } // int x0=-1,y0=-1 repeat // timer count until key input while (not kbhit()) t=time() if t-ts>dt then { :/* change second dt=dt+1 // locate(20,0):print dt; // beep2(0) // locate(20,1) } touchCnt=getTouchPoint(tpoint) if (touchCnt>0) then { x=tpoint(0):// float → int y=tpoint(1) if x<>x0 or y<>y0 then { locate(0,0):print x;",";y sp_halt(YES):// Halt screen update until finish to change the values. // normal if pbA<>1 then { sp_setting(planeA , x, y,spA,pbA ,SPRITE_FLIP_NONE,SPRITE_PRW_SPBG0BG1) } else { // sp_move() is palette block 1 only sp_move( planeA , x, y,spA) } // Flip sp_setting(planeB , x+16, y+16,spB,pbB ,SPRITE_FLIP_NONE ,SPRITE_PRW_SPBG0BG1) sp_setting(planeB+1, x-16, y+16,spB,pbB ,SPRITE_FLIP_HORIZONTAL ,SPRITE_PRW_SPBG0BG1) sp_setting(planeB+2, x+16, y-16,spB,pbB ,SPRITE_FLIP_VERTICAL ,SPRITE_PRW_SPBG0BG1) sp_setting(planeB+3, x-16, y-16,spB,pbB ,SPRITE_FLIP_HORIZONTAL_VERTICAL,SPRITE_PRW_SPBG0BG1) // Same pattern by another palette sp_setting(planeB+4,wgx-x,wgy-y,spA,pbA2,SPRITE_FLIP_NONE,SPRITE_PRW_SPBG0BG1) sp_halt(NO):// Resume display // x0=x y0=y } // Do not re-displayed when the coordinate is same. Sprite would flicker Failure to do so. } endwhile // key operation cs=inkey$() until cs="!" float ver=osVersion() print "iOS=";ver // end
Zip archive file: XBsprite.zip
2013/05/09
Bugs in V1.71
I will inform about found bugs in X-BASIC for iOS v1.71.
1. Printing float without using statement is sometime illegal.
2. When printing float with using statement and set to 0 digit decimal digits,
it is not rounded to the nearest integer in the first decimal place.
3. When there is a decimal place in the iOS version, getSystemversion() returns incorrect iOS version.
4. keyRepeatTime() does not set correctly.
5. At 3.5 inches devices (iPod touch 4 and iPhone 4), the bottom of the screen is cut off.
6. tborder() is not display until print any contents.
You can avoid this by tborder():print " ".
7. It may fall at using float arrays.
8. The startAngle and endAngle of circle() is misinterpreted.
9. It may fall with repeating the selection of program
10. Some BASIC samples can not run normally.
They will be fixed in next V2.0.
Please just wait.
1. Printing float without using statement is sometime illegal.
2. When printing float with using statement and set to 0 digit decimal digits,
it is not rounded to the nearest integer in the first decimal place.
3. When there is a decimal place in the iOS version, getSystemversion() returns incorrect iOS version.
4. keyRepeatTime() does not set correctly.
5. At 3.5 inches devices (iPod touch 4 and iPhone 4), the bottom of the screen is cut off.
6. tborder() is not display until print any contents.
You can avoid this by tborder():print " ".
7. It may fall at using float arrays.
8. The startAngle and endAngle of circle() is misinterpreted.
9. It may fall with repeating the selection of program
10. Some BASIC samples can not run normally.
They will be fixed in next V2.0.
Please just wait.
Subscribe to:
Posts (Atom)