Jump to content

Photo

TURBO-BASIC XL-Source Code now in PD and online! :-)))

TURBO-BASIC TURBO-BASIC XL Source Code

76 replies to this topic

#1 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • 641 posts

Posted Tue May 23, 2017 4:58 AM

Hi together!

 
Yesterday was historic, after > 31 years a dream came true, we now have the Turbo-Basic XL - Source Code online in PD with permission from the Ostrowski family. :-)))
 
 
What a time! :-)
 
So, now just 4 are missing here:
 
 
- Atari Assembler Editor
 
- Atari Macro Assembler and Program Text Editor (AMAC)
 
- OSS EASMD
 
- OSS Basic A+
 
to complete the OSS vision, which all started with the Atari Basic Source Book. :-)
 

Any help of any kind, even any hint for this goal is very welcome at any time.

 

With this I would like to say thank you to the community for all the help you gave the AtariWiki. It is you, who made Atari great and who keep Atari great. Thank you all.



#2 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 12,349 posts
  • Location:United Kingdom

Posted Tue May 23, 2017 7:25 AM

Excellent work!

#3 sanny OFFLINE  

sanny

    Chopper Commander

  • 154 posts
  • Location:Bavaria

Posted Tue May 23, 2017 7:25 AM

What assembler was being used? Bibo?



#4 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Tue May 23, 2017 7:34 AM

Yes, it was the Bibo Assembler, as written on the Wiki. But Thorsten Karwoth's Assembler can be tried out, too. ;-)

 

Have fun!



#5 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Tue May 23, 2017 7:40 AM

By the sanny, last week I have applied for a job in Bavaria. :-) If they will hire me, I can and will join the VCFE in Munich each year. :-)



#6 drac030 OFFLINE  

drac030

    Stargunner

  • 1,762 posts
  • Location:Warszawa, Poland

Posted Tue May 23, 2017 7:49 AM

So it seems after all that I was lied to when I was told that the source code did not exist anymore. Well, good that it has emerged.

EDIT: after taking a look, I think it is not the original where the TBXL was built from, but a disassembly. But it is certainly better than nothing :)

Edited by drac030, Tue May 23, 2017 7:56 AM.


#7 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Tue May 23, 2017 8:06 AM

Hi drac030, yes, true for both. I never give up and I never surrender, sometimes this German disease is an advantage. ;-)

 

Did took a look at the source code, yes, it is highly likely from a disassembly, but all major parts are documented. We just wait for an Bibo Assembler generation regarding the object code. The result should be compared with the real code in an editor of modern times. Then we can interbreed and mix the code with the Atari Caculator for doing precise math and so on. I am sure in 2 years, the site will be completely different. -> Ultimate Basic. Even your site and your Basic is a big part in that coming project! Main problem will be the special characters in part 11 in the source code. But even that can and will be overcome. What a time, we live in. :-)))



#8 sanny OFFLINE  

sanny

    Chopper Commander

  • 154 posts
  • Location:Bavaria

Posted Tue May 23, 2017 8:26 AM

By the sanny, last week I have applied for a job in Bavaria. :-) If they will hire me, I can and will join the VCFE in Munich each year. :-)

 

 

Great :-) And we could do some Atari hacking...

 

I'm living ca. 30km away from Munich, but in the recent years I never managed to attend VCFe. But I've been there twice before.



#9 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Tue May 23, 2017 8:36 AM

Cool, then April 2018 is booked now. :-)



#10 dmsc ONLINE  

dmsc

    Chopper Commander

  • 218 posts
  • Location:Viņa del Mar, Chile

Posted Tue May 23, 2017 1:50 PM

Hi!,
 

So it seems after all that I was lied to when I was told that the source code did not exist anymore. Well, good that it has emerged.

EDIT: after taking a look, I think it is not the original where the TBXL was built from, but a disassembly. But it is certainly better than nothing :)


Yes, it is probably a disassembly, and a modified one, the initial text is missing the happy computer logo and writes: "TURBO-BASIC XL 2.0 Update von (12/90)"

Also, another difference is that the "DOS" command is replaced with a simple routine that writes "KEIN DOS" and exits.

#11 peteym5 OFFLINE  

peteym5

    Stargunner

  • 1,640 posts
  • Location:Buffalo NY USA

Posted Tue May 23, 2017 2:41 PM

We probably can port this over to MADS or DASM ASM files so we can modify it and assembly it with a modern PC. Like what would .HX translate to?



#12 vitoco OFFLINE  

vitoco

    Chopper Commander

  • 199 posts

Posted Tue May 23, 2017 3:22 PM

We probably can port this over to MADS or DASM ASM files so we can modify it and assembly it with a modern PC. Like what would .HX translate to?

 

I'd like to see this in MADS. I'll try to parse it and get a full MADS listing.

 

.HX is like .HE in MADS, but MADS requires a space or comma between hex bytes, without "$", and a split every two hex digits is required.



#13 sanny OFFLINE  

sanny

    Chopper Commander

  • 154 posts
  • Location:Bavaria

Posted Tue May 23, 2017 4:26 PM

 

I.HX is like .HE in MADS, but MADS requires a space or comma between hex bytes, without "$", and a split every two hex digits is required.

 

 

"perl" to the rescue :)



#14 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Tue May 23, 2017 5:42 PM

All questions should be answered with the Bibo manual:

Attached File  BIBO Assembler.pdf   288.79KB   41 downloads



#15 ijor OFFLINE  

ijor

    Stargunner

  • 1,814 posts

Posted Tue May 23, 2017 8:46 PM

You are doing an excellent work, but precision is very important here. Please note here and at your web site that this is NOT the source code.

 

It doesn't matter if we can rebuild everything from the disassembly and get an identical binary. Source is something else and has historical significance. It might have invaluable comments that you could never recreate from a reverse engineering work.



#16 vitoco OFFLINE  

vitoco

    Chopper Commander

  • 199 posts

Posted Tue May 23, 2017 10:24 PM

I'd like to see this in MADS. I'll try to parse it and get a full MADS listing.

 
Well, I did it. 
 

"perl" to the rescue :)

 
Of course I used perl  ;)
 
Then I compiled the parsed source and got an XEX that runs.
 

You are doing an excellent work, but precision is very important here. Please note here and at your web site that this is NOT the source code.
 
It doesn't matter if we can rebuild everything from the disassembly and get an identical binary. Source is something else and has historical significance. It might have invaluable comments that you could never recreate from a reverse engineering work.

 
I agree. As dmsc said, this source is not the one for 1.5 but a modified version labeled as 2.0 and just prints a message when DOS command is entered.
 
The attached source is what I got after the parsing. There is no additional formatting, so it is ugly. I guess it should be merged with a disassembly of the actual 1.5 version to transfer comments and labels.
 
Note: I tried one of my TBXL 10-liners which run OK, but I noticed that memory area at $8000 is overwritten when RUN command is executed (garbage appeared over my P/M graphics). That does not happen in 1.5.
 
BTW, I found a small bug in MADS: when a single line has a label, a mnemonic and a MAE-style temporary label that is not declared yet, it produces an error. I had to split in two lines a couple of them and all was fine.

 

EDIT: I changed the ASM...

Attached Files


Edited by vitoco, Tue May 23, 2017 10:35 PM.


#17 vitoco OFFLINE  

vitoco

    Chopper Commander

  • 199 posts

Posted Tue May 23, 2017 11:06 PM

Hum! I tried another of my 10-liners and got an "ERROR-13 ?FOR".  :-o

 

And the same with another one. That's very bad.

 

It might be something I missed when I convert the sources to MADS syntax that got interpreted differently by this assembler.

 

If someone had compiled the source using BIBO, please share the executable to compare the binaries and do some tests with it. Thanks!

 



#18 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Wed May 24, 2017 2:20 AM

@ijor:

You are doing an excellent work, too! A what a one! :-))) Please go ahead. It is a little bit complicated. I intend to follow your arguments, a normal source code is much better documented, but what is normal? I have looked through all 15 parts, each of them are documented and labeled at all major points, so the user gets the picture. Further, I assume (assuming is not knowing of course!), that Frank in 1983 took Bill Wilkinson's book: 'The Atari Basic Source Book' typed it in and then started over 2-3 years his improvements. TB 1.4 was realeased in 12/1985, but version 1.4 was ready much earlier, but later published then version 1.5! Bill's version was already documentated! Further, I am in contact with Torsten Karwoth, author of 130XE+ Makroassembler V2.1 mit MyDOS 4.50 (1991), who had improved Turbo-Basic from version 1.5 on. He told me, that he simply patched the existing 1.5 version... There are these bright guys out there. All comments are in German, the source code was made with a German assembler, I really doubt that the 'Ultimate Disassembler' can do such a job. Therefore, I offer here a mix of source code for real and a disassembled one, which goes more in your direction, up to 60-70% ? Can you live with that? I have already published:

http://atariage.com/...d/#entry3760293

therefore, I don't think it will get any better, with the version we have, we can at least try to make a new start and rebuild it. How such results can end, I have described in the above posting.

 

@vitoco (http://vitoco.cl/atari/):

First, thank you for your work. But there have to be done some changes..., please see the 2 attached pictures. Part 11 of the source code is critical, due to inverse characters. But only there!

We have to take into account the Bibo Assembler:

https://atariwiki.or...=Bibo Assembler

and wait until someone compiles a version out of this. A binary compare with the existing version 2.0 would be cool, further, a compare of the source code with Bill Wilkinson's version out of the original source code from The Atari Basic Book. In the end, we should be able to receive or create a version like Lorenz did with Star Raiders. His version compiled matches 1:1 to the rom version.

 

The AtariWiki gets supported today, so access could be difficult.

Attached Thumbnails

  • original.jpg
  • error.jpg


#19 peteym5 OFFLINE  

peteym5

    Stargunner

  • 1,640 posts
  • Location:Buffalo NY USA

Posted Wed May 24, 2017 6:48 AM

I know people had complained about lack of pmgraphics and not having a ELSEIF statement. Those can be added, but will be leaving less RAM for programming. Give it Basic XE extend abilities. Maybe the turbo basic source can be further optimized to open up some space. This has been one of my favorite goto for optimizing code. https://wiki.nesdev....y_optimisations



#20 flashjazzcat ONLINE  

flashjazzcat

    Quadrunner

  • 12,349 posts
  • Location:United Kingdom

Posted Wed May 24, 2017 6:54 AM

I'm going to go out on a limb and assume someone with Frank Ostrowski's talent and expertise was already familiar with most of the 6502 coding tricks on that page, but having said that, no code exists which cannot be further optimised in some way. ;)



#21 vitoco OFFLINE  

vitoco

    Chopper Commander

  • 199 posts

Posted Wed May 24, 2017 7:54 AM

@vitoco (http://vitoco.cl/atari/):

First, thank you for your work. But there have to be done some changes..., please see the 2 attached pictures. Part 11 of the source code is critical, due to inverse characters. But only there!

 

You are right, those characters are important for the code, but as the listing is in ASCII for MADS, the ATASCII inverse characters must be written as byte data, and I thought that is better to write them as hex instead of decimal values. For example, the inverse uppercase M from REM has the hex value of $CD, and that's why it says "RE",$CD instead of "REÍ". Once assembled, it'll say what you expected. Another way to write that for MADS could be "RE","M"* with an asterisk after a string. Please note that Part 14 also has more of this kind of code: the error messages.

 

I also analyzed the binary file I got. This is the binary (XEX) structure:

 

65535 [$FFFF] (binhead)
8960-9086 [$2300-$237E] (127) PROG/DATA
738-739 [$02E2-$02E3] (2) -> 8960 [$2300]
8832-8865 [$2280-$22A1] (34) PROG/DATA
9216-9417 [$2400-$24C9] (202) PROG/DATA
9472-9486 [$2500-$250E] (15) PROG/DATA
9508-9518 [$2524-$252E] (11) PROG/DATA
9530-14369 [$253A-$3821] (4840) PROG/DATA
24576-24955 [$6000-$617B] (380) PROG/DATA
738-739 [$02E2-$02E3] (2) -> 24576 [$6000]
49152-52210 [$C000-$CBF2] (3059) PROG/DATA
55296-57337 [$D800-$DFF9] (2042) PROG/DATA
58368-65517 [$E400-$FFED] (7150) PROG/DATA
 
I did the same to Turbo BASIC 1.5 executable and got this:
 
65535 [$FFFF] (binhead)
743-744 [$02E7-$02E8] (2) -> 13865 [$3629]
24064-24199 [$5E00-$5E87] (136) PROG/DATA
8448-8595 [$2100-$2193] (148) PROG/DATA
738-739 [$02E2-$02E3] (2) -> 8448 [$2100]
8320-8353 [$2080-$20A1] (34) PROG/DATA
8704-8905 [$2200-$22C9] (202) PROG/DATA
8960-8981 [$2300-$2315] (22) PROG/DATA
8996-9006 [$2324-$232E] (11) PROG/DATA
9018-13864 [$233A-$3628] (4847) PROG/DATA
24576-24955 [$6000-$617B] (380) PROG/DATA
738-739 [$02E2-$02E3] (2) -> 24576 [$6000]
49152-52215 [$C000-$CBF7] (3064) PROG/DATA
55296-57337 [$D800-$DFF9] (2042) PROG/DATA
58368-65521 [$E400-$FFF1] (7154) PROG/DATA
 

So, the probability to match both source codes to transfer labels and comments into 1.5 source are high.

 

Actually, I used DIS6502 to create a listing from the 1.5 version binary and compared them. I was happy with what I saw, but some hard work would be needed. Probably another disassembler would give a better listing. Ideas? Hints?

 

Anyway, from the comparison, I easyly found the code to call DOS that was replaced by a message in 2.0. Also, I found that BYE performs a coldstart in 2.0 while 1.5 calls the Self Test just like Atari BASIC does.

 

BTW, I'm not sure, but I think that the FOR error #13 I got in my tests using 2.0 executable could be related to a mess of MAE-style temporary labels in MADS. I'll have to do some tests.



#22 luckybuck OFFLINE  

luckybuck

    Dragonstomper

  • Topic Starter
  • 641 posts

Posted Wed May 24, 2017 8:02 AM

Hi vitoco,

 

WOW! that is really good work, thank you so much. As far as I have heard, the Ultimate Disassembler should be a good choice.



#23 dmsc ONLINE  

dmsc

    Chopper Commander

  • 218 posts
  • Location:Viņa del Mar, Chile

Posted Wed May 24, 2017 8:49 AM

Hi!,
 

I'm going to go out on a limb and assume someone with Frank Ostrowski's talent and expertise was already familiar with most of the 6502 coding tricks on that page, but having said that, no code exists which cannot be further optimised in some way. ;)


Also, and IMHO, if some wants a new "ultimate basic" with TBXL compatibility, a *much* better starting point is AltirraBasic, as it is open source, smaller, faster and has fewer bugs. Adding support for the TBXL extra commands to Altirra Basic is easier than optimizing the given TBXL code (that is only a disassembly, not the real source). Remember that TBXL is based on the buggy original Atari Basic source.

#24 ijor OFFLINE  

ijor

    Stargunner

  • 1,814 posts

Posted Wed May 24, 2017 10:45 AM

I intend to follow your arguments, a normal source code is much better documented, but what is normal?


I didn't say it is better or normal, just that it's a different thing. And historically has, of course, much more significance.

 

Let me make an analogy, even when we know it is not quite the same. Is it the same, the original handwritten manuscript of a music or literary work, than the published machine made version? Of course it is not. The original handwritten manuscript has a completely different value from the historical point of view. It is not necessary better. The published version might have correction and additions, so it might be better than the original in some senses. That's not the point.

 

While this is not exactly the same as an original manuscript. It is still true that the original source might have something that you can't get from a reverse engineering work. As I sad, you have the original comments from the author. This is not just about documenting. It might have all sort of thing that we'll never know. Furthermore, the original source might have extra (or different) code that for some reason was never compiled in the public version.
 

Further, I assume (assuming is not knowing of course!), that Frank in 1983 took Bill Wilkinson's book:


May be, may be not. That's one of the things we might know if we had the real original source (he might have references commented on the original source).
 

Therefore, I offer here a mix of source code for real and a disassembled one, which goes more in your direction, up to 60-70% ? Can you live with that?

 

It is perfect fine. It is good, valuable and useful. Just, IMHO, you have to make perfectly clear to anybody reading this page or your web site, what exactly comes from original sources and what from a reverse engineered work. e.g. the very same title of this thread is inaccurate.


Edited by ijor, Wed May 24, 2017 10:45 AM.


#25 peteym5 OFFLINE  

peteym5

    Stargunner

  • 1,640 posts
  • Location:Buffalo NY USA

Posted Wed May 24, 2017 10:54 AM

How far have you guys got with the translation to Mads Assembler so far? I am figuring out this Mad Pascal and Mads Studio for other alternatives to make some future games.

 

If we can optimize it, maybe make it run even faster. Not going to be as fast as doing stuff in pure assembler or other compiled programming languages because most Basics on the Atari is Floating Point variables only. No option to use byte, integer, or word. Also using OS graphics routines also are slower than the fast line drawing routine that I posted awhile back.







Also tagged with one or more of these keywords: TURBO-BASIC, TURBO-BASIC XL, Source Code

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users