nedoPC.org

Electronics hobbyists community established in 2002
Atom Feed | View unanswered posts | View active topics It is currently 28 Mar 2024 12:33



Reply to topic  [ 14 posts ] 
Вопрос по троичным ПК (реализация опкодов в ассемблере) 
Author Message
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
Здравствуйте.
(Пока вопрос модерируется в топике тернари писи, вопрошаю тут)
Можете проконсультировать по троичным компьютерам? Хочу попробовать написать ассемблер под старые сетунь и сетунь70. (вернее прикрутить трансляцию мнемоник троичного ПК в машинные коды в уже готовом ассемблере) - выходной файл 2х-канальный бинарник (в каждом канале отражены только положительные или только отрицательные значения тритов, пока не определился каналы представлять непрерывным потоком битов с паддингом в конце канала, или чередовать dword`ы каждого канала также с паддингом до dword`а в конце)

Все что понял (однозначно):
сетунь:
размер слова 9 трит, понятие трайт отсутствует
K - регистр команды (9 трит) непонятно 4 старших (или младших) трита - опкод (в котором 1й трит - непонятный механизм модификации адресной части), оставшиеся 5 трит - адресная часть
C - регистр адреса команды (5 трит)
F - регистр модификаии (5 трит)
S - регистр результата (18 трит)
R - регистр множителя (18 трит)
MB - адрес зоны магнитного барабана (4 трита)
адресное пространство -9тритное избыточное (4 трита адреса зоны + 5 трит адреса)

понятно что call 5bitaddr кодируется как:
M00_0AD_RES или как ADR_ESM_000, где M - непонятный механизм модификации адресной части и осуществляет вызов инструкции по адресу MB:AD_RES
с остальными инструкциями ничего непонятно.
должны быть еще инверсия, арифметические и логические операции - вроде всего 24 операции и соответственно 24 опкода этих операций.

далее сетунь70:
его трайт равен 6 тритам, слово равно 3 трайтам или 18 тритам
адресное пространство 18тритное
состав регистров непонятен.

понятно что call 17bitaddr кодируется как:
0AD_DRE_SSA_DDR_ESS_ADD
I##_###_### - зарезервировано
все прочие команды:
1IM_CR#_ARG_UME_NTA_RGU - команды макрорежима MCR
10C_OD#_ARG_UME_NTA_RGU - команды пользовательского режима COD
11I_RQ#_ARG_UME_NTA_RGU - команды режима прерываний IRQ
# - зарезервирована как 0

также известно что все троичные ПК реальные и виртуальные - LittleEndian.

Последнее известное ТВМ (под ТВМ написать ассемблер куда больше желание):
кратность 3 взята за основу: 1 трайт = 9 трит, 1 слово = 3 трайта = 27 трит
регистры 3х-трайтные. 2 вида стека: данные и адреса возвратов.
есть регистры программный счетчик и счетчик инструкций (не совсем понятно для чего второй).
адресное пространство 27 тритов. нет портов, устройства маппятся в нижние адреса адресного пространства.
понятно что call 26bitaddr кодируется как:
0AD_DRE_SSA_DDR_ESS_ADD_RES_SAD_DRE
все остальные опкоды непонятны.
Спасибо.


17 Jun 2018 15:34
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22412
Location: Silicon Valley
Reply with quote
Перенёс в троичный форум, а также сделал автора обычным юзерам - теперь можно писать где угодно ;)

_________________
:dj: https://mastodon.social/@Shaos


17 Jun 2018 17:05
Profile WWW
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
Насчет 1й Сетуни - стало больше ясности: 5 трит адреса располагаются в старших разрядах, самый младший 1 трит определяет добавлять(+) или вычитать(-) индексный регистр из адреса или только адрес(0). Между ними 3 трита - опкод. Таблица действий процессора связанных с этими 3 тритами конечно была (но ранее у меня не было ясности где именно среди 9 тритов инструкции располагаются эти 3 трита)
Попытался расшифровать в более менее человекопонятный вид программу "Тест-1" для эмулятора СетуниВС
пока все немного криво:
Code:
terna=deci: tritvalue action                mnemonic ternary            mnemonic decimal
-----=-121: 00+-+0-00 (A*)=>(F)             mov   F,[00+-+]             ;mov F,[7]
----0=-120: 00+0+00-0 (F)=>(A*)             mov   [00+0+],F             ;mov [10],F
----+=-119: +000+-000 Вводв Фà*. Вывод из Фà*
---0-=-118: +0+---0++ (Ôà*)+F=>(Ìä*)
---00=-117: +0+---0-+ (Ìä*)+F=>(Ôà*)
---0+=-116: 000+00-00 (A*)=>(F)             mov   F,[000+0]             ;mov F,[3]
---+-=-115: 0+--0+000 (A*)=>(S)             mov   S,[0+--0]             ;mov S,[15]
---+0=-114: 00++--++0 (S)=>(A*)             mov   [00++-],S             ;mov [11],S
---++=-113: ----0+00+ (A*)=>(S)             mov   S,[----0 + F]         ;mov S,[F-120]
--0--=-112: 00+-0-+00 (S) íà (A*)=>(S)      shift S,[00+-0]             ;shift S,[6]
--0-0=-111: 00++-+0+0 (S)+(A*)=>(S)         add   S,[00++-]             ;add S,[11]
--0-+=-110: 00++--++0 (S)=>(A*)             mov   [00++-],S             ;mov [11],S
--00-=-109: 00+-+0--0 (F)+(A*)=>(F)         add   F,[00+-+]             ;add F,[7]
--000=-108: 0-0000+-0 A*=>(C) ïðè w=-       jn    0-000                 ;jneg -27
--00+=-107: 0-+++0++0 A*=>(C) ïðè w=+       jp    0-+++                 ;jpos -14
--0+-=-106: 000++0-00 (A*)=>(F)             mov   F,[000+0]             ;mov F,[3]
--0+0=-105: 0-0000000 A*=>(C)               call  0-000 ; mov C,[0-000] ;call -27
--0++=-104: 00+0+0-00 (A*)=>(F)             mov   F,[00+0+]             ;mov F,[10]
--+--=-103: 0+-0-+0-+ (S)-(A*)+F=>(S)       sub   S,[0+-0- + F]         ;sub S,[F+17]
--+-0=-102: 00-+00+00 A*=>(C) ïðè w=0       jz    00-+0                 ;jzer -6
--+-+=-101: 00000+--0 (A*)=>(R)             STOP                        ;make STOP
--+0-=-100: 0--000000
--+00=-099: 00+000--0
--+0+=-098: 0---+0+00
--++-=-097: +0+0--0-0
--++0=-096: -0+---0-0
--+++=-095: +--+00000
-0---=-094: 0---00000
-0--0=-093: -00000000
-0--+=-092: -000+0000
-0-0-=-091: 00-000000
-0-00=-090: 000+00000
-0-0+=-089: 000-00000
-0-+-=-088: 000000000
-0-+0=-087: 0000000-+
-0-++=-086: +0---+-+-
-00--=-085: 000000000
-00-0=-084: 000000000
-00-+=-083: 0000000-+
-000-=-082: +0---+-+-
-0000=-081: 0000000-+
-000+=-080: +-+-+-+-0
-00+-=-079: 000000000
-00+0=-078: 000000000
-00++=-077: 000000000
-0+--=-076: 000000000
-0+-0=-075: 000000000
-0+-+=-074: 000000000
-0+0-=-073: 000000000
-0+00=-072: 000000000
-0+0+=-071: 000000000
-0++-=-070: 000000000
-0++0=-069: 000000000
-0+++=-068: 000000000
-+---=-067: ++0-0-0++
-+--0=-066: +0++0-0++
-+--+=-065: ++-00+---
-+-0-=-064: 000000000
-+-00=-063: ----+0-+0
-+-0+=-062: +-0-+0+00
-+-+-=-061: 0--00+--0
-+-+0=-060: -0+-00-00
-+-++=-059: -00+++000
-+0--=-058: -000++0+0
-+0-0=-057: -00+0+0-0
-+0-+=-056: +-+-+0+00
-+00-=-055: 000-0+--0
-+000=-054: -+-+-+000
-+00+=-053: -+---++00
-+0+-=-052: -+00-+0-0
-+0+0=-051: -+0+-+0-0
-+0++=-050: -+0--+-+0
-++--=-049: -+-+-+++0
-++-0=-048: -+-+-++-0
-++-+=-047: -+-+-+0-0
-++0-=-046: +0-++0+00
-++00=-045: -+++0+--0
-++0+=-044: +0--0+000
-+++-=-043: -00+++-00
-+++0=-042: -0+-+-+00
-++++=-041: -++0000+0
0----=-040: -+++--+-0
0---0=-039: -0+-++0-0
0---+=-038: +0+-+0+00
0--0-=-037: 00+00+--0
0--00=-036: -0+-0+000
0--0+=-035: -++00+0-0
0--+-=-034: +0+++0+00
0--+0=-033: 000+0+--0
0--++=-032: -+++-+000
0-0--=-031: -0+00-+00
0-0-0=-030: -0+-0+0+0
0-0-+=-029: ++-+00+00
0-00-=-028: 000+++--0
0-000=-027: +-+-00--0 (F)+(A*)=>(F)         add   F,[+-+-0]
0-00+=-026: +-0000++0 A*=>(C) ïðè w=+       jp    +-000                 ;jpos 54 - any undefined value (defined with call to 0)
0-0+-=-025: +0+-00-00 (A*)=>(F)             mov   F,[+0+-0]
0-0+0=-024: -++-+00-0 (F)=>(A*)             mov   [-++-+],F
0-0++=-023: -+-+-+00- (A*)-F=>(S)           mov   S,[-+-+- - F]
0-+--=-022: -++0--++0 Undefined instruction                             ;that will cause cpu interrupt
0-+-0=-021: -0+-00-00
0-+-+=-020: +-----++-
0-+0-=-019: +-+-00--0
0-+00=-018: ++0++0++0
0-+0+=-017: +-0-00-00
0-++-=-016: +-----0++
0-++0=-015: -0+000--0
0-+++=-014: +++0+0+-0 A*=>(C) ïðè w=-       jn    +++0+                 ;jpos 118 - any undefined value (defined with call to 0) - I think it is always false
00---=-013: +-0-00-00 (A*)=>(F)             mov   F,[+-0-0]             ;mov F,[51]
00--0=-012: -++-000-0 (F)=>(A*)             mov   [-++-0],F             ;mov [-48],F
00--+=-011: +-----0-+ (Ìä*)+F=>(Ôà*)
00-0-=-010: -0+-00-00 (A*)=>(F)             mov   F,[-0+-0]             ;mov F,[-75]
00-00=-009: -++0-+000 (A*)=>(S)             mov   S,[-++0-]             ;mov S,[-46]
00-0+=-008: +----+0-- (S)-(A*)-F=>(S)       sub   S,[+---- -F]          ;sub S,[-F+41]
00-+-=-007: --+++0+00 A*=>(C) ïðè w=0       jz    --+++                 ;jzer -95
00-+0=-006: -+++--++0 (S)=>(A*)             mov   [-+++-],S             ;mov [-43],S
00-++=-005: -+++-+-+0 (A*)=>(R)             mov   R,[-+++-]             ;mov R,[-43]
000--=-004: -++-0+000 (A*)=>(S)             mov   S,[-++-0]             ;mov S,[-48]
000-0=-003: -0+0++0+0 (S)+(A*)=>(S)         add   S,[-0+0+]             ;add S,[-71]
000-+=-002: --++0-++0 (S)=>(A*)             mov   [--++0],S             ;mov [-96],S
0000-=-001: -++0-+000 (A*)=>(S)             mov   S,[-++0-]             ;mov S,[-46]
00000=0000: -0+-0+-00 (A*)[x](S)=>(S)       porazryadnoe umnojenie
0000+=+001: --++0+0+0 (S)+(A*)=>(S)         add   S,[--++0]             ;add S,[-96]
000+-=+002: --++0-++0 (S)=>(A*)             mov   [--++0],S             ;mov [-96],S
000+0=+003: 000000000 A*=>(C)               call  00000                 ;infinity loop - what a...
000++=+004: +-+-00--0
00+--=+005: ---+00++0
00+-0=+006: -++-00-00
00+-+=+007: -0+000--0
00+0-=+008: ----+0+-0
00+00=+009: -++-+0-00
00+0+=+010: +-+-00--0
00++-=+011: ++0-+0++0
00++0=+012: +0-00-000
00+++=+013: +--+00000
0+---=+014: 0-+00-00+
0+--0=+015: 0---+++--
0+--+=+016: 0-+0--0++
0+-0-=+017: +00000000
0+-00=+018: 0-++-0000
0+-0+=+019: 0000+0000
0+-+-=+020: +----+--0
0+-+0=+021: 000000000
0+-++=+022: 000000000
0+0--=+023: +++++++++
0+0-0=+024: +++++++++
0+0-+=+025: ---------
0+00-=+026: ---------
0+000=+027: 0+0-0--+0
0+00+=+028: +-0+0++-0
0+0+-=+029: 0+-++-+-+
0+0+0=+030: --+--+-+-
0+0++=+031: ++0-++--0
0++--=+032: --0+--+++
0++-0=+033: 0+-0+0000
0++-+=+034: ++0+0-+0+
0++0-=+035: 0--000000
0++00=+036: 00+-00000
0++0+=+037: +++++0+++
0+++-=+038: +++++++++
0+++0=+039: 000+00000
0++++=+040: 000+00000

обнаружил некоторые затруднения:
1.Стоп - наверно это не ошибка, а настоящий конец программы (т.к. вся остальная логика в подфункциях).
2.Выполнение недокументированной инструкции - это однозначно вызовет прерывание (куда уйдет код после него - хз, перепрыгнет ли он незнакомую инструкцию или вовсе уйдет в дебри кода ОС)
3.Использован бесконечный цикл без условия выхода (мне кажется это плохо) - возможно на каком-то вызове случится исключение (если в архитектуру встроена хоть какая то защита от бесконечных циклов)

Может здесь есть тот кто делал эмулятор СетуньВС?


19 Jun 2018 13:51
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
поизучал файл application.jz с основной логикой эмулятора СетуниВС:
Code:
                 power:function(){trinary.setunws.init(),trinary.setunws.uiss.setRoot(),trinary.setunws.uiss.viewOriginal()},run:function(){trinary.setunws.ui.allocate()},
                 init:function(){trinary.setunws.defaults.core=trinary.setunws.core}},
trinary.setunws.core={mode:{"step-by-step":"-",
                            "set-up-code":"-",
                            "c-k":"0",
                            "mb-fk-vp":"0",
                            "command-from-panel":"0"},
                      "stop-at":"",
                      code:"",
                      button:{stop:{label:"\u041e\u0441\u0442\u0430\u043d\u043e\u0432",action:"stop"},
                              start:{label:"\u041f\u0443\u0441\u043a",action:"start"},
                              command:{label:"\u041a\u043e\u043c. \u041f\u0423",action:"execute"},
                              boot:{label:"\u041d\u0430\u0447. \u043f\u0443\u0441\u043a",action:"boot"}},
                      register:{p:{label:"\u03c6",size:2,value:"++"},
                                s:{label:"S",size:18,value:"++++++++++++++++++"},
                                r:{label:"R",size:18,value:"++++++++++++++++++"},
                                f:{label:"F",size:5,value:"+++++"},
                                c:{label:"C",size:5,value:"+++++"},
                                k:{label:"K",size:9,value:"+++++++++"},
                                w:{label:"\u03c9",size:1,value:"+"},
                                mb:{label:"\u0417\u043e\u043d\u0430 \u041c\u0411",size:4,value:"++++"}},
                                ft:[[],[],[]],
                                mb:{},

из кода однозначно ясно - регистры инициируются положительными значениями


20 Jun 2018 17:12
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
адресное пространство оказалось уже на 1 позицию со стороны нижней границы (нет адреса -----), более того слово на нижней границе тоже инициализировано положительными тритами как регстры
Code:
memory:{"----0":"+++++++++",
        "----+":"000000000",
        "---00":"000000000",
        "---0+":"000000000",
        "---+0":"000000000",
        "---++":"000000000",
        "--0-0":"000000000",
        "--0-+":"000000000",
        "--000":"000000000",
        "--00+":"000000000",
        "--0+0":"000000000",
        "--0++":"000000000",
       ...
        "+++-0":"000000000",
        "+++-+":"000000000",
        "+++00":"000000000",
        "+++0+":"000000000",
        "++++0":"000000000",
        "+++++":"000000000"},


20 Jun 2018 17:17
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
2 непонятные таблицы (1 из них коды печатных символов, данные таблиц взаимнопересекаются)
Code:
symbols:{"+-0":["A","6","\u0410","6"],          ;u0410 - русская А                         
         "+-+":["B","7","\u0412","7"],          ;u0412 - русская В                         
         "+0-":["\u0421","8","\u0421","8"],     ;u0421 - русская С                         
         "+00":["D","9","\u0414","9"],          ;u0414 - русская Д                         
         "+0+":["E"," ","\u0415"," "],          ;u0415 - русская Е                         
         "--+":["_","_","_","_"],                                                         
         "-00":["G","/","\u0429","\u042e"],     ;u0429 - русская Щ, u042e - русская Ю     
         "-0+":["H",".","\u041d",","],          ;u041d - русская Н                         
         "-+0":["J","+","\u041b","+"],          ;u041b - русская Л                         
         "-++":["I","V","\u042b","\u042d"],     ;u042b - русская Ы, u042d - русская Э     
         "0--":["K","W","\u041a","\u0416"],     ;u041a - русская К, u0416 - русская Ж     
         "0-0":["L","X","\u0413","\u0425"],     ;u0413 - русская Г, u0425 - русская Х     
         "0-+":["M","Y","\u041c","\u0423"],     ;u041c - русская М, u0423 - русская У     
         "00-":["N","Z","\u0426","\u0426"],     ;u0426 - русская Ц                         
         "000":["P","0","\u0420","0"],          ;u0420 - русская Р                         
         "00+":["Q","1","\u0419","1"],          ;u0419 - русская Й                         
         "0+-":["R","2","\u042f","2"],          ;u042f - русская Я                         
         "0+0":["S","3","\u042c","3"],          ;u042c - русская Ь                         
         "0++":["T","4","\u0422","4"],          ;u0422 - русская Т                         
         "+--":["U","5","\u041f","5"],          ;u041f - русская П                         
         "+++":["(",")","\u0429","\u0424"],     ;u0429 - русская Щ, u0424 - русская Ф     
         "-+-":["=","*","=","*"]},                                                         
codes:{A:"+-0",                                                                           
       6:"+-0",                                                                           
       "\u0410":"+-0",                          ;u0410 - русская А                         
       B:"+-+",                                                                           
       7:"+-+",                                                                           
       "\u0412":"+-+",                          ;u0412 - русская В                         
       "\u0421":"+0-",                          ;u0421 - русская С                         
       8:"+0-",                                                                           
       D:"+00",                                                                           
       9:"+00",                                                                           
       "\u0414":"+00",                          ;u0414 - русская Д                         
       E:"+0+",                                                                           
       " ":"+0+",                                                                         
       "\u0415":"+0+",                          ;u0415 - русская Е                         
       F:"--+",                                                                           
       "-":"--+",                                                                         
       "\u0411":"--+",                          ;u0411 - русская Б                         
       G:"-00",                                                                           
       "/":"-00",                                                                         
       "\u0429":"+++",                          ;u0429 - русская Щ                         
       "\u042e":"-00",                          ;u042e - русская Ю                         
       H:"-0+",                                                                           
       ".":"-0+",                                                                         
       "\u041d":"-0+",                          ;u041d - русская Н                         
       ",":"-0+",                                                                         
       J:"-+0",                                                                           
       "+":"-+0",                                                                         
       "\u041b":"-+0",                          ;u041b - русская Л                         
       I:"-++",                                                                           
       V:"-++",                                                                           
       "\u042b":"-++",                          ;u042b - русская Ы                         
       "\u042d":"-++",                          ;u042d - русская Э                         
       K:"0--",                                                                           
       W:"0--",                                                                           
       "\u041a":"0--",                          ;u041a - русская К                         
       "\u0416":"0--",                          ;u0416 - русская Ж                         
       L:"0-0",                                                                           
       X:"0-0",                                                                           
       "\u0413":"0-0",                          ;u0413 - русская Г                         
       "\u0425":"0-0",                          ;u0425 - русская Х                         
       M:"0-+",                                                                           
       Y:"0-+",                                                                           
       "\u041c":"0-+",                          ;u041c - русская М                         
       "\u0423":"0-+",                          ;u0423 - русская У                         
       N:"00-",                                                                           
       Z:"00-",                                                                           
       "\u0426":"00-",                          ;u0426 - русская Ц                         
       P:"000",                                                                           
       0:"000",                                                                           
       "\u0420":"000",                          ;u0420 - русская Р                         
       Q:"00+",                                                                           
       1:"00+",                                                                           
       "\u0419":"00+",                          ;u0419 - русская Й                         
       R:"0+-",                                                                           
       2:"0+-",                                                                           
       "\u042f":"0+-",                          ;u042f - русская Я                         
       S:"0+0",                                                                           
       3:"0+0",                                                                           
       "\u042c":"0+0",                          ;u042c - русская Ь                         
       T:"0++",                                                                           
       4:"0++",                                                                           
       "\u0422":"0++",                          ;u0422 - русская Т                         
       U:"+--",                                                                           
       5:"+--",                                                                           
       "\u041f":"+--",                          ;u041f - русская П                         
       "(":"+++",                                                                         
       ")":"+++",                                                                         
       "\u0424":"+++",                          ;u0424 - русская Ф                         
       "=":"-+-",                                                                         
       "*":"-+-",                                                                         
       _:"--+"},                                                                           


20 Jun 2018 17:20
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
К сожалению не смог увидеть вывода в консоли браузера (как задумывалось автором)
Code:
trinary.setunws.console={data:"",
                         buffer:"",
                         stack:[],
                         warn:console.warn,
                         error:console.error,
                         info:console.info,
                         pc:0,
                         log:function(e){trinary.setunws.console.data+=e.join(""),
                                         trinary.setunws.console.pc!=trinary.setunws.processor.pc&&(trinary.setunws.console.pc=trinary.setunws.processor.pc,
                                                                                                    trinary.setunws.console.stack.push(trinary.setunws.console.data),
                                                                                                    trinary.setunws.console.data=""),
                                         trinary.setunws.console.stack.length>10&&trinary.setunws.console.stack.shift()},
                         clear:function(){trinary.setunws.console.data="",
                                          trinary.setunws.console.stack=[]}},
                         trinary.setunws.ft={load:function(e,t){if(isset(e)||(e=1),1==e||2==e){
                                                                  if(isset(t)){
                                                                     t=t.replace(/\u0446/gi,"z").replace(/\u0443/gi,"y").replace(/\u0445/gi,"x").replace(/\u0436/gi,"w").replace(/\u0447/gi,"4").replace(/\n/g," ");
                                                                     var n=trinary.core.detectBase(t);
                                                                     t=t.split(" ");
                                                                     var i=[];
                                                                     if (9==n)
                                                                       for(var r=0;r<t.length;r++)
                                                                         i.push(trinary.setunws.ft.tr923(t[r]));
                                                                     else
                                                                       for(var r=0;r<t.length;r++)
                                                                         i.push(trinary.core.grow(t[r].substr(0,9),9));
                                                                         return trinary.setunws.core.ft[e]=i,i}
                                                                  console.warn("FT:load. Data empty")}
                                                                else console.error("FT:load. Wrong device id")},
                                             read:function(e){var t=[];
                                                              if(isset(e)||(e=1),isset(trinary.setunws.core.ft[e]))
                                                                for(var n=trinary.setunws.core.ft[e],i=n.length,r=0;i>r;r++)
                                                                  if(t.push(n.shift()),r>=53){break}return t},
                                             tr923:function(e){return isset(e)?trinary.core.nonaryToTrinary(e.substr(0,5)).substr(1):void console.warn("tr923: empty data")}},
                         trinary.setunws.mb={write:function(e,t){isset(t)?(e=trinary.core.align(e.substr(0,4),4),
                                                                 trinary.setunws.core.register.mb.value=e,
                                                                 trinary.setunws.core.mb[e]=t):console.warn("MB write zone: empty data",
                                                                 arguments.calle)},
                                             read:function(e){var t=[];
                                                              return isset(e)&&isset(trinary.setunws.core.mb[e])?(trinary.setunws.core.register.mb.value=e,
                                                              t=trinary.setunws.core.mb[e]):console.warn("MB read zone: wrong zone address"),t}},
                         trinary.setunws.memory={__memory_address_start:-121,
                                                 __memory_address_end:122,
                                                 read:function(e){return isset(e)?trinary.setunws.memory.service.readWriteCell(e):void console.warn("memory read: empty address")},
                                                 write:function(e,t){if(isset(e)){if(isset(t))return trinary.setunws.memory.service.readWriteCell(e,t);
                                                                                  console.warn("memory write: empty value")}
                                                                     else console.warn("memory write: empty address")},
                                                 zone:{read:function(e){isset(e)||(e="0");
                                                                        for(var t,n,i=trinary.core.trinaryToDecimal(e+"---0"),r=0,o=[];;)
                                                                          if(t=trinary.core.align(trinary.core.decimalToTrinary(i),5),n=isset(trinary.setunws.core.memory[t])?trinary.setunws.core.memory[t]:trinary.setunws.memory.service.formater("0"),o.push(n),i+="+"==t.charAt(4)?2:1,r++,r>=54)
                                                                            break;
                                                                        return o},
                                                       write:function(e,t){if(isset(t)){isset(e)||(e="0");
                                                                                        var n,
                                                                                            i,
                                                                                            r=trinary.core.trinaryToDecimal(e+"---0"),
                                                                                            o=54;
                                                                                        for(var s in t)
                                                                                          if(n=trinary.core.align(trinary.core.decimalToTrinary(r),5),i=trinary.setunws.memory.service.formater(t[s]),trinary.setunws.core.memory[n]=i,r+="+"==n.charAt(4)?2:1,o-=1,0>=o)
                                                                                            break}
                                                                           else console.warn("Memory write zone: empty data",arguments.callee)}},
                                                       reset:function(){trinary.setunws.memory.service.writeData()},
                                                       service:{readWriteCell:function(e,t){if(isset(e)){if(isset(e.charAt(4))&&"-"==e.charAt(4)){var n,
                                                                                                                                                      i,
                                                                                                                                                      r=e.substr(0,4),
                                                                                                                                                      o=r+"0",
                                                                                                                                                      s=r+"+";
                                                                                                                                                  if(isset(t)){t=trinary.core.grow(t,18);
                                                                                                                                                               var a=t.substr(0,9),
                                                                                                                                                                   l=t.substr(9,9);
                                                                                                                                                               n=trinary.setunws.memory.service.cell(o,a),
                                                                                                                                                               i=trinary.setunws.memory.service.cell(s,l)}
                                                                                                                                                  else n=trinary.setunws.memory.service.cell(o),
                                                                                                                                                       i=trinary.setunws.memory.service.cell(s);
                                                                                                                                                  t=n+i}
                                                                                                         else t=trinary.setunws.memory.service.cell(e,t);
                                                                                                         return t}
                                                                                            console.warn("memory_cell: empty address")},
                                                                cell:function(e,t){return isset(e)&&isset(trinary.setunws.core.memory[e])?(isset(t)&&(trinary.setunws.core.memory[e]=trinary.setunws.memory.service.formater(t)),trinary.setunws.core.memory[e]):void 0},
                                                                formater:function(e){return isset(e)||(e="0"),"number"==typeof e&&(e=e.toString()),trinary.core.align(trinary.core.validate(e.substr(0,9)),9)},
                                                                writeData:function(e){"array"!=typeof e&&(e=[]);
                                                                                      for(var t,n,i=trinary.setunws.memory.__memory_address_start;i<trinary.setunws.memory.__memory_address_end;i++)
                                                                                        t=trinary.core.align(trinary.core.decimalToTrinary(i),5),
                                                                                        "-"!=t.charAt(4)&&(n=isset(e[t])?e[t]:0,
                                                                                        trinary.setunws.core.memory[t]=trinary.setunws.memory.service.formater(n))}}},
                         trinary.setunws.operation={boot:function(){var e=1,
                                                                        t=trinary.setunws.core.ft[e];
                                                                    trinary.setunws.operation.reset(),
                                                                    trinary.setunws.core.ft[e]=t;
                                                                    var n=trinary.setunws.ft.read(e);
                                                                    trinary.setunws.memory.zone.write("0",n),
                                                                    trinary.setunws.core.register.c.value="0000+",
                                                                    trinary.setunws.processor.start()},
                                                    reset:function(){trinary.setunws.processor.reset(),
                                                                     trinary.setunws.state.reset(),
                                                                     trinary.setunws.registers.reset(),
                                                                     trinary.setunws.memory.reset(),
                                                                     trinary.setunws.console.clear()},
                                                    start:function(){trinary.setunws.processor.__stop=!1,
                                                                     "+"==trinary.setunws.core.mode["step-by-step"]?trinary.setunws.processor.step():trinary.setunws.processor.start()},
                                                    step:function(){trinary.setunws.processor.step()},
                                                    stop:function(){trinary.setunws.processor.__stop=!0},
                                                    setcell:function(e,t){trinary.setunws.memory.write(e,t)},
                                                    stepByStep:{on:function(){trinary.setunws.core.mode["step-by-step"]="+"},
                                                    off:function(){trinary.setunws.core.mode["step-by-step"]="-"}},
                                                    setStopAddress:function(e){isset(e)?trinary.setunws.core["stop-at"]=e:console.warn("Action setStopAddress: empty address")},
                                                    setModeStepByStep:function(e){isset(e)?trinary.setunws.core.mode["step-by-step"]=e:console.warn("Action setModeStepByStep: empty value")},
                                                    changeModeSetUpCode:function(){var e=trinary.setunws.core.mode;
                                                                                   return e["set-up-code"]="+"==e["set-up-code"]?"-":"+"},
                                                    getModeSetUpCode:function(){return trinary.setunws.core.mode["set-up-code"]},
                                                    setModeCK:function(e){isset(e)?trinary.setunws.core.mode["c-k"]=e:console.warn("Action setModeCK: empty value")},
                                                    setModeMbFkVp:function(e){isset(e)?trinary.setunws.core.mode["mb-fk-vp"]=e:console.warn("Action setModeMbFkVp: empty value")},
                                                    setCode:function(e){return isset(e)?trinary.setunws.core.code=e:void console.warn("Action setCode: empty value")},
                                                    execute:function(e){isset(e)?(trinary.setunws.core.register.k.value=trinary.core.align(e.substr(0,9),9),"+"==trinary.setunws.core.mode["step-by-step"]?trinary.setunws.core.mode["command-from-panel"]="+":(trinary.setunws.processor.decode(),
                                                                                                                                                                                                                                                                trinary.setunws.processor.execute(),
                                                                                                                                                                                                                                                                trinary.setunws.processor.start())):console.warn("Action execute: empty command")}},
                         trinary.setunws.output={data:null,
                                                 output:function(e){var t="",
                                                                        n=0,
                                                                        i="";
                                                                    if(isset(e)){e=e.join("");
                                                                                 for(var r=0;r<e.length;r++)
                                                                                   if(i+=e.charAt(r),i.length>=3){if("++0"===i)n=0;
                                                                                                                  else if("++-"===i)n=1;
                                                                                                                       else if("-0-"===i)t+="\n";
                                                                                                                            else{if("---"===i)break;
                                                                                                                                 isset(trinary.setunws.core.symbols[i])&&(t+=trinary.setunws.core.symbols[i][n])}
                                                                                                                  i=""}}
                                                                    else console.warn("Output: empty data",arguments.calle);
                                                                    return trinary.setunws.output.data=t,t},
                                                 text2code:function(e){isset(e)||(e="",console.warn("text2code: empty text"));
                                                                       for(var t,n="",i=0;i<e.length;i++)
                                                                         t=e[i],
                                                                         isset(trinary.setunws.core.codes[t])&&(n+=trinary.setunws.core.codes[t]);
                                                                       return n}},


20 Jun 2018 17:24
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
наконец код самой эмуляции процессора:
Code:
trinary.setunws.processor={__stop:!1,
                                                    delay:0,
                                                    pc:0,
                                                    timer:null,
                                                    running:!1,
                                                    time:{start:null,end:null},
                                                    start:function(){trinary.setunws.processor.time.start=new Date,
                                                                     trinary.setunws.processor.cycle0()},
                                                    cycle0:function(){trinary.setunws.processor.timer=setTimeout("trinary.setunws.processor.cycle1()",10)},
                                                    cycle1:function(){for(var e=10;e>0;)
                                                                        1!=trinary.setunws.processor.__stop?(trinary.setunws.processor.cycle(),
                                                                        trinary.setunws.processor.running=!0,
                                                                        trinary.setunws.processor.pc%10==0&&trinary.setunws.ui.update()):(trinary.setunws.processor.running=!1,trinary.setunws.ui.update(),e=0),
                                                                        e--;
                                                                        1!=trinary.setunws.processor.__stop&&trinary.setunws.processor.cycle0()},
                                                    cycle:function(){var e=trinary.setunws.core.register.c.value.charAt(4),
                                                                         t=trinary.setunws.core.register.c.value;
                                                                     if(trinary.setunws.console.log(["<",trinary.setunws.processor.pc,"> ",trinary.core.trinaryToNonary(t),"[",t,"]\xa0(\u03c9):",trinary.setunws.core.register.w.value," "]),"-"===e){
                                                                       var n=trinary.setunws.core.register.c.value.substr(0,4),
                                                                           i=n+"0",
                                                                           r=n+"+";
                                                                       trinary.setunws.core.register.k.value=trinary.setunws.core.memory[i],
                                                                       trinary.setunws.processor.stop()||(trinary.setunws.processor.decode(),
                                                                                                          trinary.setunws.processor.execute(),
                                                                                                          trinary.setunws.processor.execute(),
                                                                                                          trinary.setunws.core.register.k.value=trinary.setunws.core.memory[r],
                                                                                                          trinary.setunws.processor.decode(),
                                                                       trinary.setunws.processor.stop()||trinary.setunws.processor.execute())}
                                                                     else trinary.setunws.core.register.k.value=trinary.setunws.core.memory[trinary.setunws.core.register.c.value],
                                                                          trinary.setunws.processor.decode(),
                                                                          trinary.setunws.processor.stop()||trinary.setunws.processor.execute();
                                                                     var o="0"===e?"+":"+"===e?"+-":"++";
                                                                     if(trinary.setunws.core.register.c.value==t){
                                                                       var s=null;
                                                                       s="+++++"==trinary.setunws.core.register.c.value?"----0":"0++++"==trinary.setunws.core.register.c.value?"+---0":"-++++"==trinary.setunws.core.register.c.value?"0---0":trinary.core.sum(trinary.setunws.core.register.c.value,o),
                                                                       trinary.setunws.core.register.c.value=trinary.core.align(s,5)}
                                                                     t=trinary.setunws.core.register.c.value,
                                                                     trinary.setunws.processor.pc++,
                                                                     trinary.setunws.console.log(["-> ",trinary.core.trinaryToNonary(t),"[",t,"]"])},
                                                    execute:function(){isset(trinary.setunws.processor.commands[trinary.setunws.state.command.code])?trinary.setunws.processor.commands[trinary.setunws.state.command.code]():trinary.setunws.trinary.setunws.console.warn("Processor: execute, wrong command code",p.state.command.code)},
                                                    step:function(){"+"==trinary.setunws.core.mode["command-from-panel"]?(trinary.setunws.core.mode["command-from-panel"]="0",
                                                                                                                          trinary.setunws.processor.decode(),
                                                                                                                          trinary.setunws.processor.execute()):trinary.setunws.processor.cycle(),
                                                                    trinary.setunws.processor.running=!1,trinary.setunws.ui.update()},
                                                    reset:function(){trinary.setunws.processor.__stop=!1,
                                                                     trinary.setunws.processor.pc=0,
                                                                     trinary.setunws.processor.timer=null,
                                                                     trinary.setunws.processor.running=!1,
                                                                     trinary.setunws.processor.time.start=null,
                                                                     trinary.setunws.processor.time.end=null},
                                                    decode:function(){var e=trinary.core.align(trinary.setunws.core.register.k.value.substr(0,9),9);
                                                                      trinary.setunws.state.command.value=e,
                                                                      trinary.setunws.state.command.code=e.substr(5,3);
                                                                      var t=e.substr(8,1);
                                                                      trinary.setunws.state.command.flag=t;
                                                                      var n=e.substr(0,5),
                                                                      i=trinary.setunws.core.register.f.value;
                                                                      i=trinary.core.tryteMultiplyTrit(i,t);
                                                                      var r=trinary.core.sum(n,i);
                                                                      r=trinary.core.align(r,5),
                                                                      trinary.setunws.state.command.address=r.substr(-5);
                                                                      var o="+"==trinary.setunws.core.mode["set-up-code"]?!0:!1;
                                                                      trinary.setunws.state.keying=o;
                                                                      var s=isset(trinary.setunws.core.code)?trinary.setunws.core.code:"";
                                                                      trinary.setunws.state.cell=o?s:trinary.setunws.memory.read(trinary.setunws.state.command.address),
                                                                      trinary.setunws.processor.__stop=!1;
                                                                      {var a=trinary.setunws.processor.tooltip[trinary.setunws.state.command.code];
                                                                       trinary.setunws.core.register.c.value,trinary.setunws.core.register.k.value}
                                                                      trinary.setunws.console.log([trinary.core.trinaryToNonary(trinary.setunws.state.command.code)," [",trinary.setunws.state.command.code,"] ",a.name,"; ",a.content," "]),
                                                                      trinary.setunws.console.log(["A:\xa0\xa0",n,"\xa0+\xa0\u03c0\u0444:",trinary.setunws.state.command.flag,"\xa0x\xa0F:",trinary.setunws.core.register.f.value," "]),
                                                                      trinary.setunws.console.log(["A*:\xa0",trinary.setunws.state.command.address,"\xa0\xa0\xa0\xa00x9:",trinary.core.trinaryToNonary(trinary.setunws.state.command.address)," "]),
                                                                      trinary.setunws.console.log(["(A*):",trinary.setunws.state.cell,"\xa0\xa0\xa00x9:",trinary.core.trinaryToNonary(trinary.setunws.state.cell)," "])},
                                                    stop:function(){return"-"==trinary.setunws.core.mode["c-k"]&&trinary.setunws.core["stop-at"]==trinary.setunws.core.register.c.value?trinary.setunws.processor.__stop=!0:"+"==trinary.setunws.core.mode["c-k"]&&trinary.setunws.core["stop-at"]==trinary.setunws.state.command.address&&("0"==trinary.setunws.core.mode["mb-fk-vp"]?trinary.setunws.processor.__stop=!0:"-"!=trinary.setunws.core.mode["mb-fk-vp"]||"-0+"!=trinary.setunws.state.command.code&&"-0-"!=trinary.setunws.state.command.code?"+"==trinary.setunws.core.mode["mb-fk-vp"]&&"-00"==trinary.setunws.state.command.code&&(trinary.setunws.processor.__stop=!0):trinary.setunws.processor.__stop=!0),trinary.setunws.processor.__stop}},
                         trinary.setunws.processor.commands={"+00":function(){trinary.setunws.core.register.s.value=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.console.log(["(S):",trinary.setunws.core.register.s.value,"  (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "+0+":function(){var e=trinary.setunws.core.register.s.value,
                                                                                  t=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  n=trinary.core.sum(e,t);
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(n.substr(-18),18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.core.register.p.value=trinary.core.align(n.substr(-20,2),2),
                                                                              trinary.setunws.console.log(["(A*):",t,"(S):",e," (A*)+(S):",n,"  (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              n.length>18&&(trinary.setunws.processor.__stop=!0,
                                                                                            trinary.setunws.console.warn("Overflow! -> S:",n," \u03c6:",trinary.setunws.core.register.p.value))},
                                                             "+0-":function(){var e=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  t=trinary.setunws.core.register.s.value,
                                                                                  n=trinary.core.inverse(e),
                                                                                  i=trinary.core.sum(t,n);
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(i.substr(-18),18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.core.register.p.value=trinary.core.align(i.substr(-20,2),2),
                                                                              trinary.setunws.console.log(["(S):",t," (A*):",e," (S)-(A*):",i," => (S): ",trinary.setunws.core.register.s.value,"  (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              i.length>18&&(trinary.setunws.processor.__stop=!0,
                                                                                            trinary.setunws.console.warn("Overflow! -> S:",i," \u03c6:",trinary.setunws.core.register.p.value))},
                                                             "++0":function(){var e=trinary.setunws.core.register.r.value=trinary.setunws.core.register.s.value,
                                                                                  t=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  n=trinary.core.align(trinary.core.multiplication(t,e),36),
                                                                                  i=n.substr(2,18),
                                                                                  r=n.substr(0,2);
                                                                              trinary.setunws.core.register.s.value=i,
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(i),
                                                                              trinary.setunws.core.register.p.value=r,
                                                                              trinary.setunws.console.log([" (R):",e," (A*):",t," (A*)*(R):",n," -> S:",i," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              "00"!=r&&(trinary.setunws.processor.__stop=!0,
                                                                                        trinary.setunws.console.warn("Overflow! -> R:",n," \u03c6:",trinary.setunws.core.register.p.value))},
                                                             "+++":function(){var e=trinary.setunws.core.register.s.value,
                                                                                  t=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  n=trinary.setunws.core.register.r.value,
                                                                                  i=trinary.core.align(trinary.core.multiplication(t,n),36),
                                                                                  r=i.substr(2,18),
                                                                                  o=i.substr(0,2);
                                                                              "00"!=o&&(trinary.setunws.processor.__stop=!0,
                                                                              trinary.setunws.console.warn("Overflow! -> AR:",i," \u03c6:",o));
                                                                              var s=trinary.core.align(trinary.core.sum(e,r),20);
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(s.substr(-18),18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.core.register.p.value=trinary.core.align(s.substr(-20,2),2),
                                                                              trinary.setunws.console.log(["(S):",e," (A*):",t," (R):",n," (A*)*(R):",i," [(A*)*(R)]18:",r," (S)+(A*)*(R):",s," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              "00"!=trinary.setunws.core.register.p.value&&(trinary.setunws.processor.__stop=!0,
                                                                                                                            trinary.setunws.console.warn("Overflow! -> S:",s," \u03c6:",trinary.setunws.core.register.p.value))},
                                                             "++-":function(){var e=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  t=trinary.setunws.core.register.s.value,
                                                                                  n=trinary.setunws.core.register.r.value,
                                                                                  i=trinary.core.align(trinary.core.multiplication(t,n),36),
                                                                                  r=i.substr(2,18),
                                                                                  o=i.substr(0,2);
                                                                              "00"!=o&&(trinary.setunws.processor.__stop=!0,
                                                                                        trinary.setunws.console.warn("Overflow! -> SR:",i," \u03c6:",o));
                                                                              var s=trinary.core.align(trinary.core.sum(e,r),20);
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(s.substr(-18),18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.core.register.p.value=trinary.core.align(s.substr(-20,2),2),
                                                                              trinary.setunws.console.log([" (A*):",e," (S):",t," (R):",n," (S)*(R):",i," [(S)*(R)]18:",r," (A*)+(S)*(R):",s," -> (S):",trinary.setunws.core.register.s.value," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              "00"!=o&&(trinary.setunws.processor.__stop=!0,
                                                                                        trinary.setunws.console.warn("Overflow! -> (A*)+(S)*(R):",s," \u03c6:",o))},
                                                             "+-0":function(){var e=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                                  t=trinary.setunws.core.register.s.value,
                                                                                  n=trinary.setunws.core.register.s.value=trinary.core.bitwiseMultiplication(e,t);
                                                                                  trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                                  trinary.setunws.console.log(["(A*):",e," (S):",t," (A*)x(S):",n,"  (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "+-+":function(){trinary.setunws.core.register.r.value=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.r.value),
                                                                              trinary.setunws.console.log(["(R):",trinary.setunws.core.register.r.value,"  (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "+--":function(){trinary.setunws.core.register.r.value=trinary.core.grow(trinary.setunws.state.cell,18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.r.value),
                                                                              trinary.setunws.processor.__stop=!0,
                                                                              trinary.setunws.console.log(["(R):",trinary.setunws.core.register.r.value," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              trinary.setunws.console.log(["STOPED!"])},
                                                             "0+0":function(){"0"===trinary.setunws.core.register.w.value&&(trinary.setunws.core.register.c.value=trinary.setunws.state.command.address,
                                                                                                                            trinary.setunws.console.log(["(C) <- ",trinary.setunws.core.register.c.value]))},
                                                             "0++":function(){"+"==trinary.setunws.core.register.w.value&&(trinary.setunws.core.register.c.value=trinary.setunws.state.command.address,
                                                                                                                           trinary.setunws.console.log(["(C) <- ",trinary.setunws.core.register.c.value]))},
                                                             "0+-":function(){"-"==trinary.setunws.core.register.w.value&&(trinary.setunws.core.register.c.value=trinary.setunws.state.command.address,
                                                                                                                           trinary.setunws.console.log(["(C) <- ",trinary.setunws.core.register.c.value]))},
                                                             "000":function(){trinary.setunws.core.register.c.value=trinary.setunws.state.command.address,
                                                                              trinary.setunws.console.log(["(C) <- ",trinary.setunws.core.register.c.value])},
                                                             "00+":function(){var e=trinary.setunws.state.command.address,
                                                                                  t=trinary.core.grow(trinary.setunws.core.register.c.value,9);
                                                                              trinary.setunws.memory.write(e,t),
                                                                              trinary.setunws.console.log(["(C):",trinary.setunws.core.register.c.value," => A*:",e," (A*):",trinary.setunws.memory.read(e)])},
                                                             "00-":function(){var e=trinary.setunws.state.command.address,
                                                                                  t=trinary.core.grow(trinary.setunws.core.register.f.value,9);
                                                                              trinary.setunws.memory.write(e,t),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(t),
                                                                              trinary.setunws.console.log(["(F):",t," -> A*:",e," (A*):",trinary.setunws.memory.read(e)," (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "0-0":function(){var e=trinary.setunws.state.cell.substr(0,5);
                                                                              trinary.setunws.core.register.f.value=e,
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.f.value),
                                                                              trinary.setunws.console.log(["(A*):",trinary.setunws.state.cell,"-> F:",e])},
                                                             "0-+":function(){var e=trinary.setunws.state.cell.substr(0,5),
                                                                                  t=trinary.setunws.core.register.c.value,
                                                                                  n=trinary.core.align(trinary.core.sum(e,t),5);
                                                                              trinary.setunws.core.register.f.value=n.substr(0,5),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.f.value),
                                                                              trinary.setunws.console.log(["(A*):",e," (C):",t," (A*)+(C):",n," -> (F):",trinary.setunws.core.register.f.value," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              n.length>5&&trinary.setunws.console.error("overflow:",n)},
                                                             "0--":function(){var e=trinary.setunws.core.register.f.value,
                                                                                  t=trinary.setunws.state.cell,
                                                                                  n=trinary.core.align(trinary.core.sum(e,t.substr(0,5)),5);
                                                                              trinary.setunws.core.register.f.value=n.substr(0,5),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.f.value),
                                                                              trinary.setunws.console.log(["(F):",e," (A*):",t," (F)+(A*):",n," -> (F):",trinary.setunws.core.register.f.value," (\u03c9):",trinary.setunws.core.register.w.value]),
                                                                              n.length>5&&trinary.setunws.console.error("overflow:",n)},
                                                             "-+0":function(){var e=trinary.setunws.state.cell.substr(0,5),
                                                                                  t=trinary.setunws.core.register.s.value,
                                                                                  n=trinary.core.shift(trinary.setunws.core.register.s.value,e);
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(n,18),
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.console.log(["N:",e," 0x10:",trinary.core.trinaryToDecimal(e)," (S):",t," -> ",n," (S):",trinary.setunws.core.register.s.value," (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "-++":function(){if(trinary.setunws.state.keying){
                                                                                var e=trinary.setunws.core.code;
                                                                                trinary.setunws.console.log(["Keying!"]),
                                                                                "-"===trinary.setunws.state.command.address.charAt(4)?trinary.setunws.memory.write(trinary.setunws.state.command.address,e):trinary.setunws.memory.write(trinary.setunws.state.command.address,e.substr(0,9)),
                                                                                trinary.setunws.core.register.w.value=trinary.core.sign(e)}
                                                                              else
                                                                                "-"===trinary.setunws.state.command.address.charAt(4)?trinary.setunws.memory.write(trinary.setunws.state.command.address,trinary.setunws.core.register.s.value):trinary.setunws.memory.write(trinary.setunws.state.command.address,trinary.setunws.core.register.s.value.substr(0,9)),
                                                                                trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                                trinary.setunws.console.log(["A*:",trinary.setunws.state.command.address," (S):",trinary.setunws.core.register.s.value," (A*):",trinary.setunws.memory.read(trinary.setunws.state.command.address)," (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "-+-":function(){var e=trinary.core.normalize(trinary.setunws.core.register.s.value,18),
                                                                                  t=e.N,
                                                                                  n=e.normalize;
                                                                              if(trinary.setunws.console.log(["S:",trinary.setunws.core.register.s.value," N:",t," normalize:",n]),
                                                                                "-"===trinary.setunws.state.command.address.charAt(4)){
                                                                                var i=trinary.core.align(n,18);
                                                                                trinary.setunws.memory.write(trinary.setunws.state.command.address,i)}
                                                                              else{var i=n.substr(0,9);
                                                                                   trinary.setunws.memory.write(trinary.setunws.state.command.address,i)}
                                                                              trinary.setunws.core.register.s.value=trinary.core.align(t,5)+"0000000000000",
                                                                              trinary.setunws.core.register.w.value=trinary.core.sign(trinary.setunws.core.register.s.value),
                                                                              trinary.setunws.console.log(["(A*):",i," (S):",trinary.setunws.core.register.s.value," (\u03c9):",trinary.setunws.core.register.w.value])},
                                                             "-00":function(){var e=trinary.setunws.state.command.address.charAt(0),
                                                                                  t=trinary.setunws.state.command.address.substr(1,4);
                                                                              if(trinary.setunws.console.log(["code:",t," zone:",e]),"000+"===t)
                                                                                trinary.setunws.console.log(["FT-1 -> MemBank :",e]),
                                                                                trinary.setunws.memory.zone.write(e,trinary.setunws.ft.read(1));
                                                                              else if("00+0"===t)
                                                                                trinary.setunws.console.log("FT-2 -> MemBank :",e),
                                                                                trinary.setunws.memory.zone.write(e,trinary.setunws.ft.read(2));
                                                                              else if("000-"===t)trinary.setunws.console.log(["UNDER CONSTRUCTION"]);
                                                                              else if("00-0"===t)trinary.setunws.console.log(["UNDER CONSTRUCTION"]);
                                                                              else if("0-00"===t){trinary.setunws.console.log(["PRINTER!"]);
                                                                              var n=trinary.setunws.memory.zone.read(e);
                                                                              trinary.setunws.console.log([n.length]),
                                                                              trinary.setunws.core.printer.data=trinary.setunws.output.output(n)}},
                                                             "-0+":function(){var e=trinary.setunws.state.command.address.charAt(0),
                                                                                  t=trinary.setunws.memory.zone.read(e),
                                                                                  n=trinary.setunws.state.command.address.substr(1,4);
                                                                              trinary.setunws.mb.write(n,t),
                                                                              trinary.setunws.console.log(["\u0424["+e+"] -> M["+n+"] data:",t])},
                                                             "-0-":function(){var e=trinary.setunws.state.command.address.substr(1,4),
                                                                                  t=trinary.setunws.mb.read(e),
                                                                                  n=trinary.setunws.state.command.address.charAt(0);
                                                                              trinary.setunws.memory.zone.write(n,t),
                                                                              trinary.setunws.console.log(["M["+e+"] -> \u0424["+n+"] data:",t])},
                                                             "--0":function(){trinary.setunws.processor.__stop=!0,
                                                                              trinary.setunws.console.log(["This command not used"])},
                                                             "--+":function(){trinary.setunws.processor.__stop=!0,
                                                                              trinary.setunws.console.log(["This command not used"])},
                                                             "---":function(){trinary.setunws.processor.__stop=!0,
                                                                              trinary.setunws.console.log(["This command not used"])}},
                         trinary.setunws.processor.tooltip={"+00":{nonary:"30",name:"\u041f\u043e\u0441\u044b\u043b\u043a\u0430\xa0\u0432\xa0S\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(A*)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "+0+":{nonary:"33",name:"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435\xa0\u0432\xa0S\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(S)+(A*)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "+0-":{nonary:"3\u0445",name:"\u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435\xa0\u0432\xa0S\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(S)-(A*)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "++0":{nonary:"40",name:"\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\xa00\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(S)=>(R);\xa0(A*)(R)=>(S)\xa0\xa0"},
                                                            "+++":{nonary:"43",name:"\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\xa0+\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(S)+(A*)(R)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "++-":{nonary:"4\u0445",name:"\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\xa0-\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(A*)+(S)(R)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "+-0":{nonary:"20",name:"\u041f\u043e\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0435\xa0\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435",content:"(A*)[x](S)=>(S)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "+-+":{nonary:"23",name:"\u041f\u043e\u0441\u044b\u043b\u043a\u0430\xa0\u0432\xa0R\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(A*)=>(R)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "+--":{nonary:"2\u0445",name:"\u041e\u0441\u0442\u0430\u043d\u043e\u0432\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"\u0421\u0442\u043e\u043f;\xa0(A*)=>(R)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0+0":{nonary:"10",name:"\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439\xa0\u043f\u0435\u0440\u0435\u0445\u043e\u0434\xa00\xa0\xa0\xa0",content:"A*=>(C)\xa0\u043f\u0440\u0438\xa0w=0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0++":{nonary:"13",name:"\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439\xa0\u043f\u0435\u0440\u0435\u0445\u043e\u0434\xa0+\xa0\xa0\xa0",content:"A*=>(C)\xa0\u043f\u0440\u0438\xa0w=+\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0+-":{nonary:"1\u0445",name:"\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439\xa0\u043f\u0435\u0440\u0435\u0445\u043e\u0434\xa0-\xa0\xa0\xa0",content:"A*=>(C)\xa0\u043f\u0440\u0438\xa0w=-\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "000":{nonary:"00",name:"\u0411\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439\xa0\u043f\u0435\u0440\u0435\u0445\u043e\u0434\xa0\xa0",content:"A*=>(C)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "00+":{nonary:"03",name:"\u0417\u0430\u043f\u0438\u0441\u044c\xa0\u0438\u0437\xa0C\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(C)=>(A*)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "00-":{nonary:"0\u0445",name:"\u0417\u0430\u043f\u0438\u0441\u044c\xa0\u0438\u0437\xa0F\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(F)=>(A*)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0-0":{nonary:"\u04460",name:"\u041f\u043e\u0441\u044b\u043b\u043a\u0430\xa0\u0432\xa0F\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(A*)=>(F)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0--":{nonary:"\u04463",name:"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435\xa0\u0432\xa0F\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(F)+(A*)=>(F)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "0-+":{nonary:"\u0446\u0445",name:"\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435\xa0\u0432\xa0F\xa0c\xa0(C)\xa0\xa0\xa0",content:"(C)+(A*)=>F\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "-+0":{nonary:"\u04430",name:"\u0421\u0434\u0432\u0438\u0433\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"\u0421\u0434\u0432\u0438\u0433\xa0(S)\xa0\u043d\u0430\xa0(A*)=>(S)\xa0\xa0"},
                                                            "-++":{nonary:"\u04433",name:"\u0417\u0430\u043f\u0438\u0441\u044c\xa0\u0438\u0437\xa0S\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(S)=>(A*)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "-+-":{nonary:"\u0443\u0445",name:"\u041d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"\u041d\u043e\u0440\u043c.(S)=>(A*);\xa0(N)=>(S)"},
                                                            "-00":{nonary:"\u04450",name:"\u0412\u044b\u0432\u043e\u0434-\u0432\u0432\u043e\u0434\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"\u0412\u0432\u043e\u0434\xa0\u0432\xa0\u0424\u0430*.\xa0\u0412\u044b\u0432\u043e\u0434\xa0\u0438\u0437\xa0\u0424\u0430*"},
                                                            "-0+":{nonary:"\u04453",name:"\u0417\u0430\u043f\u0438\u0441\u044c\xa0\u043d\u0430\xa0\u041c\u0411\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0",content:"(\u0424\u0430*)=>(\u041c\u0434*)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "-0-":{nonary:"\u0445\u0445",name:"\u0421\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u0435\xa0\u0441\xa0\u041c\u0411\xa0\xa0\xa0\xa0\xa0\xa0",content:"(\u041c\u0434*)=>(\u0424\u0430*)\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "--0":{nonary:"\u04360",name:"\u041d\u0435\xa0\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0430\xa0\xa0\xa0\xa0\xa0",content:"\u0421\u0442\u043e\u043f\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "--+":{nonary:"\u04363",name:"\u041d\u0435\xa0\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0430\xa0\xa0\xa0\xa0\xa0",content:"\u0421\u0442\u043e\u043f\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"},
                                                            "---":{nonary:"\u0436\u0445",name:"\u041d\u0435\xa0\u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0430\xa0\xa0\xa0\xa0\xa0",content:"\u0421\u0442\u043e\u043f\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0"}},
                         trinary.setunws.registers={register_update:function(e){isset(e)||(e=[]);
                                                                                var t,
                                                                                    n;
                                                                                for(var i in trinary.setunws.core.register)
                                                                                  t=trinary.setunws.core.register[i],
                                                                                  n=isset(e[i])?e[i]:"0",
                                                                                  trinary.setunws.core.register[i].value=trinary.core.align(n,t.size)},
                                                    reset:function(){var e,
                                                                         t;
                                                                     for(var n in trinary.setunws.core.register)
                                                                       e=trinary.setunws.core.register[n],
                                                                       t=trinary.core.align("0",e.size),
                                                                       trinary.setunws.core.register[n].value=t}},
                                                    trinary.setunws.state={cell:"",
                                                                           keying:!1,
                                                                           command:{address:null,
                                                                                    code:null,
                                                                                    flag:null,
                                                                                    value:null},
                                                                           reset:function(){trinary.setunws.state.cell="",
                                                                                            trinary.setunws.state.keying=!1,
                                                                                            trinary.setunws.state.command={address:null,
                                                                                                                           code:null,
                                                                                                                           flag:null,
                                                                                                                           value:null}}},
                                                    trinary.setunws.ui={update:function(){},
                                                                        deallocate:function(){}},
                                                    trinary.setunws.uiss={root:null,
                                                                          setRoot:function(){trinary.setunws.uiss.root=$("<div>",{id:"setunws"})},
                                                                          viewOriginal:function(){trinary.setunws.ui.deallocate(),
                                                                                                  trinary.setunws.ui=trinary.setunws.uiss.original},
                                                                          viewTerminal:function(){trinary.setunws.ui.deallocate(),
                                                                                                  trinary.setunws.ui=trinary.setunws.uiss.terminal}},
                                                    trinary.setunws.uiss.original={root:null,
                                                                                   svg:null,
                                                                                   allocate:function(){with(trinary.setunws.uiss.root.attr("class","original"),
                                                                                                            trinary.setunws.uiss.original.root=$("<div>"),
                                                                                                            trinary.setunws.uiss.root.append(trinary.setunws.uiss.original.root),
                                                                                                            trinary.setunws.uiss.original)
                                                                                                         pult.init(),
                                                                                                         ft.init(1),
                                                                                                         root.append(ft.device[1].instance),
                                                                                                         ft.init(2),
                                                                                                         root.append(ft.device[2].instance),
                                                                                                         printer.init(),
                                                                                                         root.append(printer.instance),
                                                                                                         registers.init(),
                                                                                                         pult.append(registers),
                                                                                                         clock.init(),
                                                                                                         pult.append(clock),
                                                                                                         control.Address.init(),
                                                                                                         pult.append(control.Address),
                                                                                                         control.Code.init(),
                                                                                                         pult.append(control.Code),
                                                                                                         control.Command.init(),
                                                                                                         pult.append(control.Command),
                                                                                                         control.Buttons.init(),
                                                                                                         pult.append(control.Buttons),
                                                                                                         control.mode.StepByStep.init(),
                                                                                                         pult.append(control.mode.StepByStep),
                                                                                                         control.mode.CK.init(),
                                                                                                         pult.append(control.mode.CK),
                                                                                                         control.mode.MbFkVp.init(),
                                                                                                         pult.append(control.mode.MbFkVp),
                                                                                                         control.mode.SetUpCode.init(),
                                                                                                         pult.append(control.mode.SetUpCode),
                                                                                                         dispose()},
                                                                                   deallocate:function(){trinary.setunws.uiss.root.html("")},
                                                                                   dispose:function(){with(trinary.setunws.core.register)
                                                                                                        k.instance.setTransform("translate(0, 0)"),
                                                                                                        f.instance.setTransform("translate(0, 50)"),
                                                                                                        c.instance.setTransform("translate(0, 100)"),
                                                                                                        w.instance.setTransform("translate(138, 50)"),
                                                                                                        s.instance.setTransform("translate(230, 0)"),
                                                                                                        r.instance.setTransform("translate(270, 50)"),
                                                                                                        mb.instance.setTransform("translate(292, 100)");
                                                                                                      with(trinary.setunws.uiss.original)
                                                                                                        with(clock.instance.setTransform("translate(230,75)"),control)
                                                                                                          Command.instance.setTransform("translate(10, 170)"),
                                                                                                          Code.instance.setTransform("translate(300, 170)"),
                                                                                                          Address.instance.setTransform("translate(10, 250)"),
                                                                                                          Buttons.instance.setTransform("translate(275, 250)"),
                                                                                                          mode.StepByStep.instance.setTransform("translate(500,245)"),
                                                                                                          mode.CK.instance.setTransform("translate(130,220)"),
                                                                                                          mode.MbFkVp.instance.setTransform("translate(130,270)"),
                                                                                                          mode.SetUpCode.instance.setTransform("translate(220,170)")},
                                                                                   update:function(){trinary.setunws.uiss.original.registers.update(),
                                                                                                     trinary.setunws.uiss.original.ft.update(),
                                                                                                     trinary.setunws.uiss.original.printer.print()}},
                                                    trinary.setunws.uiss.original.pult={instance:null,
                                                                                        init:function(){var e=trinary.setunws.uiss.root,
                                                                                                            t=e.width(),
                                                                                                            n=trinary.setunws.uiss.original.svg=SVG.create("svg");
                                                                                                        n.attr({width:t,height:t/2}),
                                                                                                        $(trinary.setunws.uiss.original.root).append(n.instance);
                                                                                                        var i=trinary.setunws.uiss.original.pult.instance=trinary.setunws.uiss.original.widget.panel({"class":"pult"});
                                                                                                        n.append(i),
                                                                                                        i.scale(t/650),
                                                                                                        e.css("height","auto"),
                                                                                                        $(window).resize(function(){var t=e.width();
                                                                                                                                    n.attr({width:t,height:t/2}),
                                                                                                                                    i.scale(t/650)})},
                                                                                        append:function(e){var t=null!=e.instance?e.instance:e;
                                                                                                           trinary.setunws.uiss.original.pult.instance.append(t)}},
                                                    trinary.setunws.uiss.original.registers={instance:null,
                                                                                             instances:{},
                                                                                             init:function(){var e=trinary.setunws.uiss.original.widget,
                                                                                                                 t=trinary.setunws.core.register,
                                                                                                                 n=e.panel({"class":"registers"});
                                                                                                             for(register in t)
                                                                                                               if("p"!=register){var i=t[register],
                                                                                                                                     r=e.panel({"class":"register",name:register}),
                                                                                                                                     o=trinary.setunws.uiss.original.widget.indicatorsSet(i);
                                                                                                                                 o.setTransform("translate(30)");
                                                                                                                                 var s=e.label({x:14,y:22});
                                                                                                                                 if(s.text(i.label),"s"==register){
                                                                                                                                   o.setTransform("translate(70)");
                                                                                                                                   var a=trinary.setunws.uiss.original.widget.indicatorsSet(t.p,{labelPrefix:t.p.label+" ",noGrouped:!0});
                                                                                                                                   a.setTransform("translate(30)"),
                                                                                                                                   r.append(a)}
                                                                                                                                 r.append(o),
                                                                                                                                 r.append(s),
                                                                                                                                 i.instance=r,
                                                                                                                                 n.append(r)}
                                                                                                             trinary.setunws.uiss.original.registers.instance=n},
                                                                                             read:function(){trinary.setunws.uiss.original.registers.update()},
                                                                                             update:function(){for(name in trinary.setunws.core.register)
                                                                                                                 for(var e=trinary.setunws.core.register[name],t=0;t<e.size;t++){
                                                                                                                   var n=trinary.setunws.core.register[name].indicator[t];
                                                                                                                   if(null!=n){
                                                                                                                     var i=e.value.charAt(t);
                                                                                                                     n.attr("value",i)}}}},   


20 Jun 2018 17:27
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
остатки логики эмулятора
Code:
trinary.setunws.uiss.original.control={Address:{instance:null,
                                                                                                    switcher:[],
                                                                                                    init:function(){var e=trinary.setunws.uiss.original.widget.switchers({name:"setAddress",size:5,label:"\u0410\u0434\u0440\u0435\u0441 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0430"});
                                                                                                                    trinary.setunws.uiss.original.control.Address.instance=e.instance,
                                                                                                                    trinary.setunws.uiss.original.control.Address.switcher=e.switcher}},
                                                                                           Command:{instance:null,
                                                                                                    switcher:[],
                                                                                                    init:function(){var e=trinary.setunws.uiss.original.widget.switchers({name:"command",size:9,label:"\u041d\u0430\u0431\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434\u044b"});
                                                                                                                    trinary.setunws.uiss.original.control.Command.instance=e.instance,trinary.setunws.uiss.original.control.Command.switcher=e.switcher}},
                                                                                           Code:{instance:null,
                                                                                                 switcher:[],
                                                                                                 init:function(){var e=trinary.setunws.uiss.original.widget.switchers({name:"setCode",size:18,action:"setCode"}),
                                                                                                                     t=trinary.setunws.uiss.original.control.Code;
                                                                                                                 t.instance=e.instance,
                                                                                                                 t.switcher=e.switcher,
                                                                                                                 t.instance.onclick=function(){trinary.setunws.uiss.original.actions.Set.code()}}},
                                                                                           Buttons:{instance:null,
                                                                                                    init:function(){var e=trinary.setunws.core.button,
                                                                                                                        t=0,
                                                                                                                        n=SVG.create("g"),
                                                                                                                        i=null;
                                                                                                                    for(button in e)
                                                                                                                      i=e[button],
                                                                                                                      i.instance=trinary.setunws.uiss.original.widget.button(i),
                                                                                                                      i.instance.attr("name",button),
                                                                                                                      i.instance.setTransform("translate("+t+")"),
                                                                                                                      n.append(i.instance),
                                                                                                                      t+=50,
                                                                                                                      i.instance.parent=i,
                                                                                                                      i.instance.onclick=function(){"disabled"!=this.attr("disabled")&&trinary.setunws.uiss.original.actions[this.parent.action]&&trinary.setunws.uiss.original.actions[this.parent.action]()};
                                                                                                                      return e.boot.instance.attr("disabled","disabled"),
                                                                                                                      trinary.setunws.uiss.original.control.Buttons.instance=n,n}}},
                                                    trinary.setunws.uiss.original.control.mode={StepByStep:{instance:null,
                                                                                                            init:function(){var e=trinary.setunws.core.mode["step-by-step"],
                                                                                                                                t=trinary.setunws.uiss.original.widget.panel({"class":"modeswitcher"});
                                                                                                                            t.attr("value",e);
                                                                                                                            var n=trinary.setunws.uiss.original.widget.bulb();
                                                                                                                            n.setTransform("translate(5,5)");
                                                                                                                            var i=trinary.setunws.uiss.original.widget.switcher({position:"reverse-horizontal"});
                                                                                                                            i.setTransform("translate(25,5)");
                                                                                                                            var r=trinary.setunws.uiss.original.widget.label({x:0,y:25}),
                                                                                                                                o=SVG.create("tspan",{x:10,dy:"0em"});
                                                                                                                            o.text("\u041e\u0434\u043d\u043e\u0442\u0430\u043a\u0442\u043d\u044b\u0439");
                                                                                                                            var s=SVG.create("tspan",{x:10,dy:"1em"});
                                                                                                                            return s.text("\u0440\u0435\u0436\u0438\u043c"),
                                                                                                                            r.append(o),
                                                                                                                            r.append(s),
                                                                                                                            t.append(n),
                                                                                                                            t.append(i),
                                                                                                                            t.append(r),
                                                                                                                            t.onclick=function(){this.attr("value","+"==this.attr("value")?"-":"+"),
                                                                                                                                                 trinary.setunws.uiss.original.actions.Set.stepByStep()},
                                                                                                                            trinary.setunws.uiss.original.control.mode.StepByStep.instance=t,t},
                                                                                                            change:function(){trinary.setunws.uiss.original.control.mode.StepByStep.instance.attr("value"),
                                                                                                                              trinary.setunws.uiss.original.control.mode.SetUpCode.instance.attr("value")}},
                                                                                                CK:{instance:null,
                                                                                                    init:function(){var e=trinary.setunws.uiss.original.widget.triSwitcher({labelMinus:"C",labelZero:"",labelPlus:"K"});
                                                                                                                    e.onclick=function(){trinary.setunws.uiss.original.actions.Set.ck()},
                                                                                                                    trinary.setunws.uiss.original.control.mode.CK.instance=e}},
                                                                                                MbFkVp:{instance:null,
                                                                                                        init:function(){var e=trinary.setunws.uiss.original.widget.triSwitcher({labelMinus:"\u041c\u0411",labelZero:"\u0424\u041a",labelPlus:"\u0412\u041f"});
                                                                                                                        e.onclick=function(){trinary.setunws.uiss.original.actions.Set.mbfkvp()},
                                                                                                                        trinary.setunws.uiss.original.control.mode.MbFkVp.instance=e}},
                                                                                                SetUpCode:{instance:null,
                                                                                                           init:function(){var e=trinary.setunws.uiss.original.widget.biSwitcher({label:"\u041d\u0430\u0431\u043e\u0440 \u043a\u043e\u0434\u0430"});
                                                                                                                           e.attr("value",trinary.setunws.operation.getModeSetUpCode()),
                                                                                                                           e.onclick=function(){trinary.setunws.uiss.original.control.mode.SetUpCode.change()},
                                                                                                                           trinary.setunws.uiss.original.control.mode.SetUpCode.instance=e},
                                                                                                           change:function(){var e=trinary.setunws.operation.changeModeSetUpCode();
                                                                                                                             trinary.setunws.uiss.original.control.mode.SetUpCode.instance.attr("value",e)}}},
                                                    trinary.setunws.uiss.original.ft={device:[],
                                                                                      init:function(e){trinary.setunws.uiss.original.ft.device[e]=[];
                                                                                      var t=trinary.setunws.uiss.original.ft.device[e],
                                                                                          n=t.instance=$("<ft>",{name:e});
                                                                                      return t.label=$("<label>"),
                                                                                      t.label.html("\u0424\u0422-"+e),
                                                                                      t.input=$("<textarea>",{name:"input"}),
                                                                                      t.button=$("<button>",{name:"load"}),
                                                                                      t.button.html("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043b\u0435\u043d\u0442\u0443"),
                                                                                      n.append(t.label),
                                                                                      n.append(t.input),
                                                                                      n.append(t.button),
                                                                                      t.button.click(function(){trinary.setunws.uiss.original.ft.load(e)}),
                                                                                      t.input.dblclick(function(){this.select()}),n},
                                                                                      update:function(){var e=trinary.setunws.core.ft;
                                                                                                        for(var t in e)
                                                                                                          if(null!=trinary.setunws.uiss.original.ft.device[t]){
                                                                                                            var n="";
                                                                                                            for(line in e[t])
                                                                                                              n+=e[t][line]+"\n";
                                                                                                            trinary.setunws.uiss.original.ft.device[t].input.val(n)}},
                                                                                      load:function(e){var t=trinary.setunws.uiss.original.ft.device[e].input.val();
                                                                                                       e&&t&&(trinary.setunws.ft.load(e,t),
                                                                                                       trinary.setunws.uiss.original.ft.update(),
                                                                                                       1==e&&trinary.setunws.core.button.boot.instance.attr("disabled",""))}},
                                                    trinary.setunws.uiss.original.memory={instance:null,
                                                                                          cells:{},
                                                                                          init:function(){var e=trinary.setunws.core.memory,
                                                                                                              t=$("<memory>"),
                                                                                                              n=$("<label>");
                                                                                                          n.html("\u041e\u0417\u0423"),
                                                                                                          t.append(n);
                                                                                                          var i=0,
                                                                                                              r=trinary.setunws.uiss.original.memory.cells;
                                                                                                          for(address in e){
                                                                                                            if(i%54==0){
                                                                                                              var o=$("<bank>");
                                                                                                              t.append(o)}
                                                                                                            r[address]=trinary.setunws.uiss.original.widget.cell(address,e[address]),
                                                                                                            r[address].input.blur(function(){trinary.setunws.uiss.original.memory.updateCell(this.name,this.value)}),
                                                                                                            o.append(r[address].instance),i++}
                                                                                                          return trinary.setunws.uiss.original.memory.instance=t,t},
                                                                                          updateCell:function(e,t){var n=trinary.setunws.uiss.original.memory.cells[e];
                                                                                                                   t=trinary.setunws.memory.write(e,t),
                                                                                                                   n.input.val(t),
                                                                                                                   n.tooltip.html(trinary.core.trinaryToNonary(e)+":"+trinary.core.trinaryToNonary(t))},
                                                                                          update:function(){var e=trinary.setunws.core.memory;
                                                                                                            for(address in e)
                                                                                                              trinary.setunws.uiss.original.memory.updateCell(address,e[address])},
                                                                                          read:function(){trinary.setunws.uiss.original.refresh_cell()},
                                                                                          cell:function(e){return ;},
                                                                                          highlight:function(e,t){},
                                                                                          clearhighlight:function(e){}},
                                                    trinary.setunws.uiss.original.printer={instance:null,
                                                                                           output:null,
                                                                                           init:function(){var e=trinary.setunws.uiss.original.printer.instance=$('<div class="printer"></div>'),
                                                                                                               t=trinary.setunws.uiss.original.printer.output=$('<div class="output"></div>'),
                                                                                                               n=$("<label>");
                                                                                                           return n.html("\u041f\u0440\u0438\u043d\u0442\u0435\u0440 \u042d\u0423\u041c-46"),
                                                                                                           e.append(n),
                                                                                                           e.append(t),
                                                                                                           e},
                                                                                           print:function(){trinary.setunws.uiss.original.printer.output.html(trinary.setunws.uiss.original.printer.output.html()+"\n"+trinary.setunws.core.printer.data)}},
                                                    trinary.setunws.uiss.original.actions={boot:function(){trinary.setunws.core.button.boot.instance.attr("disabled","disabled"),
                                                                                                           trinary.setunws.core.button.start.instance.attr("disabled",""),
                                                                                                           trinary.setunws.operation.boot(),
                                                                                                           trinary.setunws.uiss.original.update()},
                                                                                           step:function(){var e=trinary.setunws.core.button.start;
                                                                                                           e.instance.attr("disabled","disabled"),
                                                                                                           trinary.setunws.uiss.original.memory.highlight(trinary.setunws.core.register.c.value,"before"),
                                                                                                           trinary.setunws.operation.step(),
                                                                                                           trinary.setunws.uiss.original.update(),
                                                                                                           trinary.setunws.uiss.original.memory.highlight(trinary.setunws.core.register.c.value,"now"),
                                                                                                           e.instance.attr("disabled","")},
                                                                                           start:function(){var e=trinary.setunws.core.button.start;
                                                                                                            e.instance.attr("disabled","disabled"),
                                                                                                            trinary.setunws.uiss.original.memory.highlight(trinary.setunws.core.register.c.value,"before"),
                                                                                                            trinary.setunws.operation.start(),
                                                                                                            trinary.setunws.uiss.original.update(),
                                                                                                            trinary.setunws.uiss.original.memory.highlight(trinary.setunws.core.register.c.value,"now"),
                                                                                                            e.instance.attr("disabled","")},
                                                                                           execute:function(){var e="",
                                                                                                                  t=trinary.setunws.uiss.original.control.Command.switcher;
                                                                                                              for(i in t)e+=t[i].attr("value");
                                                                                                              trinary.setunws.operation.execute(e),
                                                                                                              trinary.setunws.uiss.original.update(),
                                                                                                              "+"==trinary.setunws.core.mode["step-by-step"]},
                                                                                           stop:function(){trinary.setunws.operation.stop()},
                                                                                           Set:{code:function(){var e=trinary.setunws.uiss.original.control.Code,
                                                                                                                    t="";
                                                                                                                for(i in e.switcher)
                                                                                                                  t+=e.switcher[i].attr("value");
                                                                                                                t=trinary.setunws.operation.setCode(t)},
                                                                                                ck:function(){var e=trinary.setunws.uiss.original.control.mode.CK.instance.attr("value");
                                                                                                              trinary.setunws.operation.setModeCK(e);
                                                                                                              var t=trinary.setunws.core["c-k"];
                                                                                                              t="+"==t?"K":"-"==t?"C":"\u0441\u043d\u044f\u0442"},
                                                                                                mbfkvp:function(){var e=trinary.setunws.uiss.original.control.mode.MbFkVp.instance.attr("value");
                                                                                                                  trinary.setunws.operation.setModeMbFkVp(e);
                                                                                                                  var t=trinary.setunws.core["mb-fk-vp"];
                                                                                                                  t="+"==t?"\u0412\u041f":"-"==t?"\u041c\u0411":"\u0424\u041a"},
                                                                                                stepByStep:function(){var e=trinary.setunws.uiss.original.control.mode.StepByStep.instance.attr("value");
                                                                                                                      trinary.setunws.operation.setModeStepByStep(e),
                                                                                                                      trinary.setunws.uiss.original.control.mode.StepByStep.change()}}},
                                                    trinary.setunws.uiss.original.log={instance:null,
                                                                                       output:null,
                                                                                       init:function(){var e=(trinary.setunws.uiss.original.log.instance=$("<console>"),
                                                                                                       trinary.setunws.uiss.original.log.output=$("<output>"),$("<label>"));
                                                                                                       e.html("\u041a\u043e\u043d\u0441\u043e\u043b\u044c")},
                                                                                       write:function(){trinary.setunws.uiss.original.log.output},
                                                                                       clear:function(){trinary.setunws.uiss.original.log.output.html("")}},
                                                    trinary.setunws.uiss.original.widget={panel:function(e){return SVG.create("g",e)},
                                                                                          label:function(e){return SVG.create("text",e)},
                                                                                          bulb:function(){var e=SVG.create("g",{"class":"bulb"}),
                                                                                                              t=SVG.create("circle",{cx:0,cy:0,r:7}),
                                                                                                              n=SVG.create("ellipse",{cx:0,cy:0,rx:5,ry:5,"class":"glass"});
                                                                                                          return e.append(t),
                                                                                                                 e.append(n),
                                                                                                                 e},
                                                                                          indicator:function(e){var t=SVG.create("g",{"class":"indicator"}),
                                                                                                                    n=trinary.setunws.uiss.original.widget.bulb();
                                                                                                                n.setTransform("translate(0,10)");
                                                                                                                var i=trinary.setunws.uiss.original.widget.bulb();
                                                                                                                i.setTransform("translate(0,26)");
                                                                                                                var r=SVG.create("text",{x:0,y:40});
                                                                                                                return r.text(e.label),
                                                                                                                       t.append(n),
                                                                                                                       t.append(i),
                                                                                                                       t.append(r),
                                                                                                                       t},
                                                                                          indicatorsSet:function(e,t){(null==t||"undefined"==typeof t)&&(t={});
                                                                                                                      var n,
                                                                                                                          i,
                                                                                                                          r=0,
                                                                                                                          o=0,
                                                                                                                          s=SVG.create("g",{"class":"indicators-set"});
                                                                                                                      e.indicator=[];
                                                                                                                      for(var a=void 0==t.labelPrefix?"":t.labelPrefix,l=void 0==t.noGrouped?5:0,c=17,u=c+l,h=0;h<e.size;h++)
                                                                                                                        n=trinary.setunws.uiss.original.widget.indicator({label:a+(h+1).toString()}),
                                                                                                                        n.setTransform("translate("+r+",0)"),
                                                                                                                        9==o&&(o=0,r+=l),
                                                                                                                        r+=o++%2==0?u:c,i=null!=e.value&&e.value[h]?e.value[h]:"0",
                                                                                                                        n.attr("value",i),
                                                                                                                        e.indicator[h]=n,
                                                                                                                        s.append(n);
                                                                                                                      return s},
                                                                                          switcher:function(e){null==e&&(e={});
                                                                                                               var t=SVG.create("g",{"class":"switcher",value:"0"}),
                                                                                                                   n=SVG.create("g");
                                                                                                               null!=e.position&&("horizontal"==e.position?n.setTransform("rotate(90)"):"reverse-horizontal"==e.position&&n.setTransform("rotate(-90)"));
                                                                                                               var i=SVG.create("g",{transform:"translate(-3, -10)"});
                                                                                                               i.append(SVG.create("rect",{"class":"place",x:0,y:0,height:"20",width:"6",rx:"1"})),
                                                                                                               n.append(i);
                                                                                                               var i=SVG.create("g",{"class":"position",name:"+"});
                                                                                                               i.append(SVG.create("circle",{cx:0,cy:0,r:"3"})),
                                                                                                               i.append(SVG.create("polyline",{points:"-4,0 -5,-8 5,-8 4,0"})),
                                                                                                               i.append(SVG.create("ellipse",{cx:0,cy:-8,rx:4,ry:2.5})),
                                                                                                               n.append(i);
                                                                                                               var i=SVG.create("g",{"class":"position",name:"0"});
                                                                                                               i.append(SVG.create("ellipse",{cx:0,cy:0,rx:"5",ry:"4"})),
                                                                                                               i.append(SVG.create("ellipse",{cx:0,cy:0,rx:"3",ry:"2"})),
                                                                                                               n.append(i);
                                                                                                               var i=SVG.create("g",{"class":"position",name:"-",transform:"rotate(180)"});
                                                                                                               if(i.append(SVG.create("circle",{cx:0,cy:0,r:"3"})),
                                                                                                                  i.append(SVG.create("polyline",{points:"-4,0 -5,-8 5,-8 4,0"})),
                                                                                                                  i.append(SVG.create("ellipse",{cx:0,cy:-8,rx:4,ry:2.5})),
                                                                                                                  n.append(i),
                                                                                                                  t.append(n),
                                                                                                                  null!=e&&null!=e.label){
                                                                                                                 var r=SVG.create("text",{x:0,y:20});
                                                                                                                 r.text(e.label),
                                                                                                                 t.append(r)}
                                                                                                               return t},
                                                                                          switchers:function(e){null==e&&(e={});
                                                                                                                var t,
                                                                                                                    n,
                                                                                                                    i=SVG.create("g",{"class":"switcher-set"}),
                                                                                                                    r=0,
                                                                                                                    o=0,
                                                                                                                    s={};
                                                                                                                s.switcher=[];
                                                                                                                for(var a=0;a<e.size;a++)
                                                                                                                  t=trinary.setunws.uiss.original.widget.switcher({label:a+1}),
                                                                                                                  t.setTransform("translate("+r+",0)"),
                                                                                                                  9==o&&(o=0,r+=5),
                                                                                                                  r+=o++%2==0?23:16,
                                                                                                                  t.attr("value",n),
                                                                                                                  t.onclick=function(){var e=this.attr("value"),
                                                                                                                                           t=this.attr("prev");
                                                                                                                                       null==t&&(t=0),
                                                                                                                                       "+"==e||"-"==e?(this.attr("value","0"),
                                                                                                                                                       this.attr("prev",e)):"+"==t?(this.attr("value","-"),
                                                                                                                                       this.attr("prev","0")):(this.attr("value","+"),
                                                                                                                                       this.attr("prev","0"))},
                                                                                                                  s.switcher[a]=t,
                                                                                                                  i.append(t);
                                                                                                                if(null!=e.label){
                                                                                                                  var l=SVG.create("text",{x:0,y:35});
                                                                                                                  l.text(e.label),
                                                                                                                  i.append(l)}
                                                                                                                return i.setTransform("translate(5)"),
                                                                                                                       s.instance=i,s},
                                                                                          biSwitcher:function(e){null==e&&(e={});
                                                                                          var t=SVG.create("g",{"class":"switcher bi-switcher"});
                                                                                          t.attr("value","-");
                                                                                          var n=trinary.setunws.uiss.original.widget.bulb(),
                                                                                              i=trinary.setunws.uiss.original.widget.switcher({position:"reverse-horizontal"});
                                                                                          if(i.setTransform("translate(20)"),t.append(n),t.append(i),null!=e.label){
                                                                                            var r=SVG.create("text");
                                                                                            r.text(e.label),
                                                                                            r.setTransform("translate(0,20)"),
                                                                                            t.append(r)}
                                                                                          return t.onclick=function(){var e=this.attr("value");
                                                                                                                      this.attr("value","-"==e?"+":"-")},
                                                                                                                      t},
                                                                                          triSwitcher:function(e){null==e&&(e={});
                                                                                                                  var t=SVG.create("g",{"class":"switcher tri-switcher"}),
                                                                                                                      n=trinary.setunws.uiss.original.widget.bulb(),
                                                                                                                      i=trinary.setunws.uiss.original.widget.bulb(),
                                                                                                                      r=trinary.setunws.uiss.original.widget.switcher({position:"horizontal"}),
                                                                                                                      o=SVG.create("text",{x:0,y:20}),
                                                                                                                      s=SVG.create("text",{x:25,y:20}),
                                                                                                                      a=SVG.create("text",{x:50,y:20});
                                                                                                                  return t.attr("value",0),
                                                                                                                         n.attr("value","-"),
                                                                                                                         i.attr("value","+"),
                                                                                                                         i.setTransform("translate(50)"),
                                                                                                                         r.setTransform("translate(25)"),
                                                                                                                         e.labelMinus&&o.text(e.labelMinus),
                                                                                                                         e.labelZero&&s.text(e.labelZero),
                                                                                                                         e.labelPlus&&a.text(e.labelPlus),
                                                                                                                         t.append(n),
                                                                                                                         t.append(r),
                                                                                                                         t.append(i),
                                                                                                                         t.append(o),
                                                                                                                         t.append(s),
                                                                                                                         t.append(a),
                                                                                                                         r.onclick=function(){var e=t.attr("value"),
                                                                                                                                                  n=t.attr("prev");
                                                                                                                                              null==n&&(n=0),
                                                                                                                                              "+"==e||"-"==e?(t.attr("value","0"),t.attr("prev",e)):"+"==n?(t.attr("value","-"),
                                                                                                                                                                                                            t.attr("prev","0")):(t.attr("value","+"),
                                                                                                                                                                                                                                 t.attr("prev","0"))},
                                                                                                                                              t},
                                                                                                                         cell:function(e,t){var n={};
                                                                                                                                            return n.address=e,
                                                                                                                                                   n.instance=$("<cell>"),
                                                                                                                                                   n.label=$("<label>",{},e),
                                                                                                                                                   n.input=$("<input>",{name:e,value:t}),
                                                                                                                                                   n.tooltip=$("<label>",{},trinary.core.trinaryToNonary(e)+":"+trinary.core.trinaryToNonary(t)),
                                                                                                                                                   n.instance.append(n.label),
                                                                                                                                                   n.instance.append(n.input),
                                                                                                                                                   n.instance.append(n.tooltip),
                                                                                                                                                   n},
                                                                                                                         button:function(e){var t=SVG.create("g",{"class":"button"}),
                                                                                                                                                n=SVG.create("circle",{cx:0,cy:0,r:6});
                                                                                                                                            if(t.append(n),"undefined"!=typeof e&&null!=e.label){
                                                                                                                                              var i=SVG.create("text",{x:0,y:20});
                                                                                                                                              i.text(e.label),
                                                                                                                                              t.append(i)}
                                                                                                                                            return t}},
больше для себя выложил (более менее структурировал - так как код чужой - так изучать удобнее).


20 Jun 2018 17:41
Profile
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
Последний кусок:
Code:
trinary.setunws.uiss.original.clock={instance:null,
                                                                                         init:function(e){null==e&&(e={});
                                                                                                          var t=trinary.setunws.uiss.original.widget.panel({"class":"clock"});
                                                                                                          t.append(SVG.create("circle",{cx:0,cy:0,r:35,"class":"border"})),
                                                                                                          t.append(SVG.create("circle",{cx:0,cy:0,r:33}));
                                                                                                          var n=27,
                                                                                                              i=1,
                                                                                                              r=Math.PI*(2/12),
                                                                                                              o=.5*-Math.PI,
                                                                                                              s=SVG.create("g"),
                                                                                                              a=SVG.create("polyline",{points:"0,0 0,-1.5 12,-1.5, 12,-4 18,0 12,4 12,1.5 0,1.5 0,0"}),
                                                                                                              l=SVG.create("polyline",{points:"0,0 0,-1 17,-1, 17,-3 23,0 17,3 17,1 0,1 0,0"});
                                                                                                          for(t.append(a),t.append(l),t.append(s),t.append(SVG.create("circle",{cx:0,cy:0,r:3})),t.append(SVG.create("circle",{cx:0,cy:0,r:1})),i;12>=i;i++){
                                                                                                            var c=SVG.create("text",{x:Math.cos(i*r+o)*n,y:Math.sin(i*r+o)*n});
                                                                                                            c.text(i),
                                                                                                            s.append(c)}
                                                                                                          setInterval(function(e,t){var n=new Date,
                                                                                                                                        i=360*n.getMinutes()/60-90;
                                                                                                                                        t.setTransform("rotate("+i+")");
                                                                                                                                    var r=n.getHours();
                                                                                                                                    r>12&&(r-=12);
                                                                                                                                    var i=360*(r+n.getMinutes()/60)/12-90;
                                                                                                                                    e.setTransform("rotate("+i+")")},
                                                                                                                      1e3,a,l),
                                                                                                          trinary.setunws.uiss.original.clock.instance=t}},
                                                    trinary.setunws.uiss.terminal={registers:[],
                                                                                   cells:[],
                                                                                   printer:null,
                                                                                   cache:{cells:{},
                                                                                          ft:{}},
                                                                                          instance:{register:null,
                                                                                                    memory:{"-":$("textarea"),
                                                                                                            0:$("textarea"),
                                                                                                            "+":$("textarea")},
                                                                                                    ft:{1:null,2:null},
                                                                                                    console:$("div",{"class":"console"}),
                                                                                                    control:{boot:$("a",{href:"#"}),
                                                                                                    start:$("a",{href:"#"}),
                                                                                                    stop:$("a",{href:"#"}),
                                                                                                    step:$("a",{href:"#"})}},
                                                                                   update:function(){var e=trinary.setunws.uiss.terminal.dump;
                                                                                                     e.log(),
                                                                                                     trinary.setunws.uiss.terminal.printer.update(),
                                                                                                     e.register(),
                                                                                                     e.memory(),
                                                                                                     e.ft(1),
                                                                                                     e.ft(2)},
                                                                                   allocate:function(){var e=trinary.setunws.uiss.root,
                                                                                                           t=trinary.setunws.uiss.terminal,
                                                                                                           n=$("<div>",{"class":"control"});
                                                                                                       e.append(n),t.instance.control.boot.html("\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0441\u043a"),
                                                                                                       t.instance.control.start.html("\u041f\u0443\u0441\u043a"),
                                                                                                       t.instance.control.step.html("\u0422\u0430\u043a\u0442"),
                                                                                                       t.instance.control.stop.html("\u041e\u0441\u0442\u0430\u043d\u043e\u0432"),
                                                                                                       t.instance.control.boot.click(function(){trinary.setunws.operation.boot(),
                                                                                                                                                trinary.setunws.uiss.terminal.update()}),
                                                                                                       t.instance.control.start.click(function(){trinary.setunws.operation.start()}),
                                                                                                       t.instance.control.step.click(function(){trinary.setunws.operation.step()}),
                                                                                                       t.instance.control.stop.click(function(){trinary.setunws.operation.stop()}),
                                                                                                       n.append(t.instance.control.boot),
                                                                                                       n.append(t.instance.control.start),
                                                                                                       n.append(t.instance.control.step),
                                                                                                       n.append(t.instance.control.stop);
                                                                                                       var i=$("<div>",{"class":"registers"}),
                                                                                                           r=$("<h4>");
                                                                                                       r.html("\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u044b"),
                                                                                                       i.append(r);
                                                                                                       var o=trinary.setunws.uiss.terminal.registers,
                                                                                                           s=$("<ul>");
                                                                                                       i.append(s),
                                                                                                       e.append(i);
                                                                                                       for(var a in trinary.setunws.core.register){
                                                                                                         var l=trinary.setunws.uiss.terminal.widget.register(a);
                                                                                                         s.append($("<li>").append(l)),
                                                                                                         o.push(l)}trinary.setunws.uiss.terminal.printer=trinary.setunws.uiss.terminal.widget.printer(),
                                                                                                         e.append(trinary.setunws.uiss.terminal.printer),
                                                                                                         t.instance.ft[1]=t.widget.ft(1),
                                                                                                         t.instance.ft[2]=t.widget.ft(2),
                                                                                                         e.append(t.instance.ft[1]),
                                                                                                         e.append(t.instance.ft[2]),
                                                                                                         t.cache.ft[1]="",
                                                                                                         t.cache.ft[2]="";
                                                                                                         var i=$("<div>",{"class":"memory"}),
                                                                                                             r=$("<h4>");
                                                                                                         r.html("\u041e\u0417\u0423"),
                                                                                                         i.append(r);
                                                                                                         var c=trinary.setunws.uiss.terminal.cells,
                                                                                                             u=0;
                                                                                                         for(var h in trinary.setunws.core.memory){
                                                                                                           (0==u||54==u||108==u)&&(s=$("<ul>",{"class":"bank"}),i.append(s)),
                                                                                                           trinary.setunws.uiss.terminal.cache.cells[h]="";
                                                                                                           var l=trinary.setunws.uiss.terminal.widget.cell(h);
                                                                                                           s.append(l),
                                                                                                           c.push(l),
                                                                                                           u++}
                                                                                                         e.append(i),
                                                                                                         e.append("<h4>\u041a\u043e\u043d\u0441\u043e\u043b\u044c</h4>"),
                                                                                                         e.append(t.instance.console)},
                                                                                                       deallocate:function(){trinary.setunws.uiss.root.html("")},
                                                                                                       updateTextNode:function(e,t){null==e.firstChild?e.appendChild(document.createTextNode(t)):e.firstChild.data=t},
                                                                                                       widget:{register:function(e){var t=$("<label>");
                                                                                                                                    t.html(trinary.setunws.core.register[e].label+": ");
                                                                                                                                    var n=$("<dfn>");
                                                                                                                                    return t.append(n),
                                                                                                                                           n=n[0],
                                                                                                                                           t.update=function(){trinary.setunws.uiss.terminal.updateTextNode(n,trinary.setunws.core.register[e].value)},
                                                                                                                                           t.update(),
                                                                                                                                           t.attr("name",e),
                                                                                                                                           t},
                                                                                                       cell:function(e){var t=$("<li>"),
                                                                                                                            n=$("<label>");
                                                                                                                        n.html(e+": ");
                                                                                                                        var i=$("<dfn>");
                                                                                                                        t.append(n),
                                                                                                                        t.append(i),
                                                                                                                        i=i[0];
                                                                                                                        var r=$("<label>",{"class":"non"});
                                                                                                                        r.html(trinary.core.trinaryToNonary(e)+": ");
                                                                                                                        var o=$("<dfn>");
                                                                                                                        return t.append(r),
                                                                                                                               t.append(o),
                                                                                                                               o=o[0],
                                                                                                                               t.update=function(){var t=trinary.setunws.core.memory[e];
                                                                                                                                                   trinary.setunws.uiss.terminal.cache.cells[e]!=t&&(trinary.setunws.uiss.terminal.cache.cells[e]=t,
                                                                                                                                                                                                     trinary.setunws.uiss.terminal.updateTextNode(i,t),
                                                                                                                                                                                                     trinary.setunws.uiss.terminal.updateTextNode(o,trinary.core.trinaryToNonary(t)))},
                                                                                                                               t.update(),
                                                                                                                               t.attr("name",name),
                                                                                                                        t},
                                                                                                       printer:function(){var e=$("<div>",{"class":"printer"}),
                                                                                                                              t=$("<div>",{"class":"output"});
                                                                                                                          e.html("<h4>\u042d\u0423\u041c</h4>"),
                                                                                                                          e.append(t);
                                                                                                                          var n=t[0];
                                                                                                                          return e.update=function(){n.textContent=trinary.setunws.core.printer.data},
                                                                                                                                 e},
                                                                                                       ft:function(e){var t=$("<div>",{"class":"ft",name:e}),
                                                                                                                          n=$("<h4>");
                                                                                                                      n.html("\u0424\u0422-"+e);
                                                                                                                      var i=$("<textarea>",{name:"input"}),
                                                                                                                          r=$("<button>",{name:"load"});
                                                                                                                      r.html("\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043b\u0435\u043d\u0442\u0443"),
                                                                                                                      t.append(n),
                                                                                                                      t.append(i),
                                                                                                                      t.append(r);
                                                                                                                      var o=i[0];
                                                                                                                      return t.update=function(){var t=trinary.setunws.core.ft[e].join("\n");
                                                                                                                                                 trinary.setunws.uiss.terminal.cache.ft[e]!=t&&(o.value=t,trinary.setunws.uiss.terminal.cache.ft[e]=t)},
                                                                                                                      r.click(function(){trinary.setunws.ft.load(e,i.val()),
                                                                                                                                         t.update()}),
                                                                                                                      i.dblclick(function(){this.select()}),
                                                                                                                      t}},
                                                                                                        dump:{register:function(){for(var e=trinary.setunws.uiss.terminal.registers,t=0;t<e.length;t++)
                                                                                                                                    e[t].update()},
                                                                                                        mode:function(){var e="";
                                                                                                                        for(var t in trinary.setunws.core.register){
                                                                                                                          var n=trinary.setunws.core.register[t];
                                                                                                                          e+=t+": "+n.value+"\n"}
                                                                                                                        e+="\n";
                                                                                                                        for(var t in trinary.setunws.core.mode){
                                                                                                                          var i=trinary.setunws.core.mode[t];
                                                                                                                          e+=t+": "+i+"\n"}
                                                                                                                        e+="\n",
                                                                                                                        e+="printer: "+trinary.setunws.core.printer.data,trinary.setunws.uiss.terminal.instance.register.val(e)},
                                                                                                        memory:function(){for(var e=trinary.setunws.uiss.terminal.cells,t=0;t<e.length;t++)
                                                                                                                            e[t].update()},
                                                                                                        ft:function(e){var t="";
                                                                                                                       for(var n in trinary.setunws.core.ft[e]){
                                                                                                                         var i=trinary.setunws.core.ft[e][n];
                                                                                                                         t+=i+" | ",
                                                                                                                         t+=trinary.core.trinaryToNonary(i)+"\n"}
                                                                                                                       trinary.setunws.uiss.terminal.instance.ft[e].val(t)},
                                                                                                        log:function(){trinary.setunws.uiss.terminal.updateTextNode(trinary.setunws.uiss.terminal.instance.console[0],
                                                                                                                       trinary.setunws.console.stack.join("\n"))}}},
                                                                              window.AceEditorController=function(){function e(e,t){var n=ace.edit(e);
                                                                                                                                    n.setTheme("ace/theme/github"),
                                                                                                                                    n.getSession().setMode("ace/mode/markdown"),
                                                                                                                                    $("#"+e).parents("form:first").submit(function(){$("#"+t).val(n.getValue())})}return e}(),
                                                                              window.CommentsController=function(e){var t={};
                                                                                                                    t.form=null;
                                                                                                                    var n="#comment_form",
                                                                                                                        i="#comment_parent_id";
                                                                                                                    return t.initialize=function(){var r=$("#comments .comment-actions:first").detach();
                                                                                                                                                   r.show(),
                                                                                                                                                   $("#comments [data-reply] .media-content").each(function(){$(this).after(r.clone())}),
                                                                                                                                                   $(e).on("click","#comments .comment-reply",function(e){$(".comment-actions").show();
                                                                                                                                                                                                          var r=$(this),
                                                                                                                                                                                                              o=r.parents("[data-reply]:first").attr("data-reply"),
                                                                                                                                                                                                              s=r.parent();
                                                                                                                                                                                                          s.hide();
                                                                                                                                                                                                          var a=t.form.clone(),
                                                                                                                                                                                                              l=a.find("textarea");
                                                                                                                                                                                                          $(n).remove(),
                                                                                                                                                                                                          s.after(a),
                                                                                                                                                                                                          a.find(i).val(o),
                                                                                                                                                                                                          l.focus(),
                                                                                                                                                                                                          e.preventDefault(),
                                                                                                                                                                                                          AceEditorController("editor","comment_content")}),
                                                                                                                                                                                                          $(e).on("ajax:success","#comment_form",function(e,t){$(".comment-actions").show();
                                                                                                                                                                                                                                                               var n=$(t);
                                                                                                                                                                                                                                                               n.find(".media-content").after(r.clone()),
                                                                                                                                                                                                                                                               $(this).replaceWith(n)}),
                                                                                                                                                                                                          $(e).on("ajax:error","#comment_form",function(e,t){$(this).replaceWith(t.responseText)}),
                                                                                                                                                                                                          $(e).on("submit","#new_comment",function(e){$(this).find("button").attr("disabled","disabled"),
                                                                                                                                                                                                                                                      $(this).fadeOut(1e3),
                                                                                                                                                                                                                                                      e.preventDefault()}),
                                                                                                                                                                                                          t.form=$(n).clone(),
                                                                                                                                                                                                          AceEditorController("editor","comment_content")},
                                                                                                                                                   t}
                                                                                                                   (document),
                                                                                                                   function(){function e(){var e=8,
                                                                                                                                               t=6,
                                                                                                                                               n=$("#encodesource").val();
                                                                                                                                           $(".encoded-results").css("display","block");
                                                                                                                                           var i=Thencoder.getFreq(n),
                                                                                                                                               r=Thencoder.getBinaryTree(i),
                                                                                                                                               o=Thencoder.getTrinaryTree(i),
                                                                                                                                               s=Thencoder.getPrefixCodes(r),
                                                                                                                                               a=Thencoder.getPrefixCodes(o);
                                                                                                                                               $("#statistics-symbols").html(Thencoder.statistics.symlist(i,s,a)),
                                                                                                                                               $("#src_symbols_qty").html(n.length),
                                                                                                                                               $("#bin_src_size").html(n.length*e),
                                                                                                                                               $("#tri_src_size").html(n.length*t);
                                                                                                                                           var l={binary:Thencoder.getEncodedSize(s),
                                                                                                                                                  trinary:Thencoder.getEncodedSize(a)};
                                                                                                                                           $("#bin_encoded_size").html(l.binary),
                                                                                                                                           $("#tri_encoded_size").html(l.trinary),
                                                                                                                                           $("#bin_ratio").html(Math.round(1e4*l.binary/(n.length*e))/100+"%"),
                                                                                                                                           $("#tri_ratio").html(Math.round(1e4*l.trinary/(n.length*t))/100+"%"),
                                                                                                                                           $("#btree").html('<div id="bintree"></div>'),
                                                                                                                                           $("#ttree").html('<div id="tritree"></div>');
                                                                                                                                           var c;
                                                                                                                                           c=new Thencoder.structure.Tree;
                                                                                                                                           var u=c.grow(r),
                                                                                                                                               h=new Gardener,
                                                                                                                                               d=h.tree(u);
                                                                                                                                           d.grow(),
                                                                                                                                           d.plant("#bintree"),
                                                                                                                                           c=new Thencoder.structure.Tree;
                                                                                                                                           var g=c.grow(o),
                                                                                                                                               f=h.tree(g);
                                                                                                                                           f.grow(),
                                                                                                                                           f.plant("#tritree")}trinary.ThencoderController={initialize:function(t){$(t).click(function(){e()})}}}
                                                                                                                   (trinary),
                                                                                                                   $(function(){new trinary.coder.Translator("[data-behavior=trinary-translator]"),$("time[data-type!=tz]").timeago()});
А Alexander Obukhov на этом форуме появляется? проще было бы распросить автора, чем препарировать код.


20 Jun 2018 17:42
Profile
Supreme God
User avatar

Joined: 21 Oct 2009 08:08
Posts: 7777
Location: Россия
Reply with quote
ProMiNick wrote:
А Alexander Obukhov на этом форуме появляется?

А он должен на этом форуме появляться? :roll:

Я чисто из интересу поискал такого пользователя, так на форуме такого официально нет... :-?
Attachment:
A_Obukh.gif
A_Obukh.gif [ 29.53 KiB | Viewed 11641 times ]

_________________
iLavr


20 Jun 2018 23:48
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22412
Location: Silicon Valley
Reply with quote
Вот он вроде как:

http://www.nedopc.org/forum/memberlist.php?mode=viewprofile&u=3081

Правда у него тут
Quote:
Последнее посещение: 05 фев 2006 19:57


Оно и понятно - у него свой веб-сайт http://trinary.ru имеется c 2007 года :roll:

P.S. Гитхаб с исходниками у него тоже есть: https://github.com/trinarygroup и https://github.com/sprql (а также бложек https://sprql.space/about/ и твиттер https://twitter.com/sprql)

Attachment:
A_Obukhov.jpg
A_Obukhov.jpg [ 8.88 KiB | Viewed 11584 times ]


P.P.S. Хотя на этом форуме есть сообщения, датируемые 2009 годом и это наверное последствия соединения баз данных сообщений этого форума и форума Ternary.info...

_________________
:dj: https://mastodon.social/@Shaos


22 Jun 2018 19:05
Profile WWW
Novelist

Joined: 16 Jun 2018 14:35
Posts: 25
Reply with quote
нашел как отлаживать код страницы...
прояснились еще моменты:
начальное состояние регистров все-таки 0 (по крайней мере перед загрузкой программы из ФТ)
программа из ФТ грузится партиями постранично (т.е. по 54 9ти-тритных слова) в адреса страницы оперативной памяти с -40 по +40 адреса (занимая все 54 из 81 адреса младший трит адреса которых не равен "-")
после загрузки первой же партии программы в страницу оперативной памяти № 0000, выполнение начинается с инструкции по адресу +1.
поток адресов для исполнения инструкций - не непрерывный, исполнение перепрыгивает адреса, младший трит которых равен "-".

по какому условию происходит загрузка следующих партий (страниц) программы - пока не дошел. Дошел - грузятся инструкцией Вывод-ввод.
загрузка и исполнение адресов с младшим тритом равным "-" невозможна, есть ли подобное ограничение на чтение и запись программно этих адресов - пока не нашел. Да есть, сдвиг как в случае исполнения в младшем трите "-" заменяется на "0".

вот как загрузилась 1я страница:
Code:
[0----]=           [-40]
[0---0]=00+-+0-00  [-39] [2я инструкция mov F, [00+-+]; mov F,000+0 ]
[0---+]=00+0+00-0  [-38][3я инструкция mov [00+0+],F; mov [00+0+].hi5trits,F
[0--0-]            [-37]
[0--00]=+000+-000  [-36][4я инструкция]
[0--0+]=+0+---0++  [-35][5я ...]
[0--0-]            [-34]
[0--+0]=+0+---0-+  [-33]
[0--++]=000+00-00  [-32]
[0-0--]=           [-31]
[0-0-0]=0+--0+000  [-30]
[0-0-+]=00++--++0  [-29]
[0-00-]=           [-28]
[0-000]=----0+00+  [-27]
[0-00+]=00+-0-+00  [-26]
[0-0+-]=           [-25]
[0-0+0]=00++-+0+0  [-24]
[0-0++]=00++--++0  [-23]
[0-+--]=           [-22]
[0-+-0]=00+-+0--0  [-21]
[0-+-+]=0-0000+-0  [-20]
[0-+0-]=           [-19]
[0-+00]=0-+++0++0  [-18]
[0-+0+]=000++0-00  [-17]
[0-++-]=           [-16]
[0-++0]=0-0000000  [-15]
[0-+++]=00+0+0-00  [-14]
[00---]=           [-13]
[00--0]=0+-0-+0-+  [-12]
[00--+]=00-+00+00  [-11]
[00-0-]=           [-10]
[00-00]=00000+--0  [-09]
[00-0+]=0--000000  [-08]
[00-+-]=           [-07]
[00-+0]=00+000--0  [-06]
[00-++]=0---+0+00  [-05]
[000--]=           [-04]
[000-0]=+0+0--0-0  [-03]
[000-+]=-0+---0-0  [-02]
[0000-]=           [-01]
[00000]=+--+00000  [000]
[0000+]=0---00000  [+01] [1-я инструкция переход на 0---0]
[000+-]=           [+02]
[000+0]=-00000000  [+03]
[000++]=-000+0000  [+04]
[00+--]=           [+05]
[00+-0]=00-000000  [+06]
[00+-+]=000+00000  [+07]
[00+0-]=           [+08]
[00+00]=000-00000  [+09]
[00+0+]=000000000  [+10]
[00++-]=           [+11]
[00++0]=0000000-+  [+12]
[00+++]=+0---+-+-  [+13]
[0+---]=           [+14]
[0+--0]=000000000  [+15]
[0+--+]=000000000  [+16]
[0+-0-]=           [+17]
[0+-00]=0000000-+  [+18]
[0+-0+]=+0---+-+-  [+19]
[0+-+-]=           [+20]
[0+-+0]=0000000-+  [+21]
[0+-++]=+-+-+-+-0  [+22]
[0+0--]=           [+23]
[0+0-0]=000000000  [+24]
[0+0-+]=000000000  [+25]
[0+00-]=           [+26]
[0+000]=000000000  [+27]
[0+00+]=000000000  [+28]
[0+0+-]=           [+29]
[0+0+0]=000000000  [+30]
[0+0++]=000000000  [+31]
[0++--]=           [+32]
[0++-0]=000000000  [+33]
[0++-+]=000000000  [+34]
[0++0-]=           [+35]
[0++00]=000000000  [+36]
[0++0+]=000000000  [+37]
[0+++-]=           [+38]
[0+++0]=000000000  [+39]
[0++++]=000000000  [+40]


пошагово путешествуя по отладке, удалось вычленить сообщения из самозатираемой консоли (не попадающие в нормальную консоль):
    "<0> 001[0000+] (ω):0 00 [000] Безусловный переход ; A*=>(C) A: 0---0 + πф:0 x F:00000 A*: 0---0 0x9:0жх (A*):00+-+0-00 0x9:01уц0 (C) <- 0---0 -> 0жх[0---0]"
    "<1> 0жх[0---0] (ω):0 0х [0-0] Посылка в F ; (A*)=>(F) A: 00+-+ + πф:0 x F:00000 A*: 00+-+ 0x9:01у (A*):000+00000 0x9:00300 (A*):000+00000-> F:000+0 -> 0жу[0---+]"
    "<2> 0жу[0---+] (ω):+ 0ц [00-] Запись из F ; (F)=>(A*) A: 00+0+ + πф:0 x F:000+0 A*: 00+0+ 0x9:011 (A*):000000000 0x9:00000 (F):000+00000 -> A*:00+0+ (A*):000+00000 (ω):+ -> 0ж0[0--00]"
    "<3> 0ж0[0--00] (ω):+ ц0 [-00] Вывод-ввод ; Ввод в Фа*. Вывод из Фа* A: +000+ + πф:0 x F:000+0 A*: +000+ 0x9:101 (A*):000000000 0x9:00000 code:000+ zone:+ FT-1 -> MemBank :+ -> 0ж1[0--0+]"
    ...

по команде Вывод-ввод данные грузятся в зависимости от значения самого старшего трита инструкции
либо в "-" младший диапазон -121..-41
либо в "0" средний диапазон -40..+40
либо в "+" старший диапазон +41..+121 .
загрузка происходит во все 54 адреса из 81 возможных в которых младший трит не равен "-".
4 трита следующих за старшим определяют откуда(или куда) будет произведена загрузка.
000+ или +1 - из ФТ1
00+0 или +2 - из ФТ2
0-00 или -9 - в Принтер.


28 Jun 2018 03:07
Profile
Doomed
User avatar

Joined: 04 Jan 2016 09:15
Posts: 649
Location: Russia, S.- Peterburg
Reply with quote
ProMiNick wrote:

загрузка и исполнение адресов с младшим тритом равным "-" невозможна, есть ли подобное ограничение на чтение и запись программно этих адресов - пока не нашел.
Да есть, сдвиг как в случае исполнения в младшем трите "-" заменяется на "0".

вот как загрузилась 1я страница:
[0----]= [-40]
[0---0]=00+-+0-00 [-39] [2я инструкция mov F, [00+-+]; mov F,000+0 ]
[0---+]=00+0+00-0 [-38][3я инструкция mov [00+0+],F; mov [00+0+].hi5trits,F
[0--0-] [-37]



Возможна! Выполняется ДВА РАЗА инструкция с младшим тритом равным '0'.

Code:
   
/**
* Filename: "emusetun.c "
*
* Project: Виртуальная машина МЦВМ "Сетунь" 1958 года на языке Си
*
* Create date: 01.11.2018
* Edit date:   07.02.2021
*
* Version: 1.23
*/
      /* ---------------------------------------
      *  Выполнить операцию машины "Сетунь-1958"
      *  ---------------------------------------
      */

      /*
      * Описание реализации команд машины «Сетунь»
      *
      * 5-разрядный регистр управления С, в котором содержится адрес
      * выполняемой команды, после выполнения каждой команды в регистре С
      * формируется адрес следующей команды причём за командой являющейся первой
      * коротким кодом какой-либо ячейки, следует­ команда, являющаяся вторым
      * коротким кодом этой ячейки, а вслед за ней — ко­манда, являющаяся первым
      * коротким кодом следующей ячейки, и т. д.;
      * этот порядок может быть нарушен при выполнении команд
      * перехода.
      */


Attachments:
setun_next_command.png
setun_next_command.png [ 854.65 KiB | Viewed 7119 times ]

_________________
"Ученье свет, а неученье — тьма. Дело мастера боится, и коль крестьянин не умеет сохою владеть — хлеб не родится." (С)
10 Feb 2021 00:07
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 15 guests


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.