Menu

Using X11 Basic to unit-test GFA BASIC code on native Atari ST

2015-07-29
2016-10-08
  • Andreas Kotes

    Andreas Kotes - 2015-07-29

    Hi all,

    I'm part of c-base, a Hackerspace in Berlin (see Wikipedia).

    We've got an Atari ST-based cash register that members use to pay
    cashless at the bar.

    So far, everything was done locally on that system, on disk. I'm
    integrating it further with our other systems, and would like to add
    unit-tests to the code while I do it. Developing on the Atari ST
    directly is 'a bit' tiresome, so I've tried to work with X11 Basic
    directly.

    Seems to work fine - mostly. Just some commands don't seem to be
    supported the same way, so I'm getting syntax errors or other problems,
    here are some examples:

    WARNING at line 88: Syntax error: RECALL #1,ANSAGE$(),-1,ANSAGE
    WARNING at line 96: Syntax error: RECALL #1,DISPLAY$(),-1,DISPLAY
    WARNING at line 104: Syntax error: RECALL #1,BANNER$(),-1,BANNER
    WARNING at line 112: Syntax error: RECALL #1,SYSTEM$(),-1,A
    WARNING at line 121: Syntax error: RECALL #1,MAIL$(),-1,MAILMAX
    WARNING at line 203: Wrong number of parameters: EVERY.
    WARNING at line 239: Syntax error: VTAB 21
    WARNING at line 240: Syntax error: HTAB 1
    WARNING at line 526: Syntax error: FORM INPUT 10,ZWEIT$
    WARNING at line 605: Syntax error: FORM INPUT 10,USER$
    WARNING at line 608: Syntax error: FORM INPUT 5 AS DATUM$
    WARNING at line 611: Syntax error: FORM INPUT 5 AS ZEIT$
    ERROR: Assignment to Sysvar DATE$ not allowed.
    ERROR: ==> Syntax error DATE
    ERROR at line 621: variable could not be created.
    ERROR: Assignment to Sysvar TIME$ not allowed.
    ERROR: ==> Syntax error TIME
    ERROR at line 623: variable could not be created.
    WARNING at line 1192: Wrong number of parameters: FILESELECT.
    WARNING at line 1286: Wrong number of parameters: LINE.
    WARNING at line 1315: Syntax error: FORM INPUT 10,A$
    WARNING at line 1327: Wrong number of parameters: EVERY.
    WARNING at line 1609: Syntax error: FIELD #6,30 AS AUTOMAT$
    WARNING at line 1610: Wrong number of parameters: GET.
    WARNING at line 1616: Wrong number of parameters: PUT.
    WARNING at line 1618: Wrong number of parameters: PUT.
    WARNING at line 2326: Wrong number of parameters: RENAME.
    WARNING at line 2335: Syntax error: RESUME START
    WARNING at line 2485: Syntax error: RESERVE -FRE(0)+1024
    WARNING at line 2487: Wrong number of parameters: EXEC.
    WARNING at line 2488: Syntax error: RESERVE
    WARNING at line 2493: Syntax error: RESUME NEXT
    WARNING at line 2525: Syntax error: QSORT SORT$(-),MAX
    WARNING at line 2529: Syntax error: KEYDEF I%,TASTEN$(I%)+CHR$(13)
    WARNING at line 2530: Syntax error: KEYDEF I%+10,TASTEN$(I%)+"#"
    WARNING at line 2532: Syntax error: KEYDEF I%,""
    WARNING at line 2536: Syntax error: KEYPAD &X110010
    WARNING at line 2547: Syntax error: DIR TEXTPFAD$+"*.blx" TO TEXTPFAD$+"dirblx.txt"
    ERROR: Incorrect parameter, must be number
    WARNING: free_parameter, unknown typ $41, PC=0.
    ERROR: Parser: Syntax Error <0>
    : Error in `xbasic': free(): invalid pointer: 0x0000000001cd03b0

    I figure most of the problems (RECALL, VTAB,HTAB, FORM, FIELD, ..) are
    functions that are simply not implemented - some way to stub them for
    testing would be required.

    other than that, some things seem to have different calling conventions
    (EVERY, PUT, GET), which I don't know how to solve?

    assigning sysvars should be overrideable or would need to be IF-ed away.

    it's absolutely essential to me to be able to run the same code in
    native GFA BASIC on the Atari ST and in X11 Basic (on Linux in my case,
    but that shouldn't matter).

    I've already found a way to distinguish the two :) (IF UNIX? doesn't
    work, syntax error on Atari ST)

    IF DIM?(XBIOS)) == 0
    PRINT "Atari"
    ELSE
    PRINT "X11 Basic"
    ENDIF

    Hope you can help :)

    count

    --
    Andreas 'count' Kotes
    Taming computers for humans since 1990.
    "Don't ask what the world needs. Ask what makes you come alive, and go do it.
    Because what the world needs is people who have come alive." -- Howard Thurman

     
  • Markus Hoffmann

    Markus Hoffmann - 2015-07-29

    Hi Andreas,
    well, X11-Basic cannot be 100% compatible to GFA-Basic. The differences are mentioned in one of the chapters of the X11-Basic manual. Also at the moment I do not see an easy way to make some of the GFA-Basic commands stub. Probably one could implement some more. But even conceptually, some of the commands have a different and incompatible syntax. Have you thought of a kind of converter, which converts GFA-Basic programs to X11-Basic? This should not be too difficult. Another converter could convert it back to GFA-Basic.

    To find out, if a program runs under GFA-BASIC one could test for BASEPAGE
    If BASEPAGE>0
    print "GFA-Basic"
    else
    print "X11-basic"
    endif

     

    Last edit: Markus Hoffmann 2015-07-29

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.