Tunguska the ternary emulator
Moderator: haqreu
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I just uploaded the GTK code to the CVS. I didn't want to risk a hard drive breakdown or something undoing all my work. It's not remotely workable at the moment though.
Oh, and Tunguska is a year old now. It's 15,558 lines of code now. I think that is pretty decent for a hobby project.
Oh, and Tunguska is a year old now. It's 15,558 lines of code now. I think that is pretty decent for a hobby project.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
Yes, very good progress for one year
Thank you!

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I haven't had a lot of time to work on Tunguska lately, but I have added a new feature to the CVS today (which is really to make both the transfer to faster integer based internal logic, and the GTK interface easier to implement): Change hooks to memory cells.
Previously, every device (the screen and so on) had to scan their memory range after every instruction to see if the data has changed, but now the trytes themselves will tell their respective peripherals that they have changed.
Previously, every device (the screen and so on) had to scan their memory range after every instruction to see if the data has changed, but now the trytes themselves will tell their respective peripherals that they have changed.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I should have done this a long time ago, but I just added much needed malloc() and free() functions to the 3cc memory image. So you can now take advantage of dynamic memory allocation! You can make linked lists, and trees, and all sorts of things!
They are pretty crude, and can only allocate a maximum of 1000 chunks at 27 words each at the moment, but... it works!
I may change the chunk size and count later (probably up to 10,000 or something, since that's approximately 40% of the addressable memory, which seems a fair number)
They are pretty crude, and can only allocate a maximum of 1000 chunks at 27 words each at the moment, but... it works!
I may change the chunk size and count later (probably up to 10,000 or something, since that's approximately 40% of the addressable memory, which seems a fair number)
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've been working a little on the 3CC memory image for Tunguska. I've added basic disk I/O now, and I'm working on a very simple file system loosely based on the one used in RT-11 (neither are in the CVS yet).
Other features I'm planning are:
A DEBUG command like the one in DOS (that can display memory and process assembly directly in the memory)
File management commands (when the file system is done, obviously)
A simple BASIC interpreter to replace the command prompt
Other features I'm planning are:
A DEBUG command like the one in DOS (that can display memory and process assembly directly in the memory)
File management commands (when the file system is done, obviously)
A simple BASIC interpreter to replace the command prompt
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
Once again - very good news!
Could you please explain me how can I connect to CVS from Ubuntu? I've got it installed into VirtualBox in Windows now.

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I don't know how detailed help you need.
Create a folder somewhere you want to build Tunguska, and create a text file called Makefile, and copy the following lines into it:
Then you open a console (or terminal or whatever they're called), go to this directory, and run "make co build"
And it will check out and build the source tree. It may ask you for a password at some point, but it's safe to just press enter.
----
Heh, I just downloaded the CVS onto my old laptop. It runs a pretty old version of slackware, so I had to really coerce it into compiling at all, and it's so slow I only get about 100 thousand operations per second (I can get almost 3,000 on my workstation)
Create a folder somewhere you want to build Tunguska, and create a text file called Makefile, and copy the following lines into it:
Code: Select all
TARGETS=tunguska_sources tunguska_3cc tunguska_memory_image_sources memory_image_3cc
all: co
co:
cvs -d:pserver:anonymous@tunguska.cvs.sourceforge.net:/cvsroot/tunguska login
cvs -z3 -d:pserver:anonymous@tunguska.cvs.sourceforge.net:/cvsroot/tunguska co -P $(TARGETS)
build:
make -C tunguska_3cc clean all
make -C tunguska_sources clean all
make -C memory_image_3cc clean all
And it will check out and build the source tree. It may ask you for a password at some point, but it's safe to just press enter.
----
Heh, I just downloaded the CVS onto my old laptop. It runs a pretty old version of slackware, so I had to really coerce it into compiling at all, and it's so slow I only get about 100 thousand operations per second (I can get almost 3,000 on my workstation)
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've completed the experiment with all host integer logic in Tunguska, and it turned out to be a failure.
The current mode of operation is faster. It may still be possible to use some of the algorithms to fix the bottlenecks in the current implementation though.
The current mode of operation is faster. It may still be possible to use some of the algorithms to fix the bottlenecks in the current implementation though.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
Well, negative experience is very important too
Now you know what way does not make code faster.

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
It's still a theoretically interesting concept, since it is much denser than array coded ternary arithmetic.
To code a n wide word in regular binary, you require 2*n bits. But the host integer method only requires n*log(3)/log(2) bits (rounded up).
So, to represent 20 ternary digits with the regular algorithms, you need 40 bits, but with the host integer method you only need 32.
To code a n wide word in regular binary, you require 2*n bits. But the host integer method only requires n*log(3)/log(2) bits (rounded up).
So, to represent 20 ternary digits with the regular algorithms, you need 40 bits, but with the host integer method you only need 32.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I'm seriously considering a major overhaul of the core code of Tunguska. It would be largely backwards-compatible with current Tunguska assembly code (and thus also 3CC code), but use 9 digits per word instead of 6, and add more instructions and address modes.
There are fundamental problems with Tunguska as it is right now. Most of them stem from how it was written completely ad-hoc, with no real aim or sense of direction. It is therefore poorly modularized, impossible to fork, really difficult to modify, etc. It superficially looks somewhat neat, but it really is quite a mess.
There are fundamental problems with Tunguska as it is right now. Most of them stem from how it was written completely ad-hoc, with no real aim or sense of direction. It is therefore poorly modularized, impossible to fork, really difficult to modify, etc. It superficially looks somewhat neat, but it really is quite a mess.
-
- Admin
- Posts: 23989
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Tunguska the ternary emulator
Do you plan to keep OLD Tunguska in "frozen" state like Tunguska-1 and develop NEW Tunguska as Tunguska-2? I still want to do something interesting with "old good" Tunguska 

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
Yeah, that's how I had it planned.
Classic Tunguska a working and pretty stable system, so it doesn't make sense to throw all that work away to start over with new bugs and instabilities.
Classic Tunguska a working and pretty stable system, so it doesn't make sense to throw all that work away to start over with new bugs and instabilities.
-
- Admin
- Posts: 23989
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Tunguska the ternary emulator
I got last sources, but it failed to compile - it looks like it requires "gtksourceview-2.0", that my Slackware-12.2 doesn't have...
-
- Admin
- Posts: 23989
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Tunguska the ternary emulator
I took it from here in source codeShaos wrote: I got last sources, but it failed to compile - it looks like it requires "gtksourceview-2.0", that my Slackware-12.2 doesn't have...
http://ftp.acc.umu.se/pub/gnome/sources ... eview/2.0/