2015/09/16

Application name will change


I will change this application name from "X-BASIC for iOS" to "X-BASIC'"(Dash).

Because Apple pointed out "An application name must not include the word 'iOS' ".

The application name will change but general name is still "X-BASIC for iOS".

Best regards.

2015/09/09

[Important]About progloader.bas

progloader is a sample program that is built into the V3.00.
In fact, this sample has a very important meaning.

The program itself is easy.
Please select a program from the list and tap "Download". The selected program will be downloaded.
You terminate the program by tapping "end" and close the screen by tapping .
Then you will be able to select downloaded program in the program selection menu.
Not only the program , but also the required data files are imported .

 The Zip file is here : XBprogloader.zip
(This is intended to view a sample of the list-file. Program itself is built in X-BASIC for iOS. )


・・・Mechanism・・・

This mechanism does not work out by the progloader alone.
By using this program, if you want to download your program (and data), you will need the following preparations.
  1. Prepare the server to the program downloading
  2. Put the list-file that is described of programs information on server.
    The list-file is UTF8 text file with the following format:
      "program name"    zip-filename
    One line is for one program. The "program name" is the name that appears in the progloader. The zip-filename is the name of the zip file that is downloaded when you select it. The names that appear in program selection menu of X-BASIC are the file name of *.bas archived in zip file.
    Between them are separated by one or more spaces or tabs. A line that begin with ';' is considered a comment, so it will be ignored.

    This list-file is put on the server side. It other words, without rewriting the progloader, you can increase or decrease the program that can be downloaded.

  3. Put the zip file that contains programs and data together
    Usually, the zip file includes * .bas and the required data. It is also allowed to have with the directory structure. It will be expanded in the X-BASIC for iOS same as the original directory structure.

  4. Rewrite the URL written in the progloader.bas
    str baseURL = "~" is the URL.
People who can not understand this method by reading this description, should not be used.


・・・Note・・・
You can delete the program itself from the program selection by "Delete". But the accompanying data is not deleted automatically. So the datas still remains in iOS and eat the storage capacity. Please remove datas by using built-in sample filer.bas.

···From now on···
Since progloader was completed, in the future, I will publish sample programs by using this. When you will run progloader.bas , sometime there may be the new sample program.


···Just in case···
I keep writing for just in case. X-BASIC for iOS has no function for the iOS system hacking. Even if you write any program, you can not be used for hacking.

Latest manuals

The latest version's manuals are here:

About X-BASIC for iOS
Statement & functions manual
iOS dependent functions manual
X68 compatible/Convenient/Card functions manual
About sprite and BG screen
Table of Fonts

In addition, in iPad, you can see all in built-in help.

Note in X-BASIC for iOS v3.00

In X-BASIC for iOS v3.00, some point has been changed from previous versions.
  1. The value of the max string length in settings has been changed.
    This is only changed the interpretation way. The essence does not change.
  2. Display processing of text character has changed.
    Please check because sometimes display different results.
  3. When the function names in the existing program is duplicate and it is difficult to modify program,
    please turn off "X68 Compatible functions" in settings.
  4. The order of the program files list is changed.
    Previous version:
    The first is case-sensitive order in user-created program and the second is case-sensitive built-in samples.
    New version:
    The case-insensitive in total of user-created program and built in samples.
    When there is the same name in the built-in and user-created, user-created is priority.
  5. Revoke the function randomise()
    Because it was misspelled, randomise() was revoked in V3.00. Please rewrite to randomize().

The following is I'm sorry.

  • I have no 64-bit real machine, iPhone6 and iPhone 6 plus.
    So, I tested only on the simulator. Those who has trouble on a real machine, please let me know with as much detail as possible.
  • When an error occurs, editor is scrolled automatically to display the first error source line.
    However, in the case of long source, it may not be scroll automatically. This is the iOS bug. If you tap the error line again to scroll to it.
  • Known bugs in X-BASIC for iOS V3.10

    Known bugs in X-BASIC for iOS V3.10 are below:
    1. Sometimes, text character displays too small.
    2. The system falls when the program source is terminated without 'next' paired with 'for'.
    3. The system falls when the program source is terminated without 'endwhile' paired with 'while'.
    4. The system falls when the program source is terminated without 'until' paired with 'repeat'.
    5. The system falls when the program source is terminated without 'endswitch' paired with 'switch'.
    6. The system falls when the program source is terminated without 'endfunc' paired with 'func'.
    7. The system falls when the program source is terminated without 'endenum' paired with 'enum' or 'fenum'.
    8. system error occurs when you declare a 10-dimensional array.
    9. If you try to save a file from the "Creat New", ".!" is displayed in the file name input field.
    10. The cardInit() does not correspond the SHIFT-JIS filename.
    11. A program line with number can not be read correctly.
    12. "Old display compatibe" in settings does not become ON.
    13. If the first character in the program source is a surrogate pair characters, it does not display the characters in the font selection view.
    14. If you include the surrogate pair characters in symbolt(), it is not displayed correctly.
    15. In the some external function, run-time error is ignored.
    16. Text charater of text screen may be too small.
    17. The beep2()'s argument floadonly is ignored.
    18. You seem that the touch area is not released by removeTouchArea().
    19. It becomes abnormal operation when you do not omit the argument of bitmapImgLoad() or bitmapTileImgLoad().
    20. When you display an integer number by 'print', The displaying space in front of the number is different from the X-BASIC/68.
    21. It issues a new line when you write Print "~"; //.
    22. When you print double-byte characters at last column in the text screen,it does not issue new line before.
    23. The display corrdinate of function keys are illegal.
    24. Sometime system fall at bitmapOpen().
    25. At the first launching, the setup data for v3.0 later are not initialized.
    26. In zipExpand (), you can not expand the Japanese file name files in Zip made under Windows environment.
    27. Sometime th return information of jpegHeader()/pngHeader() is illegal.
    28. The system fall when motionGetRotation()/compassGetData()/symbol(,ht)/fontSize(,wy)/getWidth(,fontWx,fontWy) returns float value to float variables.
    29. After using the motion function, working memory has been still allocated.
    30. When you call 'end' statement without motionEnd(), the motion function has been still run.
    31. The date and time of file creating are not correct at making zip archive with emailSend.
    32. The return value of str$(positive number) is not same as X-BASIC/68.
    33. If you call the bitmapImgLoad () for the same graphics page in a short period of time, sometimes drawing is delayed or lack
    All bugs except last one are resolved in V3.40.

    In addition, the following is a specification:
    1. When you use dimension argument in internal function, you can not use enum constant to the size specified.
      Example : func f(masu(WW,WW);int):// error occur
    2. When writing the enum values using the equation, it is an error to uses some operators consecutively two or more.
      enum
        C=1+2+4          OK
        D=1 or 2 or 4    Error
        E=(1 or 2) or 4  OK
      endenum
      
    1st is due to the following reasons:
    1. The internal function's name and argument are registered within preprocess of compile.
    2. The enum constant is determined within compile process.
    3. Therefore, in preprocess, the enum constant is not referable.
    This is very difficult to solve. I made a comparison between the frequency of use and the effort of implementation and debugging.
    As a result, I decided this to "limit as a specification".

    2nd is derived from the method of generating internal code, it is very difficult to modified.
    Therefore, this is considered as a specification.
    The formula writing in the enum, please enclose with () in every operator.

    Differences summary from V2.96 to V3.40

    V2.96 as a reference, I have made the changes list In later versions(except application name).
    I listed only the changed part. Make sure the latest version of the manual for more information.
    It should be noted, the currently uploaded manuals are V3.50's.(not v3.40's).


    In front of their names, with "+" means added, "-" means deleted and another means changed only. In addition, I have omit the only bug fixed thing.
    v3.00V3.10V3.40
    +maxStringLength() +fenum +debugMode()
    +gLocate() fopen() +debugDump()
    +forcedSJIS() +fopenError() +logoAlert()
    +ellipse() +errorCodeFopen() +setTouchKeys()
    -randomise() freads() +resetTouchKeys()
    +sjisStrWidth() rand() +resetAllTouchKeys()
    +utf8StrWidth() rnd() +programName$()
    +toascii() +getScreenSize()
    width() setFunctionKeyBackgroundImage()
    cursorMove() displayFunctionKey()
    imgLoad() displayFunctionKeyAll()
    tileImgLoad() width()
    gTransform() tAtrb()
    sp_def() selectMenu2()
    +X68 compatible functionsgetBitmapSize()
    +Convenient functions+Debug function
    +Card functions devicePlatform()
     +checkCompatible()
     +isLandscape()
     gTransform()
     +stick()
     +checkCompatible()
     +isLandscape()
     gTransform()
     +stick()
     +zipArchive()
     +progSaver.bas
     beep2()
     iOS9 compatible

    2013/12/13

    About update this site

    I was very tired to translate this site Japanese to English.
    So, I can not update English site frequently.

    If you want latest information, please read Japanese site with Google Translate.
    Thanking you in advance.


    Postscript November/09 2015

    For the most important thing, I will write also in English in the future.

    2013/09/16

    SAMPLE : trump game self fortune-telling "Ten"

    This is trump game self fortune-telling "Ten".



    This is only for iPad portrait screen (landscape screen is unvalidated).


    The source program is so big so it is not able to publish. Please download zip file from here : XBten.zip.

    The cTen.bas is for iOS, and the Ten.bas is for X-BASIC/68 or peke-BASIC.
    They are stored to show how to transplanted.

    2013/08/29

    SAMPLE : card game "Sevens"

    This is card game "Sevens".



    This is only for iPad portrait screen (landscape screen is unvalidated).


    The source program is so big so it is not able to publish. Please download zip file from here : XB7.zip.

    The c7.bas is for iOS, and the 7.bas is for X-BASIC/68 or peke-BASIC.
    They are stored to show how to transplanted.

    SAMPLE : card game 99

    This is card game "99".



    "99" is the first sample of card.fnc.

     This is only for iPad portrait screen (landscape screen is unvalidated).


    The source program is so big so it is not able to publish. Please download zip file from here : XB99.zip.

    The c99.bas is for iOS, and the 99.bas and 99patch.bas is for X-BASIC/68 or peke-BASIC.
    They are stored to show how to transplanted.

    2013/08/08

    SAMPLE : Z80 assembler "SuperBASE"

    I ported Z80 asembler "SuperBASE" to X-BASIC for iOS.

    This needs V2.4 later.

    Almost message and documents are Japanese only.

    Zipファイル :XBsbase.zip

    This is not redistributable.

    2013/08/01

    SAMPLE : Rader Snaky

    Rader Snaky

    We were enjoying this game the old days.
    Some people would yearn.
    Some people will know with a fresh feeling.

    Porting fromI/O separate volume of WICS and BASE programs collection.
    This is not redistributable.




    Zip Archive :XBrs.zip

    2013/07/23

    SAMPLE : Human play chess program

    This is chess program to human play.

    You can not play against the computer.
    Appearance is very simple.

    After all, I have finished the half-baked program.
    Please improve appropriately(^_^;).

    This is compatible for iPad portrait and landscape screen. And this is compatible for Japanese and English.


    Zip file :XBches.zip

    2013/07/13

    SAMPLE : Lunar Rescue

    Lunar Rescue

    We were enjoying this game the old days.
    Some people would yearn.
    Some people will know with a fresh feeling.

    Porting from I/O bind book of MZ-80 use of research.
    This is not redistributable.





    Zip file :XBlunar.zip

    2013/07/05

    SAMPLE:New theory!? The game of Peach Boy




    This is porting from I/O bind book of MZ-80 use of research.
    This is not redistributable.

    Zipファイル :XBmomo.zip

    2013/07/02

    SAMPLE:The underground maximum strategy



    This is porting ftom Oh!X1988/9. This is not redistributable.

    Zipファイル :XBsnake.zip

    2013/06/23

    SAMPLE:simulate the physical behavior of the spring.

    It is the program to simulate the physical behavior of the spring.
    // http://d.hatena.ne.jp/x68000forever/20101123/1290520018 より
    // 画面初期化 / screen initialize
    apage(0)
    wipe()
    vpriority(TPAGE,SPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3)
    vpage(B_TPAGE+B_SPAGE+B_GPAGE0)
    gborder(1,CTHYELLOW)
    int by=0
    switch deviceType()
     case DEVICE_IPODTOUCH: // iPod touch
     case DEVICE_IPHONE: // iPhone
     case DEVIDE_IPHONE_SIMURATOR
      width(40)
      by=32
    endswitch
    //
    int c1,c2,t
    float l1,l2,l3,k,m
    float a,b,c,w1,w2,w3,xx1,xx2,xx3,x1,x2,x3,r2=1.4142135623731#
    //
    print localizedString("変位1=","Displacement1=");:input l1
    print localizedString("変位2=","Displacement2=");:input l2
    print localizedString("変位3=","Displacement2=");:input l3
    print localizedString("バネ定数=","Rate of spring=");:input k
    repeat
     print localizedString("質量(>0)=","Mass(>0)=");:input m
    until m>0
    //
    w1=pow((2-r2)*k/m,0.5#)
    w2=pow(2*k/m,0.5#)
    w3=pow((2+r2)*k/m,0.5#)
    a=(l1+r2*l2+l3)/4
    b=(l1-l3)/2
    c=(l1-r2*l2+l3)/4
    //
    c1=x68Color2iOSColor(61376):// hsv(30,31,31))
    c2=x68Color2iOSColor(55358):// hsv(100,31,31))
    gColor(c2)
    line(  0,288+by,511,288+by)
    gColor(c1)
    line(130,285+by,130,291+by)
    line(255,285+by,255,291+by)
    line(380,285+by,380,291+by)
    sp_clr()
    sp_disp(0)
    sprite_pattern():sprite_pallet()
    sp_disp(1)
    //
    repeat
     x1=a*cos(w1*t)+b*cos(w2*t)+c*cos(w3*t)
     x2=r2*a*cos(w1*t)-r2*c*cos(w3*t)
     x3=a*cos(w1*t)-b*cos(w2*t)+c*cos(w3*t)
     locate(0,5):print "t=";t
     locate(0,6):print "x1=";x1,"x2=";x2,"x3=";x3
     xx1=130+x1:xx2=255+x2:xx3=380+x3
     locate(0,7):print "xx1=";xx1,"xx2=";xx2,"xx3=";xx3
     sp_halt(YES)
     sp_move( 0,xx1-16,256+by, 0)
     sp_move( 1,xx1   ,256+by, 1)
     sp_move( 2,xx1   ,272+by, 2)
     sp_move( 3,xx1-16,272+by, 3)
     sp_move( 4,xx2-16,256+by, 4)
     sp_move( 5,xx2   ,256+by, 5)
     sp_move( 6,xx2   ,272+by, 6)
     sp_move( 7,xx2-16,272+by, 7)
     sp_move( 8,xx3-16,256+by, 8)
     sp_move( 9,xx3   ,256+by, 9)
     sp_move(10,xx3   ,272+by,10)
     sp_move(11,xx3-16,272+by,11)
     sp_halt(NO)
     if t=0 then wait(1)
     t=t+1
     wait(0.1)
    until t>1000
    end
    //
    func sprite_pattern()
     int i,j
     dim char sp1(255),sp2(255),sp3(255),sp4(255)
     sp1={
      0,0,0,0,0,0,0,0,0,0,4,4,4,4,5,5,
      0,0,0,0,0,0,0,0,4,5,5,5,5,5,6,6,
      0,0,0,0,0,0,0,4,5,6,6,6,6,6,6,6,
      0,0,0,0,0,4,5,6,6,6,6,7,7,7,7,7,
      0,0,0,0,4,5,6,6,7,7,7,7,8,8,8,8,
      0,0,0,4,5,6,7,7,7,8,8,8,8,8,9,9,
      0,0,4,4,6,6,7,8,8,8,8,9,9,9,9,10,
      0,0,4,5,6,7,8,8,9,9,9,9,10,10,10,10,
      0,4,4,6,6,7,8,9,9,10,10,10,10,11,11,11,
      0,4,5,6,7,8,8,9,10,10,11,11,11,11,12,12,
      4,5,6,6,7,8,9,9,10,11,11,12,12,12,12,13,
      4,5,6,7,7,8,9,10,10,11,12,12,13,13,13,13,
      4,5,6,7,8,8,9,10,10,11,12,13,13,14,14,14,
      4,5,6,7,8,8,9,10,11,11,12,13,14,14,15,15,
      4,6,6,7,8,9,9,10,11,12,12,13,14,15,15,15,
      5,6,6,7,8,9,10,10,11,12,13,13,14,15,15,15
     }
     sp4={
      5,6,6,7,8,9,10,10,11,12,13,13,14,15,15,15,
      4,6,6,7,8,9,9,10,11,12,12,13,14,15,15,15,
      4,5,6,7,8,8,9,10,11,11,12,13,14,14,15,15,
      4,5,6,7,8,8,9,10,10,11,12,13,13,14,14,14,
      4,5,6,7,7,8,9,10,10,11,12,12,13,13,13,13,
      4,5,6,6,7,8,9,9,10,11,11,12,12,12,12,13,
      0,4,5,6,7,8,8,9,10,10,11,11,11,11,12,12,
      0,4,4,6,6,7,8,9,9,10,10,10,10,11,11,11,
      0,0,4,5,6,7,8,8,9,9,9,9,10,10,10,10,
      0,0,4,4,6,6,7,8,8,8,8,9,9,9,9,10,
      0,0,0,4,5,6,7,7,7,8,8,8,8,8,9,9,
      0,0,0,0,4,5,6,6,7,7,7,7,8,8,8,8,
      0,0,0,0,0,4,5,6,6,6,6,7,7,7,7,7,
      0,0,0,0,0,0,0,4,5,6,6,6,6,6,6,6,
      0,0,0,0,0,0,0,0,4,5,5,5,5,5,6,6,
      0,0,0,0,0,0,0,0,0,0,4,4,4,4,5,5
     }
     for i=0 to 255
      sp3(i)=sp1(255-i)
      sp2(i)=sp4(255-i)
     next
     sp_def(0 ,sp1)
     sp_def(1 ,sp2)
     sp_def(2 ,sp3)
     sp_def(3 ,sp4)
     sp_def(4 ,sp1)
     sp_def(5 ,sp2)
     sp_def(6 ,sp3)
     sp_def(7 ,sp4)
     sp_def(8 ,sp1)
     sp_def(9 ,sp2)
     sp_def(10,sp3)
     sp_def(11,sp4)
    endfunc
    //
    func sp_color2(pal;int,colX68;int,pb;int)
    // X68の色コードでスプライトの色を設定する / set sprite color by X68 color
     sp_color(pal,x68Color2iOSColor(colX68),pb)
    endfunc
    //
    func sprite_pallet()
     sp_color(  0,    0,1)://sp_color2( 0,    1,1)
     sp_color2( 1, 4229,1)
     sp_color2( 2, 8457,1)
     sp_color2( 3,12685,1)
     sp_color2( 4,19027,1)
     sp_color2( 5,23255,1)
     sp_color2( 6,27483,1)
     sp_color2( 7,31711,1)
     sp_color2( 8,35939,1)
     sp_color2( 9,40167,1)
     sp_color2(10,44395,1)
     sp_color2(11,48623,1)
     sp_color2(12,52851,1)
     sp_color2(13,57079,1)
     sp_color2(14,61307,1)
     sp_color2(15,65535,1)
    endfunc
    
    func str localizedString(js;str,es;str)
     if isLocalizeJapan() then return(js)
     return (es)
    endfunc
    

    Zip archive file: XBetc.zip

    2013/06/18

    SAMPLE : Sinshu

    It is a game like you have seen somewhere.

    I do not write the manual
    You are only going to take the same pattern tiles.

    For iPad only
    Portrait/Landscape both support

    There is a corner-cutting in the calculation process from the touch position to identify the tile.
    Therefore, if you do not touch near the middle of the tile, you will choose wrong tile.
    (CheckPoint ()).

    There is no score and undo.
    Please improve by all means.

    Also this is the iconic sample which indicate indicates that X-BASIC for iOS's sprite is just fit to this level.

    Porting from Oh!X 1988/6.
    It is all rights reserved.
    Zip file :XBsinshu.zip

    July-16/2013
    Update for V2.3's X-BASIC.

    2013/06/16

    SAMPLE : PITMAN


    PITMAN ; X-BASIC for iOS



    Introduction


    This game is for iPad Portrait screen only because of screen size.

    How to play


    The goal of this game is get all gold in the map by manipulate the PITMAN.
    Here are characters and its feature.
    Ladder PITMAN can move to up/down/left/right.
      Gold Can get left or right side only.
    If under goes blank, gold will fall.
      Soil Can dig from left or right side.
    If you dig, it becomes blank and it does not return to the original.
      Rock Can push from left or right side.
    It falls as same as gold.
      Wall Can't move and push. And don't fall.
      PITMAN Hero of this game.
    You fall when below is space. You can jump when upside is space.
    (There is some maps using this jump.)

    Operation in play mode



    Operate by touch key and function keys as shown in the figure below:

    Move PITMAN
     
    [Giveup] Retry this map by reducing one PITMAN.
    Please press when you are trapped.
    [Edit] Enter the edit mode (see below).
    [Next] Go to next map by reducing one PITMAN.
    You can not go when the one PITMAN remaining.
    [Prev] Go to previous map (PITMAN does not decrement).
    [Exit] Exit the game.

    Operation in edit mode



    The edit mode is the mode that edit map data.
    Operate by touch key and function keys as shown in the figure below:

    Move cursor

    [Flag] Erase clear flags.
    [Exchange] Exchange this map and selected map.
    [Erase] Clear this map.
    [Save] Save map data and clear flags. You can set 0 to 3 maps.
    [Load] Load map data and clear flags.
    [Select] Select map
    [Next] Go to next map
    [Prev] Go to previous map
    [Restore] Discard the edited contents and restore this map data.
    [Play] Play from this map.
    The following, select the data to be placed in the map.
    [Space]
    [Ladder]
    [Gold]
    [Soil]
    [Rock]
    [Wall]
    [PITMAN]
    Don't put two or more PITMAN in a map.
    It also does not check the map data of whether no problem. You can also make the map data that can not be solved absolutely. Please be careful.

    Operation in selection mode


    If you push [Select] or [Exchange] in edit mode, you can select a map from list.

    Operate by touch key and function keys as shown in the figure below.
    Or you can select map directly with touching of map.

    Move cursor

    [Determine]Determine map
    [+10] Display next 10 maps.
    [-10] Display previous 10 maps.
    [ESC] Escape from selection.

    Such as convention


    1. Reproduction is prohibited.
    2. Any problem was caused by using this program, I do not care.
    3. This sample has been not-high dare perfection. Please improve in everyone by all means. For example it will be full touch operation. If you done, please send me.
    4. Please send me your impressions.
    Porting from Oh!MZ 1985/11(PIT-MAN2000)
    Original Oh!MZ 1985/8

    Zip File :XBpit.zip

    Bug information:
    2013/06/22
    Edited map and clear information file was not written correctly.
    I am up a modified version, but only rewrite fopen(~, "w") to "c".