Jump to content
IGNORED

BASIC to XEX?


Mr Robot

Recommended Posts

Here's one from this years compo, it contains ATASCII characters so I can't print it here so I've included a screenshot and the bas file.

 

Most of the tenliners files are TBXL but there are some atari BASIC and some fast BASIC entries as well. I'd be happy if they all ran in TBXL if that makes it more possible, I can't imagine they would suffer much from running faster!

 

Screenshot 2019-12-30 at 18.20.33.jpg

BOUNCE.BAS

Link to comment
Share on other sites

Well,

 

for Atari Basic files there exist several programs to convert them into XEX without compiling them, e.g. Raster's Bas2COM utility (A8) or Fandal's BAS2XEX.EXE (PC, 16 Bit or 32Bit). If I remember correctly, Raster's BAS2COM is limited to max. 28kb or 30kb. Of course you can also use a Basic compiler like ABC or MMG or something like that.

 

I doubt that Fast Basic programs will run under TB XL, since e.g. they have no line numbers and there are surely FB commands that are unknown to TB XL. But FB itself has a compiler, use it to create stand-alone XEX files.

 

To create XEX files from TB XL programs a) compile them with the TB XL compiler to create a CTB file, then b) use the CTB-linker to link the Runtime and the CTB file into one stand-alone file (11k longer as the original file, since the Runtime is 11k). Due to several compiler errors, not all TB XL files (or TB XL commands) can be compiled and errm, not all CTB files will run correct after linking with the runtime as stand-alone files (or I am simply too stupid to create working files of all of them).

 

If you create e.g. ten files with the CTB-linker, you will have at least 10 x 11kbytes additional filelength, maybe it would be better to simply create a DOS 2.x disk with a menu (created with the CTB-linker) then that contains menu+runtime in one file and then displays and loads all *.CTB files ? That way you would require the Runtime only once. I have a simple Basic menu that displays and runs all *.BAS files, all you have to do is change one line in the listing (from *.BAS into *.CTB), compile it with the TB XL compiler and link it with the runtime with the CTB-linker. The menu will then display and load all CTB files (if interested, I can upload it tomorrow)...

 

BAS2XEX.zip BAS2COM.xex CTB_LINK.ATR

  • Like 3
Link to comment
Share on other sites

@CharlieChaplin thank you for that, it's exactly what I was looking for! I knew it had to exist but didn't have the vocabulary to find it.

 

I plan to make a MyPicoDos disk with a directory for each year so the extra 11kb per file won't be an issue. I could make a menu but with mypicodos I can have long file names and subfolders which is about perfect for this.

2 hours ago, erichenneke said:

with several basic 10 liners already converted to xex

I know Homesoft (@nobody) has done some of of the tenliners but hasn't done all of them, I'd like this to be the complete set (updated each year with the new ones) runnable easily by anyone so they get more visibility.

 

  • Like 2
Link to comment
Share on other sites

A warning about timing in games: do not compile a BASIC program if it was designed and build to be run in a given interpreter. A complied version of a game could be unplayable as well as if it is run in another interpreter even when the syntax/tokens match.

 

For Atari BASIC games, the best option is to use any of the utilities that encapsulates a game in an XEX file that loads the game, enables the BASIC ROM and forces the LOAD and RUN statements.

 

But be careful, some tenliners were written with some default settings in mind, so many setup instructions might be omitted to save space. If you change the loading environment, something might not work as desired.

 

About menu disks, I published some compilations in my tenliner's home page. I used simple techniques to load every game in the proper interpreter. You can use them if you want.

 

BTW, using a simple hack, my Bounce & Catch tenliner can be run on TBXL. It runs smoothly and with more realistic bounces, but the game lasts less.

  • Thanks 1
Link to comment
Share on other sites

16 hours ago, Mr Robot said:

Here's one from this years compo, it contains ATASCII characters so I can't print it here so I've included a screenshot and the bas file.

 

 

Screenshot 2019-12-30 at 18.20.33.jpg

BOUNCE.BAS 1.54 kB · 3 downloads

Which editor is that one that splits lines at spaces?

 

To get pretty prints of ATASCII listings, you can always use the online ATASCII Printer. It supports Atari BASIC and TBXL files natively, but you can use any ATASCII program listing to print with all that special chars.

 

  • Like 1
Link to comment
Share on other sites

I wrote a BASIC/TBXL/BASICXL-XE/MAC65 detokeniser in python that spits out an HTML file using an Atari font with all the ATASCII characters mapped correctly, it will also convert plain ATASCII files, and for the listings will optionally add TYPOII checksums to the lines, it's all just an HTML file so it wraps at the browser edge. I intend to put basic listings on my website at some point for people who enjoy typing them in.

 

The detokeniser will also output unicode text, mapping the ATASCII to the closest unicode character available. With the new additions to the unicode standard for retro fonts this will eventually be a two-way process but at present its just one way only.

 

I've noticed a bug in the routine because of this program, I'm not processing tab characters correctly so line 1 isn't right. I'll fix that!

 

EDIT:

Fixed! Here's the code with the TYPO checksums enabled

724326304_Screenshot2019-12-31at14_32_23.thumb.jpg.ece138a99b6027533e10fd6a931234ab.jpg

  • Like 2
Link to comment
Share on other sites

On 12/30/2019 at 10:37 PM, tane said:

Good to hear about such programs. But not always work. With Crash-Tinkle-Tinkle.bas works, with Adventurer (The).bas doesn't.

 

But there is a converter from BAS to ATR: Adventurer (The).atr

 

(For this game there is an error in both bas and atr).

1293750461_TheAdventurer.png.b4c9793fdb7aa886e7e4c57d65df3957.png

 

 

It's called Bas2Boot: bas2boot - BAS to ATR converter.7z

https://www.atarimax.com/jindroush.atari.org/data/asoft/

 

It works under DosBox: it doesn't work under Windows, so it's required DosBox. First a folder must be mounted (example provided in file), an autoexec line can be added at the end to the .conf file also. Then, if there is a "No DPMI error", the file CWSDPMI.EXE (also provided) must be copied to the working folder. Then from the command line convert the .bas to .atr.

 

Edited by tane
Link to comment
Share on other sites

3 hours ago, tane said:

 

But there is a converter from BAS to ATR: Adventurer (The).atr

 

(For this game there is an error in both bas and atr).

 

It's called Bas2Boot: bas2boot - BAS to ATR converter.7z

https://www.atarimax.com/jindroush.atari.org/data/asoft/

 

It works under DosBox: it doesn't work under Windows, so it's required DosBox. First a folder must be mounted (example provided in file), an autoexec line can be added at the end to the .conf file also. Then, if there is a "No DPMI error", the file CWSDPMI.EXE (also provided) must be copied to the working folder. Then from the command line convert the .bas to .atr.

 

 

Hehe,

the Adventurer was a type-in listing from a german magazine named Computronic. The game listing comes in two parts, so it will not load from a bootdisk or gamedos (Error 130 - no DOS or better no D : device when trying to load the second part). Bas2COM and BAS2XEX and similar programs will also not work with multipart or multistage Basic programs...

 

Error130.jpg.eae025d496c93137aabf1f2d0c6d0c30.jpg

 

The solution would be to merge both parts into one stand-alone file and then convert into COM/XEX and that's what Homesoft has already done, you can find the game on disk 364 or directly here: http://www.mushca.com/f/atari/index.php?dl=364|THE_URER

 

Link to comment
Share on other sites

On 12/31/2019 at 2:56 PM, Mr Robot said:

I wrote a BASIC/TBXL/BASICXL-XE/MAC65 detokeniser in python that spits out an HTML file using an Atari font with all the ATASCII characters mapped correctly, it will also convert plain ATASCII files, and for the listings will optionally add TYPOII checksums to the lines, it's all just an HTML file so it wraps at the browser edge. I intend to put basic listings on my website at some point for people who enjoy typing them in.

 

The detokeniser will also output unicode text, mapping the ATASCII to the closest unicode character available. With the new additions to the unicode standard for retro fonts this will eventually be a two-way process but at present its just one way only.

 

I've noticed a bug in the routine because of this program, I'm not processing tab characters correctly so line 1 isn't right. I'll fix that!

 

EDIT:

Fixed! Here's the code with the TYPO checksums enabled

724326304_Screenshot2019-12-31at14_32_23.thumb.jpg.ece138a99b6027533e10fd6a931234ab.jpg

 

Nice!
 

My tool (written in perl) only detokenizes TBXL (and BASIC because this is only a subset of that). I wanted to detokenize MAC-65 files, but then I realized that it was more practical to list assembly output, and it was already doing that. By that time, I'd never seen another BASIC flavor to include in the tool, but I recently thought about Altirra BASIC.

 

For my game, it generates the following 38 columns listing (like in LIST from screen editor):

 

BOUNCE_BAS.PNG.fad3b21b77d8ab30c05fc46007c728b4.PNG

 

As I said in a previous post, many BASIC programs need some system defaults be present when the program starts, specially in tenliners. If you change from Atari BASIC to TBXL, you will get a faster program, but with some defaults changed, like available memory disposition, and you might need to hack the programs a little to be runable.

 

To hack "Bounce & Catch" and run it in TBXL, just assign the value of 48792 to the constant Q in line 1. Do you want a longer lasting game? Increase the max number of bounces for R variable in line 3, or change it to zero for unlimited number of bounces (game ends only when you miss the ball).

 

Have fun!

 

Link to comment
Share on other sites

2 hours ago, vitoco said:

I'd never seen another BASIC flavor to include in the tool, but I recently thought about Altirra BASIC.

If you support BASIC XL you get Altirra BASIC for free as it’s compatible. I haven’t looked at Altirra extended BASIC yet. I’ve added indentation to my detokeniser for tbxl and basic xl/xe as an option as well. 
 

I think I’ll leave the basic variant alone wherever possible, I want things to run as the author imagined. 
 

mypicodos supports running bas files, it will enable/disable basic on XL/XE machines automatically and stuff like that so I only need to make tbxl files into xexs to achieve my goal. The fast basic files are already xex‘s. 

Link to comment
Share on other sites

Many, many, many years ago, I tried to write my own Atari BASIC to EXE converter and I failed... but it didn't mind because I started using TurboBasic XL as a faster interpreter for my utils.

 

Because of this thread, I tried to resume that old project, and with the help of Altirra's debugger, I could do it, at least as a prototype. My "Bounce & Catch" Atari BASIC game is attached in XEX format as an example.  It does not require the BASIC ROM be available because it is turned on automagically, and it can be loaded from DOS or any BOOT menu which does not use page 6. But pressing RESET might give unexpected results.

 

Is this useful? Might I complete the BAS-2-XEX utility to convert any Atari BASIC file to XEX format?

 

BOUNCE.XEX

  • Like 2
Link to comment
Share on other sites

1 hour ago, Mr Robot said:

If it's a tool that runs in linux then yes! That's very useful indeed. I was thinking about converting the TBXL CTB-Linker that @CharlieChaplin posted above to python, but if you're in a coding mood... ;)

 

I wrote the prototype of the tool in Perl, so it is Linux native, but as it only concatenates the mini loader to the tokenized Atari BASIC file, I was thinking about porting it to BASIC and to run it in the Atari! ?

 

Could you post some Atari BASIC games or programs (links to download) you are interested in, in order to test them first and to fix my loader if required?

 

About TBXL linker, I've never tried it, but I remember that it is not just a runtime for the tokenized file but actually a runtime for a pre compiled code, i.e. it runs faster than using RUN in the TBXL editor. Or that is another tool?

 

Link to comment
Share on other sites

1 hour ago, vitoco said:

Many, many, many years ago, I tried to write my own Atari BASIC to EXE converter and I failed... but it didn't mind because I started using TurboBasic XL as a faster interpreter for my utils.

 

Because of this thread, I tried to resume that old project, and with the help of Altirra's debugger, I could do it, at least as a prototype. My "Bounce & Catch" Atari BASIC game is attached in XEX format as an example.  It does not require the BASIC ROM be available because it is turned on automagically, and it can be loaded from DOS or any BOOT menu which does not use page 6. But pressing RESET might give unexpected results.

 

Is this useful? Might I complete the BAS-2-XEX utility to convert any Atari BASIC file to XEX format 

The more the merrier, of course.

 

Is your utility doing something significantly different than BCOM?

Switching BASIC ON, placing the tokenised program to memory, populating page 0 values, and jumping to an unofficial vector in ATARI BASIC ROM, so the program starts?

 

Link to comment
Share on other sites

3 minutes ago, baktra said:

Is your utility doing something significantly different than BCOM?

Switching BASIC ON, placing the tokenised program to memory, populating page 0 values, and jumping to an unofficial vector in ATARI BASIC ROM, so the program starts?

 

 

Nothing different I guess. I never tried BCOM and I don't know how that works. As I said, it was a very old project and I just wanted to solve by myself what I couldn't do then. 

 

BTW, my tool loads the BASIC file at current MEMLO, giving almost all the memory to the BASIC program if it is loaded without DOS. But it might crash if MEMLO is higher than $2000.

 

And it is WIP, so I'm currently testing it for special cases. Do you know about anyone that does not work with BCOM?

 

Link to comment
Share on other sites

9 hours ago, vitoco said:

 

Nothing different I guess. I never tried BCOM and I don't know how that works. As I said, it was a very old project and I just wanted to solve by myself what I couldn't do then. 

 

BTW, my tool loads the BASIC file at current MEMLO, giving almost all the memory to the BASIC program if it is loaded without DOS. But it might crash if MEMLO is higher than $2000.

 

And it is WIP, so I'm currently testing it for special cases. Do you know about anyone that does not work with BCOM?

 

Not that different, in the end. I believe some basic programs not working vere mentioned before. The question is if the emedding tool is guilty or dubious practices in the basic code are.

 

The only problem with some bas2xex tools is that they tend not to work with Altirra BASIC.

Link to comment
Share on other sites

6 hours ago, baktra said:

Not that different, in the end. I believe some basic programs not working vere mentioned before. The question is if the emedding tool is guilty or dubious practices in the basic code are.

 

The only problem with some bas2xex tools is that they tend not to work with Altirra BASIC.

The only mentioned game (The Adventrer) won't work because it requires another program. Fortunatelly someone did a convertion as it was said.

 

After many tests, I found that some of my old games didn't work with my tool. I found that some Atari BASIC programs has some internal tables moved some bytes from were they were supossed to be. I don't know if it is another Atari BASIC bug, but I solved that by allowing my loader to be more dynamic. Now, it even loads "Escape from Epsilon", which suffers from the same "bug", and it is the reason it also fails with raster's BCOM tool.

 

But keep in mind that this tools are intended for Atari BASIC programs, not for Altirra BASIC ones. The idea is to keep those Atari BASIC programs running just like they were designed to be. If you run them in Altirra (Extended) BASIC or TBXL, the experience shoud not be the same, and probably worst. So, if you had changed the ROM chip in your HW (or emulator), unfortunatelly it won't run as it was designed. In that case, a workaround would be to add 8K of extra "ROM data" to the XEX.

 

Link to comment
Share on other sites

On 1/3/2020 at 9:47 PM, vitoco said:

 But pressing RESET might give unexpected results.

 

Is this useful? Might I complete the BAS-2-XEX utility to convert any Atari BASIC file to XEX format?

 

BOUNCE.XEX 1.67 kB · 7 downloads

 

Hmmm,

 

how about adding a Poke 580,1 then (either in the original Basic listing or later to the XEX file) ?!? Pressing Reset should do a nice reboot of your computer then...

 

 

COLDSTA.XEX

Link to comment
Share on other sites

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...