Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported Commands from other Atari Basics #31

Open
ghost opened this issue May 5, 2020 · 11 comments
Open

Unsupported Commands from other Atari Basics #31

ghost opened this issue May 5, 2020 · 11 comments

Comments

@ghost
Copy link

ghost commented May 5, 2020

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.

@dmsc
Copy link
Owner

dmsc commented May 5, 2020

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!

@ghost
Copy link
Author

ghost commented May 6, 2020

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.

@dmsc
Copy link
Owner

dmsc commented May 6, 2020

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!

@ghost
Copy link
Author

ghost commented May 10, 2020

Here is what I done so far for documenting conversion to Fast Basic.

Convert_to_Fast_Basic.zip

@dmsc
Copy link
Owner

dmsc commented May 11, 2020

Hi!

Here is what I done so far for documenting conversion to Fast Basic.

Thanks!

I will add the text to the Wiki.

@dmsc
Copy link
Owner

dmsc commented May 11, 2020

Hi!

Here is what I done so far for documenting conversion to Fast Basic.

Convert_to_Fast_Basic.zip

Added to https://github.com/dmsc/fastbasic/wiki/Converting-to-FastBasic

Thanks!

@flashjazzcat
Copy link

Most illuminating, but it reads like a Chinglish product manual. Could use some editing.

@painintheworld
Copy link
Contributor

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
Copy link
Owner

dmsc commented May 13, 2020

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!

@ghost
Copy link
Author

ghost commented Mar 14, 2021

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.

@dmsc
Copy link
Owner

dmsc commented Mar 14, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants