Tunguska the ternary emulator

Balanced Ternary Numeral System - forum was moved from http://ternary.info

Moderator: haqreu

User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

http://nedopc.org/ternary/tunguska/tung ... _1-win.zip (1.4M)

2USERS: There is no LOADSUB anymore - use RUN instead. And now it has 3CC compiler inside! :)

2AUTHOR: It looks like I found bug in implementation of new ops: machine.h has last commands enumerated as XAM XAY XAX XYX, but documentation orders them little bit differently: XAM XAX XAY XYX (so XAX and XAY are swapped in source code) - my "alternative assembler" RASM supports these commands as documented, but tunguska and tg_assembler don't - could it be fixed?

P.S. Question to author: May I include your The_Fine_Manual.pdf to our windows Tunguska package?
Last edited by Shaos on 11 Nov 2012 17:53, edited 1 time in total.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Great!

I fixed the XAX/XAY thing in the CVS now.

You're free to include the manual as long as you include it's sources (the .lyx-file) -- or at least a file indicating where they may be found.
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

eudoxie wrote:
I fixed the XAX/XAY thing in the CVS now.
Thanks!
You're free to include the manual as long as you include it's sources (the .lyx-file) -- or at least a file indicating where they may be found.
Where can I find it? Is it part of any CVS repository? And what about source of pong.asm? In that package I provided file SOURCES with CVS commands to download sources.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

It's only available in the source tarballs at this point, I've been meaning to put it in the CVS but not gotten around to it.

Anyways, I've uploaded a rudimentary memory image written in 3cc to the CVS. It requires the very latest CVS version of both 3cc and tunguska to compile and run properly (there was a problem with the CAD instruction in tunguska causing it to behave... backwards.)

If you would like, I could add you to the tunguska source forge project so you can host your windows ports using it's file release system or even submit code / fixes to the CVS; I've been intending to make this more of a collaborative project for a long time.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I just released tunguska 0.4.1, fixing the broken instructions mentioned.

As for the example code (pong.asm and whatnot), consider them public domain.
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Thanks for inviting me to your project!

For my projects I usually release:
1) sources
2) binary for Linux/x86
3) binary for MS-DOS
4) binary for Windows
5) binary for Linux/PPC
6) binary for MacOSX/PPC

For your project I think Linux binaries are not needed, because you have "configure" in sources, right? MS-DOS is not an option, because there is no SDL port for it (but actually I can try to do MS-DOS port of Tunguska without SDL at all ;). So I can definitely do port for Windows and MacOS X (PPC only, not "universal", because I have PowerBook G4 with MacOS X 10.4 as second OS). What do you think?
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I agree linux binaries are unnecessary, mostly because it's so quick to build, and anyone with enough understanding of computers to actually use tunguska isn't going to have much trouble compiling a tarball.

I agree Windows and MacOS X binaries make more sense.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I've added a debug prompt based on GNU readline to the CVS version of tunguska. It doesn't do very much at the moment, it's mostly proof of concept, but I plan to add stuff like memory inspection and possibly even some form of reverse-assembly functionality.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I just added modulo and division operators for both char and int to 3cc.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Fixed broken ROL and ROR instructions.

As I said earlier in this thread, I'm amazed how well it works with so few apparently working instructions.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I've added four new instructions that makes full word arithmetic a lot faster and easier. Earlier, adding (or even worse) multiplying numbers was half a screen of assembly code. Now it's one instruction.

They use the stack as an auxiliary register so that you can multiply any two given numbers (using any applicable mode of addressing).

Say you want to add 0nDDB443 with the contents of 0n333000, all you have to do is this:

Code: Select all

PSH (0n333000)
ADW 0nDDB443
And the result is stored in the X,Y registers.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I improved the integer to tryte converion algorithm, and added a static look up table. It was already pretty heavily optimized, but since it is one of the most called functions, every bit helps. I estimate about 5% speed increase :-)

--edit--

Whoa. It's proabably closer to 15-20% performance boost! Sweet!
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I think Tunguska is about as ready as it's going to get for the 0.5-release. There may be some minor issues with the 3CC-based memory image and maybe some typos in the manual, but I think now is a good time to start working on packages.

I've created a pre-release tarball for testing and whatnot, it lacks the 3cc memory image, but contains tunguska and 3cc.

http://www.acc.umu.se/~achtt315/tungusk ... ase.tar.gz
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

Wow! I'm waiting for Win build :) Can't use something other than that now :(
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

eudoxie wrote: I think Tunguska is about as ready as it's going to get for the 0.5-release. There may be some minor issues with the 3CC-based memory image and maybe some typos in the manual, but I think now is a good time to start working on packages.

I've created a pre-release tarball for testing and whatnot, it lacks the 3cc memory image, but contains tunguska and 3cc.

http://www.acc.umu.se/~achtt315/tungusk ... ase.tar.gz
Again I can't build it in CYGWIN - configure is OK, but make can't find SDL functions to link binary. So, I will compile CVS version of source codes...