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 »

New bug - if I enter something unknown instead of command it starts print zeros to the screen - many lines of zeros...
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

In the 3cc memory image? If so, could you post the .asm-file 3CC generated (or upload it somewhere, it's several thousand lines :-o)
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: In the 3cc memory image? If so, could you post the .asm-file 3CC generated (or upload it somewhere, it's several thousand lines :-o)
I thinks it's ASM-image. I can't find 3CC-image sources on CVS...
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

The 3cc image is in "memory_image_3cc" in the CVS.

How did you assemble the sources? You're only supposed to do
"tg_assembler ram.asm" nowadays, though assembling the wrong way should only cause warnings and redundant code. Furthermore, what optimization level are you compiling tunguska in?

Also, if you are running in windows, could you upload the windows binary so I can see the problem for myself?
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Yes, I'm using ./tg_assembler ram.asm since July ;)

Also I took memory_image_3cc from CVS and got this:
cpp string.c -o string.ppc
cpp stdio.c -o stdio.ppc
cpp math.c -o math.ppc
cpp main.c -o main.ppc
cpp system.c -o system.ppc
cpp graphics.c -o graphics.ppc
cpp demos.c -o demos.ppc
../tunguska_3cc/3cc -O 0n400000 -oout.asm string.ppc stdio.ppc math.ppc main.ppc system.ppc graphics.ppc demos.ppc
../tunguska_sources/tg_assembler out.asm

Caught error during assembly (final sweep)

* assembler.cc[257]: Unresolved varaible clear_screen.bootstrapped
* assembler.cc[413]: Error during assembly of out.asm, line 4328
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Are tunguska and 3cc up to date?

Could you try running "../tunguska_sources/tg_assembler -v out.asm" And pasting the output.

Also, if possible, supply out.asm.
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 ... _0-win.zip (2.5M)

See ram_3cc/out.asm and ram_3cc/out

To rebuild ram_3cc run build_ram_3cc.bat that got error described above written to file "out"
Last edited by Shaos on 11 Nov 2012 17:57, 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 »

Yeah, now I see what the problem is.

Something seems to be wrong with the $$-token. I'm thinking either it isn't matched in the lexer for some reason, or something has gotten broken in the porting process.

Could you diff any alterations you have done to scanner.l, parser.ypp and assembler.h?
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Could you diff any alterations you have done to scanner.l, parser.ypp and assembler.h?
I didn't do anything special - just got CVS and make...
P.S. Actually I did some changes earlier in July in generated lex.yy.cc, but it was just changing cin to std::cin and cout to std::cout, that part wasn't changed since that time, so make didn't recreate it again.
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Strange. I'm not sure what could cause this sort of problem. Either the token isn't recognized, or assembler::get_pc() isn't doing it's job for some reason.

Try changing tunguska_sources/parser.ypp:121 from

Code: Select all

	| HERE { $<ival>$ = assembler::instance()->get_pc(); }
to

Code: Select all

	| HERE { $<ival>$ = assembler::instance()->get_pc(); 
	         fprintf(stderr, "$$-token recognized(%d)\n",$<ival>$); }
And compile and see what happens when you assemble out.asm.
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

I did make clean and make (2 tries, after 1st one I again changed cin,cout,cerr to std::cin,std::cout,std::cerr in lex.yy.cc), now it build out.asm, but it is not working:

Code: Select all

'symbols.bmp' not found in '/usr/local/share/tunguska/'
Falling back to 'share/symbols.bmp' ... success!
'bg.bmp' not found in '/usr/local/share/tunguska/'
Falling back to 'share/bg.bmp' ... success!
LOADING out.ternobj
...DONE
RTI outside BRK
RTI outside BRK
RTI outside BRK
Initial benchmark: 447.686 thousand operations per second
        Spread: 20.119

RTI outside BRK
RTI outside BRK
It strange, but asm image did the same thing now...

http://nedopc.org/ternary/tunguska/tung ... _1-win.zip (2.4M)
Last edited by Shaos on 11 Nov 2012 17:58, edited 1 time in total.
User avatar
Shaos
Admin
Posts: 24008
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

I rebuilt tunguska and tg_assembler again with -O2 in Makefile and now it's working! Even many zeros bug also gone...

http://nedopc.org/ternary/tunguskatungu ... _2-win.zip (2.4M)
Last edited by Shaos on 11 Nov 2012 17:58, 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 news!
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: Great news!
So is it final v0.5? Should I prepare windows version for SourceForge now?
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

The sourcecode is final, I need to finish the updates of the manual and maybe the memory image for 3cc (I expect it to be done before next week), but you could probably start the work on the 0.5 package for windows.