Tunguska the ternary emulator
Moderator: haqreu
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've been playing with the idea of changing floppy disks on the fly within the machine. I would add calls that poll disk status (i.e. is a disk loaded?), get file name of the loaded disk, "eject" the disk, and open a new disk from the host filesystem.
The latter would be done by passing a 0-terminated string with X:Y.
The cool part is that it would be possible to, instead of like now when you have to pass a filename on the command prompt, add a command like
"LOADSUB myfile.ternobj", that loads and runs that image
The latter would be done by passing a 0-terminated string with X:Y.
The cool part is that it would be possible to, instead of like now when you have to pass a filename on the command prompt, add a command like
"LOADSUB myfile.ternobj", that loads and runs that image

-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
Very nice idea. What about "write protection" ? 

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I don't want to make any changes to the file format. Maybe in-emulator software-implemented (i.e. if certain positions are set to some magic value, write protection is enabled, and the write function refuses to work). Another possibility would be to somehow implement it in the host file system (simply setting the file read-only). But that would be hard to port, since different operating systems have widely different file permission paradigms...
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
I've been thinking about write protection via host filesystem, but since it would be hard to port, I'd leave this idea for now.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've made the (CVS) memory image sources rely on includes instead of command line arguments to decide what to assemble. So, instead of just assembling everything, the sources are now assembled by running
tg_assembler ram.asm
And then it figures out on it's own when to include what.
tg_assembler ram.asm
And then it figures out on it's own when to include what.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've realized Tunguska does not like some linux-versions (the very recent ones). It seems to be a problem with either gcc or glibc.
I'm working on finding a solution to the problem at the moment.
The symptom is random crashes at startup with messages like these.
I'm working on finding a solution to the problem at the moment.
The symptom is random crashes at startup with messages like these.
Code: Select all
*** glibc detected *** tunguska: malloc(): memory corruption: 0x08095dd0 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7d0c356]
/lib/tls/i686/cmov/libc.so.6(__libc_malloc+0x8d)[0xb7d0dcad]
/usr/lib/libstdc++.so.6(_Znwj+0x27)[0xb7ed8447]
tunguska[0x804b54c]
tunguska[0x804a329]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7cb6450]
tunguska(__gxx_personality_v0+0x85)[0x80493e1]
======= Memory map: ========
08048000-0805e000 r-xp 00000000 08:12 170697 /usr/local/bin/tunguska
0805e000-0805f000 rw-p 00015000 08:12 170697 /usr/local/bin/tunguska
0805f000-080bc000 rw-p 0805f000 00:00 0 [heap]
b6700000-b6721000 rw-p b6700000 00:00 0
b6721000-b6800000 ---p b6721000 00:00 0
b6809000-b6855000 rw-p b6809000 00:00 0
b6856000-b68ed000 rw-p b6856000 00:00 0
b68ed000-b6a19000 rw-s 00000000 00:09 8192026 /SYSV00000000 (deleted)
b6a19000-b7871000 rw-p b6a19000 00:00 0
b78da000-b78de000 r-xp 00000000 08:12 8411 /usr/lib/libXfixes.so.3.1.0
b78de000-b78df000 rw-p 00003000 08:12 8411 /usr/lib/libXfixes.so.3.1.0
b78df000-b78e7000 r-xp 00000000 08:12 8401 /usr/lib/libXcursor.so.1.0.2
b78e7000-b78e8000 rw-p 00007000 08:12 8401 /usr/lib/libXcursor.so.1.0.2
[...]
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
It's fixed now. Was a sneaky little buffer overflow.
Anyways, I added some of the floppy functionality to the CVS. Now, to load an image type "LOAD" and it will prompt you about the image to load. Then, to run it, type "RUN". You can also unload it with "UNLOAD", but you don't need to unload to load a new image.
Anyways, I added some of the floppy functionality to the CVS. Now, to load an image type "LOAD" and it will prompt you about the image to load. Then, to run it, type "RUN". You can also unload it with "UNLOAD", but you don't need to unload to load a new image.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I released a bugfix version (0.0.3.3) to fix the buffer overflow in the 0.0.3 branch.
--
The next branch is also getting close to release. I don't think there is going to be any new features other than what is already in the CVS added to it. What's left is going over the documentation and making sure it's relevant to the current state of affairs.
I'm going to do what I should have done with the last release and shift the version numbers one step to the left. It really doesn't deserve to be called alpha software any more. It clearly is more than worthy of beta status. So the next branch is going to be called "Tunguska 0.4"
--
The next branch is also getting close to release. I don't think there is going to be any new features other than what is already in the CVS added to it. What's left is going over the documentation and making sure it's relevant to the current state of affairs.
I'm going to do what I should have done with the last release and shift the version numbers one step to the left. It really doesn't deserve to be called alpha software any more. It clearly is more than worthy of beta status. So the next branch is going to be called "Tunguska 0.4"

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
I've made a few updates to the CVS that may or may not improve performance slightly. Most notably, I've added value caching to the tryte class so that unless it's actually changed, the value at integer conversion is stored in an integer. Also some minor changes to the trit class that also might improve performance slightly.
-
- Admin
- Posts: 24008
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Tunguska the ternary emulator
Your Makefile has a problem a few months already:
P.S. Congratulations with publishing in "Linux Format" magazine! 
Code: Select all
12c12
< lex.yy.c:
---
> lex.yy.cc:
14c14
< parser: parser.tab.cpp lex.yy.c
---
> parser: parser.tab.cpp lex.yy.cc

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
Fix'd, thanks.
Yeah, I saw the Linux Format thing. I didn't think it made it to the press, but apparently it did.
Yeah, I saw the Linux Format thing. I didn't think it made it to the press, but apparently it did.

-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Tunguska the ternary emulator
Just making a note of the fact that I just released tunguska-0.4. I've been putting it off for a long time for no real reason.
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Tunguska the ternary emulator
Good news! Waiting for Windows build 
P.S. Tunguska (Windows build, v 0.2a) works perfectly on my Intel Atom ITX board. Will use the system for development.

P.S. Tunguska (Windows build, v 0.2a) works perfectly on my Intel Atom ITX board. Will use the system for development.
-
- Admin
- Posts: 24008
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Tunguska the ternary emulator
I just got that Linux Format issue from UK (I bought it from ebay, because it was not available locally anymore)eudoxie wrote: Fix'd, thanks.
Yeah, I saw the Linux Format thing. I didn't think it made it to the press, but apparently it did.![]()