Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/+Olivetti+Programma+101+Simulator+?V=10
QUERY_STRINGV=10
CONTENT_TYPE
DOCUMENT_URI/revision/+Olivetti+Programma+101+Simulator+
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
REMOTE_ADDR172.69.6.145
REMOTE_PORT40228
SERVER_PORT8888
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip
HTTP_X_FORWARDED_FOR3.14.145.128
HTTP_CF_RAY89285a5f586c61fa-ORD
HTTP_X_FORWARDED_PROTOhttp
HTTP_CF_VISITOR{"scheme":"http"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP3.14.145.128
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit { Olivetti Programma 101 Simulator } My\ first\ computer\ was\ an\ Olivetti\ Programma\ 101\ owned\ by\ my\ high\ school,\ and\ I\ spent\ many\ hours\ learning\ how\ to\ program\ using\ it.\ As\ chance\ would\ have\ it,\ it\ was\ also\ the\ first\ computer\ my\ wife\ worked\ with\ as\ well\ -\ though\ she\ only\ got\ a\ few\ hours.\ At\ any\ rate,\ I\ wrote\ this\ for\ my\ wife's\ birthday.\ Those\ of\ you\ who\ have\ also\ used\ this\ machine\ will\ recognize\ it\ immediately.\n\nThis\ program\ is\ not\ typical\ Tcl.\ Because\ our\ current\ computers\ have\ quite\ different\ screen\ resolutions,\ I\ needed\ to\ make\ it\ resizable,\ at\ least\ to\ ''some''\ extent.\ So\ I\ came\ up\ with\ a\ system\ to\ generate\ a\ display\ from\ a\ bitmap,\ and\ widgets\ are\ located\ by\ decimal\ places\ -\ .5\ would\ be\ 50%\ of\ the\ way\ from\ the\ left\ side,\ and\ so\ on.\ It\ also\ extracts\ the\ actual\ button\ label\ from\ that\ portion\ of\ the\ image,\ so\ I\ don't\ need\ to\ specify\ it\ separately.\n\nThis\ program\ has\ been\ lightly\ tested,\ but\ there\ are\ probably\ still\ bugs.\ The\ worst\ I've\ dealt\ with\ are\ actually\ edit\ errors\ that\ moved\ widgets\ to\ West\ Succotash,\ Iowa\ or\ someplace\ because\ I\ dinged\ the\ table\ of\ widget\ placement\ data.\ Hopefully,\ this\ version\ straightens\ out\ all\ of\ that.\ It\ should\ also\ be\ noted\ there\ are\ quite\ a\ few\ new\ features\ added\ to\ the\ architecture\ to\ make\ it\ a\ little\ less\ painful\ to\ program,\ including\ editing\ of\ programs\ (if\ you\ made\ a\ mistake\ in\ entering\ the\ current\ instruction\ you\ could\ CLEAR\ and\ re-enter\ it,\ but\ if\ you\ don't\ notice\ the\ error\ right\ away\ and\ spot\ it\ scrolling\ up\ while\ you\ are\ entering\ a\ different\ command,\ well,\ you\ ''lose''\ and\ you\ have\ to\ re-enter\ the\ whole\ program\ all\ over\ again).\ Also,\ the\ blue\ buttons\ represent\ various\ extended\ functions\ allowing\ you\ to\ display\ the\ registers,\ edit\ the\ labels,\ and\ so\ on,\ and\ I\ also\ added\ the\ \"rub\ out\"\ button\ and\ the\ keyboard\ buffer\ display.\ You\ just\ had\ to\ remember\ what\ digits\ you\ keyed\ in\ with\ the\ actual\ hardware.\n\nAside\ from\ these\ additions\ the\ layout\ exactly\ follows\ the\ original\ except\ for\ moving\ the\ decimal\ wheel\ from\ the\ right\ to\ the\ left.\n\nThe\ variable\ \"runfrom\"\ can\ be\ set\ to\ \".\"\ or\ to\ \"p101.exe\"\ according\ to\ whether\ it\ is\ run\ as\ a\ script\ or\ as\ a\ tclkit.\ In\ either\ case,\ it\ needs\ a\ companion\ \"images\"\ directory\ with\ the\ following\ contents:\n\nThe\ program\ is\ below,\ but\ it\ needs\ a\ variety\ of\ images\ and\ so\ forth.\ I\ tried\ to\ upload\ those\ and\ got\ complaints\ about\ an\ image\ format\ not\ being\ text/wikit\ format.\ It\ would\ be\ easiest\ to\ just\ upload\ the\ p101.vfs\ as\ a\ zip\ file.\ If\ someone\ can\ help\ me\ circumvent\ these\ issues?\n\n\[CMcC\]\ Could\ you\ please\ elaborate\ on\ \"No\ .exe,\ no\ .zip,\ and\ no\ .gif\ either\ since\ I\ somehow\ changed\ the\ type\ of\ the\ file,\ whatever\ THAT\ means\"\ ?\n\nThe\ wiki\ refuses\ to\ upload\ .exe\ and\ .zip\ files.\ Likely\ this\ is\ not\ a\ bug\ but\ a\ security\ feature,\ either\ one\ may\ host\ malware.\ \nOkay,\ re-reading\ the\ image\ upload\ and\ doing\ it\ the\ correct\ way\ seems\ to\ work\ -\ although\ I\ find\ the\ method\ counter-intuitive\ in\ the\ extreme\ -\ but\ when\ I\ uploaded\ a\ .ico\ file\ it\ was\ still\ assigned\ a\ page\ number\ and\ the\ .htm\ extension,\ and\ when\ I\ did\ \"save\ Link\"\ and\ renamed\ it\ back\ to\ .ico,\ it\ didn't\ work.\ Likely\ not\ 8-bit\ clean\ somewhere\ in\ the\ loop.\n======\n\nNow,\ after\ some\ thought,\ I\ expect\ this\ is\ because\ it\ is\ assuming\ that\ the\ upload\ file\ ''replaces''\ the\ original\ wiki\ page,\ and\ it\ won't\ do\ that.\ \ Again,\ probably\ a\ a\ feature\ rather\ than\ a\ bug.\ It\ leaves\ me\ not\ knowing\ how\ to\ upload\ an\ image\ as\ such\ under\ its\ own\ name\ and\ type.\n\nSecondly,\ consider\ using\ the\ \[Half\ Bakery\]\ for\ uploading\ your\ code.\ \ I\ think\ the\ basic\ problem\ here\ is\ that\ you're\ uploading\ a\ package\ which\ could\ be\ modelled\ as\ a\ collection\ containing\ several\ components,\ and\ wiki\ generally\ doesn't\ really\ lend\ itself\ to\ a\ hierarchy\ by\ inclusion.\n\nI\ hadn't\ thought\ of\ the\ Half\ Bakery\ as\ a\ release\ mechanism.\ I'll\ look\ into\ that.\n<sigh>I\ don't\ see\ how\ to\ upload\ here,\ either.\ Uploading\ a\ .zip\ or\ a\ .tgz\ add\ the\ archive\ name\ preceded\ by\ an\ 'x'\ link,\ but\ it\ doesn't\ seem\ to\ have\ actually\ added\ it\ to\ the\ repository\ and\ pressing\ the\ x\ just\ seems\ to\ delete\ it.</sigh>\ I\ really\ agree\ with\ \[uniquename\],\ a\ simply\ upload\ button\ would\ require\ far\ less\ explanation\ or\ documentation.\ It\ reminds\ me\ of\ the\ whole\ \"how\ come\ Tcl\ barfs\ when\ it\ sees\ 09?\"\ controversy.\n\n======\npackage\ provide\ app-p101\ 1.0\n#\ set\ runfrom\ p101.exe\nset\ runfrom\ .\n\nproc\ setfonts\ \{\ brw\ brh\ bufw\ dispch\ spfnsz\ brfnsz\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ txtfnsz\ HLfnsz\ abtfnsz\ regfnsz\ lblfnsz\ \\\n\}\ \{\n\ \ set\ ::brheight\ \$brh\n\ \ set\ ::brwidth\ \$brw\n\ \ set\ ::bufwidth\ \$bufw\n\ \ set\ ::dispch\ \$dispch\n\ \ set\ ::spfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$spfnsz\ \]\n\ \ set\ ::brfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$brfnsz\ \]\n\ \ set\ ::txtfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$txtfnsz\ \]\n\ \ set\ ::HLfn\ \[\ font\ create\ -family\ tahoma\ -weight\ bold\ -size\ \$HLfnsz\ \]\n\ \ set\ ::abtfn\ \[\ font\ create\ -family\ tahoma\ -weight\ normal\ -size\ \$abtfnsz\ \]\n\ \ set\ ::regfn\ \[\ font\ create\ -family\ tahoma\ -size\ \$regfnsz\ \]\n\ \ set\ ::lblfn\ \[\ font\ create\ -family\ tahoma\ -weight\ normal\ -size\ \$lblfnsz\ \]\n\}\n\nproc\ log\ \{\ msg\ \}\ \{\n\ \ if\ !\$::uselog\ return\n\ \ if\ !\$::logopen\ \{\n\ \ \ \ if\ \{\ \[\ catch\ \{\n\ \ \ \ \ \ set\ ::logfile\ \[\ open\ ./logfile.txt\ w\ \]\n\ \ \ \ \ \ set\ ::logopen\ 1\n\ \ \ \ \}\ error\ \]\ !=\ 0\ \}\ \{\n\ \ \ \ \ \ set\ ::uselog\ 0\n\ \ \ \ \}\n\ \ \}\n\ \ puts\ \$::logfile\ \$msg\n\ \ flush\ \$::logfile\n\}\n\nproc\ announce\ \{\ msg\ \}\ \{\n\ \ tk_messageBox\ -parent\ .top\ -title\ \"Info\"\ \\\n\ \ \ \ -icon\ info\ -type\ ok\ -message\ \$msg\n\}\n\nproc\ reset\ \{\ \{\ override\ 0\ \}\ \}\ \{\n\ \ if\ !\$override\ \{\n\ \ \ \ if\ \{\[tk_messageBox\ -parent\ .\ -title\ \"Are\ you\ sure?\"\ \\\n\ \ \ \ \ \ \ \ \ \ \ -icon\ question\ -type\ yesno\ -default\ no\ \\\n\ \ \ \ \ \ \ \ \ \ \ -message\ \"Reset\ P101\ Simulator?\"\]\ ne\ \"yes\"\n\ \ \ \ \}\ \{\n\ \ \ \ \ \ return\n\ \ \ \ \}\n\ \ \}\n\ \ .top.printarea.text\ delete\ 0.0\ end\n\ \ .prog.list.list\ delete\ 0\ end\n\ \ .prog.list.list\ insert\ end\ \"end\"\ \;\ renum\ .prog.list\n\ \ set\ ::pc\ 0\n\ \ set\ ::reg\ \"\"\n\ \ set\ ::confirm\ 0\n\ \ set\ ::entering\ 0\n\ \ set\ ::recording\ 0\n\ \ set\ ::interactive\ 1\n\ \ set\ ::register(A)\ 0.0\n\ \ set\ ::register(B)\ 0.0\n\ \ set\ ::register(b)\ 0.0\n\ \ set\ ::register(C)\ 0.0\n\ \ set\ ::register(c)\ 0.0\n\ \ set\ ::register(D)\ 0.0\n\ \ set\ ::register(d)\ 0.0\n\ \ set\ ::register(E)\ 0.0\n\ \ set\ ::register(e)\ 0.0\n\ \ set\ ::register(F)\ 0.0\n\ \ set\ ::register(f)\ 0.0\n\ \ set\ ::register(R)\ 0.0\n\ \ set\ ::register(M)\ 0.0\n\ \ set\ stack\ \{\}\n\ \ set\ regstack\ \{\}\n\ \ .top.red\ configure\ -bg\ \$::dkred\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ normal\ \}\n\ \ .top.face\ delete\ vwyzlbl\n\ \ updlbls\n\}\n\nproc\ down\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \$::register(\$reg)\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2193\n\}\n\nproc\ up\ \{\ reg\ \}\ \{\n\ \ set\ ::register(\$reg)\ \$::register(M)\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2191\n\}\n\nproc\ swap\ \{\ reg\ \}\ \{\n\ \ if\ \{\ \$reg\ eq\ \"/\"\ \}\ \{\n\ \ \ \ \ \ set\ A\ \$::register(A)\n\ \ \ \ \ \ set\ ::register(M)\ \[=\ \{\$A-entier(\$A)\}\ \]\n\ \ \ \ \ \ interactive\ \$::register(M)\ /\ \\u2195\n\ \ \ \ return\n\ \ \}\n\ \ if\ \{\ \$reg\ eq\ \"A\"\ \}\ \{\ \n\ \ \ \ set\ ::register(A)\ \[=\ \{abs(\$::register(A))\}\]\n\ \ \}\ else\ \{\n\ \ \ \ set\ temp\ \$::register(A)\n\ \ \ \ set\ ::register(A)\ \$::register(\$reg)\n\ \ \ \ set\ ::register(\$reg)\ \$temp\n\ \ \}\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2195\n\}\n\nproc\ sqrt\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{sqrt(\$::register(\$reg))\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ \\u221a\n\}\n\nproc\ minus\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ -\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ -\n\}\n\nproc\ times\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ *\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ \\u00d7\n\}\n\nproc\ plus\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ +\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ +\n\}\n\nproc\ divide\ \{\ reg\ \}\ \{\n\ \ set\ A\ \[=\ \{entier(\$::register(A))\}\]\n\ \ if\ \{\[\ string\ first\ \".\"\ \$::register(A)\ \]\ ==\ -1\ \}\ \{\n\ \ \ \ set\ ::register(A)\ \$::register(A).0\n\ \ \}\n\ \ if\ \{\ 0\ !=\ \[\ catch\ \{\n\ \ \ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ /\ \$::register(\$reg)\}\]\n\ \ \ \ set\ ::register(R)\ 0\n\ \ \ \ set\ R\ \[=\ \{entier(\$::register(\$reg))\}\]\n\ \ \ \ set\ ::register(R)\ \[=\ \{\$A\ %\ \$R\}\]\n\ \ \ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ \ \ interactive\ \$::register(A)\ \$reg\ \\u00f7\n\ \ \}\ \]\ \}\ \{\ redlight\ -1.0\ \}\n\}\n\nproc\ zero\ \{\ reg\ \}\ \{\n\ \ set\ ::register(\$reg)\ 0\n\ \ interactive\ \$::register(\$reg)\ \$\{reg\}\ *\n\}\n\nproc\ prreg\ \{\ reg\ \}\ \{\n\ \ type\ \$::register(\$reg)\ \$\{reg\}\\u25c7\n\}\n\nproc\ renum\ \{\ w\ \}\ \{\n\ \ \$w.linecount\ delete\ 0\ end\n\ \ set\ maxj\ \[\ \$w.list\ index\ end\ \]\n\ \ for\ \{\ set\ j\ 0\ \}\ \{\ \$j\ <\ \$maxj\ \}\ \{\ incr\ j\ \}\ \{\n\ \ \ \ \$w.linecount\ insert\ end\ \$j\n\ \ \}\n\}\n\nproc\ insins\ \{\ instr\ \}\ \{\n\ \ .prog.list.list\ insert\ \$::pc\ \"\$instr\"\n\ \ type\ \"\$::pc:\ \$instr\"\n\ \ renum\ .prog.list\n\}\n\nproc\ delins\ \{\ \}\ \{\n\ \ if\ \{\ \[\ .prog.list.list\ get\ \$::pc\ \]\ eq\ \"end\"\ \}\ return\n\ \ .prog.list.list\ delete\ \$::pc\ \$::pc\n\ \ renum\ .prog.list\n\}\n\nproc\ clear\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\n\ \ \ \ delins\n\ \ \ \ return\n\ \ \}\n\ \ .top.red\ configure\ -bg\ \$::dkred\n\ \ .top.buffer.entry\ delete\ 0\ end\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ normal\ \}\n\}\n\nproc\ recprog\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\n\ \ \ \ set\ ::recording\ 0\n\ \ \ \ .top.recprog\ configure\ -relief\ raised\n\ \ \ \ type\ \"...end\"\n\ \ \ \ return\n\ \ \}\n\ \ type\ \"Begin...\"\n\ \ set\ ::recording\ 1\n\ \ .top.recprog\ configure\ -relief\ sunken\n\ \ .top.buffer.entry\ delete\ 0\ end\n\}\n\nproc\ prprog\ \{\ \}\ \{\n\ \ type\ \"Listing...\"\n\ \ set\ maxj\ \[\ .prog.list.list\ index\ end\ \]\n\ \ for\ \{\ set\ j\ 0\ \}\ \{\ \$j\ <\ \$maxj\ \}\ \{\ incr\ j\ \}\ \{\n\ \ \ \ set\ ins\ \[\ .prog.list.list\ get\ \$j\ \]\n\ \ \ \ type\ \"\$j:\ \$ins\"\n\ \ \}\n\ \ type\ \"...end\"\n\}\n\nproc\ paperadv\ \{\ \}\ \{\ type\ \"\"\ \}\nproc\ paperclr\ \{\ \}\ \{\n\ \ .top.printarea.text\ delete\ 1.0\ end\n\ \ set\ ::value\ \"\"\n\}\nproc\ papersav\ \{\ \}\ \{\n\ \ set\ tapename\ \[\ tk_getSaveFile\ -defaultextension\ .txt\ \\\n\ \ \ \ -initialdir\ .\ -parent\ .top\ -title\ \"Save\ Paper\ Tape...\"\ \]\n\ \ if\ \{\ \$tapename\ ne\ \"\"\ \}\ \{\n\ \ \ \ set\ f\ \[\ open\ \$tapename\ w\ \]\n\ \ \ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ \ \ set\ tape\ \[\ .top.printarea.text\ get\ 1.0\ end\ \]\n\ \ \ \ puts\ \$f\ \$tape\n\ \ \ \ close\ \$f\n\ \ \}\n\}\n\nproc\ page\ \{\ number\ \}\ \{\n\ \ if\ \{\ \$::curpage\ !=\ 0\ \}\ \{\n\ \ \ \ grid\ forget\ .top.about.pg\$\{::curpage\}txt\n\ \ \ \ .top.about.pg\$\{::curpage\}\ configure\ -relief\ groove\n\ \ \}\n\ \ set\ ::curpage\ \$number\n\ \ grid\ .top.about.pg\$\{number\}txt\ -row\ 3\ -column\ 0\ -columnspan\ 6\ -rowspan\ 20\ -sticky\ news\n\ \ .top.about.pg\$\{::curpage\}\ configure\ -relief\ solid\n\}\n\nproc\ manual\ \{\ \}\ \{\n\ \ set\ savename\ \[\ tk_getSaveFile\ -defaultextension\ pdf\ \\\n\ \ \ \ -initialfile\ olpro101.pdf\ \\\n\ \ \ \ -parent\ .top\ -title\ \"Save\ Manual\ To...\"\ \]\n\ \ if\ \{\ \$savename\ ne\ \"\"\ \}\ \{\n\ \ \ \ file\ copy\ -force\ \$::manpdf\ \$savename\n\ \ \}\n\}\n\nproc\ prefs\ \{\ \}\ \{\n\ \ destroy\ .top.options\n\ \ toplevel\ .top.options\n\ \ label\ .top.options.title\ -text\ \"PROGRAMMA-101\\nSIMULATOR\ OPTIONS\"\n\ \ grid\ .top.options.title\ -row\ 0\ -column\ 0\ -columnspan\ 2\n\ \ checkbutton\ .top.options.animation\ \\\n\ \ \ \ -variable\ ::animation\ -text\ \"Card\ Animation\"\n\ \ grid\ .top.options.animation\ -row\ 1\ -column\ 0\n\ \ button\ .top.options.close\ -text\ \"Close\ Options\"\ -command\ \{\n\ \ \ \ destroy\ .top.options\ \n\ \ \}\n\ \ button\ .top.options.manual\ -text\ \"Save\ Manual\"\ -command\ manual\n\ \ grid\ .top.options.manual\ -row\ 2\ -column\ 0\n\ \ grid\ .top.options.close\ -row\ 3\ -column\ 0\ -columnspan\ 2\n\}\n\nproc\ about\ \{\ \}\ \{\n\ \ set\ tabs\ \\t\n\ \ if\ \{\ \$::size\ ==\ 100\ \}\ \{\ set\ tabs\ \\t\\t\ \}\n\ \ destroy\ .top.about\n\ \ toplevel\ .top.about\n\ \ label\ .top.about.title\ -text\ \"OLIVETTI-UNDERWOOD\\nPROGRAMMA\ 101\"\ \\\n\ \ \ \ -font\ \$::HLfn\n\ \ grid\ .top.about.title\ -row\ 0\ -column\ 0\ -columnspan\ 5\n\ \ label\ .top.about.blurb\ -text\ \"by\ Larry\ Smith\"\ -font\ \$::HLfn\n\ \ grid\ .top.about.blurb\ -row\ 1\ -column\ 0\ -columnspan\ 5\n\ \ button\ .top.about.pg1\ -command\ \{\ page\ 1\ \}\ -text\ \"Credits\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg1\ -row\ 2\ -column\ 0\n\ \ button\ .top.about.pg2\ -command\ \{\ page\ 2\ \}\ -text\ \"Machine\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg2\ -row\ 2\ -column\ 1\n\ \ button\ .top.about.pg3\ -command\ \{\ page\ 3\ \}\ -text\ \"Simulator\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg3\ -row\ 2\ -column\ 2\n\ \ button\ .top.about.pg4\ -command\ \{\ page\ 4\ \}\ -text\ \"Basic\ Ops\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg4\ -row\ 2\ -column\ 3\n\ \ button\ .top.about.pg5\ -command\ \{\ page\ 5\ \}\ -text\ \"Extensions\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg5\ -row\ 2\ -column\ 4\n\ \ label\ .top.about.pg1txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"©\ 2009\ by\ Larry\ Smith\\n\\nWritten\ for\ Marjie\ Smith,\ my\ wife,\ for\ her\ birthday.\ \ The\ Olivetti\\nProgramma\ 101\ was\ the\ first\ real\ computer\ I\ ever\ used\ and\ it\ was\\nthe\ first\ Marjie\ ever\ used,\ too.\ \ It\ has\ great\ nostalgic\ value\ for\ us.\\n\\n\\n\\n\\n\\n\\n\"\n\ \ label\ .top.about.pg2txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"The\ Programma\ 101\ was\ the\ first\ machine\ to\ be\ marketed\ as\\n\\\"microcomputer\\\".\ \ It\ was\ built\ with\ many\ transistors\ worth\ of\\ndiscrete\ logic,\ and\ used\ a\ delay\ line\ to\ implement\ the\ memory\\nregisters.\ \ By\ modern\ standards\ it\ was\ limited\ -\ five\ registers\\n(B,\ C,\ D,\ E\ and\ F)\ which\ could\ each\ be\ split\ in\ two\ if\ you\ could\\nlive\ with\ half\ the\ accuracy).\ \ It\ stored\ just\ 48\ instructions\ in\\nits\ program,\ and\ began\ eating\ up\ registers\ F,\ E,\ and\ D\ if\ you\\nexceeded\ that\ number,\ to\ a\ maximum\ of\ 120\ instructions\ with\\nonly\ two\ registers\ left.\\n\\n\\n\"\n\ \ label\ .top.about.pg3txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"The\ simulator\ emulates\ the\ original\ machine,\ but\ it\ does\ not\\nenforce\ its'\ limits.\ \ That\ is\ to\ say,\ you\ can\ split\ the\ F\ register\\ninto\ F\ and\ f\ (F-split)\ but\ they\ are\ not\ reduced\ in\ size,\ each\ is\\nreally\ a\ separate\ register.\\n\\nThe\ program\ is\ also\ not\ limited\ to\ 48\ or\ 120\ steps,\ it\ can\ be\ any\\nlength,\ and\ the\ F,\ E\ and\ D\ registers\ are\ never\ used.\\n\\n\\n\\n\\n\"\n\ \ label\ .top.about.pg4txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"\\\[To\ A\\u2193\\\]\\tdown\\tTransfers\ named\ register\ to\ accumulator.\\n\\\[M\\u2191\\\]\\tup\\tMoves\ contents\ of\ M\ (keyboard)\ register\ to\ named\ reg.\\n\\\[A\\u2195\\\]\\tswap\\tSwitches\ contents\ of\ named\ register\ and\ accumulator.\\n\\\[\\u221a\\\]\\tsqrt\\tLoads\ accumulator\ with\ the\ square\ root\ of\ the\ reg.\\n\\\[\\u2014\\\]\\tminus\\tSubtracts\ named\ reg\ from\ accumulator.\\n\\\[\\u00d7\\\]\\ttimes\\tMultiplies\ named\ reg\ by\ accumulator.\\n\\\[+\\\]\\tplus\\tAdds\ named\ reg\ to\ accumulator.\\n\\\[\\u00f7\\\]\\tdivide\\tDivides\ accumulator\ by\ named\ reg.\\n\\\[*\\\]\\tzero\\tStores\ 0\ in\ named\ reg.\\n\\\[\\u25c7\\\]\\tprreg\\tPrints\ the\ named\ reg.\\n\\\[S\\\]\\tstart\\tStarts\ execution\ at\ current\ program\ step.\\n\\\[/\\\]\\tsplit\\tUsed\ to\ address\ split\ registers\ a\ (A/),\ b\ (B/)\ etc.\"\n\ \ label\ .top.about.pg5txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"Buttons\ with\ a\ blue\ background\ are\ for\ extensions\ to\ the\ machine.\\n\\nSave\ Tape\\tSaves\ contents\ of\ display\ tape\ to\ utf-8\ text\ file.\\nClear\ Tape\\tClears\ display\ tape.\\nPush\ Regs\\tSave\ all\ regs\ but\ A,\ R\ &\ M\ to\ internal\ stack.\\nPull\ Regs\\t\\tRestore\ all\ regs\ but\ A,\ R\ &\ M\ from\ internal\ stack.\\nProg\ Library\\tSets\ directory\ to\ search\ for\ program\ cards.\\nSave\ Card\$\{tabs\}Saves\ current\ program\ to\ program\ card.\\nShow\ Labels\\tDisplays\ window\ to\ permit\ editing\ VXYZ\ labels.\\nShow\ Regs\\tDisplays\ window\ showing\ current\ contents\ of\ regs.\\nShow\ Prog\\tDisplays\ window\ showing\ current\ program.\\n\"\n\ \ button\ .top.about.exit\ -text\ \"Exit\ Simulator\"\ \\\n\ \ \ \ -command\ off\ -border\ 3\ -font\ \$::abtfn\n\ \ grid\ .top.about.exit\ -row\ 23\ -column\ 1\n\ \ button\ .top.about.close\ -text\ \"Close\ About...\"\ \\\n\ \ \ \ -command\ \{\ destroy\ .top.about\ \}\ -border\ 3\ -font\ \$::abtfn\n\ \ grid\ .top.about.close\ -row\ 23\ -column\ 3\n\ \ page\ 1\n\ \ center\ .top.about\n\}\n\nproc\ setdec\ \{\ args\ \}\ \{\n\ \ set\ ::tcl_precision\ \$::numdecs\n\}\n\nproc\ type\ \{\ str\ \{\ suffix\ \"\"\ \}\ \}\ \{\n\ \ if\ \{\ \$suffix\ eq\ \"\"\ \}\ \{\n\ \ \ \ set\ prstr\ \$str\n\ \ \}\ else\ \{\n\ \ \ \ set\ prstr\ \"\[format\ \"%\[=\ \{\$::dispch-4\}\].\[set\ ::numdecs\]f\"\ \$str\]\ \$\{suffix\}\"\n\ \ \}\n\ \ .top.printarea.text\ insert\ end\ \\n\$prstr\n\ \ .top.printarea.text\ see\ end\n\}\n\nproc\ blink\ \{\ \}\ \{\n\ \ if\ \$::greenon\ return\n\ \ set\ ::greenon\ 1\n\ \ .top.green\ configure\ -bg\ \$::brgreen\n\ \ set\ delay\ 300\n\ \ if\ !\$::interactive\ \{\ set\ delay\ 100\ \}\n\ \ after\ \$delay\ \{\n\ \ \ \ .top.green\ configure\ -bg\ \$::dkgreen\n\ \ set\ ::greenon\ 0\n\ \ \}\n\}\n\nproc\ off\ \{\ \}\ \{\ exit\;\n\ \ if\ \{\[tk_messageBox\ -parent\ .\ -title\ \"Are\ you\ sure?\"\ \\\n\ \ \ \ \ \ \ \ \ -icon\ question\ -type\ yesno\ -default\ no\ \\\n\ \ \ \ \ \ \ \ \ -message\ \"Exit\ P101\ Simulator?\"\]\ eq\ \"yes\"\n\ \ \}\ \{\n\ \ \ \ exit\n\ \ \}\n\}\n\nproc\ redlight\ \{\ code\ \}\ \{\n\ \ .top.green\ configure\ -bg\ \$::dkgreen\n\ \ .top.red\ configure\ -bg\ \$::brred\n\ \ if\ \$::interactive\ \{\ type\ \$code\ E!\ \}\ else\ \{\ type\ \$code\ PC\ \}\n\ \ set\ ::interactive\ 1\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ disabled\ \}\n\ \ set\ ::register(A)\ 0.0\n\}\n\nproc\ jump\ \{\ label\ \}\ \{\n\ \ set\ ::interactive\ 0\n\ \ set\ reg\ \[\ string\ index\ \$label\ 0\ \]\n\ \ set\ cond\ 0\n\ \ if\ \{\ \[\ string\ first\ \$reg\ \"/cdr\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ set\ cond\ 1\n\ \ \}\n\ \ set\ pc\ \$::pc\n\ \ if\ \{\ !\$cond\ ||\ (\$::register(A)\ >\ 0)\ \}\ \{\n\ \ \ \ set\ pc\ \[\ lsearch\ -exact\ \$::program\ \$::jumps(\$label)\ \]\n\ \ \}\n\ \ if\ \{\ \$pc\ ==\ -1\ \}\ \{\n\ \ \ \ set\ ::interactive\ 1\n\ \ \ \ redlight\ \$::pc\n\ \ \ \ set\ ::pc\ 0\n\ \ \ \ return\ 0\n\ \ \}\n\ \ set\ ::pc\ \$pc\n\ \ return\ 1\n\}\n\nproc\ isjump\ \{\ label\ \}\ \{\n\ \ set\ result\ 0\n\ \ if\ \{\ (\$label\ ne\ \"\")\ &&\ (\$label\ ne\ \"\ S\")\ \}\ \{\n\ \ \ \ set\ reg\ \[\ string\ index\ \$label\ 0\ \]\n\ \ \ \ set\ cmd\ \[\ string\ index\ \$label\ 1\ \]\n\ \ \ \ if\ \{\ (\[\ string\ first\ \$cmd\ \"VWYZ\"\ \]\ !=\ -1\ )\ &&\n\ \ \ \ \ \ \ \ \ (\[\ string\ first\ \$reg\ \"\ MCDR/cdr\"\ \]\ !=\ -1\ )\n\ \ \ \ \ \ \ \}\ \{\n\ \ \ \ \ \ set\ result\ 1\n\ \ \ \ \}\n\ \ \}\n\ \ return\ \$result\n\}\n\nproc\ start\ \{\ \{\ label\ \"\"\ \}\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ start\ \;\ return\ \}\n\ \ if\ \{\ !\[info\ exists\ ::pc\]\ ||\ (\$::pc\ eq\ \"\")\ \}\ \{\ set\ ::pc\ 0\ \}\n\ \ set\ ::interactive\ 0\n\ \ set\ ::program\ \[\ .prog.list.list\ get\ 0\ end\ \]\n\ \ if\ \{\ \$label\ ne\ \"\"\ \}\ \{\ jump\ \$label\ \}\n\ \ while\ 1\ \{\n\ \ \ \ blink\n\ \ \ \ set\ ins\ \[\ lindex\ \$::program\ \$::pc\ \]\n\ \ \ \ set\ cmd\ \[\ string\ index\ \$ins\ end\ \]\n\ \ \ \ set\ reg\ \[\ string\ index\ \$ins\ end-1\ \]\n\ \ \ \ incr\ ::pc\n\ \ \ \ if\ \{\ \$ins\ eq\ \"end\"\ \}\ \{\n\ \ \ \ \ \ if\ \[\ pullstate\ \]\ continue\n\ \ \ \ \ \ set\ ::pc\ 0\n\ \ \ \ \ \ return\n\ \ \ \ \}\ elseif\ \{\ \$ins\ eq\ \"\ S\"\ \}\ \{\ return\n\ \ \ \ \}\ elseif\ \{\ \[string\ first\ \$cmd\ \"VWYZ\"\ \]\ !=-1\ \}\ \{\n\ \ \ \ \ \ #\ either\ label\ or\ branch.\ \ Labels\ are\ ignored\n\ \ \ \ \ \ if\ \[\ isjump\ \$ins\ \]\ \{\n\ \ \ \ \ \ \ \ if\ !\[jump\ \$ins\]\ return\n\ \ \ \ \ \ \}\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ set\ cmd\ \$::op2cmd(\$cmd)\n\ \ \ \ \ \ set\ value\ \[\ string\ range\ \$ins\ 0\ end-2\ \]\n\ \ \ \ \ \ if\ \{\ \$value\ ne\ \"\"\ \}\ \{\ set\ ::register(M)\ \$value\ \}\n\ \ \ \ \ \ \$cmd\ \$reg\n\ \ \ \ \ \ if\ \$::interactive\ return\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ interactive\ \{\ str\ reg\ op\ \}\ \{\n\ \ if\ \$::interactive\ \{\ type\ \$str\ \$\{reg\}\$op\ \}\n\ \ blink\n\}\n\nproc\ nextkey\ \{\ \}\ \{\n\ \ while\ 1\ \{\n\ \ \ \ vwait\ ::curbtn\n\ \ \ \ if\ \{\ \[lsearch\ \$::immediate\ \$::curbtn\]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \$::curbtn\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ set\ btntype\ \[\ string\ range\ \$::curbtn\ 0\ 2\ \]\n\ \ \ \ \ \ if\ \{\ (\$btntype\ eq\ \"num\")\ ||\ (\$btntype\ eq\ \"reg\")\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \[\ string\ index\ \$::curbtn\ end\ \]\n\ \ \ \ \ \ \ \ if\ \{\ \$::curbtn\ eq\ \"!\"\ \}\ \{\ set\ ::curbtn\ .\ \}\n\ \ \ \ \ \ \}\ elseif\ \{\ \[\ string\ first\ \$::curbtn\ \"vwyz\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \[\ string\ toupper\ \$::curbtn\ \]\n\ \ \ \ \ \ \}\ elseif\ \[\ info\ exists\ ::cmd2op(\$::curbtn)\ \]\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \$::cmd2op(\$::curbtn)\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ return\ \$::curbtn\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ backsp\ \{\ \}\ \{\n\ \ .top.buffer.entry\ delete\ \[=\ \{\[string\ length\ \[.top.buffer.entry\ get\]\]-1\}\]\n\}\n\nproc\ cmdloop\ \{\ \}\ \{\n\ \ set\ delbuffer\ 1\n\ \ while\ 1\ \{\n\ \ \ \ set\ reg\ \"\"\n\ \ \ \ set\ btn\ \[nextkey\]\n\ \ \ \ if\ \{\[string\ first\ \$btn\ \"0123456789.-\"\ \]\ !=\ -1\}\ \{\n\ \ \ \ \ \ if\ \$delbuffer\ \{\n\ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ \ \ set\ delbuffer\ 0\n\ \ \ \ \ \ \ \ set\ havedec\ 0\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ if\ \{\ \$btn\ eq\ \".\"\ \}\ \{\n\ \ \ \ \ \ \ \ if\ !\$::havedec\ \{\n\ \ \ \ \ \ \ \ \ \ set\ ::havedec\ 1\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ .\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \}\ elseif\ \{\ \$btn\ eq\ \"-\"\ \}\ \{\n\ \ \ \ \ \ \ \ if\ \{\[\ string\ index\ \$::buffer\ 0\ \]\ eq\ \"-\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ 1\n\ \ \ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ 0\ -\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ \$btn\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ continue\n\ \ \ \ \}\n\ \ \ \ set\ value\ \"\"\n\ \ \ \ if\ \{\ \$::buffer\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ if\ \{\ \[\ string\ first\ \".\"\ \$::buffer\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::buffer\ \$\{::buffer\}.0\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ set\ value\ \$::buffer\n\ \ \ \ \ \ if\ \$::interactive\ \{\ set\ ::register(M)\ \$value\ \}\n\ \ \ \ \}\n\ \ \ \ set\ delbuffer\ 1\n\ \ \ \ #\ value\ (if\ any)\ dealt\ with.\ \ btn\ should\ now\ be\ op,\ split\ or\ reg\n\ \ \ \ if\ \{\[string\ first\ \$btn\ \"ABCDEFMR/\"\]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ #\ it's\ a\ register\ name\n\ \ \ \ \ \ set\ reg\ \[\ string\ index\ \$btn\ end\ \]\n\ \ \ \ \ \ set\ btn\ \[\ nextkey\ \]\ \ \;#\ look\ for\ op\ or\ split\n\ \ \ \ \ \ if\ \{\ \$btn\ eq\ \"/\"\ \}\ \{\n\ \ \ \ \ \ \ \ set\ reg\ \[\ string\ tolower\ \$reg\ \]\n\ \ \ \ \ \ \ \ if\ \{\ \$reg\ eq\ \"m\"\ \}\ \{\ set\ reg\ /\ \}\n\ \ \ \ \ \ \ \ set\ btn\ \[nextkey\]\ \;#\ op\ MUST\ follow\ now\n\ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ #\ we\ get\ here\ we\ have\ a\ reg\ and\ op\ is\ in\ btn\n\ \ \ \ if\ \{\ \$reg\ eq\ \"\"\ \}\ \{\ set\ reg\ M\ \}\ \;#\ default\ register\n\ \ \ \ if\ \$::recording\ \{\n\ \ \ \ \ \ if\ \{\ \[string\ first\ \$btn\ \"VWXZ\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \$reg\ eq\ \"M\"\ \}\ \{\ set\ reg\ \"\ \"\ \}\n\ \ \ \ \ \ \ \ insins\ \"\$value\$reg\$btn\"\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \$btn\ eq\ \"S\"\ \}\ \{\ set\ reg\ \"\ \"\ \}\n\ \ \ \ \ \ \ \ insins\ \"\$value\$reg\$btn\"\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ incr\ ::pc\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ if\ \[\ isjump\ \$reg\$btn\ \]\ \{\n\ \ \ \ \ \ \ \ start\ \$reg\$btn\n\ \ \ \ \ \ \ \ set\ ::interactive\ 1\n\ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ \$::register(M)\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[catch\ \{\ \$::op2cmd(\$btn)\ \$reg\ \}\ err\ \]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \$btn\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ loadlistbox\ \{\ w\ values\ \}\ \{\n\ set\ j\ true\n\ set\ indx\ 0\n\ \$w.list\ delete\ 0\ end\n\ \$w.linecount\ delete\ 0\ end\n\ foreach\ i\ \$values\ \{\n\ \ \ \$w.list\ insert\ end\ \$i\n\ \ \ \$w.linecount\ insert\ end\ \$indx\n\ \ \ if\ \{\$j\}\ \{\n\ \ \ \ \ set\ j\ false\n\ \ \ \ \ \$w.list\ itemconfigure\ \$indx\ -background\ #ffffdd\n\ \ \ \}\ else\ \{\n\ \ \ \ \ set\ j\ true\n\ \ \ \}\n\ \ \ incr\ indx\n\ \ \}\n\}\n\nproc\ scrolledlistbox\ \{\ w\ width\ height\ values\ cmd\ \{\ font\ \"\"\ \}\}\ \{\nlog\ \"height\ is\ \$height\"\n\ if\ \{\ \$font\ eq\ \"\"\ \}\ \{\ set\ font\ \$::txtfn\ \}\ else\ \{\ set\ font\ \$::brfn\ \}\n\ frame\ \$w\n\ listbox\ \$w.list\ -width\ \$::brwidth\ -height\ \$::brheight\ -font\ \$font\n\ listbox\ \$w.linecount\ -width\ 4\ -height\ \$::brheight\ -font\ \$font\n\ \$w.list\ configure\ -yscrollcommand\ \"\$w.scrl\ set\"\n\ #\$w.linecount\ configure\ -yscrollcommand\ \"\$w.scrl\ set\"\n\ scrollbar\ \$w.scrl\ -command\ \"\$w.list\ yview\;\ \$w.linecount\ yview\"\n\ pack\ \$w.scrl\ -side\ right\ -fill\ y\n\ pack\ \$w.linecount\ -side\ left\ -fill\ y\n\ pack\ \$w.list\ -side\ left\ -fill\ both\ -expand\ 1\n\ loadlistbox\ \$w\ \$values\n\ #\ bindings\n\ #\n\ #\ this\ will\ obtain\ the\ item\ clicked,\ and\ then\ pass\n\ #\ the\ value\ onto\ the\ proc\ specified\ in\ the\ variable\ cmd.\n\ eval\ \"bind\ \$w.list\ <ButtonRelease-1>\ \\\{\$cmd\ \\\[\\%\\W\ get\ \\@\\%x,\\%y\\\]\\\}\"\n\ #\ return\ the\ widget\ path\n\ return\ \$w\n\}\n\nproc\ scrolledtextarea\ \{w\ l\ t\ r\ b\ \}\ \{\n\ \ set\ width\ \[=\ \{round((\$r-\$l)*\$::dispw)\}\]\n\ \ set\ height\ \[=\ \{round((\$b-\$t)*\$::disph)\}\]\n\ \ set\ x\ \[=\ \{round(\$l*\$::dispw)\}\]\n\ \ set\ y\ \[=\ \{round(\$t*\$::disph)\}\]\n\ \ frame\ \$w\ -width\ \$width\ -height\ \$height\ -bd\ 2\ -bg\ white\n\ \ place\ \$w\ -x\ \$x\ -y\ \$y\n\ \ scrollbar\ \$w.vscroll\ -orient\ vertical\ -command\ \[\ list\ \$w.text\ yview\ \]\n\ \ scrollbar\ \$w.hscroll\ -orient\ horizontal\ -command\ \[\ list\ \$w.text\ xview\ \]\n\ \ text\ \$w.text\ -yscrollcommand\ \[\ list\ \$w.vscroll\ set\ \]\ \\\n\ \ \ \ -xscrollcommand\ \[\ list\ \$w.hscroll\ set\ \]\ \\\n\ \ \ \ -font\ \$::txtfn\ -bg\ white\ -width\ 1\ -height\ 4\ -width\ \$::dispch\n\ \ pack\ \$w.vscroll\ -side\ right\ -fill\ y\n\ \ pack\ \$w.hscroll\ -side\ top\ -fill\ x\n\ \ pack\ \$w.text\ -side\ left\n\}\n\nproc\ uptodate\ \{filename\ \{time\ 0\}\}\ \{\n\ \ set\ filename\ \[file\ join\ \[pwd\]\ \$filename\]\n\ \ set\ mtime\ \[file\ mtime\ \$filename\]\n\ \ if\ \{\$mtime\ >\ \$time\}\ \{source\ \$filename\}\n\ \ after\ 1000\ \[list\ uptodate\ \$filename\ \$mtime\]\n\}\ \;#RS\n\nproc\ reloadlib\ \{\}\ \{\n\ \ set\ proglist\ \"\"\n\ \ catch\ \{\ set\ proglist\ \[glob\ -directory\ \$::library\ *.p101\]\ \}\n\ \ .top.cardlist.list\ delete\ 0\ end\n\ \ foreach\ file\ \$proglist\ \{\n\ \ \ \ .top.cardlist.list\ insert\ end\ \$file\n\ \ \}\n\ \ renum\ .top.cardlist\n\}\n\nproc\ proglib\ \{\}\ \{\n\ \ set\ newlib\ \[\ tk_chooseDirectory\ \ -initialdir\ \$::library\ \\\n\ \ \ \ -mustexist\ 1\ -parent\ .top\ -title\ \"Library\ Directory\"\ \]\n\ \ if\ \{\ \$newlib\ ne\ \"\"\ \}\ \{\ set\ ::library\ \$newlib\ \}\n\}\n\nproc\ savecard\ \{\}\ \{\n\ \ set\ progname\ \[\ tk_getSaveFile\ -defaultextension\ p101\ \\\n\ \ \ \ -initialdir\ \$::library\ -parent\ .top\ -title\ \"Save\ Program\ To...\"\ \]\n\ \ if\ \{\ \$progname\ ne\ \"\"\ \}\ \{\n\ \ \ \ set\ f\ \[\ open\ \$progname\ w\ \]\n\ \ \ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ \ \ puts\ \$f\ \"\[\ .prog.list.list\ get\ 0\ end\ \]\"\n\ \ \ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ R\ \}\ \{\n\ \ \ \ \ \ puts\ \$f\ \$::register(\$reg)\n\ \ \ \ \}\n\ \ \ \ foreach\ lbl\ \{\ v\ w\ y\ z\ \}\ \{\n\ \ \ \ \ \ set\ text\ \[.vwyz.\$\{lbl\}txt\ get\ 1.0\ end\ \]\n\ \ \ \ \ \ set\ text\ \[\ split\ \$text\ \\n\ \]\n\ \ \ \ \ \ set\ text\ \[\ join\ \$text\ \"\\\\n\"\ \]\n\ \ \ \ \ \ puts\ \$f\ \$text\n\ \ \ \ \}\n\ \ \ \ puts\ \$f\ \$::pc\n\ \ \ \ puts\ \$f\ \$::numdecs\n\ \ \ \ close\ \$f\n\ \ \}\n\ \ animatecard\ 1\n\ \ reloadlib\n\}\n\nproc\ runcard\ \{\ args\ \}\ \{\ \n\ \ set\ cardname\ \$::register(M)\n\ \ set\ ::register(M)\ 0.0\n\ \ pushstate\ \$cardname\n\}\n\nset\ ::animating\ 0\nproc\ animatecard\ \{\ \{\ reverse\ 0\ \}\ \}\ \{\n\ \ if\ \$::animating\ return\n\ \ set\ ::animating\ 1\n\ \ destroy\ .card\n\ \ if\ !\$::animation\ return\n\ \ set\ cardw\ \[\ image\ width\ card\ \]\n\ \ set\ cardh\ \[\ image\ height\ card\ \]\n\ \ toplevel\ .card\n\ \ wm\ overrideredirect\ .card\ 1\n\ \ canvas\ .card.c\ -width\ \$cardw\ -height\ \$cardh\n\ \ pack\ .card.c\n\ \ .card.c\ create\ image\ 0\ 0\ -image\ card\ -anchor\ nw\n\ \ update\n\ \ set\ leftsh\ \[=\ \{round(\$::dispw*0.6955)\}\]\n\ \ set\ bottomsh\ \[=\ \{round(\$::disph*0.031\ )\}\]\n\ \ set\ left\ \[=\ \{\[\ winfo\ rootx\ .top\ \]\ +\ \$leftsh\}\]\n\ \ set\ showlabels\ 0\n\ \ if\ \$reverse\ \{\n\ \ \ \ set\ bottom\ \[=\ \{\[winfo\ rooty\ .top.cdrdr\]\ +\ \$bottomsh\}\]\n\ \ \ \ set\ curh\ 1\n\ \ \ \ while\ \{\ \$curh\ <\ \$cardh\ \}\ \{\n\ \ \ \ \ \ wm\ geometry\ .card\ \$\{cardw\}x\$curh+\$left+\$bottom\n\ \ \ \ \ \ update\n\ \ \ \ \ \ incr\ curh\n\ \ \ \ \ \ incr\ bottom\ -1\n\ \ \ \ \}\n\ \ \}\ else\ \{\n\ \ \ \ set\ rooty\ \[winfo\ rooty\ .top.cdrdr\]\n\ \ \ \ set\ cardh\ \[winfo\ height\ .card\]\n\ \ \ \ set\ bottom\ \[=\ \{\$rooty-\$cardh+\$bottomsh\}\]\n\ \ \ \ set\ curh\ \$cardh\n\ \ \ \ while\ \{\ \$curh\ >\ 0\ \}\ \{\n\ \ \ \ \ \ wm\ geometry\ .card\ \$\{cardw\}x\$curh+\$left+\$bottom\n\ \ \ \ \ \ update\n\ \ \ \ \ \ incr\ curh\ -1\n\ \ \ \ \ \ incr\ bottom\n\ \ \ \ \}\n\ \ \}\n\ \ set\ ::animating\ 0\n\ \ destroy\ .card\n\ \ update\n\}\n\nproc\ loadprog\ \{\ \}\ \{\n\ \ foreach\ ins\ \$::program\ \{\n\ \ \ \ .prog.list.list\ insert\ end\ \$ins\n\ \ \}\n\}\n\nproc\ loadcard\ \{\ cardname\ \}\ \{\n\ \ set\ h\ \[winfo\ height\ .top\]\n\ \ set\ w\ \[winfo\ width\ .top\]\n\ \ if\ \$::recording\ \{\n\ \ \ \ insins\ \"\$cardname\ @\"\n\ \ \ \ return\n\ \ \}\n\ \ if\ \{\ \$cardname\ eq\ \"\"\ \}\ return\n\ \ set\ f\ \[\ open\ \$cardname\ r\ \]\n\ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ set\ ::program\ \[\ gets\ \$f\ \]\ \ \n\ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ R\}\ \{\n\ \ \ \ set\ ::register(\$reg)\ \[\ gets\ \$f\ \]\n\ \ \}\n\ \ foreach\ lbl\ \{\ v\ w\ y\ z\ \}\ \{\n\ \ \ \ .vwyz.\$\{lbl\}txt\ delete\ 1.0\ end\n\ \ \ \ eval\ set\ lbltxt\ \[\ gets\ \$f\ \]\n\ \ \ \ set\ lbltxt\ \[\ string\ trim\ \$lbltxt\ \]\n\ \ \ \ .vwyz.\$\{lbl\}txt\ insert\ end\ \$lbltxt\n\ \ \}\n\ \ updlbls\n\ \ set\ ::pc\ \[\ gets\ \$f\ \]\n\ \ set\ ::numdecs\ \[\ gets\ \$f\ \]\n\ \ close\ \$f\n\ \ .prog.list.list\ delete\ 0\ end\n\ \ loadprog\n\ \ renum\ .prog.list\n\ \ wm\ geometry\ .top\ \$\{w\}x\$h\n\ \ animatecard\n\}\n\nproc\ updlbls\ \{\ \}\ \{\n\ \ .top.face\ delete\ vwxylbls\n\ \ set\ y\ \[=\ \{round(\$::dispw*.72)\}\]\n\ \ foreach\ \{\ lbl\ offset\ \}\ \{\ v\ .720\ w\ .800\ y\ .880\ z\ .960\ \}\ \{\n\ \ \ \ set\ x\ \[=\ \{round(\$offset*\$::dispw)\}\]\n\ \ \ \ set\ lbltxt\ \[\ .vwyz.\$\{lbl\}txt\ get\ 1.0\ end\ \]\n\ \ \ \ if\ \{\ \$lbltxt\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ .top.face\ create\ text\ \$x\ \$y\ -fill\ black\ -font\ \$::lblfn\ \\\n\ \ \ \ \ \ \ \ -tags\ vwxylbls\ -anchor\ s\ -justify\ center\ -text\ \$lbltxt\n\ \ \ \ \}\n\ \ \}\n\ \ .top.face\ raise\ vwxylbls\n\}\n\nproc\ setpc\ \{\ instr\ \}\ \{\n\ \ set\ ::pc\ \[\ .prog.list.list\ curselection\ \]\n\}\n\nproc\ showprog\ \{\ args\ \}\ \{\n\ \ if\ \$::progshowing\ \{\n\ \ \ \ wm\ withdraw\ .prog\n\ \ \ \ set\ ::progshowing\ 0\n\ \ \ \ .top.showprog\ configure\ -text\ \"Show\\nProg\"\n\ \ \}\ else\ \{\n\ \ \ \ wm\ deiconify\ .prog\n\ \ \ \ set\ ::progshowing\ 1\n\ \ \ \ .top.showprog\ configure\ -text\ \"Hide\\nProg\"\n\ \ \}\n\}\n\nproc\ showlabels\ \{\ args\ \}\ \{\n\ \ if\ \$::labelshowing\ \{\n\ \ \ \ set\ ::labelshowing\ 0\n\ \ \ \ wm\ withdraw\ .vwyz\n\ \ \}\ else\ \{\n\ \ \ \ set\ ::labelshowing\ 1\n\ \ \ \ wm\ deiconify\ .vwyz\n\ \ \}\n\}\n\nproc\ pushregs\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ pushregs\ \;\ return\ \}\n\ \ set\ state\ \[\ list\ \\\n\ \ \ \ \$::register(B)\ \$::register(b)\ \$::register(C)\ \$::register(c)\ \\\n\ \ \ \ \$::register(D)\ \$::register(d)\ \$::register(E)\ \$::register(e)\ \\\n\ \ \ \ \$::register(F)\ \$::register(f)\ \]\n\ \ lappend\ ::regstack\ \$state\n\}\n\nproc\ pullregs\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ pullregs\ \;\ return\ \}\n\ \ if\ \{\ \$::regstack\ eq\ \{\}\ \}\ \{\ return\ 0\ \}\n\ \ set\ state\ \[lindex\ end\ \$::regstack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ foreach\ \[list\ \\\n\ \ \ \ ::register(B)\ ::register(b)\ ::register(C)\ ::register(c)\ \\\n\ \ \ \ ::register(D)\ ::register(d)\ ::register(E)\ ::register(e)\ \\\n\ \ \ \ ::register(F)\ ::register(f)\ \]\ \\\n\ \ \$state\ break\n\ \ return\ 1\n\}\n\n#\ push\ and\ pull\ save\ everything\ but\ registers\ AM&R,\ which\ can\n#\ be\ used\ to\ pass\ results\ back\ to\ a\ previous\ program\nproc\ pushstate\ \{\ newcard\ \}\ \{\n\ \ lappend\ ::stack\ \$::program\n\ \ lappend\ ::stack\ \$::pc\n\ \ pushregs\n\ \ loadcard\ \$newcard\n\}\n\nproc\ pullstate\ \{\ \}\ \{\n\ \ if\ \{\ \$::stack\ eq\ \{\}\ \}\ \{\ return\ 0\ \}\n\ \ set\ ::pc\ \[lindex\ end\ \$::stack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ set\ ::program\ \[lindex\ end-1\ \$::stack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ pullregs\n\ \ return\ 1\n\}\n\nproc\ showregs\ \{\ args\ \}\ \{\n\ \ if\ !\$::regssetup\ \{\n\ \ \ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ M\ R\ \}\ \{\n\ \ \ \ \ \ .regs.reglist.linecount\ insert\ end\ \$reg\n\ \ \ \ \ \ .regs.reglist.list\ insert\ end\ \$::register(\$reg)\n\ \ \ \ \ \ trace\ add\ variable\ ::register(\$reg)\ write\ updregs\n\ \ \ \ \}\n\ \ \ \ set\ ::regssetup\ 1\n\ \ \}\n\ \ if\ \$::regsshowing\ \{\n\ \ \ \ wm\ withdraw\ .regs\n\ \ \ \ set\ ::regsshowing\ 0\n\ \ \ \ .top.showregs\ configure\ -text\ \"Show\\nRegs\"\n\ \ \}\ else\ \{\n\ \ \ \ wm\ deiconify\ .regs\n\ \ \ \ set\ ::regsshowing\ 1\n\ \ \ \ .top.showregs\ configure\ -text\ \"Hide\\nRegs\"\n\ \ \}\n\}\n\nproc\ updregs\ \{\ args\ \}\ \{\n\ \ .regs.reglist.list\ delete\ 0\ end\n\ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ M\ R\ \}\ \{\n\ \ \ \ .regs.reglist.list\ insert\ end\ \$::register(\$reg)\n\ \ \}\n\}\n\nproc\ center\ \{\ w\ \{\ width\ 0\ \}\ \{\ height\ 0\ \}\ \}\ \{\n\ \ update\n\ \ if\ \{\ \$width\ ==\ 0\ \}\ \{\ set\ width\ \[winfo\ width\ \$w\]\ \}\n\ \ if\ \{\ \$height\ ==\ 0\ \}\ \{\ set\ height\ \[winfo\ height\ \$w\]\ \}\n\ \ set\ x\ \[=\ \{(\[winfo\ vrootwidth\ \ \$w\]\ -\ \$width\ \ )\ /\ 2\ \}\]\n\ \ set\ y\ \[=\ \{(\[winfo\ vrootheight\ \$w\]\ -\ \$height\ )\ /\ 2\ \}\]\n\ \ wm\ geometry\ \$w\ \$\{width\}x\$\{height\}+\$\{x\}+\$\{y\}\n\}\n\nproc\ showsplash\ \{\ \}\ \{\n\ \ destroy\ .splash\n\ \ toplevel\ .splash\n\ \ wm\ overrideredirect\ .splash\ 1\n\ \ canvas\ .splash.c\n\ \ pack\ .splash.c\ -side\ top\ -fill\ both\ -expand\ 1\n\ \ image\ create\ photo\ splash\ -file\ \$::runfrom/images/splash.gif\n\ \ .splash.c\ create\ image\ 0\ 0\ -image\ splash\ -anchor\ nw\n\ \ center\ .splash\ 600\ 655\n\ \ update\n\ \ after\ 3000\ \{\n\ \ \ \ destroy\ .splash\n\ \ \}\n\}\n\nproc\ buildvwyz\ \{\ \}\ \{\n\ \ destroy\ .vwyz\n\ \ toplevel\ .vwyz\n\ \ wm\ protocol\ .vwyz\ WM_DELETE_WINDOW\ showlabels\n\ \ wm\ withdraw\ .vwyz\n\ \ label\ .vwyz.title\ -text\ \"Labels:\"\ -font\ regfn\n\ \ grid\ .vwyz.title\ -row\ 0\ -column\ 0\ -columnspan\ 2\n\n\ \ label\ .vwyz.v\ -text\ \"V:\"\ -font\ regfn\n\ \ grid\ .vwyz.v\ -row\ 1\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.w\ -text\ \"W:\"\ -font\ regfn\n\ \ grid\ .vwyz.w\ -row\ 2\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.y\ -text\ \"Y:\"\ -font\ regfn\n\ \ grid\ .vwyz.y\ -row\ 3\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.z\ -text\ \"Z:\"\ -font\ regfn\n\ \ grid\ .vwyz.z\ -row\ 4\ \ -column\ 0\ -sticky\ news\n\n\ \ text\ .vwyz.vtxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.vtxt\ -row\ 1\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.wtxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.wtxt\ -row\ 2\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.ytxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.ytxt\ -row\ 3\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.ztxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.ztxt\ -row\ 4\ -column\ 1\ -sticky\ news\n\n\ \ button\ .vwyz.updlbls\ -font\ regfn\ -command\ updlbls\ \\\n\ \ \ \ -text\ \"Update\ Labels\"\n\ \ grid\ .vwyz.updlbls\ -row\ 5\ -column\ 0\ -columnspan\ 2\ -sticky\ ew\n\ \ update\n\}\n\nproc\ buildprog\ \{\ \}\ \{\n\ \ destroy\ .prog\n\ \ toplevel\ .prog\n\ \ wm\ protocol\ .prog\ WM_DELETE_WINDOW\ showprog\n\ \ wm\ withdraw\ .prog\n\ \ scrolledlistbox\ .prog.list\ 20\ 10\ \"\"\ setpc\n\ \ .prog.list.list\ insert\ end\ end\;\ renum\ .prog.list\n\ \ label\ .prog.label\ -text\ \"Program:\"\ -anchor\ w\n\ \ pack\ .prog.label\ .prog.list\n\ \ update\n\}\n\nproc\ buildregs\ \{\ \}\ \{\n\ \ destroy\ .regs\n\ \ toplevel\ .regs\n\ \ wm\ protocol\ .regs\ WM_DELETE_WINDOW\ showregs\n\ \ wm\ withdraw\ .regs\n\ \ scrolledlistbox\ .regs.reglist\ 20\ 13\ \"\"\ \"\"\n\ \ label\ .regs.label\ -text\ \"Registers:\"\ -anchor\ w\n\ \ pack\ .regs.label\ .regs.reglist\n\ \ update\n\}\n\nproc\ buildgui\ \{\ args\ \}\ \{\n\ \ global\ size\ dispw\ disph\n\ \ destroy\ .top\n\ \ toplevel\ .top\n\ \ wm\ protocol\ .top\ WM_DELETE_WINDOW\ \{\ off\ \}\n\ \ image\ create\ photo\ card\ -file\ \$::runfrom/images/p101card-\$\{size\}%.gif\n\ \ image\ create\ photo\ p101\ -file\ \$::runfrom/images/p101.gif\n\ \ image\ create\ photo\ cr\ -file\ \$::runfrom/images/cardreader-\$\{size\}%.gif\n\ \ image\ create\ photo\ 1xparentpx\ -file\ \$::runfrom/images/1xparentpx.gif\n\ \ image\ create\ photo\ p101face\ -file\ \$::runfrom/images/P101-\$\{size\}%.gif\n\ \ image\ create\ photo\ btnup\ -file\ \$::runfrom/images/P101-\$\{size\}%.gif\n\ \ #image\ create\ photo\ btndn\ \\\n\ \ \ \ -file\ \$::runfrom/images/P101-\$\{size\}%-dark.png\n\ \ set\ dispw\ \[\ image\ width\ p101face\ \]\n\ \ set\ disph\ \[\ image\ height\ p101face\ \]\n\ \ switch\ \$size\ \{\n\ \ \ \ 50\ \ \{\ setfonts\ 18\ 2\ 32\ 33\ 6\ 6\ 8\ 8\ 8\ 8\ 6\ \}\n\ \ \ \ 75\ \ \{\ setfonts\ 22\ 4\ 27\ 29\ 10\ 8\ 14\ 14\ 12\ 12\ 8\ \}\n\ \ \ \ 100\ \{\ setfonts\ 20\ 4\ 25\ 28\ 16\ 12\ 20\ 20\ 16\ 16\ 12\ \}\n\ \ \}\n\ \ update\n\ \ set\ btns\ \[\ list\ \\\n\ \ \ \ .top.about\ 0.0852\ 0.0\ 0.2335\ 0.1260\ \\\n\ \ \ \ .top.paperadv\ 0.01052\ 0.2087\ 0.0727\ 0.3930\ \\\n\ \ \ \ .top.prefs\ 0.0096\ 0.4715\ 0.0746\ 0.5556\ \\\n\ \ \ \ .top.reset\ 0.0096\ 0.5840\ 0.0746\ 0.6680\ \\\n\ \ \ \ .top.off\ 0.00956\ 0.6965\ 0.0746\ 0.7805\ \\\n\ \ \ \ .top.regF\ 0.0852\ 0.4580\ 0.1703\ 0.5704\ \\\n\ \ \ \ .top.regE\ 0.0852\ 0.5705\ 0.1703\ 0.6829\ \\\n\ \ \ \ .top.regD\ 0.0852\ 0.6830\ 0.1703\ 0.7953\ \\\n\ \ \ \ .top.regC\ 0.0852\ 0.7954\ 0.1703\ 0.9078\ \\\n\ \ \ \ .top.showlabels\ 0.0852\ 0.9079\ 0.1703\ 0.9986\ \\\n\ \ \ \ .top.up\ 0.1703\ 0.4580\ 0.3388\ 0.5704\ \\\n\ \ \ \ .top.regB\ 0.1703\ 0.6830\ 0.3388\ 0.7953\ \\\n\ \ \ \ .top.clear\ 0.1703\ 0.5705\ 0.3388\ 0.6829\ \\\n\ \ \ \ .top.reg/\ 0.1703\ 0.7954\ 0.3388\ 0.9078\ \\\n\ \ \ \ .top.showregs\ 0.1703\ 0.9079\ 0.2545\ 0.9986\ \\\n\ \ \ \ .top.showprog\ 0.2555\ 0.9079\ 0.3388\ 0.9986\ \\\n\ \ \ \ .top.num7\ 0.3426\ 0.4580\ 0.4230\ 0.5704\ \\\n\ \ \ \ .top.num4\ 0.3426\ 0.5705\ 0.4230\ 0.6829\ \\\n\ \ \ \ .top.num1\ 0.3426\ 0.6830\ 0.4230\ 0.7953\ \\\n\ \ \ \ .top.num0\ 0.3426\ 0.7954\ 0.4230\ 0.9078\ \\\n\ \ \ \ .top.pushregs\ 0.3426\ 0.9079\ 0.4230\ 0.9986\ \\\n\ \ \ \ .top.num8\ 0.4239\ 0.4580\ 0.5091\ 0.5704\ \\\n\ \ \ \ .top.num5\ 0.4239\ 0.5705\ 0.5091\ 0.6829\ \\\n\ \ \ \ .top.num2\ 0.4239\ 0.6830\ 0.5091\ 0.7953\ \\\n\ \ \ \ .top.num!\ 0.4239\ 0.7954\ 0.5091\ 0.9078\ \\\n\ \ \ \ .top.pullregs\ 0.4239\ 0.9097\ 0.5091\ 0.9986\ \\\n\ \ \ \ .top.num9\ 0.5100\ 0.4580\ 0.5943\ 0.5704\ \\\n\ \ \ \ .top.num6\ 0.5100\ 0.5705\ 0.5943\ 0.6929\ \\\n\ \ \ \ .top.num3\ 0.5100\ 0.6830\ 0.5943\ 0.7953\ \\\n\ \ \ \ .top.num-\ 0.5100\ 0.7954\ 0.5943\ 0.9078\ \\\n\ \ \ \ .top.proglib\ 0.5100\ 0.9097\ 0.5942\ 0.9986\ \\\n\ \ \ \ .top.start\ 0.5962\ 0.4580\ 0.6804\ 0.9078\ \\\n\ \ \ \ .top.savecard\ 0.5962\ 0.9097\ 0.6804\ 0.9986\ \\\n\ \ \ \ .top.recprog\ 0.6813\ 0.35\ 0.839\ 0.41\ \\\n\ \ \ \ .top.down\ 0.6813\ 0.4580\ 0.8402\ 0.5704\ \\\n\ \ \ \ .top.minus\ 0.6813\ 0.5705\ 0.7590\ 0.6929\ \\\n\ \ \ \ .top.plus\ 0.6813\ 0.6830\ 0.7590\ 0.7953\ \\\n\ \ \ \ .top.v\ 0.6813\ 0.7954\ 0.7664\ 0.8550\ \\\n\ \ \ \ .top.times\ 0.7608\ 0.5705\ 0.8402\ 0.6929\ \\\n\ \ \ \ .top.divide\ 0.7608\ 0.6830\ 0.8402\ 0.7953\ \\\n\ \ \ \ .top.w\ 0.7608\ 0.7954\ 0.9262\ 0.8564\ \\\n\ \ \ \ .top.prprog\ 0.8411\ 0.35\ 0.999\ 0.41\ \\\n\ \ \ \ .top.swap\ 0.8411\ 0.4580\ 0.9196\ 0.8550\ \\\n\ \ \ \ .top.regA\ 0.8411\ 0.5705\ 0.9196\ 0.6929\ \\\n\ \ \ \ .top.regR\ 0.8411\ 0.6830\ 0.9196\ 0.7953\ \\\n\ \ \ \ .top.y\ 0.8411\ 0.7954\ 0.9196\ 0.8564\ \\\n\ \ \ \ .top.sqrt\ 0.9206\ 0.4580\ 0.9990\ 0.8550\ \\\n\ \ \ \ .top.prreg\ 0.9206\ 0.5705\ 0.9990\ 0.6929\ \\\n\ \ \ \ .top.zero\ 0.9206\ 0.6830\ 0.9990\ 0.7953\ \\\n\ \ \ \ .top.z\ 0.9206\ 0.7954\ 0.9990\ .8580\ \\\n\ \ \ \ .top.papersav\ 0.0105\ 0.1463\ 0.0727\ 0.2073\ \\\n\ \ \ \ .top.paperclr\ 0.0105\ 0.3957\ 0.0727\ 0.4566\ \\\n\ \ \ \ .top.backsp\ 0.5962\ 0.25\ 0.6804\ 0.455\ \\\n\ \ \]\n\ \ canvas\ .top.face\ -width\ \$dispw\ -height\ \$disph\n\ \ .top.face\ create\ image\ 0\ 0\ -image\ p101face\ -anchor\ nw\n\ \ place\ .top.face\ -x\ 0\ -y\ 0\n\ \ update\n\ \ center\ .top\ \$dispw\ \$disph\n\ \ set\ ::btnlist\ \{\}\n\ \ foreach\ \{\ name\ l\ t\ r\ b\ \}\ \$btns\ \{\n\ \ \ \ set\ l\ \[=\ \{round(\$l*\$::dispw)\}\]\n\ \ \ \ set\ t\ \[=\ \{round(\$t*\$::disph)\}\]\n\ \ \ \ set\ r\ \[=\ \{round(\$r*\$::dispw)\}\]\n\ \ \ \ set\ b\ \[=\ \{round(\$b*\$::disph)\}\]\n\ \ \ \ image\ create\ photo\ face\$name\n\ \ \ \ face\$name\ copy\ btnup\ -from\ \$l\ \$t\ \$r\ \$b\n\ \ \ \ set\ cmd\ \[\ list\ set\ ::curbtn\ \$name\ \]\n\ \ \ \ set\ code\ \[\ string\ range\ \[\ file\ extension\ \$name\ \]\ 1\ end\ \]\n\ \ \ \ button\ \$name\ -image\ face\$name\ -command\ \[list\ set\ ::curbtn\ \$code\]\ \\\n\ \ \ \ \ \ -bd\ 0\ -highlightthickness\ 0\ -activebackground\ #0000ff\n\ \ \ \ place\ \$name\ -x\ \$l\ -y\ \$t\ \n\ \ \ \ \ \ \ \ raise\ \$name\n\ \ \ \ if\ \{\ (\$name\ ne\ \".top.clear\")\ &&\ (\$name\ ne\ \".top.reset\")\ \}\ \{\n\ \ \ \ \ \ lappend\ ::btnlist\ \$name\n\ \ \ \ \}\n\ \ \}\n\ \ #\ printarea\n\ \ foreach\ \{\ l\ t\ r\ b\ \}\ \{\ 0.0852\ 0.127\ 0.67\ 0.29\ \}\ break\n\ \ scrolledtextarea\ .top.printarea\ \$l\ \$t\ \$r\ \$b\n\ \ #\ buffer\n\ \ foreach\ \{\ x\ y\ \}\ \{\ 0.0855\ 0.390\ \}\ break\n\ \ frame\ .top.buffer\ -bd\ 2\n\ \ place\ .top.buffer\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ entry\ .top.buffer.entry\ -font\ \$::txtfn\ -textvariable\ ::buffer\ -width\ \$::bufwidth\n\ \ pack\ .top.buffer.entry\ -fill\ both\n\ \ #\ cardlist\n\ \ foreach\ \{\ x\ y\ \}\ \{\ .6813\ .125\ \}\ break\n\ \ scrolledlistbox\ .top.cardlist\ \$::brwidth\ \$::brheight\ \"\"\ loadcard\ \$::brfn\n\ \ place\ .top.cardlist\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ card\ reader\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ 0\ 0\ .681\ .2735\ \}\ break\n\ \ label\ .top.cdrdr\ -image\ cr\ -anchor\ nw\ -bd\ 0\n\ \ place\ .top.cdrdr\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ green\ light\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ .18\ .06\ .6825\ .01\ \}\ break\n\ \ if\ \{\ \$::size\ ==\ 50\ \}\ \{\ set\ w\ .18\ \}\n\ \ label\ .top.green\ -bg\ \$::dkgreen\ -anchor\ center\ \ -image\ 1xparentpx\ \\\n\ \ \ \ -width\ \[=\ \{round(\$dispw*\$w)\}\]\ -height\ \[=\ \{round(\$disph*\$h)\}\]\ -bd\ 10\ \\\n\ \ \ \ -relief\ raised\n\ \ place\ .top.green\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ red\ light\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ .07\ .06\ .9\ .01\ \}\ break\n\ \ label\ .top.red\ -bg\ \$::dkred\ -anchor\ center\ -image\ 1xparentpx\ \\\n\ \ \ \ -width\ \[=\ \{round(\$dispw*\$w)\}\]\ -height\ \[=\ \{round(\$disph*\$h)\}\]\ -bd\ 10\ \\\n\ \ \ \ -relief\ raised\n\ \ place\ .top.red\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ decimal\ wheel\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ 2\ 1\ .018\ .8821\ \}\ break\n\ \ spinbox\ .top.decset\ -from\ 0\ -to\ 15\ -wrap\ 1\ -font\ \$::spfn\ \\\n\ \ \ \ -width\ 2\ -command\ setdec\ -textvariable\ numdecs\n\ \ place\ .top.decset\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\n\ \ if\ \$::needreset\ \{\n\ \ \ \ set\ ::needreset\ 0\n\ \ \ \ buildregs\n\ \ \ \ buildvwyz\n\ \ \ \ buildprog\n\ \ \ \ reset\ 1\n\ \ \}\ else\ \{\n\ \ \ \ loadprog\n\ \ \}\n\ \ reloadlib\n\ \ update\n\}\n\nproc\ setsize\ \{\ \{size\ 0\ \}\ \}\ \{\n\ \ if\ \{\ \$size\ ==\ 0\ \}\ \{\n\ \ \ \ destroy\ .size\n\ \ \ \ toplevel\ .size\n\ \ \ \ label\ .size.msg\ -text\ \"Simulator\ Display\ Size?\"\n\ \ \ \ grid\ .size.msg\ -row\ 0\ -column\ 0\ -columnspan\ 4\n\ \ \ \ button\ .size.100\ -text\ \"100%\"\ -command\ \{\ setsize\ 100\ \}\n\ \ \ \ grid\ .size.100\ -row\ 1\ -column\ 0\n\ \ \ \ button\ .size.75\ -text\ \"75%\"\ -command\ \{\ setsize\ 75\ \}\n\ \ \ \ grid\ .size.75\ -row\ 1\ -column\ 1\n\ \ \ \ button\ .size.50\ -text\ \"50%\"\ -command\ \{\ setsize\ 50\ \}\n\ \ \ \ grid\ .size.50\ -row\ 1\ -column\ 2\n\ \ \ \ button\ .size.cancel\ -text\ \"Exit\"\ -command\ exit\n\ \ \ \ grid\ .size.cancel\ -row\ 1\ -column\ 3\n\ \ \ \ center\ .size\n\ \ \ \ \ \ \ \ after\ 1000\ \{\ wm\ deiconify\ .size\ \}\n\ \ \}\ else\ \{\n\ \ \ \ destroy\ .size\n\ \ \ \ set\ ::size\ \$size\n\ \ \}\n\}\n\n#\ initialize\npackage\ require\ Tk\nwm\ withdraw\ .\n#set\ runfrom\ .\nset\ runfrom\ p101.exe\nset\ manpdf\ \$::runfrom/olpro101.pdf\ \ninterp\ alias\ \{\}\ =\ \{\}\ expr\nencoding\ system\ utf-8\nset\ dkgreen\ #179fa2\nset\ brgreen\ #879fa2\nset\ dkred\ #880000\nset\ brred\ #ff0000\nset\ btnlist\ \{\}\nset\ program\ \{\}\nset\ stack\ \{\}\nset\ regstack\ \{\}\narray\ set\ op2cmd\ \{\n\ \ \\u2193\ down\n\ \ \\u2191\ up\n\ \ \\u2195\ swap\n\ \ \\u221a\ sqrt\n\ \ \\u2014\ minus\n\ \ \\u00d7\ times\n\ \ +\ \ \ \ \ \ plus\n\ \ \\u00f7\ divide\n\ \ *\ \ \ \ \ \ zero\n\ \ \\u25c7\ prreg\n\ \ S\ \ \ \ \ \ start\n\ \ /\ \ \ \ \ \ split\n\ \ @\ \ \ \ \ \ runcard\n\ \ (\ \ \ \ \ \ pushregs\n\ \ )\ \ \ \ \ \ pullregs\n\}\narray\ set\ cmd2op\ \{\n\ \ down\ \ \ \ \ \\u2193\n\ \ up\ \ \ \ \ \ \ \\u2191\n\ \ swap\ \ \ \ \ \\u2195\n\ \ sqrt\ \ \ \ \ \\u221a\n\ \ minus\ \ \ \ \\u2014\n\ \ times\ \ \ \ \\u00d7\n\ \ plus\ \ \ \ \ +\n\ \ divide\ \ \ \\u00f7\n\ \ zero\ \ \ \ \ *\n\ \ prreg\ \ \ \ \\u25c7\n\ \ start\ \ \ \ S\n\ \ split\ \ \ \ /\n\ \ runcard\ \ @\n\ \ pushregs\ (\n\ \ pullregs\ )\n\}\nset\ uselog\ 1\nset\ logopen\ 0\nset\ logfile\ \"\"\nset\ recording\ 0\nset\ curpage\ 0\nset\ animation\ 1\nset\ interactive\ 1\nset\ greenon\ 0\narray\ set\ jumps\ \{\n\ \ \"\ V\"\ AV\n\ \ \"\ W\"\ AW\n\ \ \"\ Y\"\ AY\n\ \ \"\ Z\"\ AZ\n\ \ MV\ AV\n\ \ MW\ AW\n\ \ MY\ AY\n\ \ MZ\ AZ\n\ \ CW\ BW\n\ \ CY\ BY\n\ \ CZ\ BZ\n\ \ DV\ EV\n\ \ DW\ EW\n\ \ DY\ EY\n\ \ DZ\ EZ\n\ \ RV\ FV\n\ \ RW\ FW\n\ \ RY\ FY\n\ \ RZ\ FZ\n\ \ /V\ aV\n\ \ /W\ aW\n\ \ /Y\ aY\n\ \ /Z\ aZ\n\ \ cV\ bV\n\ \ cW\ bW\n\ \ cY\ bY\n\ \ cZ\ bZ\n\ \ dV\ eV\n\ \ dW\ eW\n\ \ dY\ eY\n\ \ dZ\ eZ\n\ \ rV\ fV\n\ \ rW\ fW\n\ \ rY\ fY\n\ \ rZ\ fZ\n\}\nset\ immediate\ \[\ list\ recprog\ prprog\ prefs\ reset\ off\ clear\ start\ \\\n\ \ papersav\ paperclr\ showlabels\ showregs\ showprog\ pushregs\ pullregs\ \\\n\ \ proglib\ savecard\ about\ backsp\ \]\nset\ havedec\ 0\nset\ progshowing\ 0\nset\ progshowing\ 0\nset\ labelshowing\ 0\nset\ regsshowing\ 0\nset\ regssetup\ 0\nset\ regsshowing\ 0\nuptodate\ \[info\ script\]\ \[file\ mtime\ \[info\ script\]\]\nset\ numdecs\ 4\;\ setdec\nset\ curbtn\ \"\"\ntrace\ add\ variable\ size\ write\ buildgui\nset\ needreset\ 1\nset\ library\ .\nshowsplash\nafter\ 2000\nsetsize\ncmdloop\n======\n\n<<categories>>\ Retrocomputing|Simulator regexp2} CALL {my render { Olivetti Programma 101 Simulator } My\ first\ computer\ was\ an\ Olivetti\ Programma\ 101\ owned\ by\ my\ high\ school,\ and\ I\ spent\ many\ hours\ learning\ how\ to\ program\ using\ it.\ As\ chance\ would\ have\ it,\ it\ was\ also\ the\ first\ computer\ my\ wife\ worked\ with\ as\ well\ -\ though\ she\ only\ got\ a\ few\ hours.\ At\ any\ rate,\ I\ wrote\ this\ for\ my\ wife's\ birthday.\ Those\ of\ you\ who\ have\ also\ used\ this\ machine\ will\ recognize\ it\ immediately.\n\nThis\ program\ is\ not\ typical\ Tcl.\ Because\ our\ current\ computers\ have\ quite\ different\ screen\ resolutions,\ I\ needed\ to\ make\ it\ resizable,\ at\ least\ to\ ''some''\ extent.\ So\ I\ came\ up\ with\ a\ system\ to\ generate\ a\ display\ from\ a\ bitmap,\ and\ widgets\ are\ located\ by\ decimal\ places\ -\ .5\ would\ be\ 50%\ of\ the\ way\ from\ the\ left\ side,\ and\ so\ on.\ It\ also\ extracts\ the\ actual\ button\ label\ from\ that\ portion\ of\ the\ image,\ so\ I\ don't\ need\ to\ specify\ it\ separately.\n\nThis\ program\ has\ been\ lightly\ tested,\ but\ there\ are\ probably\ still\ bugs.\ The\ worst\ I've\ dealt\ with\ are\ actually\ edit\ errors\ that\ moved\ widgets\ to\ West\ Succotash,\ Iowa\ or\ someplace\ because\ I\ dinged\ the\ table\ of\ widget\ placement\ data.\ Hopefully,\ this\ version\ straightens\ out\ all\ of\ that.\ It\ should\ also\ be\ noted\ there\ are\ quite\ a\ few\ new\ features\ added\ to\ the\ architecture\ to\ make\ it\ a\ little\ less\ painful\ to\ program,\ including\ editing\ of\ programs\ (if\ you\ made\ a\ mistake\ in\ entering\ the\ current\ instruction\ you\ could\ CLEAR\ and\ re-enter\ it,\ but\ if\ you\ don't\ notice\ the\ error\ right\ away\ and\ spot\ it\ scrolling\ up\ while\ you\ are\ entering\ a\ different\ command,\ well,\ you\ ''lose''\ and\ you\ have\ to\ re-enter\ the\ whole\ program\ all\ over\ again).\ Also,\ the\ blue\ buttons\ represent\ various\ extended\ functions\ allowing\ you\ to\ display\ the\ registers,\ edit\ the\ labels,\ and\ so\ on,\ and\ I\ also\ added\ the\ \"rub\ out\"\ button\ and\ the\ keyboard\ buffer\ display.\ You\ just\ had\ to\ remember\ what\ digits\ you\ keyed\ in\ with\ the\ actual\ hardware.\n\nAside\ from\ these\ additions\ the\ layout\ exactly\ follows\ the\ original\ except\ for\ moving\ the\ decimal\ wheel\ from\ the\ right\ to\ the\ left.\n\nThe\ variable\ \"runfrom\"\ can\ be\ set\ to\ \".\"\ or\ to\ \"p101.exe\"\ according\ to\ whether\ it\ is\ run\ as\ a\ script\ or\ as\ a\ tclkit.\ In\ either\ case,\ it\ needs\ a\ companion\ \"images\"\ directory\ with\ the\ following\ contents:\n\nThe\ program\ is\ below,\ but\ it\ needs\ a\ variety\ of\ images\ and\ so\ forth.\ I\ tried\ to\ upload\ those\ and\ got\ complaints\ about\ an\ image\ format\ not\ being\ text/wikit\ format.\ It\ would\ be\ easiest\ to\ just\ upload\ the\ p101.vfs\ as\ a\ zip\ file.\ If\ someone\ can\ help\ me\ circumvent\ these\ issues?\n\n\[CMcC\]\ Could\ you\ please\ elaborate\ on\ \"No\ .exe,\ no\ .zip,\ and\ no\ .gif\ either\ since\ I\ somehow\ changed\ the\ type\ of\ the\ file,\ whatever\ THAT\ means\"\ ?\n\nThe\ wiki\ refuses\ to\ upload\ .exe\ and\ .zip\ files.\ Likely\ this\ is\ not\ a\ bug\ but\ a\ security\ feature,\ either\ one\ may\ host\ malware.\ \nOkay,\ re-reading\ the\ image\ upload\ and\ doing\ it\ the\ correct\ way\ seems\ to\ work\ -\ although\ I\ find\ the\ method\ counter-intuitive\ in\ the\ extreme\ -\ but\ when\ I\ uploaded\ a\ .ico\ file\ it\ was\ still\ assigned\ a\ page\ number\ and\ the\ .htm\ extension,\ and\ when\ I\ did\ \"save\ Link\"\ and\ renamed\ it\ back\ to\ .ico,\ it\ didn't\ work.\ Likely\ not\ 8-bit\ clean\ somewhere\ in\ the\ loop.\n======\n\nNow,\ after\ some\ thought,\ I\ expect\ this\ is\ because\ it\ is\ assuming\ that\ the\ upload\ file\ ''replaces''\ the\ original\ wiki\ page,\ and\ it\ won't\ do\ that.\ \ Again,\ probably\ a\ a\ feature\ rather\ than\ a\ bug.\ It\ leaves\ me\ not\ knowing\ how\ to\ upload\ an\ image\ as\ such\ under\ its\ own\ name\ and\ type.\n\nSecondly,\ consider\ using\ the\ \[Half\ Bakery\]\ for\ uploading\ your\ code.\ \ I\ think\ the\ basic\ problem\ here\ is\ that\ you're\ uploading\ a\ package\ which\ could\ be\ modelled\ as\ a\ collection\ containing\ several\ components,\ and\ wiki\ generally\ doesn't\ really\ lend\ itself\ to\ a\ hierarchy\ by\ inclusion.\n\nI\ hadn't\ thought\ of\ the\ Half\ Bakery\ as\ a\ release\ mechanism.\ I'll\ look\ into\ that.\n<sigh>I\ don't\ see\ how\ to\ upload\ here,\ either.\ Uploading\ a\ .zip\ or\ a\ .tgz\ add\ the\ archive\ name\ preceded\ by\ an\ 'x'\ link,\ but\ it\ doesn't\ seem\ to\ have\ actually\ added\ it\ to\ the\ repository\ and\ pressing\ the\ x\ just\ seems\ to\ delete\ it.</sigh>\ I\ really\ agree\ with\ \[uniquename\],\ a\ simply\ upload\ button\ would\ require\ far\ less\ explanation\ or\ documentation.\ It\ reminds\ me\ of\ the\ whole\ \"how\ come\ Tcl\ barfs\ when\ it\ sees\ 09?\"\ controversy.\n\n======\npackage\ provide\ app-p101\ 1.0\n#\ set\ runfrom\ p101.exe\nset\ runfrom\ .\n\nproc\ setfonts\ \{\ brw\ brh\ bufw\ dispch\ spfnsz\ brfnsz\ \\\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ txtfnsz\ HLfnsz\ abtfnsz\ regfnsz\ lblfnsz\ \\\n\}\ \{\n\ \ set\ ::brheight\ \$brh\n\ \ set\ ::brwidth\ \$brw\n\ \ set\ ::bufwidth\ \$bufw\n\ \ set\ ::dispch\ \$dispch\n\ \ set\ ::spfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$spfnsz\ \]\n\ \ set\ ::brfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$brfnsz\ \]\n\ \ set\ ::txtfn\ \[\ font\ create\ -family\ courier\ -weight\ bold\ -size\ \$txtfnsz\ \]\n\ \ set\ ::HLfn\ \[\ font\ create\ -family\ tahoma\ -weight\ bold\ -size\ \$HLfnsz\ \]\n\ \ set\ ::abtfn\ \[\ font\ create\ -family\ tahoma\ -weight\ normal\ -size\ \$abtfnsz\ \]\n\ \ set\ ::regfn\ \[\ font\ create\ -family\ tahoma\ -size\ \$regfnsz\ \]\n\ \ set\ ::lblfn\ \[\ font\ create\ -family\ tahoma\ -weight\ normal\ -size\ \$lblfnsz\ \]\n\}\n\nproc\ log\ \{\ msg\ \}\ \{\n\ \ if\ !\$::uselog\ return\n\ \ if\ !\$::logopen\ \{\n\ \ \ \ if\ \{\ \[\ catch\ \{\n\ \ \ \ \ \ set\ ::logfile\ \[\ open\ ./logfile.txt\ w\ \]\n\ \ \ \ \ \ set\ ::logopen\ 1\n\ \ \ \ \}\ error\ \]\ !=\ 0\ \}\ \{\n\ \ \ \ \ \ set\ ::uselog\ 0\n\ \ \ \ \}\n\ \ \}\n\ \ puts\ \$::logfile\ \$msg\n\ \ flush\ \$::logfile\n\}\n\nproc\ announce\ \{\ msg\ \}\ \{\n\ \ tk_messageBox\ -parent\ .top\ -title\ \"Info\"\ \\\n\ \ \ \ -icon\ info\ -type\ ok\ -message\ \$msg\n\}\n\nproc\ reset\ \{\ \{\ override\ 0\ \}\ \}\ \{\n\ \ if\ !\$override\ \{\n\ \ \ \ if\ \{\[tk_messageBox\ -parent\ .\ -title\ \"Are\ you\ sure?\"\ \\\n\ \ \ \ \ \ \ \ \ \ \ -icon\ question\ -type\ yesno\ -default\ no\ \\\n\ \ \ \ \ \ \ \ \ \ \ -message\ \"Reset\ P101\ Simulator?\"\]\ ne\ \"yes\"\n\ \ \ \ \}\ \{\n\ \ \ \ \ \ return\n\ \ \ \ \}\n\ \ \}\n\ \ .top.printarea.text\ delete\ 0.0\ end\n\ \ .prog.list.list\ delete\ 0\ end\n\ \ .prog.list.list\ insert\ end\ \"end\"\ \;\ renum\ .prog.list\n\ \ set\ ::pc\ 0\n\ \ set\ ::reg\ \"\"\n\ \ set\ ::confirm\ 0\n\ \ set\ ::entering\ 0\n\ \ set\ ::recording\ 0\n\ \ set\ ::interactive\ 1\n\ \ set\ ::register(A)\ 0.0\n\ \ set\ ::register(B)\ 0.0\n\ \ set\ ::register(b)\ 0.0\n\ \ set\ ::register(C)\ 0.0\n\ \ set\ ::register(c)\ 0.0\n\ \ set\ ::register(D)\ 0.0\n\ \ set\ ::register(d)\ 0.0\n\ \ set\ ::register(E)\ 0.0\n\ \ set\ ::register(e)\ 0.0\n\ \ set\ ::register(F)\ 0.0\n\ \ set\ ::register(f)\ 0.0\n\ \ set\ ::register(R)\ 0.0\n\ \ set\ ::register(M)\ 0.0\n\ \ set\ stack\ \{\}\n\ \ set\ regstack\ \{\}\n\ \ .top.red\ configure\ -bg\ \$::dkred\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ normal\ \}\n\ \ .top.face\ delete\ vwyzlbl\n\ \ updlbls\n\}\n\nproc\ down\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \$::register(\$reg)\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2193\n\}\n\nproc\ up\ \{\ reg\ \}\ \{\n\ \ set\ ::register(\$reg)\ \$::register(M)\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2191\n\}\n\nproc\ swap\ \{\ reg\ \}\ \{\n\ \ if\ \{\ \$reg\ eq\ \"/\"\ \}\ \{\n\ \ \ \ \ \ set\ A\ \$::register(A)\n\ \ \ \ \ \ set\ ::register(M)\ \[=\ \{\$A-entier(\$A)\}\ \]\n\ \ \ \ \ \ interactive\ \$::register(M)\ /\ \\u2195\n\ \ \ \ return\n\ \ \}\n\ \ if\ \{\ \$reg\ eq\ \"A\"\ \}\ \{\ \n\ \ \ \ set\ ::register(A)\ \[=\ \{abs(\$::register(A))\}\]\n\ \ \}\ else\ \{\n\ \ \ \ set\ temp\ \$::register(A)\n\ \ \ \ set\ ::register(A)\ \$::register(\$reg)\n\ \ \ \ set\ ::register(\$reg)\ \$temp\n\ \ \}\n\ \ interactive\ \$::register(\$reg)\ \$reg\ \\u2195\n\}\n\nproc\ sqrt\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{sqrt(\$::register(\$reg))\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ \\u221a\n\}\n\nproc\ minus\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ -\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ -\n\}\n\nproc\ times\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ *\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ \\u00d7\n\}\n\nproc\ plus\ \{\ reg\ \}\ \{\n\ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ +\ \$::register(\$reg)\}\]\n\ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ interactive\ \$::register(A)\ \$reg\ +\n\}\n\nproc\ divide\ \{\ reg\ \}\ \{\n\ \ set\ A\ \[=\ \{entier(\$::register(A))\}\]\n\ \ if\ \{\[\ string\ first\ \".\"\ \$::register(A)\ \]\ ==\ -1\ \}\ \{\n\ \ \ \ set\ ::register(A)\ \$::register(A).0\n\ \ \}\n\ \ if\ \{\ 0\ !=\ \[\ catch\ \{\n\ \ \ \ set\ ::register(A)\ \[=\ \{\$::register(A)\ /\ \$::register(\$reg)\}\]\n\ \ \ \ set\ ::register(R)\ 0\n\ \ \ \ set\ R\ \[=\ \{entier(\$::register(\$reg))\}\]\n\ \ \ \ set\ ::register(R)\ \[=\ \{\$A\ %\ \$R\}\]\n\ \ \ \ set\ ::register(M)\ \$::register(\$reg)\n\ \ \ \ interactive\ \$::register(A)\ \$reg\ \\u00f7\n\ \ \}\ \]\ \}\ \{\ redlight\ -1.0\ \}\n\}\n\nproc\ zero\ \{\ reg\ \}\ \{\n\ \ set\ ::register(\$reg)\ 0\n\ \ interactive\ \$::register(\$reg)\ \$\{reg\}\ *\n\}\n\nproc\ prreg\ \{\ reg\ \}\ \{\n\ \ type\ \$::register(\$reg)\ \$\{reg\}\\u25c7\n\}\n\nproc\ renum\ \{\ w\ \}\ \{\n\ \ \$w.linecount\ delete\ 0\ end\n\ \ set\ maxj\ \[\ \$w.list\ index\ end\ \]\n\ \ for\ \{\ set\ j\ 0\ \}\ \{\ \$j\ <\ \$maxj\ \}\ \{\ incr\ j\ \}\ \{\n\ \ \ \ \$w.linecount\ insert\ end\ \$j\n\ \ \}\n\}\n\nproc\ insins\ \{\ instr\ \}\ \{\n\ \ .prog.list.list\ insert\ \$::pc\ \"\$instr\"\n\ \ type\ \"\$::pc:\ \$instr\"\n\ \ renum\ .prog.list\n\}\n\nproc\ delins\ \{\ \}\ \{\n\ \ if\ \{\ \[\ .prog.list.list\ get\ \$::pc\ \]\ eq\ \"end\"\ \}\ return\n\ \ .prog.list.list\ delete\ \$::pc\ \$::pc\n\ \ renum\ .prog.list\n\}\n\nproc\ clear\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\n\ \ \ \ delins\n\ \ \ \ return\n\ \ \}\n\ \ .top.red\ configure\ -bg\ \$::dkred\n\ \ .top.buffer.entry\ delete\ 0\ end\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ normal\ \}\n\}\n\nproc\ recprog\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\n\ \ \ \ set\ ::recording\ 0\n\ \ \ \ .top.recprog\ configure\ -relief\ raised\n\ \ \ \ type\ \"...end\"\n\ \ \ \ return\n\ \ \}\n\ \ type\ \"Begin...\"\n\ \ set\ ::recording\ 1\n\ \ .top.recprog\ configure\ -relief\ sunken\n\ \ .top.buffer.entry\ delete\ 0\ end\n\}\n\nproc\ prprog\ \{\ \}\ \{\n\ \ type\ \"Listing...\"\n\ \ set\ maxj\ \[\ .prog.list.list\ index\ end\ \]\n\ \ for\ \{\ set\ j\ 0\ \}\ \{\ \$j\ <\ \$maxj\ \}\ \{\ incr\ j\ \}\ \{\n\ \ \ \ set\ ins\ \[\ .prog.list.list\ get\ \$j\ \]\n\ \ \ \ type\ \"\$j:\ \$ins\"\n\ \ \}\n\ \ type\ \"...end\"\n\}\n\nproc\ paperadv\ \{\ \}\ \{\ type\ \"\"\ \}\nproc\ paperclr\ \{\ \}\ \{\n\ \ .top.printarea.text\ delete\ 1.0\ end\n\ \ set\ ::value\ \"\"\n\}\nproc\ papersav\ \{\ \}\ \{\n\ \ set\ tapename\ \[\ tk_getSaveFile\ -defaultextension\ .txt\ \\\n\ \ \ \ -initialdir\ .\ -parent\ .top\ -title\ \"Save\ Paper\ Tape...\"\ \]\n\ \ if\ \{\ \$tapename\ ne\ \"\"\ \}\ \{\n\ \ \ \ set\ f\ \[\ open\ \$tapename\ w\ \]\n\ \ \ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ \ \ set\ tape\ \[\ .top.printarea.text\ get\ 1.0\ end\ \]\n\ \ \ \ puts\ \$f\ \$tape\n\ \ \ \ close\ \$f\n\ \ \}\n\}\n\nproc\ page\ \{\ number\ \}\ \{\n\ \ if\ \{\ \$::curpage\ !=\ 0\ \}\ \{\n\ \ \ \ grid\ forget\ .top.about.pg\$\{::curpage\}txt\n\ \ \ \ .top.about.pg\$\{::curpage\}\ configure\ -relief\ groove\n\ \ \}\n\ \ set\ ::curpage\ \$number\n\ \ grid\ .top.about.pg\$\{number\}txt\ -row\ 3\ -column\ 0\ -columnspan\ 6\ -rowspan\ 20\ -sticky\ news\n\ \ .top.about.pg\$\{::curpage\}\ configure\ -relief\ solid\n\}\n\nproc\ manual\ \{\ \}\ \{\n\ \ set\ savename\ \[\ tk_getSaveFile\ -defaultextension\ pdf\ \\\n\ \ \ \ -initialfile\ olpro101.pdf\ \\\n\ \ \ \ -parent\ .top\ -title\ \"Save\ Manual\ To...\"\ \]\n\ \ if\ \{\ \$savename\ ne\ \"\"\ \}\ \{\n\ \ \ \ file\ copy\ -force\ \$::manpdf\ \$savename\n\ \ \}\n\}\n\nproc\ prefs\ \{\ \}\ \{\n\ \ destroy\ .top.options\n\ \ toplevel\ .top.options\n\ \ label\ .top.options.title\ -text\ \"PROGRAMMA-101\\nSIMULATOR\ OPTIONS\"\n\ \ grid\ .top.options.title\ -row\ 0\ -column\ 0\ -columnspan\ 2\n\ \ checkbutton\ .top.options.animation\ \\\n\ \ \ \ -variable\ ::animation\ -text\ \"Card\ Animation\"\n\ \ grid\ .top.options.animation\ -row\ 1\ -column\ 0\n\ \ button\ .top.options.close\ -text\ \"Close\ Options\"\ -command\ \{\n\ \ \ \ destroy\ .top.options\ \n\ \ \}\n\ \ button\ .top.options.manual\ -text\ \"Save\ Manual\"\ -command\ manual\n\ \ grid\ .top.options.manual\ -row\ 2\ -column\ 0\n\ \ grid\ .top.options.close\ -row\ 3\ -column\ 0\ -columnspan\ 2\n\}\n\nproc\ about\ \{\ \}\ \{\n\ \ set\ tabs\ \\t\n\ \ if\ \{\ \$::size\ ==\ 100\ \}\ \{\ set\ tabs\ \\t\\t\ \}\n\ \ destroy\ .top.about\n\ \ toplevel\ .top.about\n\ \ label\ .top.about.title\ -text\ \"OLIVETTI-UNDERWOOD\\nPROGRAMMA\ 101\"\ \\\n\ \ \ \ -font\ \$::HLfn\n\ \ grid\ .top.about.title\ -row\ 0\ -column\ 0\ -columnspan\ 5\n\ \ label\ .top.about.blurb\ -text\ \"by\ Larry\ Smith\"\ -font\ \$::HLfn\n\ \ grid\ .top.about.blurb\ -row\ 1\ -column\ 0\ -columnspan\ 5\n\ \ button\ .top.about.pg1\ -command\ \{\ page\ 1\ \}\ -text\ \"Credits\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg1\ -row\ 2\ -column\ 0\n\ \ button\ .top.about.pg2\ -command\ \{\ page\ 2\ \}\ -text\ \"Machine\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg2\ -row\ 2\ -column\ 1\n\ \ button\ .top.about.pg3\ -command\ \{\ page\ 3\ \}\ -text\ \"Simulator\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg3\ -row\ 2\ -column\ 2\n\ \ button\ .top.about.pg4\ -command\ \{\ page\ 4\ \}\ -text\ \"Basic\ Ops\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg4\ -row\ 2\ -column\ 3\n\ \ button\ .top.about.pg5\ -command\ \{\ page\ 5\ \}\ -text\ \"Extensions\"\ \\\n\ \ \ \ -font\ \$::HLfn\ -relief\ groove\n\ \ grid\ .top.about.pg5\ -row\ 2\ -column\ 4\n\ \ label\ .top.about.pg1txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"©\ 2009\ by\ Larry\ Smith\\n\\nWritten\ for\ Marjie\ Smith,\ my\ wife,\ for\ her\ birthday.\ \ The\ Olivetti\\nProgramma\ 101\ was\ the\ first\ real\ computer\ I\ ever\ used\ and\ it\ was\\nthe\ first\ Marjie\ ever\ used,\ too.\ \ It\ has\ great\ nostalgic\ value\ for\ us.\\n\\n\\n\\n\\n\\n\\n\"\n\ \ label\ .top.about.pg2txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"The\ Programma\ 101\ was\ the\ first\ machine\ to\ be\ marketed\ as\\n\\\"microcomputer\\\".\ \ It\ was\ built\ with\ many\ transistors\ worth\ of\\ndiscrete\ logic,\ and\ used\ a\ delay\ line\ to\ implement\ the\ memory\\nregisters.\ \ By\ modern\ standards\ it\ was\ limited\ -\ five\ registers\\n(B,\ C,\ D,\ E\ and\ F)\ which\ could\ each\ be\ split\ in\ two\ if\ you\ could\\nlive\ with\ half\ the\ accuracy).\ \ It\ stored\ just\ 48\ instructions\ in\\nits\ program,\ and\ began\ eating\ up\ registers\ F,\ E,\ and\ D\ if\ you\\nexceeded\ that\ number,\ to\ a\ maximum\ of\ 120\ instructions\ with\\nonly\ two\ registers\ left.\\n\\n\\n\"\n\ \ label\ .top.about.pg3txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"The\ simulator\ emulates\ the\ original\ machine,\ but\ it\ does\ not\\nenforce\ its'\ limits.\ \ That\ is\ to\ say,\ you\ can\ split\ the\ F\ register\\ninto\ F\ and\ f\ (F-split)\ but\ they\ are\ not\ reduced\ in\ size,\ each\ is\\nreally\ a\ separate\ register.\\n\\nThe\ program\ is\ also\ not\ limited\ to\ 48\ or\ 120\ steps,\ it\ can\ be\ any\\nlength,\ and\ the\ F,\ E\ and\ D\ registers\ are\ never\ used.\\n\\n\\n\\n\\n\"\n\ \ label\ .top.about.pg4txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"\\\[To\ A\\u2193\\\]\\tdown\\tTransfers\ named\ register\ to\ accumulator.\\n\\\[M\\u2191\\\]\\tup\\tMoves\ contents\ of\ M\ (keyboard)\ register\ to\ named\ reg.\\n\\\[A\\u2195\\\]\\tswap\\tSwitches\ contents\ of\ named\ register\ and\ accumulator.\\n\\\[\\u221a\\\]\\tsqrt\\tLoads\ accumulator\ with\ the\ square\ root\ of\ the\ reg.\\n\\\[\\u2014\\\]\\tminus\\tSubtracts\ named\ reg\ from\ accumulator.\\n\\\[\\u00d7\\\]\\ttimes\\tMultiplies\ named\ reg\ by\ accumulator.\\n\\\[+\\\]\\tplus\\tAdds\ named\ reg\ to\ accumulator.\\n\\\[\\u00f7\\\]\\tdivide\\tDivides\ accumulator\ by\ named\ reg.\\n\\\[*\\\]\\tzero\\tStores\ 0\ in\ named\ reg.\\n\\\[\\u25c7\\\]\\tprreg\\tPrints\ the\ named\ reg.\\n\\\[S\\\]\\tstart\\tStarts\ execution\ at\ current\ program\ step.\\n\\\[/\\\]\\tsplit\\tUsed\ to\ address\ split\ registers\ a\ (A/),\ b\ (B/)\ etc.\"\n\ \ label\ .top.about.pg5txt\ -width\ 66\ -bd\ 5\ -relief\ solid\ -justify\ left\ -font\ \$::abtfn\ -text\ \"Buttons\ with\ a\ blue\ background\ are\ for\ extensions\ to\ the\ machine.\\n\\nSave\ Tape\\tSaves\ contents\ of\ display\ tape\ to\ utf-8\ text\ file.\\nClear\ Tape\\tClears\ display\ tape.\\nPush\ Regs\\tSave\ all\ regs\ but\ A,\ R\ &\ M\ to\ internal\ stack.\\nPull\ Regs\\t\\tRestore\ all\ regs\ but\ A,\ R\ &\ M\ from\ internal\ stack.\\nProg\ Library\\tSets\ directory\ to\ search\ for\ program\ cards.\\nSave\ Card\$\{tabs\}Saves\ current\ program\ to\ program\ card.\\nShow\ Labels\\tDisplays\ window\ to\ permit\ editing\ VXYZ\ labels.\\nShow\ Regs\\tDisplays\ window\ showing\ current\ contents\ of\ regs.\\nShow\ Prog\\tDisplays\ window\ showing\ current\ program.\\n\"\n\ \ button\ .top.about.exit\ -text\ \"Exit\ Simulator\"\ \\\n\ \ \ \ -command\ off\ -border\ 3\ -font\ \$::abtfn\n\ \ grid\ .top.about.exit\ -row\ 23\ -column\ 1\n\ \ button\ .top.about.close\ -text\ \"Close\ About...\"\ \\\n\ \ \ \ -command\ \{\ destroy\ .top.about\ \}\ -border\ 3\ -font\ \$::abtfn\n\ \ grid\ .top.about.close\ -row\ 23\ -column\ 3\n\ \ page\ 1\n\ \ center\ .top.about\n\}\n\nproc\ setdec\ \{\ args\ \}\ \{\n\ \ set\ ::tcl_precision\ \$::numdecs\n\}\n\nproc\ type\ \{\ str\ \{\ suffix\ \"\"\ \}\ \}\ \{\n\ \ if\ \{\ \$suffix\ eq\ \"\"\ \}\ \{\n\ \ \ \ set\ prstr\ \$str\n\ \ \}\ else\ \{\n\ \ \ \ set\ prstr\ \"\[format\ \"%\[=\ \{\$::dispch-4\}\].\[set\ ::numdecs\]f\"\ \$str\]\ \$\{suffix\}\"\n\ \ \}\n\ \ .top.printarea.text\ insert\ end\ \\n\$prstr\n\ \ .top.printarea.text\ see\ end\n\}\n\nproc\ blink\ \{\ \}\ \{\n\ \ if\ \$::greenon\ return\n\ \ set\ ::greenon\ 1\n\ \ .top.green\ configure\ -bg\ \$::brgreen\n\ \ set\ delay\ 300\n\ \ if\ !\$::interactive\ \{\ set\ delay\ 100\ \}\n\ \ after\ \$delay\ \{\n\ \ \ \ .top.green\ configure\ -bg\ \$::dkgreen\n\ \ set\ ::greenon\ 0\n\ \ \}\n\}\n\nproc\ off\ \{\ \}\ \{\ exit\;\n\ \ if\ \{\[tk_messageBox\ -parent\ .\ -title\ \"Are\ you\ sure?\"\ \\\n\ \ \ \ \ \ \ \ \ -icon\ question\ -type\ yesno\ -default\ no\ \\\n\ \ \ \ \ \ \ \ \ -message\ \"Exit\ P101\ Simulator?\"\]\ eq\ \"yes\"\n\ \ \}\ \{\n\ \ \ \ exit\n\ \ \}\n\}\n\nproc\ redlight\ \{\ code\ \}\ \{\n\ \ .top.green\ configure\ -bg\ \$::dkgreen\n\ \ .top.red\ configure\ -bg\ \$::brred\n\ \ if\ \$::interactive\ \{\ type\ \$code\ E!\ \}\ else\ \{\ type\ \$code\ PC\ \}\n\ \ set\ ::interactive\ 1\n\ \ foreach\ w\ \$::btnlist\ \{\ \$w\ configure\ -state\ disabled\ \}\n\ \ set\ ::register(A)\ 0.0\n\}\n\nproc\ jump\ \{\ label\ \}\ \{\n\ \ set\ ::interactive\ 0\n\ \ set\ reg\ \[\ string\ index\ \$label\ 0\ \]\n\ \ set\ cond\ 0\n\ \ if\ \{\ \[\ string\ first\ \$reg\ \"/cdr\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ set\ cond\ 1\n\ \ \}\n\ \ set\ pc\ \$::pc\n\ \ if\ \{\ !\$cond\ ||\ (\$::register(A)\ >\ 0)\ \}\ \{\n\ \ \ \ set\ pc\ \[\ lsearch\ -exact\ \$::program\ \$::jumps(\$label)\ \]\n\ \ \}\n\ \ if\ \{\ \$pc\ ==\ -1\ \}\ \{\n\ \ \ \ set\ ::interactive\ 1\n\ \ \ \ redlight\ \$::pc\n\ \ \ \ set\ ::pc\ 0\n\ \ \ \ return\ 0\n\ \ \}\n\ \ set\ ::pc\ \$pc\n\ \ return\ 1\n\}\n\nproc\ isjump\ \{\ label\ \}\ \{\n\ \ set\ result\ 0\n\ \ if\ \{\ (\$label\ ne\ \"\")\ &&\ (\$label\ ne\ \"\ S\")\ \}\ \{\n\ \ \ \ set\ reg\ \[\ string\ index\ \$label\ 0\ \]\n\ \ \ \ set\ cmd\ \[\ string\ index\ \$label\ 1\ \]\n\ \ \ \ if\ \{\ (\[\ string\ first\ \$cmd\ \"VWYZ\"\ \]\ !=\ -1\ )\ &&\n\ \ \ \ \ \ \ \ \ (\[\ string\ first\ \$reg\ \"\ MCDR/cdr\"\ \]\ !=\ -1\ )\n\ \ \ \ \ \ \ \}\ \{\n\ \ \ \ \ \ set\ result\ 1\n\ \ \ \ \}\n\ \ \}\n\ \ return\ \$result\n\}\n\nproc\ start\ \{\ \{\ label\ \"\"\ \}\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ start\ \;\ return\ \}\n\ \ if\ \{\ !\[info\ exists\ ::pc\]\ ||\ (\$::pc\ eq\ \"\")\ \}\ \{\ set\ ::pc\ 0\ \}\n\ \ set\ ::interactive\ 0\n\ \ set\ ::program\ \[\ .prog.list.list\ get\ 0\ end\ \]\n\ \ if\ \{\ \$label\ ne\ \"\"\ \}\ \{\ jump\ \$label\ \}\n\ \ while\ 1\ \{\n\ \ \ \ blink\n\ \ \ \ set\ ins\ \[\ lindex\ \$::program\ \$::pc\ \]\n\ \ \ \ set\ cmd\ \[\ string\ index\ \$ins\ end\ \]\n\ \ \ \ set\ reg\ \[\ string\ index\ \$ins\ end-1\ \]\n\ \ \ \ incr\ ::pc\n\ \ \ \ if\ \{\ \$ins\ eq\ \"end\"\ \}\ \{\n\ \ \ \ \ \ if\ \[\ pullstate\ \]\ continue\n\ \ \ \ \ \ set\ ::pc\ 0\n\ \ \ \ \ \ return\n\ \ \ \ \}\ elseif\ \{\ \$ins\ eq\ \"\ S\"\ \}\ \{\ return\n\ \ \ \ \}\ elseif\ \{\ \[string\ first\ \$cmd\ \"VWYZ\"\ \]\ !=-1\ \}\ \{\n\ \ \ \ \ \ #\ either\ label\ or\ branch.\ \ Labels\ are\ ignored\n\ \ \ \ \ \ if\ \[\ isjump\ \$ins\ \]\ \{\n\ \ \ \ \ \ \ \ if\ !\[jump\ \$ins\]\ return\n\ \ \ \ \ \ \}\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ set\ cmd\ \$::op2cmd(\$cmd)\n\ \ \ \ \ \ set\ value\ \[\ string\ range\ \$ins\ 0\ end-2\ \]\n\ \ \ \ \ \ if\ \{\ \$value\ ne\ \"\"\ \}\ \{\ set\ ::register(M)\ \$value\ \}\n\ \ \ \ \ \ \$cmd\ \$reg\n\ \ \ \ \ \ if\ \$::interactive\ return\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ interactive\ \{\ str\ reg\ op\ \}\ \{\n\ \ if\ \$::interactive\ \{\ type\ \$str\ \$\{reg\}\$op\ \}\n\ \ blink\n\}\n\nproc\ nextkey\ \{\ \}\ \{\n\ \ while\ 1\ \{\n\ \ \ \ vwait\ ::curbtn\n\ \ \ \ if\ \{\ \[lsearch\ \$::immediate\ \$::curbtn\]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \$::curbtn\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ set\ btntype\ \[\ string\ range\ \$::curbtn\ 0\ 2\ \]\n\ \ \ \ \ \ if\ \{\ (\$btntype\ eq\ \"num\")\ ||\ (\$btntype\ eq\ \"reg\")\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \[\ string\ index\ \$::curbtn\ end\ \]\n\ \ \ \ \ \ \ \ if\ \{\ \$::curbtn\ eq\ \"!\"\ \}\ \{\ set\ ::curbtn\ .\ \}\n\ \ \ \ \ \ \}\ elseif\ \{\ \[\ string\ first\ \$::curbtn\ \"vwyz\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \[\ string\ toupper\ \$::curbtn\ \]\n\ \ \ \ \ \ \}\ elseif\ \[\ info\ exists\ ::cmd2op(\$::curbtn)\ \]\ \{\n\ \ \ \ \ \ \ \ set\ ::curbtn\ \$::cmd2op(\$::curbtn)\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ return\ \$::curbtn\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ backsp\ \{\ \}\ \{\n\ \ .top.buffer.entry\ delete\ \[=\ \{\[string\ length\ \[.top.buffer.entry\ get\]\]-1\}\]\n\}\n\nproc\ cmdloop\ \{\ \}\ \{\n\ \ set\ delbuffer\ 1\n\ \ while\ 1\ \{\n\ \ \ \ set\ reg\ \"\"\n\ \ \ \ set\ btn\ \[nextkey\]\n\ \ \ \ if\ \{\[string\ first\ \$btn\ \"0123456789.-\"\ \]\ !=\ -1\}\ \{\n\ \ \ \ \ \ if\ \$delbuffer\ \{\n\ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ \ \ set\ delbuffer\ 0\n\ \ \ \ \ \ \ \ set\ havedec\ 0\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ if\ \{\ \$btn\ eq\ \".\"\ \}\ \{\n\ \ \ \ \ \ \ \ if\ !\$::havedec\ \{\n\ \ \ \ \ \ \ \ \ \ set\ ::havedec\ 1\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ .\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \}\ elseif\ \{\ \$btn\ eq\ \"-\"\ \}\ \{\n\ \ \ \ \ \ \ \ if\ \{\[\ string\ index\ \$::buffer\ 0\ \]\ eq\ \"-\"\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ 1\n\ \ \ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ 0\ -\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ \$btn\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ continue\n\ \ \ \ \}\n\ \ \ \ set\ value\ \"\"\n\ \ \ \ if\ \{\ \$::buffer\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ if\ \{\ \[\ string\ first\ \".\"\ \$::buffer\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ set\ ::buffer\ \$\{::buffer\}.0\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ set\ value\ \$::buffer\n\ \ \ \ \ \ if\ \$::interactive\ \{\ set\ ::register(M)\ \$value\ \}\n\ \ \ \ \}\n\ \ \ \ set\ delbuffer\ 1\n\ \ \ \ #\ value\ (if\ any)\ dealt\ with.\ \ btn\ should\ now\ be\ op,\ split\ or\ reg\n\ \ \ \ if\ \{\[string\ first\ \$btn\ \"ABCDEFMR/\"\]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ #\ it's\ a\ register\ name\n\ \ \ \ \ \ set\ reg\ \[\ string\ index\ \$btn\ end\ \]\n\ \ \ \ \ \ set\ btn\ \[\ nextkey\ \]\ \ \;#\ look\ for\ op\ or\ split\n\ \ \ \ \ \ if\ \{\ \$btn\ eq\ \"/\"\ \}\ \{\n\ \ \ \ \ \ \ \ set\ reg\ \[\ string\ tolower\ \$reg\ \]\n\ \ \ \ \ \ \ \ if\ \{\ \$reg\ eq\ \"m\"\ \}\ \{\ set\ reg\ /\ \}\n\ \ \ \ \ \ \ \ set\ btn\ \[nextkey\]\ \;#\ op\ MUST\ follow\ now\n\ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \ \ #\ we\ get\ here\ we\ have\ a\ reg\ and\ op\ is\ in\ btn\n\ \ \ \ if\ \{\ \$reg\ eq\ \"\"\ \}\ \{\ set\ reg\ M\ \}\ \;#\ default\ register\n\ \ \ \ if\ \$::recording\ \{\n\ \ \ \ \ \ if\ \{\ \[string\ first\ \$btn\ \"VWXZ\"\ \]\ !=\ -1\ \}\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \$reg\ eq\ \"M\"\ \}\ \{\ set\ reg\ \"\ \"\ \}\n\ \ \ \ \ \ \ \ insins\ \"\$value\$reg\$btn\"\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ if\ \{\ \$btn\ eq\ \"S\"\ \}\ \{\ set\ reg\ \"\ \"\ \}\n\ \ \ \ \ \ \ \ insins\ \"\$value\$reg\$btn\"\n\ \ \ \ \ \ \}\n\ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ incr\ ::pc\n\ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ if\ \[\ isjump\ \$reg\$btn\ \]\ \{\n\ \ \ \ \ \ \ \ start\ \$reg\$btn\n\ \ \ \ \ \ \ \ set\ ::interactive\ 1\n\ \ \ \ \ \ \ \ .top.buffer.entry\ delete\ 0\ end\n\ \ \ \ \ \ \ \ .top.buffer.entry\ insert\ end\ \$::register(M)\n\ \ \ \ \ \ \}\ else\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ if\ \{\ \[catch\ \{\ \$::op2cmd(\$btn)\ \$reg\ \}\ err\ \]\ \}\ \{\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \$btn\n\ \ \ \ \ \ \ \ \}\n\ \ \ \ \ \ \ \ \ \ \}\n\ \ \ \ \}\n\ \ \}\n\}\n\nproc\ loadlistbox\ \{\ w\ values\ \}\ \{\n\ set\ j\ true\n\ set\ indx\ 0\n\ \$w.list\ delete\ 0\ end\n\ \$w.linecount\ delete\ 0\ end\n\ foreach\ i\ \$values\ \{\n\ \ \ \$w.list\ insert\ end\ \$i\n\ \ \ \$w.linecount\ insert\ end\ \$indx\n\ \ \ if\ \{\$j\}\ \{\n\ \ \ \ \ set\ j\ false\n\ \ \ \ \ \$w.list\ itemconfigure\ \$indx\ -background\ #ffffdd\n\ \ \ \}\ else\ \{\n\ \ \ \ \ set\ j\ true\n\ \ \ \}\n\ \ \ incr\ indx\n\ \ \}\n\}\n\nproc\ scrolledlistbox\ \{\ w\ width\ height\ values\ cmd\ \{\ font\ \"\"\ \}\}\ \{\nlog\ \"height\ is\ \$height\"\n\ if\ \{\ \$font\ eq\ \"\"\ \}\ \{\ set\ font\ \$::txtfn\ \}\ else\ \{\ set\ font\ \$::brfn\ \}\n\ frame\ \$w\n\ listbox\ \$w.list\ -width\ \$::brwidth\ -height\ \$::brheight\ -font\ \$font\n\ listbox\ \$w.linecount\ -width\ 4\ -height\ \$::brheight\ -font\ \$font\n\ \$w.list\ configure\ -yscrollcommand\ \"\$w.scrl\ set\"\n\ #\$w.linecount\ configure\ -yscrollcommand\ \"\$w.scrl\ set\"\n\ scrollbar\ \$w.scrl\ -command\ \"\$w.list\ yview\;\ \$w.linecount\ yview\"\n\ pack\ \$w.scrl\ -side\ right\ -fill\ y\n\ pack\ \$w.linecount\ -side\ left\ -fill\ y\n\ pack\ \$w.list\ -side\ left\ -fill\ both\ -expand\ 1\n\ loadlistbox\ \$w\ \$values\n\ #\ bindings\n\ #\n\ #\ this\ will\ obtain\ the\ item\ clicked,\ and\ then\ pass\n\ #\ the\ value\ onto\ the\ proc\ specified\ in\ the\ variable\ cmd.\n\ eval\ \"bind\ \$w.list\ <ButtonRelease-1>\ \\\{\$cmd\ \\\[\\%\\W\ get\ \\@\\%x,\\%y\\\]\\\}\"\n\ #\ return\ the\ widget\ path\n\ return\ \$w\n\}\n\nproc\ scrolledtextarea\ \{w\ l\ t\ r\ b\ \}\ \{\n\ \ set\ width\ \[=\ \{round((\$r-\$l)*\$::dispw)\}\]\n\ \ set\ height\ \[=\ \{round((\$b-\$t)*\$::disph)\}\]\n\ \ set\ x\ \[=\ \{round(\$l*\$::dispw)\}\]\n\ \ set\ y\ \[=\ \{round(\$t*\$::disph)\}\]\n\ \ frame\ \$w\ -width\ \$width\ -height\ \$height\ -bd\ 2\ -bg\ white\n\ \ place\ \$w\ -x\ \$x\ -y\ \$y\n\ \ scrollbar\ \$w.vscroll\ -orient\ vertical\ -command\ \[\ list\ \$w.text\ yview\ \]\n\ \ scrollbar\ \$w.hscroll\ -orient\ horizontal\ -command\ \[\ list\ \$w.text\ xview\ \]\n\ \ text\ \$w.text\ -yscrollcommand\ \[\ list\ \$w.vscroll\ set\ \]\ \\\n\ \ \ \ -xscrollcommand\ \[\ list\ \$w.hscroll\ set\ \]\ \\\n\ \ \ \ -font\ \$::txtfn\ -bg\ white\ -width\ 1\ -height\ 4\ -width\ \$::dispch\n\ \ pack\ \$w.vscroll\ -side\ right\ -fill\ y\n\ \ pack\ \$w.hscroll\ -side\ top\ -fill\ x\n\ \ pack\ \$w.text\ -side\ left\n\}\n\nproc\ uptodate\ \{filename\ \{time\ 0\}\}\ \{\n\ \ set\ filename\ \[file\ join\ \[pwd\]\ \$filename\]\n\ \ set\ mtime\ \[file\ mtime\ \$filename\]\n\ \ if\ \{\$mtime\ >\ \$time\}\ \{source\ \$filename\}\n\ \ after\ 1000\ \[list\ uptodate\ \$filename\ \$mtime\]\n\}\ \;#RS\n\nproc\ reloadlib\ \{\}\ \{\n\ \ set\ proglist\ \"\"\n\ \ catch\ \{\ set\ proglist\ \[glob\ -directory\ \$::library\ *.p101\]\ \}\n\ \ .top.cardlist.list\ delete\ 0\ end\n\ \ foreach\ file\ \$proglist\ \{\n\ \ \ \ .top.cardlist.list\ insert\ end\ \$file\n\ \ \}\n\ \ renum\ .top.cardlist\n\}\n\nproc\ proglib\ \{\}\ \{\n\ \ set\ newlib\ \[\ tk_chooseDirectory\ \ -initialdir\ \$::library\ \\\n\ \ \ \ -mustexist\ 1\ -parent\ .top\ -title\ \"Library\ Directory\"\ \]\n\ \ if\ \{\ \$newlib\ ne\ \"\"\ \}\ \{\ set\ ::library\ \$newlib\ \}\n\}\n\nproc\ savecard\ \{\}\ \{\n\ \ set\ progname\ \[\ tk_getSaveFile\ -defaultextension\ p101\ \\\n\ \ \ \ -initialdir\ \$::library\ -parent\ .top\ -title\ \"Save\ Program\ To...\"\ \]\n\ \ if\ \{\ \$progname\ ne\ \"\"\ \}\ \{\n\ \ \ \ set\ f\ \[\ open\ \$progname\ w\ \]\n\ \ \ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ \ \ puts\ \$f\ \"\[\ .prog.list.list\ get\ 0\ end\ \]\"\n\ \ \ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ R\ \}\ \{\n\ \ \ \ \ \ puts\ \$f\ \$::register(\$reg)\n\ \ \ \ \}\n\ \ \ \ foreach\ lbl\ \{\ v\ w\ y\ z\ \}\ \{\n\ \ \ \ \ \ set\ text\ \[.vwyz.\$\{lbl\}txt\ get\ 1.0\ end\ \]\n\ \ \ \ \ \ set\ text\ \[\ split\ \$text\ \\n\ \]\n\ \ \ \ \ \ set\ text\ \[\ join\ \$text\ \"\\\\n\"\ \]\n\ \ \ \ \ \ puts\ \$f\ \$text\n\ \ \ \ \}\n\ \ \ \ puts\ \$f\ \$::pc\n\ \ \ \ puts\ \$f\ \$::numdecs\n\ \ \ \ close\ \$f\n\ \ \}\n\ \ animatecard\ 1\n\ \ reloadlib\n\}\n\nproc\ runcard\ \{\ args\ \}\ \{\ \n\ \ set\ cardname\ \$::register(M)\n\ \ set\ ::register(M)\ 0.0\n\ \ pushstate\ \$cardname\n\}\n\nset\ ::animating\ 0\nproc\ animatecard\ \{\ \{\ reverse\ 0\ \}\ \}\ \{\n\ \ if\ \$::animating\ return\n\ \ set\ ::animating\ 1\n\ \ destroy\ .card\n\ \ if\ !\$::animation\ return\n\ \ set\ cardw\ \[\ image\ width\ card\ \]\n\ \ set\ cardh\ \[\ image\ height\ card\ \]\n\ \ toplevel\ .card\n\ \ wm\ overrideredirect\ .card\ 1\n\ \ canvas\ .card.c\ -width\ \$cardw\ -height\ \$cardh\n\ \ pack\ .card.c\n\ \ .card.c\ create\ image\ 0\ 0\ -image\ card\ -anchor\ nw\n\ \ update\n\ \ set\ leftsh\ \[=\ \{round(\$::dispw*0.6955)\}\]\n\ \ set\ bottomsh\ \[=\ \{round(\$::disph*0.031\ )\}\]\n\ \ set\ left\ \[=\ \{\[\ winfo\ rootx\ .top\ \]\ +\ \$leftsh\}\]\n\ \ set\ showlabels\ 0\n\ \ if\ \$reverse\ \{\n\ \ \ \ set\ bottom\ \[=\ \{\[winfo\ rooty\ .top.cdrdr\]\ +\ \$bottomsh\}\]\n\ \ \ \ set\ curh\ 1\n\ \ \ \ while\ \{\ \$curh\ <\ \$cardh\ \}\ \{\n\ \ \ \ \ \ wm\ geometry\ .card\ \$\{cardw\}x\$curh+\$left+\$bottom\n\ \ \ \ \ \ update\n\ \ \ \ \ \ incr\ curh\n\ \ \ \ \ \ incr\ bottom\ -1\n\ \ \ \ \}\n\ \ \}\ else\ \{\n\ \ \ \ set\ rooty\ \[winfo\ rooty\ .top.cdrdr\]\n\ \ \ \ set\ cardh\ \[winfo\ height\ .card\]\n\ \ \ \ set\ bottom\ \[=\ \{\$rooty-\$cardh+\$bottomsh\}\]\n\ \ \ \ set\ curh\ \$cardh\n\ \ \ \ while\ \{\ \$curh\ >\ 0\ \}\ \{\n\ \ \ \ \ \ wm\ geometry\ .card\ \$\{cardw\}x\$curh+\$left+\$bottom\n\ \ \ \ \ \ update\n\ \ \ \ \ \ incr\ curh\ -1\n\ \ \ \ \ \ incr\ bottom\n\ \ \ \ \}\n\ \ \}\n\ \ set\ ::animating\ 0\n\ \ destroy\ .card\n\ \ update\n\}\n\nproc\ loadprog\ \{\ \}\ \{\n\ \ foreach\ ins\ \$::program\ \{\n\ \ \ \ .prog.list.list\ insert\ end\ \$ins\n\ \ \}\n\}\n\nproc\ loadcard\ \{\ cardname\ \}\ \{\n\ \ set\ h\ \[winfo\ height\ .top\]\n\ \ set\ w\ \[winfo\ width\ .top\]\n\ \ if\ \$::recording\ \{\n\ \ \ \ insins\ \"\$cardname\ @\"\n\ \ \ \ return\n\ \ \}\n\ \ if\ \{\ \$cardname\ eq\ \"\"\ \}\ return\n\ \ set\ f\ \[\ open\ \$cardname\ r\ \]\n\ \ fconfigure\ \$f\ -encoding\ utf-8\n\ \ set\ ::program\ \[\ gets\ \$f\ \]\ \ \n\ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ R\}\ \{\n\ \ \ \ set\ ::register(\$reg)\ \[\ gets\ \$f\ \]\n\ \ \}\n\ \ foreach\ lbl\ \{\ v\ w\ y\ z\ \}\ \{\n\ \ \ \ .vwyz.\$\{lbl\}txt\ delete\ 1.0\ end\n\ \ \ \ eval\ set\ lbltxt\ \[\ gets\ \$f\ \]\n\ \ \ \ set\ lbltxt\ \[\ string\ trim\ \$lbltxt\ \]\n\ \ \ \ .vwyz.\$\{lbl\}txt\ insert\ end\ \$lbltxt\n\ \ \}\n\ \ updlbls\n\ \ set\ ::pc\ \[\ gets\ \$f\ \]\n\ \ set\ ::numdecs\ \[\ gets\ \$f\ \]\n\ \ close\ \$f\n\ \ .prog.list.list\ delete\ 0\ end\n\ \ loadprog\n\ \ renum\ .prog.list\n\ \ wm\ geometry\ .top\ \$\{w\}x\$h\n\ \ animatecard\n\}\n\nproc\ updlbls\ \{\ \}\ \{\n\ \ .top.face\ delete\ vwxylbls\n\ \ set\ y\ \[=\ \{round(\$::dispw*.72)\}\]\n\ \ foreach\ \{\ lbl\ offset\ \}\ \{\ v\ .720\ w\ .800\ y\ .880\ z\ .960\ \}\ \{\n\ \ \ \ set\ x\ \[=\ \{round(\$offset*\$::dispw)\}\]\n\ \ \ \ set\ lbltxt\ \[\ .vwyz.\$\{lbl\}txt\ get\ 1.0\ end\ \]\n\ \ \ \ if\ \{\ \$lbltxt\ ne\ \"\"\ \}\ \{\n\ \ \ \ \ \ .top.face\ create\ text\ \$x\ \$y\ -fill\ black\ -font\ \$::lblfn\ \\\n\ \ \ \ \ \ \ \ -tags\ vwxylbls\ -anchor\ s\ -justify\ center\ -text\ \$lbltxt\n\ \ \ \ \}\n\ \ \}\n\ \ .top.face\ raise\ vwxylbls\n\}\n\nproc\ setpc\ \{\ instr\ \}\ \{\n\ \ set\ ::pc\ \[\ .prog.list.list\ curselection\ \]\n\}\n\nproc\ showprog\ \{\ args\ \}\ \{\n\ \ if\ \$::progshowing\ \{\n\ \ \ \ wm\ withdraw\ .prog\n\ \ \ \ set\ ::progshowing\ 0\n\ \ \ \ .top.showprog\ configure\ -text\ \"Show\\nProg\"\n\ \ \}\ else\ \{\n\ \ \ \ wm\ deiconify\ .prog\n\ \ \ \ set\ ::progshowing\ 1\n\ \ \ \ .top.showprog\ configure\ -text\ \"Hide\\nProg\"\n\ \ \}\n\}\n\nproc\ showlabels\ \{\ args\ \}\ \{\n\ \ if\ \$::labelshowing\ \{\n\ \ \ \ set\ ::labelshowing\ 0\n\ \ \ \ wm\ withdraw\ .vwyz\n\ \ \}\ else\ \{\n\ \ \ \ set\ ::labelshowing\ 1\n\ \ \ \ wm\ deiconify\ .vwyz\n\ \ \}\n\}\n\nproc\ pushregs\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ pushregs\ \;\ return\ \}\n\ \ set\ state\ \[\ list\ \\\n\ \ \ \ \$::register(B)\ \$::register(b)\ \$::register(C)\ \$::register(c)\ \\\n\ \ \ \ \$::register(D)\ \$::register(d)\ \$::register(E)\ \$::register(e)\ \\\n\ \ \ \ \$::register(F)\ \$::register(f)\ \]\n\ \ lappend\ ::regstack\ \$state\n\}\n\nproc\ pullregs\ \{\ \}\ \{\n\ \ if\ \$::recording\ \{\ set\ ::curbtn\ pullregs\ \;\ return\ \}\n\ \ if\ \{\ \$::regstack\ eq\ \{\}\ \}\ \{\ return\ 0\ \}\n\ \ set\ state\ \[lindex\ end\ \$::regstack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ foreach\ \[list\ \\\n\ \ \ \ ::register(B)\ ::register(b)\ ::register(C)\ ::register(c)\ \\\n\ \ \ \ ::register(D)\ ::register(d)\ ::register(E)\ ::register(e)\ \\\n\ \ \ \ ::register(F)\ ::register(f)\ \]\ \\\n\ \ \$state\ break\n\ \ return\ 1\n\}\n\n#\ push\ and\ pull\ save\ everything\ but\ registers\ AM&R,\ which\ can\n#\ be\ used\ to\ pass\ results\ back\ to\ a\ previous\ program\nproc\ pushstate\ \{\ newcard\ \}\ \{\n\ \ lappend\ ::stack\ \$::program\n\ \ lappend\ ::stack\ \$::pc\n\ \ pushregs\n\ \ loadcard\ \$newcard\n\}\n\nproc\ pullstate\ \{\ \}\ \{\n\ \ if\ \{\ \$::stack\ eq\ \{\}\ \}\ \{\ return\ 0\ \}\n\ \ set\ ::pc\ \[lindex\ end\ \$::stack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ set\ ::program\ \[lindex\ end-1\ \$::stack\]\n\ \ set\ ::stack\ \[lrange\ \$::regstack\ 0\ end-1\]\n\ \ pullregs\n\ \ return\ 1\n\}\n\nproc\ showregs\ \{\ args\ \}\ \{\n\ \ if\ !\$::regssetup\ \{\n\ \ \ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ M\ R\ \}\ \{\n\ \ \ \ \ \ .regs.reglist.linecount\ insert\ end\ \$reg\n\ \ \ \ \ \ .regs.reglist.list\ insert\ end\ \$::register(\$reg)\n\ \ \ \ \ \ trace\ add\ variable\ ::register(\$reg)\ write\ updregs\n\ \ \ \ \}\n\ \ \ \ set\ ::regssetup\ 1\n\ \ \}\n\ \ if\ \$::regsshowing\ \{\n\ \ \ \ wm\ withdraw\ .regs\n\ \ \ \ set\ ::regsshowing\ 0\n\ \ \ \ .top.showregs\ configure\ -text\ \"Show\\nRegs\"\n\ \ \}\ else\ \{\n\ \ \ \ wm\ deiconify\ .regs\n\ \ \ \ set\ ::regsshowing\ 1\n\ \ \ \ .top.showregs\ configure\ -text\ \"Hide\\nRegs\"\n\ \ \}\n\}\n\nproc\ updregs\ \{\ args\ \}\ \{\n\ \ .regs.reglist.list\ delete\ 0\ end\n\ \ foreach\ reg\ \{\ A\ B\ b\ C\ c\ D\ d\ E\ e\ F\ f\ M\ R\ \}\ \{\n\ \ \ \ .regs.reglist.list\ insert\ end\ \$::register(\$reg)\n\ \ \}\n\}\n\nproc\ center\ \{\ w\ \{\ width\ 0\ \}\ \{\ height\ 0\ \}\ \}\ \{\n\ \ update\n\ \ if\ \{\ \$width\ ==\ 0\ \}\ \{\ set\ width\ \[winfo\ width\ \$w\]\ \}\n\ \ if\ \{\ \$height\ ==\ 0\ \}\ \{\ set\ height\ \[winfo\ height\ \$w\]\ \}\n\ \ set\ x\ \[=\ \{(\[winfo\ vrootwidth\ \ \$w\]\ -\ \$width\ \ )\ /\ 2\ \}\]\n\ \ set\ y\ \[=\ \{(\[winfo\ vrootheight\ \$w\]\ -\ \$height\ )\ /\ 2\ \}\]\n\ \ wm\ geometry\ \$w\ \$\{width\}x\$\{height\}+\$\{x\}+\$\{y\}\n\}\n\nproc\ showsplash\ \{\ \}\ \{\n\ \ destroy\ .splash\n\ \ toplevel\ .splash\n\ \ wm\ overrideredirect\ .splash\ 1\n\ \ canvas\ .splash.c\n\ \ pack\ .splash.c\ -side\ top\ -fill\ both\ -expand\ 1\n\ \ image\ create\ photo\ splash\ -file\ \$::runfrom/images/splash.gif\n\ \ .splash.c\ create\ image\ 0\ 0\ -image\ splash\ -anchor\ nw\n\ \ center\ .splash\ 600\ 655\n\ \ update\n\ \ after\ 3000\ \{\n\ \ \ \ destroy\ .splash\n\ \ \}\n\}\n\nproc\ buildvwyz\ \{\ \}\ \{\n\ \ destroy\ .vwyz\n\ \ toplevel\ .vwyz\n\ \ wm\ protocol\ .vwyz\ WM_DELETE_WINDOW\ showlabels\n\ \ wm\ withdraw\ .vwyz\n\ \ label\ .vwyz.title\ -text\ \"Labels:\"\ -font\ regfn\n\ \ grid\ .vwyz.title\ -row\ 0\ -column\ 0\ -columnspan\ 2\n\n\ \ label\ .vwyz.v\ -text\ \"V:\"\ -font\ regfn\n\ \ grid\ .vwyz.v\ -row\ 1\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.w\ -text\ \"W:\"\ -font\ regfn\n\ \ grid\ .vwyz.w\ -row\ 2\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.y\ -text\ \"Y:\"\ -font\ regfn\n\ \ grid\ .vwyz.y\ -row\ 3\ -column\ 0\ -sticky\ news\n\ \ label\ .vwyz.z\ -text\ \"Z:\"\ -font\ regfn\n\ \ grid\ .vwyz.z\ -row\ 4\ \ -column\ 0\ -sticky\ news\n\n\ \ text\ .vwyz.vtxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.vtxt\ -row\ 1\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.wtxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.wtxt\ -row\ 2\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.ytxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.ytxt\ -row\ 3\ -column\ 1\ -sticky\ news\n\ \ text\ .vwyz.ztxt\ -width\ 10\ -font\ regfn\ -height\ 5\n\ \ grid\ .vwyz.ztxt\ -row\ 4\ -column\ 1\ -sticky\ news\n\n\ \ button\ .vwyz.updlbls\ -font\ regfn\ -command\ updlbls\ \\\n\ \ \ \ -text\ \"Update\ Labels\"\n\ \ grid\ .vwyz.updlbls\ -row\ 5\ -column\ 0\ -columnspan\ 2\ -sticky\ ew\n\ \ update\n\}\n\nproc\ buildprog\ \{\ \}\ \{\n\ \ destroy\ .prog\n\ \ toplevel\ .prog\n\ \ wm\ protocol\ .prog\ WM_DELETE_WINDOW\ showprog\n\ \ wm\ withdraw\ .prog\n\ \ scrolledlistbox\ .prog.list\ 20\ 10\ \"\"\ setpc\n\ \ .prog.list.list\ insert\ end\ end\;\ renum\ .prog.list\n\ \ label\ .prog.label\ -text\ \"Program:\"\ -anchor\ w\n\ \ pack\ .prog.label\ .prog.list\n\ \ update\n\}\n\nproc\ buildregs\ \{\ \}\ \{\n\ \ destroy\ .regs\n\ \ toplevel\ .regs\n\ \ wm\ protocol\ .regs\ WM_DELETE_WINDOW\ showregs\n\ \ wm\ withdraw\ .regs\n\ \ scrolledlistbox\ .regs.reglist\ 20\ 13\ \"\"\ \"\"\n\ \ label\ .regs.label\ -text\ \"Registers:\"\ -anchor\ w\n\ \ pack\ .regs.label\ .regs.reglist\n\ \ update\n\}\n\nproc\ buildgui\ \{\ args\ \}\ \{\n\ \ global\ size\ dispw\ disph\n\ \ destroy\ .top\n\ \ toplevel\ .top\n\ \ wm\ protocol\ .top\ WM_DELETE_WINDOW\ \{\ off\ \}\n\ \ image\ create\ photo\ card\ -file\ \$::runfrom/images/p101card-\$\{size\}%.gif\n\ \ image\ create\ photo\ p101\ -file\ \$::runfrom/images/p101.gif\n\ \ image\ create\ photo\ cr\ -file\ \$::runfrom/images/cardreader-\$\{size\}%.gif\n\ \ image\ create\ photo\ 1xparentpx\ -file\ \$::runfrom/images/1xparentpx.gif\n\ \ image\ create\ photo\ p101face\ -file\ \$::runfrom/images/P101-\$\{size\}%.gif\n\ \ image\ create\ photo\ btnup\ -file\ \$::runfrom/images/P101-\$\{size\}%.gif\n\ \ #image\ create\ photo\ btndn\ \\\n\ \ \ \ -file\ \$::runfrom/images/P101-\$\{size\}%-dark.png\n\ \ set\ dispw\ \[\ image\ width\ p101face\ \]\n\ \ set\ disph\ \[\ image\ height\ p101face\ \]\n\ \ switch\ \$size\ \{\n\ \ \ \ 50\ \ \{\ setfonts\ 18\ 2\ 32\ 33\ 6\ 6\ 8\ 8\ 8\ 8\ 6\ \}\n\ \ \ \ 75\ \ \{\ setfonts\ 22\ 4\ 27\ 29\ 10\ 8\ 14\ 14\ 12\ 12\ 8\ \}\n\ \ \ \ 100\ \{\ setfonts\ 20\ 4\ 25\ 28\ 16\ 12\ 20\ 20\ 16\ 16\ 12\ \}\n\ \ \}\n\ \ update\n\ \ set\ btns\ \[\ list\ \\\n\ \ \ \ .top.about\ 0.0852\ 0.0\ 0.2335\ 0.1260\ \\\n\ \ \ \ .top.paperadv\ 0.01052\ 0.2087\ 0.0727\ 0.3930\ \\\n\ \ \ \ .top.prefs\ 0.0096\ 0.4715\ 0.0746\ 0.5556\ \\\n\ \ \ \ .top.reset\ 0.0096\ 0.5840\ 0.0746\ 0.6680\ \\\n\ \ \ \ .top.off\ 0.00956\ 0.6965\ 0.0746\ 0.7805\ \\\n\ \ \ \ .top.regF\ 0.0852\ 0.4580\ 0.1703\ 0.5704\ \\\n\ \ \ \ .top.regE\ 0.0852\ 0.5705\ 0.1703\ 0.6829\ \\\n\ \ \ \ .top.regD\ 0.0852\ 0.6830\ 0.1703\ 0.7953\ \\\n\ \ \ \ .top.regC\ 0.0852\ 0.7954\ 0.1703\ 0.9078\ \\\n\ \ \ \ .top.showlabels\ 0.0852\ 0.9079\ 0.1703\ 0.9986\ \\\n\ \ \ \ .top.up\ 0.1703\ 0.4580\ 0.3388\ 0.5704\ \\\n\ \ \ \ .top.regB\ 0.1703\ 0.6830\ 0.3388\ 0.7953\ \\\n\ \ \ \ .top.clear\ 0.1703\ 0.5705\ 0.3388\ 0.6829\ \\\n\ \ \ \ .top.reg/\ 0.1703\ 0.7954\ 0.3388\ 0.9078\ \\\n\ \ \ \ .top.showregs\ 0.1703\ 0.9079\ 0.2545\ 0.9986\ \\\n\ \ \ \ .top.showprog\ 0.2555\ 0.9079\ 0.3388\ 0.9986\ \\\n\ \ \ \ .top.num7\ 0.3426\ 0.4580\ 0.4230\ 0.5704\ \\\n\ \ \ \ .top.num4\ 0.3426\ 0.5705\ 0.4230\ 0.6829\ \\\n\ \ \ \ .top.num1\ 0.3426\ 0.6830\ 0.4230\ 0.7953\ \\\n\ \ \ \ .top.num0\ 0.3426\ 0.7954\ 0.4230\ 0.9078\ \\\n\ \ \ \ .top.pushregs\ 0.3426\ 0.9079\ 0.4230\ 0.9986\ \\\n\ \ \ \ .top.num8\ 0.4239\ 0.4580\ 0.5091\ 0.5704\ \\\n\ \ \ \ .top.num5\ 0.4239\ 0.5705\ 0.5091\ 0.6829\ \\\n\ \ \ \ .top.num2\ 0.4239\ 0.6830\ 0.5091\ 0.7953\ \\\n\ \ \ \ .top.num!\ 0.4239\ 0.7954\ 0.5091\ 0.9078\ \\\n\ \ \ \ .top.pullregs\ 0.4239\ 0.9097\ 0.5091\ 0.9986\ \\\n\ \ \ \ .top.num9\ 0.5100\ 0.4580\ 0.5943\ 0.5704\ \\\n\ \ \ \ .top.num6\ 0.5100\ 0.5705\ 0.5943\ 0.6929\ \\\n\ \ \ \ .top.num3\ 0.5100\ 0.6830\ 0.5943\ 0.7953\ \\\n\ \ \ \ .top.num-\ 0.5100\ 0.7954\ 0.5943\ 0.9078\ \\\n\ \ \ \ .top.proglib\ 0.5100\ 0.9097\ 0.5942\ 0.9986\ \\\n\ \ \ \ .top.start\ 0.5962\ 0.4580\ 0.6804\ 0.9078\ \\\n\ \ \ \ .top.savecard\ 0.5962\ 0.9097\ 0.6804\ 0.9986\ \\\n\ \ \ \ .top.recprog\ 0.6813\ 0.35\ 0.839\ 0.41\ \\\n\ \ \ \ .top.down\ 0.6813\ 0.4580\ 0.8402\ 0.5704\ \\\n\ \ \ \ .top.minus\ 0.6813\ 0.5705\ 0.7590\ 0.6929\ \\\n\ \ \ \ .top.plus\ 0.6813\ 0.6830\ 0.7590\ 0.7953\ \\\n\ \ \ \ .top.v\ 0.6813\ 0.7954\ 0.7664\ 0.8550\ \\\n\ \ \ \ .top.times\ 0.7608\ 0.5705\ 0.8402\ 0.6929\ \\\n\ \ \ \ .top.divide\ 0.7608\ 0.6830\ 0.8402\ 0.7953\ \\\n\ \ \ \ .top.w\ 0.7608\ 0.7954\ 0.9262\ 0.8564\ \\\n\ \ \ \ .top.prprog\ 0.8411\ 0.35\ 0.999\ 0.41\ \\\n\ \ \ \ .top.swap\ 0.8411\ 0.4580\ 0.9196\ 0.8550\ \\\n\ \ \ \ .top.regA\ 0.8411\ 0.5705\ 0.9196\ 0.6929\ \\\n\ \ \ \ .top.regR\ 0.8411\ 0.6830\ 0.9196\ 0.7953\ \\\n\ \ \ \ .top.y\ 0.8411\ 0.7954\ 0.9196\ 0.8564\ \\\n\ \ \ \ .top.sqrt\ 0.9206\ 0.4580\ 0.9990\ 0.8550\ \\\n\ \ \ \ .top.prreg\ 0.9206\ 0.5705\ 0.9990\ 0.6929\ \\\n\ \ \ \ .top.zero\ 0.9206\ 0.6830\ 0.9990\ 0.7953\ \\\n\ \ \ \ .top.z\ 0.9206\ 0.7954\ 0.9990\ .8580\ \\\n\ \ \ \ .top.papersav\ 0.0105\ 0.1463\ 0.0727\ 0.2073\ \\\n\ \ \ \ .top.paperclr\ 0.0105\ 0.3957\ 0.0727\ 0.4566\ \\\n\ \ \ \ .top.backsp\ 0.5962\ 0.25\ 0.6804\ 0.455\ \\\n\ \ \]\n\ \ canvas\ .top.face\ -width\ \$dispw\ -height\ \$disph\n\ \ .top.face\ create\ image\ 0\ 0\ -image\ p101face\ -anchor\ nw\n\ \ place\ .top.face\ -x\ 0\ -y\ 0\n\ \ update\n\ \ center\ .top\ \$dispw\ \$disph\n\ \ set\ ::btnlist\ \{\}\n\ \ foreach\ \{\ name\ l\ t\ r\ b\ \}\ \$btns\ \{\n\ \ \ \ set\ l\ \[=\ \{round(\$l*\$::dispw)\}\]\n\ \ \ \ set\ t\ \[=\ \{round(\$t*\$::disph)\}\]\n\ \ \ \ set\ r\ \[=\ \{round(\$r*\$::dispw)\}\]\n\ \ \ \ set\ b\ \[=\ \{round(\$b*\$::disph)\}\]\n\ \ \ \ image\ create\ photo\ face\$name\n\ \ \ \ face\$name\ copy\ btnup\ -from\ \$l\ \$t\ \$r\ \$b\n\ \ \ \ set\ cmd\ \[\ list\ set\ ::curbtn\ \$name\ \]\n\ \ \ \ set\ code\ \[\ string\ range\ \[\ file\ extension\ \$name\ \]\ 1\ end\ \]\n\ \ \ \ button\ \$name\ -image\ face\$name\ -command\ \[list\ set\ ::curbtn\ \$code\]\ \\\n\ \ \ \ \ \ -bd\ 0\ -highlightthickness\ 0\ -activebackground\ #0000ff\n\ \ \ \ place\ \$name\ -x\ \$l\ -y\ \$t\ \n\ \ \ \ \ \ \ \ raise\ \$name\n\ \ \ \ if\ \{\ (\$name\ ne\ \".top.clear\")\ &&\ (\$name\ ne\ \".top.reset\")\ \}\ \{\n\ \ \ \ \ \ lappend\ ::btnlist\ \$name\n\ \ \ \ \}\n\ \ \}\n\ \ #\ printarea\n\ \ foreach\ \{\ l\ t\ r\ b\ \}\ \{\ 0.0852\ 0.127\ 0.67\ 0.29\ \}\ break\n\ \ scrolledtextarea\ .top.printarea\ \$l\ \$t\ \$r\ \$b\n\ \ #\ buffer\n\ \ foreach\ \{\ x\ y\ \}\ \{\ 0.0855\ 0.390\ \}\ break\n\ \ frame\ .top.buffer\ -bd\ 2\n\ \ place\ .top.buffer\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ entry\ .top.buffer.entry\ -font\ \$::txtfn\ -textvariable\ ::buffer\ -width\ \$::bufwidth\n\ \ pack\ .top.buffer.entry\ -fill\ both\n\ \ #\ cardlist\n\ \ foreach\ \{\ x\ y\ \}\ \{\ .6813\ .125\ \}\ break\n\ \ scrolledlistbox\ .top.cardlist\ \$::brwidth\ \$::brheight\ \"\"\ loadcard\ \$::brfn\n\ \ place\ .top.cardlist\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ card\ reader\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ 0\ 0\ .681\ .2735\ \}\ break\n\ \ label\ .top.cdrdr\ -image\ cr\ -anchor\ nw\ -bd\ 0\n\ \ place\ .top.cdrdr\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ green\ light\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ .18\ .06\ .6825\ .01\ \}\ break\n\ \ if\ \{\ \$::size\ ==\ 50\ \}\ \{\ set\ w\ .18\ \}\n\ \ label\ .top.green\ -bg\ \$::dkgreen\ -anchor\ center\ \ -image\ 1xparentpx\ \\\n\ \ \ \ -width\ \[=\ \{round(\$dispw*\$w)\}\]\ -height\ \[=\ \{round(\$disph*\$h)\}\]\ -bd\ 10\ \\\n\ \ \ \ -relief\ raised\n\ \ place\ .top.green\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ red\ light\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ .07\ .06\ .9\ .01\ \}\ break\n\ \ label\ .top.red\ -bg\ \$::dkred\ -anchor\ center\ -image\ 1xparentpx\ \\\n\ \ \ \ -width\ \[=\ \{round(\$dispw*\$w)\}\]\ -height\ \[=\ \{round(\$disph*\$h)\}\]\ -bd\ 10\ \\\n\ \ \ \ -relief\ raised\n\ \ place\ .top.red\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\ \ #\ decimal\ wheel\n\ \ foreach\ \{\ w\ h\ x\ y\ \}\ \{\ 2\ 1\ .018\ .8821\ \}\ break\n\ \ spinbox\ .top.decset\ -from\ 0\ -to\ 15\ -wrap\ 1\ -font\ \$::spfn\ \\\n\ \ \ \ -width\ 2\ -command\ setdec\ -textvariable\ numdecs\n\ \ place\ .top.decset\ -x\ \[=\ \{round(\$x*\$dispw)\}\]\ -y\ \[=\ \{round(\$y*\$disph)\}\]\n\n\ \ if\ \$::needreset\ \{\n\ \ \ \ set\ ::needreset\ 0\n\ \ \ \ buildregs\n\ \ \ \ buildvwyz\n\ \ \ \ buildprog\n\ \ \ \ reset\ 1\n\ \ \}\ else\ \{\n\ \ \ \ loadprog\n\ \ \}\n\ \ reloadlib\n\ \ update\n\}\n\nproc\ setsize\ \{\ \{size\ 0\ \}\ \}\ \{\n\ \ if\ \{\ \$size\ ==\ 0\ \}\ \{\n\ \ \ \ destroy\ .size\n\ \ \ \ toplevel\ .size\n\ \ \ \ label\ .size.msg\ -text\ \"Simulator\ Display\ Size?\"\n\ \ \ \ grid\ .size.msg\ -row\ 0\ -column\ 0\ -columnspan\ 4\n\ \ \ \ button\ .size.100\ -text\ \"100%\"\ -command\ \{\ setsize\ 100\ \}\n\ \ \ \ grid\ .size.100\ -row\ 1\ -column\ 0\n\ \ \ \ button\ .size.75\ -text\ \"75%\"\ -command\ \{\ setsize\ 75\ \}\n\ \ \ \ grid\ .size.75\ -row\ 1\ -column\ 1\n\ \ \ \ button\ .size.50\ -text\ \"50%\"\ -command\ \{\ setsize\ 50\ \}\n\ \ \ \ grid\ .size.50\ -row\ 1\ -column\ 2\n\ \ \ \ button\ .size.cancel\ -text\ \"Exit\"\ -command\ exit\n\ \ \ \ grid\ .size.cancel\ -row\ 1\ -column\ 3\n\ \ \ \ center\ .size\n\ \ \ \ \ \ \ \ after\ 1000\ \{\ wm\ deiconify\ .size\ \}\n\ \ \}\ else\ \{\n\ \ \ \ destroy\ .size\n\ \ \ \ set\ ::size\ \$size\n\ \ \}\n\}\n\n#\ initialize\npackage\ require\ Tk\nwm\ withdraw\ .\n#set\ runfrom\ .\nset\ runfrom\ p101.exe\nset\ manpdf\ \$::runfrom/olpro101.pdf\ \ninterp\ alias\ \{\}\ =\ \{\}\ expr\nencoding\ system\ utf-8\nset\ dkgreen\ #179fa2\nset\ brgreen\ #879fa2\nset\ dkred\ #880000\nset\ brred\ #ff0000\nset\ btnlist\ \{\}\nset\ program\ \{\}\nset\ stack\ \{\}\nset\ regstack\ \{\}\narray\ set\ op2cmd\ \{\n\ \ \\u2193\ down\n\ \ \\u2191\ up\n\ \ \\u2195\ swap\n\ \ \\u221a\ sqrt\n\ \ \\u2014\ minus\n\ \ \\u00d7\ times\n\ \ +\ \ \ \ \ \ plus\n\ \ \\u00f7\ divide\n\ \ *\ \ \ \ \ \ zero\n\ \ \\u25c7\ prreg\n\ \ S\ \ \ \ \ \ start\n\ \ /\ \ \ \ \ \ split\n\ \ @\ \ \ \ \ \ runcard\n\ \ (\ \ \ \ \ \ pushregs\n\ \ )\ \ \ \ \ \ pullregs\n\}\narray\ set\ cmd2op\ \{\n\ \ down\ \ \ \ \ \\u2193\n\ \ up\ \ \ \ \ \ \ \\u2191\n\ \ swap\ \ \ \ \ \\u2195\n\ \ sqrt\ \ \ \ \ \\u221a\n\ \ minus\ \ \ \ \\u2014\n\ \ times\ \ \ \ \\u00d7\n\ \ plus\ \ \ \ \ +\n\ \ divide\ \ \ \\u00f7\n\ \ zero\ \ \ \ \ *\n\ \ prreg\ \ \ \ \\u25c7\n\ \ start\ \ \ \ S\n\ \ split\ \ \ \ /\n\ \ runcard\ \ @\n\ \ pushregs\ (\n\ \ pullregs\ )\n\}\nset\ uselog\ 1\nset\ logopen\ 0\nset\ logfile\ \"\"\nset\ recording\ 0\nset\ curpage\ 0\nset\ animation\ 1\nset\ interactive\ 1\nset\ greenon\ 0\narray\ set\ jumps\ \{\n\ \ \"\ V\"\ AV\n\ \ \"\ W\"\ AW\n\ \ \"\ Y\"\ AY\n\ \ \"\ Z\"\ AZ\n\ \ MV\ AV\n\ \ MW\ AW\n\ \ MY\ AY\n\ \ MZ\ AZ\n\ \ CW\ BW\n\ \ CY\ BY\n\ \ CZ\ BZ\n\ \ DV\ EV\n\ \ DW\ EW\n\ \ DY\ EY\n\ \ DZ\ EZ\n\ \ RV\ FV\n\ \ RW\ FW\n\ \ RY\ FY\n\ \ RZ\ FZ\n\ \ /V\ aV\n\ \ /W\ aW\n\ \ /Y\ aY\n\ \ /Z\ aZ\n\ \ cV\ bV\n\ \ cW\ bW\n\ \ cY\ bY\n\ \ cZ\ bZ\n\ \ dV\ eV\n\ \ dW\ eW\n\ \ dY\ eY\n\ \ dZ\ eZ\n\ \ rV\ fV\n\ \ rW\ fW\n\ \ rY\ fY\n\ \ rZ\ fZ\n\}\nset\ immediate\ \[\ list\ recprog\ prprog\ prefs\ reset\ off\ clear\ start\ \\\n\ \ papersav\ paperclr\ showlabels\ showregs\ showprog\ pushregs\ pullregs\ \\\n\ \ proglib\ savecard\ about\ backsp\ \]\nset\ havedec\ 0\nset\ progshowing\ 0\nset\ progshowing\ 0\nset\ labelshowing\ 0\nset\ regsshowing\ 0\nset\ regssetup\ 0\nset\ regsshowing\ 0\nuptodate\ \[info\ script\]\ \[file\ mtime\ \[info\ script\]\]\nset\ numdecs\ 4\;\ setdec\nset\ curbtn\ \"\"\ntrace\ add\ variable\ size\ write\ buildgui\nset\ needreset\ 1\nset\ library\ .\nshowsplash\nafter\ 2000\nsetsize\ncmdloop\n======\n\n<<categories>>\ Retrocomputing|Simulator} CALL {my revision { Olivetti Programma 101 Simulator }} CALL {::oo::Obj1843956 process revision/+Olivetti+Programma+101+Simulator+} CALL {::oo::Obj1843954 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4