TOS 1.04 sources reconstructed

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

TOS 1.04 sources reconstructed

Post by ThorstenOtto »

Inspired by some topic in the exxos forum, i finally settled down and finished what i had already started when working on the TOS 2.x/3.x sources some years ago. As a result, there are now sources available that can be used to

compile all the original TOS 1.04 ROM images from sources

You don't believe it? Take a look at https://github.com/th-otto/tos1x and try yourself.

I has been tested for all languages were i could find original ROM images (us, de, fr, uk, es, it, se, fi, no, sf, sg, nl). The se (swedish) ROM that i found had some patches applied (those that are supposed to be fixed by TOS14FIX).
Czech is also available, which seems to be just a patched german version.

The nl (dutch) version (taken from http://avtandil.narod.ru/tos/tos104nl.zip) is a bit strange : it is the only one, where the VDI code is 4 bytes shorter than in all the others (does not affect functionality in any way, just two branches that are optimized out). However, due to that difference, all absolute addresses after that, and all absolute references to the data segment, are off by 4 bytes, which makes it highly unlikely that this is just a patched version.
Last edited by ThorstenOtto on Wed Dec 22, 2021 7:09 am, edited 1 time in total.
User avatar
TheNameOfTheGame
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2203
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: TOS 1.04 sources recovered

Post by TheNameOfTheGame »

Wow, quite an accomplishment!
User avatar
Count
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 127
Joined: Sat Sep 16, 2017 9:15 am
Location: Germany

Re: TOS 1.04 sources recovered

Post by Count »

This is really nice.
:cheers:
ragnar76
Captain Atari
Captain Atari
Posts: 233
Joined: Thu Apr 07, 2011 3:01 pm

Re: TOS 1.04 sources recovered

Post by ragnar76 »

Works like a charm! Thx for all your effort. I find the line Atari Corp. 2/28/90 very interesting, next year it's getting 32 years old :shrug:

Code: Select all

../bin64/ar68 -r desk.a desksupp.o deskact.o deskdir.o rainbow.o deskapp1.o deskapp3.o deskdisk.o desktop.o deskfun.o deskinf.o deskpref.o deskins.o deskfpd.o deskwin.o deskobj.o deskshow.o deskif.o
make[1]: Leaving directory '/home/ragnar/src/tos1x/desk'
make[1]: Entering directory '/home/ragnar/src/tos1x/glue'
AS startup.S
AS ../common/vars.S
AS ../common/tosvars.S
GEN glue.de
New Resource Glue
Atari Corp.   2/28/90
Please don't type in a three-letter abbrevation of the
country and don't hit escape key to quit.
Reading ../aes/rsc/104/gemde.rsc
Reading ../desk/rsc/104/deskde.rsc
Reading ../desk/rsc/104/deskde.inf
Writing glue.de
File size is $4226
Done.
GEN tosrscde.c
CC tosrscde.c
LD tos.img
../tools/mkrom pad 192k tos.img tos104de.img
# Padding tos.img to 192 KB image into tos104de.img
# tos104de.img done (922 bytes free)
make[1]: Leaving directory '/home/ragnar/src/tos1x/glue'
• FireBee • Falcon030/040/060 • MiSTer • TT • (Mega)STe • Suska III-B • Suska III-C • (Mega)ST •
User avatar
TheNameOfTheGame
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2203
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: TOS 1.04 sources recovered

Post by TheNameOfTheGame »

Question...after editing "config.mak" for usa version and compiling (using gcc) I see the tos104us.img and the tos.img in the "glue" directory.

The tos.img file is 326128 bytes long but the resulting tos104us.img is down to the expected 196608 bytes.

Just curious what the final compile message means (and why tos.img is larger):

# Padding tos.img to 192 KB image into tos104us.img
# tos104us.img done (1066 bytes free)
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: TOS 1.04 sources recovered

Post by ThorstenOtto »

gcc can only be used to do compile test, it won't produce a working binary, and the 326k also include a symbol table which can be stripped. However in the default configuration, the build system will not use it. To get a usable version, you have to use the alcyon compiler (binaries for tos and linux are provided in the repo). More specifically, you really have to use the one from the repo, because i had to "hack" it a bit in order to produce the linef opcodes to replace function epilogues and function calls, the original one from the developer kit would not work. I still have no idea how Atari achieved that, maybe they wrote some extra tool for this.
ijor
Hardware Guru
Hardware Guru
Posts: 4346
Joined: Sat May 29, 2004 7:52 pm
Contact:

Re: TOS 1.04 sources recovered

Post by ijor »

Awesome work, many thanks and congratulations!

But please be careful with the wording. This is not really the TOS sources recovered. At least not what I expected when I saw the thread's title. Recovered sources means the original Atari/DRI sources with the original comments. Or at least it certainly could be interpreted that way.

Perhaps a more accurate wording would be reverse engineered (decompiled) sources?

Anyway, again, great job!
Fx Cast: Atari St cycle accurate fpga core
User avatar
TheNameOfTheGame
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2203
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: TOS 1.04 sources recovered

Post by TheNameOfTheGame »

ThorstenOtto wrote: Tue Dec 21, 2021 11:18 pm gcc can only be used to do compile test, it won't produce a working binary, and the 326k also include a symbol table which can be stripped. However in the default configuration, the build system will not use it. To get a usable version, you have to use the alcyon compiler (binaries for tos and linux are provided in the repo). More specifically, you really have to use the one from the repo, because i had to "hack" it a bit in order to produce the linef opcodes to replace function epilogues and function calls, the original one from the developer kit would not work. I still have no idea how Atari achieved that, maybe they wrote some extra tool for this.
Ok, thanks for the tip. I recompiled after adjusting my PATH variable in the linux bash shell to see your modified alcyon compiler using "PATH=${PWD}/bin64:$PATH".

I used the resulting binary from the "glue" directory to boot the system in Steem and everything works good.

Happy Holidays!
joska
Hardware Guru
Hardware Guru
Posts: 5342
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: TOS 1.04 sources reconstructed

Post by joska »

Thank you Thorsten! This will allow me to make the first ever "proper" Norwegian TOS 1.4. However, while "make COUNTRY=se" works, "make COUNTRY=no" fails with a "make: *** No rule to make target 'country_no', needed by 'all'. Stop.". This is when cross-compiling under Linux.

Also, when I try to compile on my MSTE the build stops at gemjstrt.S "can't open ..\bin\lineftab.txt: No such file or directory". I was using command.tos as shell, will try with mupfel later.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: TOS 1.04 sources reconstructed

Post by ThorstenOtto »

joska wrote: Wed Dec 22, 2021 6:26 pm Thank you Thorsten! This will allow me to make the first ever "proper" Norwegian TOS 1.4. However, while "make COUNTRY=se" works, "make COUNTRY=no" fails with a "make: *** No rule to make target 'country_no', needed by 'all'. Stop.". This is when cross-compiling under Linux.
Oops, i think norwegian version is not available. So the comment above is wrong (think i have copied from wrong place), but it is correctly tested in the makefile, that is why you get an error. But if you find some norwegian rom for either 1.04, 1.06 or 1.62, i can extract the resource and add it to the list. The resource files for all these TOS versions are identical.
Also, when I try to compile on my MSTE the build stops at gemjstrt.S "can't open ..\bin\lineftab.txt: No such file or directory". I was using command.tos as shell, will try with mupfel later.
My bad, the file is missing from the repo, because the /bin directory is ignored by git, and i forgot to explicitly add it. But in the meantime you can copy the file from the bin64 directory, it is the same.

Edit: ah. in TOS 2.06 the norwegian version actually uses the swedish resource, and also keyboard tables. So i guess there has never been an norwegian translatoion, and the only difference is the language code in the header? In that case, copying the resource files (and fixing the test in the Makefile) should just do for now.
joska
Hardware Guru
Hardware Guru
Posts: 5342
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: TOS 1.04 sources reconstructed

Post by joska »

There has been no official Norwegian TOS since 1.00 actually. I see that in keytbl.c you have...

Code: Select all

#if (OS_COUNTRY == CTRY_SE) | (OS_COUNTRY == CTRY_FI) | (OS_COUNTRY == CTRY_NO)
...while in deskrsc.h there is...

Code: Select all

#if (OS_COUNTRY == CTRY_SE) | (OS_COUNTRY == CTRY_FI)
...and no check for CTRY_NO. By adding the missing resource-files and modify the language checks I managed to build a "norwegian" TOS 1.4 with a "norwegian" resource and keyboard table (both copies of the swedish versions) :) First checks indicates that the keyboard tables are broken in both, I will take a look at that when time permits.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
joska
Hardware Guru
Hardware Guru
Posts: 5342
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: TOS 1.04 sources reconstructed

Post by joska »

Oh, the keyboard is broken when building the german TOS as well. This was built before I made any changes whatsoever. It's broken in the same way as the swedish keyboard, some keys appears to be on the wrong row. This also affects the ALT-combos that are not defined in the tables, e.g. ALT+Ä which should result in ] on a German keyboard returns nothing, while * and ALT+* returns Ä and ].

Tested only in Hatari so far. Keyboard works correctly when using EmuTOS.
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
BlankVector
Atari Super Hero
Atari Super Hero
Posts: 573
Joined: Wed Oct 24, 2007 7:52 pm
Location: France
Contact:

Re: TOS 1.04 sources reconstructed

Post by BlankVector »

Great hack 😃
Subscribe to my Vretrocomputing channel on YouTube and Facebook. Latest video: Disable the key click in assembly language on Atari ST.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: TOS 1.04 sources reconstructed

Post by ThorstenOtto »

joska wrote: Wed Dec 22, 2021 8:09 pm ...while in deskrsc.h there is...

Code: Select all

#if (OS_COUNTRY == CTRY_SE) | (OS_COUNTRY == CTRY_FI)
...and no check for CTRY_NO.
To be honest, i can't remember what made me think that norwegian is supported. The tests are the same as in my 2.06 sources, and you will get the same error there when trying to build it. There are are also no norwegian resource files. So for now that does not work, until someone (:wink:) manages to provide translated resource files. I guess the keyboard tables can be taken from EmuTOS or MiNT.
Oh, the keyboard is broken when building the german TOS as well. Tested only in Hatari so far.
Maybe a problem with Hatari, or you need the corresponding keyboard translation table. The resulting binary should be identical to the official TOS version, so it can't be a problem with the keyboard tables.
User avatar
troed
Atari God
Atari God
Posts: 1635
Joined: Mon Apr 30, 2012 6:20 pm
Location: Sweden

Re: TOS 1.04 sources reconstructed

Post by troed »

ThorstenOtto wrote: Wed Dec 22, 2021 7:16 pm Edit: ah. in TOS 2.06 the norwegian version actually uses the swedish resource, and also keyboard tables. So i guess there has never been an norwegian translatoion, and the only difference is the language code in the header?
(This is because while we allowed the Norwegians to believe they gained independence in 1905 they're actually still ours)

/Sweden
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 2721
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: TOS 1.04 sources reconstructed

Post by Cyprian »

ThorstenOtto wrote: Tue Dec 21, 2021 4:50 pm Inspired by some topic in the exxos forum, i finally settled down and finished what i had already started when working on the TOS 2.x/3.x sources some years ago. As a result, there are now sources available that can be used to

compile all the original TOS 1.04 ROM images from sources

You don't believe it? Take a look at https://github.com/th-otto/tos1x and try yourself.
well done Thorsten,

would be possible to create a git also for your work with TOS 2.x / 3.x http://tho-otto.de/download/tos306de.tar.bz2 ?
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
User avatar
davemacblack
Atariator
Atariator
Posts: 24
Joined: Mon Mar 09, 2015 9:20 am
Location: Czech Republic
Contact:

Re: TOS 1.04 sources reconstructed

Post by davemacblack »

ThorstenOtto wrote: Tue Dec 21, 2021 4:50 pm Czech is also available, which seems to be just a patched german version.
Since I had the opportunity to watch the creation of the Czech version from afar, I can confirm that it is indeed a patch of the German version of TOS. Around 1992, I and a few friends decided to become ATARI dealers through the newly established Czech dealership (ICC Prague) and one of my colleagues did the localization and modification on the German TOS system, which he extracted from his own 520 STFM. Since Czechoslovakia was under the Vienna distribution, only computers with the German system were shipped here, but we hoped that the version we had modified in this way would be passed on to ATARI by the distributor and that a localized version of TOS would be available here in the future. I personally handed over a burned EPROM with the localized TOS and TOS image on a floppy disk in the ICC offices, but I believe it never got any further and stayed in the dealer's drawer.
However, I can imagine that more similar Czech versions of TOS were created at that time, as communication between local communities was difficult and only took place at the level of meetings within clubs or through communication on FIDO.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: TOS 1.04 sources reconstructed

Post by ThorstenOtto »

davemacblack wrote: Thu Dec 23, 2021 9:58 am I can imagine that more similar Czech versions of TOS were created at that time, as communication between local communities was difficult and only took place at the level of meetings within clubs or through communication on FIDO.
Maybe you can have a look at the resource file, whether that is yours (the image was downloaded from http://avtandil.narod.ru/tose.html). In the 2.0x/3.0x it is the same, the czech version is a patched german ROM. Also, in both cases, the ROMs have a few patches for known bugs applied.
joska
Hardware Guru
Hardware Guru
Posts: 5342
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: TOS 1.04 sources reconstructed

Post by joska »

ThorstenOtto wrote: Thu Dec 23, 2021 2:50 amSo for now that does not work, until someone (:wink:) manages to provide translated resource files.
Yes, that is my intention. I already have the correct keyboard tables, I only need to translate the RSC.
ThorstenOtto wrote: Thu Dec 23, 2021 2:50 am Maybe a problem with Hatari,
I agree, it's almost certainly a configuration problem with Hatari. A good example of why I'm not too fond of emulators. I will test on my STM as soon as time permits.
troed wrote: Thu Dec 23, 2021 9:25 am (This is because while we allowed the Norwegians to believe they gained independence in 1905 they're actually still ours)
I originally wrote a very true but also slightly offensive reply here, but decided to delete it before posting ;)
Jo Even

VanillaMiNT - Falcon060 - Milan060 - Falcon040 - MIST - Mega STE - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
mikro
Hardware Guru
Hardware Guru
Posts: 2997
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: TOS 1.04 sources reconstructed

Post by mikro »

ThorstenOtto wrote: Thu Dec 23, 2021 12:19 pm
davemacblack wrote: Thu Dec 23, 2021 9:58 am I can imagine that more similar Czech versions of TOS were created at that time, as communication between local communities was difficult and only took place at the level of meetings within clubs or through communication on FIDO.
Maybe you can have a look at the resource file, whether that is yours (the image was downloaded from http://avtandil.narod.ru/tose.html). In the 2.0x/3.0x it is the same, the czech version is a patched german ROM. Also, in both cases, the ROMs have a few patches for known bugs applied.
I'm pretty sure that the most wide-spread version of TOS 1.04/2.06 was translated into Czech by Petr Stehlik a.k.a. Joy (and yes, he added those patches as well). The list of fixed bugs in the Czech version of 2.06 is as follows:

- set the shell-pointer to null after reset
- fixed boot device, bad booting from other logical partitions
- fixed stack pointer after execution in AUTO
- fixed "Applikationsstatus anders abfragen", "Überlängenwert auf Null setzen" and "Warteroutine von ARROW-Repeat ändern" bugs
- reset-proof ram disks are working now
alanh
Hardware Guru
Hardware Guru
Posts: 1520
Joined: Mon Jul 24, 2006 9:01 pm
Location: North Wales, UK

Re: TOS 1.04 sources reconstructed

Post by alanh »

Is there a tos2x too ? :-)
Falcon CT60, Falcon CT63 x2, TT x3, MegaST x2, MegaSTE x2, STFM x2, STE x2, STacy, STBook, (Dead) Hades 060, Milan 060, T40.
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 2721
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: TOS 1.04 sources reconstructed

Post by Cyprian »

alanh wrote: Thu Dec 23, 2021 8:25 pm Is there a tos2x too ? :-)
I don't think so.
I asked about that here https://www.atari-forum.com/viewtopic.p ... 35#p427035
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
alanh
Hardware Guru
Hardware Guru
Posts: 1520
Joined: Mon Jul 24, 2006 9:01 pm
Location: North Wales, UK

Re: TOS 1.04 sources reconstructed

Post by alanh »

Oh man, that tarball does have 2.06 support :-) awesome !
Falcon CT60, Falcon CT63 x2, TT x3, MegaST x2, MegaSTE x2, STFM x2, STE x2, STacy, STBook, (Dead) Hades 060, Milan 060, T40.
ThorstenOtto
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2367
Joined: Sun Aug 03, 2014 5:54 pm

Re: TOS 1.04 sources reconstructed

Post by ThorstenOtto »

Cyprian wrote: Thu Dec 23, 2021 9:56 am would be possible to create a git also for your work with TOS 2.x / 3.x http://tho-otto.de/download/tos306de.tar.bz2 ?
I'm currently thinking about it. But they have already been uploaded to github by someone else (https://github.com/Kochise/atari-docs/t ... S/tos306de).

I'm also not sure whether i should clean it up, and remove the ifdefs for TOS < 2.00. As you may have seen, a lot of parts already contain the TOS 1.4 parts, but it won't compile to a identical image. There would be quite some places where i would have to add even more ifdefs. Most of them don't even affect functionality, and are just needed to be able to compare the ROMs. Now that 1.4 is complete, that's maybe not needed anymore. What do you think?
User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 2721
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: TOS 1.04 sources reconstructed

Post by Cyprian »

ThorstenOtto wrote: Fri Dec 24, 2021 10:05 am I'm currently thinking about it. But they have already been uploaded to github by someone else (https://github.com/Kochise/atari-docs/t ... S/tos306de).
thanks, I know that page but I didn't realize it was your work.
ThorstenOtto wrote: Fri Dec 24, 2021 10:05 am I'm also not sure whether i should clean it up, and remove the ifdefs for TOS < 2.00. As you may have seen, a lot of parts already contain the TOS 1.4 parts, but it won't compile to a identical image. There would be quite some places where i would have to add even more ifdefs. Most of them don't even affect functionality, and are just needed to be able to compare the ROMs. Now that 1.4 is complete, that's maybe not needed anymore. What do you think?
good question, in fact maybe would be better to have less ifdefs and have separate 1.x and 2x/3.x versions. I would vote for that.
Lynx I / Mega ST 1 / 7800 / Portfolio / Lynx II / Jaguar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
DDD HDD / AT Speed C16 / TF536 / SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.atari.org
Post Reply

Return to “Coding”