nedoPC.org

Community of electronics hobbyists established in 2002

...
Atom Feed | View unanswered posts | View active topics It is currently 13 Dec 2017 14:51



Reply to topic  [ 273 posts ]  Go to page 1, 2, 3, 4, 5 ... 19  Next
[Ternary] Tunguska the ternary emulator 
Author Message
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Upon request, I'm cross-posting the announcement (and discussion) of my ternary computer emulator/virtual machine (previous discussion here).

Sources/info can be found here: http://www.acc.umu.se/~achtt315/tunguska/

New web-site: http://tunguska.sourceforge.net (corrected in November 2012)

Image

P.S. Manual: http://tunguska.sourceforge.net/The_Fine_Manual.pdf (copy available here)


05 Feb 2008 14:49
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
Ok, eventually I've got the time to build this package, but after launch I get black window and this message in stdout:

Code:
Tunguska loaded null memory, basically
rendering it a drooling vegetable :-(

It's a lot more fun with something in the
memory to execute...Attempt at accessing memory outside limits
RTI outside BRK
Attempt at accessing memory outside limits
RTI outside BRK
Attempt at accessing memory outside limits
RTI outside BRK


06 Feb 2008 05:00
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
You haven't loaded an image into the memory. Which is comparable to starting your computer with no harddrive. It doesn't know what to do.

Type "make memory", and it will assemble the sources in the "ram/" subdirectory.

From there, you can run "bin/tunguska memory.image", and it will load the freshly created memory.image into the memory, and it will provide at least some interaction.

--

Also, don't grow too fond of the assembler. I'm working on rewriting it pretty much from scratch, having the excellent GNU tools bison and flex do the parsing (it will mean a slight change in syntax as well). In the end, this will make the assembler much more powerful and flexible than it currently is.

It really was never intended to do half the stuff I've convinced it to do, so this rewrite really is for the best.


06 Feb 2008 13:55
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
Yes, now it's working! :)


07 Feb 2008 05:54
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Glad to hear that...

Also, the "RTI without BRK" message basically means it's run into an instruction telling it to return from an interrupt, without actually being in an interrupt. A symptom of the program counter somehow ending up outside of an area of memory with code, and into where-ever an interrupt handler has been installed. Or, in this case, with nothing in the memory, the memory automatically in it's vanilla state has an interrupt handler that just consists of an RTI instruction at the very end of memory.

So, whenever the machine has executed every single instruction of memory (and wraps around from 444:444 to DDD:DDD) it spits out a "RTI without BRK" warning (that actually serves a decent benchmark, if you clock the time between messages, you can pretty straightforwardly work out how many operations per seconds it's doing).

That was probably confusing to anyone that doesn't know the machine inside and out like me.


07 Feb 2008 14:35
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
It would be great to have some kind of OS here to load "applications" that will call some API (like read character from keyboard, print character to display, compare strings etc.) by specified addresses, defined as constants in some INC-files


12 Feb 2008 20:48
Profile WWW
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
I have just checked Tunguska instruction set and I can't find operation "inversion". Should I use A(+)444 instead?

Also I didn't understand sentence about PHA/PSH and PLA/PLL - should it be replaced in opcodes table?


Last edited by Shaos on 11 Nov 2012 19:52, edited 1 time in total.



12 Feb 2008 23:44
Profile WWW
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
I found this project on FreshMeat: http://freshmeat.net/projects/tunguska/
Does author have ideas to put it on SourceForge and use CVS? I personally can help with something useful for this project ;)
Some features that are interesting for me:
1) ability to load additional binary to address 000 (using functional key for example);
2) command RUN that will call subprogram from address 000;
3) ability to save memory image to file (using functional key for example);
4) all standard functions should be called by predefined and never changed addresses;
5) loading and saving files from programs;
6) support for color raster graphics (at least 16 colors by pixel);
7) mouse support.


Last edited by Shaos on 11 Nov 2012 19:53, edited 1 time in total.



13 Feb 2008 00:45
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Shaos wrote:
It would be great to have some kind of OS here to load "applications" that will call some API (like read character from keyboard, print character to display, compare strings etc.) by specified addresses, defined as constants in some INC-files


That's sort of what I'm working towards, a standard set of includes that does the stuff you describe, where you simply include them in the assembly process (similar to how you include headers in C) to use them for your program.

Shaos wrote:
I have just checked Tunguska instruction set and I can't find operation "inversion". Should I use A(+)444 instead?


That would work. I personally prefer to use exclusive or with %111. Ternary exclusive or of two trytes A = <A1,A2,A3>; and B = <B1,B2,B3> is defined as <-A1*B1, -A2*B2, -A3*B3>, so exclusive or between A and <1,1,1> is <-A1, -A2, -A3>.

Shaos wrote:
Also I didn't understand sentence about PHA/PSH and PLA/PLL - should it be replaced in opcodes table?


That seems to be an error in the specifications, the table should read PSH and PLL; not PHA and PLA. I'll fix it with the next release.

Shaos wrote:
I found this project on FreshMeat: http://freshmeat.net/projects/tunguska/
Does author have ideas to put it on SourceForge and use CVS? I personally can help with something useful for this project ;)
Some features that are interesting for me:
1) ability to load additional binary to address 000 (using functional key for example);
2) command RUN that will call subprogram from address 000;
3) ability to save memory image to file (using functional key for example);
4) all standard functions should be called by predefined and never changed addresses;
5) loading and saving files from programs;
6) support for color raster graphics (at least 16 colors by pixel);
7) mouse support.


Sourceforge: I've considered it, but not gotten around to investigating it.

1,2,3,5: I've been planning to include some sort of permanent storage, sort of like what a diskette station would be to a regular computer. It would be possible to change the "diskette" on the fly. Once that's done, it should be possible to achieve the rest of what you describe with assembly code.
4: I've thought about that. I don't quite want to make them that static, but something like a standard "OS" with standard functionality is something I'm planning.
6: Maybe. If it is actually possible to do. Speed is a big issue with this. The latest version is a lot faster with redrawing since graphics has been migrated to a separate thread, but it's still sort of iffy whether this will be possible. Another big issue is size. Even an extremely low resolution, like 320x240 would eat more than 14% of the memory.
7: Planned. Maybe not in the next version, but shouldn't be that far off.


13 Feb 2008 14:08
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
Thank you for your answers! Actually I can do 1,2,3 by myself - and you can use it in future releases if you want ;)

4: you need to make static only vector of jumps like:
ORG %444000
@_getstring JMP @getstring
@_feedscreen JMP @feedscreen
@_putchar JMP @putchar
@_puts JMP @puts
@_strcmp JMP @strcmp
@_strlen JMP @strlen
etc.
and you will have STDLIB.INC with
_getsring EQU %444000
_feedscreen EQU %444003
_putchar EQU %444006
etc.
Something like that...

P.S. I've just built tunguska-alpha-1 for Windows using CygWin if somebody needs it:
http://nedopc.org/ternary/tunguska/tung ... -1-win.zip (955K)
SDL.dll and cygwin1.dll are included.
Also I created couple BAT-files to build new memory.image (prebuilt version is already there) and to launch "tunguska" with current memory.image

P.P.S. It's even working in WINE ;)

P.P.P.S. I built it for MacOS X 10.4 (PowerPC) also, but with some small tricks:
1) machine::brk() should be public
2) strndup should be defined in assembler.cc
3) main() should have return 0 at the end (assembler.cc)

Image


Last edited by Shaos on 11 Nov 2012 19:54, edited 1 time in total.



13 Feb 2008 19:56
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
That's actually pretty smart. But there's an even better way, using indirect addressing.

Simply define functions as you would, and then add memory pointers like this

@feedscreen DW @_feedscreen
@puts DW @_puts
@clear DW @_clear
And, then when you want to run a function, you simply call for an example JSR (@puts)
--

However, you should hold off with any major assembly projects until the next release, since it comes with an overhaul of the assembly syntax. It is possible to convert existing assembly code by hand, but it's very tedious (I should know, I spent an hour doing it to the existing ram image.)

I'm glad that it's portable to windows and macos.

--

As for raster graphics you mentioned earlier. I experimented with it and it actually seems to be working fairly well. It may actually be added in the future.


14 Feb 2008 06:41
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
eudoxie wrote:
That's actually pretty smart. But there's an even better way, using indirect addressing.

Simply define functions as you would, and then add memory pointers like this

@feedscreen DW @_feedscreen
@puts DW @_puts
@clear DW @_clear
And, then when you want to run a function, you simply call for an example JSR (@puts)


Yes, you are right! I forgot about this feature :)

eudoxie wrote:

However, you should hold off with any major assembly projects until the next release, since it comes with an overhaul of the assembly syntax. It is possible to convert existing assembly code by hand, but it's very tedious (I should know, I spent an hour doing it to the existing ram image.)

I'm glad that it's portable to windows and macos.

--

As for raster graphics you mentioned earlier. I experimented with it and it actually seems to be working fairly well. It may actually be added in the future.


Great! So when we may have new release? :-)


14 Feb 2008 11:02
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
The next release should be fairly soon. A week or so, maybe? I don't have that much free time at the moment, but it shouldn't be terribly far off into the future.

I registered tunguska on sourceforge just now, so hopefully CVS (or SVN?) will be up within a few days.

-- edit --

Project just got approved on sourceforge. I'll commit it to CVS within a day or two.


14 Feb 2008 15:05
Profile
Admin
User avatar

Joined: 09 Jan 2003 02:22
Posts: 15910
Location: Colorado
Reply with quote
eudoxie wrote:
The next release should be fairly soon. A week or so, maybe? I don't have that much free time at the moment, but it shouldn't be terribly far off into the future.

I registered tunguska on sourceforge just now, so hopefully CVS (or SVN?) will be up within a few days.

-- edit --

Project just got approved on sourceforge. I'll commit it to CVS within a day or two.


Excellent news!


14 Feb 2008 20:23
Profile WWW
Maniac

Joined: 17 Sep 2012 16:36
Posts: 277
Location: 81.170.128.52
Reply with quote
CVS is up now.

Access instructions can be found on http://sourceforge.net/projects/tunguska/


15 Feb 2008 08:33
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 273 posts ]  Go to page 1, 2, 3, 4, 5 ... 19  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.