Tunguska the ternary emulator

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

Moderator: haqreu

eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

After some further minor fixes, I released 0.0.3 just now. =D
User avatar
Shaos
Admin
Posts: 24011
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

eudoxie wrote: After some further minor fixes, I released 0.0.3 just now. =D
One more "unofficial" build for Windows is ready:

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

It includes new examples "snow.asm" and "ants.asm", alternative assembler RASM (now supports new commands XAM, XAX, XAY, XYX, PAUSE) and some examples for it.
Last edited by Shaos on 11 Nov 2012 17:50, edited 1 time in total.
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

Is there a way to read RTC data of host machine ? I'd like to write ternary clock for vrtual ternary machine :)
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I looked into it a while back, but I found no way of implementing it that didn't either slaughter performance or look really ugly.

Maybe some time in the future I'll find some satisfying way of implementing it.
User avatar
Shaos
Admin
Posts: 24011
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Mac Buster wrote: Is there a way to read RTC data of host machine ? I'd like to write ternary clock for vrtual ternary machine :)
I can do special build with this functionality ;)
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

Well, that would be just great :) I think there should be an address what will hold current huor, minute and second values (and of course it does not have to be updated every second, update-on-read-request is enought).
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I dislike the idea of implementing what is really OS-level functionality into the hardware level of the machine: I think on a hardware level the best way to represent time is something like UNIX time_t, the number of seconds relative to some date, since that is easier for a computer to understand than a mixed-radix time measurement like (year:month:day:)hour:minute:second.

But, since Tunguska's OS is pretty lacking at this stage, it might be possible to add this sort of functionality to the AGDP until it can be properly implemented in the OS.
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

Well, I didn't say that you have to store date and time in separate thrytes, you can use that UNIX way as well. Just give to programmes a way to read it :-)
User avatar
Shaos
Admin
Posts: 24011
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Mac Buster wrote: Well, I didn't say that you have to store date and time in separate thrytes, you can use that UNIX way as well. Just give to programmes a way to read it :-)
Actually it has to be separate trytes, because any RTC does this. Personally I never met computer hardware that has UNIX time on RTC level ;)
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Not specifically UNIX time, perhaps, but IBM BIOS for an example, gives you time in seconds or milliseconds passed since some epoch (atleast according to wikipedia.)

It would be very strange for a real time clock to do this sort of a thing on a mixed-radix basis, since they essentially just count the number of oscillations of a quartz crystal. It is much easier to implement a simple second or msecond counter in hardware than one that does second-minute-hour-day spillover in separate fields.
User avatar
Shaos
Admin
Posts: 24011
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

eudoxie wrote: Not specifically UNIX time, perhaps, but IBM BIOS for an example, gives you time in seconds or milliseconds passed since some epoch (atleast according to wikipedia.)
That page on wikipedia describes software methods to retrieve absolute time, but RTC usually has separated values for date and time: http://linux.die.net/man/4/rtc
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

I stand corrected.

I've added a new instruction AGDP_WHEN that stores the first six fields from struct tm in the AGDP registers to the CVS. To access it, call the following

Code: Select all

  LDA #agdp.WHEN
  STA agdp.OP
Fields are:
agdp.R1 -- second
agdp.R1+1 -- minute
agdp.R2 -- hour
agdp.R2+1 -- day of month
agdp.R3 -- month
agdp.R3+1 -- year
User avatar
Shaos
Admin
Posts: 24011
Joined: 08 Jan 2003 23:22
Location: Silicon Valley

Re: Tunguska the ternary emulator

Post by Shaos »

Last edited by Shaos on 11 Nov 2012 17:50, edited 2 times in total.
Mac Buster
Retired
Posts: 1474
Joined: 03 Aug 2003 22:37
Location: Moscow

Re: Tunguska the ternary emulator

Post by Mac Buster »

Great! I'm going to write ternary clock :lol:
eudoxie
Maniac
Posts: 277
Joined: 17 Sep 2012 13:36
Location: 81.170.128.52

Re: Tunguska the ternary emulator

Post by eudoxie »

Neat, would make a nice addition to programs in the main command prompt.