Jump to content
IGNORED

U-BASIC


drac030

Recommended Posts

Last Sunday I did the following:

 

1) grabbed the source code of the Atari BASIC rev. C

 

2) split it in two blocks, reassembled everything for addresses $C000-$CBFF and $E400-F7FF

 

3) added the so called FASTCHIP, the fast FP package written by Charles Marslett

 

4) wrote a bit (around 1k) of wrappers and initializing code

 

Since Sunday I also sat at it twice or thrice to do some debugging.

 

And here it is: http://drac030.krap.pl/en-ub-pliki.php

 

U-BASIC, i.e. the plain vanilla Atari BASIC, but prepared to run under the OS ROM. As a result, it gives about 8k more memory for programs than the standard one. Like here under SDX:

 

ubasic.png

 

or here under MyDOS:

 

mydos-ubi.png

 

For comparison, here is the standard Atari BASIC under the same MyDOS:

 

mydos-ab.png

 

U-BASIC is also a bit faster thanks to the fast FP package mentioned above.

 

Occupies 109 bytes in the main memory (always directly over the memlo). Appears to work.

Edited by drac030
  • Like 26
Link to comment
Share on other sites

I thought the floating point package was part of the OS and not BASIC. How does this change the FP, and how does it relate to systems that already have a replacement FP? This is a very cool little project. It intrigues me.

U-BASIC sits in the RAM under ROM, so the OS FP will be switched out when U-BASIC is running. Unless things were changed so that ROM is reinstated before the FP is called, the RAM based FP will always be used by U-BASIC.

Link to comment
Share on other sites

Exactly. But the FASTCHIP there is not recompiled (in fact, I just used a binary version of it, and it sits in RAM at $D800), so it should be fairly simple to prepare a version of U-BASIC which instead of using own FP package, copies one from ROM.

Edited by drac030
  • Like 2
Link to comment
Share on other sites

Afaik,

 

there is also "Basix" (spelling?) available, it is Atari Basic Revision C and gives you additional 12kbytes RAM under the OS for programming. Thus instead of 32kbytes for programming you now have 44kybtes - but no fast FP...

 

Want more Basic`s ?!? How about compilers, linkers, runtime, enhancements, etc:

- Atari Basic Rev. A - Advan Basic Compiler

- Atari Basic Rev. B - ABC

- Atari Basic Rev. C - SSS compiler

- Advan Basic - MMG compiler

- Microsoft Basic - TB XL compiler + runtime

- Microsoft Basic II - CTB-linker

- Altirra Basic - BAS-linker (by Antic or Analog)

- Basix - BAS2COM (by Raster)

- Hypra-Soft-Basic - BAS2BIN (by Antic or Analog)

- Turbo-Basic XL - Baslink (by Raster)

(various versions) - XE-Basic (AB enhancement? by Tajemnicze Atari)

- Multi-Basic - JLS Basic compiler

- Fast Basic - extended AB

- Basic XL - extended TB XL

- Basic XE - BasWedge

- OSS Basic A+ - BXL runtime (only to execute BXL programs)

- a few more I guess - various Basic enhancements (approx. 30 in my collection)

 

Nowadays I prefer Basic programs written either in Atari Basic or TB XL. At the moment I am adding Altirra Basic to most AB programs to execute them faster and to shorten the initialization time (but when the programs get too fast, I add a file version of Atari Basic). Furthermore I prefer having a Basic with Autorun function, like e.g. Autorun.BAS under TB XL, so I can put the Basic dialect onto a disk (disk-image) and add the program which will then run/execute automatically.

 

Attached are eight Basic dialects which do contain an Autorun function (mostly done by Fandal, one or two maybe by Homesoft). Even Atari Basic Rev. A and Rev. C on that disk-image do support an autorun function. All these Basic dialects come with short info-texts (afair) in english language (and/or bad grammar and spelling, since they were written by me)...

 

Please note: Altirra Basic has not been updated yet on that image to the newest version 1.45 (think there is still V1.44 or an older one on the image)...

Basics.zip

Edited by CharlieChaplin
  • Like 4
Link to comment
Share on other sites

 

 

there is also "Basix" (spelling?) available, it is Atari Basic Revision C and gives you additional 12kbytes RAM under the OS for programming.

 

That is certainly interesting and doable, but I do not think that it is a good idea. Just imagine x=usr(adr(a$)) when a$ happens to be under the ROM and contains 6502 instructions like jsr $e456.

 

 

 

I prefer having a Basic with Autorun function, like e.g. Autorun.BAS under TB XL, so I can put the Basic dialect onto a disk (disk-image) and add the program which will then run/execute automatically.

 

In SpartaDOS X type this at command prompt:

 

ECHO RUN"D:FOOBAR.BAS"|UBI

 

and it will autoload the specified program. If this is too much typing, a batch file should solve the problem.

  • Like 3
Link to comment
Share on other sites

Revision 1.3 available for download here: http://drac030.krap.pl/pl-ub-pliki.php

 

Changes:

 

* the text of a program can now be typed in lower case

* forward GOTO/GOSUB jumps (which includes GOTO jumps to the same line) should now be faster

* the interpreter now tries to load and run "D:AUTORUN.BAS" at startup

* if the DOS underneath offers the DOS XL/SpartaDOS-compatible command line interface, doing this:

 

UBI FOOBAR.BAS

 

will cause the interpreter to attempt to load and run "D:FOOBAR.BAS" instead of the default "D:AUTORUN.BAS"

 

EDIT: and it now occupies only 68 bytes in the main memory (over the MEMLO).

Edited by drac030
  • Like 4
Link to comment
Share on other sites

* if the DOS underneath offers the DOS XL/SpartaDOS-compatible command line interface, doing this:

 

UBI FOOBAR.BAS

 

will cause the interpreter to attempt to load and run "D:FOOBAR.BAS" instead of the default "D:AUTORUN.BAS"

 

Oooooh, very slick.

 

Q: does it automatically disable the built-in XL/XE BASIC when it runs, similar to TurboBASIC XL?

Link to comment
Share on other sites

It should have but it did not :D Also I forgot about restoring the BASIC state at exit.

 

Here is a new version: http://drac030.krap.pl/ubi14.arc

 

I tried it under MyDOS and when the computer was booted with BASIC enabled, I was able to switch between Atari BASIC and U-BASIC.

Edited by drac030
  • Like 3
Link to comment
Share on other sites

I thought the floating point package was part of the OS and not BASIC. How does this change the FP, and how does it relate to systems that already have a replacement FP? This is a very cool little project. It intrigues me.

 

If someone wants to use the U-BASIC with a ROM-based FP, please start U-BASIC and run this program:

10 FOR X=1536 TO 1564
20 READ A:POKE X,A
30 NEXT X:X=USR(1536):END
100 DATA 104,168,133,212,169,216,133
110 DATA 213,162,8,177,212,206,1,211
120 DATA 145,212,238,1,211,200,208
130 DATA 243,230,213,202,208,238,96 

It copies the ROM area $D800-$DFFF (= FP package) to the RAM below, replacing the U-BASIC's FPP with whatever is in ROM. It should also work with replacement FP packages as long as they fit completely in $D800-$DFFF and $CC00-CFFF (that last area - CHARSET 2 - is copied by U-BASIC at startup).

 

PS. The program, when run with any other BASIC interpreter, will probably just crash.

Edited by drac030
  • Like 2
Link to comment
Share on other sites

 

Attached are eight Basic dialects which do contain an Autorun function (mostly done by Fandal, one or two maybe by Homesoft). Even Atari Basic Rev. A and Rev. C on that disk-image do support an autorun function. All these Basic dialects come with short info-texts (afair) in english language (and/or bad grammar and spelling, since they were written by me)...

 

 

Thanks for this image, but when I start it in Altirra, I'm not sure what to do with it. The disk boots to a DOS 2.5 menu. I can <L>oad some of the COM files, but then it shows a FILE NOT FOUND! error, What is the proper way to load a particular version of BASIC, or know what one you are currently using?

Link to comment
Share on other sites

 

Thanks for this image, but when I start it in Altirra, I'm not sure what to do with it. The disk boots to a DOS 2.5 menu. I can <L>oad some of the COM files, but then it shows a FILE NOT FOUND! error, What is the proper way to load a particular version of BASIC, or know what one you are currently using?

 

Haha,

thats funny !! When you see the "File not found!" error, the Basic language you want has already loaded and executed a sample Basic file (its the Basic file that prints "File not found" on the screen). Type LIST or NEW and you can start programming (except with Basic XL runtime, which does not allow this, it will only execute BXL files) or start loading any Basic file you want.

 

The sample Basic file does nothing more than trying to a) display a Gr. 2 text-title and b) load another Basic file (if its not there, it prints the Error message "File not found" on the screen). I use this short Basic program to execute a game or an application and while the program gets loaded, a text-title gets shown. Of course I have to edit this short Basic file for every new program I want to load with it (change the text-title and change the filename for the file I want to load)...

 

Here is what you should do to use one of these Basic versions (note: the Basic XL runtime will only execute a BXL program, you cannot edit or list the BXL program in any way):

 

1) format/create a new disk or disk-image

2) write DOS on that disk or disk-image

3) copy the Basic language you want onto that disk or disk-image; depending on the DOS you are using, you may rename the Basic language to Autorun.SYS to execute automatically

4) copy your Basic program (*.BAS or whatever) onto that disk or disk-image, if you want to have it loaded automatically, rename it like shown in step 5...

5) all eight Basic versions do have a built-in Autorun option, i.e. they will load and execute a Basic program automatically:

a) Atari Basic Rev. A: use Autorun.ABA for your Basic file to auto-execute

b) Atari Basic Rev C: use Autorun.ABS for your Basic file to auto-execute

c) Basic XL: use Autorun.BXL for your Basic file to auto-execute

d) Hypra-Soft-Basic: use Autorun.HSB for your Basic file to auto-execute

e) Basix: use Autorun.BSX for your Basic file to auto-execute

f) Fast Basic: use Autorun.FBA for your Basic file to auto-execute

g) Turbo Basic XL: use Autorun.TBS for your Basic file to auto-execute

h) Altirra Basic: use Autorun.AIB for your basic file to auto-execute

6) When done, boot the disk or disk-image; it should load DOS, then the Basic language (or dialect), named Autorun.SYS and then your Basic program, named Autorun.*. You may also want to change/edit the Gr.2-text title in front of the Basic language, because it currently displays "Here comes the title". Use a disk/sector-editor and change it to a title you want (with max. 20 chars.!)

 

(Instead of a Basic program, e.g. a single game or application, you may also copy a menu or a title-screen on the disk and name it Autorun.* to execute automatically...)

 

Some Basic languages (or dialects) will simply show a READY screen when the Autorun.* file is not there, some will print an error message and some will lock up or try endlessly to find&load the Autorun file...

 

Attached is a sample disk with the game "Valiant" and an old version of Altirra Basic executing it. When you see the text title "Valiant" for the first time (yellow) then Altirra Basic is loading, when you see it for the second time (orange), then the Basic program is loading. You may press the Break key, when you see the orange title and then type LIST - you will see the short Basic program that displays the title, loads the game and also contains the "File not found" error message...

valiant.zip

Edited by CharlieChaplin
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

So, noone has complained for over a year, so I guess everything works :D and it is time for a new version. So, here you are, U-BASIC v.1.6:

 

http://drac030.krap.pl/en-ub-pliki.php

 

The changes:

 

* RND function reworked to get rid of the FP division, and to make it more compatible with accelerated machines.

* command line parser fixed to be compliant with the DOS XL documentation.

* string variables and numerical arrays may now exceed 32768 bytes: statements like DIM A$(40000) no longer cause an error (assuming there is so much free RAM, of course).

* a check for an overflow added in the routine that calculates the size of numeric arrays.

* added a DIR statement to be used in the direct mode (see README.TXT for details).

  • Like 7
Link to comment
Share on other sites

  • 4 weeks later...

I have uploaded a new version of U-BASIC to my website (link above). Version 1.7 has changes as follows:

 

1) main memory usage reduced to 43 bytes (52 in 1.6)

 

2) at startup added loading a configuration file (UBI.CFG). In SpartaDOS X it is first searched in $PATH, then again in the current directory (so you can have global and local settings).

 

3) the memory contents will now be dumped to UBI.SAV file when exiting to DOS. This file will be loaded at next startup. This mechanism can be disabled in the UBI.CFG file.

 

4) SAVE/CSAVE will now silence the sound channels after being executed from within a program.

 

Have fun.

Edited by drac030
  • Like 8
Link to comment
Share on other sites

Some slight flickering during IO and not often. U1M at 1088K Ultimate build SDX449b.

 

Large amount of flickering during IO with U1M at 1088K MyIDE 2 cartridge with SDX449b-myide512.

 

I really like the UBI.SAV. , but I have not got any luck yet with autorun=1 and autoname=d:myfile.bas

Link to comment
Share on other sites

memsav=1 (i.e. saving/loading the UBI.SAV) overrides the autorun=1, i.e. disables it.

 

About the flicker: does it occur while I/O is being done by a BASIC program? I.e. during SAVE, LOAD, PUT, GET etc. If so, could you post a program to reproduce it?

Edited by drac030
Link to comment
Share on other sites

The only time I see any Flickering is if I do the ECHO thing to start a basic program.

"ECHO thing"? Could you elaborate so that I could reproduce the effect here?

 

Also, a flicker may be caused by opening a file with $PATH searching, because this needs the SDX cartridge to get enabled for a moment. One can reproduce this in TBXL by executing this:

 

10 OPEN #1,$24,0,"D:FOO.BAR":CLOSE

Link to comment
Share on other sites

 

In SpartaDOS X type this at command prompt:

 

ECHO RUN"D:FOOBAR.BAS"|UBI

 

and it will autoload the specified program. If this is too much typing, a batch file should solve the problem.

This is the ECHO thing I have been doing recently, but have now stopped using in favor of the UBI.CFG. I have the Global cfg in the $PATH and a local cfg in my basic folder..

Link to comment
Share on other sites

I see. But this ECHO thing has not been necessary since version 1.3, it is just enough to type this:

 

UBI FOOBAR.BAS

 

and the specified program will get automatically loaded and started. See post #9. The ECHO stuff was only a workaround for the lack of this function in the versions earlier than 1.3.

Edited by drac030
  • Like 3
Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...