Fabrizio Caruso Posted September 17, 2019 Share Posted September 17, 2019 I am looking for a fully automatic tool (script/command line) to convert a text file containing an Atari BASIC program into a format that can be loaded by an emulator. Any format better than plain text would do for me. I suppose I need to tokenize the file and them insert it into some xex or atr container. Anyone has a suggestion? Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted September 17, 2019 Share Posted September 17, 2019 Have you used Altirra's copy and paste feature? You should be able to paste the text directly. The other suggestion is to use H: mapping to a folder where you hold the text file. If you edit the file on the PC and so it doesn't use Atari's End-of-Line character ($9B) then you can load the file using ENTER "H6:FILE.LST" 2 Quote Link to comment Share on other sites More sharing options...
Rybags Posted September 17, 2019 Share Posted September 17, 2019 The H: devices with Ascii translation IMO is the best way. Copy/paste direct is real handy but best left for short snippets of several lines or less. And note of course that translation usually doesn't work well when there's embedded control characters in strings etc. 1 Quote Link to comment Share on other sites More sharing options...
baktra Posted September 17, 2019 Share Posted September 17, 2019 Fandal also created a command-line tool for PCs that takes a tokenized BAS file and wraps it in a .xex file. The program runs under Windows and allows to customize the load address. http://a8.fandal.cz/files/bas2xex_32bit.zip Blog post (in Czech, use google translate): http://a8.fandal.cz/blog_2013.php It appears that the resulting .xex files work only with Atari BASIC, but do not work with e.g. Altirra BASIC. This is core of the wrapper routine L0700: ldx #$0D L0702: lda L07F2,X sta LOMEM,X dex bpl L0702 ldx #$FF txs lda #$A9 pha lda #$79 pha lda #$0A sta L00C9 lda #$00 sta BOOT sta BASICF lda #$FD sta PORTB lda #$B7 pha lda #$54 pha lda RAMTOP bpl L072F lda #$A0 L072F: sta RAMTOP jmp LEF94 Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted September 17, 2019 Author Share Posted September 17, 2019 I do use copy and paste but I want to make a release of my game into a standard format that is loaded immediately by the emulator such as xex, atr, etc. How can I convert the text file into a tokenized basic file to be converted into xex? Quote Link to comment Share on other sites More sharing options...
xxl Posted September 17, 2019 Share Posted September 17, 2019 maybe the solution would be to compile the Basic program and link to the runtime library? you'll get a regular binary file. Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 17, 2019 Share Posted September 17, 2019 Hi! 26 minutes ago, Fabrizio Caruso said: I do use copy and paste but I want to make a release of my game into a standard format that is loaded immediately by the emulator such as xex, atr, etc. How can I convert the text file into a tokenized basic file to be converted into xex? You need two steps: Tokenizing the source text to the Atari format (.BAS). You can do this step using my tool: https://github.com/dmsc/tbxl-parser/releases, it supports TurboBASIC but if you only use statements valid in Atari BASIC it will work. But, as TurboBasicXL is a lot faster, you could take advantage of the extra speed. Storing the BAS inside an ATR with an auto-run stub. - If using TurboBasicXL, this is easy as you simply need an ATR with DOS and the interpreter (named "AUTORUN.SYS" so it auto loads) and your program file named "AUTORUN.BAS". - If using Atari BASIC, you need a stub that does the same, I have used this: https://www.atarimax.com/jindroush.atari.org/asoft.html , attached is an AUTORUN.SYS that you can copy which runs AUTORUN.BAS on start, also attached is an ATR with DOS25 and the tool, just copy your BAS file inside and it will run at boot. But, if you are writing a new program, you could use my FastBasic that produces Atari executables directly Have Fun! autobasic.atr autorbas.asm AUTORUN.SYS Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted September 17, 2019 Author Share Posted September 17, 2019 @dmsc Thanks! I don't understand how to create the ATR file that runs my .BAS program. What do I need from https://www.atarimax.com/jindroush.atari.org/asoft.html ? I see a list of tools. How do I use the ATR and SYS and my tokenized .bas BASIC file? I suppose ATR is a disk image and SYS is a program that I have to store inside the ATR file. I then need a tool to store the .bas and .sys inside ATR. Which tool and how? I would like to create an automatic procedure (a script that runs the necessary tools with the right parameters). Thanks Quote Link to comment Share on other sites More sharing options...
Irgendwer Posted September 17, 2019 Share Posted September 17, 2019 48 minutes ago, Fabrizio Caruso said: I would like to create an automatic procedure (a script that runs the necessary tools with the right parameters). Quote Link to comment Share on other sites More sharing options...
baktra Posted September 17, 2019 Share Posted September 17, 2019 39 minutes ago, Fabrizio Caruso said: @dmsc Thanks! I don't understand how to create the ATR file that runs my .BAS program. If you want to create the disk on PC, you can use the DIR2ATR tool. Extracting DOS.SYS 1. Get an .ATR file with DOS 2.5 2. Create a new PC folder, let us say "c:\atari\my_disk" 3. Setup emulator's H1: device to use "my_disk" and let H1 be read write 4. Using emulator, boot from the .ATR file 5. Use DOS's function for copying files to copy DOS.SYS to the H1: device. Then, you will be able to automatically create your own disk from the my_disk folder with the DIR2ATR utility. 1. Place AUTORUN.SYS from the previous posts to the my_disk folder. 2. Place AUTORUN.BAS to the my_disk folder (this is the tokenized version of your basic program) 3. Place any other files needed by your BASIC program to the my_disk folder Run DIR2ATR: dir2atr.exe -b DOS25 720 "newdisk.atr" c:\atari\my_disk Then when you boot from newdisk.atr, your BASIC program will be executed. 2 Quote Link to comment Share on other sites More sharing options...
+CharlieChaplin Posted September 18, 2019 Share Posted September 18, 2019 (edited) Well, you can try a BAS 2 COM (XEX) conversion with BCOM: a) save your Basic listing in tokenized format (Enter"D:*.LST then Save"D:*.BAS). b) load BCOM by Raster: http://www.atarionline.pl/v01/index.php?ct=utils&sub=4. Programowanie&tg=BCOM#BCOM c) when done, type in source filename of your Basic program (D:Filename.BAS) d) next type in destination filename of your program (D:Filename.XEX) e) choose either "1" to keep the program in its original (listable) form or choose "2" for list protection f) BCOM loads and saves source + destination file to the same disk, so make sure there is enough room for both on the diskette... Your Basic program should have a clear screen and Gr. command (e.g. Gr.0) at the beginning, since the BCOM program does not do that for you. The BCOM program can convert Basic files with a max. size of 28kbytes into a pseudo COM/XEX file, but as always, not all files will work. You can load the program from DOS or gamedos then and afaik, it will enable Basic automatically (on XL/XE with standard Atari OS). If you do not choose list protection, then a simple Break or Reset will stop the program and it can be listed then... Last not least, there is also BAS2XEX (by Fandal, if I remember correctly) which works for me under WIN XP command prompt (there is a 16Bit and 32bit version)... BAS2XEX.zip Edited September 18, 2019 by CharlieChaplin Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted September 18, 2019 Share Posted September 18, 2019 (edited) 20 hours ago, baktra said: jmp LEF94 From: https://atariwiki.org/wiki/Wiki.jsp?page=DiffOldOs2XL Vector Label 800 XL/XE 1200XL E400 E:OPEN F3FC EF94 EEF8 So that could be made a bit more generic Edited September 18, 2019 by Wrathchild added table header Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted September 18, 2019 Author Share Posted September 18, 2019 @CharlieChaplin I don't want to type anything. I need an automatic solution, i.e., only command line commands that I can put into a script. I do not want to open tools nor emulator or click on buttons any single time I want to test a change in a single line. Your solution does what I need but not how I need it: I am coding on the PC and I only use the emulator to test. I need a solution to both easily and quickly load my Basic program and to publish it in a standard format such as xex and/or atr and/or anything standard. Quote Link to comment Share on other sites More sharing options...
Fabrizio Caruso Posted September 18, 2019 Author Share Posted September 18, 2019 @Irgendwer How do I use your tool to convert a pain text file with plain Atari BASIC into a standard format such as XEX or ATR? It looks like your tool is something else. I do not want to use a special editor. Quote Link to comment Share on other sites More sharing options...
Wrathchild Posted September 18, 2019 Share Posted September 18, 2019 Once you've pasted or ENTER'd the code into Altirra then try just save this using: SAVE "H1:FILENAME.BAS" Then pick that file from the mapped folder and distribute that? .BAS files are associated with the emulator and if not can be dragged dropped or opened (to auto run)? Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 18, 2019 Share Posted September 18, 2019 (edited) Hi! Quote @CharlieChaplin I don't want to type anything. I need an automatic solution, i.e., only command line commands that I can put into a script. I do not want to open tools nor emulator or click on buttons any single time I want to test a change in a single line. Your solution does what I need but not how I need it: I am coding on the PC and I only use the emulator to test. I need a solution to both easily and quickly load my Basic program and to publish it in a standard format such as xex and/or atr and/or anything standard. You just need to join all the tools presented above You need: My parser tool: https://github.com/dmsc/tbxl-parser/releases This tools converts a TEXT file (in Atari or PC format) to a BAS file. It also supports a lot of extensions to the language, for example you can include control characters inside strings by giving the hex code, and you can make the program "unlistable". The DOS files of your choice. Recommended are Atari DOS 2.5 (for maximum retro-compatibility), MyDOS (if you need folders), XDOS 2.43 (a simple command line DOS) or BW-DOS (a small advanced, command line DOS). DOS25, MyDOS and XDOS are compatible with DOS2.0 format, so they can inter-operate. BW-DOS is compatible with SpartaDOS-X format, this is an advanced cartridge based DOS. Attached are DOS2.5 files - I will use that as an example. A basic loader, for DOS2.5 it should be named "AUTORUN.SYS" to be loaded at startup. A program to create ATR disks in the format of your choice of DOS. For DOS2.0 and DOS2.5 formats I recommend "dir2atr" tool, download from https://www.horus.com/~hias/atari/ , there you can download versions for Linux and Windows (you did not said which OS you are using). Now, suppose you have my tool ( basicParser ) and the ATR creation tool ( dir2atr ) in the path, you need: Copy DOS.SYS, DUP.SYS and AUTORUN.SYS to an empty folder. Run my tool to output the AUTORUN.BAS file: basicParse myprogram.txt -o path/to/folder/AUTORUN.BAS Run dir2atr to generate ATR image: dir2atr -b dos25 myimage.atr path/to/folder/ Note that in the Atari 8-bit, BASIC is only included in the newer XL/XE models, and there you need to boot without any key pressed to actually load the interpreter. Most emulators boot with the OPTION key pressed to deactivate BASIC, you need to inhibit that - it is an option. And last - the BAS tokenized format *is* (was?) the standard for distributing basic program in the Atari world, people that used the Atari in the eighties will know how to load it. Making a bootable ATR is only a little simpler to the user. Have Fun! autorunbas.zip Edited September 18, 2019 by dmsc Forgot attachment. 1 Quote Link to comment Share on other sites More sharing options...
dmsc Posted September 18, 2019 Share Posted September 18, 2019 Hi! 2 hours ago, Fabrizio Caruso said: @Irgendwer How do I use your tool to convert a pain text file with plain Atari BASIC into a standard format such as XEX or ATR? It looks like your tool is something else. I do not want to use a special editor. Irgendwer tool is just a script ("turban" for Linux/OSX , "turban.bat" for Windows) using my parser tool to automatically create a bootable disk with TurboBasicXL or Atari Basic and your program. It also uses DOS2.5 and dir2atr to create the image. So, it is exactly what you need - but you must read the manual !! 1 Quote Link to comment Share on other sites More sharing options...
sanny Posted September 18, 2019 Share Posted September 18, 2019 Just to add to the options to create tokenized BASIC programs from ASCII input... ? You could also use the atari800 emulator in "basic" mode. In this mode it doesn't open an UI and just uses stdin and stdout. AFAIK no precompiled binaries are available for the "basic" version, so you will need to compile it yourself. Configure the build process like this: ./configure --with-sound=no --with-video=no --disable-riodevice Then create a small text file (script.txt) with the inputs to the emulator, ENTER "H1:INPUT.ASC" SAVE "H2:OUTPUT.BAS" and run the emulator with something like atari800 -basic <path_to>/dos25.atr < script.txt What host dirs are referred to by "H1:" and "H2:" is configured in the atari800 config file. regards, chris 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.