Open ghost opened 4 years ago
Hi!
I see a few commands were removed from Atari Basic. If code is being ported over, there should be a list of in unsupported commands and functions. I see GOTO, GOSUB, and ON (variable) (GOTO GOSUB EXEC) no longer supported. I know the. ON statement can be done with block if. (Or RTS assembly trick).
I am attempting to take a few of my old Atari Basic Games, port over to Fast Basic, and provide as open source samples for help others learn the language.
Thanks!.
I think we could write a documentation "porting Atari BASIC programs", that explains the lack of GOTO/GOSUB and how to re-arrange your programs.
I'm not very good at writing (specially in English), so any help is welcomed!
Have Fun!
Many of the programs I am looking to convert were written in the original Atari Basic, or later ported to Turbo Basic XL, OSS Basic XL / XE. Written before the conventions of Structured Programming became wide spread. Atari Basic does not have ELSE, ENDIF, DO LOOP, WHILE WEND, REPEAT UNTIL. What I have been doing is I LIST the files to disk in a separate ATR in the emulator. Then I use an Atari Disk Utility to extract the files to my PC hard drive. I discovered it is good to use a good Text Editor on your Windows PC. I have been using "PSPAD" and know people using MS Studio Code. I have not had time to make up a syntax file for each of these programs. It does help if your editor has a rectangle block text select as you need to removing line numbers at some point. Before you can delete line numbers, you need to find and GOSUBs and the line number destination. You can either create a name for the new PROC, or just put a letter + underscore + linenumber. Line 1000 becomes PROC S_1000 and replace the Return with ENDPROC. You can always do a find + replace operation later if you want to give your subroutine an actual name with the function it does. Replacing GOTOs is a bit trickier. If its being used to create a loop. Just create a DO LOOP, IF THEN GOTOs. If this creates a loop until condition, replace with REPEAT UNTIL (opposite condition) or WHILE WEND. I hope the information here is a good start if you are planning to make up a document on this subject.
I hope the information here is a good start if you are planning to make up a document on this subject.
Yes, thank you for your that!
Here is what I done so far for documenting conversion to Fast Basic.
Hi!
Here is what I done so far for documenting conversion to Fast Basic.
Thanks!
I will add the text to the Wiki.
Hi!
Here is what I done so far for documenting conversion to Fast Basic.
Added to https://github.com/dmsc/fastbasic/wiki/Converting-to-FastBasic
Thanks!
Most illuminating, but it reads like a Chinglish product manual. Could use some editing.
dmsc, I will be in a position with time to spare so as to be able to help with the manual, wiki, etc. in the very near future.
dmsc, I will be in a position with time to spare so as to be able to help with the manual, wiki, etc. in the very near future.
Thanks!
I think anyone can edit the wiki now.
Have Fun!
Need to update with some of my more recent findings. One is when passing values with a USR call. The first byte that indicates to # of bytes pushed onto the stack is no long present. The values are in reverse order also. Was this intentional? It gets even more a problem when I ported to CC65 and use the C-Stack "sp" pointer to get the values. All the fun we have with using different languages.
Hi!
Need to update with some of my more recent findings. One is when passing values with a USR call. The first byte that indicates to # of bytes pushed onto the stack is no long present. The values are in reverse order also. Was this intentional?
Yes, this makes the parser a lot simpler - it does not need to count arguments - and also allows to directly call OS functions, you can USR to CIOV for example after writing all the values in the IOCB, or call SIOV with all the parameters.
About the order, I think that Atari BASIC passes the parameters in the same order as FastBASIC.
It gets even more a problem when I ported to CC65 and use the C-Stack "sp" pointer to get the values. All the fun we have with using different languages.
Don't use stack parameters with CC65 functions, it is slow and produces a lot more code. It is only needed if the function is recursive. It is much easier to simply define the function as "fastcall", so the argument is placed in the registers A/X, and if you need extra parameters, you can pass them in static variables.
Have Fun!
I see a few commands were removed from Atari Basic. If code is being ported over, there should be a list of in unsupported commands and functions. I see GOTO, GOSUB, and ON (variable) (GOTO GOSUB EXEC) no longer supported. I know the. ON statement can be done with block if. (Or RTS assembly trick).
I am attempting to take a few of my old Atari Basic Games, port over to Fast Basic, and provide as open source samples for help others learn the language.