Jump to content

XBasic

0% developed
From Wikibooks, open books for an open world


XBasic
An open source GUI Basic with identical code for Windows and Linux

Components

[edit | edit source]
  • Editor (writing computer code)
  • Compiler (creating code)
  • Debugger (checking for errors)
  • Libraries (ready made 'internal' code to call on)
  • GuiDesigner (creates the 'look and feel' of the program)
  • Signed and unsigned 8-bit, 16-bit and 32-bit and signed 64-bit integers
  • 32- and 64-bit floating point values. The string datatype is only for 8-bit characters.
  • Generates an assembly language file.
  • XBasic has a Windows only version called XBLite
  • SourceForge development

XBasic Programming Language

[edit | edit source]

Chat using the java chat

[edit | edit source]

[click here to join forum]

senior XBasic developers will be there to take your praise and questions (have them ready)

Attending: (senior Developers) Vic, Eddie, Steve

just click on edit to add your name to say you will be attending

Time: Starting Sunday at Sept 19 2004 at 1600 GMT

Then every 3rd Sunday of the month

Next meeting Sunday November 21 2004

History

[edit | edit source]

XBasic is a variant of the BASIC programming language. Xbasic was developed in the late 1980s for the Motorola 88000 CPU and Unix. In the early 1990s XBasic was ported to Windows and Linux. Since 1999 it has been available as Open Source software.

Making a Standalone Executable

[edit | edit source]

XBasic programs can be compiled to create an executable just by double-clicking the program's MAK file. The following method works for XBasic V6.2.0 and above, in Windows 95; it should also work with later Windows versions.

The setup needs to be done only once. In all of the following, replace '\XBasic with the path to your XBasic directory.

1. Using a text editor (Notepad will do), put the following lines in your AUTOEXEC.BAT. Do not put any spaces or tabs around the "=".

SET XBDIR=\XBasic

SET PATH=%XBDIR%\bin;%PATH%

SET INCLUDE=%XBDIR%\include;%INCLUDE%

SET LIB=%XBDIR%\lib;%LIB%


If the path to your XBasic directory contains spaces (eg., \Program Files\xb), then it may be necessary to use quotes around the paths, as for example

SET PATH="%XBDIR%\bin";%PATH%


These lines should be placed after any existing definitions of the PATH, INCLUDE, or LIB variables. Save the edited AUTOEXEC.BAT, and re-boot.

2. Make sure the following files are in the appropriate XBasic directories:

\XBasic\bin

    spasm.exe     nmake.exe     link.exe

\XBasic\include

    xbasic.mak

\XBasic\lib

    xstart.o, and all RESOURCES, STDLIBS, and LIBS listed in xbasic.mak and in your own .mak file:
    advapi32.lib comdlg32.lib gdi32.lib kernel32.lib msvcrt.lib user32.lib winspool.lib xb.lib
    xb.rbj
    (There will be more if your program IMPORTs anything other than these libraries or the standard XBasic libraries.)

3. Create the text file NMAKE.BAT, containing the following line

"%XBDIR%\bin\nmake.exe" %1

and save it - for example, in the \XBasic\bin directory. The quotes are only necessary if your XBasic directory path contains spaces (eg., \Program Files\xb). The purpose of this BAT is just to keep the DOS window open when nmake.exe has finished, so you can see results of the compilation.

4. From Explorer's View menu, select Options, then File Types to associate MAK files with NMAKE.BAT. Make this the Default association for this file type.

If you aren't familiar with this procedure, then an alternative is to double-click any .mak file. An "Open With" dialog will appear, asking you which program you want to use to open .mak files. Click "Other", then go to the folder containing nmake.bat, and select it. Also, make sure the checkbox 'Always use this program to open this file' is checked.


This completes the setup. Now whenever you want to create an EXE, just select 'assembly' from the 'run' menu in the PDE - which creates the .s and .mak files - then double-click the .mak file. Or, run XBasic from the command line, using the command xb myprogram.x. Create a DLL the same way, but select 'library' from the 'run' menu instead (or run xb myprogram.x -lib). (For more information on making a DLL, see Multiple Module Programs.)

One hint: Save the .x source before creating the .s and .mak files, not after. If the source is saved after the assembly (.s) file is created, then nmake will see the .s file as being older than the .x file, and will invoke xb.exe to re-compile the .x.

When running your EXE, remember that you should have copied xbrun.dll into your \Windows folder, and re-named it xb.dll. Also, you can run the EXE from any folder except the XBasic\bin folder; if you run it in this folder, it will link to the wrong xb.dll, and start up the PDE instead of running your program.

Collaborative Project

[edit | edit source]

please add your contributions

Here is how : Help:Editing

Is Opensource the best place for collaborative projects? I am sure there must be simpler tools?

Idea 1

[edit | edit source]

Xbasic on a USB stick (and/or self booting CD)

I recently put Puppy Linux on a 64 meg USB stick

Maybe a dual booting CD (Linux and Windows)

ReactOS that is developing an Open Source

Windows NT)

Idea 2

[edit | edit source]

XBasic Wizards

One of the things we hear on the forum again and again

is I have just started etc

How do I etc

Well how about a list of questions

and paremeters set and then the required functions are added

This would mean that nay code we are familiar with could be added

Idea 3

[edit | edit source]

. . . Your idea here . . .

Code examples

Look here to see some screenshots of projects completed using XBasic. These are programmes developed for airlines in Iceland by Stefan Saemundsson:

XBasic Program screenshot

XBasic another program screenshot


add your links here

Future Developments

[edit | edit source]

A regularly updated XBLite is a Windows only version which aims to use the API of Windows to reduce the code size.

A new update of Xbasic is expected before the end of 2004

A new version XBasic 2 that generates C code rather than assembler is also being created.

[edit | edit source]