Merge branch 'next-release'

This commit is contained in:
Jeff Parsons 2016-11-18 10:47:04 -08:00
commit a83ae4c0be
35 changed files with 2739 additions and 1648 deletions

View file

@ -1,8 +1,9 @@
{"load":0xC000/*140000*/,"exec":0xC000/*140000*/,
{"load":0xC000/*140000*/,
"exec":0xC000/*140000*/,
"words":[
0x0005/*000005*/,0x0A1F/*005037*/,0xFFFE/*177776*/,0x15C6/*012706*/,0xC000/*140000*/,0x0A1F/*005037*/,0xFF74/*177564*/,0x15C0/*012700*/,
0xC251/*141121*/,0x09F7/*004767*/,0x0052/*000122*/,0x15DF/*012737*/,0xC054/*140124*/,0x0040/*000100*/,0x15DF/*012737*/,0x00E0/*000340*/,
0x0042/*000102*/,0x55DF/*052737*/,0x0040/*000100*/,0xFF66/*177546*/,0x15C0/*012700*/,0xC269/*141151*/,0x09F7/*004767*/,0x0038/*000070*/,
0xC25E/*141136*/,0x09F7/*004767*/,0x0052/*000122*/,0x15DF/*012737*/,0xC054/*140124*/,0x0040/*000100*/,0x15DF/*012737*/,0x00E0/*000340*/,
0x0042/*000102*/,0x55DF/*052737*/,0x0040/*000100*/,0xFF66/*177546*/,0x15C0/*012700*/,0xC276/*141166*/,0x09F7/*004767*/,0x0038/*000070*/,
0xE5C6/*162706*/,0x00AE/*000256*/,0x1180/*010600*/,0x09F7/*004767*/,0x006A/*000152*/,0x0A00/*005000*/,0x0001/*000001*/,0x0A80/*005200*/,
0x0BF7/*005767*/,0x000C/*000014*/,0x03FB/*001773*/,0x15E6/*012746*/,0x5800/*054000*/,0x1DE6/*016746*/,0x0002/*000002*/,0x0002/*000002*/,
0x0000/*000000*/,0x0000/*000000*/,0x0AB7/*005267*/,0xFFFA/*177772*/,0x0002/*000002*/,0x8BDF/*105737*/,0xFF74/*177564*/,0x80FD/*100375*/,
@ -14,76 +15,101 @@
0x0030/*000060*/,0x15DF/*012737*/,0x0080/*000200*/,0x0032/*000062*/,0xD5DF/*152737*/,0x0040/*000100*/,0xFF70/*177560*/,0x0087/*000207*/,
0x1026/*010046*/,0x97C0/*113700*/,0xFF72/*177562*/,0xA017/*120027*/,0x000D/*000015*/,0x032D/*001455*/,0xA017/*120027*/,0x007F/*000177*/,
0x0303/*001403*/,0xA017/*120027*/,0x0008/*000010*/,0x020A/*001012*/,0x0BF7/*005767*/,0xFFC6/*177706*/,0x0306/*001406*/,0x0AF7/*005367*/,
0xFFC0/*177700*/,0x15C0/*012700*/,0xC21F/*141037*/,0x09F7/*004767*/,0xFF7E/*177576*/,0x012B/*000453*/,0xA017/*120027*/,0x0020/*000040*/,
0xFFC0/*177700*/,0x15C0/*012700*/,0xC227/*141047*/,0x09F7/*004767*/,0xFF7E/*177576*/,0x012B/*000453*/,0xA017/*120027*/,0x0020/*000040*/,
0x0528/*002450*/,0xA017/*120027*/,0x007F/*000177*/,0x0425/*002045*/,0x09F7/*004767*/,0xFF5E/*177536*/,0xA017/*120027*/,0x007A/*000172*/,
0x0605/*003005*/,0xA017/*120027*/,0x0061/*000141*/,0x0502/*002402*/,0xC5C0/*142700*/,0x0020/*000040*/,0x2DD7/*026727*/,0xFF92/*177622*/,
0x00AC/*000254*/,0x0417/*002027*/,0x9026/*110046*/,0x1DC0/*016700*/,0xFF86/*177606*/,0x6DC0/*066700*/,0xFF84/*177604*/,0x9588/*112610*/,
0x0AB7/*005267*/,0xFF7E/*177576*/,0x010E/*000416*/,0x1DC0/*016700*/,0xFF76/*177566*/,0x6DC0/*066700*/,0xFF74/*177564*/,0x8A08/*105010*/,
0x15DF/*012737*/,0xC146/*140506*/,0x00A0/*000240*/,0x15DF/*012737*/,0x0040/*000100*/,0x00A2/*000242*/,0x15DF/*012737*/,0x0400/*002000*/,
0xFFFA/*177772*/,0x1580/*012600*/,0x0002/*000002*/,0x0A1F/*005037*/,0xFFFA/*177772*/,0x1026/*010046*/,0x1066/*010146*/,0x10A6/*010246*/,
0x10E6/*010346*/,0x1126/*010446*/,0x15C0/*012700*/,0xC21C/*141034*/,0x09F7/*004767*/,0xFF0C/*177414*/,0xB5DF/*132737*/,0x0040/*000100*/,
0xFF74/*177564*/,0x02FC/*001374*/,0x0A04/*005004*/,0x15C3/*012703*/,0xC223/*141043*/,0x94C0/*112300*/,0x0319/*001431*/,0x1DC2/*016702*/,
0x10E6/*010346*/,0x1126/*010446*/,0x15C0/*012700*/,0xC224/*141044*/,0x09F7/*004767*/,0xFF0C/*177414*/,0xB5DF/*132737*/,0x0040/*000100*/,
0xFF74/*177564*/,0x02FC/*001374*/,0x0A04/*005004*/,0x15C3/*012703*/,0xC22B/*141053*/,0x94C0/*112300*/,0x0319/*001431*/,0x1DC2/*016702*/,
0xFF2E/*177456*/,0x9481/*112201*/,0x0319/*001431*/,0xA057/*120127*/,0x0020/*000040*/,0x03FB/*001773*/,0xA001/*120001*/,0x0208/*001010*/,
0x94C0/*112300*/,0x030A/*001412*/,0x9481/*112201*/,0x0308/*001410*/,0xA057/*120127*/,0x0020/*000040*/,0x02F7/*001367*/,0x0104/*000404*/,
0x94C0/*112300*/,0x02FE/*001376*/,0x0A84/*005204*/,0x01E9/*000751*/,0x0CC4/*006304*/,0x09FC/*004774*/,0xC1C0/*140700*/,0x0104/*000404*/,
0x15C0/*012700*/,0xC23F/*141077*/,0x09F7/*004767*/,0xFEC0/*177300*/,0x0A37/*005067*/,0xFEF6/*177366*/,0x15C0/*012700*/,0xC269/*141151*/,
0x15C0/*012700*/,0xC24C/*141114*/,0x09F7/*004767*/,0xFEC0/*177300*/,0x0A37/*005067*/,0xFEF6/*177366*/,0x15C0/*012700*/,0xC276/*141166*/,
0x09F7/*004767*/,0xFEB4/*177264*/,0x1584/*012604*/,0x1583/*012603*/,0x1582/*012602*/,0x1581/*012601*/,0x1580/*012600*/,0x0002/*000002*/,
0xC428/*142050*/,0xC2A4/*141244*/,0xC2B0/*141260*/,0xC2F4/*141364*/,0xC29A/*141232*/,0x4F43/*047503*/,0x4D4D/*046515*/,0x4E41/*047101*/,
0x5344/*051504*/,0x4120/*040440*/,0x4552/*042522*/,0x4220/*041040*/,0x4F4F/*047517*/,0x2C54/*026124*/,0x4820/*044040*/,0x4C41/*046101*/,
0x2C54/*026124*/,0x4C20/*046040*/,0x4749/*043511*/,0x5448/*052110*/,0x2C53/*026123*/,0x5420/*052040*/,0x5345/*051505*/,0x2054/*020124*/,
0x4E41/*047101*/,0x2044/*020104*/,0x4548/*042510*/,0x504C/*050114*/,0x0A0D/*005015*/,0x4F42/*047502*/,0x544F/*052117*/,0x4420/*042040*/,
0x5645/*053105*/,0x4349/*041511*/,0x5345/*051505*/,0x4120/*040440*/,0x4552/*042522*/,0x5220/*051040*/,0x3F4B/*037513*/,0x5220/*051040*/,
0x3F4C/*037514*/,0x4F20/*047440*/,0x2052/*020122*/,0x5052/*050122*/,0x0D3F/*006477*/,0x000A/*000012*/,0x0A0D/*005015*/,0x0800/*004000*/,
0x0820/*004040*/,0x4200/*041000*/,0x4F4F/*047517*/,0x0054/*000124*/,0x4148/*040510*/,0x544C/*052114*/,0x5400/*052000*/,0x5345/*051505*/,
0x0054/*000124*/,0x494C/*044514*/,0x4847/*044107*/,0x5354/*051524*/,0x4800/*044000*/,0x4C45/*046105*/,0x0050/*000120*/,0x5500/*052400*/,
0x4B4E/*045516*/,0x4F4E/*047516*/,0x4E57/*047127*/,0x4320/*041440*/,0x4D4F/*046517*/,0x414D/*040515*/,0x444E/*042116*/,0x0D0A/*006412*/,
0x5000/*050000*/,0x5044/*050104*/,0x312D/*030455*/,0x2031/*020061*/,0x4F4D/*047515*/,0x494E/*044516*/,0x4F54/*047524*/,0x2052/*020122*/,
0x3156/*030526*/,0x302E/*030056*/,0x0D0A/*006412*/,0x0D0A/*006412*/,0x4200/*041000*/,0x4F4F/*047517*/,0x3E54/*037124*/,0x0020/*000040*/,
0x4E55/*047125*/,0x4E4B/*047113*/,0x574F/*053517*/,0x204E/*020116*/,0x4F42/*047502*/,0x544F/*052117*/,0x4420/*042040*/,0x5645/*053105*/,
0x4349/*041511*/,0x0A45/*005105*/,0x000D/*000015*/,0x2020/*020040*/,0x2020/*020040*/,0x2020/*020040*/,0x4C43/*046103*/,0x434F/*041517*/,
0x204B/*020113*/,0x4954/*044524*/,0x4B43/*045503*/,0x0A53/*005123*/,0x000D/*000015*/,0x15C0/*012700*/,0xC1CA/*140712*/,0x09F7/*004767*/,
0xFDC6/*176706*/,0x0087/*000207*/,0x0000/*000000*/,0x15C0/*012700*/,0xC21C/*141034*/,0x09F7/*004767*/,0xFDBA/*176672*/,0x0087/*000207*/,
0x0A37/*005067*/,0xFD9E/*176636*/,0x15C5/*012705*/,0x1A00/*015000*/,0x115F/*010537*/,0xFF78/*177570*/,0x1144/*010504*/,0x0C84/*006204*/,
0xC5AE/*142656*/,0xC2C4/*141304*/,0xC2D0/*141320*/,0xC316/*141426*/,0xC47A/*142172*/,0xC2BA/*141272*/,0x4F43/*047503*/,0x4D4D/*046515*/,
0x4E41/*047101*/,0x5344/*051504*/,0x4120/*040440*/,0x4552/*042522*/,0x4220/*041040*/,0x4F4F/*047517*/,0x2C54/*026124*/,0x4820/*044040*/,
0x4C41/*046101*/,0x2C54/*026124*/,0x5420/*052040*/,0x5345/*051505*/,0x2C54/*026124*/,0x4420/*042040*/,0x4149/*040511*/,0x2C47/*026107*/,
0x4C20/*046040*/,0x4749/*043511*/,0x5448/*052110*/,0x2053/*020123*/,0x4E41/*047101*/,0x2044/*020104*/,0x4548/*042510*/,0x504C/*050114*/,
0x0A0D/*005015*/,0x4F42/*047502*/,0x544F/*052117*/,0x4420/*042040*/,0x5645/*053105*/,0x4349/*041511*/,0x5345/*051505*/,0x4120/*040440*/,
0x4552/*042522*/,0x5220/*051040*/,0x3F4B/*037513*/,0x5220/*051040*/,0x3F4C/*037514*/,0x4F20/*047440*/,0x2052/*020122*/,0x5052/*050122*/,
0x0D3F/*006477*/,0x000A/*000012*/,0x0A0D/*005015*/,0x0800/*004000*/,0x0820/*004040*/,0x4200/*041000*/,0x4F4F/*047517*/,0x0054/*000124*/,
0x4148/*040510*/,0x544C/*052114*/,0x5400/*052000*/,0x5345/*051505*/,0x0054/*000124*/,0x4944/*044504*/,0x4741/*043501*/,0x4C00/*046000*/,
0x4749/*043511*/,0x5448/*052110*/,0x0053/*000123*/,0x4548/*042510*/,0x504C/*050114*/,0x0000/*000000*/,0x4E55/*047125*/,0x4E4B/*047113*/,
0x574F/*053517*/,0x204E/*020116*/,0x4F43/*047503*/,0x4D4D/*046515*/,0x4E41/*047101*/,0x0A44/*005104*/,0x000D/*000015*/,0x4450/*042120*/,
0x2D50/*026520*/,0x3131/*030461*/,0x4D20/*046440*/,0x4E4F/*047117*/,0x5449/*052111*/,0x524F/*051117*/,0x5620/*053040*/,0x2E31/*027061*/,
0x0A30/*005060*/,0x0A0D/*005015*/,0x000D/*000015*/,0x4F42/*047502*/,0x544F/*052117*/,0x203E/*020076*/,0x5500/*052400*/,0x4B4E/*045516*/,
0x4F4E/*047516*/,0x4E57/*047127*/,0x4220/*041040*/,0x4F4F/*047517*/,0x2054/*020124*/,0x4544/*042504*/,0x4956/*044526*/,0x4543/*042503*/,
0x0D0A/*006412*/,0x2000/*020000*/,0x2020/*020040*/,0x2020/*020040*/,0x4320/*041440*/,0x4F4C/*047514*/,0x4B43/*045503*/,0x5420/*052040*/,
0x4349/*041511*/,0x534B/*051513*/,0x0D0A/*006412*/,0x2000/*020000*/,0x2020/*020040*/,0x2020/*020040*/,0x4920/*044440*/,0x4554/*042524*/,
0x4152/*040522*/,0x4954/*044524*/,0x4E4F/*047117*/,0x0A53/*005123*/,0x000D/*000015*/,0x15C0/*012700*/,0xC1CC/*140714*/,0x09F7/*004767*/,
0xFDA6/*176646*/,0x0087/*000207*/,0x0000/*000000*/,0x15C0/*012700*/,0xC224/*141044*/,0x09F7/*004767*/,0xFD9A/*176632*/,0x0087/*000207*/,
0x0A37/*005067*/,0xFD7E/*176576*/,0x15C5/*012705*/,0x1A00/*015000*/,0x115F/*010537*/,0xFF78/*177570*/,0x1144/*010504*/,0x0C84/*006204*/,
0x0A00/*005000*/,0x1141/*010501*/,0x7204/*071004*/,0x1002/*010002*/,0x7084/*070204*/,0x60C1/*060301*/,0x2045/*020105*/,0x0301/*001401*/,
0x0000/*000000*/,0x7F0A/*077412*/,0x7F4F/*077517*/,0x15C0/*012700*/,0xC28B/*141213*/,0x1DC3/*016703*/,0xFD74/*176564*/,0x0A02/*005002*/,
0x0000/*000000*/,0x7F0A/*077412*/,0x7F4F/*077517*/,0x15C0/*012700*/,0xC298/*141230*/,0x1DC3/*016703*/,0xFD54/*176524*/,0x0A02/*005002*/,
0x7297/*071227*/,0x0008/*000010*/,0x65C3/*062703*/,0x0030/*000060*/,0x90E0/*110340*/,0x1083/*010203*/,0x02F8/*001370*/,0x09F7/*004767*/,
0xFD76/*176566*/,0x0087/*000207*/,0x15C3/*012703*/,0x7F06/*077406*/,0x0A02/*005002*/,0x0A01/*005001*/,0x15C0/*012700*/,0x0008/*000010*/,
0x10F1/*010361*/,0xF4C0/*172300*/,0x10B1/*010261*/,0xF4E0/*172340*/,0x10F1/*010361*/,0xF4D0/*172320*/,0x10B1/*010261*/,0xF4F0/*172360*/,
0x10F1/*010361*/,0xF480/*172200*/,0x10B1/*010261*/,0xF4A0/*172240*/,0x10F1/*010361*/,0xF490/*172220*/,0x10B1/*010261*/,0xF4B0/*172260*/,
0x10F1/*010361*/,0xFF80/*177600*/,0x10B1/*010261*/,0xFFA0/*177640*/,0x10F1/*010361*/,0xFF90/*177620*/,0x10F1/*010361*/,0xFFB0/*177660*/,
0x65C2/*062702*/,0x0080/*000200*/,0x65C1/*062701*/,0x0002/*000002*/,0x7E1D/*077035*/,0x55DF/*052737*/,0xFC00/*176000*/,0xF4FE/*172376*/,
0x55DF/*052737*/,0xFC00/*176000*/,0xF4BE/*172276*/,0x55DF/*052737*/,0xFC00/*176000*/,0xFFBE/*177676*/,0x15DF/*012737*/,0x003F/*000077*/,
0xF54E/*172516*/,0x15DF/*012737*/,0x0001/*000001*/,0xFF7A/*177572*/,0x15DF/*012737*/,0x03C0/*001700*/,0xF4A4/*172244*/,0x15DF/*012737*/,
0x03C0/*001700*/,0xF4B4/*172264*/,0x15DF/*012737*/,0x1000/*010000*/,0xFFFE/*177776*/,0x15C3/*012703*/,0x4080/*040200*/,0x15C2/*012702*/,
0xC384/*141604*/,0x14A6/*012246*/,0x0D93/*006623*/,0x2097/*020227*/,0xC428/*142050*/,0x87FB/*103773*/,0x15F7/*012767*/,0x4080/*040200*/,
0xFCCE/*176316*/,0x0087/*000207*/,0x15C0/*012700*/,0x001F/*000037*/,0x15C1/*012701*/,0xF800/*174000*/,0x35DF/*032737*/,0x0001/*000001*/,
0xFF78/*177570*/,0x030C/*001414*/,0x15C0/*012700*/,0x0F0F/*007417*/,0x1001/*010001*/,0x0A41/*005101*/,0x35DF/*032737*/,0x0002/*000002*/,
0xFF78/*177570*/,0x0304/*001404*/,0x15C0/*012700*/,0x3C73/*036163*/,0x15C1/*012701*/,0x3E00/*037000*/,0x1042/*010102*/,0xE5C2/*162702*/,
0x0002/*000002*/,0x45C2/*042702*/,0x0001/*000001*/,0x1083/*010203*/,0x45C3/*042703*/,0xFFC1/*177701*/,0x15F3/*012763*/,0x0001/*000001*/,
0x4000/*040000*/,0x65C3/*062703*/,0x0002/*000002*/,0x15F3/*012763*/,0x004B/*000113*/,0x4000/*040000*/,0x1084/*010204*/,0x7517/*072427*/,
0xFFFA/*177772*/,0x45C4/*042704*/,0xFF80/*177600*/,0x15C5/*012705*/,0x03C0/*001700*/,0xE105/*160405*/,0x1084/*010204*/,0x7517/*072427*/,
0xFFF4/*177764*/,0x45C4/*042704*/,0xFFF1/*177761*/,0x1174/*010564*/,0xF4A0/*172240*/,0x1043/*010103*/,0x74D7/*072327*/,0xFFF4/*177764*/,
0x45C3/*042703*/,0xFFF1/*177761*/,0x20C4/*020304*/,0x030A/*001412*/,0x1044/*010104*/,0x7517/*072427*/,0xFFFA/*177772*/,0x45C4/*042704*/,
0xFF80/*177600*/,0x15C5/*012705*/,0x03C0/*001700*/,0xE105/*160405*/,0x1173/*010563*/,0xF4A0/*172240*/,0x15C4/*012704*/,0x0003/*000003*/,
0x67C4/*063704*/,0xFF78/*177570*/,0x15C3/*012703*/,0x0002/*000002*/,0x61C3/*060703*/,0x004A/*000112*/,0x7F02/*077402*/,0x1002/*010002*/,
0x0C02/*006002*/,0x0C41/*006101*/,0x0C00/*006000*/,0x01C2/*000702*/,0x0A03/*005003*/,0x9481/*112201*/,0x0365/*001545*/,0xA057/*120127*/,
0x0020/*000040*/,0x03FB/*001773*/,0xA057/*120127*/,0x0052/*000122*/,0x0305/*001405*/,0x15C0/*012700*/,0xC270/*141160*/,0x09F7/*004767*/,
0xFC26/*176046*/,0x0087/*000207*/,0x9481/*112201*/,0x9480/*112200*/,0x030E/*001416*/,0xA017/*120027*/,0x0020/*000040*/,0x030B/*001413*/,
0xA017/*120027*/,0x0037/*000067*/,0x0619/*003031*/,0xE5C0/*162700*/,0x0030/*000060*/,0x0516/*002426*/,0x0CC3/*006303*/,0x0CC3/*006303*/,
0x0CC3/*006303*/,0x5003/*050003*/,0x01F0/*000760*/,0x0A02/*005002*/,0x15D2/*012722*/,0x005F/*000137*/,0x15D2/*012722*/,0xC000/*140000*/,
0x15D2/*012722*/,0xC000/*140000*/,0x0A12/*005022*/,0xA057/*120127*/,0x004B/*000113*/,0x033E/*001476*/,0xA057/*120127*/,0x004C/*000114*/,
0x0308/*001410*/,0xA057/*120127*/,0x0050/*000120*/,0x034F/*001517*/,0x15C0/*012700*/,0xC23F/*141077*/,0x09F7/*004767*/,0xFBD8/*175730*/,
0x0087/*000207*/,0x0005/*000005*/,0x00C3/*000303*/,0x15C1/*012701*/,0xF900/*174400*/,0x15F1/*012761*/,0x000B/*000013*/,0x0004/*000004*/,
0x55C3/*052703*/,0x0004/*000004*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x8A03/*105003*/,0x55C3/*052703*/,0x0008/*000010*/,
0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x1C42/*016102*/,0x0006/*000006*/,0x45C2/*042702*/,0x003F/*000077*/,0x0A82/*005202*/,
0x10B1/*010261*/,0x0004/*000004*/,0x8A03/*105003*/,0x55C3/*052703*/,0x0006/*000006*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,
0x0A31/*005061*/,0x0002/*000002*/,0x0A31/*005061*/,0x0004/*000004*/,0x15F1/*012761*/,0xFE00/*177000*/,0x0006/*000006*/,0x8A03/*105003*/,
0x55C3/*052703*/,0x000C/*000014*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x45C9/*042711*/,0x00FF/*000377*/,0x0A02/*005002*/,
0x0A03/*005003*/,0x0A04/*005004*/,0x0A05/*005005*/,0x0A07/*005007*/,0x0005/*000005*/,0x00C3/*000303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,
0x0CC3/*006303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x15C1/*012701*/,0xFF0A/*177412*/,0x10C9/*010311*/,0x0A21/*005041*/,0x15E1/*012741*/,
0xFE00/*177000*/,0x15E1/*012741*/,0x0005/*000005*/,0x0A02/*005002*/,0x0A03/*005003*/,0x0A04/*005004*/,0x0A05/*005005*/,0x8BC9/*105711*/,
0x80FE/*100376*/,0x8A09/*105011*/,0x0A07/*005007*/,0x0005/*000005*/,0x15C1/*012701*/,0xFDC0/*176700*/,0x15F1/*012761*/,0x0020/*000040*/,
0x0008/*000010*/,0x10F1/*010361*/,0x0008/*000010*/,0x15C9/*012711*/,0x0011/*000021*/,0x15F1/*012761*/,0x1000/*010000*/,0x001A/*000032*/,
0x15F1/*012761*/,0xFE00/*177000*/,0x0002/*000002*/,0x0A31/*005061*/,0x0004/*000004*/,0x0A31/*005061*/,0x0006/*000006*/,0x0A31/*005061*/,
0x001C/*000034*/,0x15C9/*012711*/,0x0039/*000071*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x8A09/*105011*/,0x10C0/*010300*/,0x0A07/*005007*/]
0xFD56/*176526*/,0x0087/*000207*/,0x0000/*000000*/,0x0A37/*005067*/,0xFFFA/*177772*/,0x0A37/*005067*/,0xFD34/*176464*/,0x0A05/*005005*/,
0x8104/*100404*/,0x8503/*102403*/,0x8202/*101002*/,0x0501/*002401*/,0x8301/*101401*/,0x0000/*000000*/,0x0AC5/*005305*/,0x8003/*100003*/,
0x0302/*001402*/,0x0401/*002001*/,0x0701/*003401*/,0x0000/*000000*/,0x0C05/*006005*/,0x8402/*102002*/,0x8601/*103001*/,0x0201/*001001*/,
0x0000/*000000*/,0x95DF/*112737*/,0x000F/*000017*/,0xFFFE/*177776*/,0x8004/*100004*/,0x8403/*102003*/,0x0502/*002402*/,0x8201/*101001*/,
0x8101/*100401*/,0x0000/*000000*/,0x15C3/*012703*/,0x7FFF/*077777*/,0x65C3/*062703*/,0x7FFF/*077777*/,0xA7D7/*123727*/,0xFFFE/*177776*/,
0x0005/*000005*/,0x0201/*001001*/,0x0000/*000000*/,0x95C4/*112704*/,0x03C0/*001700*/,0x8003/*100003*/,0x2117/*020427*/,0xFFC0/*177700*/,
0x0301/*001401*/,0x0000/*000000*/,0x8A04/*105004*/,0x2117/*020427*/,0xFF00/*177400*/,0x0301/*001401*/,0x0000/*000000*/,0x15C5/*012705*/,
0xAAAA/*125252*/,0x1140/*010500*/,0x1001/*010001*/,0x1042/*010102*/,0x1083/*010203*/,0x10C4/*010304*/,0x1105/*010405*/,0xE141/*160501*/,
0x0501/*002401*/,0x0301/*001401*/,0x0000/*000000*/,0x0C42/*006102*/,0x8601/*103001*/,0x0501/*002401*/,0x0000/*000000*/,0x6083/*060203*/,
0x0A83/*005203*/,0x0A43/*005103*/,0x60C1/*060301*/,0x8701/*103401*/,0x0701/*003401*/,0x0000/*000000*/,0x0C04/*006004*/,0x5103/*050403*/,
0x6143/*060503*/,0x0A83/*005203*/,0x8702/*103402*/,0x0AC1/*005301*/,0x0501/*002401*/,0x0000/*000000*/,0x0A40/*005100*/,0x8301/*101401*/,
0x0000/*000000*/,0x4001/*040001*/,0x6041/*060101*/,0x0601/*003001*/,0x0701/*003401*/,0x0000/*000000*/,0x00C1/*000301*/,0x2057/*020127*/,
0x5455/*052125*/,0x0204/*001004*/,0x3105/*030405*/,0x0602/*003002*/,0x0A45/*005105*/,0x0201/*001001*/,0x0000/*000000*/,0x95C0/*112700*/,
0xFF01/*177401*/,0x8001/*100001*/,0x0000/*000000*/,0x7E02/*077002*/,0x0A01/*005001*/,0x0A81/*005201*/,0x7E02/*077002*/,0x0BC0/*005700*/,
0x0202/*001002*/,0x0BC1/*005701*/,0x0301/*001401*/,0x0000/*000000*/,0x15C7/*012707*/,0xC3FE/*141776*/,0x0000/*000000*/,0x0BD7/*005727*/,
0x0000/*000000*/,0x15E6/*012746*/,0xC40A/*142012*/,0x0087/*000207*/,0x0000/*000000*/,0x0A26/*005046*/,0x15E6/*012746*/,0xC414/*142024*/,
0x0002/*000002*/,0x0000/*000000*/,0x005F/*000137*/,0xC41A/*142032*/,0x0000/*000000*/,0x15C5/*012705*/,0x0003/*000003*/,0x0A1F/*005037*/,
0x0006/*000006*/,0x15DF/*012737*/,0xC42C/*142054*/,0x0004/*000004*/,0x0BE5/*005745*/,0x0000/*000000*/,0x65C6/*062706*/,0x0004/*000004*/,
0x0A00/*005000*/,0x15C1/*012701*/,0x0FFF/*007777*/,0x1002/*010002*/,0x65C2/*062702*/,0x0005/*000005*/,0x2432/*022062*/,0xFFFB/*177773*/,
0x0302/*001402*/,0x0000/*000000*/,0x0000/*000000*/,0x7E49/*077111*/,0x0AB7/*005267*/,0xFEC8/*177310*/,0x8601/*103001*/,0x0000/*000000*/,
0x2DD7/*026727*/,0xFBFE/*175776*/,0x0480/*002200*/,0x8202/*101002*/,0x0077/*000167*/,0xFEC2/*177302*/,0x15C0/*012700*/,0xC2AC/*141254*/,
0x1DC3/*016703*/,0xFEB0/*177260*/,0x0A02/*005002*/,0x7297/*071227*/,0x0008/*000010*/,0x65C3/*062703*/,0x0030/*000060*/,0x90E0/*110340*/,
0x1083/*010203*/,0x02F8/*001370*/,0x09F7/*004767*/,0xFBF0/*175760*/,0x0087/*000207*/,0x15C3/*012703*/,0x7F06/*077406*/,0x0A02/*005002*/,
0x0A01/*005001*/,0x15C0/*012700*/,0x0008/*000010*/,0x10F1/*010361*/,0xF4C0/*172300*/,0x10B1/*010261*/,0xF4E0/*172340*/,0x10F1/*010361*/,
0xF4D0/*172320*/,0x10B1/*010261*/,0xF4F0/*172360*/,0x10F1/*010361*/,0xF480/*172200*/,0x10B1/*010261*/,0xF4A0/*172240*/,0x10F1/*010361*/,
0xF490/*172220*/,0x10B1/*010261*/,0xF4B0/*172260*/,0x10F1/*010361*/,0xFF80/*177600*/,0x10B1/*010261*/,0xFFA0/*177640*/,0x10F1/*010361*/,
0xFF90/*177620*/,0x10F1/*010361*/,0xFFB0/*177660*/,0x65C2/*062702*/,0x0080/*000200*/,0x65C1/*062701*/,0x0002/*000002*/,0x7E1D/*077035*/,
0x55DF/*052737*/,0xFC00/*176000*/,0xF4FE/*172376*/,0x55DF/*052737*/,0xFC00/*176000*/,0xF4BE/*172276*/,0x55DF/*052737*/,0xFC00/*176000*/,
0xFFBE/*177676*/,0x15DF/*012737*/,0x003F/*000077*/,0xF54E/*172516*/,0x15DF/*012737*/,0x0001/*000001*/,0xFF7A/*177572*/,0x15DF/*012737*/,
0x03C0/*001700*/,0xF4A4/*172244*/,0x15DF/*012737*/,0x03C0/*001700*/,0xF4B4/*172264*/,0x15DF/*012737*/,0x1000/*010000*/,0xFFFE/*177776*/,
0x15C3/*012703*/,0x4080/*040200*/,0x15C2/*012702*/,0xC50A/*142412*/,0x14A6/*012246*/,0x0D93/*006623*/,0x2097/*020227*/,0xC5AE/*142656*/,
0x87FB/*103773*/,0x15F7/*012767*/,0x4080/*040200*/,0xFB48/*175510*/,0x0087/*000207*/,0x15C0/*012700*/,0x001F/*000037*/,0x15C1/*012701*/,
0xF800/*174000*/,0x35DF/*032737*/,0x0001/*000001*/,0xFF78/*177570*/,0x030C/*001414*/,0x15C0/*012700*/,0x0F0F/*007417*/,0x1001/*010001*/,
0x0A41/*005101*/,0x35DF/*032737*/,0x0002/*000002*/,0xFF78/*177570*/,0x0304/*001404*/,0x15C0/*012700*/,0x3C73/*036163*/,0x15C1/*012701*/,
0x3E00/*037000*/,0x1042/*010102*/,0xE5C2/*162702*/,0x0002/*000002*/,0x45C2/*042702*/,0x0001/*000001*/,0x1083/*010203*/,0x45C3/*042703*/,
0xFFC1/*177701*/,0x15F3/*012763*/,0x0001/*000001*/,0x4000/*040000*/,0x65C3/*062703*/,0x0002/*000002*/,0x15F3/*012763*/,0x004B/*000113*/,
0x4000/*040000*/,0x1084/*010204*/,0x7517/*072427*/,0xFFFA/*177772*/,0x45C4/*042704*/,0xFF80/*177600*/,0x15C5/*012705*/,0x03C0/*001700*/,
0xE105/*160405*/,0x1084/*010204*/,0x7517/*072427*/,0xFFF4/*177764*/,0x45C4/*042704*/,0xFFF1/*177761*/,0x1174/*010564*/,0xF4A0/*172240*/,
0x1043/*010103*/,0x74D7/*072327*/,0xFFF4/*177764*/,0x45C3/*042703*/,0xFFF1/*177761*/,0x20C4/*020304*/,0x030A/*001412*/,0x1044/*010104*/,
0x7517/*072427*/,0xFFFA/*177772*/,0x45C4/*042704*/,0xFF80/*177600*/,0x15C5/*012705*/,0x03C0/*001700*/,0xE105/*160405*/,0x1173/*010563*/,
0xF4A0/*172240*/,0x15C4/*012704*/,0x0003/*000003*/,0x67C4/*063704*/,0xFF78/*177570*/,0x15C3/*012703*/,0x0002/*000002*/,0x61C3/*060703*/,
0x004A/*000112*/,0x7F02/*077402*/,0x1002/*010002*/,0x0C02/*006002*/,0x0C41/*006101*/,0x0C00/*006000*/,0x01C2/*000702*/,0x0A03/*005003*/,
0x9481/*112201*/,0x0365/*001545*/,0xA057/*120127*/,0x0020/*000040*/,0x03FB/*001773*/,0xA057/*120127*/,0x0052/*000122*/,0x0305/*001405*/,
0x15C0/*012700*/,0xC27D/*141175*/,0x09F7/*004767*/,0xFAA0/*175240*/,0x0087/*000207*/,0x9481/*112201*/,0x9480/*112200*/,0x030E/*001416*/,
0xA017/*120027*/,0x0020/*000040*/,0x030B/*001413*/,0xA017/*120027*/,0x0037/*000067*/,0x0619/*003031*/,0xE5C0/*162700*/,0x0030/*000060*/,
0x0516/*002426*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x5003/*050003*/,0x01F0/*000760*/,0x0A02/*005002*/,0x15D2/*012722*/,
0x005F/*000137*/,0x15D2/*012722*/,0xC000/*140000*/,0x15D2/*012722*/,0xC000/*140000*/,0x0A12/*005022*/,0xA057/*120127*/,0x004B/*000113*/,
0x033E/*001476*/,0xA057/*120127*/,0x004C/*000114*/,0x0308/*001410*/,0xA057/*120127*/,0x0050/*000120*/,0x034F/*001517*/,0x15C0/*012700*/,
0xC24C/*141114*/,0x09F7/*004767*/,0xFA52/*175122*/,0x0087/*000207*/,0x0005/*000005*/,0x00C3/*000303*/,0x15C1/*012701*/,0xF900/*174400*/,
0x15F1/*012761*/,0x000B/*000013*/,0x0004/*000004*/,0x55C3/*052703*/,0x0004/*000004*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,
0x8A03/*105003*/,0x55C3/*052703*/,0x0008/*000010*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x1C42/*016102*/,0x0006/*000006*/,
0x45C2/*042702*/,0x003F/*000077*/,0x0A82/*005202*/,0x10B1/*010261*/,0x0004/*000004*/,0x8A03/*105003*/,0x55C3/*052703*/,0x0006/*000006*/,
0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x0A31/*005061*/,0x0002/*000002*/,0x0A31/*005061*/,0x0004/*000004*/,0x15F1/*012761*/,
0xFE00/*177000*/,0x0006/*000006*/,0x8A03/*105003*/,0x55C3/*052703*/,0x000C/*000014*/,0x10C9/*010311*/,0x8BC9/*105711*/,0x80FE/*100376*/,
0x45C9/*042711*/,0x00FF/*000377*/,0x0A02/*005002*/,0x0A03/*005003*/,0x0A04/*005004*/,0x0A05/*005005*/,0x0A07/*005007*/,0x0005/*000005*/,
0x00C3/*000303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x0CC3/*006303*/,0x15C1/*012701*/,0xFF0A/*177412*/,
0x10C9/*010311*/,0x0A21/*005041*/,0x15E1/*012741*/,0xFE00/*177000*/,0x15E1/*012741*/,0x0005/*000005*/,0x0A02/*005002*/,0x0A03/*005003*/,
0x0A04/*005004*/,0x0A05/*005005*/,0x8BC9/*105711*/,0x80FE/*100376*/,0x8A09/*105011*/,0x0A07/*005007*/,0x0005/*000005*/,0x15C1/*012701*/,
0xFDC0/*176700*/,0x15F1/*012761*/,0x0020/*000040*/,0x0008/*000010*/,0x10F1/*010361*/,0x0008/*000010*/,0x15C9/*012711*/,0x0011/*000021*/,
0x15F1/*012761*/,0x1000/*010000*/,0x001A/*000032*/,0x15F1/*012761*/,0xFE00/*177000*/,0x0002/*000002*/,0x0A31/*005061*/,0x0004/*000004*/,
0x0A31/*005061*/,0x0006/*000006*/,0x0A31/*005061*/,0x001C/*000034*/,0x15C9/*012711*/,0x0039/*000071*/,0x8BC9/*105711*/,0x80FE/*100376*/,
0x8A09/*105011*/,0x10C0/*010300*/,0x0A07/*005007*/]
}

View file

@ -174,13 +174,14 @@ CMD:
RTI
CMDTBL: .WORD BOOT,HALT,TEST,LIGHTS,HELP
HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, LIGHTS, TEST AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
CMDTBL: .WORD BOOT,HALT,TEST,DIAG,LIGHTS,HELP
HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, TEST, DIAG, LIGHTS AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
EOL: .BYTE 15,12,0
DEL: .BYTE 10,40,10,0
CMDLST: .ASCIZ 'BOOT'
.ASCIZ 'HALT'
.ASCIZ 'TEST'
.ASCIZ 'DIAG'
.ASCIZ 'LIGHTS'
.ASCIZ 'HELP'
.BYTE 0
@ -190,6 +191,7 @@ BANNER: .ASCIZ 'PDP-11 MONITOR V1.0'<12><15><12><15>
PROMPT: .ASCIZ 'BOOT> '
BADBOO: .ASCIZ 'UNKNOWN BOOT DEVICE'<12><15>
PERMSG: .ASCIZ ' CLOCK TICKS'<12><15>
LOOMSG: .ASCIZ ' ITERATIONS'<12><15>
.EVEN
@ -236,6 +238,179 @@ TEST:
JSR PC,PRINT
RTS PC
LOOCNT: .WORD 0
DIAG:
CLR LOOCNT
CLR CLKTIC
DIAGLP:
CLR R5
BMI L1
BVS L1
BHI L1
BLT L1
BLOS L2
L1: HALT
L2: DEC R5
BPL L3
BEQ L3
BGE L3
BLE L4
L3: HALT
L4: ROR R5
BVC L5
BCC L5
BNE L6
L5: HALT
L6: MOVB #17,@#177776
BPL L7
BVC L7
BLT L7
BHI L7
BMI L8
L7: HALT
L8: MOV #77777,R3
ADD #77777,R3
CMPB @#177776,#5
BNE L9
HALT
L9: MOVB #1700,R4
BPL L10
CMP R4,#177700
BEQ L11
L10: HALT
L11: CLRB R4
CMP R4,#177400
BEQ L12
HALT
L12: MOV #125252,R5
MOV R5,R0
MOV R0,R1
MOV R1,R2
MOV R2,R3
MOV R3,R4
MOV R4,R5
SUB R5,R1
BLT NODIAG
BEQ L13
NODIAG: HALT
L13: ROL R2
BCC L14
BLT L15
L14: HALT
L15: ADD R2,R3
INC R3
COM R3
ADD R3,R1
BCS L16
BLE L17
L16: HALT
L17: ROR R4
BIS R4,R3
ADD R5,R3
INC R3
BCS L18
DEC R1
BLT L19
L18: HALT
L19: COM R0
BLOS L20
HALT
L20: BIC R0,R1
ADD R1,R1
BGT L21
BLE L22
L21: HALT
L22: SWAB R1
CMP R1,#052125
BNE L23
BIT R4,R5
BGT L23
COM R5
BNE L24
L23: HALT
L24: MOVB #177401,R0
BPL L26
L25: HALT
L26: SOB R0,L25
CLR R1
L27: INC R1
SOB R0,L27
TST R0
BNE L28
TST R1
BEQ L29
L28: HALT
L29: MOV #N1,PC
HALT
N1: TST (PC)+
HALT
N2: MOV #N3,-(SP)
RTS PC
HALT
N3: CLR -(SP)
MOV #N4,-(SP)
RTI
HALT
N4: JMP @#N5
HALT
N5: MOV #3,R5
CLR @#6
MOV #N6,@#4
TST -(R5)
HALT
N6: ADD #4,SP
CLR R0
MOV #7777,R1
N7: MOV R0,R2
ADD #5,R2
CMP (R0)+,-5(R2)
BEQ N8
HALT
D1: .WORD 0
N8: SOB R1,N7
INC LOOCNT
BCC 10$
HALT
10$: CMP CLKTIC,#2200
BHI 20$
JMP DIAGLP
20$: MOV #LOOMSG+5,R0
MOV LOOCNT,R3
25$: CLR R2
DIV #10,R2
ADD #'0,R3
MOVB R3,-(R0)
MOV R2,R3
BNE 25$
JSR PC,PRINT
RTS PC
MMR0=177572
MMR1=177574

View file

@ -16,13 +16,13 @@
16 140002 005037 177776 CLR @#PSW
17 140006 012706 140000 MOV #START,SP
18 140012 005037 177564 CLR @#DL11XCSR ; CLEAR THE XCSR
19 140016 012700 141121 MOV #BANNER,R0
19 140016 012700 141136 MOV #BANNER,R0
20 140022 004767 140150' JSR PC,PRINT
21 140026 012737 140124 000100 MOV #CLKAST,@#KW11VEC
22 140034 012737 000340 000102 MOV #340,@#KW11VEC+2
23 140042 052737 000100 177546 BIS #100,@#KW11LKS ; SET CLOCK TICKING
24
25 140050 012700 141151 MOV #PROMPT,R0
25 140050 012700 141166 MOV #PROMPT,R0
26 140054 004767 140150' JSR PC,PRINT
27 140060 162706 000256 SUB #256,SP
28 140064 010600 MOV SP,R0
@ -92,7 +92,7 @@
92 140330 005767 140242' 2$: TST LENGTH ; DATA IN BUFFER?
93 140334 001406 BEQ 3$
94 140336 005367 140242' DEC LENGTH ; LENGTH
95 140342 012700 141037 MOV #DEL,R0
95 140342 012700 141047 MOV #DEL,R0
96 140346 004767 140150' JSR PC,PRINT
97 140352 000453 3$: BR 9$
98 140354 120027 000040 4$: CMPB R0,#40
@ -130,12 +130,12 @@
130 140516 010246 MOV R2,-(SP)
131 140520 010346 MOV R3,-(SP)
132 140522 010446 MOV R4,-(SP)
133 140524 012700 141034 MOV #EOL,R0
133 140524 012700 141044 MOV #EOL,R0
134 140530 004767 140150' JSR PC,PRINT
135 140534 132737 000100 177564 1$: BITB #100,@#177564
136 140542 001374 BNE 1$
137 140544 005004 CLR R4
138 140546 012703 141043 MOV #CMDLST,R3 ; CMD LIST
138 140546 012703 141053 MOV #CMDLST,R3 ; CMD LIST
139 140552 112300 3$: MOVB (R3)+,R0
140 140554 001431 BEQ 13$
141 140556 016702 140240' MOV BUFFER,R2 ; USER CMD
@ -160,11 +160,11 @@
160 140632 004774 140700 JSR PC,@CMDTBL(R4) ; EXECUTE
161 140636 000404 BR 15$
162
163 140640 012700 141077 13$: MOV #UNKMSG,R0
163 140640 012700 141114 13$: MOV #UNKMSG,R0
164 140644 004767 140150' JSR PC,PRINT
165
166 140650 005067 140242' 15$: CLR LENGTH
167 140654 012700 141151 MOV #PROMPT,R0
167 140654 012700 141166 MOV #PROMPT,R0
168 140660 004767 140150' JSR PC,PRINT
169 140664 012604 MOV (SP)+,R4
170 140666 012603 MOV (SP)+,R3
@ -174,360 +174,544 @@
174 140676 000002 RTI
175
176
177 140700 142050 141244 141260 CMDTBL: .WORD BOOT,HALT,TEST,LIGHTS,HELP
140706 141364 141232
178 140712 103 117 115 HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, LIGHTS, TEST AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
140715 115 101 116
140720 104 123 040
140723 101 122 105
140726 040 102 117
140731 117 124 054
140734 040 110 101
140737 114 124 054
140742 040 114 111
140745 107 110 124
140750 123 054 040
140753 124 105 123
140756 124 040 101
140761 116 104 040
140764 110 105 114
140767 120 015 012
140772 102 117 117
140775 124 040 104
141000 105 126 111
141003 103 105 123
141006 040 101 122
141011 105 040 122
141014 113 077 040
141017 122 114 077
141022 040 117 122
141025 040 122 120
141030 077 015 012
141033 000
179 141034 015 012 000 EOL: .BYTE 15,12,0
180 141037 010 040 010 DEL: .BYTE 10,40,10,0
141042 000
181 141043 102 117 117 CMDLST: .ASCIZ 'BOOT'
141046 124 000
182 141050 110 101 114 .ASCIZ 'HALT'
141053 124 000
183 141055 124 105 123 .ASCIZ 'TEST'
141060 124 000
184 141062 114 111 107 .ASCIZ 'LIGHTS'
141065 110 124 123
141070 000
185 141071 110 105 114 .ASCIZ 'HELP'
141074 120 000
186 141076 000 .BYTE 0
187 141077 125 116 113 UNKMSG: .ASCIZ 'UNKNOWN COMMAND'<12><15>
141102 116 117 127
141105 116 040 103
141110 117 115 115
141113 101 116 104
141116 012 015 000
188 141121 120 104 120 BANNER: .ASCIZ 'PDP-11 MONITOR V1.0'<12><15><12><15>
141124 055 061 061
141127 040 115 117
141132 116 111 124
141135 117 122 040
141140 126 061 056
141143 060 012 015
141146 012 015 000
189 ; 'ADAPTED FROM CODE BY PAUL NANKERVIS <PAULNANK@HOTMAIL.COM>'<12><15><12><15>
190 141151 102 117 117 PROMPT: .ASCIZ 'BOOT> '
141154 124 076 040
141157 000
191 141160 125 116 113 BADBOO: .ASCIZ 'UNKNOWN BOOT DEVICE'<12><15>
141163 116 117 127
141166 116 040 102
141171 117 117 124
141174 040 104 105
141177 126 111 103
141202 105 012 015
141205 000
192 141206 040 040 040 PERMSG: .ASCIZ ' CLOCK TICKS'<12><15>
141211 040 040 040
141214 103 114 117
141217 103 113 040
141222 124 111 103
141225 113 123 012
141230 015 000
193
194 .EVEN
177 140700 142656 141304 141320 CMDTBL: .WORD BOOT,HALT,TEST,DIAG,LIGHTS,HELP
140706 141426 142172 141272
178 140714 103 117 115 HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, TEST, DIAG, LIGHTS AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
140717 115 101 116
140722 104 123 040
140725 101 122 105
140730 040 102 117
140733 117 124 054
140736 040 110 101
140741 114 124 054
140744 040 124 105
140747 123 124 054
140752 040 104 111
140755 101 107 054
140760 040 114 111
140763 107 110 124
140766 123 040 101
140771 116 104 040
140774 110 105 114
140777 120 015 012
141002 102 117 117
141005 124 040 104
141010 105 126 111
141013 103 105 123
141016 040 101 122
141021 105 040 122
141024 113 077 040
141027 122 114 077
141032 040 117 122
141035 040 122 120
141040 077 015 012
141043 000
179 141044 015 012 000 EOL: .BYTE 15,12,0
180 141047 010 040 010 DEL: .BYTE 10,40,10,0
141052 000
181 141053 102 117 117 CMDLST: .ASCIZ 'BOOT'
141056 124 000
182 141060 110 101 114 .ASCIZ 'HALT'
141063 124 000
183 141065 124 105 123 .ASCIZ 'TEST'
141070 124 000
184 141072 104 111 101 .ASCIZ 'DIAG'
141075 107 000
185 141077 114 111 107 .ASCIZ 'LIGHTS'
141102 110 124 123
141105 000
186 141106 110 105 114 .ASCIZ 'HELP'
141111 120 000
187 141113 000 .BYTE 0
188 141114 125 116 113 UNKMSG: .ASCIZ 'UNKNOWN COMMAND'<12><15>
141117 116 117 127
141122 116 040 103
141125 117 115 115
141130 101 116 104
141133 012 015 000
189 141136 120 104 120 BANNER: .ASCIZ 'PDP-11 MONITOR V1.0'<12><15><12><15>
141141 055 061 061
141144 040 115 117
141147 116 111 124
141152 117 122 040
141155 126 061 056
141160 060 012 015
141163 012 015 000
190 ; 'ADAPTED FROM CODE BY PAUL NANKERVIS <PAULNANK@HOTMAIL.COM>'<12><15><12><15>
191 141166 102 117 117 PROMPT: .ASCIZ 'BOOT> '
141171 124 076 040
141174 000
192 141175 125 116 113 BADBOO: .ASCIZ 'UNKNOWN BOOT DEVICE'<12><15>
141200 116 117 127
141203 116 040 102
141206 117 117 124
141211 040 104 105
141214 126 111 103
141217 105 012 015
141222 000
193 141223 040 040 040 PERMSG: .ASCIZ ' CLOCK TICKS'<12><15>
141226 040 040 040
141231 103 114 117
141234 103 113 040
141237 124 111 103
141242 113 123 012
141245 015 000
194 141247 040 040 040 LOOMSG: .ASCIZ ' ITERATIONS'<12><15>
141252 040 040 040
141255 111 124 105
141260 122 101 124
141263 111 117 116
141266 123 012 015
141271 000
195
196 HELP:
197 141232 012700 140712 MOV #HLPMSG,R0
198 141236 004767 140150' JSR PC,PRINT
199 141242 000207 RTS PC
200
201 HALT:
202 141244 000000 HALT
203 141246 012700 141034 MOV #EOL,R0
204 141252 004767 140150' JSR PC,PRINT
205 141256 000207 RTS PC
206
207 TEST:
208 141260 005067 140122' CLR CLKTIC
209
210 141264 012705 015000 MOV #15000,R5
211 141270 010537 177570 10$: MOV R5,@#177570 ; DISPLAY
212 141274 010504 MOV R5,R4
213 141276 006204 ASR R4
214 141300 005000 15$: CLR R0
215 141302 010501 MOV R5,R1
216 141304 071004 DIV R4,R0
217 141306 010002 MOV R0,R2
218 141310 070204 MUL R4,R2
219 141312 060301 ADD R3,R1
220 141314 020105 CMP R1,R5
221 141316 001401 BEQ 20$
222 141320 000000 HALT
223 141322 077412 20$: SOB R4,15$
224 141324 077517 SOB R5,10$
225
226 141326 012700 141213 MOV #PERMSG+5,R0
227 141332 016703 140122' MOV CLKTIC,R3
228
229 141336 005002 25$: CLR R2
230 141340 071227 000010 DIV #10,R2
231 141344 062703 000060 ADD #'0,R3
232 141350 110340 MOVB R3,-(R0)
233 141352 010203 MOV R2,R3
234 141354 001370 BNE 25$
235
236 141356 004767 140150' JSR PC,PRINT
237 141362 000207 RTS PC
238
239
240 177572 MMR0=177572
241 177574 MMR1=177574
242 177576 MMR2=177576
243 172516 MMR3=172516
244
245 LIGHTS:
246 141364 012703 077406 MOV #77406,R3 ; DEFAULT PDR
247 141370 005002 CLR R2
248 141372 005001 CLR R1
249 141374 012700 000010 MOV #8.,R0
250 141400 010361 172300 1$: MOV R3,172300(R1) ; KERNEL I PDR
251 141404 010261 172340 MOV R2,172340(R1) ; KERNEL I PAR
252 141410 010361 172320 MOV R3,172320(R1) ; KERNEL D PDR
253 141414 010261 172360 MOV R2,172360(R1) ; KERNEL D PAR
254 141420 010361 172200 MOV R3,172200(R1) ; SUPER I PDR
255 141424 010261 172240 MOV R2,172240(R1) ; SUPER I PAR
256 141430 010361 172220 MOV R3,172220(R1) ; SUPER D PDR
257 141434 010261 172260 MOV R2,172260(R1) ; SUPER D PAR
258 141440 010361 177600 MOV R3,177600(R1) ; USER I PDR
259 141444 010261 177640 MOV R2,177640(R1) ; USER I PAR
260 141450 010361 177620 MOV R3,177620(R1) ; USER D PDR
261 141454 010361 177660 MOV R3,177660(R1) ; USER D PAR
262 141460 062702 000200 ADD #200,R2
263 141464 062701 000002 ADD #2,R1
264 141470 077035 SOB R0,1$
265 141472 052737 176000 172376 BIS #176000,@#172376 ; KERNEL D POINTS TO I/O SPACE
266 141500 052737 176000 172276 BIS #176000,@#172276 ; SUPER D POINTS TO I/O SPACE
267 141506 052737 176000 177676 BIS #176000,@#177676 ; USER D POINTS TO I/O SPACE
268 141514 012737 000077 172516 MOV #77,@#MMR3 ; 77 FOR 22 BIT
269 141522 012737 000001 177572 MOV #1,@#MMR0
270
271 141530 012737 001700 172244 MOV #1700,@#172244 ; BASE SUPER I (PAR 2) #40000 AT #170000
272 141536 012737 001700 172264 MOV #1700,@#172264 ; BASE SUPER D (PAR 2) #40000 AT #170000
273 141544 012737 010000 177776 MOV #010000,@#177776 ; SET PM TO SUPER
274
275 141552 012703 040200 MOV #40200,R3 ; SUPER CODE ADDRESS
276 141556 012702 141604 MOV #SUPERS,R2 ; ADDRESS SUPER CODE
277 141562 012246 10$: MOV (R2)+,-(SP)
278 141564 006623 MTPI (R3)+
279 141566 020227 142050 CMP R2,#SUPERE
280 141572 103773 BLO 10$
196 .EVEN
197
198 HELP:
199 141272 012700 140714 MOV #HLPMSG,R0
200 141276 004767 140150' JSR PC,PRINT
201 141302 000207 RTS PC
202
203 HALT:
204 141304 000000 HALT
205 141306 012700 141044 MOV #EOL,R0
206 141312 004767 140150' JSR PC,PRINT
207 141316 000207 RTS PC
208
209 TEST:
210 141320 005067 140122' CLR CLKTIC
211
212 141324 012705 015000 MOV #15000,R5
213 141330 010537 177570 10$: MOV R5,@#177570 ; DISPLAY
214 141334 010504 MOV R5,R4
215 141336 006204 ASR R4
216 141340 005000 15$: CLR R0
217 141342 010501 MOV R5,R1
218 141344 071004 DIV R4,R0
219 141346 010002 MOV R0,R2
220 141350 070204 MUL R4,R2
221 141352 060301 ADD R3,R1
222 141354 020105 CMP R1,R5
223 141356 001401 BEQ 20$
224 141360 000000 HALT
225 141362 077412 20$: SOB R4,15$
226 141364 077517 SOB R5,10$
227
228 141366 012700 141230 MOV #PERMSG+5,R0
229 141372 016703 140122' MOV CLKTIC,R3
230
231 141376 005002 25$: CLR R2
232 141400 071227 000010 DIV #10,R2
233 141404 062703 000060 ADD #'0,R3
234 141410 110340 MOVB R3,-(R0)
235 141412 010203 MOV R2,R3
236 141414 001370 BNE 25$
237
238 141416 004767 140150' JSR PC,PRINT
239 141422 000207 RTS PC
240
241 141424 000000 LOOCNT: .WORD 0
242
243 DIAG:
244 141426 005067 141424' CLR LOOCNT
245 141432 005067 140122' CLR CLKTIC
246 DIAGLP:
247 141436 005005 CLR R5
248 141440 100404 BMI L1
249 141442 102403 BVS L1
250 141444 101002 BHI L1
251 141446 002401 BLT L1
252 141450 101401 BLOS L2
253 141452 000000 L1: HALT
254
255 141454 005305 L2: DEC R5
256 141456 100003 BPL L3
257 141460 001402 BEQ L3
258 141462 002001 BGE L3
259 141464 003401 BLE L4
260 141466 000000 L3: HALT
261
262 141470 006005 L4: ROR R5
263 141472 102002 BVC L5
264 141474 103001 BCC L5
265 141476 001001 BNE L6
266 141500 000000 L5: HALT
267
268 141502 112737 000017 177776 L6: MOVB #17,@#177776
269 141510 100004 BPL L7
270 141512 102003 BVC L7
271 141514 002402 BLT L7
272 141516 101001 BHI L7
273 141520 100401 BMI L8
274 141522 000000 L7: HALT
275
276 141524 012703 077777 L8: MOV #77777,R3
277 141530 062703 077777 ADD #77777,R3
278 141534 123727 177776 000005 CMPB @#177776,#5
279 141542 001001 BNE L9
280 141544 000000 HALT
281
282 141574 012767 040200 140120' MOV #40200,LGHTON ; CHANGE IDLE TASK
283 141602 000207 RTS PC
284
285 ;
286 ; TO BE COPIED TO SUPER #40200 AT PHYSICAL #170000
287 ; #40000 TO #40200 FOR WAIT & JMP INSTRUCTIONS
288 ;
289 SUPERS:
290 141604 012700 000037 MOV #37,R0 ; LOAD PATTERN
291 141610 012701 174000 MOV #174000,R1
292 141614 032737 000001 177570 BIT #1,@#177570
293 141622 001414 BEQ 10$
294 141624 012700 007417 MOV #7417,R0
295 141630 010001 MOV R0,R1
296 141632 005101 COM R1
297 141634 032737 000002 177570 BIT #2,@#177570
298 141642 001404 BEQ 10$
299 141644 012700 036163 MOV #36163,R0
300 141650 012701 037000 MOV #37000,R1
301 141654 010102 10$: MOV R1,R2
302 141656 162702 000002 SUB #2,R2
303 141662 042702 000001 BIC #1,R2 ; WAIT ADDRESS
304 141666 010203 MOV R2,R3
305 141670 042703 177701 BIC #177701,R3 ; ADDRESS OFFSET
306 141674 012763 000001 040000 MOV #0000001,40000(R3) ; WRITE WAIT
307 141702 062703 000002 ADD #2,R3
308 141706 012763 000113 040000 MOV #0000113,40000(R3) ; WRITE JMP (R3)
282 141546 112704 001700 L9: MOVB #1700,R4
283 141552 100003 BPL L10
284 141554 020427 177700 CMP R4,#177700
285 141560 001401 BEQ L11
286 141562 000000 L10: HALT
287
288 141564 105004 L11: CLRB R4
289 141566 020427 177400 CMP R4,#177400
290 141572 001401 BEQ L12
291 141574 000000 HALT
292
293 141576 012705 125252 L12: MOV #125252,R5
294 141602 010500 MOV R5,R0
295 141604 010001 MOV R0,R1
296 141606 010102 MOV R1,R2
297 141610 010203 MOV R2,R3
298 141612 010304 MOV R3,R4
299 141614 010405 MOV R4,R5
300 141616 160501 SUB R5,R1
301 141620 002401 BLT NODIAG
302 141622 001401 BEQ L13
303 141624 000000 NODIAG: HALT
304
305 141626 006102 L13: ROL R2
306 141630 103001 BCC L14
307 141632 002401 BLT L15
308 141634 000000 L14: HALT
309
310 141714 010204 MOV R2,R4
311 141716 072427 177772 ASH #-6,R4
312 141722 042704 177600 BIC #177600,R4
313 141726 012705 001700 MOV #1700,R5
314 141732 160405 SUB R4,R5 ; PAR ADDRESS BASE FOR WAIT
315 141734 010204 MOV R2,R4
316 141736 072427 177764 ASH #-12.,R4
317 141742 042704 177761 BIC #177761,R4 ; PAR SELECT OFFSET
318 141746 010564 172240 MOV R5,172240(R4) ; SUPER I SPACE
319
320 141752 010103 MOV R1,R3
321 141754 072327 177764 ASH #-12.,R3
322 141760 042703 177761 BIC #177761,R3 ; PAR SELECT OFFSET
323 141764 020304 CMP R3,R4 ; SAME PAR
324 141766 001412 BEQ 30$
325 141770 010104 MOV R1,R4
326 141772 072427 177772 ASH #-6,R4
327 141776 042704 177600 BIC #177600,R4
328 142002 012705 001700 MOV #1700,R5
329 142006 160405 SUB R4,R5 ; PAR ADDRESS BASE FOR JMP
330 142010 010563 172240 MOV R5,172240(R3) ; SUPER I SPACE
331 30$:
332 142014 012704 000003 MOV #3,R4
333 142020 063704 177570 ADD @#177570,R4
334 142024 012703 000002 MOV #2,R3
335 142030 060703 ADD PC,R3
336 142032 000112 40$: JMP (R2)
337 142034 077402 SOB R4,40$
338 142036 010002 MOV R0,R2
339 142040 006002 ROR R2 ; ROTATE PATTERN
340 142042 006101 ROL R1
341 142044 006000 ROR R0
342 142046 000702 BR 10$
343 SUPERE:
344
345 BOOT:
346 142050 005003 CLR R3 ; UNIT
347 142052 112201 1$: MOVB (R2)+,R1
348 142054 001545 BEQ BOOTRK ; DEFAULT DEVICE IS RK0
349 142056 120127 000040 CMPB R1,#40
350 142062 001773 BEQ 1$
351 142064 120127 000122 CMPB R1,#'R
352 142070 001405 BEQ 5$
353
354 142072 012700 141160 MOV #BADBOO,R0
355 142076 004767 140150' JSR PC,PRINT
356 142102 000207 RTS PC
357
358 142104 112201 5$: MOVB (R2)+,R1 ; HOPEFULLY K, L OR P
359 142106 112200 7$: MOVB (R2)+,R0 ; DIGIT
360 142110 001416 BEQ 9$
361 142112 120027 000040 CMPB R0,#40
362 142116 001413 BEQ 9$
363 142120 120027 000067 CMPB R0,#'7
364 142124 003031 BGT 11$
365 142126 162700 000060 SUB #'0,R0
366 142132 002426 BLT 11$
367 142134 006303 ASL R3
368 142136 006303 ASL R3
369 142140 006303 ASL R3
370 142142 050003 BIS R0,R3 ; PUT DIGIT INTO UNIT
371 142144 000760 BR 7$
372 142146 005002 9$: CLR R2
373 142150 012722 000137 MOV #137,(R2)+ ; STORE "JMP @#140000" INSTRUCTION AT ADDRESS 0
374 142154 012722 140000 MOV #START,(R2)+
375 142160 012722 140000 MOV #START,(R2)+ ; STORE #140000 IN VECTOR 4, IN CASE OF TRAP TO 4
376 142164 005022 CLR (R2)+
377 142166 120127 000113 CMPB R1,#'K
378 142172 001476 BEQ BOOTRK
379 142174 120127 000114 CMPB R1,#'L
380 142200 001410 BEQ BOOTRL
381 142202 120127 000120 CMPB R1,#'P
382 142206 001517 BEQ BOOTRP
383
384 142210 012700 141077 11$: MOV #UNKMSG,R0
385 142214 004767 140150' JSR PC,PRINT
386 142220 000207 RTS PC
387
388 174400 RLCS=174400
389 BOOTRL:
390 142222 000005 RESET
391 142224 000303 SWAB R3 ; UNIT NUMBER
392 142226 012701 174400 MOV #RLCS,R1 ; CSR
393 142232 012761 000013 000004 MOV #13,4(R1) ; CLR ERR
394 142240 052703 000004 BIS #4,R3 ; UNIT+GSTAT
395 142244 010311 MOV R3,(R1) ; ISSUE CMD
396 142246 105711 TSTB (R1) ; WAIT
397 142250 100376 BPL .-2
398 142252 105003 CLRB R3
399 142254 052703 000010 BIS #10,R3 ; UNIT+RDHDR
400 142260 010311 MOV R3,(R1) ; ISSUE CMD
401 142262 105711 TSTB (R1) ; WAIT
402 142264 100376 BPL .-2
403 142266 016102 000006 MOV 6(R1),R2 ; GET HDR
404 142272 042702 000077 BIC #77,R2 ; CLR SECTOR
405 142276 005202 INC R2 ; MAGIC BIT
406 142300 010261 000004 MOV R2,4(R1) ; SEEK TO 0
407 142304 105003 CLRB R3
408 142306 052703 000006 BIS #6,R3 ; UNIT+SEEK
409 142312 010311 MOV R3,(R1) ; ISSUE CMD
410 142314 105711 TSTB (R1) ; WAIT
411 142316 100376 BPL .-2
412 142320 005061 000002 CLR 2(R1) ; CLR BA
413 142324 005061 000004 CLR 4(R1) ; CLR DA
414 142330 012761 177000 000006 MOV #-512.,6(R1) ; SET WC
415 142336 105003 CLRB R3
416 142340 052703 000014 BIS #14,R3 ; UNIT+READ
417 142344 010311 MOV R3,(R1) ; ISSUE CMD
418 142346 105711 TSTB (R1) ; WAIT
419 142350 100376 BPL .-2
420 142352 042711 000377 BIC #377,(R1)
421 142356 005002 CLR R2
422 142360 005003 CLR R3
423 142362 005004 CLR R4
424 142364 005005 CLR R5
425 142366 005007 CLR PC
426
427 177412 RKDA=177412
428 000005 READGO=5
429 BOOTRK:
430 142370 000005 RESET
431 142372 000303 SWAB R3 ; UNIT NUMBER
432 142374 006303 ASL R3
433 142376 006303 ASL R3
434 142400 006303 ASL R3
435 142402 006303 ASL R3
436 142404 006303 ASL R3
437 142406 012701 177412 MOV #RKDA,R1 ; CSR
438 142412 010311 MOV R3,(R1) ; LOAD DA
439 142414 005041 CLR -(R1) ; CLEAR BA
440 142416 012741 177000 MOV #-256.*2,-(R1) ; LOAD WC
441 142422 012741 000005 MOV #READGO,-(R1) ; READ & GO
442 142426 005002 CLR R2
443 142430 005003 CLR R3
444 142432 005004 CLR R4
445 142434 005005 CLR R5
446 142436 105711 TSTB (R1)
447 142440 100376 BPL .-2
448 142442 105011 CLRB (R1)
449 142444 005007 CLR PC
450
451 176700 RPCSR=0176700
452 BOOTRP:
453 142446 000005 RESET
454 142450 012701 176700 MOV #RPCSR, R1
455 142454 012761 000040 000010 MOV #0000040, 10(R1) ; RESET
456 142462 010361 000010 MOV R3, 10(R1) ; SET UNIT
457 142466 012711 000021 MOV #0000021, (R1) ; PACK ACK
458 142472 012761 010000 000032 MOV #0010000, 32(R1) ; 16B MODE
459 142500 012761 177000 000002 MOV #-512., 2(R1) ; SET WC
460 142506 005061 000004 CLR 4(R1) ; CLR BA
461 142512 005061 000006 CLR 6(R1) ; CLR DA
462 142516 005061 000034 CLR 34(R1) ; CLR CYL
463 142522 012711 000071 MOV #0000071, (R1) ; READ
464 142526 105711 TSTB (R1) ; WAIT
465 142530 100376 BPL .-2
466 142532 105011 CLRB (R1)
467 142534 010300 MOV R3,R0
468 142536 005007 CLR PC
469
470 .END START
470
310 141636 060203 L15: ADD R2,R3
311 141640 005203 INC R3
312 141642 005103 COM R3
313 141644 060301 ADD R3,R1
314 141646 103401 BCS L16
315 141650 003401 BLE L17
316 141652 000000 L16: HALT
317
318 141654 006004 L17: ROR R4
319 141656 050403 BIS R4,R3
320 141660 060503 ADD R5,R3
321 141662 005203 INC R3
322 141664 103402 BCS L18
323 141666 005301 DEC R1
324 141670 002401 BLT L19
325 141672 000000 L18: HALT
326
327 141674 005100 L19: COM R0
328 141676 101401 BLOS L20
329 141700 000000 HALT
330
331 141702 040001 L20: BIC R0,R1
332 141704 060101 ADD R1,R1
333 141706 003001 BGT L21
334 141710 003401 BLE L22
335 141712 000000 L21: HALT
336
337 141714 000301 L22: SWAB R1
338 141716 020127 052125 CMP R1,#052125
339 141722 001004 BNE L23
340 141724 030405 BIT R4,R5
341 141726 003002 BGT L23
342 141730 005105 COM R5
343 141732 001001 BNE L24
344 141734 000000 L23: HALT
345
346 141736 112700 177401 L24: MOVB #177401,R0
347 141742 100001 BPL L26
348 141744 000000 L25: HALT
349
350 141746 077002 L26: SOB R0,L25
351 141750 005001 CLR R1
352 141752 005201 L27: INC R1
353 141754 077002 SOB R0,L27
354 141756 005700 TST R0
355 141760 001002 BNE L28
356 141762 005701 TST R1
357 141764 001401 BEQ L29
358 141766 000000 L28: HALT
359
360 141770 012707 141776 L29: MOV #N1,PC
361 141774 000000 HALT
362
363 141776 005727 N1: TST (PC)+
364 142000 000000 HALT
365
366 142002 012746 142012 N2: MOV #N3,-(SP)
367 142006 000207 RTS PC
368 142010 000000 HALT
369
370 142012 005046 N3: CLR -(SP)
371 142014 012746 142024 MOV #N4,-(SP)
372 142020 000002 RTI
373 142022 000000 HALT
374
375 142024 000137 142032 N4: JMP @#N5
376 142030 000000 HALT
377
378 142032 012705 000003 N5: MOV #3,R5
379 142036 005037 000006 CLR @#6
380 142042 012737 142054 000004 MOV #N6,@#4
381 142050 005745 TST -(R5)
382 142052 000000 HALT
383 142054 062706 000004 N6: ADD #4,SP
384
385 142060 005000 CLR R0
386 142062 012701 007777 MOV #7777,R1
387 142066 010002 N7: MOV R0,R2
388 142070 062702 000005 ADD #5,R2
389 142074 022062 177773 CMP (R0)+,-5(R2)
390 142100 001402 BEQ N8
391 142102 000000 HALT
392 142104 000000 D1: .WORD 0
393
394 142106 077111 N8: SOB R1,N7
395
396 142110 005267 141424' INC LOOCNT
397 142114 103001 BCC 10$
398 142116 000000 HALT
399 142120 026727 140122' 002200 10$: CMP CLKTIC,#2200
400 142126 101002 BHI 20$
401 142130 000167 141436' JMP DIAGLP
402 142134 012700 141254 20$: MOV #LOOMSG+5,R0
403 142140 016703 141424' MOV LOOCNT,R3
404
405 142144 005002 25$: CLR R2
406 142146 071227 000010 DIV #10,R2
407 142152 062703 000060 ADD #'0,R3
408 142156 110340 MOVB R3,-(R0)
409 142160 010203 MOV R2,R3
410 142162 001370 BNE 25$
411
412 142164 004767 140150' JSR PC,PRINT
413 142170 000207 RTS PC
414
415 177572 MMR0=177572
416 177574 MMR1=177574
417 177576 MMR2=177576
418 172516 MMR3=172516
419
420 LIGHTS:
421 142172 012703 077406 MOV #77406,R3 ; DEFAULT PDR
422 142176 005002 CLR R2
423 142200 005001 CLR R1
424 142202 012700 000010 MOV #8.,R0
425 142206 010361 172300 1$: MOV R3,172300(R1) ; KERNEL I PDR
426 142212 010261 172340 MOV R2,172340(R1) ; KERNEL I PAR
427 142216 010361 172320 MOV R3,172320(R1) ; KERNEL D PDR
428 142222 010261 172360 MOV R2,172360(R1) ; KERNEL D PAR
429 142226 010361 172200 MOV R3,172200(R1) ; SUPER I PDR
430 142232 010261 172240 MOV R2,172240(R1) ; SUPER I PAR
431 142236 010361 172220 MOV R3,172220(R1) ; SUPER D PDR
432 142242 010261 172260 MOV R2,172260(R1) ; SUPER D PAR
433 142246 010361 177600 MOV R3,177600(R1) ; USER I PDR
434 142252 010261 177640 MOV R2,177640(R1) ; USER I PAR
435 142256 010361 177620 MOV R3,177620(R1) ; USER D PDR
436 142262 010361 177660 MOV R3,177660(R1) ; USER D PAR
437 142266 062702 000200 ADD #200,R2
438 142272 062701 000002 ADD #2,R1
439 142276 077035 SOB R0,1$
440 142300 052737 176000 172376 BIS #176000,@#172376 ; KERNEL D POINTS TO I/O SPACE
441 142306 052737 176000 172276 BIS #176000,@#172276 ; SUPER D POINTS TO I/O SPACE
442 142314 052737 176000 177676 BIS #176000,@#177676 ; USER D POINTS TO I/O SPACE
443 142322 012737 000077 172516 MOV #77,@#MMR3 ; 77 FOR 22 BIT
444 142330 012737 000001 177572 MOV #1,@#MMR0
445
446 142336 012737 001700 172244 MOV #1700,@#172244 ; BASE SUPER I (PAR 2) #40000 AT #170000
447 142344 012737 001700 172264 MOV #1700,@#172264 ; BASE SUPER D (PAR 2) #40000 AT #170000
448 142352 012737 010000 177776 MOV #010000,@#177776 ; SET PM TO SUPER
449
450 142360 012703 040200 MOV #40200,R3 ; SUPER CODE ADDRESS
451 142364 012702 142412 MOV #SUPERS,R2 ; ADDRESS SUPER CODE
452 142370 012246 10$: MOV (R2)+,-(SP)
453 142372 006623 MTPI (R3)+
454 142374 020227 142656 CMP R2,#SUPERE
455 142400 103773 BLO 10$
456
457 142402 012767 040200 140120' MOV #40200,LGHTON ; CHANGE IDLE TASK
458 142410 000207 RTS PC
459
460 ;
461 ; TO BE COPIED TO SUPER #40200 AT PHYSICAL #170000
462 ; #40000 TO #40200 FOR WAIT & JMP INSTRUCTIONS
463 ;
464 SUPERS:
465 142412 012700 000037 MOV #37,R0 ; LOAD PATTERN
466 142416 012701 174000 MOV #174000,R1
467 142422 032737 000001 177570 BIT #1,@#177570
468 142430 001414 BEQ 10$
469 142432 012700 007417 MOV #7417,R0
470 142436 010001 MOV R0,R1
471 142440 005101 COM R1
472 142442 032737 000002 177570 BIT #2,@#177570
473 142450 001404 BEQ 10$
474 142452 012700 036163 MOV #36163,R0
475 142456 012701 037000 MOV #37000,R1
476 142462 010102 10$: MOV R1,R2
477 142464 162702 000002 SUB #2,R2
478 142470 042702 000001 BIC #1,R2 ; WAIT ADDRESS
479 142474 010203 MOV R2,R3
480 142476 042703 177701 BIC #177701,R3 ; ADDRESS OFFSET
481 142502 012763 000001 040000 MOV #0000001,40000(R3) ; WRITE WAIT
482 142510 062703 000002 ADD #2,R3
483 142514 012763 000113 040000 MOV #0000113,40000(R3) ; WRITE JMP (R3)
484
485 142522 010204 MOV R2,R4
486 142524 072427 177772 ASH #-6,R4
487 142530 042704 177600 BIC #177600,R4
488 142534 012705 001700 MOV #1700,R5
489 142540 160405 SUB R4,R5 ; PAR ADDRESS BASE FOR WAIT
490 142542 010204 MOV R2,R4
491 142544 072427 177764 ASH #-12.,R4
492 142550 042704 177761 BIC #177761,R4 ; PAR SELECT OFFSET
493 142554 010564 172240 MOV R5,172240(R4) ; SUPER I SPACE
494
495 142560 010103 MOV R1,R3
496 142562 072327 177764 ASH #-12.,R3
497 142566 042703 177761 BIC #177761,R3 ; PAR SELECT OFFSET
498 142572 020304 CMP R3,R4 ; SAME PAR
499 142574 001412 BEQ 30$
500 142576 010104 MOV R1,R4
501 142600 072427 177772 ASH #-6,R4
502 142604 042704 177600 BIC #177600,R4
503 142610 012705 001700 MOV #1700,R5
504 142614 160405 SUB R4,R5 ; PAR ADDRESS BASE FOR JMP
505 142616 010563 172240 MOV R5,172240(R3) ; SUPER I SPACE
506 30$:
507 142622 012704 000003 MOV #3,R4
508 142626 063704 177570 ADD @#177570,R4
509 142632 012703 000002 MOV #2,R3
510 142636 060703 ADD PC,R3
511 142640 000112 40$: JMP (R2)
512 142642 077402 SOB R4,40$
513 142644 010002 MOV R0,R2
514 142646 006002 ROR R2 ; ROTATE PATTERN
515 142650 006101 ROL R1
516 142652 006000 ROR R0
517 142654 000702 BR 10$
518 SUPERE:
519
520 BOOT:
521 142656 005003 CLR R3 ; UNIT
522 142660 112201 1$: MOVB (R2)+,R1
523 142662 001545 BEQ BOOTRK ; DEFAULT DEVICE IS RK0
524 142664 120127 000040 CMPB R1,#40
525 142670 001773 BEQ 1$
526 142672 120127 000122 CMPB R1,#'R
527 142676 001405 BEQ 5$
528
529 142700 012700 141175 MOV #BADBOO,R0
530 142704 004767 140150' JSR PC,PRINT
531 142710 000207 RTS PC
532
533 142712 112201 5$: MOVB (R2)+,R1 ; HOPEFULLY K, L OR P
534 142714 112200 7$: MOVB (R2)+,R0 ; DIGIT
535 142716 001416 BEQ 9$
536 142720 120027 000040 CMPB R0,#40
537 142724 001413 BEQ 9$
538 142726 120027 000067 CMPB R0,#'7
539 142732 003031 BGT 11$
540 142734 162700 000060 SUB #'0,R0
541 142740 002426 BLT 11$
542 142742 006303 ASL R3
543 142744 006303 ASL R3
544 142746 006303 ASL R3
545 142750 050003 BIS R0,R3 ; PUT DIGIT INTO UNIT
546 142752 000760 BR 7$
547 142754 005002 9$: CLR R2
548 142756 012722 000137 MOV #137,(R2)+ ; STORE "JMP @#140000" INSTRUCTION AT ADDRESS 0
549 142762 012722 140000 MOV #START,(R2)+
550 142766 012722 140000 MOV #START,(R2)+ ; STORE #140000 IN VECTOR 4, IN CASE OF TRAP TO 4
551 142772 005022 CLR (R2)+
552 142774 120127 000113 CMPB R1,#'K
553 143000 001476 BEQ BOOTRK
554 143002 120127 000114 CMPB R1,#'L
555 143006 001410 BEQ BOOTRL
556 143010 120127 000120 CMPB R1,#'P
557 143014 001517 BEQ BOOTRP
558
559 143016 012700 141114 11$: MOV #UNKMSG,R0
560 143022 004767 140150' JSR PC,PRINT
561 143026 000207 RTS PC
562
563 174400 RLCS=174400
564 BOOTRL:
565 143030 000005 RESET
566 143032 000303 SWAB R3 ; UNIT NUMBER
567 143034 012701 174400 MOV #RLCS,R1 ; CSR
568 143040 012761 000013 000004 MOV #13,4(R1) ; CLR ERR
569 143046 052703 000004 BIS #4,R3 ; UNIT+GSTAT
570 143052 010311 MOV R3,(R1) ; ISSUE CMD
571 143054 105711 TSTB (R1) ; WAIT
572 143056 100376 BPL .-2
573 143060 105003 CLRB R3
574 143062 052703 000010 BIS #10,R3 ; UNIT+RDHDR
575 143066 010311 MOV R3,(R1) ; ISSUE CMD
576 143070 105711 TSTB (R1) ; WAIT
577 143072 100376 BPL .-2
578 143074 016102 000006 MOV 6(R1),R2 ; GET HDR
579 143100 042702 000077 BIC #77,R2 ; CLR SECTOR
580 143104 005202 INC R2 ; MAGIC BIT
581 143106 010261 000004 MOV R2,4(R1) ; SEEK TO 0
582 143112 105003 CLRB R3
583 143114 052703 000006 BIS #6,R3 ; UNIT+SEEK
584 143120 010311 MOV R3,(R1) ; ISSUE CMD
585 143122 105711 TSTB (R1) ; WAIT
586 143124 100376 BPL .-2
587 143126 005061 000002 CLR 2(R1) ; CLR BA
588 143132 005061 000004 CLR 4(R1) ; CLR DA
589 143136 012761 177000 000006 MOV #-512.,6(R1) ; SET WC
590 143144 105003 CLRB R3
591 143146 052703 000014 BIS #14,R3 ; UNIT+READ
592 143152 010311 MOV R3,(R1) ; ISSUE CMD
593 143154 105711 TSTB (R1) ; WAIT
594 143156 100376 BPL .-2
595 143160 042711 000377 BIC #377,(R1)
596 143164 005002 CLR R2
597 143166 005003 CLR R3
598 143170 005004 CLR R4
599 143172 005005 CLR R5
600 143174 005007 CLR PC
601
602 177412 RKDA=177412
603 000005 READGO=5
604 BOOTRK:
605 143176 000005 RESET
606 143200 000303 SWAB R3 ; UNIT NUMBER
607 143202 006303 ASL R3
608 143204 006303 ASL R3
609 143206 006303 ASL R3
610 143210 006303 ASL R3
611 143212 006303 ASL R3
612 143214 012701 177412 MOV #RKDA,R1 ; CSR
613 143220 010311 MOV R3,(R1) ; LOAD DA
614 143222 005041 CLR -(R1) ; CLEAR BA
615 143224 012741 177000 MOV #-256.*2,-(R1) ; LOAD WC
616 143230 012741 000005 MOV #READGO,-(R1) ; READ & GO
617 143234 005002 CLR R2
618 143236 005003 CLR R3
619 143240 005004 CLR R4
620 143242 005005 CLR R5
621 143244 105711 TSTB (R1)
622 143246 100376 BPL .-2
623 143250 105011 CLRB (R1)
624 143252 005007 CLR PC
625
626 176700 RPCSR=0176700
627 BOOTRP:
628 143254 000005 RESET
629 143256 012701 176700 MOV #RPCSR, R1
630 143262 012761 000040 000010 MOV #0000040, 10(R1) ; RESET
631 143270 010361 000010 MOV R3, 10(R1) ; SET UNIT
632 143274 012711 000021 MOV #0000021, (R1) ; PACK ACK
633 143300 012761 010000 000032 MOV #0010000, 32(R1) ; 16B MODE
634 143306 012761 177000 000002 MOV #-512., 2(R1) ; SET WC
635 143314 005061 000004 CLR 4(R1) ; CLR BA
636 143320 005061 000006 CLR 6(R1) ; CLR DA
637 143324 005061 000034 CLR 34(R1) ; CLR CYL
638 143330 012711 000071 MOV #0000071, (R1) ; READ
639 143334 105711 TSTB (R1) ; WAIT
640 143336 100376 BPL .-2
641 143340 105011 CLRB (R1)
642 143342 010300 MOV R3,R0
643 143344 005007 CLR PC
644
645 .END START
645

View file

@ -33,232 +33,407 @@ The **BOOTMON.mac** source code is shown below.
KW11LKS = 177546
KW11VEC = 100
.ASECT
.=140000
.ASECT
.=140000
START: RESET
CLR @#PSW
MOV #START,SP
CLR @#DL11XCSR ; CLEAR THE XCSR
MOV #BANNER,R0
JSR PC,PRINT
MOV #CLKAST,@#KW11VEC
MOV #340,@#KW11VEC+2
BIS #100,@#KW11LKS ; SET CLOCK TICKING
CLR @#PSW
MOV #START,SP
CLR @#DL11XCSR ; CLEAR THE XCSR
MOV #BANNER,R0
JSR PC,PRINT
MOV #CLKAST,@#KW11VEC
MOV #340,@#KW11VEC+2
BIS #100,@#KW11LKS ; SET CLOCK TICKING
MOV #PROMPT,R0
JSR PC,PRINT
SUB #256,SP
MOV SP,R0
JSR PC,INPUT
CLR R0
MOV #PROMPT,R0
JSR PC,PRINT
SUB #256,SP
MOV SP,R0
JSR PC,INPUT
CLR R0
1$: WAIT
INC R0
TST LGHTON
BEQ 1$
MOV #054000,-(SP) ; SUPER PRIORITY 0 ALT REG
MOV LGHTON,-(SP) ; CALL SUPER LOOP START
RTI
INC R0
TST LGHTON
BEQ 1$
MOV #054000,-(SP) ; SUPER PRIORITY 0 ALT REG
MOV LGHTON,-(SP) ; CALL SUPER LOOP START
RTI
LGHTON: .WORD 0
CLKTIC: .WORD 0
CLKAST:
INC CLKTIC
RTI
INC CLKTIC
RTI
ONECHR:
TSTB @#DL11XCSR
BPL ONECHR
MOVB R0,@#177566
RTS PC
TSTB @#DL11XCSR
BPL ONECHR
MOVB R0,@#177566
RTS PC
PRTPTR: .WORD 0
PRINT:
BITB #100,@#DL11XCSR
BNE PRINT
MOV R0,PRTPTR
MOV #PRTAST,@#DL11VEC
MOV #200,@#DL11VEC+2
BISB #100,@#DL11XCSR
RTS PC
BITB #100,@#DL11XCSR
BNE PRINT
MOV R0,PRTPTR
MOV #PRTAST,@#DL11VEC
MOV #200,@#DL11VEC+2
BISB #100,@#DL11XCSR
RTS PC
PRTAST:
TSTB @PRTPTR
BEQ 2$
MOVB @PRTPTR,@#177566
INC PRTPTR
RTI
TSTB @PRTPTR
BEQ 2$
MOVB @PRTPTR,@#177566
INC PRTPTR
RTI
2$: CLRB @#177564
RTI
RTI
BUFFER: .WORD 0 ; INPUT BUFFER POINTER
LENGTH: .WORD 0 ; INPUT BUFFER LENGTH
INPUT:
MOV R0,BUFFER
CLR LENGTH
MOV #INPAST,@#60
MOV #200,@#62
BISB #100,@#177560
RTS PC
MOV R0,BUFFER
CLR LENGTH
MOV #INPAST,@#60
MOV #200,@#62
BISB #100,@#177560
RTS PC
INPAST:
MOV R0,-(SP)
MOVB @#177562,R0
CMPB R0,#15
BEQ 7$ ; CARRIAGE RETURN
CMPB R0,#127.
BEQ 2$ ; <DEL>
CMPB R0,#10
BNE 4$ ; BACK SPACE
MOV R0,-(SP)
MOVB @#177562,R0
CMPB R0,#15
BEQ 7$ ; CARRIAGE RETURN
CMPB R0,#127.
BEQ 2$ ; <DEL>
CMPB R0,#10
BNE 4$ ; BACK SPACE
2$: TST LENGTH ; DATA IN BUFFER?
BEQ 3$
DEC LENGTH ; LENGTH
MOV #DEL,R0
JSR PC,PRINT
BEQ 3$
DEC LENGTH ; LENGTH
MOV #DEL,R0
JSR PC,PRINT
3$: BR 9$
4$: CMPB R0,#40
BLT 9$ ; BELOW SPACE
CMPB R0,#177
BGE 9$ ; SKIP STUFF TOO BIG
JSR PC,ONECHR ; ECHO CHAR
CMPB R0,#172
BGT 5$ ; ABOVE Z
CMPB R0,#141
BLT 5$ ; BELOW A
BICB #40,R0 ; CONVERT TO UPPER CASE
BLT 9$ ; BELOW SPACE
CMPB R0,#177
BGE 9$ ; SKIP STUFF TOO BIG
JSR PC,ONECHR ; ECHO CHAR
CMPB R0,#172
BGT 5$ ; ABOVE Z
CMPB R0,#141
BLT 5$ ; BELOW A
BICB #40,R0 ; CONVERT TO UPPER CASE
5$: CMP LENGTH,#254
BGE 9$
MOVB R0,-(SP)
MOV BUFFER,R0
ADD LENGTH,R0
MOVB (SP)+,(R0)
INC LENGTH
BR 9$
BGE 9$
MOVB R0,-(SP)
MOV BUFFER,R0
ADD LENGTH,R0
MOVB (SP)+,(R0)
INC LENGTH
BR 9$
7$: MOV BUFFER,R0
ADD LENGTH,R0
CLRB (R0)
MOV #CMD,@#240 ; CALL CMD AT PRIORITY 2
MOV #100,@#242
MOV #2000,@#177772
ADD LENGTH,R0
CLRB (R0)
MOV #CMD,@#240 ; CALL CMD AT PRIORITY 2
MOV #100,@#242
MOV #2000,@#177772
9$: MOV (SP)+,R0
RTI
RTI
CMD:
CLR @#177772 ; NO MORE PIR CALLS
MOV R0,-(SP)
MOV R1,-(SP)
MOV R2,-(SP)
MOV R3,-(SP)
MOV R4,-(SP)
MOV #EOL,R0
JSR PC,PRINT
CLR @#177772 ; NO MORE PIR CALLS
MOV R0,-(SP)
MOV R1,-(SP)
MOV R2,-(SP)
MOV R3,-(SP)
MOV R4,-(SP)
MOV #EOL,R0
JSR PC,PRINT
1$: BITB #100,@#177564
BNE 1$
CLR R4
MOV #CMDLST,R3 ; CMD LIST
BNE 1$
CLR R4
MOV #CMDLST,R3 ; CMD LIST
3$: MOVB (R3)+,R0
BEQ 13$
MOV BUFFER,R2 ; USER CMD
BEQ 13$
MOV BUFFER,R2 ; USER CMD
4$: MOVB (R2)+,R1
BEQ 15$ ; NULL COMMAND?
CMPB R1,#40
BEQ 4$ ; SKIP SPACE
BEQ 15$ ; NULL COMMAND?
CMPB R1,#40
BEQ 4$ ; SKIP SPACE
5$: CMPB R0,R1
BNE 7$
MOVB (R3)+,R0
BEQ 9$
MOVB (R2)+,R1
BEQ 9$
CMPB R1,#40
BNE 5$
BR 9$
BNE 7$
MOVB (R3)+,R0
BEQ 9$
MOVB (R2)+,R1
BEQ 9$
CMPB R1,#40
BNE 5$
BR 9$
7$: MOVB (R3)+,R0
BNE 7$
INC R4
BR 3$
BNE 7$
INC R4
BR 3$
9$: ASL R4
JSR PC,@CMDTBL(R4) ; EXECUTE
BR 15$
JSR PC,@CMDTBL(R4) ; EXECUTE
BR 15$
13$: MOV #UNKMSG,R0
JSR PC,PRINT
JSR PC,PRINT
15$: CLR LENGTH
MOV #PROMPT,R0
JSR PC,PRINT
MOV (SP)+,R4
MOV (SP)+,R3
MOV (SP)+,R2
MOV (SP)+,R1
MOV (SP)+,R0
RTI
MOV #PROMPT,R0
JSR PC,PRINT
MOV (SP)+,R4
MOV (SP)+,R3
MOV (SP)+,R2
MOV (SP)+,R1
MOV (SP)+,R0
RTI
CMDTBL: .WORD BOOT,HALT,TEST,LIGHTS,HELP
HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, LIGHTS, TEST AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
CMDTBL: .WORD BOOT,HALT,TEST,DIAG,LIGHTS,HELP
HLPMSG: .ASCIZ 'COMMANDS ARE BOOT, HALT, TEST, DIAG, LIGHTS AND HELP'<15><12>'BOOT DEVICES ARE RK? RL? OR RP?'<15><12>
EOL: .BYTE 15,12,0
DEL: .BYTE 10,40,10,0
CMDLST: .ASCIZ 'BOOT'
.ASCIZ 'HALT'
.ASCIZ 'TEST'
.ASCIZ 'LIGHTS'
.ASCIZ 'HELP'
.BYTE 0
.ASCIZ 'HALT'
.ASCIZ 'TEST'
.ASCIZ 'DIAG'
.ASCIZ 'LIGHTS'
.ASCIZ 'HELP'
.BYTE 0
UNKMSG: .ASCIZ 'UNKNOWN COMMAND'<12><15>
BANNER: .ASCIZ 'PDP-11 MONITOR V1.0'<12><15><12><15>
; 'ADAPTED FROM CODE BY PAUL NANKERVIS <PAULNANK@HOTMAIL.COM>'<12><15><12><15>
PROMPT: .ASCIZ 'BOOT> '
BADBOO: .ASCIZ 'UNKNOWN BOOT DEVICE'<12><15>
PERMSG: .ASCIZ ' CLOCK TICKS'<12><15>
LOOMSG: .ASCIZ ' ITERATIONS'<12><15>
.EVEN
.EVEN
HELP:
MOV #HLPMSG,R0
JSR PC,PRINT
RTS PC
MOV #HLPMSG,R0
JSR PC,PRINT
RTS PC
HALT:
HALT
MOV #EOL,R0
JSR PC,PRINT
RTS PC
HALT
MOV #EOL,R0
JSR PC,PRINT
RTS PC
TEST:
CLR CLKTIC
CLR CLKTIC
MOV #15000,R5
MOV #15000,R5
10$: MOV R5,@#177570 ; DISPLAY
MOV R5,R4
ASR R4
MOV R5,R4
ASR R4
15$: CLR R0
MOV R5,R1
DIV R4,R0
MOV R0,R2
MUL R4,R2
ADD R3,R1
CMP R1,R5
BEQ 20$
HALT
MOV R5,R1
DIV R4,R0
MOV R0,R2
MUL R4,R2
ADD R3,R1
CMP R1,R5
BEQ 20$
HALT
20$: SOB R4,15$
SOB R5,10$
SOB R5,10$
MOV #PERMSG+5,R0
MOV CLKTIC,R3
MOV #PERMSG+5,R0
MOV CLKTIC,R3
25$: CLR R2
DIV #10,R2
ADD #'0,R3
MOVB R3,-(R0)
MOV R2,R3
BNE 25$
DIV #10,R2
ADD #'0,R3
MOVB R3,-(R0)
MOV R2,R3
BNE 25$
JSR PC,PRINT
RTS PC
JSR PC,PRINT
RTS PC
LOOCNT: .WORD 0
DIAG:
CLR LOOCNT
CLR CLKTIC
DIAGLP:
CLR R5
BMI L1
BVS L1
BHI L1
BLT L1
BLOS L2
L1: HALT
L2: DEC R5
BPL L3
BEQ L3
BGE L3
BLE L4
L3: HALT
L4: ROR R5
BVC L5
BCC L5
BNE L6
L5: HALT
L6: MOVB #17,@#177776
BPL L7
BVC L7
BLT L7
BHI L7
BMI L8
L7: HALT
L8: MOV #77777,R3
ADD #77777,R3
CMPB @#177776,#5
BNE L9
HALT
L9: MOVB #1700,R4
BPL L10
CMP R4,#177700
BEQ L11
L10: HALT
L11: CLRB R4
CMP R4,#177400
BEQ L12
HALT
L12: MOV #125252,R5
MOV R5,R0
MOV R0,R1
MOV R1,R2
MOV R2,R3
MOV R3,R4
MOV R4,R5
SUB R5,R1
BLT NODIAG
BEQ L13
NODIAG: HALT
L13: ROL R2
BCC L14
BLT L15
L14: HALT
L15: ADD R2,R3
INC R3
COM R3
ADD R3,R1
BCS L16
BLE L17
L16: HALT
L17: ROR R4
BIS R4,R3
ADD R5,R3
INC R3
BCS L18
DEC R1
BLT L19
L18: HALT
L19: COM R0
BLOS L20
HALT
L20: BIC R0,R1
ADD R1,R1
BGT L21
BLE L22
L21: HALT
L22: SWAB R1
CMP R1,#052125
BNE L23
BIT R4,R5
BGT L23
COM R5
BNE L24
L23: HALT
L24: MOVB #177401,R0
BPL L26
L25: HALT
L26: SOB R0,L25
CLR R1
L27: INC R1
SOB R0,L27
TST R0
BNE L28
TST R1
BEQ L29
L28: HALT
L29: MOV #N1,PC
HALT
N1: TST (PC)+
HALT
N2: MOV #N3,-(SP)
RTS PC
HALT
N3: CLR -(SP)
MOV #N4,-(SP)
RTI
HALT
N4: JMP @#N5
HALT
N5: MOV #3,R5
CLR @#6
MOV #N6,@#4
TST -(R5)
HALT
N6: ADD #4,SP
CLR R0
MOV #7777,R1
N7: MOV R0,R2
ADD #5,R2
CMP (R0)+,-5(R2)
BEQ N8
HALT
D1: .WORD 0
N8: SOB R1,N7
INC LOOCNT
BCC 10$
HALT
10$: CMP CLKTIC,#2200
BHI 20$
JMP DIAGLP
20$: MOV #LOOMSG+5,R0
MOV LOOCNT,R3
25$: CLR R2
DIV #10,R2
ADD #'0,R3
MOVB R3,-(R0)
MOV R2,R3
BNE 25$
JSR PC,PRINT
RTS PC
MMR0=177572
MMR1=177574
@ -266,228 +441,228 @@ The **BOOTMON.mac** source code is shown below.
MMR3=172516
LIGHTS:
MOV #77406,R3 ; DEFAULT PDR
CLR R2
CLR R1
MOV #8.,R0
MOV #77406,R3 ; DEFAULT PDR
CLR R2
CLR R1
MOV #8.,R0
1$: MOV R3,172300(R1) ; KERNEL I PDR
MOV R2,172340(R1) ; KERNEL I PAR
MOV R3,172320(R1) ; KERNEL D PDR
MOV R2,172360(R1) ; KERNEL D PAR
MOV R3,172200(R1) ; SUPER I PDR
MOV R2,172240(R1) ; SUPER I PAR
MOV R3,172220(R1) ; SUPER D PDR
MOV R2,172260(R1) ; SUPER D PAR
MOV R3,177600(R1) ; USER I PDR
MOV R2,177640(R1) ; USER I PAR
MOV R3,177620(R1) ; USER D PDR
MOV R3,177660(R1) ; USER D PAR
ADD #200,R2
ADD #2,R1
SOB R0,1$
BIS #176000,@#172376 ; KERNEL D POINTS TO I/O SPACE
BIS #176000,@#172276 ; SUPER D POINTS TO I/O SPACE
BIS #176000,@#177676 ; USER D POINTS TO I/O SPACE
MOV #77,@#MMR3 ; 77 FOR 22 BIT
MOV #1,@#MMR0
MOV R2,172340(R1) ; KERNEL I PAR
MOV R3,172320(R1) ; KERNEL D PDR
MOV R2,172360(R1) ; KERNEL D PAR
MOV R3,172200(R1) ; SUPER I PDR
MOV R2,172240(R1) ; SUPER I PAR
MOV R3,172220(R1) ; SUPER D PDR
MOV R2,172260(R1) ; SUPER D PAR
MOV R3,177600(R1) ; USER I PDR
MOV R2,177640(R1) ; USER I PAR
MOV R3,177620(R1) ; USER D PDR
MOV R3,177660(R1) ; USER D PAR
ADD #200,R2
ADD #2,R1
SOB R0,1$
BIS #176000,@#172376 ; KERNEL D POINTS TO I/O SPACE
BIS #176000,@#172276 ; SUPER D POINTS TO I/O SPACE
BIS #176000,@#177676 ; USER D POINTS TO I/O SPACE
MOV #77,@#MMR3 ; 77 FOR 22 BIT
MOV #1,@#MMR0
MOV #1700,@#172244 ; BASE SUPER I (PAR 2) #40000 AT #170000
MOV #1700,@#172264 ; BASE SUPER D (PAR 2) #40000 AT #170000
MOV #010000,@#177776 ; SET PM TO SUPER
MOV #1700,@#172244 ; BASE SUPER I (PAR 2) #40000 AT #170000
MOV #1700,@#172264 ; BASE SUPER D (PAR 2) #40000 AT #170000
MOV #010000,@#177776 ; SET PM TO SUPER
MOV #40200,R3 ; SUPER CODE ADDRESS
MOV #SUPERS,R2 ; ADDRESS SUPER CODE
MOV #40200,R3 ; SUPER CODE ADDRESS
MOV #SUPERS,R2 ; ADDRESS SUPER CODE
10$: MOV (R2)+,-(SP)
MTPI (R3)+
CMP R2,#SUPERE
BLO 10$
MTPI (R3)+
CMP R2,#SUPERE
BLO 10$
MOV #40200,LGHTON ; CHANGE IDLE TASK
RTS PC
MOV #40200,LGHTON ; CHANGE IDLE TASK
RTS PC
;
; TO BE COPIED TO SUPER #40200 AT PHYSICAL #170000
; #40000 TO #40200 FOR WAIT & JMP INSTRUCTIONS
;
SUPERS:
MOV #37,R0 ; LOAD PATTERN
MOV #174000,R1
BIT #1,@#177570
BEQ 10$
MOV #7417,R0
MOV R0,R1
COM R1
BIT #2,@#177570
BEQ 10$
MOV #36163,R0
MOV #37000,R1
MOV #37,R0 ; LOAD PATTERN
MOV #174000,R1
BIT #1,@#177570
BEQ 10$
MOV #7417,R0
MOV R0,R1
COM R1
BIT #2,@#177570
BEQ 10$
MOV #36163,R0
MOV #37000,R1
10$: MOV R1,R2
SUB #2,R2
BIC #1,R2 ; WAIT ADDRESS
MOV R2,R3
BIC #177701,R3 ; ADDRESS OFFSET
MOV #0000001,40000(R3) ; WRITE WAIT
ADD #2,R3
MOV #0000113,40000(R3) ; WRITE JMP (R3)
SUB #2,R2
BIC #1,R2 ; WAIT ADDRESS
MOV R2,R3
BIC #177701,R3 ; ADDRESS OFFSET
MOV #0000001,40000(R3) ; WRITE WAIT
ADD #2,R3
MOV #0000113,40000(R3) ; WRITE JMP (R3)
MOV R2,R4
ASH #-6,R4
BIC #177600,R4
MOV #1700,R5
SUB R4,R5 ; PAR ADDRESS BASE FOR WAIT
MOV R2,R4
ASH #-12.,R4
BIC #177761,R4 ; PAR SELECT OFFSET
MOV R5,172240(R4) ; SUPER I SPACE
MOV R2,R4
ASH #-6,R4
BIC #177600,R4
MOV #1700,R5
SUB R4,R5 ; PAR ADDRESS BASE FOR WAIT
MOV R2,R4
ASH #-12.,R4
BIC #177761,R4 ; PAR SELECT OFFSET
MOV R5,172240(R4) ; SUPER I SPACE
MOV R1,R3
ASH #-12.,R3
BIC #177761,R3 ; PAR SELECT OFFSET
CMP R3,R4 ; SAME PAR
BEQ 30$
MOV R1,R4
ASH #-6,R4
BIC #177600,R4
MOV #1700,R5
SUB R4,R5 ; PAR ADDRESS BASE FOR JMP
MOV R5,172240(R3) ; SUPER I SPACE
MOV R1,R3
ASH #-12.,R3
BIC #177761,R3 ; PAR SELECT OFFSET
CMP R3,R4 ; SAME PAR
BEQ 30$
MOV R1,R4
ASH #-6,R4
BIC #177600,R4
MOV #1700,R5
SUB R4,R5 ; PAR ADDRESS BASE FOR JMP
MOV R5,172240(R3) ; SUPER I SPACE
30$:
MOV #3,R4
ADD @#177570,R4
MOV #2,R3
ADD PC,R3
MOV #3,R4
ADD @#177570,R4
MOV #2,R3
ADD PC,R3
40$: JMP (R2)
SOB R4,40$
MOV R0,R2
ROR R2 ; ROTATE PATTERN
ROL R1
ROR R0
BR 10$
SOB R4,40$
MOV R0,R2
ROR R2 ; ROTATE PATTERN
ROL R1
ROR R0
BR 10$
SUPERE:
BOOT:
CLR R3 ; UNIT
CLR R3 ; UNIT
1$: MOVB (R2)+,R1
BEQ BOOTRK ; DEFAULT DEVICE IS RK0
CMPB R1,#40
BEQ 1$
CMPB R1,#'R
BEQ 5$
BEQ BOOTRK ; DEFAULT DEVICE IS RK0
CMPB R1,#40
BEQ 1$
CMPB R1,#'R
BEQ 5$
MOV #BADBOO,R0
JSR PC,PRINT
RTS PC
MOV #BADBOO,R0
JSR PC,PRINT
RTS PC
5$: MOVB (R2)+,R1 ; HOPEFULLY K, L OR P
7$: MOVB (R2)+,R0 ; DIGIT
BEQ 9$
CMPB R0,#40
BEQ 9$
CMPB R0,#'7
BGT 11$
SUB #'0,R0
BLT 11$
ASL R3
ASL R3
ASL R3
BIS R0,R3 ; PUT DIGIT INTO UNIT
BR 7$
BEQ 9$
CMPB R0,#40
BEQ 9$
CMPB R0,#'7
BGT 11$
SUB #'0,R0
BLT 11$
ASL R3
ASL R3
ASL R3
BIS R0,R3 ; PUT DIGIT INTO UNIT
BR 7$
9$: CLR R2
MOV #137,(R2)+ ; STORE "JMP @#140000" INSTRUCTION AT ADDRESS 0
MOV #START,(R2)+
MOV #START,(R2)+ ; STORE #140000 IN VECTOR 4, IN CASE OF TRAP TO 4
CLR (R2)+
CMPB R1,#'K
BEQ BOOTRK
CMPB R1,#'L
BEQ BOOTRL
CMPB R1,#'P
BEQ BOOTRP
MOV #137,(R2)+ ; STORE "JMP @#140000" INSTRUCTION AT ADDRESS 0
MOV #START,(R2)+
MOV #START,(R2)+ ; STORE #140000 IN VECTOR 4, IN CASE OF TRAP TO 4
CLR (R2)+
CMPB R1,#'K
BEQ BOOTRK
CMPB R1,#'L
BEQ BOOTRL
CMPB R1,#'P
BEQ BOOTRP
11$: MOV #UNKMSG,R0
JSR PC,PRINT
RTS PC
JSR PC,PRINT
RTS PC
RLCS=174400
BOOTRL:
RESET
SWAB R3 ; UNIT NUMBER
MOV #RLCS,R1 ; CSR
MOV #13,4(R1) ; CLR ERR
BIS #4,R3 ; UNIT+GSTAT
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
CLRB R3
BIS #10,R3 ; UNIT+RDHDR
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
MOV 6(R1),R2 ; GET HDR
BIC #77,R2 ; CLR SECTOR
INC R2 ; MAGIC BIT
MOV R2,4(R1) ; SEEK TO 0
CLRB R3
BIS #6,R3 ; UNIT+SEEK
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
CLR 2(R1) ; CLR BA
CLR 4(R1) ; CLR DA
MOV #-512.,6(R1) ; SET WC
CLRB R3
BIS #14,R3 ; UNIT+READ
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
BIC #377,(R1)
CLR R2
CLR R3
CLR R4
CLR R5
CLR PC
RESET
SWAB R3 ; UNIT NUMBER
MOV #RLCS,R1 ; CSR
MOV #13,4(R1) ; CLR ERR
BIS #4,R3 ; UNIT+GSTAT
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
CLRB R3
BIS #10,R3 ; UNIT+RDHDR
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
MOV 6(R1),R2 ; GET HDR
BIC #77,R2 ; CLR SECTOR
INC R2 ; MAGIC BIT
MOV R2,4(R1) ; SEEK TO 0
CLRB R3
BIS #6,R3 ; UNIT+SEEK
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
CLR 2(R1) ; CLR BA
CLR 4(R1) ; CLR DA
MOV #-512.,6(R1) ; SET WC
CLRB R3
BIS #14,R3 ; UNIT+READ
MOV R3,(R1) ; ISSUE CMD
TSTB (R1) ; WAIT
BPL .-2
BIC #377,(R1)
CLR R2
CLR R3
CLR R4
CLR R5
CLR PC
RKDA=177412
READGO=5
BOOTRK:
RESET
SWAB R3 ; UNIT NUMBER
ASL R3
ASL R3
ASL R3
ASL R3
ASL R3
MOV #RKDA,R1 ; CSR
MOV R3,(R1) ; LOAD DA
CLR -(R1) ; CLEAR BA
MOV #-256.*2,-(R1) ; LOAD WC
MOV #READGO,-(R1) ; READ & GO
CLR R2
CLR R3
CLR R4
CLR R5
TSTB (R1)
BPL .-2
CLRB (R1)
CLR PC
RESET
SWAB R3 ; UNIT NUMBER
ASL R3
ASL R3
ASL R3
ASL R3
ASL R3
MOV #RKDA,R1 ; CSR
MOV R3,(R1) ; LOAD DA
CLR -(R1) ; CLEAR BA
MOV #-256.*2,-(R1) ; LOAD WC
MOV #READGO,-(R1) ; READ & GO
CLR R2
CLR R3
CLR R4
CLR R5
TSTB (R1)
BPL .-2
CLRB (R1)
CLR PC
RPCSR=0176700
BOOTRP:
RESET
MOV #RPCSR, R1
MOV #0000040, 10(R1) ; RESET
MOV R3, 10(R1) ; SET UNIT
MOV #0000021, (R1) ; PACK ACK
MOV #0010000, 32(R1) ; 16B MODE
MOV #-512., 2(R1) ; SET WC
CLR 4(R1) ; CLR BA
CLR 6(R1) ; CLR DA
CLR 34(R1) ; CLR CYL
MOV #0000071, (R1) ; READ
TSTB (R1) ; WAIT
BPL .-2
CLRB (R1)
MOV R3,R0
CLR PC
RESET
MOV #RPCSR, R1
MOV #0000040, 10(R1) ; RESET
MOV R3, 10(R1) ; SET UNIT
MOV #0000021, (R1) ; PACK ACK
MOV #0010000, 32(R1) ; 16B MODE
MOV #-512., 2(R1) ; SET WC
CLR 4(R1) ; CLR BA
CLR 6(R1) ; CLR DA
CLR 34(R1) ; CLR CYL
MOV #0000071, (R1) ; READ
TSTB (R1) ; WAIT
BPL .-2
CLRB (R1)
MOV R3,R0
CLR PC
.END START
.END START

View file

@ -8,7 +8,7 @@ BOOTMON.txt: BOOTMON.mac
macro11 BOOTMON.mac -l BOOTMON.txt
BOOTMON.json: BOOTMON.txt
node ../../../../modules/filedump/bin/filedump --file=BOOTMON.txt --format=octal --output=BOOTMON.json --overwrite
node ../../../../modules/filedump/bin/filedump --file=BOOTMON.txt --format=octal --output=BOOTMON.json --load=0xC000 --exec=0xC000 --overwrite
BOOTMON.md: BOOTMON.mac
tabify -8 -d BOOTMON.mac > BOOTMON.md

View file

@ -10,6 +10,9 @@ PDP-11/70 Machine Configurations
PDPjs is currently being tested with the following PDP-11/70 machine configurations:
* [PDP-11/70 Boot Monitor](/devices/pdp11/machine/1170/monitor/) (with [Debugger](/devices/pdp11/machine/1170/monitor/debugger/))
* [PDP-11/70 with Front Panel](/devices/pdp11/machine/1170/panel) (with [Debugger](/devices/pdp11/machine/1170/panel/debugger/))
* [PDP-11/70 with Front Panel](/devices/pdp11/machine/1170/panel/) (with [Debugger](/devices/pdp11/machine/1170/panel/debugger/))
* [PDP-11/70 "Server Array"](/devices/pdp11/machine/1170/array/)
* [PDP-11/70 with VT100 Terminal](/devices/pdp11/machine/1170/vt100/) (with [Debugger](/devices/pdp11/machine/1170/vt100/debugger/))
The [PDP-11/70 with Front Panel and Debugger](/devices/pdp11/machine/1170/panel/debugger/) also features a section
on "[Toggle-Ins](/devices/pdp11/machine/1170/panel/debugger/#toggle-ins)" for your switch-toggling enjoyment.

View file

@ -4,7 +4,7 @@
<name pos="center">PDP-11/70 Boot Monitor with Debugger</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0" binding="print"/>
<panel ref="/devices/pdp11/panel/test/debugger/terminal.xml"/>

View file

@ -4,7 +4,7 @@
<name pos="center">PDP-11/70 Boot Monitor</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667" autoStart="true"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0" binding="print"/>
<panel ref="/devices/pdp11/panel/test/terminal.xml"/>

View file

@ -1,6 +1,6 @@
---
layout: page
title: PDP-11/70 with Front Panel
title: PDP-11/70 with 256Kb and Front Panel
permalink: /devices/pdp11/machine/1170/panel/
machines:
- id: test1170

View file

@ -1,6 +1,6 @@
---
layout: page
title: PDP-11/70 with Front Panel and Debugger
title: PDP-11/70 with 256Kb, Front Panel, and Debugger
permalink: /devices/pdp11/machine/1170/panel/debugger/
machines:
- id: test1170

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/versions/pdpjs/1.30.3/machine.xsl"?>
<machine id="test1170" class="pdp11" border="1" pos="center" background="#FAEBD7">
<name pos="center">PDP-11/70 with Front Panel and Debugger</name>
<name pos="center">PDP-11/70 with 256Kb, Front Panel and Debugger</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<rom id="m9312" addr="0xEA00" size="0x200" file="/devices/pdp11/rom/M9312/23-616F1.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0" binding="print" upperCase="true"/>

View file

@ -0,0 +1,19 @@
---
layout: page
title: PDP-11/70 with Front Panel and Debugger
permalink: /devices/pdp11/machine/1170/panel/debugger/xxdp/
machines:
- id: test1170
type: pdp11
debugger: true
autoStart: true
autoMount:
RL0:
path: http://archive.pcjs.org/disks/dec/rl02k/RL02K-XXDP.json
---
{% include machine.html id="test1170" %}
Other interesting things to know about this machine:
* It includes an [M9312 ROM](/devices/pdp11/rom/M9312/) at address 165000. The exact ROM is [23-616F1](/devices/pdp11/rom/M9312/23-616F1.txt).

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/versions/pdpjs/1.30.3/machine.xsl"?>
<machine id="test1170" class="pdp11" border="1" pos="center" background="#FAEBD7">
<name pos="center">PDP-11/70 with 256Kb, Front Panel and Debugger</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<rom id="m9312" addr="0xEA00" size="0x200" file="/devices/pdp11/rom/M9312/23-616F1.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0" binding="print" upperCase="true"/>
<panel ref="/devices/pdp11/panel/1170/debugger/front.xml"/>
<debugger id="debugger" base="8" messages="" commands=""/>
<device ref="/devices/pdp11/pc11/default.xml"/>
<device ref="/devices/pdp11/rl11/default.xml"/>
</machine>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/versions/pdpjs/1.30.3/machine.xsl"?>
<machine id="test1170" class="pdp11" border="1" pos="center" background="#FAEBD7">
<name pos="center">PDP-11/70 with Front Panel</name>
<name pos="center">PDP-11/70 with 256Kb and Front Panel</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667" autoStart="true"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<rom id="m9312" addr="0xEA00" size="0x200" file="/devices/pdp11/rom/M9312/23-616F1.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0" binding="print" upperCase="true"/>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/versions/pdpjs/1.30.3/machine.xsl"?>
<machine id="test1170" class="pdp11" border="1" pos="center" background="#FAEBD7">
<name pos="center">PDP-11/70 with Front Panel</name>
<name pos="center">PDP-11/70 with 256Kb, Front Panel, and Debugger</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667" autoStart="true"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0"/>
<panel ref="/devices/pdp11/panel/1170/debugger/front.xml"/>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/versions/pdpjs/1.30.3/machine.xsl"?>
<machine id="test1170" class="pdp11" border="1" pos="center" background="#FAEBD7">
<name pos="center">PDP-11/70 with Front Panel</name>
<name pos="center">PDP-11/70 with 256Kb and Front Panel</name>
<computer id="computer" busWidth="22"/>
<cpu id="cpu" model="1170" cycles="6666667" autoStart="true"/>
<ram id="ram" addr="0x00000" size="0x3E000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<ram id="ram" addr="0x00000" size="0x40000" file="/apps/pdp11/boot/monitor/BOOTMON.json"/>
<device id="default" type="default"/>
<serial id="dl11" adapter="0"/>
<panel ref="/devices/pdp11/panel/1170/front.xml"/>

View file

@ -7086,12 +7086,12 @@ if (DEBUGGER) {
DebuggerX86.prototype.doStep = function(sCmd)
{
var fCallStep = true;
var fRegs = (sCmd == "pr"? 1 : 0);
var nRegs = (sCmd == "pr"? 1 : 0);
/*
* Set up the value for this.nStep (ie, 1 or 2) depending on whether the user wants
* a subsequent register dump ("pr") or not ("p").
*/
var nStep = 1 + fRegs;
var nStep = 1 + nRegs;
if (!this.nStep) {
var fPrefix;
var fRepeat = false;
@ -7186,7 +7186,7 @@ if (DEBUGGER) {
* stopped for reasons unrelated to the temporary breakpoint, but that's OK.
*/
} else {
this.doTrace(fRegs? "tr" : "t");
this.doTrace(nRegs? "tr" : "t");
}
} else {
this.println("step in progress");

View file

@ -166,11 +166,12 @@ Component.subclass(BusPDP11);
BusPDP11.IOPAGE_16BIT = 0xE000; /*000160000*/ // eg, PDP-11/20
BusPDP11.IOPAGE_18BIT = 0x3E000; /*000760000*/ // eg, PDP-11/45
BusPDP11.IOPAGE_UNIBUS = 0x3C0000; /*017000000*/
BusPDP11.IOPAGE_22BIT = 0x3FE000; /*017760000*/ // eg, PDP-11/70
BusPDP11.IOPAGE_LENGTH = 0x2000; // ie, 8Kb
BusPDP11.IOPAGE_MASK = BusPDP11.IOPAGE_LENGTH - 1;
BusPDP11.MAX_MEMORY = BusPDP11.IOPAGE_UNIBUS - 16384; // Maximum memory address (need less memory for BSD 2.9 boot)
BusPDP11.UNIBUS_22BIT = 0x3C0000; /*017000000*/
BusPDP11.MAX_MEMORY = BusPDP11.UNIBUS_22BIT - 16384; // Maximum memory address (need less memory for BSD 2.9 boot)
BusPDP11.ERROR = {
RANGE_INUSE: 1,
@ -319,15 +320,11 @@ BusPDP11.IOController = {
fWrite = true;
}
/*
* If a writeWord() handler exists, call the readWord() handler first to get the original data,
* then call writeWord() with the new data pre-inserted in the original data.
*
* WARNING: Whenever we call readWord() under these circumstances, we zero the address parameter,
* so that the handler can distinguish this case. Thus, if we're dealing with a special register
* where a byte write operation modifies the entire register, the handler can simply return zero.
* If a writeWord() handler exists, call the readWord() handler first to get the original data
* (with fPreWrite set to true) and call writeWord() with the new data inserted into the original data.
*/
else if (afn[BusPDP11.IOHANDLER.WRITE_WORD]) {
w = afn[BusPDP11.IOHANDLER.READ_WORD]? afn[BusPDP11.IOHANDLER.READ_WORD](0) : 0;
w = afn[BusPDP11.IOHANDLER.READ_WORD]? afn[BusPDP11.IOHANDLER.READ_WORD](addrMasked, true) : 0;
if (!(addrMasked & 0x1)) {
afn[BusPDP11.IOHANDLER.WRITE_WORD]((w & ~0xff) | b, addrMasked);
fWrite = true;
@ -339,18 +336,14 @@ BusPDP11.IOController = {
} else if (addrMasked & 0x1) {
/*
* If no handler existed, and this address was odd, then perhaps a handler exists for the even address;
* if so, call the readWord() handler first to get the original data, then call writeWord() with the new
* data pre-inserted in (the high byte of) the original data.
*
* WARNING: Whenever we call readWord() under these circumstances, we zero the address parameter,
* so that the handler can distinguish this case. Thus, if we're dealing with a special register
* where a byte write operation modifies the entire register, the handler can simply return zero.
* if so, call the readWord() handler first to get the original data (with fPreWrite set to true) and call
* writeWord() with the new data inserted into (the high byte of) the original data.
*/
afn = bus.aIOHandlers[off & ~0x1];
if (afn) {
if (afn[BusPDP11.IOHANDLER.WRITE_WORD]) {
addrMasked &= ~0x1;
w = afn[BusPDP11.IOHANDLER.READ_WORD]? afn[BusPDP11.IOHANDLER.READ_WORD](0) : 0;
w = afn[BusPDP11.IOHANDLER.READ_WORD]? afn[BusPDP11.IOHANDLER.READ_WORD](addrMasked, true) : 0;
afn[BusPDP11.IOHANDLER.WRITE_WORD]((w & 0xff) | (b << 8), addrMasked);
fWrite = true;
} else if (afn[BusPDP11.IOHANDLER.WRITE_BYTE]) {
@ -930,11 +923,11 @@ BusPDP11.prototype.setMemoryBlocks = function(addr, size, aBlocks, type)
BusPDP11.prototype.getByte = function(addr)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
return this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].readByte(addr & this.nBlockLimit, addr);
@ -952,11 +945,11 @@ BusPDP11.prototype.getByte = function(addr)
BusPDP11.prototype.getByteDirect = function(addr)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
this.fFault = false;
@ -976,11 +969,11 @@ BusPDP11.prototype.getByteDirect = function(addr)
BusPDP11.prototype.getWord = function(addr)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
var off = addr & this.nBlockLimit;
@ -1003,11 +996,11 @@ BusPDP11.prototype.getWord = function(addr)
BusPDP11.prototype.getWordDirect = function(addr)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
var w;
@ -1034,11 +1027,11 @@ BusPDP11.prototype.getWordDirect = function(addr)
BusPDP11.prototype.setByte = function(addr, b)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
this.aMemBlocks[(addr & this.nBusMask) >>> this.nBlockShift].writeByte(addr & this.nBlockLimit, b & 0xff, addr);
@ -1057,11 +1050,11 @@ BusPDP11.prototype.setByte = function(addr, b)
BusPDP11.prototype.setByteDirect = function(addr, b)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
this.fFault = false;
@ -1080,11 +1073,11 @@ BusPDP11.prototype.setByteDirect = function(addr, b)
BusPDP11.prototype.setWord = function(addr, w)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
var off = addr & this.nBlockLimit;
@ -1110,11 +1103,11 @@ BusPDP11.prototype.setWord = function(addr, w)
BusPDP11.prototype.setWordDirect = function(addr, w)
{
/*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so we must pass the address through the
* UNIBUS relocation map.
*/
if (addr >= BusPDP11.IOPAGE_UNIBUS) {
if (addr >= BusPDP11.UNIBUS_22BIT) {
addr = this.cpu.mapUnibus(addr);
}
var off = addr & this.nBlockLimit;
@ -1272,7 +1265,7 @@ BusPDP11.prototype.getMemorySize = function(type)
};
/**
* addIOHandlers(start, end, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, sName)
* addIOHandlers(start, end, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, msgCategory, sName)
*
* Add I/O notification handlers to the master list (aIOHandlers). The start and end addresses are typically
* relative to the starting IOPAGE address, but they can also be absolute; we simply mask all addresses with
@ -1281,7 +1274,9 @@ BusPDP11.prototype.getMemorySize = function(type)
* CAVEATS: If a conflict is reported, a partial set of handlers may still have been added. There is no mechanism
* for removing handlers, since this is considered an initialization function. And finally, when a range of addresses
* is used, each successive address is advanced by 2, so if you really want to add a handler for a "+1" (usually odd)
* address, then you must add it individually.
* address, then you must add it individually. Failure to do is not necessarily fatal, because the IOController's
* fallback behavior for an odd address is to call the byte handler for the preceding even address, but the byte
* handler must be prepared for that (the handlers installed by ROM component's addROM() function are a good example).
*
* @this {BusPDP11}
* @param {number} start address
@ -1309,18 +1304,16 @@ BusPDP11.prototype.addIOHandlers = function(start, end, fnReadByte, fnWriteByte,
};
/**
* addIOTable(component, table, msgCategory, sName)
* addIOTable(component, table)
*
* Add I/O notification handlers from the specified table (a batch version of addIOHandlers).
*
* @this {BusPDP11}
* @param {Component} component
* @param {Object} table
* @param {number} [msgCategory] (default is BUS)
* @param {string} [sName]
* @return {boolean} (true if entire range successfully registered, false if any conflicts)
*/
BusPDP11.prototype.addIOTable = function(component, table, msgCategory, sName)
BusPDP11.prototype.addIOTable = function(component, table)
{
for (var port in table) {
var addr = +port;
@ -1336,7 +1329,6 @@ BusPDP11.prototype.addIOTable = function(component, table, msgCategory, sName)
var fnWriteByte = afn[1]? afn[1].bind(component) : null;
var fnReadWord = afn[2]? afn[2].bind(component) : null;
var fnWriteWord = afn[3]? afn[3].bind(component) : null;
var nRegs = afn[5] || 1;
/*
* As discussed in the IOController comments above, when handlers are being registered for these
@ -1360,9 +1352,11 @@ BusPDP11.prototype.addIOTable = function(component, table, msgCategory, sName)
}
var sReg = afn[4];
var nRegs = afn[5] || 1;
for (var iReg = 0; iReg < nRegs; iReg++, addr += 2) {
if (sReg && nRegs > 1) sReg = afn[4] + iReg;
if (!this.addIOHandlers(addr, addr, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, msgCategory || MessagesPDP11.BUS, sReg || sName)) {
if (!this.addIOHandlers(addr, addr, fnReadByte, fnWriteByte, fnReadWord, fnWriteWord, afn[7] || component.bitsMessage || MessagesPDP11.BUS, sReg || component.idComponent)) {
return false;
}
}

View file

@ -1067,8 +1067,8 @@ ComputerPDP11.prototype.updateDisplays = function(nUpdate)
* nUpdate will also be -1 whenever the Debugger has modified the state of the machine, implying that we're
* not sure what, if anything, actually changed.
*/
if (this.cpu) this.cpu.updateDisplay(nUpdate);
if (this.panel) this.panel.updateDisplay(nUpdate);
if (this.cpu) this.cpu.updateDisplay(nUpdate || 0);
if (this.panel) this.panel.updateDisplay(nUpdate || 0);
};
/**

View file

@ -105,6 +105,8 @@ function CPUPDP11(parmsCPU, nCyclesDefault)
var nMultiplier = parmsCPU['multiplier'] || 1;
this.nDisplayCount = 0;
this.nDisplayLimit = 30;
this.nCyclesPerSecond = nCycles;
/*
@ -525,12 +527,17 @@ CPUPDP11.prototype.updateDisplays = function(nUpdate)
* However, this should be called via the Computer's updateDisplays() interface, not directly.
*
* @this {CPUPDP11}
* @param {number} [nUpdate] (1 for periodic, -1 for forced, 0 or undefined otherwise)
* @param {number} [nUpdate] (1 for periodic, -1 for forced, 0 otherwise)
*/
CPUPDP11.prototype.updateDisplay = function(nUpdate)
{
var controlSpeed = this.bindings["speed"];
if (controlSpeed) controlSpeed.textContent = this.getSpeedCurrent();
if (controlSpeed) {
if (nUpdate <= 0 || (this.nDisplayCount += nUpdate) >= this.nDisplayLimit) {
controlSpeed.textContent = this.getSpeedCurrent();
this.nDisplayCount = 0;
}
}
};
/**
@ -684,7 +691,7 @@ CPUPDP11.prototype.getSpeedCurrent = function()
/*
* TODO: Has toFixed() been "fixed" in all browsers (eg, IE) to return a rounded value now?
*/
return ((this.flags.running && this.mhz)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
return ((this.flags.running)? (this.mhz.toFixed(2) + "Mhz") : "Stopped");
};
/**

View file

@ -1471,6 +1471,42 @@ PDP11.opRESET = function(opCode)
{
if (!(this.regPSW & PDP11.PSW.CMODE)) {
this.resetCPU();
if (this.panel) {
/*
* The PDP-11/70 XXDP test "EKBBF0" reports the following, with PANEL messages on ("m panel on"):
*
* CNSW.writeWord(177570,000101) @033502
* CNSW.readWord(177570): 000000 @032114
* LOOK AT THE CONSOLE LIGHTS
* THE DATA LIGHTS SHOULD READ 166667
* THE ADDRESS LIGHTS SHOULD READ CNSW.readWord(177570): 000000 @032150
* 032236
* CHANGE SWITCH 7 TO CONTINUE
* CNSW.readWord(177570): 000000 @032236
* stopped (31518011 instructions, 358048873 cycles, 58644 ms, 6105465 hz)
* R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642
* SP=001074 PC=032236 PS=000344 SR=00000000 T0 N0 Z1 V0 C0
* 032236: 032737 000200 177570 BIT #200,@#177570
* >> tr
* CNSW.readWord(177570): 000000 @032236 (cpu halted)
* R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642
* SP=001074 PC=032244 PS=000344 SR=00000000 T0 N0 Z1 V0 C0
* 032244: 001773 BEQ 032234 ;cycles=0
* >> tr
* R0=166667 R1=002362 R2=000000 R3=000000 R4=000000 R5=026642
* SP=001074 PC=032234 PS=000344 SR=00000000 T0 N0 Z1 V0 C0
* 032234: 000005 RESET ;cycles=5
*
* It's a little hard to see why the DATA lights should read 166667, since the PANEL messages indicate
* that the last CNSW.writeWord(177570) was for 000101, not 166667. So I'm guessing that the RESET
* instruction is supposed to propagate R0 to the console's DISPLAY register.
*
* This is similar to what we do for the HALT instruction on the PDP-11/20. None of these Console features
* seem to be very well documented (assuming they exist).
*/
this.panel.setData(this.regsGen[0], true);
}
}
this.nStepCycles -= 667; // TODO: Review (but it's definitely a big number)
};
@ -1739,7 +1775,7 @@ PDP11.opSWAB = function(opCode)
*/
PDP11.opSXT = function(opCode)
{
this.updateNZVFlags(this.writeDstWord(opCode, this.getNF? 0xffff : 0));
this.updateNZVFlags(this.writeDstWord(opCode, this.getNF()? 0xffff : 0));
this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0));
};
@ -1846,7 +1882,8 @@ PDP11.opWAIT = function(opCode)
*/
PDP11.opXOR = function(opCode)
{
this.updateDstWord(opCode, this.readSrcWord(opCode), PDP11.fnXOR);
var reg = (opCode >> PDP11.SRCMODE.SHIFT) & PDP11.OPREG.MASK;
this.updateDstWord(opCode, this.regsGen[reg], PDP11.fnXOR);
this.nStepCycles -= (this.dstMode? (8 + 1) : (2 + 1) + (this.dstReg == 7? 2 : 0));
};

View file

@ -169,9 +169,10 @@ CPUStatePDP11.prototype.initRegs = function()
/*
* TODO: Verify the initial state of all PDP-11 flags and registers (are they well-documented?)
*/
var f = 0xffff;
this.flagC = 0x10000; // PSW C bit
this.flagV = 0x8000; // PSW V bit
this.flagZ = 0xffff; // ~ PSW Z bit (TODO: Why do we clear instead of set Z, like other flags?)
this.flagZ = f; // ~ PSW Z bit (TODO: Why do we clear instead of set Z, like other flags?)
this.flagN = 0x8000; // PSW N bit
this.regPSW = 0x000f; // PSW other bits (TODO: What's the point of setting the flag bits here, too?)
this.regsGen = [ // General R0 - R7
@ -180,24 +181,23 @@ CPUStatePDP11.prototype.initRegs = function()
this.regsAlt = [ // Alternate R0 - R5
0, 0, 0, 0, 0, 0
];
this.regsAltStack = [ // Alternate R6 stack pointers (KERNEL, SUPER, illegal, USER)
this.regsAltStack = [ // Alternate R6 stack pointers (KERNEL, SUPER, UNUSED, USER)
0, 0, 0, 0
];
this.mmuMode = 0; // current memory management mode (see PDP11.MODE.KERNEL | SUPER | UNUSED | USER)
this.mmuLastPage = 0;
this.mmuLastVirtual = 0;
this.mapMMR3 = [4,2,0,1]; // map from mode to MMR3 I/D bit
this.mmuPDR = [ // memory management PDR registers by mode
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // kernel 0
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // super 1
[0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff], // mode 2 with illegal PDRs
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // user 3
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPDR regs followed by 8 KDPDR regs)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs)
[f, f, f, f, f, f, f, f, f, f, f, f, f, f, f, f], // mode 2 (not used)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs)
];
this.mmuPAR = [ // memory management PAR registers by mode
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // kernel 0
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // super 1
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // KERNEL (8 KIPAR regs followed by 8 KDPAR regs)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // SUPER (8 SIPDR regs followed by 8 SDPDR regs)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], // mode 2 (not used)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // user 3
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] // USER (8 UIPDR regs followed by 8 UDPDR regs)
];
this.unibusMap = [ // 32 unibus map registers
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
@ -222,7 +222,7 @@ CPUStatePDP11.prototype.initRegs = function()
this.dstMode = this.dstReg = this.dstAddr = 0;
this.trapPSW = -1;
this.resetRegs();
this.resetMMU();
};
/**
@ -233,35 +233,48 @@ CPUStatePDP11.prototype.initRegs = function()
CPUStatePDP11.prototype.resetCPU = function()
{
this.bus.reset();
this.resetRegs();
this.resetMMU();
};
/**
* resetRegs()
* resetMMU()
*
* @this {CPUStatePDP11}
*/
CPUStatePDP11.prototype.resetRegs = function()
CPUStatePDP11.prototype.resetMMU = function()
{
this.regSL = 0xff; // 177774
this.regErr = 0; // 177766
this.regPIR = 0; // 177772
this.regMMR0 = 0; // 177572
this.regMMR1 = 0; // 177574
this.regMMR2 = 0; // 177576
this.regMMR3 = 0; // 172516
this.regErr = 0; // 177766
this.regPIR = 0; // 177772
this.regSL = 0xff; // 177774
this.mmuEnable = 0; // MMU enabled for PDP11.ACCESS.READ or PDP11.ACCESS.WRITE
this.mmuLastMode = 0;
this.mmuMask = 0x3ffff;
this.lastAI = 0; // last auto-incs and/or auto-decs; this gets propagated to MMR1
this.lastPC = 0; // last PC at the time of getOpcode(); this get propagated to MMR2
this.lastAddr = 0; // this is queried by the Panel when it's not using its own ADDRESS register
this.lastOp = 0; // stores the PC and any auto-incs or auto-decs from the last opcode; used to update MMR1 and MMR2
this.resetTriggers();
if (this.bus) this.setMemoryAccess();
};
/**
* getMMUState()
*
* Returns bit 0 set if 22-bit, bit 1 set if 18-bit, or bit 2 set if 16-bit; used by the Panel component.
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getMMUState = function()
{
return this.mmuEnable? ((this.regMMR3 & PDP11.MMR3.MMU_22BIT)? 1 : 2) : 4;
};
/**
* setMemoryAccess()
*
@ -277,12 +290,14 @@ CPUStatePDP11.prototype.setMemoryAccess = function()
{
if (this.mmuEnable) {
this.addrDSpace = PDP11.ACCESS.DSPACE;
this.addrIOPage = (this.regMMR3 & PDP11.MMR3.MMU_22BIT)? BusPDP11.IOPAGE_22BIT : BusPDP11.IOPAGE_18BIT;
this.getAddr = this.getVirtualAddrByMode;
this.readWord = this.readWordFromVirtual;
this.writeWord = this.writeWordToVirtual;
this.bus.setIOPageRange((this.regMMR3 & PDP11.MMR3.MMU_22BIT)? 22 : 18);
} else {
this.addrDSpace = 0;
this.addrIOPage = BusPDP11.IOPAGE_16BIT;
this.getAddr = this.getPhysicalAddrByMode;
this.readWord = this.readWordFromPhysical;
this.writeWord = this.writeWordToPhysical;
@ -293,6 +308,8 @@ CPUStatePDP11.prototype.setMemoryAccess = function()
/**
* getMMR0()
*
* NOTE: It's OK to bypass this function if you're only interested in bits that always stored directly in MMR0.
*
* 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 MMR0
* nonr leng read trap unus unus ena mnt cmp -mode- i/d --page-- enable
*
@ -301,7 +318,11 @@ CPUStatePDP11.prototype.setMemoryAccess = function()
*/
CPUStatePDP11.prototype.getMMR0 = function()
{
return (this.regMMR0 & 0xf381) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1);
var data = this.regMMR0;
if (!(data & PDP11.MMR0.ABORT)) {
data = (data & ~(PDP11.MMR0.UNUSED | PDP11.MMR0.PAGE | PDP11.MMR0.MODE)) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1);
}
return data;
};
/**
@ -312,8 +333,22 @@ CPUStatePDP11.prototype.getMMR0 = function()
*/
CPUStatePDP11.prototype.setMMR0 = function(newMMR0)
{
newMMR0 &= 0xf381;
newMMR0 &= ~PDP11.MMR0.UNUSED;
if (this.regMMR0 != newMMR0) {
if (newMMR0 & PDP11.MMR0.ABORT) {
/*
* If updates to MMR0[1-7], MMR1, and MMR2 are being shut off (ie, MMR0.ABORT bits are transitioning
* from clear to set), then do one final sync with their real-time counterparts in lastOp.
*/
if (!(this.regMMR0 & PDP11.MMR0.ABORT)) {
this.regMMR1 = (this.lastOp >> 16) & 0xffff;
this.regMMR2 = this.lastOp & 0xffff;
}
}
/*
* NOTE: We are not protecting the read-only state of the COMPLETED bit here; that's handled by writeMMR0().
*/
this.regMMR0 = newMMR0;
this.mmuLastMode = (newMMR0 >> 5) & 3;
this.mmuLastPage = (newMMR0 >> 1) & 0xf;
@ -339,8 +374,12 @@ CPUStatePDP11.prototype.setMMR0 = function(newMMR0)
*/
CPUStatePDP11.prototype.getMMR1 = function()
{
/*
* If updates to MMR1 have not been shut off (ie, MMR0.ABORT bits are clear),
* then we are allowed to sync MMR1 with its real-time counterpart in lastOp.
*/
if (!(this.regMMR0 & PDP11.MMR0.ABORT)) {
this.regMMR1 = this.lastAI & 0xffff;
this.regMMR1 = (this.lastOp >> 16) & 0xffff;
}
var result = this.regMMR1;
if (result & 0xff00) {
@ -357,8 +396,12 @@ CPUStatePDP11.prototype.getMMR1 = function()
*/
CPUStatePDP11.prototype.getMMR2 = function()
{
/*
* If updates to MMR2 have not been shut off (ie, MMR0.ABORT bits are clear),
* then we are allowed to sync MMR2 with its real-time counterpart in lastOp.
*/
if (!(this.regMMR0 & PDP11.MMR0.ABORT)) {
this.regMMR2 = this.lastPC;
this.regMMR2 = this.lastOp & 0xffff;
}
return this.regMMR2;
};
@ -602,8 +645,7 @@ CPUStatePDP11.prototype.setNF = function()
CPUStatePDP11.prototype.getOpcode = function()
{
var pc = this.regsGen[PDP11.REG.PC];
this.lastAI = 0;
this.lastPC = pc;
this.lastOp = pc;
/*
* If PC is unaligned, a BUS trap will be generated, and because it will generate an
* exception, the next line (the equivalent of advancePC(2)) will not be executed, ensuring that
@ -643,6 +685,17 @@ CPUStatePDP11.prototype.getPC = function()
return this.regsGen[PDP11.REG.PC];
};
/**
* getLastAddr()
*
* @this {CPUStatePDP11}
* @return {number}
*/
CPUStatePDP11.prototype.getLastAddr = function()
{
return this.lastAddr;
};
/**
* getLastPC()
*
@ -651,7 +704,7 @@ CPUStatePDP11.prototype.getPC = function()
*/
CPUStatePDP11.prototype.getLastPC = function()
{
return this.lastPC;
return this.lastOp & 0xffff;
};
/**
@ -1225,19 +1278,6 @@ CPUStatePDP11.prototype.updateSubFlags = function(result, src, dst)
}
};
/**
* panic(reason)
*
* TODO: Something.
*
* @this {CPUStatePDP11}
* @param {number} reason
*/
CPUStatePDP11.prototype.panic = function(reason)
{
console.log("panic(" + reason + ")");
};
/**
* trap(vector, flag, reason)
*
@ -1277,8 +1317,19 @@ CPUStatePDP11.prototype.trap = function(vector, flag, reason)
reason = PDP11.REASON.RED;
}
this.lastPC = vector;
this.lastAI = 0;
/*
* NOTE: Pre-setting the auto-dec values for MMR1 to 0xF6F6 is a work-around for an "EKBEE1"
* diagnostic (PC 056710), which tests what happens when a misaligned read triggers a BUS trap,
* and that trap then triggers an MMU trap during the first pushWord() below.
*
* One would think it would be fine to zero those bits by setting lastOp to vector alone,
* and then letting each of the pushWord() calls below shift their own 0xF6 auto-dec value into
* lastOp. When the first pushWord() triggers an MMU trap, we obviously won't get to the second
* pushWord(), yet the diagnostic expects TWO auto-decs to be recorded. I'm puzzled why the
* hardware apparently indicates TWO auto-decs, if SP wasn't actually decremented twice, but who
* am I to judge.
*/
this.lastOp = vector | 0xf6f60000;
/*
* Read from kernel D space
@ -1381,7 +1432,7 @@ CPUStatePDP11.prototype.getTrapStatus = function()
/**
* mapUnibus(addr)
*
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.IOPAGE_UNIBUS aka 0x3C0000),
* If bits 18-21 of addr are all set (which is implied by addr >= BusPDP11.UNIBUS_22BIT aka 0x3C0000),
* then we have a 22-bit address pointing to the top 256Kb range, so if the UNIBUS relocation map is enabled,
* we must pass the lower 18 bits of that address through the map.
*
@ -1418,8 +1469,19 @@ CPUStatePDP11.prototype.mapUnibus = function(addr)
var idx = (addr >> 13) & 0x1f;
if (idx < 31) {
if (this.regMMR3 & PDP11.MMR3.UNIBUS_MAP) {
/*
* The UNIBUS map relocation is enabled
*/
addr = (this.unibusMap[idx] + (addr & 0x1ffe)) & 0x3ffffe;
if (addr >= BusPDP11.IOPAGE_UNIBUS && addr < BusPDP11.IOPAGE_22BIT) this.panic(898);
this.assert(addr < BusPDP11.UNIBUS_22BIT || addr >= BusPDP11.IOPAGE_22BIT);
} else {
/*
* Since UNIBUS map relocation is NOT enabled, then as explained above:
*
* If the UNIBUS map relocation is not enabled, an incoming 18-bit UNIBUS address has 4 leading zeroes added for
* referencing a 22-bit physical address. The lower 18 bits are the same. No relocation is performed.
*/
addr &= ~BusPDP11.UNIBUS_22BIT;
}
}
return addr;
@ -1490,53 +1552,85 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
* This can happen when the DSTMODE (MAINT) bit of MMR0 is set but *not* the ENABLED bit.
*/
if (!(accessFlags & this.mmuEnable)) {
return virtualAddress;
physicalAddress = virtualAddress & 0xffff;
if (physicalAddress >= BusPDP11.IOPAGE_16BIT) {
physicalAddress |= this.addrIOPage;
}
return physicalAddress;
}
this.mmuLastVirtual = virtualAddress;
page = virtualAddress >> 13;
if (!(this.regMMR3 & this.mapMMR3[this.mmuMode])) page &= 7;
pdr = this.mmuPDR[this.mmuMode][page];
physicalAddress = ((this.mmuPAR[this.mmuMode][page] << 6) + (virtualAddress & 0x1fff)) & this.mmuMask;
var errorMask = 0;
switch (pdr & 0x7) {
case 1: // read-only with trap
errorMask = PDP11.MMR0.TRAP_MMU;
if (this.nDisableTraps) return physicalAddress;
/*
* This next bit is the weirdness that Paul mentions in the function description above:
*
* As an aside it turns out that it is the memory management unit that does odd address and
* non-existent memory trapping: who knew? :-) I thought these would have been handled at access time.
*
* I haven't imported the non-existent memory checks he performed (yet); I would like to see the problems
* in action first.
*
* As for the ODDADDR error that's supposed to generate a BUS error rather than an MMU error, this happens
* in TEST #122 ("KT BEND") in the "EKBEE1" diagnostic (PC 076456).
*/
if ((physicalAddress & 0x1) && !(accessFlags & PDP11.ACCESS.BYTE)) {
this.regErr |= PDP11.CPUERR.ODDADDR;
this.trap(PDP11.TRAP.BUS, 0, physicalAddress);
}
var newMMR0 = 0;
switch (pdr & PDP11.PDR.ACF.MASK) {
case PDP11.PDR.ACF.RO1: // 0x1: read-only, abort on write attempt, memory management trap on read (11/70 only)
newMMR0 = PDP11.MMR0.TRAP_MMU;
/* falls through */
case 2: // read-only
pdr |= 0x80; // Set A bit
case PDP11.PDR.ACF.RO: // 0x2: read-only, abort on write attempt
pdr |= PDP11.PDR.ACCESSED;
if (accessFlags & PDP11.ACCESS.WRITE) {
errorMask = PDP11.MMR0.ABORT_RO;
newMMR0 = PDP11.MMR0.ABORT_RO;
}
break;
case 4: // read-write with read-write trap
errorMask = PDP11.MMR0.TRAP_MMU;
case PDP11.PDR.ACF.RW1: // 0x4: read/write, memory management trap upon completion of a read or write
newMMR0 = PDP11.MMR0.TRAP_MMU;
/* falls through */
case 5: // read-write with write trap
case PDP11.PDR.ACF.RW2: // 0x5: read/write, memory management trap upon completion of a write (11/70 only)
if (accessFlags & PDP11.ACCESS.WRITE) {
errorMask = PDP11.MMR0.TRAP_MMU;
newMMR0 = PDP11.MMR0.TRAP_MMU;
}
/* falls through */
case 6: // read-write: set A & W bits
pdr |= ((accessFlags & PDP11.ACCESS.WRITE) ? 0xc0 : 0x80);
case PDP11.PDR.ACF.RW: // 0x6: read/write, no system trap/abort action
pdr |= ((accessFlags & PDP11.ACCESS.WRITE) ? (PDP11.PDR.ACCESSED | PDP11.PDR.MODIFIED) : PDP11.PDR.ACCESSED);
break;
default:
errorMask = PDP11.MMR0.ABORT_NR;
default: // 0x0 (non-resident, abort all accesses) or 0x3 or 0x7 (unused, abort all accesses)
newMMR0 = PDP11.MMR0.ABORT_NR;
break;
}
if ((pdr & 0x7f08) != 0x7f00) { // skip checking most common case (hopefully)
if (pdr & 0x8) { // expand downwards
if (pdr & 0x7f00) {
if ((virtualAddress & 0x1fc0) < ((pdr >> 2) & 0x1fc0)) {
errorMask |= PDP11.MMR0.ABORT_PL;
if ((pdr & (PDP11.PDR.PLF | PDP11.PDR.ED)) != PDP11.PDR.PLF) { // skip checking most common case (hopefully)
/*
* The Page Descriptor Register (PDR) Page Length Field (PLF) is a 7-bit block number, where a block
* is 64 bytes. Since the bit 0 of the block number is located at bit 8 of the PDR, we shift the PDR
* right 2 bits and then clear the bottom 6 bits by masking it with 0x1FC0.
*/
if (pdr & PDP11.PDR.ED) {
if (pdr & PDP11.PDR.PLF) {
if ((virtualAddress & 0x1FC0) < ((pdr >> 2) & 0x1FC0)) {
newMMR0 |= PDP11.MMR0.ABORT_PL;
}
}
} else { // expand upwards
if ((virtualAddress & 0x1fc0) > ((pdr >> 2) & 0x1fc0)) {
errorMask |= PDP11.MMR0.ABORT_PL;
} else {
if ((virtualAddress & 0x1FC0) > ((pdr >> 2) & 0x1FC0)) {
newMMR0 |= PDP11.MMR0.ABORT_PL;
}
}
}
@ -1551,14 +1645,22 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
this.mmuLastPage = page;
}
var fAbort = false;
if (errorMask) {
if (errorMask & PDP11.MMR0.ABORT) {
if (this.trapPSW >= 0) errorMask |= 0x80; // Instruction complete
if (!(this.regMMR0 & PDP11.MMR0.ABORT)) {
this.regMMR0 |= errorMask | (this.mmuLastMode << 5) | (this.mmuLastPage << 1);
if (newMMR0) {
if (newMMR0 & PDP11.MMR0.ABORT) {
if (this.trapPSW >= 0) {
newMMR0 |= PDP11.MMR0.COMPLETED;
}
fAbort = true;
if (!(this.regMMR0 & PDP11.MMR0.ABORT)) {
newMMR0 |= (this.regMMR0 & PDP11.MMR0.TRAP_MMU) | (this.mmuLastMode << 5) | (this.mmuLastPage << 1);
this.assert(!(newMMR0 & ~PDP11.MMR0.UPDATE));
this.setMMR0((this.regMMR0 & ~PDP11.MMR0.UPDATE) | (newMMR0 & PDP11.MMR0.UPDATE));
}
/*
* TODO: In unusual circumstances, if regMMR0 already indicated an ABORT condition above,
* we run the risk of infinitely looping; eg, we call trap(), which calls mapVirtualToPhysical()
* on the trap vector, which faults again, etc. We should add some safeguards against that.
*/
this.trap(PDP11.TRAP.MMU, PDP11.OPFLAG.TRAP_MMU, PDP11.REASON.ABORT);
}
if (!(this.regMMR0 & (PDP11.MMR0.ABORT | PDP11.MMR0.TRAP_MMU))) {
/*
@ -1572,9 +1674,6 @@ CPUStatePDP11.prototype.mapVirtualToPhysical = function(virtualAddress, accessFl
}
}
}
if (fAbort) { // don't abort until the end, because it throws an exception
this.trap(PDP11.TRAP.MMU, 0, PDP11.REASON.ABORT);
}
}
return physicalAddress;
};
@ -1627,7 +1726,7 @@ CPUStatePDP11.prototype.pushWord = function(data)
{
var virtualAddress = (this.regsGen[6] - 2) & 0xffff;
this.regsGen[6] = virtualAddress; // BSD needs SP updated before any fault :-(
this.lastAI = (this.lastAI << 8) | 0xf6;
this.lastOp = (this.lastOp & 0xffff) | ((this.lastOp & ~0xffff) << 8) | (0x00f6 << 16);
this.checkStackLimit(0, virtualAddress);
this.writeWord(virtualAddress, data);
};
@ -1812,7 +1911,7 @@ CPUStatePDP11.prototype.getAddrByMode = function(mode, reg, accessFlags)
}
this.regsGen[reg] = (this.regsGen[reg] + step) & 0xffff;
this.lastAI = (this.lastAI << 8) | ((step << 3) & 0xf8) | reg;
this.lastOp = (this.lastOp & 0xffff) | ((this.lastOp & ~0xffff) << 8) | ((((step << 3) & 0xf8) | reg) << 16);
/*
* NOTE: We had to eliminate the test for "(accessFlags & PDP11.ACCESS.WRITE)", because DEC's
@ -1951,7 +2050,7 @@ CPUStatePDP11.prototype.getVirtualAddrByMode = function(mode, reg, accessFlags)
*/
CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
{
return this.bus.getWord(physicalAddress);
return this.bus.getWord(this.lastAddr = physicalAddress);
};
/**
@ -1965,7 +2064,7 @@ CPUStatePDP11.prototype.readWordFromPhysical = function(physicalAddress)
*/
CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
{
return this.bus.getWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
return this.bus.getWord(this.lastAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.READ_WORD));
};
/**
@ -1979,7 +2078,7 @@ CPUStatePDP11.prototype.readWordFromVirtual = function(virtualAddress)
*/
CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
{
this.bus.setWord(physicalAddress, data & 0xffff);
this.bus.setWord(this.lastAddr = physicalAddress, data & 0xffff);
};
/**
@ -1993,7 +2092,7 @@ CPUStatePDP11.prototype.writeWordToPhysical = function(physicalAddress, data)
*/
CPUStatePDP11.prototype.writeWordToVirtual = function(virtualAddress, data)
{
this.bus.setWord(this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE_WORD), data);
this.bus.setWord(this.lastAddr = this.mapVirtualToPhysical(virtualAddress, PDP11.ACCESS.WRITE_WORD), data);
};
/**
@ -2037,7 +2136,7 @@ CPUStatePDP11.prototype.readWordFromPrevSpace = function(opCode, accessFlags)
*/
CPUStatePDP11.prototype.writeWordToPrevSpace = function(opCode, accessFlags, data)
{
this.lastAI = 0x0016;
this.lastOp = (this.lastOp & 0xffff) | (0x0016 << 16);
var reg = this.dstReg = opCode & PDP11.OPREG.MASK;
var mode = this.dstMode = (opCode & PDP11.OPMODE.MASK) >> PDP11.OPMODE.SHIFT;
if (!mode) {

View file

@ -266,7 +266,32 @@ if (DEBUGGER) {
* Register numbers 0-7 are reserved for cpu.regsGen, 8-15 are reserved for cpu.regsAlt, and 16-19 for cpu.regsStack.
*/
DebuggerPDP11.REG_PSW = 20;
DebuggerPDP11.REG_SR = 21; // SWITCH register; see Panel's getSR() and setSR()
DebuggerPDP11.REG_PIR = 21;
DebuggerPDP11.REG_ERR = 22;
DebuggerPDP11.REG_SL = 23;
DebuggerPDP11.REG_MMR0 = 24;
DebuggerPDP11.REG_MMR1 = 25;
DebuggerPDP11.REG_MMR2 = 26;
DebuggerPDP11.REG_MMR3 = 27;
DebuggerPDP11.REG_AR = 28; // ADDRESS register; see Panel's getAR() and setAR()
DebuggerPDP11.REG_DR = 29; // DISPLAY/DATA register; see Panel's getDR() and setDR()
DebuggerPDP11.REG_SR = 30; // SWITCH register; see Panel's getSR() and setSR()
DebuggerPDP11.REGS = {
"SP": 6,
"PC": 7,
"PS": DebuggerPDP11.REG_PSW,
"IR": DebuggerPDP11.REG_PIR,
"ER": DebuggerPDP11.REG_ERR,
"SL": DebuggerPDP11.REG_SL,
"MMR0": DebuggerPDP11.REG_MMR0,
"MMR1": DebuggerPDP11.REG_MMR1,
"MMR2": DebuggerPDP11.REG_MMR2,
"MMR3": DebuggerPDP11.REG_MMR3,
"AR": DebuggerPDP11.REG_AR,
"DR": DebuggerPDP11.REG_DR,
"SR": DebuggerPDP11.REG_SR
};
/*
* Operand type masks; anything that's not covered by OP_SRC or OP_DST must be a OP_OTHER value.
@ -322,7 +347,7 @@ if (DEBUGGER) {
0x7200: [DebuggerPDP11.OPS.DIV, DebuggerPDP11.OP_DST, DebuggerPDP11.OP_SRCREG], // 071RSS
0x7400: [DebuggerPDP11.OPS.ASH, DebuggerPDP11.OP_DST, DebuggerPDP11.OP_SRCREG], // 072RSS
0x7600: [DebuggerPDP11.OPS.ASHC, DebuggerPDP11.OP_DST, DebuggerPDP11.OP_SRCREG], // 073RSS
0x7800: [DebuggerPDP11.OPS.XOR, DebuggerPDP11.OP_SRCREG, DebuggerPDP11.OP_DST], // 074RSS
0x7800: [DebuggerPDP11.OPS.XOR, DebuggerPDP11.OP_SRCREG, DebuggerPDP11.OP_DST], // 074RDD
0x7E00: [DebuggerPDP11.OPS.SOB, DebuggerPDP11.OP_SRCREG, DebuggerPDP11.OP_DSTOFF] // 077Rnn
},
0xFF00: {
@ -559,7 +584,7 @@ if (DEBUGGER) {
var fCompleted = false;
if (!dbg.isBusy(true)) {
dbg.setBusy(true);
fCompleted = dbg.stepCPU(fRepeat? 1 : 0);
fCompleted = dbg.stepCPU(fRepeat? 1 : 0, null);
dbg.setBusy(false);
}
return fCompleted;
@ -583,7 +608,7 @@ if (DEBUGGER) {
{
if (this.controlDebug) {
/*
* This seems to be recommended work-around to prevent the browser from scrolling the focused element
* This is the recommended work-around to prevent the browser from scrolling the focused element
* into view. The CPU is not a visual component, so when the CPU wants to set focus, the primary intent
* is to ensure that keyboard input is fielded properly.
*/
@ -1118,24 +1143,14 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.getRegIndex = function(sReg, off)
{
var iReg = -1;
sReg = sReg.toUpperCase();
switch(sReg) {
case "SP":
iReg = 6;
break;
case "PC":
iReg = 7;
break;
case "SR":
iReg = 21;
break;
default:
var iReg = DebuggerPDP11.REGS[sReg];
if (iReg == null) {
iReg = -1;
if (sReg.charAt(0) == "R") {
iReg = +sReg.charAt(1);
if (iReg < 0 || iReg > 7) iReg = -1;
}
break;
}
return iReg;
};
@ -1156,7 +1171,7 @@ if (DEBUGGER) {
* getRegValue(iReg)
*
* Register numbers 0-7 are reserved for cpu.regsGen, 8-15 are reserved for cpu.regsAlt,
* 16-19 for cpu.regsAltStack, 20 for regPSW, and 21 for SR (SWITCH register).
* 16-19 for cpu.regsAltStack, 20 for regPSW, etc.
*
* @this {DebuggerPDP11}
* @param {number} iReg
@ -1175,11 +1190,46 @@ if (DEBUGGER) {
else if (iReg < 20) {
value = this.cpu.regsAltStack[iReg-16];
}
else if (iReg == DebuggerPDP11.REG_PSW) {
value = this.cpu.getPSW();
}
else if (iReg == DebuggerPDP11.REG_SR && this.panel && this.panel.hasSwitches()) {
value = this.panel.getSR();
else {
var cpu = this.cpu;
var panel = this.panel;
switch(iReg) {
case DebuggerPDP11.REG_PSW:
value = this.cpu.getPSW();
break;
case DebuggerPDP11.REG_PIR:
value = cpu.regPIR;
break;
case DebuggerPDP11.REG_ERR:
value = cpu.regErr;
break;
case DebuggerPDP11.REG_SL:
value = cpu.regSL;
break;
case DebuggerPDP11.REG_MMR0:
value = cpu.getMMR0();
break;
case DebuggerPDP11.REG_MMR1:
value = cpu.getMMR1();
break;
case DebuggerPDP11.REG_MMR2:
value = cpu.getMMR2();
break;
case DebuggerPDP11.REG_MMR3:
value = cpu.getMMR3();
break;
case DebuggerPDP11.REG_AR:
if (panel) value = panel.getAR();
break;
case DebuggerPDP11.REG_DR:
if (panel) value = panel.getDR();
break;
case DebuggerPDP11.REG_SR:
if (panel && panel.hasSwitches()) {
value = panel.getSR();
}
break;
}
}
}
return value;
@ -1220,9 +1270,10 @@ if (DEBUGGER) {
if (this.sMessagePrev && sMessage == this.sMessagePrev) return;
this.sMessagePrev = sMessage;
if ((this.bitsMessage & MessagesPDP11.HALT) && this.cpu && this.cpu.isRunning() || this.isBusy(true)) {
var fRunning = false;
if ((this.bitsMessage & MessagesPDP11.HALT) && this.cpu && (fRunning = this.cpu.isRunning()) || this.isBusy(true)) {
this.stopCPU();
sMessage += " (cpu halted)";
if (fRunning) sMessage += " (cpu halted)";
}
this.println(sMessage); // + " (" + this.cpu.getCycles() + " cycles)"
@ -1317,7 +1368,7 @@ if (DEBUGGER) {
*
* @this {DebuggerPDP11}
* @param {number} nCycles (0 for one instruction without checking breakpoints)
* @param {boolean} [fRegs] is true to display registers after step (default is false)
* @param {boolean|null} [fRegs] is true to display registers after step (default is false; use null for previous setting)
* @param {boolean} [fUpdateDisplays] is false to disable Computer display updates (default is true)
* @return {boolean}
*/
@ -1325,6 +1376,10 @@ if (DEBUGGER) {
{
if (!this.checkCPU()) return false;
if (fRegs === null) {
fRegs = (!this.sTraceCmdPrev || this.sTraceCmdPrev == "tr");
}
this.nCycles = 0;
if (!nCycles) {
@ -1367,6 +1422,7 @@ if (DEBUGGER) {
* is calling us in a loop, in which case it will perform its own updateDisplays() when it's done.
*/
if (fUpdateDisplays !== false) {
if (this.panel && this.panel.stop) this.panel.stop();
this.cmp.updateDisplays(-1);
}
@ -1583,9 +1639,9 @@ if (DEBUGGER) {
if (this.checksEnabled()) {
sStopped += this.cInstructions + " instructions, ";
/*
* $ops displays progress by calculating cOpcodes - cOpcodesStart, so before
* zeroing cOpcodes, we should subtract cOpcodes from cOpcodesStart (since we're
* effectively subtracting cOpcodes from cOpcodes as well).
* $ops displays progress by calculating cInstructions - cInstructionsStart, so before
* zeroing cInstructions, we should subtract cInstructions from cInstructionsStart (since
* we're effectively subtracting cInstructions from cInstructions as well).
*/
this.cInstructionsStart -= this.cInstructions;
this.cInstructions = 0;
@ -2147,16 +2203,16 @@ if (DEBUGGER) {
sOperands += (sOperand || "???");
}
var sOpcodes = "";
var sOpCodes = "";
var sLine = this.toStrAddr(dbgAddrOp) + ":";
if (dbgAddrOp.addr !== PDP11.ADDR_INVALID && dbgAddr.addr !== PDP11.ADDR_INVALID) {
do {
sOpcodes += ' ' + this.toStrBase(this.getWord(dbgAddrOp, 2));
sOpCodes += ' ' + this.toStrBase(this.getWord(dbgAddrOp, 2));
if (dbgAddrOp.addr == null) break;
} while (dbgAddrOp.addr != dbgAddr.addr);
}
sLine += str.pad(sOpcodes, 24);
sLine += str.pad(sOpCodes, 24);
sLine += str.pad(sOpName, 5);
if (sOperands) sLine += ' ' + sOperands;
@ -2389,28 +2445,86 @@ if (DEBUGGER) {
else if (iReg >= 16 && iReg < 20) {
sReg = "S" + (iReg - 16) + '=' + this.toStrBase(cpu.regsAltStack[iReg - 16]);
}
else if (iReg == DebuggerPDP11.REG_PSW) {
sReg = "PS=" + this.toStrBase(cpu.getPSW());
}
else if (iReg == DebuggerPDP11.REG_SR && this.panel && this.panel.hasSwitches()) {
sReg = "SR=" + this.toStrBase(this.panel.getSR(), 3);
else {
switch(iReg) {
case DebuggerPDP11.REG_PSW:
sReg = "PS=" + this.toStrBase(cpu.getPSW());
break;
case DebuggerPDP11.REG_PIR:
sReg = "IR=" + this.toStrBase(cpu.regPIR);
break;
case DebuggerPDP11.REG_ERR:
sReg = "ER=" + this.toStrBase(cpu.regErr);
break;
case DebuggerPDP11.REG_SL:
sReg = "SL=" + this.toStrBase(cpu.regSL);
break;
case DebuggerPDP11.REG_MMR0:
sReg = "MMR0=" + this.toStrBase(cpu.getMMR0());
break;
case DebuggerPDP11.REG_MMR1:
sReg = "MMR1=" + this.toStrBase(cpu.getMMR1());
break;
case DebuggerPDP11.REG_MMR2:
sReg = "MMR2=" + this.toStrBase(cpu.getMMR2());
break;
case DebuggerPDP11.REG_MMR3:
sReg = "MMR3=" + this.toStrBase(cpu.getMMR3());
break;
case DebuggerPDP11.REG_AR:
if (this.panel) {
sReg = "AR=" + this.toStrBase(this.panel.getAR(), 3);
}
break;
case DebuggerPDP11.REG_DR:
if (this.panel) {
sReg = "DR=" + this.toStrBase(this.panel.getDR());
}
break;
case DebuggerPDP11.REG_SR:
if (this.panel && this.panel.hasSwitches()) {
sReg = "SR=" + this.toStrBase(this.panel.getSR(), 3);
}
break;
}
}
if (sReg) sReg += ' ';
return sReg;
};
/**
* getRegDump()
* getMiscDump()
*
* Sample register dump:
*
* R0=xxxx R1=xxxx R2=xxxx R3=xxxx R4=xxxx R5=xxxx
* SP=xxxx PC=xxxx PS=xxxx T0 N0 Z0 V0 C0
* MMR0=xxxxxx MMR1=xxxxxx MMR2=xxxxxx MMR3=xxxxxx ER=xxxxxx
*
* @this {DebuggerPDP11}
* @return {string}
*/
DebuggerPDP11.prototype.getRegDump = function()
DebuggerPDP11.prototype.getMiscDump = function()
{
var sDump = "";
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR0) + this.getRegOutput(DebuggerPDP11.REG_MMR1);
sDump += this.getRegOutput(DebuggerPDP11.REG_MMR2) + this.getRegOutput(DebuggerPDP11.REG_MMR3) + this.getRegOutput(DebuggerPDP11.REG_ERR);
sDump += '\n';
sDump += this.getRegOutput(DebuggerPDP11.REG_SR) + this.getRegOutput(DebuggerPDP11.REG_AR) + this.getRegOutput(DebuggerPDP11.REG_DR);
return sDump;
};
/**
* getRegDump(fMisc)
*
* Sample register dump:
*
* R0=xxxxxx R1=xxxxxx R2=xxxxxx R3=xxxxxx R4=xxxxxx R5=xxxxxx
* SP=xxxxxx PC=xxxxxx PS=xxxxxx IR=xxxxxx SL=xxxxxx T0 N0 Z0 V0 C0
*
* @this {DebuggerPDP11}
* @param {boolean} [fMisc] (true to include misc registers)
* @return {string}
*/
DebuggerPDP11.prototype.getRegDump = function(fMisc)
{
var i;
var sDump = "";
@ -2419,8 +2533,9 @@ if (DEBUGGER) {
}
sDump += '\n';
sDump += this.getRegOutput(PDP11.REG.SP) + this.getRegOutput(PDP11.REG.PC);
sDump += this.getRegOutput(DebuggerPDP11.REG_PSW) + this.getRegOutput(DebuggerPDP11.REG_SR);
sDump += this.getRegOutput(DebuggerPDP11.REG_PSW) + this.getRegOutput(DebuggerPDP11.REG_PIR) + this.getRegOutput(DebuggerPDP11.REG_SL);
sDump += this.getFlagOutput('T') + this.getFlagOutput('N') + this.getFlagOutput('Z') + this.getFlagOutput('V') + this.getFlagOutput('C');
if (fMisc) sDump += '\n' + this.getMiscDump();
return sDump;
};
@ -2773,12 +2888,12 @@ if (DEBUGGER) {
{
if (sAddr == '?') {
this.println("breakpoint commands:");
this.println("\tbp [a]\tset exec breakpoint at addr [a]");
this.println("\tbr [a]\tset read breakpoint at addr [a]");
this.println("\tbw [a]\tset write breakpoint at addr [a]");
this.println("\tbc [a]\tclear breakpoint at addr [a]");
this.println("\tbp [#]\tset exec breakpoint at addr #");
this.println("\tbr [#]\tset read breakpoint at addr #");
this.println("\tbw [#]\tset write breakpoint at addr #");
this.println("\tbc [#]\tclear breakpoint at addr #");
this.println("\tbl\tlist all breakpoints");
this.println("\tbn [n]\tbreak after [n] instruction(s)");
this.println("\tbn [#]\tbreak after # instruction(s)");
return;
}
@ -3386,77 +3501,115 @@ if (DEBUGGER) {
if (asArgs && asArgs[1] == '?') {
this.println("register commands:");
this.println("\tr\tdump registers");
this.println("\trm\tdump misc registers");
this.println("\trx [#]\tset flag or register x to [#]");
return;
}
var fMisc = false;
var cpu = this.cpu;
if (fInstruction == null) fInstruction = true;
if (asArgs != null && asArgs.length > 1) {
var sReg = asArgs[1];
var sValue = null;
var i = sReg.indexOf('=');
if (i > 0) {
sValue = sReg.substr(i + 1);
sReg = sReg.substr(0, i);
}
else if (asArgs.length > 2) {
sValue = asArgs[2];
if (sReg == 'm') {
fMisc = true;
}
else {
this.println("missing value for " + asArgs[1]);
return;
}
var w = this.parseExpression(sValue);
if (w === undefined) return;
var sRegMatch = sReg.toUpperCase();
switch (sRegMatch) {
case "SP":
case "R6":
cpu.setSP(w);
break;
case "PC":
case "R7":
cpu.setPC(w);
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
break;
case "N":
if (w) cpu.setNF(); else cpu.clearNF();
break;
case "Z":
if (w) cpu.setZF(); else cpu.clearZF();
break;
case "V":
if (w) cpu.setVF(); else cpu.clearVF();
break;
case "C":
if (w) cpu.setCF(); else cpu.clearCF();
break;
case "SR":
if (this.panel && this.panel.hasSwitches()) {
this.panel.setSR(w);
break;
var sValue = null;
var i = sReg.indexOf('=');
if (i > 0) {
sValue = sReg.substr(i + 1);
sReg = sReg.substr(0, i);
}
/* falls through */
default:
if (sRegMatch.charAt(0) == 'R') {
var iReg = +sRegMatch.charAt(1);
if (iReg >= 0 && iReg < 6) {
cpu.regsGen[iReg] = w & 0xffff;
else if (asArgs.length > 2) {
sValue = asArgs[2];
}
else {
this.println("missing value for " + asArgs[1]);
return;
}
var w = this.parseExpression(sValue);
if (w === undefined) return;
var sRegMatch = sReg.toUpperCase();
switch (sRegMatch) {
case "SP":
case "R6":
cpu.setSP(w);
break;
case "PC":
case "R7":
cpu.setPC(w);
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
break;
case "N":
if (w) cpu.setNF(); else cpu.clearNF();
break;
case "Z":
if (w) cpu.setZF(); else cpu.clearZF();
break;
case "V":
if (w) cpu.setVF(); else cpu.clearVF();
break;
case "C":
if (w) cpu.setCF(); else cpu.clearCF();
break;
case "PS":
cpu.setPSW(w);
break;
case "IR":
cpu.setPIR(w);
break;
case "ER":
cpu.regErr = w;
fMisc = true;
break;
case "SL":
cpu.setSL(w);
break;
case "MMR0":
cpu.setMMR0(w);
fMisc = true;
break;
case "MMR3":
cpu.setMMR3(w);
fMisc = true;
break;
case "AR":
if (this.panel) this.panel.setAR(w);
fMisc = true;
break;
case "DR":
if (this.panel) this.panel.setDR(w);
fMisc = true;
break;
case "SR":
if (this.panel && this.panel.hasSwitches()) {
this.panel.setSR(w);
fMisc = true;
break;
}
/* falls through */
default:
if (sRegMatch.charAt(0) == 'R') {
var iReg = +sRegMatch.charAt(1);
if (iReg >= 0 && iReg < 6) {
cpu.regsGen[iReg] = w & 0xffff;
break;
}
}
this.println("unknown register: " + sReg);
return;
}
this.println("unknown register: " + sReg);
return;
this.cmp.updateDisplays();
this.println("updated registers:");
}
this.cmp.updateDisplays();
this.println("updated registers:");
}
this.println(this.getRegDump());
this.println(this.getRegDump(fMisc));
if (fInstruction) {
this.dbgAddrNextCode = this.newAddr(cpu.getPC());
@ -3512,36 +3665,47 @@ if (DEBUGGER) {
};
/**
* doStep(sCmd)
* doStep(sCmd, sOption)
*
* @this {DebuggerPDP11}
* @param {string} [sCmd] "p" or "pr"
* @param {string} [sOption]
*/
DebuggerPDP11.prototype.doStep = function(sCmd)
DebuggerPDP11.prototype.doStep = function(sCmd, sOption)
{
if (sOption == '?') {
this.println("step commands:");
this.println("\tp\tstep over instruction");
this.println("\tpr\tstep over instruction with register update");
return;
}
var fCallStep = true;
var fRegs = (sCmd == "pr"? 1 : 0);
var nRegs = (sCmd == "pr"? 1 : 0);
/*
* Set up the value for this.nStep (ie, 1 or 2) depending on whether the user wants
* a subsequent register dump ("pr") or not ("p").
*/
var nStep = 1 + fRegs;
var nStep = 1 + nRegs;
if (!this.nStep) {
var dbgAddr = this.newAddr(this.cpu.getPC());
var bOpcode = this.getByte(dbgAddr);
var opCode = this.getWord(dbgAddr);
/*
switch (bOpcode) {
case PDP11.OPCODE.CALL:
if (opCode == PDP11.OPCODE.BPT || opCode == PDP11.OPCODE.IOT ||
(opCode & PDP11.OPCODE.EMT_MASK) == PDP11.OPCODE.EMT_OP ||
(opCode & PDP11.OPCODE.TRAP_MASK) == PDP11.OPCODE.TRAP_OP) {
if (fCallStep) {
this.nStep = nStep;
this.incAddr(dbgAddr, 2);
}
} else if ((opCode & PDP11.OPCODE.JSR_MASK) == PDP11.OPCODE.JSR_OP) {
var s = this.getInstruction(dbgAddr);
this.assert(s.indexOf("JSR") >= 0);
if (fCallStep) {
this.nStep = nStep;
this.incAddr(dbgAddr, 3);
}
break;
default:
break;
}
*/
if (this.nStep) {
this.setTempBreakpoint(dbgAddr);
@ -3555,7 +3719,7 @@ if (DEBUGGER) {
* stopped for reasons unrelated to the temporary breakpoint, but that's OK.
*/
} else {
this.doTrace(fRegs? "tr" : "t");
this.doTrace(nRegs? "tr" : "t");
}
} else {
this.println("step in progress");
@ -3681,6 +3845,15 @@ if (DEBUGGER) {
*/
DebuggerPDP11.prototype.doTrace = function(sCmd, sCount)
{
if (sCount == '?') {
this.println("trace commands:");
this.println("\tt [#]\ttrace # instructions");
this.println("\ttr [#]\ttrace # instructions with register updates");
this.println("\ttc [#]\ttrace # cycles");
this.println("note: bn [#] breaks after # instructions without updates");
return;
}
var dbg = this;
var fRegs = (sCmd != "t");
var nCount = this.parseValue(sCount, null, true) || 1;
@ -3689,6 +3862,7 @@ if (DEBUGGER) {
nCycles = nCount;
nCount = 1;
}
this.sTraceCmdPrev = sCmd;
web.onCountRepeat(
nCount,
function onCountStep() {
@ -3702,7 +3876,7 @@ if (DEBUGGER) {
* a final updateDisplays().
*/
if (dbg.panel && dbg.panel.stop) dbg.panel.stop();
dbg.cmp.updateDisplays();
dbg.cmp.updateDisplays(-1);
dbg.setBusy(false);
}
);
@ -3908,7 +4082,7 @@ if (DEBUGGER) {
this.doPrint(sCmd.substr(5));
break;
}
this.doStep(asArgs[0]);
this.doStep(asArgs[0], asArgs[1]);
break;
case 'r':
if (sCmd == "reset") {

View file

@ -234,6 +234,14 @@ var PDP11 = {
OPCODE: {
HALT: 0x0000,
WAIT: 0x0001,
BPT: 0x0003,
IOT: 0x0004,
JSR_OP: 0x0800,
JSR_MASK: 0xFE00,
EMT_OP: 0x8800,
EMT_MASK: 0xFF00,
TRAP_OP: 0x8900,
TRAP_MASK: 0xFF00,
INVALID: 0xFFFF // far from the only invalid opcode, just a KNOWN invalid opcode
},
/*
@ -311,44 +319,65 @@ var PDP11 = {
BYTE: 0xff, // write byte normally
SBYTE: 0xffff // sign-extend byte to word
},
CPUERR: {
RED: 0x0004, // red zone stack limit
YELLOW: 0x0008, // yellow zone stack limit
TIMEOUT: 0x0010, // UNIBUS timeout error
NOMEMORY: 0x0020, // non-existent memory error
ODDADDR: 0x0040, // odd word address error (as in non-even, not strange)
BADHALT: 0x0080 // HALT attempted in USER or SUPER modes
CPUERR: { // 177766
RED: 0x0004, // 000004 red zone stack limit
YELLOW: 0x0008, // 000010 yellow zone stack limit
TIMEOUT: 0x0010, // 000020 UNIBUS timeout error
NOMEMORY: 0x0020, // 000040 non-existent memory error
ODDADDR: 0x0040, // 000100 odd word address error (as in non-even, not strange)
BADHALT: 0x0080 // 000200 HALT attempted in USER or SUPER modes
},
MMR0: {
ENABLED: 0x0001, // address relocation enabled
PAGE_NUM: 0x000E, // page number of last fault
PAGE_D: 0x0010, // last fault occurred in D space
PAGE_MODE: 0x0060, // processor mode as of last fault
COMPLETED: 0x0080, // last instruction completed
DSTMODE: 0x0100, // only destination mode references will be relocated (aka MAINT bit)
MMU_TRAPS: 0x0200, // enable MMU traps
UNUSED: 0x0C00,
TRAP_MMU: 0x1000, // trap: MMU
ABORT_RO: 0x2000, // abort: read-only
ABORT_PL: 0x4000, // abort: page length
ABORT_NR: 0x8000, // abort: non-resident
ABORT: 0xE000
MMR0: { // 177572
ENABLED: 0x0001, // 000001 address relocation enabled
PAGE_NUM: 0x000E, // 000016 page number of last fault
PAGE_D: 0x0010, // 000020 last fault occurred in D space (11/44 and 11/70 only)
PAGE: 0x001E, // 000176 (all of the PAGE bits)
MODE: 0x0060, // 000140 processor mode as of last fault
COMPLETED: 0x0080, // 000200 last instruction completed (R/O) (11/70 only)
DSTMODE: 0x0100, // 000400 only destination mode references will be relocated (aka MAINT bit)
MMU_TRAPS: 0x0200, // 001000 enable MMU traps (11/70 only)
UNUSED: 0x0C00, // 006000
TRAP_MMU: 0x1000, // 010000 trap: MMU (11/70 only)
ABORT_RO: 0x2000, // 020000 abort: read-only
ABORT_PL: 0x4000, // 040000 abort: page length
ABORT_NR: 0x8000, // 100000 abort: non-resident
ABORT: 0xE000, // 160000 (all of the ABORT bits)
UPDATE: 0xF0FE // Includes all of: ABORT, TRAP, COMPLETED, MODE, and PAGE bits
},
MMR1: { // general purpose auto-inc/auto-dec register
REG1_NUM: 0x0007,
REG1_DELTA: 0x00F8,
REG2_NUM: 0x0700,
REG2_DELTA: 0xF800
MMR1: { // 177574: general purpose auto-inc/auto-dec register (11/44 and 11/70 only)
REG1_NUM: 0x0007, //
REG1_DELTA: 0x00F8, //
REG2_NUM: 0x0700, //
REG2_DELTA: 0xF800 //
},
MMR2: { // virtual program counter register
MMR2: { // 177576: virtual program counter register
},
MMR3: { // mapping register
MMR3: { // 172516: mapping register (11/44 and 11/70 only)
USER_D: 0x0001,
SUPER_D: 0x0002,
KERNEL_D: 0x0004,
MMU_22BIT: 0x0010,
UNIBUS_MAP: 0x0020 // UNIBUS map relocation enabled
},
PDR: {
ACF: {
NR: 0x0, // non-resident, abort all accesses
RO1: 0x1, // read-only, abort on write attempt, memory management trap on read (11/70 only)
RO: 0x2, // read-only, abort on write attempt
U1: 0x3, // unused, abort all accesses--reserved for future use
RW1: 0x4, // read/write, memory management trap upon completion of a read or write
RW2: 0x5, // read/write, memory management trap upon completion of a write (11/70 only)
RW: 0x6, // read/write, no system trap/abort action
U2: 0x7, // unused, abort all accesses--reserved for future use
MASK: 0x7
},
ED: 0x0008, // expansion direction (if set, the page expands downward from block number 127)
UNUSED: 0x0030,
MODIFIED: 0x0040, // page has been written (bit cleared when either PDR or PAR is written)
ACCESSED: 0x0080, // page has been accessed (bit cleared when either PDR or PAR is written) (11/70 only)
PLF: 0x7F00, // page length field
BC: 0x8000 // bypass cache (11/44 only)
},
/*
* Assorted special (UNIBUS) addresses
*
@ -364,11 +393,11 @@ var PDP11 = {
* is enabled, the top 5 bits of an address select one of the 31 mapping registers, and the bottom 13 bits
* are then added to the contents of the selected mapping register.
*
* ES6 ALERT: By using octal constants, this is the first place I'm dipping my toe into ECMAScript 6 waters.
* If you're loading this raw source code into your browser, then by now (2016) you're almost certainly using
* an ES6-aware browser. Everyone else should be using code compiled by Google's Closure Compiler, which
* we configure to produce code that's backward-compatible with ES5 (for example, octal constants are
* converted to decimal values).
* ES6 ALERT: By using octal constants, I'm finally dipping my toe into ES6 (aka ECMAScript 2015) waters.
* You'll even see a few binary constants below, too. If you're loading this raw source code into your browser,
* then by now (2016) you're almost certainly using an ES6-aware browser. Production sites should be using code
* compiled by Google's Closure Compiler, which we configure to produce code that's backward-compatible with ES5
* (for example, all binary, octal, and hex constants are converted to decimal values).
*
* For more details: https://github.com/google/closure-compiler/wiki/ECMAScript6
*/
@ -498,22 +527,22 @@ var PDP11 = {
UDPAR6: 0o177674, // User D Page Address Register 6
UDPAR7: 0o177676, // User D Page Address Register 7
R0SET0: 0o177700,
R1SET0: 0o177701,
R2SET0: 0o177702,
R3SET0: 0o177703,
R4SET0: 0o177704,
R5SET0: 0o177705,
R6KERNEL: 0o177706,
R7KERNEL: 0o177707,
R0SET1: 0o177710,
R1SET1: 0o177711,
R2SET1: 0o177712,
R3SET1: 0o177713,
R4SET1: 0o177714,
R5SET1: 0o177715,
R6SUPER: 0o177716,
R6USER: 0o177717,
R0SET0: 0o177700, //
R1SET0: 0o177701, //
R2SET0: 0o177702, //
R3SET0: 0o177703, //
R4SET0: 0o177704, //
R5SET0: 0o177705, //
R6KERNEL: 0o177706, //
R7KERNEL: 0o177707, //
R0SET1: 0o177710, //
R1SET1: 0o177711, //
R2SET1: 0o177712, //
R3SET1: 0o177713, //
R4SET1: 0o177714, //
R5SET1: 0o177715, //
R6SUPER: 0o177716, //
R6USER: 0o177717, //
/*
* This next group of registers is largely ignored; all accesses are routed to regsControl[],

View file

@ -130,9 +130,62 @@ DevicePDP11.prototype.initBus = function(cmp, bus, cpu, dbg)
bus.addIOTable(this, DevicePDP11.UNIBUS_IOTABLE);
bus.addResetHandler(this.reset.bind(this));
if (DEBUGGER && dbg) {
dbg.messageDump(MessagesPDP11.MMU, function onDumpMMU(asArgs) {
device.dumpMMU(asArgs);
});
}
this.setReady();
};
/**
* dumpMMU(asArgs)
*
* @this {DevicePDP11}
* @param {Array.<string>} asArgs
*/
DevicePDP11.prototype.dumpMMU = function(asArgs)
{
if (DEBUGGER) {
var cpu = this.cpu;
this.dumpRegs("KIPDR", cpu.mmuPDR[0], 0, asArgs[0]);
this.dumpRegs("KDPDR", cpu.mmuPDR[0], 8, asArgs[0]);
this.dumpRegs("KIPAR", cpu.mmuPAR[0], 0, asArgs[0]);
this.dumpRegs("KDPAR", cpu.mmuPAR[0], 8, asArgs[0], true);
this.dumpRegs("SIPDR", cpu.mmuPDR[1], 0, asArgs[0]);
this.dumpRegs("SDPDR", cpu.mmuPDR[1], 8, asArgs[0]);
this.dumpRegs("SIPAR", cpu.mmuPAR[1], 0, asArgs[0]);
this.dumpRegs("SDPAR", cpu.mmuPAR[1], 8, asArgs[0], true);
this.dumpRegs("UIPDR", cpu.mmuPDR[3], 0, asArgs[0]);
this.dumpRegs("UDPDR", cpu.mmuPDR[3], 8, asArgs[0]);
this.dumpRegs("UIPAR", cpu.mmuPAR[3], 0, asArgs[0]);
this.dumpRegs("UDPAR", cpu.mmuPAR[3], 8, asArgs[0], true);
}
};
/**
* dumpRegs(sName, aRegs, offset, sFilter, fBreak)
*
* @this {DevicePDP11}
* @param {string} sName
* @param {Array.<number>} aRegs
* @param {number} offset
* @param {string} sFilter
* @param {boolean} [fBreak]
*/
DevicePDP11.prototype.dumpRegs = function(sName, aRegs, offset, sFilter, fBreak)
{
if (DEBUGGER) {
var dbg = this.dbg;
if (sFilter && sName.indexOf(sFilter.toUpperCase()) < 0) return;
var sDump = sName + ":";
for (var i = 0; i < 8; i++) {
sDump += ' ' + dbg.toStrBase(aRegs[offset + i]);
}
dbg.println(sDump + (fBreak? '\n' : ''));
}
};
/**
* reset()
*
@ -219,7 +272,7 @@ DevicePDP11.prototype.readMMR0 = function(addr)
*/
DevicePDP11.prototype.writeMMR0 = function(data, addr)
{
this.cpu.setMMR0(data);
this.cpu.setMMR0((data & ~PDP11.MMR0.COMPLETED) | (this.cpu.regMMR0 & PDP11.MMR0.COMPLETED));
};
/**
@ -435,7 +488,10 @@ DevicePDP11.prototype.readKIPDR = function(addr)
DevicePDP11.prototype.writeKIPDR = function(data, addr)
{
var reg = (addr >> 1) & 7;
this.cpu.mmuPDR[0][reg] = data & 0xff0f;
this.cpu.mmuPDR[0][reg] = data &= 0xff0f;
if (this.messageEnabled(MessagesPDP11.MMU)) {
this.printMessage("writeKIPDR[" + reg + "]: " + str.toOct(data), true);
}
};
/**
@ -873,7 +929,8 @@ DevicePDP11.prototype.readSIZE = function(addr)
/*
* TODO: getMemorySize() returns an aggregate total, so if there are multiple discontiguous
* chunks of RAM, this could return the wrong result; another interface, getHighestAddress(),
* might be required.
* might be required. Then again, perhaps multiple discontiguous chunks of RAM are not permitted
* in PDP-11 machines.
*/
return addr == PDP11.UNIBUS.LSIZE? ((this.bus.getMemorySize(MemoryPDP11.TYPE.RAM) >> 6) - 1) : 0;
};
@ -961,20 +1018,23 @@ DevicePDP11.prototype.readMB = function(addr)
*/
DevicePDP11.prototype.writeMB = function(data, addr)
{
if (!(addr & 0x1)) data &= 0xff; // Required for KB11-CM without MFPT instruction
if (!(addr & 0x1)) {
data &= 0xff; // required for KB11-CM without MFPT instruction
}
this.cpu.regMB = data;
};
/**
* readPIR(addr)
* readPIR(addr, fPreWrite)
*
* @this {DevicePDP11}
* @param {number} addr (eg, PDP11.UNIBUS.PIR or 177772)
* @param {boolean} [fPreWrite]
* @return {number}
*/
DevicePDP11.prototype.readPIR = function(addr)
DevicePDP11.prototype.readPIR = function(addr, fPreWrite)
{
if (!addr) return 0; // the caller is preparing to write the low or high byte; these are the bits to return for the other byte
if (fPreWrite) return 0;
return this.cpu.getPIR();
};
@ -991,15 +1051,16 @@ DevicePDP11.prototype.writePIR = function(data, addr)
};
/**
* readSL(addr)
* readSL(addr, fPreWrite)
*
* @this {DevicePDP11}
* @param {number} addr (eg, PDP11.UNIBUS.SL or 177774)
* @param {boolean} [fPreWrite]
* @return {number}
*/
DevicePDP11.prototype.readSL = function(addr)
DevicePDP11.prototype.readSL = function(addr, fPreWrite)
{
if (!addr) return 0; // the caller is preparing to write the low or high byte; these are the bits to return for the other byte
if (fPreWrite) return 0;
return this.cpu.getSL();
};
@ -1069,23 +1130,23 @@ DevicePDP11.prototype.writeIgnored = function(data, addr)
*/
DevicePDP11.UNIBUS_IOTABLE = {
[PDP11.UNIBUS.UNIMAP]: /* 170200 */ [null, null, DevicePDP11.prototype.readUNIMAP, DevicePDP11.prototype.writeUNIMAP, "UNIMAP", 64, PDP11.MODEL_1170],
[PDP11.UNIBUS.SIPDR0]: /* 172200 */ [null, null, DevicePDP11.prototype.readSIPDR, DevicePDP11.prototype.writeSIPDR, "SIPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.SDPDR0]: /* 172220 */ [null, null, DevicePDP11.prototype.readSDPDR, DevicePDP11.prototype.writeSDPDR, "SDPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.SIPAR0]: /* 172240 */ [null, null, DevicePDP11.prototype.readSIPAR, DevicePDP11.prototype.writeSIPAR, "SIPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.SDPAR0]: /* 172260 */ [null, null, DevicePDP11.prototype.readSDPAR, DevicePDP11.prototype.writeSDPAR, "SDPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.KIPDR0]: /* 172300 */ [null, null, DevicePDP11.prototype.readKIPDR, DevicePDP11.prototype.writeKIPDR, "KIPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.KDPDR0]: /* 172320 */ [null, null, DevicePDP11.prototype.readKDPDR, DevicePDP11.prototype.writeKDPDR, "KDPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.KIPAR0]: /* 172340 */ [null, null, DevicePDP11.prototype.readKIPAR, DevicePDP11.prototype.writeKIPAR, "KIPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.KDPAR0]: /* 172360 */ [null, null, DevicePDP11.prototype.readKDPAR, DevicePDP11.prototype.writeKDPAR, "KDPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.MMR3]: /* 172516 */ [null, null, DevicePDP11.prototype.readMMR3, DevicePDP11.prototype.writeMMR3, "MMR3", 1, PDP11.MODEL_1145],
[PDP11.UNIBUS.SIPDR0]: /* 172200 */ [null, null, DevicePDP11.prototype.readSIPDR, DevicePDP11.prototype.writeSIPDR, "SIPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.SDPDR0]: /* 172220 */ [null, null, DevicePDP11.prototype.readSDPDR, DevicePDP11.prototype.writeSDPDR, "SDPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.SIPAR0]: /* 172240 */ [null, null, DevicePDP11.prototype.readSIPAR, DevicePDP11.prototype.writeSIPAR, "SIPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.SDPAR0]: /* 172260 */ [null, null, DevicePDP11.prototype.readSDPAR, DevicePDP11.prototype.writeSDPAR, "SDPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.KIPDR0]: /* 172300 */ [null, null, DevicePDP11.prototype.readKIPDR, DevicePDP11.prototype.writeKIPDR, "KIPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.KDPDR0]: /* 172320 */ [null, null, DevicePDP11.prototype.readKDPDR, DevicePDP11.prototype.writeKDPDR, "KDPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.KIPAR0]: /* 172340 */ [null, null, DevicePDP11.prototype.readKIPAR, DevicePDP11.prototype.writeKIPAR, "KIPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.KDPAR0]: /* 172360 */ [null, null, DevicePDP11.prototype.readKDPAR, DevicePDP11.prototype.writeKDPAR, "KDPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.MMR3]: /* 172516 */ [null, null, DevicePDP11.prototype.readMMR3, DevicePDP11.prototype.writeMMR3, "MMR3", 1, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.LKS]: /* 177546 */ [null, null, DevicePDP11.prototype.readLKS, DevicePDP11.prototype.writeLKS, "LKS"],
[PDP11.UNIBUS.MMR0]: /* 177572 */ [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0, "MMR0", 1, PDP11.MODEL_1145],
[PDP11.UNIBUS.MMR1]: /* 177574 */ [null, null, DevicePDP11.prototype.readMMR1, DevicePDP11.prototype.writeIgnored, "MMR1", 1, PDP11.MODEL_1145],
[PDP11.UNIBUS.MMR2]: /* 177576 */ [null, null, DevicePDP11.prototype.readMMR2, DevicePDP11.prototype.writeIgnored, "MMR2", 1, PDP11.MODEL_1145],
[PDP11.UNIBUS.UIPDR0]: /* 177600 */ [null, null, DevicePDP11.prototype.readUIPDR, DevicePDP11.prototype.writeUIPDR, "UIPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.UDPDR0]: /* 177620 */ [null, null, DevicePDP11.prototype.readUDPDR, DevicePDP11.prototype.writeUDPDR, "UDPDR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.UIPAR0]: /* 177640 */ [null, null, DevicePDP11.prototype.readUIPAR, DevicePDP11.prototype.writeUIPAR, "UIPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.UDPAR0]: /* 177660 */ [null, null, DevicePDP11.prototype.readUDPAR, DevicePDP11.prototype.writeUDPAR, "UDPAR", 8, PDP11.MODEL_1145],
[PDP11.UNIBUS.MMR0]: /* 177572 */ [null, null, DevicePDP11.prototype.readMMR0, DevicePDP11.prototype.writeMMR0, "MMR0", 1, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.MMR1]: /* 177574 */ [null, null, DevicePDP11.prototype.readMMR1, DevicePDP11.prototype.writeIgnored, "MMR1", 1, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.MMR2]: /* 177576 */ [null, null, DevicePDP11.prototype.readMMR2, DevicePDP11.prototype.writeIgnored, "MMR2", 1, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.UIPDR0]: /* 177600 */ [null, null, DevicePDP11.prototype.readUIPDR, DevicePDP11.prototype.writeUIPDR, "UIPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.UDPDR0]: /* 177620 */ [null, null, DevicePDP11.prototype.readUDPDR, DevicePDP11.prototype.writeUDPDR, "UDPDR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.UIPAR0]: /* 177640 */ [null, null, DevicePDP11.prototype.readUIPAR, DevicePDP11.prototype.writeUIPAR, "UIPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.UDPAR0]: /* 177660 */ [null, null, DevicePDP11.prototype.readUDPAR, DevicePDP11.prototype.writeUDPAR, "UDPAR", 8, PDP11.MODEL_1145, MessagesPDP11.MMU],
[PDP11.UNIBUS.R0SET0]: /* 177700 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R0SET0"],
[PDP11.UNIBUS.R1SET0]: /* 177701 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R1SET0"],
[PDP11.UNIBUS.R2SET0]: /* 177702 */ [null, null, DevicePDP11.prototype.readRSET0, DevicePDP11.prototype.writeRSET0, "R2SET0"],

View file

@ -38,8 +38,10 @@ var MessagesPDP11 = {
FAULT: 0x00000020,
BUS: 0x00000040,
MEMORY: 0x00000080,
ROM: 0x00000100,
DEVICE: 0x00000200,
MMU: 0x00000100,
ROM: 0x00000200,
DEVICE: 0x00000400,
PANEL: 0x00000800,
KEYBOARD: 0x00010000,
KEYS: 0x00020000,
PAPER: 0x00100000,
@ -73,8 +75,10 @@ MessagesPDP11.CATEGORIES = {
"fault": MessagesPDP11.FAULT,
"bus": MessagesPDP11.BUS,
"memory": MessagesPDP11.MEMORY,
"mmu": MessagesPDP11.MMU,
"rom": MessagesPDP11.ROM,
"device": MessagesPDP11.DEVICE,
"panel": MessagesPDP11.PANEL,
"keyboard": MessagesPDP11.KEYBOARD, // "kbd" is also allowed as shorthand for "keyboard"; see doMessages()
"key": MessagesPDP11.KEYS, // using "key" instead of "keys", since the latter is a method on JavasScript objects
"paper": MessagesPDP11.PAPER,

View file

@ -33,13 +33,14 @@
"use strict";
if (NODE) {
var str = require("../../shared/lib/strlib");
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var PDP11 = require("./defines");
var BusPDP11 = require("./bus");
var MemoryPDP11 = require("./memory");
var str = require("../../shared/lib/strlib");
var usr = require("../../shared/lib/usrlib");
var web = require("../../shared/lib/weblib");
var Component = require("../../shared/lib/component");
var PDP11 = require("./defines");
var BusPDP11 = require("./bus");
var MemoryPDP11 = require("./memory");
var MessagesPDP11 = require("./messages");
}
/**
@ -53,15 +54,15 @@ if (NODE) {
*/
function PanelPDP11(parmsPanel)
{
Component.call(this, "Panel", parmsPanel, PanelPDP11);
Component.call(this, "Panel", parmsPanel, PanelPDP11, MessagesPDP11.PANEL);
/*
* If there are any live registers, LEDs, etc, to display, this will provide a count.
* TODO: Add some UI for fDisplayLiveRegs (either an XML property, or a UI checkbox, or both).
*/
this.cLiveRegs = 0;
this.nPeriodicCount = 0;
this.nPeriodicLimit = 60;
this.nDisplayCount = 0;
this.nDisplayLimit = 60;
this.fDisplayLiveRegs = true;
/*
@ -175,6 +176,50 @@ PanelPDP11.LED = {
B22: 'B22'
};
/**
* getAR()
*
* @this {PanelPDP11}
* @return {number} (current ADDRESS register)
*/
PanelPDP11.prototype.getAR = function()
{
return this.regAddr;
};
/**
* setAR(value)
*
* @this {PanelPDP11}
* @param {number} value (new ADDRESS register)
*/
PanelPDP11.prototype.setAR = function(value)
{
this.updateAddr(this.regAddr = value);
};
/**
* getDR()
*
* @this {PanelPDP11}
* @return {number} (current DISPLAY register)
*/
PanelPDP11.prototype.getDR = function()
{
return this.regDisplay;
};
/**
* setDR(value)
*
* @this {PanelPDP11}
* @param {number} value (new DISPLAY register)
*/
PanelPDP11.prototype.setDR = function(value)
{
this.updateData(this.regDisplay = value);
};
/**
* getSR()
*
@ -573,8 +618,7 @@ PanelPDP11.prototype.processStart = function(value, index)
* is depressed, "the computer system will be cleared." I take it to mean that it performs
* the equivalent of a RESET instruction.
*/
this.bus.reset();
this.cpu.resetRegs();
this.cpu.resetCPU();
/*
* The PDP-11/70 Handbook goes on to say: "If the system needs to be initialized but execution
* is not wanted, the START switch should be depressed while the HALT/ENABLE switch is in the HALT
@ -655,7 +699,7 @@ PanelPDP11.prototype.processContinue = function(value, index)
var dbg = this.dbg;
if (dbg && !dbg.isBusy(true)) {
dbg.setBusy(true);
dbg.stepCPU(0);
dbg.stepCPU(0, null);
dbg.setBusy(false);
}
else {
@ -968,7 +1012,7 @@ PanelPDP11.prototype.setData = function(value, fActive)
* Called by the Computer component at intervals to update registers, LEDs, etc.
*
* @this {PanelPDP11}
* @param {number} [nUpdate] (< 0 for forced, > 0 for periodic, undefined otherwise)
* @param {number} [nUpdate] (< 0 for forced, > 0 for periodic, 0 otherwise)
*/
PanelPDP11.prototype.updateDisplay = function(nUpdate)
{
@ -985,7 +1029,7 @@ PanelPDP11.prototype.updateDisplay = function(nUpdate)
* LEDs are considered cheap, register displays are not. So we'll skip the latter if this
* is a periodic update AND our periodic update counter hasn't reached the periodic update limit.
*/
if (!(nUpdate > 0 && (this.nPeriodicCount += nUpdate) < this.nPeriodicLimit)) {
if (nUpdate <= 0 || (this.nDisplayCount += nUpdate) >= this.nDisplayLimit) {
for (var i = 0; i < this.cpu.regsGen.length; i++) {
this.displayValue('R'+i, this.cpu.regsGen[i]);
}
@ -995,7 +1039,7 @@ PanelPDP11.prototype.updateDisplay = function(nUpdate)
this.displayValue("ZF", (regPSW & PDP11.PSW.ZF)? 1 : 0, 1);
this.displayValue("VF", (regPSW & PDP11.PSW.VF)? 1 : 0, 1);
this.displayValue("CF", (regPSW & PDP11.PSW.CF)? 1 : 0, 1);
this.nPeriodicCount = 0;
this.nDisplayCount = 0;
}
/*
@ -1004,34 +1048,35 @@ PanelPDP11.prototype.updateDisplay = function(nUpdate)
* TODO: There is currently no mechanism for selecting regData over regDisplay;
* we are acting as if the DATASEL switch setting is locked to "DISPLAY REGISTER".
*/
this.updateAddr(nUpdate > 0 && fRunning && !fWaiting? this.cpu.getPC() : this.regAddr);
this.updateAddr(nUpdate > 0 && fRunning && !fWaiting? this.cpu.getLastAddr() : this.regAddr);
this.updateData(this.regDisplay);
var bits = this.cpu.getMMUState();
/*
* Set bit to 1 (22-bit), 2 (18-bit), or 4 (16-bit)
* Bit 0 set if 22-bit, bit 1 set if 18-bit, bit 2 set if 16-bit
*/
var bit = this.cpu.mmuEnable? ((this.cpu.regMMR3 & PDP11.MMR3.MMU_22BIT)? 1 : 2) : 4;
this.updateLED(PanelPDP11.LED.B22, bit & 1);
this.updateLED(PanelPDP11.LED.B18, bit & 2);
this.updateLED(PanelPDP11.LED.B16, bit & 4);
this.updateLED(PanelPDP11.LED.B22, bits & 1);
this.updateLED(PanelPDP11.LED.B18, bits & 2);
this.updateLED(PanelPDP11.LED.B16, bits & 4);
}
}
};
/**
* readCNSW(addr)
* readCNSW(addr, fPreWrite)
*
* If addr is set, then this a normal read, so we should return the SWITCH register (ie, regSwitches).
* If fPreWrite, this is a read-before-write, so we must return the DISPLAY register (ie, regDisplay);
* otherwise, this a normal read, so we should return the SWITCH register (ie, regSwitches).
*
* if addr is NOT set, then this is a read-before-write, so we must return the DISPLAY register (ie, regDisplay).
*
* @this {PanelPDP11}
* @param {number} addr (eg, PDP11.UNIBUS.CNSW or 177570)
* @param {boolean} [fPreWrite]
* @return {number}
*/
PanelPDP11.prototype.readCNSW = function(addr)
PanelPDP11.prototype.readCNSW = function(addr, fPreWrite)
{
return (addr? this.regSwitches : this.regDisplay) & 0xffff;
return (fPreWrite? this.regDisplay : this.regSwitches) & 0xffff;
};
/**

View file

@ -489,8 +489,8 @@ PC11.prototype.load = function(sTapeName, sTapePath, nTapeTarget, file)
if (file) {
var reader = new FileReader();
reader.onload = function() {
pc11.doneRead(sTapeName, sTapePath, nTapeTarget, reader.result);
reader.onload = function doneRead() {
pc11.finishRead(sTapeName, sTapePath, nTapeTarget, reader.result);
};
reader.readAsArrayBuffer(file);
return true;
@ -515,13 +515,13 @@ PC11.prototype.load = function(sTapeName, sTapePath, nTapeTarget, file)
}
}
return !!web.getResource(sTapeURL, null, true, function(sURL, sResponse, nErrorCode) {
pc11.doneLoad(sTapeName, sTapePath, nTapeTarget, sResponse, sURL, nErrorCode);
return !!web.getResource(sTapeURL, null, true, function doneLoad(sURL, sResponse, nErrorCode) {
pc11.finishLoad(sTapeName, sTapePath, nTapeTarget, sResponse, sURL, nErrorCode);
});
};
/**
* doneLoad(sTapeName, sTapePath, sTapeData, nTapeTarget, sURL, nErrorCode)
* finishLoad(sTapeName, sTapePath, sTapeData, nTapeTarget, sURL, nErrorCode)
*
* @this {PC11}
* @param {string} sTapeName
@ -531,7 +531,7 @@ PC11.prototype.load = function(sTapeName, sTapePath, nTapeTarget, file)
* @param {string} sURL
* @param {number} nErrorCode (response from server if anything other than 200)
*/
PC11.prototype.doneLoad = function(sTapeName, sTapePath, nTapeTarget, sTapeData, sURL, nErrorCode)
PC11.prototype.finishLoad = function(sTapeName, sTapePath, nTapeTarget, sTapeData, sURL, nErrorCode)
{
var fPrintOnly = (nErrorCode < 0 && this.cmp && !this.cmp.flags.powered);
@ -547,7 +547,7 @@ PC11.prototype.doneLoad = function(sTapeName, sTapePath, nTapeTarget, sTapeData,
}
else {
if (DEBUG && this.messageEnabled()) {
this.printMessage('doneLoad("' + sTapePath + '")');
this.printMessage('finishLoad("' + sTapePath + '")');
}
Component.addMachineResource(this.idMachine, sURL, sTapeData);
var resource = web.parseMemoryResource(sURL, sTapeData);
@ -564,7 +564,7 @@ PC11.prototype.doneLoad = function(sTapeName, sTapePath, nTapeTarget, sTapeData,
};
/**
* doneRead(sTapeName, sTapePath, nTapeTarget, buffer)
* finishRead(sTapeName, sTapePath, nTapeTarget, buffer)
*
* @this {PC11}
* @param {string} sTapeName
@ -572,7 +572,7 @@ PC11.prototype.doneLoad = function(sTapeName, sTapePath, nTapeTarget, sTapeData,
* @param {number} nTapeTarget
* @param {?} buffer (we KNOW this is an ArrayBuffer, but we can't seem to convince the Closure Compiler)
*/
PC11.prototype.doneRead = function(sTapeName, sTapePath, nTapeTarget, buffer)
PC11.prototype.finishRead = function(sTapeName, sTapePath, nTapeTarget, buffer)
{
if (buffer) {
var aBytes = new Uint8Array(buffer, 0, buffer.byteLength);

View file

@ -92,8 +92,8 @@ function RAMPDP11(parmsRAM)
sFileURL = web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sFilePath + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES + '&' + DumpAPI.QUERY.DECIMAL + '=true';
}
var ram = this;
web.getResource(sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
ram.doneLoad(sURL, sResponse, nErrorCode);
web.getResource(sFileURL, null, true, function doneLoad(sURL, sResponse, nErrorCode) {
ram.finishLoad(sURL, sResponse, nErrorCode);
});
}
}
@ -166,14 +166,14 @@ RAMPDP11.prototype.powerDown = function(fSave, fShutdown)
};
/**
* doneLoad(sURL, sData, nErrorCode)
* finishLoad(sURL, sData, nErrorCode)
*
* @this {RAMPDP11}
* @param {string} sURL
* @param {string} sData
* @param {number} nErrorCode (response from server if anything other than 200)
*/
RAMPDP11.prototype.doneLoad = function(sURL, sData, nErrorCode)
RAMPDP11.prototype.finishLoad = function(sURL, sData, nErrorCode)
{
if (nErrorCode) {
this.notice("Unable to load RAM resource (error " + nErrorCode + ": " + sURL + ")");
@ -197,8 +197,8 @@ RAMPDP11.prototype.doneLoad = function(sURL, sData, nErrorCode)
/**
* initRAM()
*
* This function is called by both initBus() and doneLoad(), but it cannot copy the initial data into place
* until after initBus() has received the Bus component AND doneLoad() has received the data. When both those
* This function is called by both initBus() and finishLoad(), but it cannot copy the initial data into place
* until after initBus() has received the Bus component AND finishLoad() has received the data. When both those
* criteria are satisfied, the component becomes "ready".
*
* @this {RAMPDP11}

View file

@ -282,7 +282,7 @@ RL11.prototype.initBus = function(cmp, bus, cpu, dbg)
this.triggerInterrupt = this.cpu.addTrigger(PDP11.RL11.VEC, PDP11.RL11.PRI);
bus.addIOTable(this, RL11.UNIBUS_IOTABLE, MessagesPDP11.DISK);
bus.addIOTable(this, RL11.UNIBUS_IOTABLE);
bus.addResetHandler(this.reset.bind(this));
this.addDisk("None", RL11.SOURCE.NONE, true);
@ -549,7 +549,7 @@ RL11.prototype.loadDrive = function(iDrive, sDiskName, sDiskPath, fAutoMount, fi
}
drive.fLocal = !!file;
var disk = new DiskPDP11(this, drive, DiskAPI.MODE.PRELOAD);
if (disk.load(sDiskName, sDiskPath, file, this.doneLoadDrive)) {
if (disk.load(sDiskName, sDiskPath, file, this.finishLoadDrive)) {
nResult++;
}
}
@ -558,7 +558,7 @@ RL11.prototype.loadDrive = function(iDrive, sDiskName, sDiskPath, fAutoMount, fi
};
/**
* doneLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount)
* finishLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount)
*
* The disk parameter is set if the disk was successfully loaded, null if not.
*
@ -569,7 +569,7 @@ RL11.prototype.loadDrive = function(iDrive, sDiskName, sDiskPath, fAutoMount, fi
* @param {string} sDiskPath
* @param {boolean} [fAutoMount]
*/
RL11.prototype.doneLoadDrive = function onLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount)
RL11.prototype.finishLoadDrive = function onLoadDrive(drive, disk, sDiskName, sDiskPath, fAutoMount)
{
var aDiskInfo;

View file

@ -54,7 +54,7 @@ if (NODE) {
* file: name of ROM data file
*
* NOTE: The ROM data will not be copied into place until the Bus is ready (see initBus()) AND
* the ROM data file has finished loading (see doneLoad()).
* the ROM data file has finished loading (see finishLoad()).
*
* Also, while the size parameter may seem redundant, I consider it useful to confirm that the ROM
* you received is the ROM you expected.
@ -65,7 +65,7 @@ if (NODE) {
*/
function ROMPDP11(parmsROM)
{
Component.call(this, "ROM", parmsROM, ROMPDP11);
Component.call(this, "ROM", parmsROM, ROMPDP11, MessagesPDP11.ROM);
this.abInit = null;
this.aSymbols = null;
@ -103,8 +103,8 @@ function ROMPDP11(parmsROM)
sFileURL = web.getHost() + DumpAPI.ENDPOINT + '?' + DumpAPI.QUERY.FILE + '=' + this.sFilePath + '&' + DumpAPI.QUERY.FORMAT + '=' + DumpAPI.FORMAT.BYTES + '&' + DumpAPI.QUERY.DECIMAL + '=true';
}
var rom = this;
web.getResource(sFileURL, null, true, function(sURL, sResponse, nErrorCode) {
rom.doneLoad(sURL, sResponse, nErrorCode);
web.getResource(sFileURL, null, true, function doneLoad(sURL, sResponse, nErrorCode) {
rom.finishLoad(sURL, sResponse, nErrorCode);
});
}
}
@ -183,14 +183,14 @@ ROMPDP11.prototype.powerDown = function(fSave, fShutdown)
};
/**
* doneLoad(sURL, sData, nErrorCode)
* finishLoad(sURL, sData, nErrorCode)
*
* @this {ROMPDP11}
* @param {string} sURL
* @param {string} sData
* @param {number} nErrorCode (response from server if anything other than 200)
*/
ROMPDP11.prototype.doneLoad = function(sURL, sData, nErrorCode)
ROMPDP11.prototype.finishLoad = function(sURL, sData, nErrorCode)
{
if (nErrorCode) {
this.notice("Unable to load ROM resource (error " + nErrorCode + ": " + sURL + ")");
@ -212,8 +212,8 @@ ROMPDP11.prototype.doneLoad = function(sURL, sData, nErrorCode)
/**
* initROM()
*
* This function is called by both initBus() and doneLoad(), but it cannot copy the initial data into place
* until after initBus() has received the Bus component AND doneLoad() has received the data. When both those
* This function is called by both initBus() and finishLoad(), but it cannot copy the initial data into place
* until after initBus() has received the Bus component AND finishLoad() has received the data. When both those
* criteria are satisfied, the component becomes "ready".
*
* @this {ROMPDP11}
@ -289,11 +289,16 @@ ROMPDP11.prototype.addROM = function(addr)
* of the IOPAGE address space, by installing I/O handlers for the entire range that return the corresponding
* bytes of the current ROM image on reads, and ignore any writes (which I'm only assuming is how a typical
* ROM "device" deals with writes; if we remove the write handler, then writes will fault).
*
* TODO: It would be more efficient if we parsed ROM data as words rather than bytes, and then installed
* only word handlers instead of only byte handlers. It was done this way purely for historical reasons (ie,
* because that's how other PCjs machines parse their ROMs). For now, all this means is that executing code
* out of ROM will be slower than out of RAM -- although that's often true in the real world as well.
*/
var IOTable = {
[addr]: [ROMPDP11.prototype.readROMByte, ROMPDP11.prototype.writeROMByte, null, null, null, this.sizeROM >> 1]
};
if (this.bus.addIOTable(this, IOTable, MessagesPDP11.ROM, this.idComponent)) {
if (this.bus.addIOTable(this, IOTable)) {
this.fRetainROM = true;
return true;
}

View file

@ -239,6 +239,19 @@ SerialPortPDP11.prototype.setBinding = function(sType, sBinding, control, sValue
return true;
};
control.onpaste = function onKeyPress(event) {
if (event.stopPropagation) event.stopPropagation();
if (event.preventDefault) event.preventDefault();
var clipboardData = event.clipboardData || window.clipboardData;
if (clipboardData) {
/*
* NOTE: Multiple lines of pasted text will (at least on macOS) contain LFs instead of CRs;
* this is dealt with in receiveData() whenever it receives a string of characters.
*/
serial.receiveData(clipboardData.getData('Text'));
}
};
/*
* Now that we've added an onkeypress handler that calls preventDefault() for ALL keys, the control
* itself no longer needs the "readonly" attribute; we primarily need to remove it for iOS browsers,
@ -513,8 +526,20 @@ SerialPortPDP11.prototype.receiveData = function(data)
this.abReceive.push(data);
}
else if (typeof data == "string") {
var b = 0, bPrev;
for (var i = 0; i < data.length; i++) {
this.abReceive.push(data.charCodeAt(i));
bPrev = b;
b = data.charCodeAt(i);
/*
* NOTE: Multiple lines of pasted text will (at least on macOS) contain LFs instead of CRs;
* we convert them to CRs below. Windows may do something different, but in the worst case,
* even if we receive CR/LF pairs, this code should keep the CRs and lose the LFs.
*/
if (b == str.ASCII.LF) {
if (bPrev == str.ASCII.CR) continue;
b = str.ASCII.CR;
}
this.abReceive.push(b);
}
}
else {

View file

@ -551,6 +551,10 @@ str.trim = function(s)
/*
* Any codes commented out in the following table are deemed "printable"
*/
str.ASCII = {
LF: 0x0A,
CR: 0x0D
};
str.aASCIICodes = {
0x00: "NUL",
0x01: "SOH", // (CTRL_A) Start of Heading

View file

@ -31,293 +31,300 @@
http://pcjs.org/modules/pdp11/lib/computer.js (C) Jeff Parsons 2012-2016
http://pcjs.org/modules/shared/lib/state.js (C) Jeff Parsons 2012-2016
*/
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,ca=["Math","log2"],da=0;da<ca.length-1;da++){var ea=ca[da];ea in ba||(ba[ea]={});ba=ba[ea]}var ga=ca[ca.length-1],ha=ba[ga],ja=ha?ha:function(a){return Math.log(a)/Math.LN2};
ja!=ha&&null!=ja&&aa(ba,ga,{configurable:!0,writable:!0,value:ja});var ka={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function pa(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function qa(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function ra(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function sa(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ta(a,b){return-1!==a.indexOf(b,a.length-b.length)}var ua={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function va(a){return a.replace(/[&<>"']/g,function(a){return ua[a]})}
function wa(a,b){return(a+" ").slice(0,b)}function xa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var ya={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function za(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Aa=Date.now||function(){return+new Date};function Ba(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
for(var k,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ca="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this,da=["Math","log2"],ea=0;ea<da.length-1;ea++){var fa=da[ea];fa in ca||(ca[fa]={});ca=ca[fa]}var ga=da[da.length-1],ia=ca[ga],ja=ia?ia:function(a){return Math.log(a)/Math.LN2};
ja!=ia&&null!=ja&&aa(ca,ga,{configurable:!0,writable:!0,value:ja});var ka={163840:[40,1,8,,254],184320:[40,1,9,,252],327680:[40,2,8,,255],368640:[40,2,9,,253],737280:[80,2,9,,249],1228800:[80,2,15,,249],1474560:[80,2,18,,240],2949120:[80,2,36,,240],21368320:[615,4,17],5242880:[256,2,40,256],10485760:[512,2,40,256]};
function ma(a,b){var c;if(a){b||(b=10);var d=a.charAt(0),e=0<a.indexOf(",");e&&(a=a.replace(/,/g,""));"#"==d?(b=8,d=null):"$"==d&&(b=16,d=null);null==d?a=a.substr(1):("0"==d&&(d=a.charAt(1),"b"==d&&e&&(b=2,d=null),"o"==d?(b=8,d=null):"x"==d&&(b=16,d=null)),null==d?a=a.substr(2):(d=a.charAt(a.length-1).toLowerCase(),"y"==d?(b=2,d=null):"."==d?(b=10,d=null):"h"==d&&(b=16,d=null),null==d&&(a=a.substr(0,a.length-1))));var f,d=a;((e=b)&&10!=e?16==e?d.match(/^[0-9a-f]+$/i):8==e?d.match(/^[0-7]+$/):2==e&&
d.match(/^[01]+$/):d.match(/^[0-9]+$/))&&!isNaN(f=parseInt(a,b))&&(c=f|0)}return c}function na(a,b,c){var d="";b?11<b&&(b=11):b=a&-65536?11:6;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;)d=String.fromCharCode((a&7)+48)+d,a>>=3;return(c?"0o":"")+d}function p(a,b,c){var d="";b?8<b&&(b=8):b=a&-65536?8:4;if(null==a||isNaN(a))for(;0<b--;)d="?"+d;else for(;0<b--;){var e=a&15,e=e+(0<=e&&9>=e?48:55),d=String.fromCharCode(e)+d;a>>=4}return(c?"0x":"")+d}
function sa(a,b){var c=a,d=a.lastIndexOf("/");0<=d&&(c=a.substr(d+1));d=c.indexOf("&");0<d&&(c=c.substr(0,d));b&&(d=c.lastIndexOf("."),0<d&&(c=c.substring(0,d)));return c}function ta(a){var b="",c=a.lastIndexOf(".");0<=c&&(b=a.substr(c+1).toLowerCase());return b}function ua(a,b){return-1!==a.indexOf(b,a.length-b.length)}var va={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"};function wa(a){return a.replace(/[&<>"']/g,function(a){return va[a]})}
function xa(a,b){return(a+" ").slice(0,b)}function ya(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}var za={0:"NUL",1:"SOH",2:"STX",3:"ETX",4:"EOT",5:"ENQ",6:"ACK",7:"BEL",8:"BS",9:"TAB",11:"VT",12:"FF",14:"SO",15:"SI",16:"DLE",17:"XON",18:"DC2",19:"XOFF",20:"DC4",21:"NAK",22:"SYN",23:"ETB",24:"CAN",25:"EM",26:"SUB",27:"ESC",28:"FS",29:"GS",30:"RS",31:"US"};
function Aa(a,b,c){var d=0,e=a.length,f=0;for(c||(c=function(a,b){return a>b?1:a<b?-1:0});d<e;){var g=d+e>>1,h;h=c(b,a[g]);0<h?d=g+1:(e=g,f=!h)}return f?d:~d}var Ba=Date.now||function(){return+new Date};function Ca(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function Da(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var h=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(h.onreadystatechange=function(){4===h.readyState&&(f=h.responseText,200==h.status||!h.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=h.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var l="",m;for(m in b)b.hasOwnProperty(m)&&(l&&(l+="&"),l+=m+"="+encodeURIComponent(b[m]));l=l.replace(/%20/g,"+");h.open("POST",a,!!c);h.setRequestHeader("Content-type","application/x-www-form-urlencoded");h.send(l)}else h.open("GET",a,!!c),"bytes"==b&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send();c||(f=h.responseText,200!=h.status&&(e=h.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function Ea(a,b){var c,d={ea:null,ga:null,La:null,Ka:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.La=g.load;d.Ka=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
function Ea(a,b){var c,d={ea:null,ga:null,Oa:null,Na:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.Oa=g.load;d.Na=g.exec;if(e=g.bytes)d.ea=e;else if(e=g.words)for(d.ea=Array(2*e.length),f=c=0;c<e.length;c++)d.ea[f++]=e[c]&255,d.ea[f++]=e[c]>>8&255;else if(e=g.data)for(d.ea=Array(4*e.length),f=c=0;c<e.length;c++)d.ea[f++]=
e[c]&255,d.ea[f++]=e[c]>>8&255,d.ea[f++]=e[c]>>16&255,d.ea[f++]=e[c]>>24&255;else d.ea=g;d.ga=g.symbols;d.ea.length?1==d.ea.length&&(q(d.ea[0]),d=null):(q("Empty resource: "+a),d=null)}catch(h){q("Resource data error ("+a+"): "+h.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){q("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.ea=e)}return d}
function Fa(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ga(a){var b=!1;window&&(b=window.confirm(a));return b}var Ha=null;function Ia(){if(null==Ha){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ha=a}return Ha}
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Qa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ra(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Sa(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ta(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Ua={init:[],show:[],exit:[]},Va=!1,Wa=!1,Xa=!0;function Ya(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Za(a){Ua.init.push(a)}
function $a(a){if(Xa)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){q(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function ab(a){!Xa&&a?(Xa=!0,Va&&bb("init"),Wa&&bb("show")):Xa=a}function bb(a){Ua[a]&&$a(Ua[a])}Ya("onload",function(){Va=!0;$a(Ua.init)});Ya("onpageshow",function(){Wa=!0;$a(Ua.show)});Ya(Ra("Opera")||Ra("iOS")?"onunload":"onbeforeunload",function(){$a(Ua.exit)});
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.vc=b.comment;this.Yc=b;b=this.id.indexOf(".");0>b?this.$a=this.id:(this.Qa=this.id.substr(0,b),this.$a=this.id.substr(b+1));this[a]=c;this.w={ready:!1,bb:!1,$b:!1,ha:!1,error:!1};this.Sb=null;this.w.error=!1;this.G={};this.i=null;this.ma=d||0;u.push(this)}var cb=void 0,db={};
if(window){cb||(cb=window.location.search.substr(1));for(var eb,fb=/\+/g,gb=/([^&=]+)=?([^&]*)/g;eb=gb.exec(cb);)db[decodeURIComponent(eb[1].replace(fb," "))]=decodeURIComponent(eb[2].replace(fb," "))}function ob(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function z(a,b){b||(b=t);a.prototype=ob(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var pb=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else pb={},u=[];function qb(a,b,c){pb[a]&&b&&(pb[a][b]=c)}function rb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function sb(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function tb(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
function B(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.sa(g.type,g.binding,f,g.value),l=h.length}}}}
function Ga(){return"http://"+(window?window.location.host:"www.pcjs.org")}function q(a){window&&window.alert(a)}function Ha(a){var b=!1;window&&(b=window.confirm(a));return b}var Ia=null;function Ja(){if(null==Ia){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}Ia=a}return Ia}
function Ka(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function La(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Na(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}function Ta(a,b,c){function d(){--a;0<=a&&(b()||(a=0));0<a?setTimeout(d,0):c()}d()}
function Ua(a,b){function c(){b(100===d)&&(e=setTimeout(c,d),d=100)}var d=0,e=null,f=!1;a.onmousedown=function(){f||e||(d=500,c())};a.ontouchstart=function(){e||(d=500,c())};a.onmouseup=a.onmouseout=function(){e&&(clearTimeout(e),e=null)};a.ontouchend=a.ontouchcancel=function(){e&&(clearTimeout(e),e=null);f=!0}}var Va={init:[],show:[],exit:[]},Wa=!1,Xa=!1,Ya=!0;function Za(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function $a(a){Va.init.push(a)}
function ab(a){if(Ya)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){q(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function bb(a){!Ya&&a?(Ya=!0,Wa&&cb("init"),Xa&&cb("show")):Ya=a}function cb(a){Va[a]&&ab(Va[a])}Za("onload",function(){Wa=!0;ab(Va.init)});Za("onpageshow",function(){Xa=!0;ab(Va.show)});Za(Na("Opera")||Na("iOS")?"onunload":"onbeforeunload",function(){ab(Va.exit)});
function t(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Bc=b.comment;this.ad=b;b=this.id.indexOf(".");0>b?this.ab=this.id:(this.Ua=this.id.substr(0,b),this.ab=this.id.substr(b+1));this[a]=c;this.A={ready:!1,eb:!1,ec:!1,ia:!1,error:!1};this.Xb=null;this.A.error=!1;this.G={};this.j=null;this.la=d||0;u.push(this)}var db=void 0,eb={};
if(window){db||(db=window.location.search.substr(1));for(var fb,gb=/\+/g,hb=/([^&=]+)=?([^&]*)/g;fb=hb.exec(db);)eb[decodeURIComponent(fb[1].replace(gb," "))]=decodeURIComponent(fb[2].replace(gb," "))}function ib(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function z(a,b){b||(b=t);a.prototype=ib(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var jb=window.PCjs.Machines||(window.PCjs.Machines={}),u=window.PCjs.Components||(window.PCjs.Components=[])}else jb={},u=[];function rb(a,b,c){jb[a]&&b&&(jb[a][b]=c)}function sb(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<u.length;b++){var d=u[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function tb(a){if(void 0!==a){var b;for(b=0;b<u.length;b++)if(u[b].id===a)return u[b]}return null}function ub(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<u.length;d++)if(c)c==u[d]&&(c=null);else if(!(a!=u[d].type||b&&u[d].id.indexOf(b)))return u[d]}return null}function A(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){q(c.message+" ("+a+")")}return b}
function B(a,b){b=D(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var h=g.split(" "),l=0;l<h.length;l++)switch(g=h[l],g){case "pdp11-binding":(g=A(f))&&g.binding&&a.wa(g.type,g.binding,f,g.value),l=h.length}}}}
function D(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},sa:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Sa=this.G[b]=c,c.value="",this.j=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.P=function(a){this.j(a,this.$a)}),!0;default:return!1}},log:function(){},j:function(){},status:function(a){this.j(this.$a+": "+a)},P:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ga:function(){return this.w.ha=!0},Fa:function(a,b){b&&(this.w.ha=!1);return!0}};function E(a,b,c,d){a.i&&(!0===c||F(a,c|0))&&a.i.message(b,d)}function F(a,b){if(a.i){a===a.i?b|=0:b=b||a.ma;var c=a.i.ma&b;return!!b&&c===b||!!(c&a.i.Qc)}return!1}
function ub(a,b){if(a.w.$b)return a.w.bb=!1,a.w.$b=!1;if(a.w.error)return a.j(a.toString()+" error"),!1;a.w.bb=b;return a.w.bb}function vb(a,b){a.w.bb&&(b?a.w.$b=!0:void 0===b&&a.j(a.toString()+" busy"));return a.w.bb}function H(a,b){a.w.error||(a.w.ready=!1!==b,a.w.ready&&(b=a.Sb,a.Sb=null,b&&b()))}function wb(a,b){b&&(a.w.ready?b():a.Sb=b);return a.w.ready}function xb(a){return a.w.error?(a.j(a.toString()+" error"),!0):!1}function yb(a,b){a.w.error=!0;a.P(b)}
t.prototype={constructor:t,parent:null,toString:function(){return this.name?this.name:this.id||this.type},wa:function(a,b,c){switch(b){case "clear":return this.G[b]||(this.G[b]=c,c.onclick=function(a){return function(){a.G.print&&(a.G.print.value="")}}(this)),!0;case "print":return this.G[b]||(this.Va=this.G[b]=c,c.value="",this.i=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.R=function(a){this.i(a,this.ab)}),!0;default:return!1}},log:function(){},i:function(){},status:function(a){this.i(this.ab+": "+a)},R:function(a,b,c){c=c||this.type;b||q((c?c+": ":"")+a)},Ka:function(){return this.A.ia=!0},Ja:function(a,b){b&&(this.A.ia=!1);return!0}};function E(a,b,c,d){a.j&&(!0===c||F(a,c|0))&&a.j.message(b,d)}function F(a,b){if(a.j){a===a.j?b|=0:b=b||a.la;var c=a.j.la&b;return!!b&&c===b||!!(c&a.j.Tc)}return!1}
function vb(a,b){if(a.A.ec)return a.A.eb=!1,a.A.ec=!1;if(a.A.error)return a.i(a.toString()+" error"),!1;a.A.eb=b;return a.A.eb}function wb(a,b){a.A.eb&&(b?a.A.ec=!0:void 0===b&&a.i(a.toString()+" busy"));return a.A.eb}function H(a,b){a.A.error||(a.A.ready=!1!==b,a.A.ready&&(b=a.Xb,a.Xb=null,b&&b()))}function xb(a,b){b&&(a.A.ready?b():a.Xb=b);return a.A.ready}function yb(a){return a.A.error?(a.i(a.toString()+" error"),!0):!1}function zb(a,b){a.A.error=!0;a.R(b)}
Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});
var zb="undefined"!==typeof ArrayBuffer,Ab="UNKNOWN ABORT ILLEGAL RED YELLOW FAULT TRACE HALT OPCODE INTERRUPT".split(" "),Bb={cpu:1,trap:16,fault:32,bus:64,memory:128,rom:256,device:512,keyboard:65536,key:131072,paper:1048576,disk:4194304,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};
function Cb(a){t.call(this,"Panel",a,Cb);this.f=this.A=this.Xa=this.D=this.J=this.H=0;this.L=this.M=this.I=!1;this.O=Db;this.B={};this.g={START:[1,1,!0,!1,this.fd],STEP:[1,1,!1,!1,this.gd],ENABLE:[1,1,!1,!1,this.bd],CONT:[1,1,!0,!1,this.$c],DEP:[0,0,!0,!1,this.ad],EXAM:[1,1,!0,!1,this.cd],LOAD:[1,1,!0,!1,this.ed],TEST:[0,0,!0,!1,this.dd]};for(a=0;22>a;a++)this.g["S"+a]=[0,0,!1,!1,this.hd,a]}z(Cb);var Db=7;function Eb(a,b){return a.g[b]&&a.g[b][1]}k=Cb.prototype;k.reset=function(){this.stop()};
k.sa=function(a,b,c,d){if(this.C&&this.C.sa(a,b,c,d)||this.b&&this.b.sa(a,b,c,d)||this.i&&this.i.sa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.G[b]=c,this.H++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.B[b]=d?1:0,this.H++,!0):"switch"==a?(void 0===this.g[b]&&(this.g[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
b){return function(){Fb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Gb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Fb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Gb(a,b)}}(this,b),!0):this.parent.sa.call(this,a,b,c,d)}};k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;Hb(b,this,Ib);Jb(b,this.reset.bind(this));Kb(this);Lb(this)};k.Ga=function(a,b){b||(Mb(),this.reset());return!0};k.Fa=function(){return!0};
function Nb(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Kb(a,b){for(var c in a.B)Nb(a,c,null!=b?b:a.B[c])}function Ob(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Lb(a){for(var b in a.g)Ob(a,b,a.g[b][1])}function ac(a,b,c,d){a.G[b]&&(void 0===c&&(yb(a,"Value for "+b+" is invalid"),a.b.da()),c=8==(a.i&&a.i.ca||8)?qa(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
function Fb(a,b){var c=a.g[b];Ob(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.L="DEP"==b,a.M="EXAM"==b)}function Gb(a,b){var c=a.g[b];c[2]&&c[3]&&(Ob(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.fd=function(a){a||this.b.w.W||(this.v.reset(),bc(this.b),Eb(this,"ENABLE")&&this.b.hb())};k.gd=function(){};k.bd=function(a){a||this.b.da()};
k.$c=function(a){if(!a&&!this.b.w.W)if(Eb(this,"ENABLE"))this.b.hb();else{if((a=this.i)&&!vb(a,!0))ub(a,!0),a.ib(0),ub(a,!1);else try{var b=this.b.ib(1);0<b&&(cc(this.b,b),dc(this.b,b,!0),ec(this.b,b))}catch(c){"number"!=typeof c&&yb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.oa()}};k.ad=function(a){a&&!this.b.w.W&&(this.L&&fc(this),a=gc(this,this.Xa),this.O==Db?this.v.Bb(this.f,a):this.b.Bb(this.f,a))};
k.cd=function(a){a||this.b.w.W||(this.M&&fc(this),a=this.O==Db?this.v.cb(this.f):this.b.cb(this.f),gc(this,a))};k.ed=function(a){a||this.b.w.W||hc(this,this.Xa)};k.dd=function(a){a?(this.I=!0,Kb(this,!0)):(this.I=!1,Kb(this),ic(this,0))};k.hd=function(a,b){this.Xa=a?this.Xa|1<<b:this.Xa&~(1<<b)};function fc(a){var b=1145>a.b.Wa?8:16,c=65472<=a.f&&a.f<65472+b,b=c?1:2,c=c?15:a.v.Na;Eb(a,"STEP")||(b=-b);hc(a,a.f&~c|a.f+b&c)}
function hc(a,b){a.f=b&a.v.Na;b=a.f;for(var c=0;22>c;c++)jc(a,"A"+c,b&1<<c)}function gc(a,b){a.A=b&65535;b=a.A;for(var c=0;16>c;c++)jc(a,"D"+c,b&1<<c);return a.A}function jc(a,b,c){a.B[b]=c;a.I||Nb(a,b,c)}function kc(a){return void 0!==a.G.S0}function ic(a,b){if(kc(a)){a.Xa=b;for(var c=0;22>c;c++)a.g["S"+c][1]=b&1<<c?1:0;Lb(a)}}k.stop=function(){hc(this,this.b.u[7])};k.kc=function(a){this.f=a};k.setData=function(a,b){b?this.D=a:this.A=a};k.kd=function(a){return(a?this.Xa:this.D)&65535};
k.ee=function(a){this.D=a};var lc={},Ib=(lc[65400]=[null,null,Cb.prototype.kd,Cb.prototype.ee,"CNSW"],lc);function Mb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=sb(e.id);f||(a=!0,f=new Cb(e));B(f,d);a&&H(f)}}Za(Mb);
function mc(a,b,c){t.call(this,"Bus",a,mc,64);this.b=b;this.i=c;this.J=a.busWidth||16;this.C=0;this.B=[];this.g=null;this.H=1<<this.J;this.Na=this.H-1;this.za=nc;this.ja=Math.log2(this.za);this.I=this.za>>2;this.v=this.za-1;this.D=this.H/this.za|0;this.ab=[];this.la=0;this.f=!1;this.bc=0;this.A=[];this.Nc=[oc,pc,qc,rc];a=new I(this);sc(a,this.i);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(mc);var nc=8192,tc=nc-1;
function oc(a,b){var c=-1,d=this.controller,e=d.ab[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.ab[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.i&&F(this.i,e[5])&&E(this.i,e[4]+".readByte("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Da(b,16,3);c=255;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to byte @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function pc(a,b,c){var d=!1,e=this.controller,f=e.ab[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.ab[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.i&&F(this.i,f[5])&&E(this.i,f[4]+".writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Da(c,16,5),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to byte @"+J(this.i,c)+": "+J(this.i,b),
!0,!e.la))}function qc(a,b){var c=-1,d=this.controller;a=d.ab[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.i&&F(this.i,a[5])&&E(this.i,a[4]+".readWord("+J(this.i,b)+"): "+J(this.i,c),!0,!d.la),c;d.Da(b,16,2);c=65535;this.i&&F(this.i,64)&&E(this.i,"warning: unconverted read access to word @"+J(this.i,b)+": "+J(this.i,c),!0,!d.la);return c}
function rc(a,b,c){var d=!1,e=this.controller;a=e.ab[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.i&&F(this.i,a[5])&&E(this.i,a[4]+".writeWord("+J(this.i,c)+","+J(this.i,b)+")",!0,!e.la):(e.Da(c,16,4),this.i&&F(this.i,64)&&E(this.i,"warning: unconverted write access to word @"+J(this.i,c)+": "+J(this.i,b),!0,!e.la))}
function uc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-nc,vc(a,c,nc,a.B),a.C=0);b&&(a.C=b,c=1<<b,a.Na=c-1,c-=nc,a.B=wc(a,c,nc),a.g?vc(a,c,nc,a.g):(xc(a,c,nc,yc,a),a.g=wc(a,c,nc)))}}k=mc.prototype;k.reset=function(){for(var a=0;a<this.A.length;a++)this.A[a]();uc(this,16)};k.Ga=function(a,b){b||this.reset();return!0};
function xc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ja;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.za,n=a.za-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Ob+=l.F-f,l.F=f,!0;if(f>=l.F+l.Ob){n=l.size-(f-m);n>g&&(n=g);l.Ob=f-l.F+n;f=m+a.za;g-=n;h++;continue}}return zc(1,f,g)}f=new I(a,f,n,a.za,d,e);sc(f,a.i,l);a.Y[h++]=f;f=m+a.za;g-=n}return 0>=g?(d==Ac&&(a.bc+=c),a.status((c>>10)+"Kb "+Bc[d]+" at "+qa(b)),!0):zc(2,b,c)}
function wc(a,b,c){var d=[];for(b>>>=a.ja;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.za;return d}function vc(a,b,c,d){var e=0;for(b>>>=a.ja;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.za}}k.Hb=function(a){3932160<=a&&(a=Cc(this.b,a));return this.Y[(a&this.Na)>>>this.ja].Vb(a&this.v,a)};k.Ub=function(a){3932160<=a&&(a=Cc(this.b,a));this.f=!1;this.la++;a=this.Y[(a&this.Na)>>>this.ja].gc(a&this.v,a);this.la--;return a};
k.na=function(a){3932160<=a&&(a=Cc(this.b,a));return this.Y[(a&this.Na)>>>this.ja].ra(a&this.v,a)};k.cb=function(a){3932160<=a&&(a=Cc(this.b,a));var b=a&this.v,c=(a&this.Na)>>>this.ja;this.f=!1;this.la++;a=this.Y[c].hc(b,a);this.la--;return a};k.Ab=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.Y[(a&this.Na)>>>this.ja].Yb(a&this.v,b&255,a)};k.rb=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.f=!1;this.la++;this.Y[(a&this.Na)>>>this.ja].Zb(a&this.v,b&255,a);this.la--};
k.gb=function(a,b){3932160<=a&&(a=Cc(this.b,a));this.Y[(a&this.Na)>>>this.ja].Pb(a&this.v,b&65535,a)};k.Bb=function(a,b){3932160<=a&&(a=Cc(this.b,a));var c=a&this.v,d=(a&this.Na)>>>this.ja;this.f=!1;this.la++;this.Y[d].mc(c,b&65535,a);this.la--};
function Dc(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Ta||e.Tc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Ec(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&tc;if(void 0!==a.ab[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.ab[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
function Hb(a,b,c,d,e){for(var f in c){var g=+f,h=c[f];if(!(h[6]&&h[6]>a.b.Wa)){var l=h[0]?h[0].bind(b):null,m=h[1]?h[1].bind(b):null,n=h[2]?h[2].bind(b):null,v=h[3]?h[3].bind(b):null,r=h[5]||1;65472<=g&&65487>=g&&(!l&&n&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(n)),!m&&v&&(m=function(a){return function(b,c){return a(b,c)}.bind(b)}(v)));for(var w=h[4],y=0;y<r;y++,g+=2)if(w&&1<r&&(w=h[4]+y),!Ec(a,g,g,l,m,n,v,d||64,w||e))return!1}}return!0}function Jb(a,b){a.A.push(b)}
k.Da=function(a,b,c){this.f=!0;this.la||(this.i&&F(this.i,32)&&E(this.i,"memory fault ("+c+") on "+J(this.i,a),!0,!0),b&&(this.b.Ha|=b),this.b.ta(4,0,a))};function Fc(a){var b=a.f;a.f=!1;return b}function zc(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,512);this.f={fa:0,lc:-1}}z(K);k=K.prototype;
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.i=d;var e=this;this.f.lc=Gc(c,function(){e.f.Jb|=128;e.f.Jb&64&&Oc(e.b,e.f.ce);e.C&&e.C.oa(1);Pc(e.b,e.f.lc,1E3/60)});this.f.ce=Qc(64,6);Hb(b,this,Rc);Jb(b,this.reset.bind(this));H(this)};k.reset=function(){this.f.Jb=128;Pc(this.b,this.f.lc,1E3/60,!0)};k.sd=function(){return this.f.Jb};k.me=function(a){this.f.Jb=a&192};k.ud=function(){var a=this.b;return a.J&62337|a.kb<<5|a.jb<<1};
k.oe=function(a){var b=this.b;a&=62337;if(b.J!=a){b.J=a;b.kb=a>>5&3;b.jb=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Va!=c&&(b.Va=c,Sc(b))}};k.vd=function(){var a=this.b;a.J&57344||(a.Ac=a.S&65535);a=a.Ac;a&65280&&(a=(a<<8|a>>8)&65535);return a};k.wd=function(){var a=this.b;a.J&57344||(a.Bc=a.Ib);return a.Bc};k.xd=function(){return this.b.qb};k.pe=function(a){var b=this.b;1170>b.Wa&&(a&=-49);b.qb!=a&&(b.qb=a,b.Ja=a&16?4194303:262143,Sc(b))};
k.Yd=function(a){a=a>>1&63;var b=this.b.Nb[a>>1];return a&1?b>>16:b&65535};k.Qe=function(a,b){b=b>>1&63;var c=b>>1;this.b.Nb[c]=b&1?this.b.Nb[c]&65535|(a&63)<<16:this.b.Nb[c]&-65536|a&65534};k.Rd=function(a){return this.b.V[1][a>>1&7]};k.Je=function(a,b){this.b.V[1][b>>1&7]=a&65295};k.Pd=function(a){return this.b.V[1][(a>>1&7)+8]};k.He=function(a,b){this.b.V[1][(b>>1&7)+8]=a&65295};k.Qd=function(a){return this.b.ya[1][a>>1&7]};k.Ie=function(a,b){b=b>>1&7;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};
k.Od=function(a){return this.b.ya[1][(a>>1&7)+8]};k.Ge=function(a,b){b=(b>>1&7)+8;this.b.ya[1][b]=a;this.b.V[1][b]&=65295};k.rd=function(a){return this.b.V[0][a>>1&7]};k.le=function(a,b){this.b.V[0][b>>1&7]=a&65295};k.pd=function(a){return this.b.V[0][(a>>1&7)+8]};k.je=function(a,b){this.b.V[0][(b>>1&7)+8]=a&65295};k.qd=function(a){return this.b.ya[0][a>>1&7]};k.ke=function(a,b){b=b>>1&7;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};k.od=function(a){return this.b.ya[0][(a>>1&7)+8]};
k.ie=function(a,b){b=(b>>1&7)+8;this.b.ya[0][b]=a;this.b.V[0][b]&=65295};k.Xd=function(a){return this.b.V[3][a>>1&7]};k.Pe=function(a,b){this.b.V[3][b>>1&7]=a&65295};k.Vd=function(a){return this.b.V[3][(a>>1&7)+8]};k.Ne=function(a,b){this.b.V[3][(b>>1&7)+8]=a&65295};k.Wd=function(a){return this.b.ya[3][a>>1&7]};k.Oe=function(a,b){b=b>>1&7;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};k.Ud=function(a){return this.b.ya[3][(a>>1&7)+8]};k.Me=function(a,b){b=(b>>1&7)+8;this.b.ya[3][b]=a;this.b.V[3][b]&=65295};
k.yb=function(a){a&=7;return this.b.N&2048?this.b.Ya[a]:this.b.u[a]};k.Cb=function(a,b){b&=7;this.b.N&2048?this.b.Ya[b]=a:this.b.u[b]=a};k.Cd=function(){return this.b.N&49152?this.b.Ia[0]:this.b.u[6]};k.ue=function(a){this.b.N&49152?this.b.Ia[0]=a:this.b.u[6]=a};k.Fd=function(){return this.b.u[7]};k.xe=function(a){this.b.u[7]=a};k.zb=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Ya[a]};k.Db=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Ya[b]=a};
k.Dd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[1]};k.ve=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[1]=a};k.Ed=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.Ia[3]};k.we=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.Ia[3]=a};k.md=function(a){return this.b.Gc[a-65504>>1]};k.ge=function(a,b){this.b.Gc[b-65504>>1]=a};k.Dc=function(a){if(65520==a){a=0;switch(Ac){case Ac:a=this.v.bc}a=(a>>6)-1}else a=0;return a};k.Kc=function(){};k.Td=function(){return 1};
k.Le=function(){};k.ld=function(){return this.b.Ha};k.fe=function(){this.b.Ha=0};k.td=function(){return this.b.Fc};k.ne=function(a,b){b&1||(a&=255);this.b.Fc=a};k.yd=function(a){return a?this.b.jc:0};k.qe=function(a){var b=this.b;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.jc=a;b.K|=2};k.Sd=function(a){return a?this.b.Wb&65280:0};k.Ke=function(a){this.b.Wb=a|255};k.Bd=function(){return Tc(this.b)};k.te=function(a){Uc(this.b,a&-1793|Tc(this.b)&1792);this.b.K|=128};
k.Jc=function(a,b){F(this)&&E(this,"writeIgnored("+qa(b)+"): "+qa(a),!0,!0)};
var L={},Rc=(L[61568]=[null,null,K.prototype.Yd,K.prototype.Qe,"UNIMAP",64,1170],L[62592]=[null,null,K.prototype.Rd,K.prototype.Je,"SIPDR",8,1145],L[62608]=[null,null,K.prototype.Pd,K.prototype.He,"SDPDR",8,1145],L[62624]=[null,null,K.prototype.Qd,K.prototype.Ie,"SIPAR",8,1145],L[62640]=[null,null,K.prototype.Od,K.prototype.Ge,"SDPAR",8,1145],L[62656]=[null,null,K.prototype.rd,K.prototype.le,"KIPDR",8,1145],L[62672]=[null,null,K.prototype.pd,K.prototype.je,"KDPDR",8,1145],L[62688]=[null,null,K.prototype.qd,
K.prototype.ke,"KIPAR",8,1145],L[62704]=[null,null,K.prototype.od,K.prototype.ie,"KDPAR",8,1145],L[62798]=[null,null,K.prototype.xd,K.prototype.pe,"MMR3",1,1145],L[65382]=[null,null,K.prototype.sd,K.prototype.me,"LKS"],L[65402]=[null,null,K.prototype.ud,K.prototype.oe,"MMR0",1,1145],L[65404]=[null,null,K.prototype.vd,K.prototype.Jc,"MMR1",1,1145],L[65406]=[null,null,K.prototype.wd,K.prototype.Jc,"MMR2",1,1145],L[65408]=[null,null,K.prototype.Xd,K.prototype.Pe,"UIPDR",8,1145],L[65424]=[null,null,K.prototype.Vd,
K.prototype.Ne,"UDPDR",8,1145],L[65440]=[null,null,K.prototype.Wd,K.prototype.Oe,"UIPAR",8,1145],L[65456]=[null,null,K.prototype.Ud,K.prototype.Me,"UDPAR",8,1145],L[65472]=[null,null,K.prototype.yb,K.prototype.Cb,"R0SET0"],L[65473]=[null,null,K.prototype.yb,K.prototype.Cb,"R1SET0"],L[65474]=[null,null,K.prototype.yb,K.prototype.Cb,"R2SET0"],L[65475]=[null,null,K.prototype.yb,K.prototype.Cb,"R3SET0"],L[65476]=[null,null,K.prototype.yb,K.prototype.Cb,"R4SET0"],L[65477]=[null,null,K.prototype.yb,K.prototype.Cb,
"R5SET0"],L[65478]=[null,null,K.prototype.Cd,K.prototype.ue,"R6KERNEL"],L[65479]=[null,null,K.prototype.Fd,K.prototype.xe,"R7KERNEL"],L[65480]=[null,null,K.prototype.zb,K.prototype.Db,"R0SET1",1,1145],L[65481]=[null,null,K.prototype.zb,K.prototype.Db,"R1SET1",1,1145],L[65482]=[null,null,K.prototype.zb,K.prototype.Db,"R2SET1",1,1145],L[65483]=[null,null,K.prototype.zb,K.prototype.Db,"R3SET1",1,1145],L[65484]=[null,null,K.prototype.zb,K.prototype.Db,"R4SET1",1,1145],L[65485]=[null,null,K.prototype.zb,
K.prototype.Db,"R5SET1",1,1145],L[65486]=[null,null,K.prototype.Dd,K.prototype.ve,"R6SUPER",1,1145],L[65487]=[null,null,K.prototype.Ed,K.prototype.we,"R6USER",1,1145],L[65504]=[null,null,K.prototype.md,K.prototype.ge,"CTRL",8,1170],L[65520]=[null,null,K.prototype.Dc,K.prototype.Kc,"LSIZE",1,1170],L[65522]=[null,null,K.prototype.Dc,K.prototype.Kc,"HSIZE",1,1170],L[65524]=[null,null,K.prototype.Td,K.prototype.Le,"SYSID",1,1170],L[65526]=[null,null,K.prototype.ld,K.prototype.fe,"CPUERR",1,1170],L[65528]=
[null,null,K.prototype.td,K.prototype.ne,"MB",1,1170],L[65530]=[null,null,K.prototype.yd,K.prototype.qe,"PIR"],L[65532]=[null,null,K.prototype.Sd,K.prototype.Ke,"SL"],L[65534]=[null,null,K.prototype.Bd,K.prototype.te,"PSW"],L);Za(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new Vc(c);B(c,d);break;case "rl11":c=new M(c),B(c,d)}}});var Wc;
if(zb){var Xc=new ArrayBuffer(2);(new DataView(Xc)).setUint16(0,256,!0);Wc=256===(new Uint16Array(Xc))[0]}else Wc=!1;var Yc=Wc;
function I(a,b,c,d,e,f){this.v=a;this.id=Zc+=2;this.b=null;this.F=b;this.Ob=c;this.size=d||0;this.type=e||$c;this.f=e==ad;this.controller=null;sc(this);this.Ta=this.Tc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],bd(this,f.Nc);else if(zb)this.A=new ArrayBuffer(this.size),this.D=new DataView(this.A,0,this.size),this.G=new Uint8Array(this.A,0,this.size),this.I=new Uint16Array(this.A,0,this.size>>1),this.b=new Int32Array(this.A,0,this.size>>2),bd(this,Yc?cd:dd);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;bd(this,ed)}else bd(this)}var $c=0,Ac=1,ad=2,yc=4,Bc=["NONE","RAM","ROM","VID","H/W"],Zc=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(zb)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(zb)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Ta=!0}return!1},mb:function(a,b){b?this.C++||fd(this,gd,!1):this.g++||hd(this,gd,!1)},J:function(a,b){this.i&&F(this.i,128)&&E(this.i,
"attempt to read invalid address "+J(this.i,b),!0);this.v.Da(b,32,2);return 255},B:function(a,b,c){this.i&&F(this.i,128)&&E(this.i,"attempt to write "+J(this.i,b)+" to invalid addresses "+J(this.i,c),!0);this.v.Da(c,32,4)},L:function(a,b){return this.Vb(a++,b++)|this.Vb(a,b)<<8},H:function(a,b,c){this.Yb(a++,b&255,c++);this.Yb(a,b>>8,c)},S:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Da(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
1]&255)<<8},$a:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Ta=!0},Ja:function(a,b,c){a&1&&this.v.Da(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Ta=!0},O:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,1,c.M)&&c.da(!0)}return this.gc(a,b)},$:function(a,b){if(this.i&&null!=this.F){var c=this.i;id(c,this.F+a,2,c.M)&&c.da(!0)}return this.hc(a,b)},ka:function(a,
b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,1,d.D)&&d.da(!0)}this.f?this.B(a,b,c):this.Zb(a,b,c)},wa:function(a,b,c){if(this.i&&null!=this.F){var d=this.i;id(d,this.F+a,2,d.D)&&d.da(!0)}this.f?this.B(a,b,c):this.mc(a,b,c)},M:function(a){return this.G[a]},R:function(a,b){a=this.G[a];this.i&&F(this.i,128)&&E(this.i,"Memory.readByte("+J(this.i,b)+"): "+J(this.i,a),!0);return a},X:function(a,b){a&1&&this.v.Da(b,64,2);return this.D.getUint16(a,!0)},Qa:function(a,b){a&1&&this.v.Da(b,64,2);
a=this.I[a>>1];this.i&&F(this.i,128)&&E(this.i,"Memory.readWord("+J(this.i,b)+"): "+J(this.i,a),!0);return a},ia:function(a,b){this.G[a]=b;this.Ta=!0},pa:function(a,b,c){this.G[a]=b;this.Ta=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeByte("+J(this.i,c)+","+J(this.i,b)+")",!0)},va:function(a,b,c){a&1&&this.v.Da(c,64,4);this.D.setUint16(a,b,!0);this.Ta=!0},xa:function(a,b,c){a&1&&this.v.Da(c,64,4);this.I[a>>1]=b;this.Ta=!0;this.i&&F(this.i,128)&&E(this.i,"Memory.writeWord("+J(this.i,c)+","+J(this.i,
b)+")",!0)}};function sc(a,b,c){a.i=b;a.g=a.C=0;c&&((a.g=c.g)&&hd(a,gd,!1),(a.C=c.C)&&fd(a,gd,!1))}function jd(a,b){b?--a.C||(a.Yb=a.f?a.B:a.Zb,a.Pb=a.f?a.H:a.mc):--a.g||(a.Vb=a.gc,a.ra=a.hc)}function fd(a,b,c){c&&a.C||(a.Yb=!a.f&&b[1]||a.B,a.Pb=!a.f&&b[3]||a.H);if(c||void 0===c)a.Zb=b[1]||a.B,a.mc=b[3]||a.H}function hd(a,b,c){c&&a.g||(a.Vb=b[0]||a.J,a.ra=b[2]||a.L);if(c||void 0===c)a.gc=b[0]||a.J,a.hc=b[2]||a.L}function bd(a,b){b||(b=kd);hd(a,b,void 0);fd(a,b,void 0)}
var kd=[],ed=[I.prototype.S,I.prototype.$a,I.prototype.ca,I.prototype.Ja],gd=[I.prototype.O,I.prototype.ka,I.prototype.$,I.prototype.wa];if(zb)var dd=[I.prototype.M,I.prototype.ia,I.prototype.X,I.prototype.va],cd=[I.prototype.R,I.prototype.pa,I.prototype.Qa,I.prototype.xa];
function ld(a,b){t.call(this,"CPU",a,ld,1);var c=a.multiplier||1;this.nb=a.cycles||b;this.eb=c;this.Fb=Math.round(this.nb/1E4)/100;this.pb=this.Fb*this.eb;this.w.W=!1;this.w.Xb=!1;this.w.tb=a.autoStart;this.w.ub=!1;this.Kb=this.va=0;this.Lb=a.csStart;this.vb=a.csInterval;this.wb=a.csStop;this.L=[];this.zc=this.be.bind(this);H(this)}z(ld);var md=["power","reset"];k=ld.prototype;
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.i=d;this.B=a.B;for(b=0;b<md.length;b++)(c=this.G[md[b]])&&this.C.sa(null,md[b],c);a=nd(a,"autoStart");null!=a&&(this.w.tb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ga=function(a,b){if(!b){if(a&&this.restore){od(this);if(!this.restore(a))return!1;pd(this)}else this.reset();this.i?(a=this.i,b=this.w.tb,a.jb=!0,a.j("Type ? for help with PDPjs Debugger commands"),qd(a),b||a.sb(),a.Ra&&(b=a.Ra,a.Ra=null,rd(a,b))):this.j("No debugger detected")}return!0};k.Fa=function(a){return a?this.save():!0};k.tb=function(){return this.w.tb||!this.i&&void 0===this.G.run?(this.hb(),!0):!1};k.sc=function(){return 0};
function pd(a){void 0===a.Lb&&(a.Lb=0);void 0===a.vb&&(a.vb=-1);void 0===a.wb&&(a.wb=-1);a.w.ub=0<=a.Lb&&0<a.vb;a.w.ub&&(a.Kb=0,a.va=a.Lb-a.pa)}function ec(a,b){if(a.w.ub){var c=!1;a.Kb=a.Kb+a.sc()|0;a.va-=b;0>=a.va&&(a.va+=a.vb,c=!0);0<=a.wb&&a.wb<=sd(a)&&(a.vb=a.wb=-1,pd(a),a.da(),c=!0);c&&a.j(sd(a)+" cycles: checksum="+p(a.Kb))}}
k.sa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.w.ha)a=!0;else{var b=null,c,h=rb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.w.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.w.ha);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.w.ready?"powered yet":"ready yet"+(b.Sb?" (waiting for notification)":""))+".");a=!1}a&&(d.w.W?d.da():d.hb())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){td(d,d.eb<<1,!0)},c.textContent=this.pb.toFixed(2)+"Mhz",!0}return!1};k.oa=function(a){this.C&&this.C.oa(a)};function dc(a,b,c){a.pa+=b;c&&(a.ka=a.b=a.I=0)}function ud(a,b){var c=1;b&&1<a.eb&&a.ca&&(c=a.ca/a.Fb);a.wc=Math.round(1E3/30);a.ob=Math.floor(a.nb/30*c);b||(a.wa=a.ob);a.Gb=0}function sd(a){return a.pa+a.$+a.ka-a.b}function od(a){a.ca=0;a.yc=0;a.pa=a.$=a.ka=a.b=a.I=0;pd(a);td(a,1)}
function td(a,b,c){var d=!1;if(void 0!==b){.8>a.ca/a.pb?b=1:d=!0;a.eb=b;b=a.Fb*a.eb;if(a.pb!=b){a.pb=b;b=a.pb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.j("target speed: "+b)}c&&a.C&&a.C.sb()}dc(a,a.$);a.$=0;a.X=Aa();a.ia=0;ud(a);return d}function Gc(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Pc(a,b,c,d){0<=b&&b<a.L.length&&(d||0>a.L[b][0])&&(c=a.nb*a.eb/1E3*c|0,a.w.W&&(c+=vd(a)),a.L[b][0]=c)}
function wd(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function cc(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function vd(a,b){var c=a.ka-=a.b;a.b=a.I=0;b&&(a.ka=0);return c}
k.be=function(){if(this.w.W){this.Gb>=this.nb&&ud(this,!0);this.Ra=0;this.lb=Aa();if(this.ia){var a=this.lb-this.ia;a>this.wc&&(this.X+=a,this.X>this.lb&&(this.X=this.lb))}try{do{var b=wd(this,this.w.ub?1:this.ob);try{this.ib(b)}catch(e){if("number"!=typeof e)throw e;}b=vd(this,!0);this.Ra+=b;this.$+=b;ec(this,b);cc(this,b);this.wa-=b;if(0>=this.wa){this.wa+=this.ob;15<=++this.yc&&(this.oa(),this.yc=0);break}}while(this.w.W)}catch(e){this.da();this.C&&this.C.stop(Aa(),sd(this));yb(this,e.stack||e.message);
return}if(this.w.W){a=setTimeout;b=this.zc;this.ia=Aa();var c=this.wc;this.Ra&&(c=Math.round(c*this.Ra/this.ob));var c=c-(this.ia-this.lb),d=this.ia-this.X;d&&(this.ca=Math.round(this.$/(10*d))/100,864E5<=d&&(this.pa=0,td(this)));if(0>c||this.ca<this.pb)-1E3>c&&(this.X-=c),c=0;this.Gb+=this.Ra;this.ia+=c;a(b,c)}}};
k.hb=function(a){if(xb(this))return!1;if(this.w.W)return this.j(this.toString()+" busy"),!1;td(this);this.w.W=!0;this.w.Xb=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.sb(!0),this.C.start(this.X,sd(this)));setTimeout(this.zc,0);return!0};k.ib=function(){return 0};k.da=function(a){var b=!1;if(this.w.W){vd(this);dc(this,this.$);this.$=0;this.w.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Aa(),sd(this));b=!0}this.w.complete=a;return b};
function xd(a){this.Wa=+a.model||1170;this.Tb=a.addrReset||0;ld.call(this,a,6666667);this.decode=1120==this.Wa?yd.bind(this):zd.bind(this);Ad(this);this.M=0;this.O=null;this.w.complete=!1}z(xd,ld);k=xd.prototype;k.reset=function(){this.status("model "+this.Wa);this.w.W&&this.da();Ad(this);od(this);this.w.error=!1;this.parent.reset.call(this)};
function Ad(a){a.T=65536;a.U=32768;a.aa=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Tb];a.Ya=[0,0,0,0,0,0];a.Ia=[0,0,0,0];a.A=0;a.jb=0;a.Xc=[4,2,0,1];a.V=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ya=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Nb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0];a.Gc=[0,0,0,0,0,0,0,0];a.Fc=0;a.K=0;a.D=a.H=0;a.g=a.f=a.Eb=0;a.xa=-1;bc(a)}function bc(a){a.Wb=255;a.Ha=0;a.jc=0;a.J=0;a.Ac=0;a.Bc=0;a.qb=0;a.Va=0;a.kb=0;a.Ja=262143;a.S=0;a.Ib=0;a.O=null;a.v&&Sc(a)}function Sc(a){a.Va?(a.R=65536,a.ba=a.Vc,a.ra=a.Zd,a.Pb=a.Re,uc(a.v,a.qb&16?22:18)):(a.R=0,a.ba=a.Uc,a.ra=a.Ec,a.Pb=a.Lc,uc(a.v,16))}k.sc=function(){return 0};k.save=function(){var a=new N(this);a.set(0,[]);a.set(1,[this.pa,this.eb]);a.set(2,Dc(this.v));return a.data()};
k.restore=function(a){var b=a[1];this.pa=b[1];td(this,b[3]);a:{b=this.v;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.I){for(var f=0,g=Array(b.I),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function Bd(a){return a.T&65536?1:0}function Cd(a){return a.U&32768?2:0}function Dd(a){return a.aa&65535?0:4}k.Ua=function(){return this.Z&32768?8:0};
function Ed(a){var b=a.u[7];a.S=0;a.Ib=b;var c=a.ra(b);a.u[7]=b+2&65535;return c}function Fd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function O(a,b){a.u[7]=b&65535}function Qc(a,b){return{de:a,xb:b,next:null}}function Gd(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Oc(a,b){if(b!=a.O){var c=a.O;if(!c||c.xb<=b.xb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.xb<=b.xb){b.next=d;c.next=b;break}c=d}while(c)}}a.K|=1}
function Hd(a){return a.K&64?(a.ta(168,64,-5),!0):a.K&32?(a.ta(4,32,-4),!0):a.K&16?(a.ta(12,16,-6),!0):!1}function Tc(a){return a.N=a.N&63728|a.Ua()|Dd(a)|Cd(a)|Bd(a)}function Uc(a,b){a.Z=b<<12;a.aa=~b&4;a.U=b<<14;a.T=b<<16;if((b^a.N)&2048)for(var c=a.Ya.length;0<=--c;){var d=a.u[c];a.u[c]=a.Ya[c];a.Ya[c]=d}a.A=b>>14&3;c=a.N>>14&3;a.A!=c&&(a.Ia[c]=a.u[6],a.u[6]=a.Ia[a.A]);a.N=b;a.K|=2}function Q(a,b){a.K&128||(a.Z=a.aa=b,a.U=0)}function Id(a,b,c){a.K&128||(a.Z=a.aa=a.T=b,a.U=c||0)}
function Jd(a,b,c,d){a.K&128||(a.Z=a.aa=a.T=b,a.U=(c^b)&(d^b))}function ee(a,b){a.K&128||(a.Z=a.aa=a.T=b,a.U=a.Z^a.T>>1)}function fe(a,b,c,d){a.K&128||(a.Z=a.aa=a.T=b,a.U=(c^d)&(d^b))}
k.ta=function(a,b,c){if(!this.M){0>this.xa?this.xa=Tc(this):this.A||(a=4,this.Ha|=4,this.u[6]=4,c=-3);this.Ib=a;this.A=this.S=0;var d=this.ra(a|this.R),e=this.ra(a+2&65535|this.R);Uc(this,e&-12289|this.xa>>2&12288);ge(this,this.xa);ge(this,this.u[7]);O(this,d);this.K&=~(b|18);this.K|=9;this.xa=-1;this.jd=a;this.Zc=c;if(-3<=c)throw a;}};function he(a){var b=ie(a),c=ie(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);O(a,b);Uc(a,c);a.K&=-17}
function Cc(a,b){var c=b>>13&31;31>c&&a.qb&32&&(b=a.Nb[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function je(a,b,c){var d,e,f;if(!(c&a.Va))return b;d=b>>13;a.qb&a.Xc[a.A]||(d&=7);e=a.V[a.A][d];f=(a.ya[a.A][d]<<6)+(b&8191)&a.Ja;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.V[a.A][d]=e;if(f!=(4194170&a.Ja)||a.A)a.kb=a.A,a.jb=d;b=!1;g&&(g&57344&&(0<=a.xa&&(g|=128),a.J&57344||(a.J=a.J|g|a.kb<<5|a.jb<<
1),b=!0),a.J&61440||!(f<(4191360&a.Ja)||f>(4194239&a.Ja))||(a.J|=4096,a.J&512&&(a.K|=64)),b&&a.ta(168,0,-1));return f}function ke(a,b){return a.v.Hb(b)}function ie(a){var b=a.ra(a.u[6]|a.R);a.u[6]=a.u[6]+2&65535;return b}function ge(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.S=a.S<<8|246;le(a,0,c);a.Pb(c,b)}function le(a,b,c){!a.A&&c<=a.Wb&&(b||4<c)&&(1145<=a.Wa&&c<=a.Wb-32?(a.Ha|=4,a.u[6]=4,a.ta(4,0,-3)):(a.Ha|=8,a.K|=32))}
function me(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return a.ta(4,0,-2),0;case 1:return 6==c&&d&4&&le(a,b,a.u[6]),a.b-=3,7==c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!=c&&(e|=g);e=a.ra(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!=c&&(e|=g);e=a.ra(e)|g;a.b-=8;break;case 6:return e=a.ra(Fd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ra(Fd(a,2)),e=e+
a.u[c]&65535,e=a.ra(e|a.R)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;a.S=a.S<<8|f<<3&248|c;6==c&&0>f&&le(a,b,a.u[6]);return e}k.Ub=function(a){if(!this.Va)return this.v.Ub(a);this.M++;a=ke(this,je(this,a,3));this.M--;return a};k.cb=function(a){if(!this.Va)return this.v.cb(a);this.M++;a=this.Ec(je(this,a,2));this.M--;return a};k.rb=function(a,b){this.Va?(this.M++,a=je(this,a,5),a&1&&this.b--,this.v.Ab(a,b),this.M--):this.v.rb(a,b)};
k.Bb=function(a,b){this.Va?(this.M++,this.Lc(je(this,a,4),b),this.M--):this.v.Bb(a,b)};k.Uc=function(a,b,c){return me(this,a,b,c)};k.Vc=function(a,b,c){return je(this,me(this,a,b,c),c)};k.Ec=function(a){return this.v.na(a)};k.Zd=function(a){return this.v.na(je(this,a,2))};k.Lc=function(a,b){this.v.gb(a,b&65535)};k.Re=function(a,b){this.v.gb(je(this,a,4),b)};
function ne(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=me(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.A=a.N>>12&3,c=a.ra(d|c&a.R),a.A=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.Ia[a.N>>12&3];return c}function oe(a,b,c,d){a.S=22;var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=me(a,b,e,4),c&65536||(e&=65535),a.A=a.N>>12&3,e=je(a,e|c&65536,4),a.A=a.N>>14&3,a.v.gb(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.Ia[a.N>>12&3]=d}
function pe(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?ke(a,a.ba(b,c,3)):-c-1}function qe(a,b){var c;b>>=6;var d=a.H=b&7;(b=a.D=(b&56)>>3)?c=a.v.na(a.ba(b,d,2)):c=-d-1;return c}function re(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return me(a,b,c,8)}function se(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?ke(a,a.ba(b,c,3)):a.u[c]&255}function te(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.na(a.ba(b,c,2)):a.u[c]}
function R(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.Eb=a.ba(b,e,7),c=0>c?a.u[-c-1]&255:c,c=d.call(a,c,ke(a,e)),e&1&&a.b--,a.v.Ab(e,c)):(b=a.u[e],c=0>c?a.u[-c-1]&255:c,a.u[e]=b&65280|d.call(a,c,b&255))}function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.ba(b,e,6),a.v.gb(e,d.call(a,0>c?a.u[-c-1]:c,a.v.na(e)))):a.u[e]=d.call(a,0>c?a.u[-c-1]:c,a.u[e])}
function ue(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.ba(b,e,5),e=c=0>c?a.u[-c-1]&255:c,d&1&&a.b--,a.v.Ab(d,e)):c?(c=0>c?a.u[-c-1]&255:c,a.u[e]=a.u[e]&~d|c<<24>>24&d):a.u[e]&=~d;return c}function ve(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.ba(b,d,4),a.v.gb(d,c=0>c?a.u[-c-1]:c)):a.u[d]=c=0>c?a.u[-c-1]:c;return c}function T(a,b,c){c&&(O(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.ib=function(a){this.w.complete=!0;var b=this.i?we(this.i)?1:this.w.Xb?-1:0:0,c=a?this.w.Xb?0:1:-1;this.w.Xb=!1;this.ka=this.b=a;do{if(b){if(xe(this.i,this.u[7],c)){this.da();break}c||c++;b++}if(this.K){if(a=this.K&7)if(a=!1,this.K&2){this.K&=-3;var d=160,e=(this.jc&224)>>5,f=this.O&&this.O.xb>e?this.O:null;f&&(d=f.de,e=f.xb);e>(this.N&224)>>5?(this.K&4&&(Fd(this,2),this.K&=-5),this.ta(d,0,-9),e=!0):e=!1;e&&(f&&Gd(this,f),a=!0)}else this.K&1&&this.K++;if(a){if(b&&xe(this.i,this.u[7],c)){this.da();
break}if(0>c)break}if(this.K&112&&Hd(this)){if(b&&xe(this.i,this.u[7],c)){this.da();break}if(0>c)break}}this.K=this.K&7|this.N&16;this.decode(Ed(this))}while(0<this.b);return this.w.complete?this.ka-this.b:void 0===this.w.complete?0:-1};Za(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new xd(d);B(d,c)}});function ye(a,b){var c=b+a;Jd(this,c,a,b);return c&65535}function ze(a,b){var c=b+a;Jd(this,c<<8,a<<8,b<<8);return c&255}
function Ae(a,b){a=b<<1;ee(this,a);return a&65535}function Be(a,b){a=b<<1;ee(this,a<<8);return a&255}function Ce(a,b){a=b&32768|b>>1|b<<16;ee(this,a);return a&65535}function De(a,b){a=b&128|b>>1|b<<8;ee(this,a<<8);return a&255}function Ee(a,b){a=b&~a;Q(this,a);return a}function Fe(a,b){a=b&~a;Q(this,a<<8);return a}function Ge(a,b){a|=b;Q(this,a);return a}function He(a,b){a|=b;Q(this,a<<8);return a}function Ie(a,b){a=~b|65536;Id(this,a);return a&65535}
function Je(a,b){a=~b|256;Id(this,a<<8);return a&255}function Ke(a,b){a=b-a;this.K&128||(this.Z=this.aa=a,this.U=b&(b^a));return a&65535}function Le(a,b){a=b-a;var c=a<<8;b<<=8;this.K&128||(this.Z=this.aa=c,this.U=b&(b^c));return a&255}function Me(a,b){a=b+a;this.K&128||(this.Z=this.aa=a,this.U=a&(b^a));return a&65535}function Ne(a,b){a=b+a;var c=a<<8;this.K&128||(this.Z=this.aa=c,this.U=c&(b<<8^c));return a&255}function Oe(a,b){a=-b;Id(this,a,a&b&32768);return a&65535}
function Pe(a,b){a=-b;Id(this,a<<8,(a&b&128)<<8);return a&255}function Qe(a,b){a=b<<1|this.T>>16&1;ee(this,a);return a&65535}function Re(a,b){a=b<<1|this.T>>16&1;ee(this,a<<8);return a&255}function Se(a,b){a=(this.T&65536|b)>>1|b<<16;ee(this,a);return a&65535}function Te(a,b){a=((this.T&65536)>>8|b)>>1|b<<8;ee(this,a<<8);return a&255}function Ue(a,b){var c=b-a;fe(this,c,a,b);return c&65535}function Ve(a,b){var c=b-a;fe(this,c<<8,a<<8,b<<8);return c&255}
function We(a,b){this.K&128||(this.Z=this.aa=b&65280,this.U=this.T=0);return(b<<8|b>>8)&65535}function Xe(a,b){a^=b;Q(this,a);return a&65535}function Ye(a){S(this,a,qe(this,a),ye);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function Ze(a){var b=te(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.T=this.U=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.T=c<<17-b,c>>=b;else if(b)if(16<b)this.U=c,c=0;else{this.T=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.U=32768)}this.u[a]=c&65535;this.Z=this.aa=c;this.b-=(this.g?6:7)+b}
function $e(a){var b=te(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.T=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.T=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.U=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.aa=d>>16|d;this.b-=(this.g?6:7)+b}function af(a){T(this,a,!Bd(this))}function bf(a){T(this,a,Bd(this))}
function cf(a){S(this,a,qe(this,a),Ee);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function df(a){R(this,a,pe(this,a),Fe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function ef(a){S(this,a,qe(this,a),Ge);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function ff(a){R(this,a,pe(this,a),He);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function gf(a){var b=qe(this,a);a=te(this,a);Q(this,(0>b?this.u[-b-1]:b)&a);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function hf(a){var b=pe(this,a);a=se(this,a);Q(this,((0>b?this.u[-b-1]&255:b)&a)<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function jf(a){T(this,a,Dd(this))}function kf(a){T(this,a,!this.Ua()==!Cd(this))}function lf(a){T(this,a,!Dd(this)&&!this.Ua()==!Cd(this))}function mf(a){T(this,a,!Bd(this)&&!Dd(this))}
function nf(a){T(this,a,Dd(this)||!this.Ua()!=!Cd(this))}function of(a){T(this,a,Bd(this)||Dd(this))}function pf(a){T(this,a,!this.Ua()!=!Cd(this))}function qf(a){T(this,a,this.Ua())}function rf(a){T(this,a,!Dd(this))}function sf(a){T(this,a,!this.Ua())}function tf(){this.ta(12,0,-8);this.b-=5}function uf(a){T(this,a,!0)}function vf(a){T(this,a,!Cd(this))}function wf(a){T(this,a,Cd(this))}function U(a){a&1&&(this.T=0);a&2&&(this.U=0);a&4&&(this.aa=1);a&8&&(this.Z=0);this.b-=5}
function xf(a){var b=qe(this,a);a=te(this,a);var c=(b=0>b?this.u[-b-1]:b)-a;fe(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function yf(a){var b=pe(this,a);a=se(this,a);var c=(b=(0>b?this.u[-b-1]&255:b)<<8)-(a<<=8);fe(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}
function zf(a){var b=te(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.T=this.U=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.aa=d>>16|d,this.Z=d>>16):(this.U=32768,this.aa=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.aa=this.Z=0,this.U=32768,this.T=65536,this.b-=7}function Af(){this.ta(24,0,-8);this.b-=25}
function Bf(){this.N&49152?(this.Ha|=128,this.ta(4,0,-7)):(this.B&&1120==this.Wa&&this.B.setData(this.u[0],!0),this.i?Cf(this.i):this.da());this.b-=7}function Df(){this.ta(16,0,-8);this.b-=25}var Ef=[0,7,7,10,7,11,9,13];function Ff(a){this.I=this.b;O(this,re(this,a));this.b=this.I-Ef[this.g]}var Gf=[0,14,14,17,14,18,16,20];function Hf(a){this.I=this.b;var b=re(this,a);a=a>>6&7;ge(this,this.u[a]);this.u[a]=this.u[7];O(this,b);this.b=this.I-Gf[this.g]}
var If=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Jf(a){var b=qe(this,a);this.I=this.b;Q(this,ve(this,a,b));this.b=this.I-If[(this.D?8:0)+this.g]+(7!=this.f||this.g?0:2)}function Kf(a){var b=pe(this,a);Q(this,ue(this,a,b,65535)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}var Lf=[7,13,13,17,14,18,17,21];
function Mf(a){var b=te(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.K&128||(this.Z=b>>16,this.aa=this.Z|b,this.U=0,this.T=-32768>b||32767<b?65536:0);this.b-=23}function Nf(){this.b-=5}function Of(){this.N&49152||(this.v.reset(),bc(this));this.b-=667}function Pf(a){if(a&8)V.call(this,a);else{var b=ie(this);a&=7;7==a?O(this,b):(O(this,this.u[a]),this.u[a]=b);this.b-=9}}function Qf(){he(this);this.b-=13}
function W(a){a&1&&(this.T=65536);a&2&&(this.U=32768);a&4&&(this.aa=0);a&8&&(this.Z=32768);this.b-=5}function Rf(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)O(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function Sf(a){S(this,a,qe(this,a),Ue);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function Tf(a){S(this,a,0,We);this.b-=this.g?9:3+(7==this.f?2:0)}function Uf(){this.ta(28,0,-8);this.b-=5}
function Vf(){this.B&&(this.B.kc(this.u[7],!0),this.B.setData(this.u[0],!0));this.K|=4;Fd(this,-2);this.b-=3}function Wf(a){S(this,a,qe(this,a),Xe);this.b-=this.g?9:3+(7==this.f?2:0)}function V(a){var b;if(b=this.i)b=this.i,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=Cf(b)):b=!1;b||this.ta(8,0,-8)}function yd(a){Xf[a>>12].call(this,a)}function Yf(a){Zf[a>>6&3].call(this,a)}function $f(a){ag[a>>6&3].call(this,a)}function bg(a){cg[a>>6&3].call(this,a)}function dg(a){eg[a&15].call(this,a)}
function fg(a){gg[a&15].call(this,a)}function hg(a){ig[a>>6&3].call(this,a)}function jg(a){kg[a>>6&3].call(this,a)}function lg(a){mg[a>>6&3].call(this,a)}
var Xf=[function(a){ng[a>>8&15].call(this,a)},Jf,xf,gf,cf,ef,Ye,V,function(a){og[a>>8&15].call(this,a)},Kf,yf,hf,df,ff,Sf,V],ng=[function(a){pg[a>>4&15].call(this,a)},uf,rf,jf,kf,pf,lf,nf,Hf,Hf,Yf,$f,bg,V,V,V],Zf=[function(a){Id(this,ve(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ie);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Me);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ke);this.b-=this.g?9:3+(7==this.f?2:0)}],ag=[function(a){S(this,a,0,
Oe);this.b-=this.g?11:6},function(a){S(this,a,Bd(this)?1:0,ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Bd(this)?1:0,Ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=te(this,a);Id(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],cg=[function(a){S(this,a,0,Se);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Qe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ce);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ae);this.b-=this.g?9:3+(7==this.f?2:0)}],
pg=[function(a){qg[a&15].call(this,a)},V,V,V,Ff,Ff,Ff,Ff,Pf,V,dg,fg,Tf,Tf,Tf,Tf],qg=[Bf,Vf,Qf,tf,Df,Of,V,V,V,V,V,V,V,V,V,V],eg=[Nf,function(){this.T=0;this.b-=5},function(){this.U=0;this.b-=5},U,function(){this.aa=1;this.b-=5},U,U,U,function(){this.Z=0;this.b-=5},U,U,U,U,U,U,U],gg=[Nf,function(){this.T=65536;this.b-=5},function(){this.U=32768;this.b-=5},W,function(){this.aa=0;this.b-=5},W,W,W,function(){this.Z=32768;this.b-=5},W,W,W,W,W,W,W],og=[sf,qf,mf,of,vf,wf,af,bf,Af,Uf,hg,jg,lg,V,V,V],ig=[function(a){Id(this,
ue(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,Je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,1,Le);this.b-=this.g?9:3+(7==this.f?2:0)}],kg=[function(a){R(this,a,0,Pe);this.b-=this.g?11:6},function(a){R(this,a,Bd(this)?1:0,ze);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,Bd(this)?1:0,Ve);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=se(this,a);Id(this,a<<8);this.b-=this.g?4:3+
(7==this.f?2:0)}],mg=[function(a){R(this,a,0,Te);this.b-=this.g?9+(this.Eb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Re);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){R(this,a,0,De);this.b-=this.g?9+(this.Eb&1):3+(7==this.f?2:0)},function(a){R(this,a,0,Be);this.b-=this.g?9:3+(7==this.f?2:0)}];function zd(a){rg[a>>12].call(this,a)}
var rg=[function(a){sg[a>>8&15].call(this,a)},Jf,xf,gf,cf,ef,Ye,function(a){tg[a>>8&15].call(this,a)},function(a){ug[a>>8&15].call(this,a)},Kf,yf,hf,df,ff,Sf,V],sg=[function(a){vg[a>>4&15].call(this,a)},uf,rf,jf,kf,pf,lf,nf,Hf,Hf,Yf,$f,bg,function(a){wg[a>>6&3].call(this,a)},V,V],wg=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ra(a|this.R);O(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=ne(this,a,0);ge(this,a);Q(this,a);this.b-=11},function(a){var b=ie(this);this.I=
this.b;oe(this,a,0,b);Q(this,b);this.b=this.I-Lf[this.g]},function(a){Q(this,ve(this,a,this.Ua?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],vg=[function(a){xg[a&15].call(this,a)},V,V,V,Ff,Ff,Ff,Ff,Pf,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.K|=1),this.b-=5):V.call(this,a)},dg,fg,Tf,Tf,Tf,Tf],xg=[Bf,Vf,function(){he(this);this.K|=this.N&16;this.b-=13},tf,Df,Of,Qf,function(){this.ta(8,0,-8)},V,V,V,V,V,V,V,V],tg=[Mf,Mf,zf,zf,Ze,Ze,$e,$e,Wf,Wf,V,V,V,V,Rf,Rf],ug=[sf,qf,mf,of,
vf,wf,af,bf,Af,Uf,hg,jg,lg,function(a){yg[a>>6&3].call(this,a)},V,V],yg=[V,function(a){a=ne(this,a,65536);ge(this,a);Q(this,a);this.b-=11},function(a){var b=ie(this);this.I=this.b;oe(this,a,65536,b);Q(this,b);this.b=this.I-Lf[this.g]},V];
function zg(a){t.call(this,"ROM",a,zg);this.ga=this.g=null;this.A=a.addr;this.f=a.size;this.D=!1;this.B=a.alias;this.C=a.file;this.H=ra(this.C);if(this.C){a=this.C;var b=sa(this.H);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga):c.C=null);Ag(c)})}}z(zg);k=zg.prototype;
k.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Ag(this)};k.Ga=function(){this.ga&&(this.i&&Tg(this.i,this.id,this.A,this.f,this.ga),delete this.ga);return!0};k.Fa=function(){return!0};
function Ag(a){if(!wb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)yb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.A;a.status(a.f+"-byte ROM at "+qa(b));if(57344<=b&&b<57344+nc){var c={};b=(c[b]=[zg.prototype.Nd,zg.prototype.Fe,null,null,null,a.f>>1],c);if(Hb(a.v,a,b,256,a.$a)){b=a.D=!0;break a}}else if(xc(a.v,b,a.f,ad)){for(c=0;c<a.g.length;c++)a.v.rb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.B?
b.push(a.B):null!=a.B&&a.B.length&&(b=a.B);for(c=0;c<b.length;c++){var d=a,e=b[c],f=wc(d.v,d.A,d.f);vc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Nd=function(a){return this.g[a-this.A]};k.Fe=function(){};Za(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new zg(d);B(d,c)}});
function Ug(a){t.call(this,"RAM",a,Ug);this.ga=this.g=null;this.C=a.addr;this.A=a.size;this.La=a.load;this.Ka=a.exec;this.B=!1;this.f=a.file;this.D=ra(this.f);if(this.f){a=this.f;var b=sa(this.D);"json"!=b&&"hex"!=b&&(a=Fa()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.P("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(qb(c.Qa,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.La&&(c.La=a.La),null==c.Ka&&(c.Ka=a.Ka)):c.f=null);Vg(c)})}}
z(Ug);Ug.prototype.Ea=function(a,b,c,d){this.v=b;this.b=c;this.i=d;Vg(this)};Ug.prototype.Ga=function(){this.ga&&(this.i&&Tg(this.i,this.id,this.C,this.A,this.ga),delete this.ga);return!0};Ug.prototype.Fa=function(){return!0};function Vg(a){if(a.v&&(!a.B&&a.A&&xc(a.v,a.C,a.A,Ac)&&(a.B=!0),!wb(a))){if(!a.B)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;Wg(a,a.g,a.La,a.Ka,a.C)}H(a)}}
Ug.prototype.reset=function(){if(this.B){for(var a=this.v,b=this.C,c=this.A,d=b&a.v,b=b>>>a.ja;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.B.length){var f=a.g.indexOf(e);0<=f&&(e=a.B[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(zb&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.Zb(d,g,e.F+d)}c-=a.za;b++;d=0}this.g&&Wg(this,this.g,this.La,this.Ka,this.C,!0)}};
function Wg(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.rb(n++,b[v++]&255);else n&1?a.b.da():null==d&&
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.rb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.Tb=d,a.v.reset(),bc(a),O(a,d),Uc(a,0),!f&&a.i&&(a.da()||qd(a.i)));return g}Za(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Ug(d);B(d,c)}});function Xg(a){t.call(this,"Keyboard",a,Xg,65536);H(this)}z(Xg);Xg.prototype.sa=function(){return!1};
Xg.prototype.Ea=function(a,b,c,d){this.C=a;this.b=c;this.i=d};Za(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Xg(d);B(d,c)}});
function X(a){this.O=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.$=a.upperCase;this.B=this.D=null;this.S=a.tabSize;this.R=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=Yg;b&&(void 0===c&&(c="Panel"),(c=tb(c,this.id))&&(b=c.G[b])&&this.sa(null,a,b))}this.I=this.L=null;this.exports={connect:this.xc,receiveData:this.ic}}z(X);var Yg="buffer";k=X.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case Yg:return this.G[b]=this.B=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.ic(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ic(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;var e=this;this.ka=Qc(48,4);this.X=Gc(this.b,function(){e.f&128||!e.A.length||(e.J=e.A.shift()&255,e.$&&97<=e.J&&122>e.J&&(e.J-=32),e.f|=128,e.f&64&&Oc(e.b,e.ka))});this.M=Qc(52,4);this.ia=Gc(this.b,function(){e.g|=128;e.g&64&&Oc(e.b,e.M)});Hb(b,this,Zg);Jb(b,this.reset.bind(this));H(this)};
k.xc=function(){if(!this.I){var a=nd(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=xa(b[0]);if(c!=this.$a)return;b=xa(b[1]);if(this.I=sb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.Qa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ga=function(a,b){if(!b)if(this.xc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.Fa=function(a){return a?this.save():!0};k.reset=function(){$g(this)};k.save=function(){var a=new N(this);a.set(0,[]);return a.data()};k.restore=function(){return $g(this)};function $g(a){a.J=0;a.f=0;a.g=128;a.A=[];return!0}k.ic=function(a){if("number"==typeof a)this.A.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.A.push(a.charCodeAt(b));else this.A=this.A.concat(a);Pc(this.b,this.X,1E3/Math.round(this.O/10));return!0};k.Hd=function(){return this.f&65534};
k.ze=function(a){this.f=this.f&-112|a&111};k.Gd=function(){this.f&=-129;0<this.A.length&&Pc(this.b,this.X,1E3/Math.round(this.O/10));return this.J};k.ye=function(){};k.ae=function(){return this.g};k.Te=function(a){this.g&128&&(a&64?Oc(this.b,this.M):Gd(this.b,this.M));this.g=this.g&-70|a&69};k.$d=function(){return 0};
k.Se=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);a&=127;if(this.B)if(13==a)this.H=0;else if(8==a)this.B.value=this.B.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=ya[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.S||8,c=a-this.H%a,this.S&&(b=wa("",c)));this.R&&!this.H&&c&&(b=String.fromCharCode(this.R)+b);this.B.value+=b;this.B.scrollTop=this.B.scrollHeight;this.H+=c}else if(null!=this.D){if(10==a||1024<=this.D.length)this.j(this.D),
this.D="";10!=a&&(this.D+=String.fromCharCode(a))}this.g&=-129;Pc(this.b,this.ia,1E3/Math.round(this.ca/10))}};var ah={},Zg=(ah[65392]=[null,null,X.prototype.Hd,X.prototype.ze,"RCSR"],ah[65394]=[null,null,X.prototype.Gd,X.prototype.ye,"RBUF"],ah[65396]=[null,null,X.prototype.ae,X.prototype.Te,"XCSR"],ah[65398]=[null,null,X.prototype.$d,X.prototype.Se,"XBUF"],ah);Za(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
function Vc(a){t.call(this,"PC11",a,Vc);this.g=a.autoMount||null;this.D=0;this.$=a.baudReceive||3600;this.J=this.L=this.f=0;this.I=[];this.H=bh;this.B=ch;this.M=this.A="";this.ea=this.La=this.Ka=null;this.R=-1;this.O=!Ra("Mobi")&&window&&"FileReader"in window}z(Vc);var bh="",ch=0;k=Vc.prototype;
k.sa=function(a,b,c){var d=this,e=ch;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
function(){var a=d.G.listTapes;a&&dh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;dh(d,ra(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;this.S=eh(a);var e=this;if((this.g=nd(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Qc(56,4);this.ca=Gc(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.J<e.I.length&&(e.L=e.I[e.J++]&255,fh(e,e.J/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Oc(e.b,e.X))});Hb(b,this,gh);Jb(b,this.reset.bind(this));hh(this,"None",bh,!0);this.O&&
hh(this,"Local Tape","?");hh(this,"Remote Tape","??");ih(this)||H(this)};k.Ga=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function ih(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=ra(b,!0)}b&&c?jh(a,c,b,1,!0):kh(a)}return!!a.D}
function dh(a,b,c,d,e){if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;jh(a,b,c,d,!1,e)}else lh(a,!1)}
function jh(a,b,c,d,e,f){var g=-1;if(a.A.toLowerCase()!=c.toLowerCase()||a.B!=d)g++,lh(a,!0),a.w.bb?a.P("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),mh(a,b,c,d,f)?g++:a.w.bb=!0);g&&nh(a,a.M,a.A,a.B,a.ea,a.La,a.Ka)}
function mh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),nh(a,b,c,d,e),a.H="?");kh(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=sa(c),f="json"==e||"gz"==e?encodeURI(c):Fa()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.w.ha;g?a.P('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(qb(a.Qa,e,f),(e=Ea(e,f))&&nh(a,b,c,d,e.ea,e.La,
e.Ka));a.w.bb=!1;a.D&&(a.D--,a.D||H(a));kh(a)})}function hh(a,b,c,d){if((a=a.G.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function kh(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.A;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function fh(a,b){b|=0;if(b!==a.R){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.R=b}}
function nh(a,b,c,d,e,f,g){a.M=b;a.A=c;a.B=d;a.ea=e;a.La=f;a.Ka=g;2==d?a.S&&Wg(a.S,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.A="",a.H=bh,a.B=ch,a.P("No load address available for tape: "+b)):(a.J=0,a.I=e,a.status("tape attached: "+b),fh(a,0))}function lh(a,b){if(a.A||!1===b)a.M="",a.A="",b||(a.B&&a.status(1==a.B?"tape detached":"tape unloaded"),a.H=bh,a.B=ch,kh(a))}k.save=function(){return(new N(this)).data()};k.restore=function(){return!0};k.Ad=function(){return this.f&65534};
k.se=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Oc(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Pc(this.b,this.ca,1E3/Math.round(this.$/10))));this.f=this.f&-66|a&65};k.zd=function(){this.f&=-129;this.f|=2048;return this.L};k.re=function(){};var oh={},gh=(oh[65384]=[null,null,Vc.prototype.Ad,Vc.prototype.se,"PRS"],oh[65386]=[null,null,Vc.prototype.zd,Vc.prototype.re,"PRB"],oh);
function ph(a,b,c){t.call(this,"Disk",{id:a.Qa+".disk"+p(++qh,4)},ph,4194304);this.controller=a;this.C=a.C;this.i=a.i;this.B=b;this.Za=b.name;this.ec=b.ec;rh(this,c,b.ua,b.Aa,b.qa,b.Ma);H(this)}var qh=0;z(ph);k=ph.prototype;k.Ea=function(a,b,c,d){this.i=d};
function rh(a,b,c,d,e,f){a.mode=b;a.ua=c;a.Aa=d;a.qa=e;a.Ma=f;a.b=[];if("preload"!=a.mode){b=Array(a.ua);for(c=0;c<b.length;c++){d=Array(a.Aa);for(e=0;e<d.length;e++){f=Array(a.qa);for(var g=1;g<=f.length;g++)f[g-1]=sh(null,c,e,g,a.Ma,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function th(a,b,c,d,e){var f=c;if(a.v)return!0;a.Za=b;a.fb=c;a.Ic=ra(c);a.v=e;a.A=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.ua=e[0];a.Aa=e[1];a.qa=e[2];a.Ma=e[3]||512;c=a.Ma>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ua);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.Aa),w=0;w<r.length;w++)for(var y=r[w]=Array(a.qa),x=0;x<y.length;x++){for(var C=sh(null,d,w,x+1,a.Ma,0),ia=C.data,Ja=0;Ja<c;Ja++,f+=4)var P=ia[Ja]=b.getInt32(f,
!0),e=e+P&-1;C.Ba=c;y[x]=C}a.f=e;c=a}else a.P("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.B,c,a.Za,a.fb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=sa(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ta(c,"/")&&(d="dir"),f=Fa()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.ec?"":e)+"&format=json"));return!!Da(f,
null,!0,function(b,c,d){uh(a,b,c,d)})}
function uh(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.w.ha;if(d)a.controller.P('Unable to load disk "'+a.Za+'" (error '+d+": "+b+")",f);else{qb(a.controller.Qa,b,c);try{if(0<ra(a.Ic,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.Za]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.ua=h.length;a.Aa=h[0].length;a.qa=h[0][0].length;var l=h[0][0][0];a.Ma=l&&l.length||512;for(d=c=0;d<a.ua;d++)for(f=0;f<a.Aa;f++)for(g=0;g<a.qa;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;vh(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}sh(l,d,f);for(w=
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.Za)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.A,a.B,e,a.Za,a.fb),a.v=null)}function sh(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.We=b;a.Xe=c;a.Pa=a.Ba=0;a.Ta=!1;return a}
k.seek=function(a,b,c,d,e){d=null;var f=this.B,g=this.b[a];if(g){var h=g[b];if(!h&&f.Oc&&b<f.Aa)for(h=g[b]=Array(f.Pc),g=0;g<h.length;g++)h[g]=sh(null,a,b,g+1,f.Cc,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Oc&&9==f.oc&&(d=h[g]=sh(null,a,b,f.oc,f.Cc,0))}}e&&e(d,!1);return d};function vh(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Ba?f<a.Pa?(a.Ba+=a.Pa-f,a.Pa=f):f>=a.Pa+a.Ba&&(a.Ba+=f-(a.Pa+a.Ba)+1):(a.Pa=f,a.Ba=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function wh(a,b){var c=a.Aa*a.qa,d=b/c|0;return d<a.ua?(b%=c,a.seek(d,b/a.qa|0,b%a.qa+1)):null}function xh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
k.save=function(){var a=0,b=[];b[a++]=[this.fb,this.f,this.ua,this.Aa,this.qa,this.Ma];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Ba){for(var h=[],l=0,m=g.Pa,n=g.Pa+g.Ba;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Pa,h]}}return b};
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?rh(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][l][m]){for(l=h.data.length;l<e;)h.data[l++]=h.pattern;l=0;h.Pa=e;for(h.Ba=f.length;e<g;)h.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.P("Unable to restore disk '"+this.Za+": "+c);return b};
k.toJSON=function(){var a;a=0;for(var b;b=wh(this,a++);)yh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function yh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function M(a){t.call(this,"RL11",a,M,4194304);this.B=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Ra("Mobi")&&window&&"FileReader"in window}z(M);k=M.prototype;
k.sa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=pa(c.value,10);null!=a&&zh(d,a)},!0;case "loadDrive":return this.G[b]=
c,c.onclick=function(){var a=d.G.listDisks;a&&Ah(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[pa(a.value,10)||0])if(a=a.Ca){var b;b="";for(var c=0,h;h=wh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(xh(a,h,l));b=btoa(b);a=a.Ic.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
"string"!=typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");q(a)}else d.P("No disk loaded in drive.");else d.P("No disk drive selected.")};return!0;case "mountDrive":if(this.L)return this.G[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Ah(d,ra(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.Ea=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.i=d;if((this.B=nd(this.C,"autoMount")||this.B)&&"string"==typeof this.B)try{this.B=eval("("+this.B+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.B+")"),this.B=null}Bh(this);this.O=Qc(112,5);Hb(b,this,Ch,4194304);Jb(b,this.reset.bind(this));Dh(this,"None","",!0);this.L&&Dh(this,"Local Disk","?");Dh(this,"Remote Disk","??");Eh(this)||H(this)};
k.Ga=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.rc){for(a=0;a<this.f.length;a++)Fh(this,a,!0);Eh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";zh(this,0)}}return!0};k.Fa=function(a){return a?this.save():!0};k.reset=function(){Bh(this)};k.save=function(){return(new N(this)).data()};
k.restore=function(a){return Bh(this,a[0])};function Eh(a,b){b||(a.H=0);if(a.B)for(var c in a.B){var d=a.B[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=ra(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Gh(a,g,f,e,!0)&&b&&H(a,!1);continue}a.P("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
function Ah(a,b,c,d){var e=a.G.listDrives,e=e&&pa(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.P("Unable to load the selected drive");else if(c)if("?"==c)a.P('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=ra(c);a.status("Attempting to load "+c+' as "'+b+'"')}Gh(a,e,b,c,!1,d)}else Fh(a,e)}
function Gh(a,b,c,d,e,f){var g=-1,h=a.f[b];h.fb.toLowerCase()!=d.toLowerCase()&&(g++,Fh(a,b,!0),h.dc?a.P("RL11 busy"):(h.dc=!0,e&&(h.cc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Qb=!!f,th(new ph(a,h,"preload"),c,d,f,a.Rc)&&g++));return g}
k.Rc=function(a,b,c,d,e){var f;a.dc=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.ua||f[1]>a.Aa)&&(this.P('Disk "'+c+'" too large for drive '+("RL"+a.fc)),b=null);b?(a.Ca=b,a.Za=c,a.fb=d,this.P('Mounted disk "'+c+'" in drive '+("RL"+a.fc),a.cc||e),this.C&&this.C.sb()):a.Qb=!1;a.cc&&(a.cc=!1,--this.H||H(this));zh(this,a.fc)};
function Dh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function zh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=pa(a.value,10),c=c.Qb?"?":c.fb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Fh(a,b,c){var d=a.f[b];if(d.Ca||!1===c)d.Za="",d.fb="",d.Ca=null,d.Qb=!1,c||(a.P("Drive RL"+b+" unloaded",c),zh(a,b))}
function Bh(a,b){var c=0;b||(b=[]);a.fa=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.A=b[c++]||0;a.D=b[c++]||0;a.J=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.fc=b;d.dc=d.Qb=!1;d.name=c.$a;d.ua=512;d.Aa=2;d.qa=40;d.Ma=256;d.ec=!0;d.Ve=0;d.Ue=0;d.oc=1;d.Pc=d.qa;d.Cc=d.Ma;d.Ye=0;d.$e=null;d.Ca||(d.fb="");d.status=29|(512==d.ua?128:0)}return!0}
k.Sc=function(a,b,c,d,e,f){this.I=f&65535;this.fa=this.fa&-49|f>>12&48;this.J=f>>16&63;this.A=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.fa=this.fa|a|32768);return!0};
k.nd=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ca.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ca.read(m,n++))||0>(r=a.Ca.read(m,n++))){h=5120;break}this.v.gb(f,v|r<<8);if(Fc(this.v)){h=8192;break}f+=2;if(n>=l.Ma&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};
k.he=function(a,b,c,d,e,f,g){var h=0,l=a.Ca,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.na(f);if(Fc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ca.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ca.write(m,n++,v&255)||!a.Ca.write(m,n++,v>>8)){h=5120;break}if(n>=l.Ma&&(m=null,++d>=l.qa&&(d=0,++c>=l.Aa&&(c=0,++b>=l.ua)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Kd=function(){return this.fa&65535};
k.Ce=function(a){this.fa=this.fa&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.fa&128)){var b;a=!0;var c=this.f[(this.fa&768)>>8],d,e,f,g;this.fa&=-2;switch(this.fa&14){case 4:this.g&8&&(this.fa&=63);this.D=c.status|this.A&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.A=this.g&4?this.A+b:this.A-b,this.g=this.A=this.A&65408|c);break;case 8:this.D=this.A;break;case 12:b=this.nd;case 10:b||(b=this.he),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.ua||f>=c.qa?this.fa|=37888:
(g=(this.J&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Sc.bind(this)))}a&&(this.fa|=129,this.fa&64&&Oc(this.b,this.O))}};k.Id=function(){return this.I};k.Ae=function(a){this.I=a&65534};k.Ld=function(){return this.g};k.De=function(a){this.g=a};k.Md=function(){return this.D};k.Ee=function(a){this.D=a};k.Jd=function(){return this.J};k.Be=function(a){this.J=a&63};
var Hh={},Ch=(Hh[63744]=[null,null,M.prototype.Kd,M.prototype.Ce,"RLCS"],Hh[63746]=[null,null,M.prototype.Id,M.prototype.Ae,"RLBA"],Hh[63748]=[null,null,M.prototype.Ld,M.prototype.De,"RLDA"],Hh[63750]=[null,null,M.prototype.Md,M.prototype.Ee,"RLMP"],Hh[63752]=[null,null,M.prototype.Jd,M.prototype.Be,"RLBE"],Hh);function Ih(a){t.call(this,"Debugger",a,Ih);this.ca=a.base||16;this.xa=!1;this.J=0;this.R=!1;this.A=-1;this.g=[];this.X={}}z(Ih);
var Jh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Ih.prototype.tc=function(){return-1};Ih.prototype.uc=function(){};
function Kh(a,b,c,d){if(c)if(b){0>a.A&&a.g.length&&(a.A=0);if(0>a.A||b!=a.g[a.A])a.g.splice(0,0,b),a.A=0;a.A--}else a.R?b="end":b=a.g[a.A+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(xa(b.substring(c,f))),c=f+1}}return a}
function Lh(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
var Ab="undefined"!==typeof ArrayBuffer,Bb="UNKNOWN ABORT ILLEGAL RED YELLOW FAULT TRACE HALT OPCODE INTERRUPT".split(" "),Cb={cpu:1,trap:16,fault:32,bus:64,memory:128,mmu:256,rom:512,device:1024,panel:2048,keyboard:65536,key:131072,paper:1048576,disk:4194304,serial:8388608,speaker:33554432,computer:67108864,log:268435456,warn:536870912,buffer:1073741824,halt:-2147483648};
function Db(a){t.call(this,"Panel",a,Db,2048);this.va=this.w=this.Ya=this.rb=this.B=this.D=0;this.I=this.K=this.H=!1;this.L=Eb;this.g={};this.f={START:[1,1,!0,!1,this.hd],STEP:[1,1,!1,!1,this.jd],ENABLE:[1,1,!1,!1,this.dd],CONT:[1,1,!0,!1,this.bd],DEP:[0,0,!0,!1,this.cd],EXAM:[1,1,!0,!1,this.ed],LOAD:[1,1,!0,!1,this.gd],TEST:[0,0,!0,!1,this.fd]};for(a=0;22>a;a++)this.f["S"+a]=[0,0,!1,!1,this.kd,a]}z(Db);var Eb=7;function Fb(a,b){return a.f[b]&&a.f[b][1]}k=Db.prototype;k.reset=function(){this.stop()};
k.wa=function(a,b,c,d){if(this.C&&this.C.wa(a,b,c,d)||this.b&&this.b.wa(a,b,c,d)||this.j&&this.j.wa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.G[b]=c,this.D++,!0;default:return"led"==a||"rled"==a?(this.G[b]=c,this.g[b]=d?1:0,this.D++,!0):"switch"==a?(void 0===this.f[b]&&(this.f[b]=[d?1:0,d?1:0]),this.G[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,
b){return function(){Gb(a,b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){Hb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){Gb(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){Hb(a,b)}}(this,b),!0):this.parent.wa.call(this,a,b,c,d)}};k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.j=d;Ib(b,this,Jb);Kb(b,this.reset.bind(this));Lb(this);Mb(this)};k.Ka=function(a,b){b||(Nb(),this.reset());return!0};k.Ja=function(){return!0};
function Ob(a,b,c){if(a=a.G[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function Lb(a,b){for(var c in a.g)Ob(a,c,null!=b?b:a.g[c])}function Pb(a,b,c){if(a=a.G[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function Mb(a){for(var b in a.f)Pb(a,b,a.f[b][1])}function Qb(a,b,c,d){a.G[b]&&(void 0===c&&(zb(a,"Value for "+b+" is invalid"),a.b.da()),c=8==(a.j&&a.j.ca||8)?na(c,d):p(c,d),a.G[b].textContent!=c&&(a.G[b].textContent=c))}
function Gb(a,b){var c=a.f[b];Pb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.I="DEP"==b,a.K="EXAM"==b)}function Hb(a,b){var c=a.f[b];c[2]&&c[3]&&(Pb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}k.hd=function(a){a||this.b.A.W||(a=this.b,a.v.reset(),Rb(a),Fb(this,"ENABLE")&&this.b.jb())};k.jd=function(){};k.dd=function(a){a||this.b.da()};
k.bd=function(a){if(!a&&!this.b.A.W)if(Fb(this,"ENABLE"))this.b.jb();else{if((a=this.j)&&!wb(a,!0))vb(a,!0),a.kb(0,null),vb(a,!1);else try{var b=this.b.kb(1);0<b&&(Sb(this.b,b),Tb(this.b,b,!0),Ub(this.b,b))}catch(c){"number"!=typeof c&&zb(this.b,c.stack||c.message)}this.stop();this.C&&this.C.sa()}};k.cd=function(a){a&&!this.b.A.W&&(this.I&&hc(this),a=ic(this,this.Ya),this.L==Eb?this.v.Fb(this.va,a):this.b.Fb(this.va,a))};
k.ed=function(a){a||this.b.A.W||(this.K&&hc(this),a=this.L==Eb?this.v.fb(this.va):this.b.fb(this.va),ic(this,a))};k.gd=function(a){a||this.b.A.W||jc(this,this.Ya)};k.fd=function(a){a?(this.H=!0,Lb(this,!0)):(this.H=!1,Lb(this),kc(this,0))};k.kd=function(a,b){this.Ya=a?this.Ya|1<<b:this.Ya&~(1<<b)};function hc(a){var b=1145>a.b.Xa?8:16,c=65472<=a.va&&a.va<65472+b,b=c?1:2,c=c?15:a.v.Qa;Fb(a,"STEP")||(b=-b);jc(a,a.va&~c|a.va+b&c)}
function jc(a,b){a.va=b&a.v.Qa;b=a.va;for(var c=0;22>c;c++)lc(a,"A"+c,b&1<<c)}function ic(a,b){a.w=b&65535;b=a.w;for(var c=0;16>c;c++)lc(a,"D"+c,b&1<<c);return a.w}function lc(a,b,c){a.g[b]=c;a.H||Ob(a,b,c)}function mc(a){return void 0!==a.G.S0}function kc(a,b){if(mc(a)){a.Ya=b;for(var c=0;22>c;c++)a.f["S"+c][1]=b&1<<c?1:0;Mb(a)}}k.stop=function(){jc(this,this.b.u[7])};k.nc=function(a){this.va=a};k.setData=function(a,b){b?this.rb=a:this.w=a};k.nd=function(a,b){return(b?this.rb:this.Ya)&65535};
k.he=function(a){this.rb=a};var nc={},Jb=(nc[65400]=[null,null,Db.prototype.nd,Db.prototype.he,"CNSW"],nc);function Nb(){for(var a=!1,b=D(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=A(d),f=tb(e.id);f||(a=!0,f=new Db(e));B(f,d);a&&H(f)}}$a(Nb);
function oc(a,b,c){t.call(this,"Bus",a,oc,64);this.b=b;this.j=c;this.K=a.busWidth||16;this.C=0;this.w=[];this.g=null;this.H=1<<this.K;this.Qa=this.H-1;this.Ca=pc;this.ka=Math.log2(this.Ca);this.I=this.Ca>>2;this.v=this.Ca-1;this.D=this.H/this.Ca|0;this.cb=[];this.na=0;this.f=!1;this.gc=0;this.B=[];this.Qc=[qc,rc,sc,tc];a=new I(this);uc(a,this.j);this.Y=Array(this.D);for(b=0;b<this.D;b++)this.Y[b]=a;H(this)}z(oc);var pc=8192,vc=pc-1;
function qc(a,b){var c=-1,d=this.controller,e=d.cb[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.cb[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return this.j&&F(this.j,e[5])&&E(this.j,e[4]+".readByte("+J(this.j,b)+"): "+J(this.j,c),!0,!d.na),c;d.Ha(b,16,3);c=255;this.j&&F(this.j,64)&&E(this.j,"warning: unconverted read access to byte @"+J(this.j,b)+": "+J(this.j,c),!0,!d.na);return c}
function rc(a,b,c){var d=!1,e=this.controller,f=e.cb[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.cb[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d?this.j&&F(this.j,f[5])&&E(this.j,f[4]+".writeByte("+J(this.j,c)+","+J(this.j,b)+")",!0,!e.na):(e.Ha(c,16,5),this.j&&F(this.j,64)&&E(this.j,"warning: unconverted write access to byte @"+J(this.j,c)+": "+J(this.j,
b),!0,!e.na))}function sc(a,b){var c=-1,d=this.controller;a=d.cb[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return this.j&&F(this.j,a[5])&&E(this.j,a[4]+".readWord("+J(this.j,b)+"): "+J(this.j,c),!0,!d.na),c;d.Ha(b,16,2);c=65535;this.j&&F(this.j,64)&&E(this.j,"warning: unconverted read access to word @"+J(this.j,b)+": "+J(this.j,c),!0,!d.na);return c}
function tc(a,b,c){var d=!1,e=this.controller;a=e.cb[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d?this.j&&F(this.j,a[5])&&E(this.j,a[4]+".writeWord("+J(this.j,c)+","+J(this.j,b)+")",!0,!e.na):(e.Ha(c,16,4),this.j&&F(this.j,64)&&E(this.j,"warning: unconverted write access to word @"+J(this.j,c)+": "+J(this.j,b),!0,!e.na))}
function wc(a,b){if(b!=a.C){var c;a.C&&(c=(1<<a.C)-pc,xc(a,c,pc,a.w),a.C=0);b&&(a.C=b,c=1<<b,a.Qa=c-1,c-=pc,a.w=yc(a,c,pc),a.g?xc(a,c,pc,a.g):(zc(a,c,pc,Ac,a),a.g=yc(a,c,pc)))}}k=oc.prototype;k.reset=function(){for(var a=0;a<this.B.length;a++)this.B[a]();wc(this,16)};k.Ka=function(a,b){b||this.reset();return!0};
function zc(a,b,c,d,e){for(var f=b,g=c,h=f>>>a.ka;0<g&&h<a.Y.length;){var l=a.Y[h],m=h*a.Ca,n=a.Ca-(f-m);n>g&&(n=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.F)return l.Tb+=l.F-f,l.F=f,!0;if(f>=l.F+l.Tb){n=l.size-(f-m);n>g&&(n=g);l.Tb=f-l.F+n;f=m+a.Ca;g-=n;h++;continue}}return Bc(1,f,g)}f=new I(a,f,n,a.Ca,d,e);uc(f,a.j,l);a.Y[h++]=f;f=m+a.Ca;g-=n}return 0>=g?(d==Cc&&(a.gc+=c),a.status((c>>10)+"Kb "+Dc[d]+" at "+na(b)),!0):Bc(2,b,c)}
function yc(a,b,c){var d=[];for(b>>>=a.ka;0<c&&b<a.Y.length;)d.push(a.Y[b++]),c-=a.Ca;return d}function xc(a,b,c,d){var e=0;for(b>>>=a.ka;0<c&&b<a.Y.length;){var f=d[e++];if(!f)break;a.Y[b++]=f;c-=a.Ca}}k.Yb=function(a){3932160<=a&&(a=Ec(this.b,a));return this.Y[(a&this.Qa)>>>this.ka].$b(a&this.v,a)};k.Zb=function(a){3932160<=a&&(a=Ec(this.b,a));this.f=!1;this.na++;a=this.Y[(a&this.Qa)>>>this.ka].lc(a&this.v,a);this.na--;return a};
k.ma=function(a){3932160<=a&&(a=Ec(this.b,a));return this.Y[(a&this.Qa)>>>this.ka].ua(a&this.v,a)};k.fb=function(a){3932160<=a&&(a=Ec(this.b,a));var b=a&this.v,c=(a&this.Qa)>>>this.ka;this.f=!1;this.na++;a=this.Y[c].mc(b,a);this.na--;return a};k.Eb=function(a,b){3932160<=a&&(a=Ec(this.b,a));this.Y[(a&this.Qa)>>>this.ka].cc(a&this.v,b&255,a)};k.tb=function(a,b){3932160<=a&&(a=Ec(this.b,a));this.f=!1;this.na++;this.Y[(a&this.Qa)>>>this.ka].dc(a&this.v,b&255,a);this.na--};
k.ib=function(a,b){3932160<=a&&(a=Ec(this.b,a));this.Y[(a&this.Qa)>>>this.ka].Ub(a&this.v,b&65535,a)};k.Fb=function(a,b){3932160<=a&&(a=Ec(this.b,a));var c=a&this.v,d=(a&this.Qa)>>>this.ka;this.f=!1;this.na++;this.Y[d].pc(c,b&65535,a);this.na--};
function Fc(a){for(var b=0,c=[],d=0;d<a.D;d++){var e=a.Y[d];if(e.Wa||e.Vc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,h=0,l=[];g<e.length;){for(var m=e[g],n=g+1;n<e.length&&e[n]===m;)n++;l[h++]=n-g;l[h++]=m;g=n}l.length<e.length&&(e=l)}c[f]=e}}return c}function Gc(a,b,c,d,e,f,g,h,l){for(;b<=c;b+=2){var m=b&vc;if(void 0!==a.cb[m])return q("I/O address already registered: "+p(b,8,!0)),!1;a.cb[m]=[d,e,f,g,l||"unknown",h,!1]}return!0}
function Ib(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.b.Xa)){var g=f[0]?f[0].bind(b):null,h=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,m=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!h&&m&&(h=function(a){return function(b,c){return a(b,c)}.bind(b)}(m)));for(var n=f[4],v=f[5]||1,r=0;r<v;r++,e+=2)if(n&&1<v&&(n=f[4]+r),!Gc(a,e,e,g,h,l,m,f[7]||b.la||64,n||b.ab))return!1}}return!0}function Kb(a,b){a.B.push(b)}
k.Ha=function(a,b,c){this.f=!0;this.na||(this.j&&F(this.j,32)&&E(this.j,"memory fault ("+c+") on "+J(this.j,a),!0,!0),b&&(this.b.oa|=b),this.b.ra(4,0,a))};function Hc(a){var b=a.f;a.f=!1;return b}function Bc(a,b,c){q("Memory block error ("+a+": "+p(b)+","+p(c)+")");return!1}function K(a){t.call(this,"Device",a,K,1024);this.f={fa:0,oc:-1}}z(K);k=K.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.j=d;var e=this;this.f.oc=Ic(c,function(){e.f.Nb|=128;e.f.Nb&64&&Jc(e.b,e.f.fe);e.C&&e.C.sa(1);Kc(e.b,e.f.oc,1E3/60)});this.f.fe=Tc(64,6);Ib(b,this,Uc);Kb(b,this.reset.bind(this));d&&Vc(d,256,function(a){var b=e.b;L(e,"KIPDR",b.P[0],0,a[0]);L(e,"KDPDR",b.P[0],8,a[0]);L(e,"KIPAR",b.ha[0],0,a[0]);L(e,"KDPAR",b.ha[0],8,a[0],!0);L(e,"SIPDR",b.P[1],0,a[0]);L(e,"SDPDR",b.P[1],8,a[0]);L(e,"SIPAR",b.ha[1],0,a[0]);L(e,"SDPAR",b.ha[1],8,a[0],!0);L(e,"UIPDR",
b.P[3],0,a[0]);L(e,"UDPDR",b.P[3],8,a[0]);L(e,"UIPAR",b.ha[3],0,a[0]);L(e,"UDPAR",b.ha[3],8,a[0],!0)});H(this)};function L(a,b,c,d,e,f){a=a.j;if(!(e&&0>b.indexOf(e.toUpperCase()))){b+=":";for(e=0;8>e;e++)b+=" "+J(a,c[d+e]);a.i(b+(f?"\n":""))}}k.reset=function(){this.f.Nb=128;Kc(this.b,this.f.oc,1E3/60,!0)};k.vd=function(){return this.f.Nb};k.pe=function(a){this.f.Nb=a&192};k.xd=function(){return Wc(this.b)};k.re=function(a){Xc(this.b,a&-129|this.b.za&128)};k.yd=function(){return Yc(this.b)};
k.zd=function(){return Zc(this.b)};k.Ad=function(){return this.b.Ta};k.se=function(a){$c(this.b,a)};k.ae=function(a){a=a>>1&63;var b=this.b.Sb[a>>1];return a&1?b>>16:b&65535};k.Te=function(a,b){b=b>>1&63;var c=b>>1;this.b.Sb[c]=b&1?this.b.Sb[c]&65535|(a&63)<<16:this.b.Sb[c]&-65536|a&65534};k.Ud=function(a){return this.b.P[1][a>>1&7]};k.Me=function(a,b){this.b.P[1][b>>1&7]=a&65295};k.Sd=function(a){return this.b.P[1][(a>>1&7)+8]};k.Ke=function(a,b){this.b.P[1][(b>>1&7)+8]=a&65295};
k.Td=function(a){return this.b.ha[1][a>>1&7]};k.Le=function(a,b){b=b>>1&7;this.b.ha[1][b]=a;this.b.P[1][b]&=65295};k.Rd=function(a){return this.b.ha[1][(a>>1&7)+8]};k.Je=function(a,b){b=(b>>1&7)+8;this.b.ha[1][b]=a;this.b.P[1][b]&=65295};k.ud=function(a){return this.b.P[0][a>>1&7]};k.oe=function(a,b){b=b>>1&7;this.b.P[0][b]=a&=65295;F(this,256)&&E(this,"writeKIPDR["+b+"]: "+na(a),!0)};k.sd=function(a){return this.b.P[0][(a>>1&7)+8]};k.me=function(a,b){this.b.P[0][(b>>1&7)+8]=a&65295};
k.td=function(a){return this.b.ha[0][a>>1&7]};k.ne=function(a,b){b=b>>1&7;this.b.ha[0][b]=a;this.b.P[0][b]&=65295};k.rd=function(a){return this.b.ha[0][(a>>1&7)+8]};k.le=function(a,b){b=(b>>1&7)+8;this.b.ha[0][b]=a;this.b.P[0][b]&=65295};k.$d=function(a){return this.b.P[3][a>>1&7]};k.Se=function(a,b){this.b.P[3][b>>1&7]=a&65295};k.Yd=function(a){return this.b.P[3][(a>>1&7)+8]};k.Qe=function(a,b){this.b.P[3][(b>>1&7)+8]=a&65295};k.Zd=function(a){return this.b.ha[3][a>>1&7]};
k.Re=function(a,b){b=b>>1&7;this.b.ha[3][b]=a;this.b.P[3][b]&=65295};k.Xd=function(a){return this.b.ha[3][(a>>1&7)+8]};k.Pe=function(a,b){b=(b>>1&7)+8;this.b.ha[3][b]=a;this.b.P[3][b]&=65295};k.Cb=function(a){a&=7;return this.b.N&2048?this.b.Za[a]:this.b.u[a]};k.Gb=function(a,b){b&=7;this.b.N&2048?this.b.Za[b]=a:this.b.u[b]=a};k.Fd=function(){return this.b.N&49152?this.b.La[0]:this.b.u[6]};k.xe=function(a){this.b.N&49152?this.b.La[0]=a:this.b.u[6]=a};k.Id=function(){return this.b.u[7]};
k.Ae=function(a){this.b.u[7]=a};k.Db=function(a){a&=7;return this.b.N&2048?this.b.u[a]:this.b.Za[a]};k.Hb=function(a,b){b&=7;this.b.N&2048?this.b.u[b]=a:this.b.Za[b]=a};k.Gd=function(){return 1==(this.b.N&49152)>>14?this.b.u[6]:this.b.La[1]};k.ye=function(a){1==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.La[1]=a};k.Hd=function(){return 3==(this.b.N&49152)>>14?this.b.u[6]:this.b.La[3]};k.ze=function(a){3==(this.b.N&49152)>>14?this.b.u[6]=a:this.b.La[3]=a};k.pd=function(a){return this.b.Jc[a-65504>>1]};
k.je=function(a,b){this.b.Jc[b-65504>>1]=a};k.Gc=function(a){if(65520==a){a=0;switch(Cc){case Cc:a=this.v.gc}a=(a>>6)-1}else a=0;return a};k.Nc=function(){};k.Wd=function(){return 1};k.Oe=function(){};k.od=function(){return this.b.oa};k.ie=function(){this.b.oa=0};k.wd=function(){return this.b.Ic};k.qe=function(a,b){b&1||(a&=255);this.b.Ic=a};k.Bd=function(a,b){return b?0:this.b.Rb};k.te=function(a){ad(this.b,a)};k.Vd=function(a,b){return b?0:this.b.sb&65280};k.Ne=function(a){this.b.sb=a|255};
k.Ed=function(){return bd(this.b)};k.we=function(a){cd(this.b,a&-1793|bd(this.b)&1792);this.b.J|=128};k.Mc=function(a,b){F(this)&&E(this,"writeIgnored("+na(b)+"): "+na(a),!0,!0)};
var M={},Uc=(M[61568]=[null,null,K.prototype.ae,K.prototype.Te,"UNIMAP",64,1170],M[62592]=[null,null,K.prototype.Ud,K.prototype.Me,"SIPDR",8,1145,256],M[62608]=[null,null,K.prototype.Sd,K.prototype.Ke,"SDPDR",8,1145,256],M[62624]=[null,null,K.prototype.Td,K.prototype.Le,"SIPAR",8,1145,256],M[62640]=[null,null,K.prototype.Rd,K.prototype.Je,"SDPAR",8,1145,256],M[62656]=[null,null,K.prototype.ud,K.prototype.oe,"KIPDR",8,1145,256],M[62672]=[null,null,K.prototype.sd,K.prototype.me,"KDPDR",8,1145,256],
M[62688]=[null,null,K.prototype.td,K.prototype.ne,"KIPAR",8,1145,256],M[62704]=[null,null,K.prototype.rd,K.prototype.le,"KDPAR",8,1145,256],M[62798]=[null,null,K.prototype.Ad,K.prototype.se,"MMR3",1,1145,256],M[65382]=[null,null,K.prototype.vd,K.prototype.pe,"LKS"],M[65402]=[null,null,K.prototype.xd,K.prototype.re,"MMR0",1,1145,256],M[65404]=[null,null,K.prototype.yd,K.prototype.Mc,"MMR1",1,1145,256],M[65406]=[null,null,K.prototype.zd,K.prototype.Mc,"MMR2",1,1145,256],M[65408]=[null,null,K.prototype.$d,
K.prototype.Se,"UIPDR",8,1145,256],M[65424]=[null,null,K.prototype.Yd,K.prototype.Qe,"UDPDR",8,1145,256],M[65440]=[null,null,K.prototype.Zd,K.prototype.Re,"UIPAR",8,1145,256],M[65456]=[null,null,K.prototype.Xd,K.prototype.Pe,"UDPAR",8,1145,256],M[65472]=[null,null,K.prototype.Cb,K.prototype.Gb,"R0SET0"],M[65473]=[null,null,K.prototype.Cb,K.prototype.Gb,"R1SET0"],M[65474]=[null,null,K.prototype.Cb,K.prototype.Gb,"R2SET0"],M[65475]=[null,null,K.prototype.Cb,K.prototype.Gb,"R3SET0"],M[65476]=[null,null,
K.prototype.Cb,K.prototype.Gb,"R4SET0"],M[65477]=[null,null,K.prototype.Cb,K.prototype.Gb,"R5SET0"],M[65478]=[null,null,K.prototype.Fd,K.prototype.xe,"R6KERNEL"],M[65479]=[null,null,K.prototype.Id,K.prototype.Ae,"R7KERNEL"],M[65480]=[null,null,K.prototype.Db,K.prototype.Hb,"R0SET1",1,1145],M[65481]=[null,null,K.prototype.Db,K.prototype.Hb,"R1SET1",1,1145],M[65482]=[null,null,K.prototype.Db,K.prototype.Hb,"R2SET1",1,1145],M[65483]=[null,null,K.prototype.Db,K.prototype.Hb,"R3SET1",1,1145],M[65484]=
[null,null,K.prototype.Db,K.prototype.Hb,"R4SET1",1,1145],M[65485]=[null,null,K.prototype.Db,K.prototype.Hb,"R5SET1",1,1145],M[65486]=[null,null,K.prototype.Gd,K.prototype.ye,"R6SUPER",1,1145],M[65487]=[null,null,K.prototype.Hd,K.prototype.ze,"R6USER",1,1145],M[65504]=[null,null,K.prototype.pd,K.prototype.je,"CTRL",8,1170],M[65520]=[null,null,K.prototype.Gc,K.prototype.Nc,"LSIZE",1,1170],M[65522]=[null,null,K.prototype.Gc,K.prototype.Nc,"HSIZE",1,1170],M[65524]=[null,null,K.prototype.Wd,K.prototype.Oe,
"SYSID",1,1170],M[65526]=[null,null,K.prototype.od,K.prototype.ie,"CPUERR",1,1170],M[65528]=[null,null,K.prototype.wd,K.prototype.qe,"MB",1,1170],M[65530]=[null,null,K.prototype.Bd,K.prototype.te,"PIR"],M[65532]=[null,null,K.prototype.Vd,K.prototype.Ne,"SL"],M[65534]=[null,null,K.prototype.Ed,K.prototype.we,"PSW"],M);
$a(function(){for(var a=D(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=A(d);switch(c.type){case "default":c=new K(c);B(c,d);break;case "pc11":c=new dd(c);B(c,d);break;case "rl11":c=new N(c),B(c,d)}}});var ed;if(Ab){var fd=new ArrayBuffer(2);(new DataView(fd)).setUint16(0,256,!0);ed=256===(new Uint16Array(fd))[0]}else ed=!1;var gd=ed;
function I(a,b,c,d,e,f){this.v=a;this.id=hd+=2;this.b=null;this.F=b;this.Tb=c;this.size=d||0;this.type=e||id;this.f=e==jd;this.controller=null;uc(this);this.Wa=this.Vc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.b=a[0],kd(this,f.Qc);else if(Ab)this.B=new ArrayBuffer(this.size),this.D=new DataView(this.B,0,this.size),this.G=new Uint8Array(this.B,0,this.size),this.I=new Uint16Array(this.B,0,this.size>>1),this.b=new Int32Array(this.B,0,this.size>>2),kd(this,gd?ld:md);else{a=this.b=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;kd(this,nd)}else kd(this)}var id=0,Cc=1,jd=2,Ac=4,Dc=["NONE","RAM","ROM","VID","H/W"],hd=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Ab)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.D.getInt32(b<<2,!0);else a=this.b;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Ab)for(b=0;b<a.length;b++)this.D.setInt32(b<<2,a[b],!0);else this.b=a;return this.Wa=!0}return!1},ob:function(a,b){b?this.C++||od(this,pd,!1):this.g++||qd(this,pd,!1)},K:function(a,b){this.j&&F(this.j,128)&&E(this.j,
"attempt to read invalid address "+J(this.j,b),!0);this.v.Ha(b,32,2);return 255},w:function(a,b,c){this.j&&F(this.j,128)&&E(this.j,"attempt to write "+J(this.j,b)+" to invalid addresses "+J(this.j,c),!0);this.v.Ha(c,32,4)},L:function(a,b){return this.$b(a++,b++)|this.$b(a,b)<<8},H:function(a,b,c){this.cc(a++,b&255,c++);this.cc(a,b>>8,c)},T:function(a){return this.b[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&this.v.Ha(b,64,2);b=a>>2;a=(a&3)<<3;var c=this.b[b]>>a;return 24>a?c&65535:c&255|(this.b[b+
1]&255)<<8},xa:function(a,b){var c=a>>2;a=(a&3)<<3;this.b[c]=this.b[c]&~(255<<a)|b<<a;this.Wa=!0},Ma:function(a,b,c){a&1&&this.v.Ha(c,64,4);c=a>>2;a=(a&3)<<3;24>a?this.b[c]=this.b[c]&~(65535<<a)|b<<a:(this.b[c]=this.b[c]&16777215|b<<24,c++,this.b[c]=this.b[c]&-256|b>>8);this.Wa=!0},O:function(a,b){if(this.j&&null!=this.F){var c=this.j;rd(c,this.F+a,1,c.M)&&c.da(!0)}return this.lc(a,b)},Ua:function(a,b){if(this.j&&null!=this.F){var c=this.j;rd(c,this.F+a,2,c.M)&&c.da(!0)}return this.mc(a,b)},ab:function(a,
b,c){if(this.j&&null!=this.F){var d=this.j;rd(d,this.F+a,1,d.D)&&d.da(!0)}this.f?this.w(a,b,c):this.dc(a,b,c)},Ba:function(a,b,c){if(this.j&&null!=this.F){var d=this.j;rd(d,this.F+a,2,d.D)&&d.da(!0)}this.f?this.w(a,b,c):this.pc(a,b,c)},M:function(a){return this.G[a]},S:function(a,b){a=this.G[a];this.j&&F(this.j,128)&&E(this.j,"Memory.readByte("+J(this.j,b)+"): "+J(this.j,a),!0);return a},X:function(a,b){a&1&&this.v.Ha(b,64,2);return this.D.getUint16(a,!0)},ba:function(a,b){a&1&&this.v.Ha(b,64,2);
a=this.I[a>>1];this.j&&F(this.j,128)&&E(this.j,"Memory.readWord("+J(this.j,b)+"): "+J(this.j,a),!0);return a},ja:function(a,b){this.G[a]=b;this.Wa=!0},pa:function(a,b,c){this.G[a]=b;this.Wa=!0;this.j&&F(this.j,128)&&E(this.j,"Memory.writeByte("+J(this.j,c)+","+J(this.j,b)+")",!0)},Aa:function(a,b,c){a&1&&this.v.Ha(c,64,4);this.D.setUint16(a,b,!0);this.Wa=!0},Ea:function(a,b,c){a&1&&this.v.Ha(c,64,4);this.I[a>>1]=b;this.Wa=!0;this.j&&F(this.j,128)&&E(this.j,"Memory.writeWord("+J(this.j,c)+","+J(this.j,
b)+")",!0)}};function uc(a,b,c){a.j=b;a.g=a.C=0;c&&((a.g=c.g)&&qd(a,pd,!1),(a.C=c.C)&&od(a,pd,!1))}function sd(a,b){b?--a.C||(a.cc=a.f?a.w:a.dc,a.Ub=a.f?a.H:a.pc):--a.g||(a.$b=a.lc,a.ua=a.mc)}function od(a,b,c){c&&a.C||(a.cc=!a.f&&b[1]||a.w,a.Ub=!a.f&&b[3]||a.H);if(c||void 0===c)a.dc=b[1]||a.w,a.pc=b[3]||a.H}function qd(a,b,c){c&&a.g||(a.$b=b[0]||a.K,a.ua=b[2]||a.L);if(c||void 0===c)a.lc=b[0]||a.K,a.mc=b[2]||a.L}function kd(a,b){b||(b=td);qd(a,b,void 0);od(a,b,void 0)}
var td=[],nd=[I.prototype.T,I.prototype.xa,I.prototype.ca,I.prototype.Ma],pd=[I.prototype.O,I.prototype.ab,I.prototype.Ua,I.prototype.Ba];if(Ab)var md=[I.prototype.M,I.prototype.ja,I.prototype.X,I.prototype.Aa],ld=[I.prototype.S,I.prototype.pa,I.prototype.ba,I.prototype.Ea];
function ud(a,b){t.call(this,"CPU",a,ud,1);b=a.cycles||b;var c=a.multiplier||1;this.wb=0;this.nb=b;this.gb=c;this.Ib=Math.round(this.nb/1E4)/100;this.qb=this.Ib*this.gb;this.A.W=!1;this.A.bc=!1;this.A.vb=a.autoStart;this.A.xb=!1;this.Ob=this.xa=0;this.Pb=a.csStart;this.zb=a.csInterval;this.Ab=a.csStop;this.L=[];this.Fc=this.ee.bind(this);H(this)}z(ud);var vd=["power","reset"];k=ud.prototype;
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.j=d;this.w=a.w;for(b=0;b<vd.length;b++)(c=this.G[vd[b]])&&this.C.wa(null,vd[b],c);a=wd(a,"autoStart");null!=a&&(this.A.vb="true"==a?!0:"false"==a?!1:!!a);H(this)};k.reset=function(){};k.save=function(){return null};k.restore=function(){return!1};
k.Ka=function(a,b){if(!b){if(a&&this.restore){xd(this);if(!this.restore(a))return!1;yd(this)}else this.reset();this.j?(a=this.j,b=this.A.vb,a.lb=!0,a.i("Type ? for help with PDPjs Debugger commands"),zd(a),b||a.ub(),a.bb&&(b=a.bb,a.bb=null,Ad(a,b))):this.i("No debugger detected")}return!0};k.Ja=function(a){return a?this.save():!0};k.vb=function(){return this.A.vb||!this.j&&void 0===this.G.run?(this.jb(),!0):!1};k.vc=function(){return 0};
function yd(a){void 0===a.Pb&&(a.Pb=0);void 0===a.zb&&(a.zb=-1);void 0===a.Ab&&(a.Ab=-1);a.A.xb=0<=a.Pb&&0<a.zb;a.A.xb&&(a.Ob=0,a.xa=a.Pb-a.ja)}function Ub(a,b){if(a.A.xb){var c=!1;a.Ob=a.Ob+a.vc()|0;a.xa-=b;0>=a.xa&&(a.xa+=a.zb,c=!0);0<=a.Ab&&a.Ab<=Bd(a)&&(a.zb=a.Ab=-1,yd(a),a.da(),c=!0);c&&a.i(Bd(a)+" cycles: checksum="+p(a.Ob))}}
k.wa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.G[b]=c,!0;case "run":return this.G[b]=c,c.onclick=function(){var a;if(a=d.C)if(a=d.C,a.A.ia)a=!0;else{var b=null,c,h=sb(a.id);for(c=0;c<h.length&&(b=h[c],b===a||b.A.ready);c++);if(c==h.length)for(c=0;c<h.length&&(b=h[c],b===a||b.A.ia);c++);c==h.length&&(b=a);q("The "+b.type+" component ("+b.id+") is not "+(b.A.ready?"powered yet":"ready yet"+(b.Xb?" (waiting for notification)":""))+".");a=!1}a&&(d.A.W?d.da():d.jb())},
!0;case "speed":return this.G[b]=c,!0;case "setSpeed":return this.G[b]=c,c.onclick=function(){Cd(d,d.gb<<1,!0)},c.textContent=this.qb.toFixed(2)+"Mhz",!0}return!1};k.sa=function(a){this.C&&this.C.sa(a)};function Tb(a,b,c){a.ja+=b;c&&(a.ca=a.b=a.I=0)}function Dd(a,b){var c=1;b&&1<a.gb&&a.pa&&(c=a.pa/a.Ib);a.Cc=Math.round(1E3/30);a.pb=Math.floor(a.nb/30*c);b||(a.Aa=a.pb);a.Jb=0}function Bd(a){return a.ja+a.X+a.ca-a.b}function xd(a){a.pa=0;a.Dc=0;a.ja=a.X=a.ca=a.b=a.I=0;yd(a);Cd(a,1)}
function Cd(a,b,c){var d=!1;if(void 0!==b){.8>a.pa/a.qb?b=1:d=!0;a.gb=b;b=a.Ib*a.gb;if(a.qb!=b){a.qb=b;b=a.qb.toFixed(2)+"Mhz";var e=a.G.setSpeed;e&&(e.textContent=b);a.i("target speed: "+b)}c&&a.C&&a.C.ub()}Tb(a,a.X);a.X=0;a.T=Ba();a.ba=0;Dd(a);return d}function Ic(a,b){var c=a.L.length;a.L.push([-1,b]);return c}function Kc(a,b,c,d){0<=b&&b<a.L.length&&(d||0>a.L[b][0])&&(c=a.nb*a.gb/1E3*c|0,a.A.W&&(c+=Ed(a)),a.L[b][0]=c)}
function Fd(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||b>d[0]&&(b=d[0])}return b}function Sb(a,b){for(var c=a.L.length-1;0<=c;c--){var d=a.L[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Ed(a,b){var c=a.ca-=a.b;a.b=a.I=0;b&&(a.ca=0);return c}
k.ee=function(){if(this.A.W){this.Jb>=this.nb&&Dd(this,!0);this.Ma=0;this.lb=Ba();if(this.ba){var a=this.lb-this.ba;a>this.Cc&&(this.T+=a,this.T>this.lb&&(this.T=this.lb))}try{do{var b=Fd(this,this.A.xb?1:this.pb);try{this.kb(b)}catch(e){if("number"!=typeof e)throw e;}b=Ed(this,!0);this.Ma+=b;this.X+=b;Ub(this,b);Sb(this,b);this.Aa-=b;if(0>=this.Aa){this.Aa+=this.pb;15<=++this.Dc&&(this.sa(),this.Dc=0);break}}while(this.A.W)}catch(e){this.da();this.C&&this.C.stop(Ba(),Bd(this));zb(this,e.stack||e.message);
return}if(this.A.W){a=setTimeout;b=this.Fc;this.ba=Ba();var c=this.Cc;this.Ma&&(c=Math.round(c*this.Ma/this.pb));var c=c-(this.ba-this.lb),d=this.ba-this.T;d&&(this.pa=Math.round(this.X/(10*d))/100,864E5<=d&&(this.ja=0,Cd(this)));if(0>c||this.pa<this.qb)-1E3>c&&(this.T-=c),c=0;this.Jb+=this.Ma;this.ba+=c;a(b,c)}}};
k.jb=function(a){if(yb(this))return!1;if(this.A.W)return this.i(this.toString()+" busy"),!1;Cd(this);this.A.W=!0;this.A.bc=!0;var b=this.G.run;b&&(b.textContent="Halt");this.C&&(a&&this.C.ub(!0),this.C.start(this.T,Bd(this)));setTimeout(this.Fc,0);return!0};k.kb=function(){return 0};k.da=function(a){var b=!1;if(this.A.W){Ed(this);Tb(this,this.X);this.X=0;this.A.W=!1;if(b=this.G.run)b.textContent="Run";this.C&&this.C.stop(Ba(),Bd(this));b=!0}this.A.complete=a;return b};
function Gd(a){this.Xa=+a.model||1170;this.Ac=a.addrReset||0;ud.call(this,a,6666667);this.decode=1120==this.Xa?Hd.bind(this):Id.bind(this);Jd(this);this.K=0;this.O=null;this.A.complete=!1}z(Gd,ud);k=Gd.prototype;k.reset=function(){this.status("model "+this.Xa);this.A.W&&this.da();Jd(this);xd(this);this.A.error=!1;this.parent.reset.call(this)};
function Jd(a){a.U=65536;a.V=32768;a.$=65535;a.Z=32768;a.N=15;a.u=[0,0,0,0,0,0,0,a.Ac];a.Za=[0,0,0,0,0,0];a.La=[0,0,0,0];a.B=0;a.mb=0;a.$c=[4,2,0,1];a.P=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ha=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Sb=
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.Jc=[0,0,0,0,0,0,0,0];a.Ic=0;a.J=0;a.D=a.H=0;a.g=a.f=a.yb=0;a.Ba=-1;Rb(a)}function Rb(a){a.za=0;a.Kb=0;a.Lb=0;a.Ta=0;a.oa=0;a.Rb=0;a.sb=255;a.M=0;a.bb=0;a.Ea=262143;a.Mb=0;a.qa=0;a.O=null;a.v&&Kd(a)}function Kd(a){a.M?(a.S=65536,a.yc=a.Ta&16?4186112:253952,a.aa=a.Yc,a.ua=a.be,a.Ub=a.Ue,wc(a.v,a.Ta&16?22:18)):(a.S=0,a.yc=57344,a.aa=a.Xc,a.ua=a.Hc,a.Ub=a.Oc,wc(a.v,16))}
function Wc(a){var b=a.za;b&57344||(b=b&-3199|a.bb<<5|a.mb<<1);return b}function Xc(a,b){b&=-3073;if(a.za!=b){b&57344&&!(a.za&57344)&&(a.Kb=a.qa>>16&65535,a.Lb=a.qa&65535);a.za=b;a.bb=b>>5&3;a.mb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.M!=c&&(a.M=c,Kd(a))}}function Yc(a){a.za&57344||(a.Kb=a.qa>>16&65535);a=a.Kb;a&65280&&(a=(a<<8|a>>8)&65535);return a}function Zc(a){a.za&57344||(a.Lb=a.qa&65535);return a.Lb}function $c(a,b){1170>a.Xa&&(b&=-49);a.Ta!=b&&(a.Ta=b,a.Ea=b&16?4194303:262143,Kd(a))}
k.vc=function(){return 0};k.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.ja,this.gb]);a.set(2,Fc(this.v));return a.data()};k.restore=function(a){var b=a[1];this.ja=b[1];Cd(this,b[3]);a:{b=this.v;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.I){for(var f=0,g=Array(b.I),h=0;h<e.length-1;)for(var l=e[h++],m=e[h++];l--;)g[f++]=m;e=g}f=b.Y[d];if(!f||!f.restore(e)){q("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};
function Ld(a){return a.U&65536?1:0}function Md(a){return a.V&32768?2:0}function Nd(a){return a.$&65535?0:4}function Od(a){return a.Z&32768?8:0}function Pd(a){var b=a.u[7];a.qa=b;var c=a.ua(b);a.u[7]=b+2&65535;return c}function Qd(a,b){var c=a.u[7];a.u[7]=c+b&65535;return c}function Q(a,b){a.u[7]=b&65535}function Tc(a,b){return{ge:a,Bb:b,next:null}}function Rd(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}
function Jc(a,b){if(b!=a.O){var c=a.O;if(!c||c.Bb<=b.Bb)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Bb<=b.Bb){b.next=d;c.next=b;break}c=d}while(c)}}a.J|=1}function me(a){return a.J&64?(a.ra(168,64,-5),!0):a.J&32?(a.ra(4,32,-4),!0):a.J&16?(a.ra(12,16,-6),!0):!1}function bd(a){return a.N=a.N&63728|Od(a)|Nd(a)|Md(a)|Ld(a)}
function cd(a,b){a.Z=b<<12;a.$=~b&4;a.V=b<<14;a.U=b<<16;if((b^a.N)&2048)for(var c=a.Za.length;0<=--c;){var d=a.u[c];a.u[c]=a.Za[c];a.Za[c]=d}a.B=b>>14&3;c=a.N>>14&3;a.B!=c&&(a.La[c]=a.u[6],a.u[6]=a.La[a.B]);a.N=b;a.J|=2}function ad(a,b){if(b&=65024){var c=b>>9;do b+=34;while(c>>=1)}a.Rb=b;a.J|=2}function R(a,b){a.J&128||(a.Z=a.$=b,a.V=0)}function ne(a,b,c){a.J&128||(a.Z=a.$=a.U=b,a.V=c||0)}function oe(a,b,c,d){a.J&128||(a.Z=a.$=a.U=b,a.V=(c^b)&(d^b))}
function pe(a,b){a.J&128||(a.Z=a.$=a.U=b,a.V=a.Z^a.U>>1)}function qe(a,b,c,d){a.J&128||(a.Z=a.$=a.U=b,a.V=(c^d)&(d^b))}k.ra=function(a,b,c){if(!this.K){0>this.Ba?this.Ba=bd(this):this.B||(a=4,this.oa|=4,this.u[6]=4,c=-3);this.qa=a|4143316992;this.B=0;var d=this.ua(a|this.S),e=this.ua(a+2&65535|this.S);cd(this,e&-12289|this.Ba>>2&12288);re(this,this.Ba);re(this,this.u[7]);Q(this,d);this.J&=~(b|18);this.J|=9;this.Ba=-1;this.md=a;this.ld=c;if(-3<=c)throw a;}};
function se(a){var b=te(a),c=te(a)&-1793;a.N&49152&&(c=c&-225|a.N&63712);Q(a,b);cd(a,c);a.J&=-17}function Ec(a,b){var c=b>>13&31;31>c&&(b=a.Ta&32?a.Sb[c]+(b&8190)&4194302:b&-3932161);return b}
function ue(a,b,c){var d,e,f;if(!(c&a.M))return f=b&65535,57344<=f&&(f|=a.yc),f;d=b>>13;a.Ta&a.$c[a.B]||(d&=7);e=a.P[a.B][d];f=(a.ha[a.B][d]<<6)+(b&8191)&a.Ea;if(a.K)return f;f&1&&!(c&1)&&(a.oa|=64,a.ra(4,0,f));var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.P[a.B][d]=e;if(f!=(4194170&a.Ea)||a.B)a.bb=
a.B,a.mb=d;g&&(g&57344&&(0<=a.Ba&&(g|=128),a.za&57344||(g|=a.za&4096|a.bb<<5|a.mb<<1,Xc(a,a.za&-61695|g&61694)),a.ra(168,64,-1)),a.za&61440||!(f<(4191360&a.Ea)||f>(4194239&a.Ea))||(a.za|=4096,a.za&512&&(a.J|=64)));return f}function ve(a,b){return a.v.Yb(b)}function te(a){var b=a.ua(a.u[6]|a.S);a.u[6]=a.u[6]+2&65535;return b}function re(a,b){var c=a.u[6]-2&65535;a.u[6]=c;a.qa=a.qa&65535|(a.qa&-65536)<<8|16121856;we(a,0,c);a.Ub(c,b)}
function we(a,b,c){!a.B&&c<=a.sb&&(b||4<c)&&(1145<=a.Xa&&c<=a.sb-32?(a.oa|=4,a.u[6]=4,a.ra(4,0,-3)):(a.oa|=8,a.J|=32))}
function xe(a,b,c,d){var e,f,g=d&8?0:a.S;switch(b){case 0:return a.ra(4,0,-2),0;case 1:return 6==c&&d&4&&we(a,b,a.u[6]),a.b-=3,7==c?a.u[c]:a.u[c]|g;case 2:f=2;e=a.u[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.b-=3;break;case 3:f=2;e=a.u[c];7!=c&&(e|=g);e=a.ua(e);e|=g;a.b-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.u[c]+f&65535;7!=c&&(e|=g);a.b-=4;break;case 5:f=-2;e=a.u[c]-2&65535;7!=c&&(e|=g);e=a.ua(e)|g;a.b-=8;break;case 6:return e=a.ua(Qd(a,2)),e=e+a.u[c]&65535|g,a.b-=6,e;case 7:return e=a.ua(Qd(a,2)),e=e+
a.u[c]&65535,e=a.ua(e|a.S)|g,a.b-=10,e}a.u[c]=a.u[c]+f&65535;a.qa=a.qa&65535|(a.qa&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&we(a,b,a.u[6]);return e}k.Zb=function(a){if(!this.M)return this.v.Zb(a);this.K++;a=ve(this,ue(this,a,3));this.K--;return a};k.fb=function(a){if(!this.M)return this.v.fb(a);this.K++;a=this.Hc(ue(this,a,2));this.K--;return a};k.tb=function(a,b){this.M?(this.K++,a=ue(this,a,5),a&1&&this.b--,this.v.Eb(a,b),this.K--):this.v.tb(a,b)};
k.Fb=function(a,b){this.M?(this.K++,this.Oc(ue(this,a,4),b),this.K--):this.v.Fb(a,b)};k.Xc=function(a,b,c){return xe(this,a,b,c)};k.Yc=function(a,b,c){return ue(this,xe(this,a,b,c),c)};k.Hc=function(a){return this.v.ma(this.Mb=a)};k.be=function(a){return this.v.ma(this.Mb=ue(this,a,2))};k.Oc=function(a,b){this.v.ib(this.Mb=a,b&65535)};k.Ue=function(a,b){this.v.ib(this.Mb=ue(this,a,4),b)};
function ye(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=xe(a,b,d,2),c&65536||61440!==(a.N&61440)&&(d&=65535),a.B=a.N>>12&3,c=a.ua(d|c&a.S),a.B=a.N>>14&3):c=6!=d||(a.N>>2&12288)===(a.N&12288)?a.u[d]:a.La[a.N>>12&3];return c}function ze(a,b,c,d){a.qa=a.qa&65535|1441792;var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=xe(a,b,e,4),c&65536||(e&=65535),a.B=a.N>>12&3,e=ue(a,e|c&65536,4),a.B=a.N>>14&3,a.v.ib(e,d)):6!=e||(a.N>>2&12288)===(a.N&12288)?a.u[e]=d:a.La[a.N>>12&3]=d}
function Ae(a,b){b>>=6;var c=a.H=b&7;return(b=a.D=(b&56)>>3)?ve(a,a.aa(b,c,3)):-c-1}function Be(a,b){var c;b>>=6;var d=a.H=b&7;(b=a.D=(b&56)>>3)?c=a.v.ma(a.aa(b,d,2)):c=-d-1;return c}function Ce(a,b){var c=a.f=b&7;b=a.g=(b&56)>>3;return xe(a,b,c,8)}function De(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?ve(a,a.aa(b,c,3)):a.u[c]&255}function Ee(a,b){var c=a.f=b&7;return(b=a.g=(b&56)>>3)?a.v.ma(a.aa(b,c,2)):a.u[c]}
function S(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.yb=a.aa(b,e,7),c=0>c?a.u[-c-1]&255:c,c=d.call(a,c,ve(a,e)),e&1&&a.b--,a.v.Eb(e,c)):(b=a.u[e],c=0>c?a.u[-c-1]&255:c,a.u[e]=b&65280|d.call(a,c,b&255))}function T(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(e=a.aa(b,e,6),a.v.ib(e,d.call(a,0>c?a.u[-c-1]:c,a.v.ma(e)))):a.u[e]=d.call(a,0>c?a.u[-c-1]:c,a.u[e])}
function Fe(a,b,c,d){var e=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,e,5),e=c=0>c?a.u[-c-1]&255:c,d&1&&a.b--,a.v.Eb(d,e)):c?(c=0>c?a.u[-c-1]&255:c,a.u[e]=a.u[e]&~d|c<<24>>24&d):a.u[e]&=~d;return c}function Ge(a,b,c){var d=a.f=b&7;(b=a.g=(b&56)>>3)?(d=a.aa(b,d,4),a.v.ib(d,c=0>c?a.u[-c-1]:c)):a.u[d]=c=0>c?a.u[-c-1]:c;return c}function U(a,b,c){c&&(Q(a,a.u[7]+(b<<24>>23)),a.b-=2);a.b-=3}
k.kb=function(a){this.A.complete=!0;var b=this.j?He(this.j)?1:this.A.bc?-1:0:0,c=a?this.A.bc?0:1:-1;this.A.bc=!1;this.ca=this.b=a;do{if(b){if(Ie(this.j,this.u[7],c)){this.da();break}c||c++;b++}if(this.J){if(a=this.J&7)if(a=!1,this.J&2){this.J&=-3;var d=160,e=(this.Rb&224)>>5,f=this.O&&this.O.Bb>e?this.O:null;f&&(d=f.ge,e=f.Bb);e>(this.N&224)>>5?(this.J&4&&(Qd(this,2),this.J&=-5),this.ra(d,0,-9),e=!0):e=!1;e&&(f&&Rd(this,f),a=!0)}else this.J&1&&this.J++;if(a){if(b&&Ie(this.j,this.u[7],c)){this.da();
break}if(0>c)break}if(this.J&112&&me(this)){if(b&&Ie(this.j,this.u[7],c)){this.da();break}if(0>c)break}}this.J=this.J&7|this.N&16;this.decode(Pd(this))}while(0<this.b);return this.A.complete?this.ca-this.b:void 0===this.A.complete?0:-1};$a(function(){for(var a=D(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Gd(d);B(d,c)}});function Je(a,b){var c=b+a;oe(this,c,a,b);return c&65535}function Ke(a,b){var c=b+a;oe(this,c<<8,a<<8,b<<8);return c&255}
function Le(a,b){a=b<<1;pe(this,a);return a&65535}function Me(a,b){a=b<<1;pe(this,a<<8);return a&255}function Ne(a,b){a=b&32768|b>>1|b<<16;pe(this,a);return a&65535}function Oe(a,b){a=b&128|b>>1|b<<8;pe(this,a<<8);return a&255}function Pe(a,b){a=b&~a;R(this,a);return a}function Qe(a,b){a=b&~a;R(this,a<<8);return a}function Re(a,b){a|=b;R(this,a);return a}function Se(a,b){a|=b;R(this,a<<8);return a}function Te(a,b){a=~b|65536;ne(this,a);return a&65535}
function Ue(a,b){a=~b|256;ne(this,a<<8);return a&255}function Ve(a,b){a=b-a;this.J&128||(this.Z=this.$=a,this.V=b&(b^a));return a&65535}function We(a,b){a=b-a;var c=a<<8;b<<=8;this.J&128||(this.Z=this.$=c,this.V=b&(b^c));return a&255}function Xe(a,b){a=b+a;this.J&128||(this.Z=this.$=a,this.V=a&(b^a));return a&65535}function Ye(a,b){a=b+a;var c=a<<8;this.J&128||(this.Z=this.$=c,this.V=c&(b<<8^c));return a&255}function Ze(a,b){a=-b;ne(this,a,a&b&32768);return a&65535}
function $e(a,b){a=-b;ne(this,a<<8,(a&b&128)<<8);return a&255}function af(a,b){a=b<<1|this.U>>16&1;pe(this,a);return a&65535}function bf(a,b){a=b<<1|this.U>>16&1;pe(this,a<<8);return a&255}function cf(a,b){a=(this.U&65536|b)>>1|b<<16;pe(this,a);return a&65535}function df(a,b){a=((this.U&65536)>>8|b)>>1|b<<8;pe(this,a<<8);return a&255}function ef(a,b){var c=b-a;qe(this,c,a,b);return c&65535}function ff(a,b){var c=b-a;qe(this,c<<8,a<<8,b<<8);return c&255}
function gf(a,b){this.J&128||(this.Z=this.$=b&65280,this.V=this.U=0);return(b<<8|b>>8)&65535}function hf(a,b){a^=b;R(this,a);return a&65535}function jf(a){T(this,a,Be(this,a),Je);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function kf(a){var b=Ee(this,a);a=a>>6&7;var c=this.u[a];c&32768&&(c|=4294901760);this.U=this.V=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.U=c<<17-b,c>>=b;else if(b)if(16<b)this.V=c,c=0;else{this.U=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.V=32768)}this.u[a]=c&65535;this.Z=this.$=c;this.b-=(this.g?6:7)+b}
function lf(a){var b=Ee(this,a);a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.U=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.U=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.V=32768)):d=c;this.u[a]=d>>16&65535;this.u[a|1]=d&65535;this.Z=d>>16;this.$=d>>16|d;this.b-=(this.g?6:7)+b}function mf(a){U(this,a,!Ld(this))}function nf(a){U(this,a,Ld(this))}
function of(a){T(this,a,Be(this,a),Pe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function pf(a){S(this,a,Ae(this,a),Qe);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function qf(a){T(this,a,Be(this,a),Re);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function rf(a){S(this,a,Ae(this,a),Se);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}
function sf(a){var b=Be(this,a);a=Ee(this,a);R(this,(0>b?this.u[-b-1]:b)&a);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function tf(a){var b=Ae(this,a);a=De(this,a);R(this,((0>b?this.u[-b-1]&255:b)&a)<<8);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function uf(a){U(this,a,Nd(this))}function vf(a){U(this,a,!Od(this)==!Md(this))}function wf(a){U(this,a,!Nd(this)&&!Od(this)==!Md(this))}function xf(a){U(this,a,!Ld(this)&&!Nd(this))}
function yf(a){U(this,a,Nd(this)||!Od(this)!=!Md(this))}function zf(a){U(this,a,Ld(this)||Nd(this))}function Af(a){U(this,a,!Od(this)!=!Md(this))}function Bf(a){U(this,a,Od(this))}function Cf(a){U(this,a,!Nd(this))}function Df(a){U(this,a,!Od(this))}function Ef(){this.ra(12,0,-8);this.b-=5}function Ff(a){U(this,a,!0)}function Gf(a){U(this,a,!Md(this))}function Hf(a){U(this,a,Md(this))}function V(a){a&1&&(this.U=0);a&2&&(this.V=0);a&4&&(this.$=1);a&8&&(this.Z=0);this.b-=5}
function If(a){var b=Be(this,a);a=Ee(this,a);var c=(b=0>b?this.u[-b-1]:b)-a;qe(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}function Jf(a){var b=Ae(this,a);a=De(this,a);var c=(b=(0>b?this.u[-b-1]&255:b)<<8)-(a<<=8);qe(this,c,a,b);this.b-=this.g?4+(this.H&&6<=this.f?1:0):(this.D?4:3)+(7==this.f?2:0)}
function Kf(a){var b=Ee(this,a);if(b){a=a>>6&7;var c=this.u[a]<<16|this.u[a|1];this.U=this.V=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.u[a]=d&65535,this.u[a|1]=c-d*b&65535,this.$=d>>16|d,this.Z=d>>16):(this.V=32768,this.$=d>>15|d,this.Z=c>>16,-1===b&&65534===this.u[a]&&(this.u[a]=this.u[a|1]=1));this.b-=53}else this.$=this.Z=0,this.V=32768,this.U=65536,this.b-=7}function Lf(){this.ra(24,0,-8);this.b-=25}
function Mf(){this.N&49152?(this.oa|=128,this.ra(4,0,-7)):(this.w&&1120==this.Xa&&this.w.setData(this.u[0],!0),this.j?Nf(this.j):this.da());this.b-=7}function Of(){this.ra(16,0,-8);this.b-=25}var Pf=[0,7,7,10,7,11,9,13];function Qf(a){this.I=this.b;Q(this,Ce(this,a));this.b=this.I-Pf[this.g]}var Rf=[0,14,14,17,14,18,16,20];function Sf(a){this.I=this.b;var b=Ce(this,a);a=a>>6&7;re(this,this.u[a]);this.u[a]=this.u[7];Q(this,b);this.b=this.I-Rf[this.g]}
var Tf=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];function Uf(a){var b=Be(this,a);this.I=this.b;R(this,Ge(this,a,b));this.b=this.I-Tf[(this.D?8:0)+this.g]+(7!=this.f||this.g?0:2)}function Vf(a){var b=Ae(this,a);R(this,Fe(this,a,b,65535)<<8);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}var Wf=[7,13,13,17,14,18,17,21];
function Xf(a){var b=Ee(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.u[a];c&32768&&(c|=-65536);b=~~(b*c);this.u[a]=b>>16&65535;this.u[a|1]=b&65535;this.J&128||(this.Z=b>>16,this.$=this.Z|b,this.V=0,this.U=-32768>b||32767<b?65536:0);this.b-=23}function Yf(){this.b-=5}function Zf(){this.N&49152||(this.v.reset(),Rb(this),this.w&&this.w.setData(this.u[0],!0));this.b-=667}function $f(a){if(a&8)W.call(this,a);else{var b=te(this);a&=7;7==a?Q(this,b):(Q(this,this.u[a]),this.u[a]=b);this.b-=9}}
function ag(){se(this);this.b-=13}function bg(a){a&1&&(this.U=65536);a&2&&(this.V=32768);a&4&&(this.$=0);a&8&&(this.Z=32768);this.b-=5}function cg(a){var b=(a&448)>>6;if(this.u[b]=this.u[b]-1&65535)Q(this,this.u[7]-((a&63)<<1)),this.b+=1;this.b-=6}function dg(a){T(this,a,Be(this,a),ef);this.b-=this.g?9+(this.H&&6<=this.f?1:0):(this.D?5:3)+(7==this.f?2:0)}function eg(a){T(this,a,0,gf);this.b-=this.g?9:3+(7==this.f?2:0)}function fg(){this.ra(28,0,-8);this.b-=5}
function gg(){this.w&&(this.w.nc(this.u[7],!0),this.w.setData(this.u[0],!0));this.J|=4;Qd(this,-2);this.b-=3}function hg(a){T(this,a,this.u[a>>6&7],hf);this.b-=this.g?9:3+(7==this.f?2:0)}function W(a){var b;if(b=this.j)b=this.j,F(b,1)?(E(b,"undefined opcode "+J(b,a),!0,!0),b=Nf(b)):b=!1;b||this.ra(8,0,-8)}function Hd(a){ig[a>>12].call(this,a)}function jg(a){kg[a>>6&3].call(this,a)}function lg(a){mg[a>>6&3].call(this,a)}function ng(a){og[a>>6&3].call(this,a)}function pg(a){qg[a&15].call(this,a)}
function rg(a){sg[a&15].call(this,a)}function tg(a){ug[a>>6&3].call(this,a)}function vg(a){wg[a>>6&3].call(this,a)}function xg(a){yg[a>>6&3].call(this,a)}
var ig=[function(a){zg[a>>8&15].call(this,a)},Uf,If,sf,of,qf,jf,W,function(a){Ag[a>>8&15].call(this,a)},Vf,Jf,tf,pf,rf,dg,W],zg=[function(a){Bg[a>>4&15].call(this,a)},Ff,Cf,uf,vf,Af,wf,yf,Sf,Sf,jg,lg,ng,W,W,W],kg=[function(a){ne(this,Ge(this,a,0));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Te);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Xe);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,1,Ve);this.b-=this.g?9:3+(7==this.f?2:0)}],mg=[function(a){T(this,a,0,
Ze);this.b-=this.g?11:6},function(a){T(this,a,Ld(this)?1:0,Je);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,Ld(this)?1:0,ef);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=Ee(this,a);ne(this,a);this.b-=this.g?4:3+(7==this.f?2:0)}],og=[function(a){T(this,a,0,cf);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,af);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Ne);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){T(this,a,0,Le);this.b-=this.g?9:3+(7==this.f?2:0)}],
Bg=[function(a){Cg[a&15].call(this,a)},W,W,W,Qf,Qf,Qf,Qf,$f,W,pg,rg,eg,eg,eg,eg],Cg=[Mf,gg,ag,Ef,Of,Zf,W,W,W,W,W,W,W,W,W,W],qg=[Yf,function(){this.U=0;this.b-=5},function(){this.V=0;this.b-=5},V,function(){this.$=1;this.b-=5},V,V,V,function(){this.Z=0;this.b-=5},V,V,V,V,V,V,V],sg=[Yf,function(){this.U=65536;this.b-=5},function(){this.V=32768;this.b-=5},bg,function(){this.$=0;this.b-=5},bg,bg,bg,function(){this.Z=32768;this.b-=5},bg,bg,bg,bg,bg,bg,bg],Ag=[Df,Bf,xf,zf,Gf,Hf,mf,nf,Lf,fg,tg,vg,xg,W,W,
W],ug=[function(a){ne(this,Fe(this,a,0,255));this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Ue);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,Ye);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,1,We);this.b-=this.g?9:3+(7==this.f?2:0)}],wg=[function(a){S(this,a,0,$e);this.b-=this.g?11:6},function(a){S(this,a,Ld(this)?1:0,Ke);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,Ld(this)?1:0,ff);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){a=De(this,a);ne(this,
a<<8);this.b-=this.g?4:3+(7==this.f?2:0)}],yg=[function(a){S(this,a,0,df);this.b-=this.g?9+(this.yb&1):3+(7==this.f?2:0)},function(a){S(this,a,0,bf);this.b-=this.g?9:3+(7==this.f?2:0)},function(a){S(this,a,0,Oe);this.b-=this.g?9+(this.yb&1):3+(7==this.f?2:0)},function(a){S(this,a,0,Me);this.b-=this.g?9:3+(7==this.f?2:0)}];function Id(a){Dg[a>>12].call(this,a)}
var Dg=[function(a){Eg[a>>8&15].call(this,a)},Uf,If,sf,of,qf,jf,function(a){Fg[a>>8&15].call(this,a)},function(a){Gg[a>>8&15].call(this,a)},Vf,Jf,tf,pf,rf,dg,W],Eg=[function(a){Hg[a>>4&15].call(this,a)},Ff,Cf,uf,vf,Af,wf,yf,Sf,Sf,jg,lg,ng,function(a){Ig[a>>6&3].call(this,a)},W,W],Ig=[function(a){a=this.u[7]+((a&63)<<1)&65535;var b=this.ua(a|this.S);Q(this,this.u[5]);this.u[6]=a+2&65535;this.u[5]=b;this.b-=8},function(a){a=ye(this,a,0);re(this,a);R(this,a);this.b-=11},function(a){var b=te(this);this.I=
this.b;ze(this,a,0,b);R(this,b);this.b=this.I-Wf[this.g]},function(a){R(this,Ge(this,a,Od(this)?65535:0));this.b-=this.g?9:3+(7==this.f?2:0)}],Hg=[function(a){Jg[a&15].call(this,a)},W,W,W,Qf,Qf,Qf,Qf,$f,function(a){a&8?(this.N&49152||(this.N=this.N&-2017|(a&7)<<5,this.J|=1),this.b-=5):W.call(this,a)},pg,rg,eg,eg,eg,eg],Jg=[Mf,gg,function(){se(this);this.J|=this.N&16;this.b-=13},Ef,Of,Zf,ag,function(){this.ra(8,0,-8)},W,W,W,W,W,W,W,W],Fg=[Xf,Xf,Kf,Kf,kf,kf,lf,lf,hg,hg,W,W,W,W,cg,cg],Gg=[Df,Bf,xf,zf,
Gf,Hf,mf,nf,Lf,fg,tg,vg,xg,function(a){Kg[a>>6&3].call(this,a)},W,W],Kg=[W,function(a){a=ye(this,a,65536);re(this,a);R(this,a);this.b-=11},function(a){var b=te(this);this.I=this.b;ze(this,a,65536,b);R(this,b);this.b=this.I-Wf[this.g]},W];
function Lg(a){t.call(this,"ROM",a,Lg,512);this.ga=this.g=null;this.B=a.addr;this.f=a.size;this.D=!1;this.w=a.alias;this.C=a.file;this.H=sa(this.C);if(this.C){a=this.C;var b=ta(this.H);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.C+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.R("Unable to load ROM resource (error "+f+": "+a+")"),c.C=null):(rb(c.Ua,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga):c.C=null);eh(c)})}}z(Lg);k=Lg.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.b=c;this.j=d;eh(this)};k.Ka=function(){this.ga&&(this.j&&fh(this.j,this.id,this.B,this.f,this.ga),delete this.ga);return!0};k.Ja=function(){return!0};
function eh(a){if(!xb(a)){if(a.C){if(!a.g||!a.v)return;a.f||(a.f=a.g.length);if(a.g.length!=a.f)zb(a,"ROM size ("+p(a.g.length,8,!0)+") does not match specified size ("+p(a.f,8,!0)+")");else{var b;a:{b=a.B;a.status(a.f+"-byte ROM at "+na(b));if(57344<=b&&b<57344+pc){var c={};b=(c[b]=[Lg.prototype.Qd,Lg.prototype.Ie,null,null,null,a.f>>1],c);if(Ib(a.v,a,b)){b=a.D=!0;break a}}else if(zc(a.v,b,a.f,jd)){for(c=0;c<a.g.length;c++)a.v.tb(b+c,a.g[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.w?b.push(a.w):
null!=a.w&&a.w.length&&(b=a.w);for(c=0;c<b.length;c++){var d=a,e=b[c],f=yc(d.v,d.B,d.f);xc(d.v,e,d.f,f)}a.D||delete a.g}}}H(a)}}k.Qd=function(a){return this.g[a-this.B]};k.Ie=function(){};$a(function(){for(var a=D(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Lg(d);B(d,c)}});
function gh(a){t.call(this,"RAM",a,gh);this.ga=this.g=null;this.C=a.addr;this.B=a.size;this.Oa=a.load;this.Na=a.exec;this.w=!1;this.f=a.file;this.D=sa(this.f);if(this.f){a=this.f;var b=ta(this.D);"json"!=b&&"hex"!=b&&(a=Ga()+"/api/v1/dump?file="+this.f+"&format=bytes&decimal=true");var c=this;Da(a,null,!0,function(a,b,f){f?(c.R("Unable to load RAM resource (error "+f+": "+a+")"),c.f=null):(rb(c.Ua,a,b),(a=Ea(a,b))?(c.g=a.ea,c.ga=a.ga,null==c.Oa&&(c.Oa=a.Oa),null==c.Na&&(c.Na=a.Na)):c.f=null);hh(c)})}}
z(gh);gh.prototype.Ia=function(a,b,c,d){this.v=b;this.b=c;this.j=d;hh(this)};gh.prototype.Ka=function(){this.ga&&(this.j&&fh(this.j,this.id,this.C,this.B,this.ga),delete this.ga);return!0};gh.prototype.Ja=function(){return!0};function hh(a){if(a.v&&(!a.w&&a.B&&zc(a.v,a.C,a.B,Cc)&&(a.w=!0),!xb(a))){if(!a.w)q("No RAM allocated");else if(a.f){if(!a.g||!a.v)return;ih(a,a.g,a.Oa,a.Na,a.C)}H(a)}}
gh.prototype.reset=function(){if(this.w){for(var a=this.v,b=this.C,c=this.B,d=b&a.v,b=b>>>a.ka;0<c&&b<a.Y.length;){var e=a.Y[b];if(e.controller&&a.g&&a.g.length==a.w.length){var f=a.g.indexOf(e);0<=f&&(e=a.w[f])}if(e){var f=c,g=0,h,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Ab&&e.G)for(h=d;f--&&h<e.G.length;h++)e.G[h]=g;else for(h=d;f--&&h<e.size;h++)e.dc(d,g,e.F+d)}c-=a.Ca;b++;d=0}this.g&&ih(this,this.g,this.Oa,this.Na,this.C,!0)}};
function ih(a,b,c,d,e,f){var g=!1;if(null==c)for(var h=0;h<b.length-1;){var l=b[h]&255|(b[h+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(h+6>=b.length)break;for(var h=h+2,m=b[h++]&255|(b[h++]&255)<<8,n=b[h++]&255|(b[h++]&255)<<8,l=l+((m&255)+(m>>8)+(n&255)+(n>>8)),v=h,r=m-=6;0<m&&h<b.length;)l+=b[h++]&255,m--;if(m||h>=b.length)break;l+=b[h++]&255;if(l&255)break;if(r)for(E(a,"loading "+p(r,4,!0)+" bytes at "+p(n,4,!0)+"-"+p(n+r-1,4,!0),1048576);r--;)a.b.tb(n++,b[v++]&255);else n&1?a.b.da():null==d&&
(d=n),null!=d&&E(a,"starting address: "+p(d,4,!0),1048576);g=!0}else h++;else h+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.b.tb(c+g,b[g]);g=!0}g&&null!=d&&(a=a.b,a.Ac=d,a.v.reset(),Rb(a),Q(a,d),cd(a,0),!f&&a.j&&(a.da()||zd(a.j)));return g}$a(function(){for(var a=D(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new gh(d);B(d,c)}});function jh(a){t.call(this,"Keyboard",a,jh,65536);H(this)}z(jh);jh.prototype.wa=function(){return!1};
jh.prototype.Ia=function(a,b,c,d){this.C=a;this.b=c;this.j=d};$a(function(){for(var a=D(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new jh(d);B(d,c)}});
function X(a){this.O=a.baudReceive||9600;this.ca=a.baudTransmit||9600;this.ba=a.upperCase;this.w=this.D=null;this.T=a.tabSize;this.S=a.charBOL;this.H=0;t.call(this,"SerialPort",a,X,8388608);var b=a.binding;if("console"==b)this.D="";else{var c;a=kh;b&&(void 0===c&&(c="Panel"),(c=ub(c,this.id))&&(b=c.G[b])&&this.wa(null,a,b))}this.I=this.L=null;this.exports={connect:this.zc,receiveData:this.ac}}z(X);var kh="buffer";k=X.prototype;
k.wa=function(a,b,c){var d=this;switch(b){case kh:return this.G[b]=this.w=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.ac(b);return!0},c.onkeypress=function(a){a=a||window.event;d.ac(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.ac(a.getData("Text"))},
c.removeAttribute("readonly"),!0}return!1};k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.j=d;var e=this;this.pa=Tc(48,4);this.X=Ic(this.b,function(){e.f&128||!e.B.length||(e.K=e.B.shift()&255,e.ba&&97<=e.K&&122>e.K&&(e.K-=32),e.f|=128,e.f&64&&Jc(e.b,e.pa))});this.M=Tc(52,4);this.ja=Ic(this.b,function(){e.g|=128;e.g&64&&Jc(e.b,e.M)});Ib(b,this,lh);Kb(b,this.reset.bind(this));H(this)};
k.zc=function(){if(!this.I){var a=wd(this.C,"connection");if(a){var b=a.split("->");if(2==b.length){var c=ya(b[0]);if(c!=this.ab)return;b=ya(b[1]);if(this.I=tb(b)){var d=this.I.exports;if(d){var e=d.connect;e&&e.call(this.I);if(this.L=d.receiveData){this.status(this.Ua+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};k.Ka=function(a,b){if(!b)if(this.zc(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
k.Ja=function(a){return a?this.save():!0};k.reset=function(){mh(this)};k.save=function(){var a=new O(this);a.set(0,[]);return a.data()};k.restore=function(){return mh(this)};function mh(a){a.K=0;a.f=0;a.g=128;a.B=[];return!0}k.ac=function(a){if("number"==typeof a)this.B.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d<a.length;d++){c=b;b=a.charCodeAt(d);if(10==b){if(13==c)continue;b=13}this.B.push(b)}else this.B=this.B.concat(a);Kc(this.b,this.X,1E3/Math.round(this.O/10));return!0};
k.Kd=function(){return this.f&65534};k.Ce=function(a){this.f=this.f&-112|a&111};k.Jd=function(){this.f&=-129;0<this.B.length&&Kc(this.b,this.X,1E3/Math.round(this.O/10));return this.K};k.Be=function(){};k.de=function(){return this.g};k.We=function(a){this.g&128&&(a&64?Jc(this.b,this.M):Rd(this.b,this.M));this.g=this.g&-70|a&69};k.ce=function(){return 0};
k.Ve=function(a){if(a&=255){E(this,"transmitByte("+p(a,2,!0)+")");this.L&&this.L.call(this.I,a);a&=127;if(this.w)if(13==a)this.H=0;else if(8==a)this.w.value=this.w.value.slice(0,-1),0<this.H&&this.H--;else{var b;b=(b=za[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.T||8,c=a-this.H%a,this.T&&(b=xa("",c)));this.S&&!this.H&&c&&(b=String.fromCharCode(this.S)+b);this.w.value+=b;this.w.scrollTop=this.w.scrollHeight;this.H+=c}else if(null!=this.D){if(10==a||1024<=this.D.length)this.i(this.D),
this.D="";10!=a&&(this.D+=String.fromCharCode(a))}this.g&=-129;Kc(this.b,this.ja,1E3/Math.round(this.ca/10))}};var nh={},lh=(nh[65392]=[null,null,X.prototype.Kd,X.prototype.Ce,"RCSR"],nh[65394]=[null,null,X.prototype.Jd,X.prototype.Be,"RBUF"],nh[65396]=[null,null,X.prototype.de,X.prototype.We,"XCSR"],nh[65398]=[null,null,X.prototype.ce,X.prototype.Ve,"XBUF"],nh);$a(function(){for(var a=D(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new X(d);B(d,c)}});
function dd(a){t.call(this,"PC11",a,dd);this.g=a.autoMount||null;this.D=0;this.ba=a.baudReceive||3600;this.K=this.L=this.f=0;this.I=[];this.H=oh;this.w=ph;this.M=this.B="";this.ea=this.Oa=this.Na=null;this.S=-1;this.O=!Na("Mobi")&&window&&"FileReader"in window}z(dd);var oh="",ph=0;k=dd.prototype;
k.wa=function(a,b,c){var d=this,e=ph;switch(b){case "listTapes":return this.G[b]=c,c.onchange=function(){var a=d.G.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){q("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.G[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.G[b]=c,c.onclick=
function(){var a=d.G.listTapes;a&&qh(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.O){c.parentNode.removeChild(c);break}this.G[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;qh(d,sa(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.G[b]=c,!0}return!1};
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.j=d;this.T=rh(a);var e=this;if((this.g=wd(this.C,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(f){q("PC11 auto-mount error: "+f.message+" ("+this.g+")"),this.g=null}this.X=Tc(56,4);this.ca=Ic(this.b,function(){1==(e.f&32769)&&!(e.f&128)&&e.K<e.I.length&&(e.L=e.I[e.K++]&255,sh(e,e.K/e.I.length*100),e.f|=128,e.f&=-2049,e.f&64&&Jc(e.b,e.X))});Ib(b,this,th);Kb(b,this.reset.bind(this));uh(this,"None",oh,!0);this.O&&
uh(this,"Local Tape","?");uh(this,"Remote Tape","??");vh(this)||H(this)};k.Ka=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};k.Ja=function(a){return a?this.save():!0};k.reset=function(){this.f&=-2241;this.L=0};function vh(a){a.D=0;if(a.g){var b=a.g.path||"",c;if(!(c=a.g.name))a:{if((c=a.G.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=sa(b,!0)}b&&c?wh(a,c,b,1,!0):xh(a)}return!!a.D}
function qh(a,b,c,d,e){if(c)if("?"==c)a.R('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"');a.H="??"}else a.H=c;wh(a,b,c,d,!1,e)}else yh(a,!1)}
function wh(a,b,c,d,e,f){var g=-1;if(a.B.toLowerCase()!=c.toLowerCase()||a.w!=d)g++,yh(a,!0),a.A.eb?a.R("PC11 busy"):(e&&(a.D++,F(a)&&E(a,"auto-loading tape: "+b)),zh(a,b,c,d,f)?g++:a.A.eb=!0);g&&Ah(a,a.M,a.B,a.w,a.ea,a.Oa,a.Na)}
function zh(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),Ah(a,b,c,d,e),a.H="?");xh(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=ta(c),f="json"==e||"gz"==e?encodeURI(c):Ga()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!Da(f,null,!0,function(e,f,g){var h=0>g&&a.C&&!a.C.A.ia;g?a.R('Unable to load tape "'+b+'" (error '+g+": "+e+")",h):(rb(a.Ua,e,f),(e=Ea(e,f))&&Ah(a,b,c,d,e.ea,e.Oa,
e.Na));a.A.eb=!1;a.D&&(a.D--,a.D||H(a));xh(a)})}function uh(a,b,c,d){if((a=a.G.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function xh(a){var b=a.G.listTapes;if(b&&b.options){a=a.H||a.B;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}function sh(a,b){b|=0;if(b!==a.S){var c=a.G.readProgress;c&&(c=(c=D(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.S=b}}
function Ah(a,b,c,d,e,f,g){a.M=b;a.B=c;a.w=d;a.ea=e;a.Oa=f;a.Na=g;2==d?a.T&&ih(a.T,e,f,g)?a.status("tape loaded: "+b):(a.M="",a.B="",a.H=oh,a.w=ph,a.R("No load address available for tape: "+b)):(a.K=0,a.I=e,a.status("tape attached: "+b),sh(a,0))}function yh(a,b){if(a.B||!1===b)a.M="",a.B="",b||(a.w&&a.status(1==a.w?"tape detached":"tape unloaded"),a.H=oh,a.w=ph,xh(a))}k.save=function(){return(new O(this)).data()};k.restore=function(){return!0};k.Dd=function(){return this.f&65534};
k.ve=function(a){a&1&&(this.f&32768?(a&=-2,this.f&64&&Jc(this.b,this.X)):(this.f&=-129,this.f|=2048,this.L=0,Kc(this.b,this.ca,1E3/Math.round(this.ba/10))));this.f=this.f&-66|a&65};k.Cd=function(){this.f&=-129;this.f|=2048;return this.L};k.ue=function(){};var Bh={},th=(Bh[65384]=[null,null,dd.prototype.Dd,dd.prototype.ve,"PRS"],Bh[65386]=[null,null,dd.prototype.Cd,dd.prototype.ue,"PRB"],Bh);
function Ch(a,b,c){t.call(this,"Disk",{id:a.Ua+".disk"+p(++Dh,4)},Ch,4194304);this.controller=a;this.C=a.C;this.j=a.j;this.w=b;this.$a=b.name;this.jc=b.jc;Eh(this,c,b.ya,b.Da,b.ta,b.Pa);H(this)}var Dh=0;z(Ch);k=Ch.prototype;k.Ia=function(a,b,c,d){this.j=d};
function Eh(a,b,c,d,e,f){a.mode=b;a.ya=c;a.Da=d;a.ta=e;a.Pa=f;a.b=[];if("preload"!=a.mode){b=Array(a.ya);for(c=0;c<b.length;c++){d=Array(a.Da);for(e=0;e<d.length;e++){f=Array(a.ta);for(var g=1;g<=f.length;g++)f[g-1]=Fh(null,c,e,g,a.Pa,0);d[e]=f}b[c]=d}a.b=b}a.f=null}
function Gh(a,b,c,d,e){var f=c;if(a.v)return!0;a.$a=b;a.hb=c;a.Lc=sa(c);a.v=e;a.B=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ka[d];if(e){a.ya=e[0];a.Da=e[1];a.ta=e[2];a.Pa=e[3]||512;c=a.Pa>>2;var f=e=0,b=new DataView(b,0,d);a.b=Array(a.ya);for(d=0;d<a.b.length;d++)for(var r=a.b[d]=Array(a.Da),w=0;w<r.length;w++)for(var y=r[w]=Array(a.ta),x=0;x<y.length;x++){for(var C=Fh(null,d,w,x+1,a.Pa,0),la=C.data,Ma=0;Ma<c;Ma++,f+=4)var P=la[Ma]=b.getInt32(f,
!0),e=e+P&-1;C.Fa=c;y[x]=C}a.f=e;c=a}else a.R("Unrecognized disk format ("+d+" bytes)");a.v&&(a.v.call(a.controller,a.w,c,a.$a,a.hb),a.v=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=ta(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ua(c,"/")&&(d="dir"),f=Ga()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.jc?"":e)+"&format=json"));return!!Da(f,
null,!0,function(b,c,d){Hh(a,b,c,d)})}
function Hh(a,b,c,d){var e=null;a.g=!1;var f=0>d&&a.C&&!a.C.A.ia;if(d)a.controller.R('Unable to load disk "'+a.$a+'" (error '+d+": "+b+")",f);else{rb(a.controller.Ua,b,c);try{if(0<sa(a.Lc,!0).toLowerCase().indexOf("-readonly"))a.g=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.g=!0)}var h;"<"==c.substr(0,1)?h=["Missing disk image: "+a.$a]:h=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(h.length)if(1==h.length)q(h[0]);else{a.ya=h.length;a.Da=h[0].length;a.ta=h[0][0].length;var l=h[0][0][0];a.Pa=l&&l.length||512;for(d=c=0;d<a.ya;d++)for(f=0;f<a.Da;f++)for(g=0;g<a.ta;g++)if(l=h[d][f][g]){var m=l.length;void 0===m&&(m=l.length=512);var m=m>>2,n=l.pattern;void 0===n&&(n=l.pattern=0);var v=l.data;if(void 0===v){var r=l.bytes;if(void 0!==r&&r.length){for(var w=m<<2,y=r.length;y<w;y++)r[y]=n;Ih(l,r)}else v=[],n=l.pattern=n|n<<8|n<<16|n<<24,l.data=v;delete l.bytes}Fh(l,d,f);for(w=
0;w<v.length;w++)c=c+v[w]&-1}a.b=h;a.f=c;e=a}else q("Empty disk image: "+a.$a)}catch(x){q("Disk image error ("+b+"): "+x.message)}}a.v&&(a.v.call(a.B,a.w,e,a.$a,a.hb),a.v=null)}function Fh(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.Ze=b;a.$e=c;a.Sa=a.Fa=0;a.Wa=!1;return a}
k.seek=function(a,b,c,d,e){d=null;var f=this.w,g=this.b[a];if(g){var h=g[b];if(!h&&f.Rc&&b<f.Da)for(h=g[b]=Array(f.Sc),g=0;g<h.length;g++)h[g]=Fh(null,a,b,g+1,f.Ec,0);if(h){for(g=0;g<h.length;g++)if(h[g]&&h[g].sector==c){d=h[g];break}!d&&f.Rc&&9==f.rc&&(d=h[g]=Fh(null,a,b,f.rc,f.Ec,0))}}e&&e(d,!1);return d};function Ih(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
k.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};k.write=function(a,b,c){if(this.g)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.Fa?f<a.Sa?(a.Fa+=a.Sa-f,a.Sa=f):f>=a.Sa+a.Fa&&(a.Fa+=f-(a.Sa+a.Fa)+1):(a.Sa=f,a.Fa=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function Jh(a,b){var c=a.Da*a.ta,d=b/c|0;return d<a.ya?(b%=c,a.seek(d,b/a.ta|0,b%a.ta+1)):null}function Kh(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}
k.save=function(){var a=0,b=[];b[a++]=[this.hb,this.f,this.ya,this.Da,this.ta,this.Pa];if(!this.g)for(var c=this.b,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.Fa){for(var h=[],l=0,m=g.Sa,n=g.Sa+g.Fa;m<n;)h[l++]=g.data[m++];b[a++]=[d,e,f,g.Sa,h]}}return b};
k.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.b.length&&6<=e.length?Eh(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.f&&e[1]!=this.f&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.f+")",b=-2));for(this.b.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],h=g[f++],l=g[f++],m=g[f++];if(h>=this.b.length||l>=this.b[h].length||m>=this.b[h][l].length){c="sector (CHS="+h+":"+l+":"+m+") out of range ("+
b+" changes applied)";b=-1;break}if(this.g){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(h=this.b[h][l][m]){for(l=h.data.length;l<e;)h.data[l++]=h.pattern;l=0;h.Sa=e;for(h.Fa=f.length;e<g;)h.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.R("Unable to restore disk '"+this.$a+": "+c);return b};
k.toJSON=function(){var a;a=0;for(var b;b=Jh(this,a++);)Lh(b);a=JSON.stringify(this.b,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function Lh(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){t.call(this,"RL11",a,N,4194304);this.w=a.autoMount||null;this.H=0;this.f=Array(4);this.L=!Na("Mobi")&&window&&"FileReader"in window}z(N);k=N.prototype;
k.wa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.G[b]=c,c.onchange=function(){var a=d.G.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(h){q("RL11 option error: "+h.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.G[b]=c,c.onchange=function(){var a=ma(c.value,10);null!=a&&Mh(d,a)},!0;case "loadDrive":return this.G[b]=
c,c.onclick=function(){var a=d.G.listDisks;a&&Nh(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.L){c.parentNode.removeChild(c);break}this.G[b]=c;c.onclick=function(){var a=d.G.listDrives;if(a&&a.options&&d.f)if(a=d.f[ma(a.value,10)||0])if(a=a.Ga){var b;b="";for(var c=0,h;h=Jh(a,c++);)for(var l=0,m=h.length;l<m;l++)b+=String.fromCharCode(Kh(a,h,l));b=btoa(b);a=a.Lc.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),
"string"!=typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");q(a)}else d.R("No disk loaded in drive.");else d.R("No disk drive selected.")};return!0;case "mountDrive":if(this.L)return this.G[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=
!a.children[0].files.length}),c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Nh(d,sa(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
k.Ia=function(a,b,c,d){this.C=a;this.v=b;this.b=c;this.j=d;if((this.w=wd(this.C,"autoMount")||this.w)&&"string"==typeof this.w)try{this.w=eval("("+this.w+")")}catch(e){q("RL11 auto-mount error: "+e.message+" ("+this.w+")"),this.w=null}Oh(this);this.O=Tc(112,5);Ib(b,this,Ph);Kb(b,this.reset.bind(this));Qh(this,"None","",!0);this.L&&Qh(this,"Local Disk","?");Qh(this,"Remote Disk","??");Rh(this)||H(this)};
k.Ka=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.C.uc){for(a=0;a<this.f.length;a++)Sh(this,a,!0);Rh(this,!0)}}else if(!this.restore(a))return!1;if(a=this.G.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Mh(this,0)}}return!0};k.Ja=function(a){return a?this.save():!0};k.reset=function(){Oh(this)};k.save=function(){return(new O(this)).data()};
k.restore=function(a){return Oh(this,a[0])};function Rh(a,b){b||(a.H=0);if(a.w)for(var c in a.w){var d=a.w[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.G.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var h=f.options[g];if(h.value==e){f=h.text;break a}}f=sa(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.f.length)){!Th(a,g,f,e,!0)&&b&&H(a,!1);continue}a.R("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.H}
function Nh(a,b,c,d){var e=a.G.listDrives,e=e&&ma(e.value,10);if(void 0===e||0>e||e>=a.f.length)a.R("Unable to load the selected drive");else if(c)if("?"==c)a.R('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=sa(c);a.status("Attempting to load "+c+' as "'+b+'"')}Th(a,e,b,c,!1,d)}else Sh(a,e)}
function Th(a,b,c,d,e,f){var g=-1,h=a.f[b];h.hb.toLowerCase()!=d.toLowerCase()&&(g++,Sh(a,b,!0),h.ic?a.R("RL11 busy"):(h.ic=!0,e&&(h.hc=!0,a.H++,F(a)&&E(a,"auto-loading disk: "+c)),h.Vb=!!f,Gh(new Ch(a,h,"preload"),c,d,f,a.Wc)&&g++));return g}
k.Wc=function(a,b,c,d,e){var f;a.ic=!1;b&&(f=b.b.length?[b.b.length,b.b[0].length,b.b[0][0].length,b.b[0][0][0].length]:[0,0,0,0],b&&f[0]>a.ya||f[1]>a.Da)&&(this.R('Disk "'+c+'" too large for drive '+("RL"+a.kc)),b=null);b?(a.Ga=b,a.$a=c,a.hb=d,this.R('Mounted disk "'+c+'" in drive '+("RL"+a.kc),a.hc||e),this.C&&this.C.ub()):a.Vb=!1;a.hc&&(a.hc=!1,--this.H||H(this));Mh(this,a.kc)};
function Qh(a,b,c,d){if((a=a.G.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Mh(a,b){if(0<=b&&b<a.f.length){var c=a.f[b],d=a.G.listDisks;a=a.G.listDrives;if(d&&a&&d.options&&a.options&&(a=ma(a.value,10),c=c.Vb?"?":c.hb,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Sh(a,b,c){var d=a.f[b];if(d.Ga||!1===c)d.$a="",d.hb="",d.Ga=null,d.Vb=!1,c||(a.R("Drive RL"+b+" unloaded",c),Mh(a,b))}
function Oh(a,b){var c=0;b||(b=[]);a.fa=b[c++]||0;a.I=b[c++]||0;a.g=b[c++]||0;a.B=b[c++]||0;a.D=b[c++]||0;a.K=b[c]||0;for(b=0;b<a.f.length;b++){var d=a.f[b];void 0===d&&(d=a.f[b]={});c=a;d.kc=b;d.ic=d.Vb=!1;d.name=c.ab;d.ya=512;d.Da=2;d.ta=40;d.Pa=256;d.jc=!0;d.Ye=0;d.Xe=0;d.rc=1;d.Sc=d.ta;d.Ec=d.Pa;d.af=0;d.cf=null;d.Ga||(d.hb="");d.status=29|(512==d.ya?128:0)}return!0}
k.Uc=function(a,b,c,d,e,f){this.I=f&65535;this.fa=this.fa&-49|f>>12&48;this.K=f>>16&63;this.B=this.g=b<<7|(c?64:0)|d&63;this.D=65536-e&65535;a&&(this.fa=this.fa|a|32768);return!0};
k.qd=function(a,b,c,d,e,f,g){var h=0,l=a.Ga,m=null,n;l||(h=5120,e=0);for(;e--;){if(!m){m=a.Ga.seek(b,c,d+1);if(!m){h=5120;break}n=0}var v,r;if(0>(v=a.Ga.read(m,n++))||0>(r=a.Ga.read(m,n++))){h=5120;break}this.v.ib(f,v|r<<8);if(Hc(this.v)){h=8192;break}f+=2;if(n>=l.Pa&&(m=null,++d>=l.ta&&(d=0,++c>=l.Da&&(c=0,++b>=l.ya)))){h=5120;break}}return g(h,b,c,d,e,f)};
k.ke=function(a,b,c,d,e,f,g){var h=0,l=a.Ga,m=null,n;l||(h=5120,e=0);for(;e--;){var v=this.v.ma(f);if(Hc(this.v)){h=8192;break}f+=2;if(!m){m=a.Ga.seek(b,c,d+1,!0);if(!m){h=5120;break}n=0}if(!a.Ga.write(m,n++,v&255)||!a.Ga.write(m,n++,v>>8)){h=5120;break}if(n>=l.Pa&&(m=null,++d>=l.ta&&(d=0,++c>=l.Da&&(c=0,++b>=l.ya)))){h=5120;break}}return g(h,b,c,d,e,f)};k.Nd=function(){return this.fa&65535};
k.Fe=function(a){this.fa=this.fa&-1023|a&1022;this.M=this.M&-4|(a&48)>>4;if(!(this.fa&128)){var b;a=!0;var c=this.f[(this.fa&768)>>8],d,e,f,g;this.fa&=-2;switch(this.fa&14){case 4:this.g&8&&(this.fa&=63);this.D=c.status|this.B&64;break;case 6:1==(this.g&3)&&(b=this.g&65408,c=(this.g&16)<<2,this.B=this.g&4?this.B+b:this.B-b,this.g=this.B=this.B&65408|c);break;case 8:this.D=this.B;break;case 12:b=this.qd;case 10:b||(b=this.ke),d=this.g>>7,e=this.g&64?1:0,f=this.g&63,d>=c.ya||f>=c.ta?this.fa|=37888:
(g=(this.K&63)<<16|this.I,a=65536-this.D&65535,a=b.call(this,c,d,e,f,a,g,this.Uc.bind(this)))}a&&(this.fa|=129,this.fa&64&&Jc(this.b,this.O))}};k.Ld=function(){return this.I};k.De=function(a){this.I=a&65534};k.Od=function(){return this.g};k.Ge=function(a){this.g=a};k.Pd=function(){return this.D};k.He=function(a){this.D=a};k.Md=function(){return this.K};k.Ee=function(a){this.K=a&63};
var Uh={},Ph=(Uh[63744]=[null,null,N.prototype.Nd,N.prototype.Fe,"RLCS"],Uh[63746]=[null,null,N.prototype.Ld,N.prototype.De,"RLBA"],Uh[63748]=[null,null,N.prototype.Od,N.prototype.Ge,"RLDA"],Uh[63750]=[null,null,N.prototype.Pd,N.prototype.He,"RLMP"],Uh[63752]=[null,null,N.prototype.Md,N.prototype.Ee,"RLBE"],Uh);function Vh(a){t.call(this,"Debugger",a,Vh);this.ca=a.base||16;this.Ea=!1;this.K=0;this.T=!1;this.B=-1;this.g=[];this.X={}}z(Vh);
var Wh={"||":0,"&&":1,"|":2,"^":3,"&":4,"!=":5,"==":5,">=":6,">":6,"<=":6,"<":6,">>>":7,">>":7,"<<":7,"-":8,"+":8,"%":9,"/":9,"*":9};Vh.prototype.wc=function(){return-1};Vh.prototype.xc=function(){};
function Xh(a,b,c,d){if(c)if(b){0>a.B&&a.g.length&&(a.B=0);if(0>a.B||b!=a.g[a.B])a.g.splice(0,0,b),a.B=0;a.B--}else a.T?b="end":b=a.g[a.B+1];a=[];if(b){b=b.replace(/""/g,"'");c=0;var e=null;d=d||";";for(var f=0;f<=b.length;f++){var g=b.charAt(f);if('"'==g||"'"==g)e?g==e&&(e=null):e=g;else if(g==d&&!e||!g)a.push(ya(b.substring(c,f))),c=f+1}}return a}
function Yh(a,b,c){for(c=c||-1;c--&&b.length;){var d=b.pop();if(2>a.length)return!1;var e=a.pop(),f=a.pop();switch(d){case "*":d=f*e;break;case "/":if(!e)return!1;d=f/e;break;case "%":if(!e)return!1;d=f%e;break;case "+":d=f+e;break;case "-":d=f-e;break;case "<<":d=f<<e;break;case ">>":d=f>>e;break;case ">>>":d=f>>>e;break;case "<":d=f<e?1:0;break;case "<=":d=f<=e?1:0;break;case ">":d=f>e?1:0;break;case ">=":d=f>=e?1:0;break;case "==":d=f==e?1:0;break;case "!=":d=f!=e?1:0;break;case "&":d=f&e;break;
case "^":d=f^e;break;case "|":d=f|e;break;case "&&":d=f&&e?1:0;break;case "||":d=f||e?1:0;break;default:return!1}a.push(d|0)}return!0}
function Mh(a,b,c){var d;if(b){b=Nh(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=xa(n);if(!n){f=!0;break}n=Oh(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Jh[n]<Jh[l[l.length-1]]&&Lh(h,l,1);l.push(n);b=b.substr(v+r)}Lh(h,l)&&1==h.length||(f=!0);f?c&&a.j("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&Ph(a,null,
d))}return d}function Nh(a,b){for(var c,d=a.xa?"(":"{",e=a.xa?")":"}",f=new RegExp(a.xa?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Mh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function Oh(a,b,c,d){var e;null!=b?(e=a.tc(b),0<=e?e=a.uc(e):(e=a.X[b],null==e&&(e=pa(b,a.ca))),null!=e||d||a.j("invalid "+(c?c:"value")+": "+b)):d||a.j("missing "+(c||"value"));return e}
function Ph(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+qa(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.j((null!=b?b+": ":"")+d);return e}function Qh(a,b){if(b)return Ph(a,b,a.X[b]);var c=0;for(b in a.X)Ph(a,b,a.X[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.ca){case 8:a=qa(b,3*c-(2<c?1:0));break;case 10:a=b.toString();break;default:a=p(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function Rh(a){Ih.call(this,a);this.jb=!1;this.xa=!0;this.L=Y(0);this.kb=Y(0);this.O=Y(0);this.I=[];this.f=this.M=this.D=[];Sh(this);this.pa=0;Th(this);this.Ja={};Uh(this,a.messages);this.Ra=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return rd(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return rd(b,a)})}z(Rh,Ih);
var Vh={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},Wh=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
Xh={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],
33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,
63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},Yh=[0],Zh=
[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=Rh.prototype;
k.Ea=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.B=a.B;(a=nd(a,"messages"))&&Uh(this,a);this.ob=Xh;this.Eb=1145>this.b.Wa?Zh:[];$h(this,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.ba(ai(d,c));if(-1===a){d.j("invalid address: "+c);break a}e=a>>>d.v.ja;l=1}d.j("blockid physical blockaddr used size type");d.j("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.j("..."):(c=n.type,m=Bc[c],n&&d.j(p(n.id,8)+" %"+
p(e<<d.v.ja,8)+" %%"+p(n.F,8)+" "+p(n.Ob,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=$c&&(c=-1),m=0);a+=d.v.za;e++}}});H(this)};
k.sa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.ka=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",rd(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.A<d.g.length-1&&(b=d.g[++d.A])):40==a.keyCode&&(0<d.A?b=d.g[--d.A]:(b="",d.A=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.G[b]=c,Ta(c,function(){if(d.ka){var a=d.ka.value;
d.ka.value="";rd(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ta(c,function(a){var b=!1;vb(d,!0)||(ub(d,!0),b=d.ib(a?1:0),ub(d,!1));return b}),!0}return!1};k.sb=function(a){if(this.ka){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.ka.focus();!a&&window&&window.scrollTo(b,c)}};k.ba=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Hb=function(a,b){var c=255,d=this.ba(a,!1,1);-1!==d&&(c=a.Rb?this.v.Ub(d):this.b.Ub(d),b&&bi(a,b));return c};
k.na=function(a,b){var c=65535,d=this.ba(a,!1,2);-1!==d&&(c=a.Rb?this.v.cb(d):this.b.cb(d),b&&bi(a,b));return c};k.Ab=function(a,b,c){var d=this.ba(a,!0,1);-1!==d&&(a.Rb?this.v.rb(d,b):this.b.rb(d,b),c&&bi(a,c),this.C.oa(-1))};k.gb=function(a,b,c){var d=this.ba(a,!0,2);-1!==d&&(a.Rb?this.v.Bb(d,b):this.b.Bb(d,b),c&&bi(a,c),this.C.oa(-1))};function Y(a,b){return{F:a,Rb:b,Oa:!1}}k.kc=function(a,b){a.F=b;a.Oa=!1;return a};function ci(a){return[a.F,a.Oa]}function di(a){return{F:a[0],Oa:a[1]}}
function ai(a,b,c){var d,e=(c?a.L:a.kb).F;c=!1;if(void 0!==b){b=Nh(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Mh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function ei(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Mc=Kh(a,b.Hc=c[2]))}function bi(a,b){null!=a.F&&(a.F+=b||1)}
function Uh(a,b){a.i=a;a.ma=a.Qc=536870912;a.ia=null;a.va=[];b=Kh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Bb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.ma|=Bb[c],a.j(c+" messages enabled"))}}function $h(a,b){for(var c in Bb)if(64==Bb[c]){a.Ja[c]=b;break}}
k.tc=function(a){var b=-1;a=a.toUpperCase();switch(a){case "SP":b=6;break;case "PC":b=7;break;case "SR":b=21;break;default:"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b)&&(b=-1)}return b};function fi(a){return 6>a?"R"+a:6==a?"SP":"PC"}k.uc=function(a){var b;0<=a&&(8>a?b=this.b.u[a]:16>a?b=this.b.Ya[a-8]:20>a?b=this.b.Ia[a-16]:20==a?b=Tc(this.b):21==a&&this.B&&kc(this.B)&&(b=this.B.Xa));return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.Ib).F));if(this.ma&1073741824)this.va.push(a);else if(!this.ia||a!=this.ia){this.ia=a;if(this.ma&-2147483648&&this.b&&this.b.w.W||vb(this,!0))this.da(),a+=" (cpu halted)";this.j(a);this.b&&(a=this.b,vd(a),a.wa=0,a.oa())}};
function Th(a){var b;if(!we(a))a.H&&a.H.length&&a.j("instruction history buffer freed"),a.$=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.$=0;a.j("instruction history buffer allocated")}}k.hb=function(a,b){if(!gi(this,b))return!1;this.b.hb(a);return!0};
k.ib=function(a,b,c){if(!gi(this))return!1;this.J=0;a||we(this)&&xe(this,this.b.u[7],0);try{a=wd(this.b,a);var d=this.b.ib(a);0<d&&(cc(this.b,d),this.J+=d,dc(this.b,d,!0),ec(this.b,d),this.wa++)}catch(e){"number"!=typeof e&&(this.J=0,yb(this.b,e.stack||e.message))}!1!==c&&this.C.oa(-1);qd(this,b||!1);return 0<this.J};k.da=function(a){this.b&&this.b.da(a)};
function qd(a,b){if(a.jb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.K&8?c.jd|c.Zc<<8:0){var d=c>>8;a.j("trapped to "+J(a,c&255,1)+" ("+(0>d?Ab[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.S?hi(a):ii(a)}}function gi(a,b){var c;(c=!a.b||!wb(a.b))||(c=a.b,c.w.ha?c=!0:(c.j(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.w.W?(b||a.j("cpu busy or unavailable, command ignored"),!1):!xb(a.b)}k.Ga=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Fa=function(a,b){b&&this.j(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){Th(this);this.wa=0;this.ia=null;this.J=0;this.L=Y(this.b.u[7]);this.w.W=!1;ji(this);a||qd(this)};k.save=function(){var a=new N(this);a.set(0,ci(this.L));a.set(1,ci(this.O));a.set(2,[this.g,this.R,this.ma]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=di(a[b++]),this.O=di(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.R=a[b][1],this.ma|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.S||this.j("running");this.w.W=!0;this.Fb=a;this.Gb=b};
k.stop=function(a,b){if(this.w.W){this.w.W=!1;this.J=b-this.Gb;if(!this.S){b="stopped";if(this.J){a-=this.Fb;var c=0<a?Math.round(1E3*this.J/a):0;b+=" (";we(this)&&(b+=this.wa+" instructions, ",this.wa=0);b+=this.J+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.j(b)}qd(this,!0);this.sb();ji(this,this.b.u[7]);this.ia=null}};function we(a){return 1<a.f.length||!!a.pa}
function xe(a,b,c){var d=-1;c||(d=a.b.cb(b),0==d&&(b=Fd(a.b,2)));if(0<c&&(a.pa&&!--a.pa||id(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.wa++,0>d&&(d=a.b.cb(b)),65535!=(d&65535)&&(a.kc(a.H[a.$],b),++a.$==a.H.length&&(a.$=0)));return!1}function Cf(a){var b=a.b;if(b.w.W)throw O(b,a.b.Ib),a.da(),-1;return!1}
function Sh(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.v;c=a.ba(c);jd(d.Y[c>>>d.ja],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.ba(c),jd(d.Y[c>>>d.ja],!0);a.D=["bw"];a.lb=0}k.mb=function(a,b,c){var d=!0;c||ki(this,a,b,!1,!0);if(a!=this.f){var e=this.ba(b);if(-1===e)this.j("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ja].mb(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Oa=!0:(li(this,a,a.length-1,"set"),Th(this)));return d};
function ki(a,b,c,d,e){var f=!1;c=a.ba(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.ba(h)&&(!d||h.Oa)){f=!0;h.Oa||e||li(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,jd(d.Y[c>>>d.ja],b==a.D));h.Oa||Th(a);break}}return f}function mi(a,b){for(var c=1;c<b.length;c++)li(a,b,c);return b.length-1}function li(a,b,c,d){c=b[c];a.j(b[0]+" "+J(a,c.F)+(d?" "+d:c.Hc?' "'+c.Hc+'"':""))}
function ji(a,b){if(void 0!==b)id(a,b,1,a.f,!0),a.S=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Oa){if(!ki(a,a.f,c,!0))break;b=0}}}
function id(a,b,c,d,e){var f=!1;if(!a.lb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Oa)for(var l=a.ba(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Oa&&(ki(a,d,h,!0),e=!0);if(n=h.Mc){for(var f=!1,v=0;v<n.length;v++)if(!ni(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.w.W||(f=!0)}if(f){e||li(a,d,g,"hit");break}}}a.lb--;return f}
function oi(a,b,c,d){var e=Y(b.F),f=a.na(b,2),g,h;for(h in a.ob)if(g=a.ob[h][f&h])break;g||(g=Yh);var l=g[0];0<=a.Eb.indexOf(l)&&(g=Yh,l=g[0]);var m=h="",n=Wh[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
y&63)switch(y=C&7,C&56){case 0:x=fi(y);break;case 8:x="@"+fi(y);break;case 16:7>y?x="("+fi(y)+")+":(C=w.na(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+fi(y)+")+":(C=w.na(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+fi(y)+")";break;case 40:x="@-("+fi(y)+")";break;case 48:C=w.na(r,2);x=J(w,C,0,!0)+"("+fi(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.na(r,2),x="@"+J(w,C)+"("+fi(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.na(e,2)),null==e.F)break;while(e.F!=b.F)}g+=wa(f,24);g+=wa(n,5);h&&(g+=" "+h);if(c||m)g=wa(g,60)+";"+(c||""),g=a.b.w.ub?g+("cycles="+sd(a.b).toString()+" cs="+p(a.b.Kb)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function pi(a,b){switch(b){case "N":a=a.b.Ua();break;case "Z":a=Dd(a.b);break;case "V":a=Cd(a.b);break;case "C":a=Bd(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function qi(a,b){var c="",d=a.b;8>b?(c=fi(b),c+="="+J(a,d.u[b])):13>b?c="A"+(b-8)+"="+J(a,d.Ya[b-8]):16<=b&&20>b?c="S"+(b-16)+"="+J(a,d.Ia[b-16]):20==b?c="PS="+J(a,Tc(d)):21==b&&a.B&&kc(a.B)&&(c="SR="+J(a,a.B.Xa,3));c&&(c+=" ");return c}function ri(a){var b,c="";for(b=0;6>b;b++)c+=qi(a,b);c=c+"\n"+(qi(a,6)+qi(a,7));c+=qi(a,20)+qi(a,21);return c+=pi(a,"T")+pi(a,"N")+pi(a,"Z")+pi(a,"V")+pi(a,"C")}k.pc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function Tg(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=za(n,l,a.pc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({Ze:b,F:c,Wc:d,ga:e,nc:f})}function si(a,b,c){var d=[],e=a.ba(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Wc;if(e>=g&&e<g+h){e=za(f.nc,[e-g],a.pc);0<=e?ti(a,b,e,d):c&&(e=~e,ti(a,b,e-1,d),ti(a,b,e,d));break}}return d}
function ti(a,b,c,d){var e={},f=a.I[b].nc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function ui(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return Qh(a)||a.j("no variables"),!0;if(!c[2])return Qh(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Mh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.j("invalid assignment:"+b);return!1}
function vi(a,b,c){var d=null;if(b=ai(a,b,!0)){a.ba(b);var e=si(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.j(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.F)&&(g=" - "+p(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.j(f),d||(d=f))}else c&&a.j("no symbols")}return d}
function hi(a,b){var c;if(b&&"?"==b[1])a.j("register commands:"),a.j("\tr\tdump registers"),a.j("\trx [#]\tset flag or register x to [#]");else{var d=a.b;null==c&&(c=!0);if(b&&1<b.length){var e=b[1],f=e.indexOf("=");if(0<f)b=e.substr(f+1),e=e.substr(0,f);else if(2<b.length)b=b[2];else{a.j("missing value for "+b[1]);return}f=Mh(a,b);if(void 0===f)return;b=e.toUpperCase();switch(b){case "SP":case "R6":d.u[6]=f&65535;break;case "PC":case "R7":O(d,f);a.L=Y(d.u[7]);break;case "N":d.Z=f?32768:0;break;case "Z":d.aa=
f?0:1;break;case "V":d.U=f?32768:0;break;case "C":d.T=f?65536:0;break;case "SR":if(a.B&&kc(a.B)){ic(a.B,f);break}default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){d.u[b]=f&65535;break}a.j("unknown register: "+e);return}a.C.oa();a.j("updated registers:")}a.j(ri(a));c&&(a.L=Y(d.u[7]),ii(a,J(a,a.L.F)))}}function wi(a,b){b=xa(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.j(c[2]):Ph(a,null,c[2].charCodeAt(0)):Mh(a,b,!0)}
function xi(a,b,c){var d="t"!=b;c=Oh(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);Sa(c,function(){return ub(a,!0)&&a.ib(e,d,!1)},function(){a.B&&a.B.stop&&a.B.stop();a.C.oa();ub(a,!1)})}
function ii(a,b,c,d){if(b=ai(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=Oh(a,c.substr(1)),null!=c&&(d=c);else{d=ai(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.j("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=vb(a,!1)||a.S?a.J:null;var g=null!=f?"cycles":null,h=si(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.j(m)}h[3]&&(g=h[3],f=null);f=oi(a,b,g,f);a.j(f);a.L=b;e-=b.F-l;c++}}}
function ni(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.j(">> "+b):(a.R&&(a.j("ended assemble at "+J(a,a.O.F)),a.L=a.O,a.R=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ia=null;if(wb(a)&&0<b.length){a.R&&(b="a "+J(a,a.O.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
ai(a,g[1],!0);if(v)if(a.O=v,void 0===g[2])a.j("begin assemble at "+J(a,v.F)),a.R=!0,a.C.oa();else{var r;a.j("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Ab(v,r[w],1);a.j(oi(a,a.O))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.j("breakpoint commands:"),a.j("\tbp [a]\tset exec breakpoint at addr [a]"),a.j("\tbr [a]\tset read breakpoint at addr [a]"),a.j("\tbw [a]\tset write breakpoint at addr [a]"),a.j("\tbc [a]\tclear breakpoint at addr [a]"),a.j("\tbl\tlist all breakpoints"),
a.j("\tbn [n]\tbreak after [n] instruction(s)");else{var ia=y.charAt(1);if("l"==ia){var Ja;Ja=0+mi(a,a.f);Ja+=mi(a,a.M);(Ja+=mi(a,a.D))||a.j("no breakpoints")}else if("n"==ia)a.pa=Oh(a,x),a.j("break after "+a.pa+" instruction(s)");else if(void 0===x)a.j("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=ai(a,x,!0),!P))break a;"c"==ia?null==P.F?(Sh(a),a.j("all breakpoints cleared")):ki(a,a.f,P)||ki(a,a.M,P)||ki(a,a.D,P)||a.j("breakpoint missing: "+J(a,P.F)):null!=P.F&&(ei(a,P,C),"p"==ia?a.mb(a.f,
P):"r"==ia?a.mb(a.M,P):"w"==ia?a.mb(a.D,P):a.j("unknown breakpoint command: "+ia))}}}break;case "c":a.Sa&&(a.Sa.value="");break;case "d":a:{var hb,La=g[0],la=g[1],Ma=g[2],Qi=g[3];if("?"==la){var ib="";for(hb in Bb)a.Ja[hb]&&(ib&&(ib+=","),ib+=hb);ib+=",state,symbols";a.j("dump memory commands:");a.j("\tdb [a] [#] dump # bytes at address a");a.j("\tdw [a] [#] dump # words at address a");a.j("\tdd [a] [#] dump # dwords at address a");a.j("\tdh [#] [#] dump # instructions from history");
ib.length&&a.j("dump extension commands:\n\t"+ib)}else if("state"==la){var Bg=yi(a.C,!0);"console"==Ma?console.log(Bg):(a.Sa&&(a.Sa.value=""),a.j(Bg))}else if("symbols"==la)for(var Kd=0;Kd<a.I.length;Kd++){var Ld=a.I[Kd],jb;for(jb in Ld.ga)if("."!=jb.charAt(0)){var Cg=Ld.ga[jb].o;if(void 0!==Cg){var Dg=Ld.ga[jb].l;Dg&&(jb=Dg);a.j(J(a,Cg)+" "+jb)}}}else{if("d"==La){for(hb in Bb)if(g[1]==hb){var Eg=a.Ja[hb];Eg?(g.shift(),g.shift(),Eg(g)):a.j("no dump registered for "+la);break a}la||(La=a.Tb||"dw")}else a.Tb=
La;if("dh"==La){var Fg=la,Gg=Ma,Hg="",Ig=0,fa=a.$,ma=a.H;if(ma.length){var Z=+Fg||a.nb,Pb=+Gg||10;isNaN(Z)?Z=Pb:Hg="more ";Z>ma.length&&(a.j("note: only "+ma.length+" available"),Z=ma.length);fa-=Z;0>fa&&(null==ma[ma.length-1].F?(Z=fa+Z,fa=0):fa+=ma.length);var Md=[];"call"==Gg&&(Pb=1E5,Md=["CALL"]);for(void 0!==Fg&&a.j(Z+" instructions earlier:");0<Pb&&fa!=a.$;){var Jg=ma[fa++];if(null==Jg.F)break;var Qb=Y(Jg.F),Ri=Z--,Kg=oi(a,Qb,"history",Ri);(!Md.length||0<=Kg.indexOf(Md[0]))&&a.j(Kg);Qb.ac&&(fa+=
Qb.ac,Pb-=Qb.ac,Z-=Qb.ac);fa>=ma.length&&(fa=0);a.nb=Z;Ig++;Pb--}}Ig||(a.j("no "+Hg+"history available"),a.nb=void 0)}else{var kb=ai(a,la);if(kb){var Rb=0,Nd=!1,Od="ds"==La;Ma&&(Nd=!0,"l"==Ma.charAt(0)&&(Nd=!1,Ma=Ma.substr(1)||Qi),Rb=Oh(a,Ma)>>>0,65536<Rb&&(Rb=65536));for(var lb="dd"==La?4:"db"==La?1:2,Hc=(Nd?Rb-kb.F:lb*Rb)||128,Pd=Od?16:a.ca,Si=(Hc+Pd-1)/Pd|0||1,Na="";Si--&&0<Hc;){for(var Oa="",Qd="",la=J(a,kb.F),Ic=Pd,Sb=0,Tb=0;0<Ic&&0<Hc;){var mb=1,Jc=1==lb?a.Hb(kb,mb):a.na(kb,mb=2),Sb=Sb|Jc<<
(Tb<<3),Tb=Tb+mb;Tb==lb&&(Od?(Oa&&(Oa+=","),Oa+="0x"+p(Sb,2*lb)):(Oa+=J(a,Sb,lb),Oa+=1==lb?9==Ic?"-":" ":" "),Sb=Tb=0);Ic-=mb;for(Hc-=mb;mb--;)var Rd=Jc&255,Qd=Qd+(32<=Rd&&128>Rd?String.fromCharCode(Rd):"."),Jc=Jc>>8}Na&&(Na+="\n");Na=Od?Na+(Oa+","):Na+(la+" "+Oa+(0==Ic?" "+Qd:""))}Na&&a.j(Na);a.kb=kb}}}}break;case "e":if("else"==g[0])break;var nb,Sd,Td,Ud,Vd=g[0],Wd=g[1];"eb"==Vd?(nb=1,Sd=255,Td=a.Hb,Ud=a.Ab):"e"==Vd||"ew"==Vd?(nb=2,Sd=65535,Td=a.na,Ud=a.gb):Wd=null;if(null==Wd)a.j("edit memory commands:"),
a.j("\teb [a] [...] edit bytes at address a"),a.j("\tew [a] [...] edit words at address a");else{var Kc=ai(a,Wd);if(Kc)for(var Lc=2;Lc<g.length;Lc++){var Ub=Mh(a,g[Lc]);if(void 0===Ub){a.j("unrecognized value: "+g[Lc]);break}Ub&~Sd&&a.j("warning: "+p(Ub)+" exceeds "+nb+"-byte value");a.j("changing "+J(a,Kc.F)+(F(a,64)?"":" from "+J(a,Td.call(a,Kc),nb))+" to "+J(a,Ub,nb));Ud.call(a,Kc,Ub,nb)}}break;case "g":a:{var Lg=g[1],Ti=b;if(void 0!==Lg){var Xd=ai(a,Lg,!0);if(!Xd)break a;ei(a,Xd,Ti);a.mb(a.f,
Xd,!0)}a.hb(!0,c)}break;case "h":a.w.W?(c||a.j("halting"),a.da()):vb(a,!0)||c||a.j("already halted");break;case "i":if("if"==g[0]){var Yd;var Vb=b.substr(2),Vb=xa(Vb);Mh(a,Vb)?(c||a.j("true: "+Vb),Yd=!0):(c||a.j("false: "+Vb),Yd=!1);Yd||(d=!1);break}f=!0;break;case "k":var Ui=g[0];if("?"==g[1])a.j("stack trace commands:"),a.j("\tk\tshow frame addresses"),a.j("\tks\tshow symbol information");else{var Zd=0,$d=Y(),Wb=Y(a.b.u[6]);for(a.j("stack trace for "+J(a,Wb.F));10>Zd;){for(var Pa=null,Vi=256;65536>
Wb.F>>>0;){$d.F=a.na(Wb,2);if(null==Wb.F||!Vi--)break;if(!($d.F&1)){for(var Wi=a,Mc=$d,Mg=null,Xb=Mc.F,Ng=Xb,ae=1;6>=ae&&Xb;ae++){if(2<ae){Mc.F=Xb;var Nc=oi(Wi,Mc);if(0<=Nc.indexOf("JSR")){var Og=Nc.indexOf(" ");if(Xb+(Nc.indexOf(" ",Og+1)-Og-1)/2==Ng){Mg=Nc;break}}}Xb-=2}Mc.F=Ng;if(Pa=Mg)break}}if(!Pa||null==Pa)break;var Pg=null;if("ks"==Ui){var Qg=Pa.match(/[0-9A-F]+$/);Qg&&(Pg=vi(a,Qg[0]))}Pa=wa(Pa,50)+" ;"+(Pg||"stack="+J(a,Wb.F));a.j(Pa);Zd++}Zd||a.j("no return addresses found")}break;case "l":if("ln"==
g[0]){vi(a,g[1],!0);break}f=!0;break;case "m":a:{var na,oa=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Ca=0;if("all"==G)Ca=1878917119,G=null;else if("on"==G)oa=!0,G=null;else if("off"==G)oa=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(na in Bb)if(G==na){Ca=Bb[na];oa=!!(a.ma&Ca);break}if(!Ca){a.j("unknown message category: "+G);break a}}if(Ca)if("on"==g[2])a.ma|=Ca,oa=!0;else if("off"==g[2]&&(a.ma&=~Ca,oa=!1,1073741824==Ca)){for(var be=0;be<a.va.length;be++)a.j(a.va[be]);
a.va=[]}}var Xi=0,Yb="";for(na in Bb)if(!G||G==na){var Yi=!!(a.ma&Bb[na]);if(null===oa||oa==Yi)Yb&&(Yb+=","),++Xi%10||(Yb+="\n\t"),"key"==na&&(na="keys"),Yb+=na}void 0===G&&a.j("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.j((null!==oa?oa?"messages on: ":"messages off: ":"message categories:\n\t")+(Yb||"none"));Th(a)}break;case "p":if("print"==g[0]){wi(a,b.substr(5));break}var Zi="pr"==g[0]?1:0;if(a.S)a.j("step in progress");else{var Rg=Y(a.b.u[7]);a.Hb(Rg);a.S?(a.mb(a.f,
Rg,!0),a.hb()||(a.C&&a.C.sb(),a.S=0)):xi(a,Zi?"tr":"t")}break;case "r":if("reset"==b){a.C&&a.C.reset();break}hi(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var Zb=+g[2];if(8==Zb||10==Zb||16==Zb)a.ca=Zb;else{a.j("invalid base: "+Zb);break}}a.j("default base: "+a.ca);break;case "cs":var $b;void 0!==g[3]&&($b=+g[3]);switch(g[2]){case "int":a.b.vb=$b;break;case "start":a.b.Lb=$b;break;case "stop":a.b.wb=$b;break;default:a.j("unknown cs option");break a}void 0!==$b&&pd(a.b);a.j("checksums "+
(a.b.w.ub?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(td(a.b,+g[2])||a.j("warning: using 1x multiplier, previous target not reached"));a.j("target speed: "+(a.b.pb.toFixed(2)+"Mhz")+" ("+a.b.eb+"x)");break;default:if(g[1]){a.j("unknown option: "+g[1]);break}case "?":a.j("debugger options:"),a.j("\tbase #\t\tset default base to #"),a.j("\tcs int #\tset checksum cycle interval to #"),a.j("\tcs start #\tset checksum cycle start count to #"),a.j("\tcs stop #\tset checksum cycle stop count to #"),
a.j("\tsp #\t\tset speed multiplier to #")}break;case "t":xi(a,g[0],g[1]);break;case "u":ii(a,g[1],g[2],8);break;case "v":if("var"==g[0]){ui(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.j("PDPjs version 1.30.3 ("+a.b.Wa+",RELEASE"+(zb?",TYPEDARRAYS":",LONGARRAYS")+")");a.j(window?window.navigator.userAgent:"");break}f=!0;break;case "?":if(g[1]){wi(a,b.substr(1));break}var ce="commands:",de;for(de in Vh)ce+="\n"+wa(de,9)+Vh[de];we(a)||(ce+="\nnote: history disabled if no exec breakpoints");a.j(ce);
break;default:f=!0}f&&(a.j("unknown command: "+b),d=!1)}}catch(Sg){a.j("debugger error: "+(Sg.stack||Sg.message)),d=!1}return d}function rd(a,b,c){b=Kh(a,b,c);for(var d in b)if(!ni(a,b[+d]))return!1;return!0}Za(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new Rh(d);B(d,c)}});
function zi(a,b,c){t.call(this,"Computer",a,zi,67108864);this.w.ha=!1;Ai(this,b);this.L=nd(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=Bi;this.I=null;this.D=this.R=!1;this.$=nd(this,"url")||"";(Math.random()+.1).toString(36);this.g=Ci(this);if(this.b=tb("CPU",this.id)){this.i=tb("Debugger",this.id);this.v=new mc({id:this.Qa+".bus",busWidth:this.X},this.b,this.i);var d,e=rb(this.id);if((this.B=tb("Panel",this.id))&&this.B.Sa)for(b=0;b<e.length;b++)d=e[b],d.P=this.B.P,d.j=this.B.j,
d.Sa=this.B.Sa;this.j("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.j("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ea&&d.Ea(this,this.v,this.b,this.i);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=nd(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=Bi),this.f&&(this.J=
new N(this,"1.30.3"),Di(this.J)?b=null:delete this.J);!b&&this.f&&(b=Ei(this))&&(this.D=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.P("Unable to load machine state from server (error "+c+(b?": "+xa(b):"")+")")):(g.I=b,g.R=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Fi(this,this.Mb)}else q("Unable to find CPU component")}z(zi);var Bi=0;
function Ai(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.S=b}function nd(a,b,c){var d=b.toLowerCase(),d=db[b]||db[d];void 0===d&&a.S&&(d=a.S[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Fi(a,b,c){for(var d=rb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!wb(f)){wb(f,function(){Fi(a,b,c)});return}}b.call(a,c)}
function Gi(a,b){var c=new N(a,"1.30.3","validate");if(Di(c)&&Hi(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.P("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=zi.prototype;
k.Mb=function(a){void 0===a&&(a=this.f||(this.I?1:Bi));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.J||new N(this,"1.30.3");if(-1==a)b=!0;else if(a>Bi){if(Di(d,this.I)){this.A=new N(this,"1.30.3","failsafe");Di(this.A)&&(Ii(this,d),a=2,Ji(this.A));this.A.set("timestamp",Ba());Ki(this.A);var e=this.f&&!this.D;if(1==a||Ga("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Hi(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Di(d,g):("error"==
f&&"no machine state"!=g?(this.P("Error: "+g),"unable to verify user"==g&&(Qa("user",""),this.g=null)):this.j(f+": "+g),Ji(d),Di(d)?(c=Hi(d),e=!0):c=!1))}e&&Gi(this,c?d:null)}else 2==a&&d.clear()}else Gi(this);delete this.I;delete this.J}e=rb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Li(this,g,d,b,c));b=[d,a,c];-1!=a?Fi(this,this.qc,b):this.qc(b)}};
function Li(a,b,c,d,e){if(!b.w.ha){b.w.ha=!0;if(b.Ga){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ga(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.R?(c.clear(),a.f=Bi,window&&window.location.reload()):a.O=!0,b.Ga(null),e=!1)}if(!d&&b.vc)for(a=b.vc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.qc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.w.ha=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Li(this,this.b,b,c,a),this.oa(),this.b.tb());this.O&&(Ii(this,b),b.clear());!c&&this.A&&(this.A.clear(),delete this.A);this.C=0};
function Ii(a,b){if(Ga("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.$;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function yi(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new N(a,"1.30.3"),g=new N(a,"1.30.3","validate"),h=Ba();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Fa&&(c&&a.b.da(),d=a.b.Fa(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.w.ha=!1,!1===d&&(e=null)));for(var h=rb(a.id),l=0;l<h.length;l++){var m=h[l];m.w.ha&&(m.Fa&&(d=m.Fa(b,c),"object"===typeof d&&f.set(m.id,
d)),c&&(m.w.ha=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Mi(a,a.g,f.toString()),Ki(g)&&Ki(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.w.ha=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
k.reset=function(){this.v&&this.v.reset&&(E(this,"Resetting "+this.v.type),this.v.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=rb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.v&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.oa(-1)};k.start=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.oa(-1)};
k.stop=function(a,b){for(var c=rb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.oa(-1)};
k.oa=function(a){if(this.b){var b=this.b,c=b.G.speed;c&&(c.textContent=b.w.W&&b.ca?b.ca.toFixed(2)+"Mhz":"Stopped")}if(this.B&&(b=this.B,b.H)){var c=b.b.w.W,d=!!(b.b.K&4);if(!(0<a&&60>(b.J+=a))){for(var e=0;e<b.b.u.length;e++)ac(b,"R"+e,b.b.u[e]);e=Tc(b.b);ac(b,"PS",e);ac(b,"NF",e&8?1:0,1);ac(b,"ZF",e&4?1:0,1);ac(b,"VF",e&2?1:0,1);ac(b,"CF",e&1?1:0,1);b.J=0}hc(b,0<a&&c&&!d?b.b.u[7]:b.f);gc(b,b.D);a=b.b.Va?b.b.qb&16?1:2:4;jc(b,"B22",a&1);jc(b,"B18",a&2);jc(b,"B16",a&4)}};
k.sa=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.w.ha?yi(d,!1,!0):Fi(d,d.Mb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.w.ha&&!d.C)if(d.f&&!d.H){var a=Ga("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");yi(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.rc=!0),d.Mb(Bi),d.rc=!1)}else d.reset(),d.b&&d.b.tb()},!0;case "save":if(ta(Fa(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.G[b]=c,c.onclick=function(){var a=Ci(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=yi(d,b);b?Mi(d,a,c):d.P("Resume disabled, machine state not saved")}},!0}return!1};
function Ci(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Ni(a,c))||a.P("The user ID is invalid.")):b&&a.P("Browser local storage is not available"));return c}
function Ni(a,b){a.g=null;b=Da(Fa()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Qa("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Ei(a){var b=null;a.g&&(b=Fa()+"/api/v1/user?req=load&user="+a.g+"&state="+Oi(a,"1.30.3"));return b}
function Mi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=Oi(a,"1.30.3");d.data=c;b=Da(Fa()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.P("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.P(c),Qa("user",""),a.g=null)}}
function eh(a){var b;a=rb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.sb=function(a){if(this.Sa){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Sa.focus();!a&&window&&window.scrollTo(b,c)}};Za(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new zi(g,d,!0);B(g,f);g.L&&Fi(g,g.Mb)}});
Ua.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.ca&&!c.w.ha&&c.Mb(-1)}});Ua.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=tb("Computer",c.id))&&c.w.ha&&yi(c,!(!c.f||c.H),!0)}});function N(a,b,c){this.id=a.id;this.key=Oi(a,b,c);this.i=a.i;Ji(this,a.Yc)}function Oi(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
N.prototype={constructor:N,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Ji(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function Ji(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Ki(a){var b=!0;if(Ia()){var c=JSON.stringify(a[a.id]);Qa(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Hi(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Di(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ia()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var Pi=0;
function $i(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):aj(h,a,b,c,d,e,f)})}
function aj(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(qb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?bj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function bj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);bj(a,b,c)}})}else c(a,null)}
function cj(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=va(a))}function f(a){e("Error: "+a);l&&(--Pi||ab(!0));l=!1}var g,h,l=!0;Pi++;pb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?$i(c,null,null,!1,e,function(d,l){l?(qb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--Pi||ab(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--Pi||ab(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?$i(b,a,d,!0,e,m):aj(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){ab(!1);return cj(a,b,c,d)};window.enableEvents=ab;window.sendEvent=bb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map
function Zh(a,b,c){var d;if(b){b=$h(a,b);for(var e=0,f=!1,g=b,h=[],l=[],m=b.split(/(\|\||&&|\||^|&|!=|==|>=|>>>|>>|>|<=|<<|<|-|\+|%|\/|\*)/);e<m.length;){var n=m[e++],v=n.length,n=ya(n);if(!n){f=!0;break}n=ai(a,n,null,!1===c);if(void 0===n){f=!0;c=!1;break}h.push(n);if(e==m.length)break;var n=m[e++],r=n.length;l.length&&Wh[n]<Wh[l[l.length-1]]&&Yh(h,l,1);l.push(n);b=b.substr(v+r)}Yh(h,l)&&1==h.length||(f=!0);f?c&&a.i("error parsing '"+g+"' at character "+(g.length-b.length)):(d=h.pop(),c&&bi(a,null,
d))}return d}function $h(a,b){for(var c,d=a.Ea?"(":"{",e=a.Ea?")":"}",f=new RegExp(a.Ea?"\\((.*?)\\)":"\\{(.*?)\\}");(c=b.match(f))&&!(0<=c[1].indexOf(d));){var g=Zh(a,c[1]);b=b.replace(d+c[1]+e,null!=g?J(a,g):"undefined")}for(;(c=b.match(/\[(.*?)]/))&&!(0<=c[1].indexOf("["));)b=b.replace("["+c[1]+"]","unimplemented");for(a=b;b=a.match(/\$([a-z]+)/i);){c=null;switch(b[1].toLowerCase()){case "ops":c=0}if(null==c)break;a=a.replace(b[0],c.toString())}return a}
function ai(a,b,c,d){var e;null!=b?(e=a.wc(b),0<=e?e=a.xc(e):(e=a.X[b],null==e&&(e=ma(b,a.ca))),null!=e||d||a.i("invalid "+(c?c:"value")+": "+b)):d||a.i("missing "+(c||"value"));return e}
function bi(a,b,c){var d,e=!1;if(void 0!==c){e=!0;d=c;var f=0,g="";if(!f||4<f)f=4;for(var h=0;h<f;h++){g&&(g=","+g);var l=d&255,m=8,n="";m?32<m&&(m=32):m=32;if(null==l||isNaN(l))for(;0<m--;)n="?"+n;else for(;0<m--;)n=(l&1?"1":"0")+n,l>>=1;g=n+g;d>>=8}d=p(c,0,!0)+" "+c+". "+na(c,0,!0)+" "+("0b"+g);32<=c&&127>c&&(d+=" '"+String.fromCharCode(c)+"'")}a.i((null!=b?b+": ":"")+d);return e}function ci(a,b){if(b)return bi(a,b,a.X[b]);var c=0;for(b in a.X)bi(a,b,a.X[b]),c++;return 0<c}
function J(a,b,c,d){switch(a.ca){case 8:a=na(b,3*c-(2<c?1:0));break;case 10:a=b.toString();break;default:a=p(b,2*c)}d?d=a.replace(/^0+([0-9A-F]+)$/i,"$1"):d=a;return d}
function di(a){Vh.call(this,a);this.lb=!1;this.Ea=!0;this.L=Y(0);this.mb=Y(0);this.S=Y(0);this.I=[];this.f=this.M=this.D=[];ei(this);this.xa=0;fi(this);this.Ma={};gi(this,a.messages);this.bb=a.commands;var b=this;window?void 0===window.pdp11&&(window.pdp11=function(a){return Ad(b,a)}):void 0===global.pdp11&&(global.pdp11=function(a){return Ad(b,a)})}z(di,Vh);
var hi={"?":"help/print","a [#]":"assemble","b [#]":"breakpoint",c:"clear output","d [#]":"dump memory","e [#]":"edit memory","g [#]":"go [to #]",h:"halt","if":"eval expression","int [#]":"request interrupt",k:"stack trace",ln:"list nearest symbol(s)",m:"messages",p:"step over",print:"print expression",r:"dump/set registers",reset:"reset machine",s:"set options","t [#]":"trace","u [#]":"unassemble","var":"assign variable",ver:"print version"},ii=".WORD ADC ADCB ADD ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT BHI BIC BICB BIS BISB BIT BITB BLE BLOS BLT BMI BNE BPL BPT BR BVC BVS CCC CLC CLCN CLCV CLCVN CLCVZ CLCZ CLCZN CLN CLR CLRB CLV CLVN CLVZ CLVZN CLZ CLZN CMP CMPB COM COMB DEC DECB INC INCB HALT JMP JSR MARK MFPD MFPI MFPS MOV MOVB MTPD MTPI MTPS NEG NEGB NOP RESET ROL ROLB ROR RORB RTI RTS SBC SBCB SCC SEC SECN SECV SECVN SECVZ SECZ SECZN SEN SEV SEVN SEVZ SEVZN SEZ SEZN SUB SWAB SXT TST TSTB WAIT MUL DIV ASH ASHC XOR SOB EMT TRAP SPL IOT RTT MFPT".split(" "),
ji={SP:6,PC:7,PS:20,IR:21,ER:22,SL:23,MMR0:24,MMR1:25,MMR2:26,MMR3:27,AR:28,DR:29,SR:30},ki={61440:{4096:[62,4032,63],8192:[47,4032,63],12288:[18,4032,63],16384:[14,4032,63],20480:[16,4032,63],24576:[3,4032,63],36864:[63,4032,63],40960:[48,4032,63],45056:[19,4032,63],49152:[15,4032,63],53248:[17,4032,63],57344:[94,4032,63]},65024:{2048:[57,448,63],28672:[100,63,448],29184:[101,63,448],29696:[102,63,448],30208:[103,63,448],30720:[104,448,63],32256:[105,448,8192]},65280:{256:[27,4096],512:[24,4096],
768:[10,4096],1024:[11,4096],1280:[22,4096],1536:[12,4096],1792:[20,4096],32768:[25,4096],33024:[23,4096],33280:[13,4096],33536:[21,4096],33792:[28,4096],34048:[29,4096],34304:[8,4096],34560:[9,4096],34816:[106,32768],35072:[107,32768]},65472:{64:[56,63],192:[95,63],2560:[39,63],2624:[49,63],2688:[53,63],2752:[51,63],2816:[67,63],2880:[1,63],2944:[77,63],3008:[97,63],3072:[73,63],3136:[71,63],3200:[6,63],3264:[4,63],3328:[58,24576],3392:[60,63],3456:[65,63],3520:[96,63],35328:[40,63],35392:[50,63],
35456:[54,63],35520:[52,63],35584:[68,63],35648:[2,63],35712:[78,63],35776:[98,63],35840:[74,63],35904:[72,63],35968:[7,63],36032:[5,63],36096:[66,63],36160:[59,63],36224:[64,63],36288:[61,63]},65528:{128:[76,7],152:[108,12288]},65535:{0:[55],1:[99],2:[75],3:[26],4:[109],5:[70],6:[110],7:[111],160:[69],161:[31],162:[41],163:[33],164:[45],165:[36],166:[43],167:[35],168:[38],169:[32],170:[42],171:[34],172:[46],173:[37],174:[44],175:[30],176:[69],177:[80],178:[88],179:[82],180:[92],181:[85],182:[90],
183:[84],184:[87],185:[81],186:[89],187:[83],188:[93],189:[86],190:[91],191:[79]}},li=[0],mi=[58,60,65,96,108,110,100,101,102,103,104,105,59,64];k=di.prototype;
k.Ia=function(a,b,c,d){this.v=b;this.C=a;this.b=c;this.w=a.w;(a=wd(a,"messages"))&&gi(this,a);this.wb=ki;this.Ib=1145>this.b.Xa?mi:[];Vc(this,64,function(a){a:{var b=d.v.Y,c=a[0],e=a=0,l=b.length;if(c){a=d.aa(ni(d,c));if(-1===a){d.i("invalid address: "+c);break a}e=a>>>d.v.ka;l=1}d.i("blockid physical blockaddr used size type");d.i("-------- --------- ---------- ------ ------ ----");for(var c=-1,m=0;l--;){var n=b[e];n.type==c?m++||d.i("..."):(c=n.type,m=Dc[c],n&&d.i(p(n.id,8)+" %"+
p(e<<d.v.ka,8)+" %%"+p(n.F,8)+" "+p(n.Tb,4,!0)+" "+p(n.size,4,!0)+" "+m),c!=id&&(c=-1),m=0);a+=d.v.Ca;e++}}});H(this)};
k.wa=function(a,b,c){var d=this;switch(b){case "debugInput":return this.pa=this.G[b]=c,c.onkeydown=function(a){var b;if(13==a.keyCode)b=c.value,c.value="",Ad(d,b,!0);else if(27==a.keyCode)c.value=b="";else if(38==a.keyCode?(b=null,d.B<d.g.length-1&&(b=d.g[++d.B])):40==a.keyCode&&(0<d.B?b=d.g[--d.B]:(b="",d.B=-1)),null!=b){var e=b.length;c.value=b;c.setSelectionRange(e,e)}null!=b&&a.preventDefault&&a.preventDefault()},!0;case "debugEnter":return this.G[b]=c,Ua(c,function(){if(d.pa){var a=d.pa.value;
d.pa.value="";Ad(d,a,!0);return!0}return!1}),!0;case "step":return this.G[b]=c,Ua(c,function(a){var b=!1;wb(d,!0)||(vb(d,!0),b=d.kb(a?1:0,null),vb(d,!1));return b}),!0}return!1};k.ub=function(a){if(this.pa){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.pa.focus();!a&&window&&window.scrollTo(b,c)}};k.aa=function(a){a=a&&a.F;null==a&&(a=-1);return a};k.Yb=function(a,b){var c=255,d=this.aa(a,!1,1);-1!==d&&(c=a.Wb?this.v.Zb(d):this.b.Zb(d),b&&oi(a,b));return c};
k.ma=function(a,b){var c=65535,d=this.aa(a,!1,2);-1!==d&&(c=a.Wb?this.v.fb(d):this.b.fb(d),b&&oi(a,b));return c};k.Eb=function(a,b,c){var d=this.aa(a,!0,1);-1!==d&&(a.Wb?this.v.tb(d,b):this.b.tb(d,b),c&&oi(a,c),this.C.sa(-1))};k.ib=function(a,b,c){var d=this.aa(a,!0,2);-1!==d&&(a.Wb?this.v.Fb(d,b):this.b.Fb(d,b),c&&oi(a,c),this.C.sa(-1))};function Y(a,b){return{F:a,Wb:b,Ra:!1}}k.nc=function(a,b){a.F=b;a.Ra=!1;return a};function pi(a){return[a.F,a.Ra]}function qi(a){return{F:a[0],Ra:a[1]}}
function ni(a,b,c){var d,e=(c?a.L:a.mb).F;c=!1;if(void 0!==b){b=$h(a,b);"%"==b.charAt(0)&&(c=!0,b=b.substr(1));d=b;var f;if(d.match(/^[a-z_][a-z0-9_]*$/i))for(d=d.toUpperCase(),e=0;e<a.I.length;e++){var g=a.I[e].ga[d];if(void 0!==g){d=g.o;void 0!==d&&(f=Y(d));break}}if(d=f)return d;e=Zh(a,b,void 0)}null!=e&&(d=Y(e,c));return d}function ri(a,b,c){c&&(c=c.match(/(['"])(.*?)\1/))&&(b.Pc=Xh(a,b.Kc=c[2]))}function oi(a,b){null!=a.F&&(a.F+=b||1)}
function gi(a,b){a.j=a;a.la=a.Tc=536870912;a.ja=null;a.Aa=[];b=Xh(a,b.replace("keys","key").replace("kbd","keyboard"),!1,"|");if(b.length)for(var c in Cb){var d;a:if(d=void 0,Array.prototype.indexOf)d=b.indexOf(c,d);else{d=d||0;0>d&&(d+=b.length);0>d&&(d=0);for(var e=b.length;d<e;d++)if(d in b&&b[d]===c)break a;d=-1}0<=d&&(a.la|=Cb[c],a.i(c+" messages enabled"))}}function Vc(a,b,c){for(var d in Cb)if(b==Cb[d]){a.Ma[d]=c;break}}
k.wc=function(a){a=a.toUpperCase();var b=ji[a];null==b&&(b=-1,"R"==a.charAt(0)&&(b=+a.charAt(1),0>b||7<b))&&(b=-1);return b};function si(a){return 6>a?"R"+a:6==a?"SP":"PC"}
k.xc=function(a){var b;if(0<=a)if(8>a)b=this.b.u[a];else if(16>a)b=this.b.Za[a-8];else if(20>a)b=this.b.La[a-16];else{var c=this.b,d=this.w;switch(a){case 20:b=bd(this.b);break;case 21:b=c.Rb;break;case 22:b=c.oa;break;case 23:b=c.sb;break;case 24:b=Wc(c);break;case 25:b=Yc(c);break;case 26:b=Zc(c);break;case 27:b=c.Ta;break;case 28:d&&(b=d.va);break;case 29:d&&(b=d.rb);break;case 30:d&&mc(d)&&(b=d.Ya)}}return b};
k.message=function(a,b){b&&(a+=" @"+J(this,Y(this.b.qa&65535).F));if(this.la&1073741824)this.Aa.push(a);else if(!this.ja||a!=this.ja){this.ja=a;b=!1;if(this.la&-2147483648&&this.b&&(b=this.b.A.W)||wb(this,!0))this.da(),b&&(a+=" (cpu halted)");this.i(a);this.b&&(a=this.b,Ed(a),a.Aa=0,a.sa())}};
function fi(a){var b;if(!He(a))a.H&&a.H.length&&a.i("instruction history buffer freed"),a.ba=0,a.H=[];else if(!a.H||!a.H.length){a.H=Array(1E3);for(b=0;b<a.H.length;b++)a.H[b]=Y();a.ba=0;a.i("instruction history buffer allocated")}}k.jb=function(a,b){if(!ti(this,b))return!1;this.b.jb(a);return!0};
k.kb=function(a,b,c){if(!ti(this))return!1;null===b&&(b=!this.yb||"tr"==this.yb);this.K=0;a||He(this)&&Ie(this,this.b.u[7],0);try{a=Fd(this.b,a);var d=this.b.kb(a);0<d&&(Sb(this.b,d),this.K+=d,Tb(this.b,d,!0),Ub(this.b,d),this.Ba++)}catch(e){"number"!=typeof e&&(this.K=0,zb(this.b,e.stack||e.message))}!1!==c&&(this.w&&this.w.stop&&this.w.stop(),this.C.sa(-1));zd(this,b||!1);return 0<this.K};k.da=function(a){this.b&&this.b.da(a)};
function zd(a,b){if(a.lb){void 0===b&&(b=!0);var c;c=a.b;if(c=c.J&8?c.md|c.ld<<8:0){var d=c>>8;a.i("trapped to "+J(a,c&255,1)+" ("+(0>d?Bb[-d]:J(a,d))+")")}a.L=Y(a.b.u[7]);b&&1!=a.O?ui(a):vi(a)}}function ti(a,b){var c;(c=!a.b||!xb(a.b))||(c=a.b,c.A.ia?c=!0:(c.i(c.toString()+" not powered"),c=!1),c=!c);return c||a.b.A.W?(b||a.i("cpu busy or unavailable, command ignored"),!1):!yb(a.b)}k.Ka=function(a,b){return!b&&(this.reset(!0),a&&this.restore&&!this.restore(a))?!1:!0};
k.Ja=function(a,b){b&&this.i(a?"suspending":"shutting down");return a?this.save():!0};k.reset=function(a){fi(this);this.Ba=0;this.ja=null;this.K=0;this.L=Y(this.b.u[7]);this.A.W=!1;wi(this);a||zd(this)};k.save=function(){var a=new O(this);a.set(0,pi(this.L));a.set(1,pi(this.S));a.set(2,[this.g,this.T,this.la]);a.set(3,this.I);return a.data()};
k.restore=function(a){var b=0;void 0!==a[2]&&(this.L=qi(a[b++]),this.S=qi(a[b++]),this.g=a[b][0],"string"==typeof this.g&&(this.g=[this.g]),this.T=a[b][1],this.la|=a[b][2]);a[3]&&(this.I=a[3]);return!0};k.start=function(a,b){this.O||this.i("running");this.A.W=!0;this.Jb=a;this.Kb=b};
k.stop=function(a,b){if(this.A.W){this.A.W=!1;this.K=b-this.Kb;if(!this.O){b="stopped";if(this.K){a-=this.Jb;var c=0<a?Math.round(1E3*this.K/a):0;b+=" (";He(this)&&(b+=this.Ba+" instructions, ",this.Ba=0);b+=this.K+" cycles, "+a+" ms, "+c+" hz)"}else F(this,-2147483648)&&(b+=" (use the 't' command to execute blocked faults)");this.i(b)}zd(this,!0);this.ub();wi(this,this.b.u[7]);this.ja=null}};function He(a){return 1<a.f.length||!!a.xa}
function Ie(a,b,c){var d=-1;c||(d=a.b.fb(b),0==d&&(b=Qd(a.b,2)));if(0<c&&(a.xa&&!--a.xa||rd(a,b,1,a.f)))return!0;0<=c&&a.H.length&&(a.Ba++,0>d&&(d=a.b.fb(b)),65535!=(d&65535)&&(a.nc(a.H[a.ba],b),++a.ba==a.H.length&&(a.ba=0)));return!1}function Nf(a){var b=a.b;if(b.A.W)throw Q(b,a.b.qa&65535),a.da(),-1;return!1}
function ei(a){var b,c;a.f=["bp"];if(a.M)for(b=1;b<a.M.length;b++){c=a.M[b];var d=a.v;c=a.aa(c);sd(d.Y[c>>>d.ka],!1)}a.M=["br"];if(a.D)for(b=1;b<a.D.length;b++)c=a.D[b],d=a.v,c=a.aa(c),sd(d.Y[c>>>d.ka],!0);a.D=["bw"];a.nb=0}k.ob=function(a,b,c){var d=!0;c||xi(this,a,b,!1,!0);if(a!=this.f){var e=this.aa(b);if(-1===e)this.i("invalid address: "+J(this,b.F)),d=!1;else{var f=this.v;f.Y[e>>>f.ka].ob(e&f.v,a==this.D)}}d&&(a.push(b),c?b.Ra=!0:(yi(this,a,a.length-1,"set"),fi(this)));return d};
function xi(a,b,c,d,e){var f=!1;c=a.aa(c);for(var g=1;g<b.length;g++){var h=b[g];if(c==a.aa(h)&&(!d||h.Ra)){f=!0;h.Ra||e||yi(a,b,g,"cleared");b.splice(g,1);b!=a.f&&(d=a.v,sd(d.Y[c>>>d.ka],b==a.D));h.Ra||fi(a);break}}return f}function zi(a,b){for(var c=1;c<b.length;c++)yi(a,b,c);return b.length-1}function yi(a,b,c,d){c=b[c];a.i(b[0]+" "+J(a,c.F)+(d?" "+d:c.Kc?' "'+c.Kc+'"':""))}
function wi(a,b){if(void 0!==b)rd(a,b,1,a.f,!0),a.O=0;else for(b=1;b<a.f.length;b++){var c=a.f[b];if(c.Ra){if(!xi(a,a.f,c,!0))break;b=0}}}
function rd(a,b,c,d,e){var f=!1;if(!a.nb++)for(var g=1;!f&&g<d.length;g++){var h=d[g];if(!e||h.Ra)for(var l=a.aa(h)&65535,m=0;m<c;m++)if(b+m==l){var n,f=!0;h.Ra&&(xi(a,d,h,!0),e=!0);if(n=h.Pc){for(var f=!1,v=0;v<n.length;v++)if(!Ai(a,n[v],!0)){if(n[v].indexOf("if")){f=!0;break}for(var r=v+1;r<n.length&&n[r].indexOf("else");r++)v++;if(r==n.length){f=!0;break}}a.b.A.W||(f=!0)}if(f){e||yi(a,d,g,"hit");break}}}a.nb--;return f}
function Bi(a,b,c,d){var e=Y(b.F),f=a.ma(b,2),g,h;for(h in a.wb)if(g=a.wb[h][f&h])break;g||(g=li);var l=g[0];0<=a.Ib.indexOf(l)&&(g=li,l=g[0]);var m=h="",n=ii[l],v=g.length-1;l||v||(h=J(a,f));for(l=1;l<=v;l++){var r=g[l];if(void 0!==r){var w;w=a;var y=r,r=b,x="",C=y&61440;if(4096==C)r=r.F+((f&255)<<24>>23)&65535,x=J(w,r);else if(8192==C)r=r.F-((f&63)<<1)&65535,x=J(w,r);else if(12288==C)x=J(w,f&7,1);else if(24576==C)x=J(w,f&63,1);else if(32768==C)x=J(w,f&255,1);else if(C=f&y,y&4032&&(C>>=6,y>>=6),
y&63)switch(y=C&7,C&56){case 0:x=si(y);break;case 8:x="@"+si(y);break;case 16:7>y?x="("+si(y)+")+":(C=w.ma(r,2),x="#"+J(w,C,0,!0));break;case 24:7>y?x="@("+si(y)+")+":(C=w.ma(r,2),x="@#"+J(w,C,0,!0));break;case 32:x="-("+si(y)+")";break;case 40:x="@-("+si(y)+")";break;case 48:C=w.ma(r,2);x=J(w,C,0,!0)+"("+si(y)+")";7==y&&(x=J(w,C+r.F&65535));break;case 56:C=w.ma(r,2),x="@"+J(w,C)+"("+si(y)+")",7==y&&(x="@"+J(w,C+r.F&65535))}w=x;if(!w||!w.length){h="INVALID";break}"string"!=typeof w&&(m=w[1],w=w[0]);
0<h.length&&(h+=",");h+=w||"???"}}f="";g=J(a,e.F)+":";if(-1!==e.F&&-1!==b.F){do if(f+=" "+J(a,a.ma(e,2)),null==e.F)break;while(e.F!=b.F)}g+=xa(f,24);g+=xa(n,5);h&&(g+=" "+h);if(c||m)g=xa(g,60)+";"+(c||""),g=a.b.A.xb?g+("cycles="+Bd(a.b).toString()+" cs="+p(a.b.Ob)):g+(null!=d?"="+d.toString():""),m&&(g+=" @"+m);return g}function Ci(a,b){switch(b){case "N":a=Od(a.b);break;case "Z":a=Nd(a.b);break;case "V":a=Md(a.b);break;case "C":a=Ld(a.b);break;default:a=0}return b.charAt(0)+(a?"1":"0")+" "}
function Z(a,b){var c="",d=a.b;if(8>b)c=si(b),c+="="+J(a,d.u[b]);else if(13>b)c="A"+(b-8)+"="+J(a,d.Za[b-8]);else if(16<=b&&20>b)c="S"+(b-16)+"="+J(a,d.La[b-16]);else switch(b){case 20:c="PS="+J(a,bd(d));break;case 21:c="IR="+J(a,d.Rb);break;case 22:c="ER="+J(a,d.oa);break;case 23:c="SL="+J(a,d.sb);break;case 24:c="MMR0="+J(a,Wc(d));break;case 25:c="MMR1="+J(a,Yc(d));break;case 26:c="MMR2="+J(a,Zc(d));break;case 27:c="MMR3="+J(a,d.Ta);break;case 28:a.w&&(c="AR="+J(a,a.w.va,3));break;case 29:a.w&&
(c="DR="+J(a,a.w.rb));break;case 30:a.w&&mc(a.w)&&(c="SR="+J(a,a.w.Ya,3))}c&&(c+=" ");return c}function Di(a,b){var c,d="";for(c=0;6>c;c++)d+=Z(a,c);d=d+"\n"+(Z(a,6)+Z(a,7));d+=Z(a,20)+Z(a,21)+Z(a,23);d+=Ci(a,"T")+Ci(a,"N")+Ci(a,"Z")+Ci(a,"V")+Ci(a,"C");b&&(b=d,c=""+(Z(a,24)+Z(a,25)),c+=Z(a,26)+Z(a,27)+Z(a,22),c=c+"\n"+(Z(a,30)+Z(a,28)+Z(a,29)),d=b+("\n"+c));return d}k.sc=function(a,b){return a[0]>b[0]?1:a[0]<b[0]?-1:0};
function fh(a,b,c,d,e){var f=[],g;for(g in e){var h=e[g];"number"==typeof h&&(e[g]=h={o:h});var l=h.o,m=h.a;if(void 0!==l){var n=f,l=[l>>>0,g],v=Aa(n,l,a.sc);0>v&&n.splice(-(v+1),0,l)}m&&(h.a=m.replace(/''/g,'"'))}a.I.push({bf:b,F:c,Zc:d,ga:e,qc:f})}function Ei(a,b,c){var d=[],e=a.aa(b)>>>0;for(b=0;b<a.I.length;b++){var f=a.I[b],g=f.F>>>0,h=f.Zc;if(e>=g&&e<g+h){e=Aa(f.qc,[e-g],a.sc);0<=e?Fi(a,b,e,d):c&&(e=~e,Fi(a,b,e-1,d),Fi(a,b,e,d));break}}return d}
function Fi(a,b,c,d){var e={},f=a.I[b].qc,g=0,h=null;0<=c&&c<f.length&&(g=f[c][0],h=f[c][1]);h&&(e=a.I[b].ga[h],h="."==h.charAt(0)?null:e.l||h);d.push(h);d.push(g);d.push(e.a);d.push(e.c)}function Gi(a,b){var c=b.match(/^\s*([A-Z_]?[A-Z0-9_]*)\s*(=?)\s*(.*)$/i);if(c){if(!c[1])return ci(a)||a.i("no variables"),!0;if(!c[2])return ci(a,c[1]);if(!c[3])return delete a.X[c[1]],!0;b=Zh(a,c[3]);return void 0!==b?(a.X[c[1]]=b,!0):!1}a.i("invalid assignment:"+b);return!1}
function Hi(a,b,c){var d=null;if(b=ni(a,b,!0)){a.aa(b);var e=Ei(a,b,!0);if(e.length){var f,g;e[0]&&(g="",(f=b.F-e[1])&&(g=" + "+p(f,4,!0)),f=e[0]+" ("+J(a,e[1])+")"+g,c&&a.i(f),d=f);4<e.length&&e[4]&&(g="",(f=e[5]-b.F)&&(g=" - "+p(f,4,!0)),f=e[4]+" ("+J(a,e[5])+")"+g,c&&a.i(f),d||(d=f))}else c&&a.i("no symbols")}return d}
function ui(a,b){var c;if(b&&"?"==b[1])a.i("register commands:"),a.i("\tr\tdump registers"),a.i("\trm\tdump misc registers"),a.i("\trx [#]\tset flag or register x to [#]");else{var d=!1,e=a.b;null==c&&(c=!0);if(b&&1<b.length){var f=b[1];if("m"==f)d=!0;else{var g=f.indexOf("=");if(0<g)b=f.substr(g+1),f=f.substr(0,g);else if(2<b.length)b=b[2];else{a.i("missing value for "+b[1]);return}g=Zh(a,b);if(void 0===g)return;b=f.toUpperCase();switch(b){case "SP":case "R6":e.u[6]=g&65535;break;case "PC":case "R7":Q(e,
g);a.L=Y(e.u[7]);break;case "N":e.Z=g?32768:0;break;case "Z":e.$=g?0:1;break;case "V":e.V=g?32768:0;break;case "C":e.U=g?65536:0;break;case "PS":cd(e,g);break;case "IR":ad(e,g);break;case "ER":e.oa=g;d=!0;break;case "SL":e.sb=g|255;break;case "MMR0":Xc(e,g);d=!0;break;case "MMR3":$c(e,g);d=!0;break;case "AR":a.w&&(d=a.w,jc(d,d.va=g));d=!0;break;case "DR":a.w&&(d=a.w,ic(d,d.rb=g));d=!0;break;case "SR":if(a.w&&mc(a.w)){kc(a.w,g);d=!0;break}default:if("R"==b.charAt(0)&&(b=+b.charAt(1),0<=b&&6>b)){e.u[b]=
g&65535;break}a.i("unknown register: "+f);return}a.C.sa();a.i("updated registers:")}}a.i(Di(a,d));c&&(a.L=Y(e.u[7]),vi(a,J(a,a.L.F)))}}function Ii(a,b){b=ya(b);var c=b.match(/^(['"])(.*?)\1$/);c?1<c[2].length?a.i(c[2]):bi(a,null,c[2].charCodeAt(0)):Zh(a,b,!0)}
function Ji(a,b,c){if("?"==c)a.i("trace commands:"),a.i("\tt [#]\ttrace # instructions"),a.i("\ttr [#]\ttrace # instructions with register updates"),a.i("\ttc [#]\ttrace # cycles"),a.i("note: bn [#] breaks after # instructions without updates");else{var d="t"!=b;c=ai(a,c,null,!0)||1;var e=1==c?0:1;"tc"==b&&(e=c,c=1);a.yb=b;Ta(c,function(){return vb(a,!0)&&a.kb(e,d,!1)},function(){a.w&&a.w.stop&&a.w.stop();a.C.sa(-1);vb(a,!1)})}}
function vi(a,b,c,d){if(b=ni(a,b,!0)){void 0===d&&(d=1);var e=256;if(void 0!==c)if("l"==c.charAt(0))c=ai(a,c.substr(1)),null!=c&&(d=c);else{d=ni(a,c,!0);if(!d||d.F<b.F)return;e=d.F-b.F;if(256<e){a.i("range too large");return}d=-1}c=0;for(var f;0<e&&d--;){f=wb(a,!1)||a.O?a.K:null;var g=null!=f?"cycles":null,h=Ei(a,b),l=b.F;if(h[0]&&d&&(!c&&d||0>h[0].indexOf("+"))){var m=h[0]+":";h[2]&&(m+=" "+h[2]);a.i(m)}h[3]&&(g=h[3],f=null);f=Bi(a,b,g,f);a.i(f);a.L=b;e-=b.F-l;c++}}}
function Ai(a,b,c){var d=!0;try{b.length&&"end"!=b?c||a.i(">> "+b):(a.T&&(a.i("ended assemble at "+J(a,a.S.F)),a.L=a.S,a.T=!1),b="");var e=b.charAt(0);if('"'==e||"'"==e)return!0;a.ja=null;if(xb(a)&&0<b.length){a.T&&(b="a "+J(a,a.S.F)+" "+b);var f=!1,g=b.replace(/ +/g," ").split(" ");g[0]=g[0].toLowerCase();if(g&&g.length)for(var h=g[0],l=h.charAt(0),m=1;m<h.length;m++){var n=h.charAt(m);if("?"==l||"r"==l||"a">n||"z"<n){g[0]=h.substr(m);g.unshift(h.substr(0,m));break}}switch(g[0].charAt(0)){case "a":var v=
ni(a,g[1],!0);if(v)if(a.S=v,void 0===g[2])a.i("begin assemble at "+J(a,v.F)),a.T=!0,a.C.sa();else{var r;a.i("not supported yet");r=[];if(r.length){for(var w=0;w<r.length;w++)a.Eb(v,r[w],1);a.i(Bi(a,a.S))}}break;case "b":a:{var y=g[0],x=g[1],C=b;if("?"==x)a.i("breakpoint commands:"),a.i("\tbp [#]\tset exec breakpoint at addr #"),a.i("\tbr [#]\tset read breakpoint at addr #"),a.i("\tbw [#]\tset write breakpoint at addr #"),a.i("\tbc [#]\tclear breakpoint at addr #"),a.i("\tbl\tlist all breakpoints"),
a.i("\tbn [#]\tbreak after # instruction(s)");else{var la=y.charAt(1);if("l"==la){var Ma;Ma=0+zi(a,a.f);Ma+=zi(a,a.M);(Ma+=zi(a,a.D))||a.i("no breakpoints")}else if("n"==la)a.xa=ai(a,x),a.i("break after "+a.xa+" instruction(s)");else if(void 0===x)a.i("missing breakpoint address");else{var P=Y();if("*"!=x&&(P=ni(a,x,!0),!P))break a;"c"==la?null==P.F?(ei(a),a.i("all breakpoints cleared")):xi(a,a.f,P)||xi(a,a.M,P)||xi(a,a.D,P)||a.i("breakpoint missing: "+J(a,P.F)):null!=P.F&&(ri(a,P,C),"p"==la?a.ob(a.f,
P):"r"==la?a.ob(a.M,P):"w"==la?a.ob(a.D,P):a.i("unknown breakpoint command: "+la))}}}break;case "c":a.Va&&(a.Va.value="");break;case "d":a:{var kb,Oa=g[0],oa=g[1],Pa=g[2],bj=g[3];if("?"==oa){var lb="";for(kb in Cb)a.Ma[kb]&&(lb&&(lb+=","),lb+=kb);lb+=",state,symbols";a.i("dump memory commands:");a.i("\tdb [a] [#] dump # bytes at address a");a.i("\tdw [a] [#] dump # words at address a");a.i("\tdd [a] [#] dump # dwords at address a");a.i("\tdh [#] [#] dump # instructions from history");
lb.length&&a.i("dump extension commands:\n\t"+lb)}else if("state"==oa){var Mg=Ki(a.C,!0);"console"==Pa?console.log(Mg):(a.Va&&(a.Va.value=""),a.i(Mg))}else if("symbols"==oa)for(var Sd=0;Sd<a.I.length;Sd++){var Td=a.I[Sd],mb;for(mb in Td.ga)if("."!=mb.charAt(0)){var Ng=Td.ga[mb].o;if(void 0!==Ng){var Og=Td.ga[mb].l;Og&&(mb=Og);a.i(J(a,Ng)+" "+mb)}}}else{if("d"==Oa){for(kb in Cb)if(g[1]==kb){var Pg=a.Ma[kb];Pg?(g.shift(),g.shift(),Pg(g)):a.i("no dump registered for "+oa);break a}oa||(Oa=a.Lb||"dw")}else a.Lb=
Oa;if("dh"==Oa){var Qg=oa,Rg=Pa,Sg="",Tg=0,ha=a.ba,pa=a.H;if(pa.length){var ba=+Qg||a.pb,Vb=+Rg||10;isNaN(ba)?ba=Vb:Sg="more ";ba>pa.length&&(a.i("note: only "+pa.length+" available"),ba=pa.length);ha-=ba;0>ha&&(null==pa[pa.length-1].F?(ba=ha+ba,ha=0):ha+=pa.length);var Ud=[];"call"==Rg&&(Vb=1E5,Ud=["CALL"]);for(void 0!==Qg&&a.i(ba+" instructions earlier:");0<Vb&&ha!=a.ba;){var Ug=pa[ha++];if(null==Ug.F)break;var Wb=Y(Ug.F),cj=ba--,Vg=Bi(a,Wb,"history",cj);(!Ud.length||0<=Vg.indexOf(Ud[0]))&&a.i(Vg);
Wb.fc&&(ha+=Wb.fc,Vb-=Wb.fc,ba-=Wb.fc);ha>=pa.length&&(ha=0);a.pb=ba;Tg++;Vb--}}Tg||(a.i("no "+Sg+"history available"),a.pb=void 0)}else{var nb=ni(a,oa);if(nb){var Xb=0,Vd=!1,Wd="ds"==Oa;Pa&&(Vd=!0,"l"==Pa.charAt(0)&&(Vd=!1,Pa=Pa.substr(1)||bj),Xb=ai(a,Pa)>>>0,65536<Xb&&(Xb=65536));for(var ob="dd"==Oa?4:"db"==Oa?1:2,Lc=(Vd?Xb-nb.F:ob*Xb)||128,Xd=Wd?16:a.ca,dj=(Lc+Xd-1)/Xd|0||1,Qa="";dj--&&0<Lc;){for(var Ra="",Yd="",oa=J(a,nb.F),Mc=Xd,Yb=0,Zb=0;0<Mc&&0<Lc;){var pb=1,Nc=1==ob?a.Yb(nb,pb):a.ma(nb,pb=
2),Yb=Yb|Nc<<(Zb<<3),Zb=Zb+pb;Zb==ob&&(Wd?(Ra&&(Ra+=","),Ra+="0x"+p(Yb,2*ob)):(Ra+=J(a,Yb,ob),Ra+=1==ob?9==Mc?"-":" ":" "),Yb=Zb=0);Mc-=pb;for(Lc-=pb;pb--;)var Zd=Nc&255,Yd=Yd+(32<=Zd&&128>Zd?String.fromCharCode(Zd):"."),Nc=Nc>>8}Qa&&(Qa+="\n");Qa=Wd?Qa+(Ra+","):Qa+(oa+" "+Ra+(0==Mc?" "+Yd:""))}Qa&&a.i(Qa);a.mb=nb}}}}break;case "e":if("else"==g[0])break;var qb,$d,ae,be,ce=g[0],de=g[1];"eb"==ce?(qb=1,$d=255,ae=a.Yb,be=a.Eb):"e"==ce||"ew"==ce?(qb=2,$d=65535,ae=a.ma,be=a.ib):de=null;if(null==de)a.i("edit memory commands:"),
a.i("\teb [a] [...] edit bytes at address a"),a.i("\tew [a] [...] edit words at address a");else{var Oc=ni(a,de);if(Oc)for(var Pc=2;Pc<g.length;Pc++){var $b=Zh(a,g[Pc]);if(void 0===$b){a.i("unrecognized value: "+g[Pc]);break}$b&~$d&&a.i("warning: "+p($b)+" exceeds "+qb+"-byte value");a.i("changing "+J(a,Oc.F)+(F(a,64)?"":" from "+J(a,ae.call(a,Oc),qb))+" to "+J(a,$b,qb));be.call(a,Oc,$b,qb)}}break;case "g":a:{var Wg=g[1],ej=b;if(void 0!==Wg){var ee=ni(a,Wg,!0);if(!ee)break a;ri(a,ee,ej);a.ob(a.f,
ee,!0)}a.jb(!0,c)}break;case "h":a.A.W?(c||a.i("halting"),a.da()):wb(a,!0)||c||a.i("already halted");break;case "i":if("if"==g[0]){var fe;var ac=b.substr(2),ac=ya(ac);Zh(a,ac)?(c||a.i("true: "+ac),fe=!0):(c||a.i("false: "+ac),fe=!1);fe||(d=!1);break}f=!0;break;case "k":var fj=g[0];if("?"==g[1])a.i("stack trace commands:"),a.i("\tk\tshow frame addresses"),a.i("\tks\tshow symbol information");else{var ge=0,he=Y(),bc=Y(a.b.u[6]);for(a.i("stack trace for "+J(a,bc.F));10>ge;){for(var Sa=null,gj=256;65536>
bc.F>>>0;){he.F=a.ma(bc,2);if(null==bc.F||!gj--)break;if(!(he.F&1)){for(var hj=a,Qc=he,Xg=null,cc=Qc.F,Yg=cc,ie=1;6>=ie&&cc;ie++){if(2<ie){Qc.F=cc;var Rc=Bi(hj,Qc);if(0<=Rc.indexOf("JSR")){var Zg=Rc.indexOf(" ");if(cc+(Rc.indexOf(" ",Zg+1)-Zg-1)/2==Yg){Xg=Rc;break}}}cc-=2}Qc.F=Yg;if(Sa=Xg)break}}if(!Sa||null==Sa)break;var $g=null;if("ks"==fj){var ah=Sa.match(/[0-9A-F]+$/);ah&&($g=Hi(a,ah[0]))}Sa=xa(Sa,50)+" ;"+($g||"stack="+J(a,bc.F));a.i(Sa);ge++}ge||a.i("no return addresses found")}break;case "l":if("ln"==
g[0]){Hi(a,g[1],!0);break}f=!0;break;case "m":a:{var qa,ra=null,G=g[1];"?"==G&&(G=void 0);if(void 0!==G){var Fa=0;if("all"==G)Fa=1878917119,G=null;else if("on"==G)ra=!0,G=null;else if("off"==G)ra=!1,G=null;else{"keys"==G&&(G="key");"kbd"==G&&(G="keyboard");for(qa in Cb)if(G==qa){Fa=Cb[qa];ra=!!(a.la&Fa);break}if(!Fa){a.i("unknown message category: "+G);break a}}if(Fa)if("on"==g[2])a.la|=Fa,ra=!0;else if("off"==g[2]&&(a.la&=~Fa,ra=!1,1073741824==Fa)){for(var je=0;je<a.Aa.length;je++)a.i(a.Aa[je]);
a.Aa=[]}}var ij=0,dc="";for(qa in Cb)if(!G||G==qa){var jj=!!(a.la&Cb[qa]);if(null===ra||ra==jj)dc&&(dc+=","),++ij%10||(dc+="\n\t"),"key"==qa&&(qa="keys"),dc+=qa}void 0===G&&a.i("message commands:\n\tm [category] [on|off]\tturn categories on/off");a.i((null!==ra?ra?"messages on: ":"messages off: ":"message categories:\n\t")+(dc||"none"));fi(a)}break;case "p":if("print"==g[0]){Ii(a,b.substr(5));break}var kj=g[0];if("?"==g[1])a.i("step commands:"),a.i("\tp\tstep over instruction"),a.i("\tpr\tstep over instruction with register update");
else{var bh="pr"==kj?1:0,ch=1+bh;if(a.O)a.i("step in progress");else{var Sc=Y(a.b.u[7]),ec=a.ma(Sc);3==ec||4==ec||34816==(ec&65280)||35072==(ec&65280)?(a.O=ch,oi(Sc,2)):2048==(ec&65024)&&(Bi(a,Sc),a.O=ch);a.O?(a.ob(a.f,Sc,!0),a.jb()||(a.C&&a.C.ub(),a.O=0)):Ji(a,bh?"tr":"t")}}break;case "r":if("reset"==b){a.C&&a.C.reset();break}ui(a,g);break;case "s":a:switch(g[1]){case "base":if(g[2]){var fc=+g[2];if(8==fc||10==fc||16==fc)a.ca=fc;else{a.i("invalid base: "+fc);break}}a.i("default base: "+a.ca);break;
case "cs":var gc;void 0!==g[3]&&(gc=+g[3]);switch(g[2]){case "int":a.b.zb=gc;break;case "start":a.b.Pb=gc;break;case "stop":a.b.Ab=gc;break;default:a.i("unknown cs option");break a}void 0!==gc&&yd(a.b);a.i("checksums "+(a.b.A.xb?"enabled":"disabled"));break;case "sp":void 0!==g[2]&&(Cd(a.b,+g[2])||a.i("warning: using 1x multiplier, previous target not reached"));a.i("target speed: "+(a.b.qb.toFixed(2)+"Mhz")+" ("+a.b.gb+"x)");break;default:if(g[1]){a.i("unknown option: "+g[1]);break}case "?":a.i("debugger options:"),
a.i("\tbase #\t\tset default base to #"),a.i("\tcs int #\tset checksum cycle interval to #"),a.i("\tcs start #\tset checksum cycle start count to #"),a.i("\tcs stop #\tset checksum cycle stop count to #"),a.i("\tsp #\t\tset speed multiplier to #")}break;case "t":Ji(a,g[0],g[1]);break;case "u":vi(a,g[1],g[2],8);break;case "v":if("var"==g[0]){Gi(a,b.substr(3))||(d=!1);break}if("ver"==g[0]){a.i("PDPjs version 1.30.3 ("+a.b.Xa+",RELEASE"+(Ab?",TYPEDARRAYS":",LONGARRAYS")+")");a.i(window?window.navigator.userAgent:
"");break}f=!0;break;case "?":if(g[1]){Ii(a,b.substr(1));break}var ke="commands:",le;for(le in hi)ke+="\n"+xa(le,9)+hi[le];He(a)||(ke+="\nnote: history disabled if no exec breakpoints");a.i(ke);break;default:f=!0}f&&(a.i("unknown command: "+b),d=!1)}}catch(dh){a.i("debugger error: "+(dh.stack||dh.message)),d=!1}return d}function Ad(a,b,c){b=Xh(a,b,c);for(var d in b)if(!Ai(a,b[+d]))return!1;return!0}
$a(function(){for(var a=D(document,"pdp11","debugger"),b=0;b<a.length;b++){var c=a[b],d=A(c),d=new di(d);B(d,c)}});
function Li(a,b,c){t.call(this,"Computer",a,Li,67108864);this.A.ia=!1;Mi(this,b);this.L=wd(this,"autoPower",a);this.C=0;this.X=a.busWidth||a.buswidth;this.f=Ni;this.I=null;this.D=this.S=!1;this.ba=wd(this,"url")||"";(Math.random()+.1).toString(36);this.g=Oi(this);if(this.b=ub("CPU",this.id)){this.j=ub("Debugger",this.id);this.v=new oc({id:this.Ua+".bus",busWidth:this.X},this.b,this.j);var d,e=sb(this.id);if((this.w=ub("Panel",this.id))&&this.w.Va)for(b=0;b<e.length;b++)d=e[b],d.R=this.w.R,d.i=this.w.i,
d.Va=this.w.Va;this.i("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.i("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.Ia&&d.Ia(this,this.v,this.b,this.j);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.H=d:this.f=parseInt(d,10));var f;if(a=wd(this,"state")||(f=!0,a.state))b=this.M=a,f||(this.D=!0,this.f=Ni),this.f&&(this.K=
new O(this,"1.30.3"),Pi(this.K)?b=null:delete this.K);!b&&this.f&&(b=Qi(this))&&(this.D=!0);if(b){var g=this;Da(b,null,!0,function(a,b,c){c?(g.H=null,g.D=!1,g.R("Unable to load machine state from server (error "+c+(b?": "+ya(b):"")+")")):(g.I=b,g.S=!0);H(g)})}else H(this);this.G.power||(this.L=!0);!c&&this.L&&Ri(this,this.Qb)}else q("Unable to find CPU component")}z(Li);var Ni=0;
function Mi(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){q(d.message+" ("+c+")")}}a.T=b}function wd(a,b,c){var d=b.toLowerCase(),d=eb[b]||eb[d];void 0===d&&a.T&&(d=a.T[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Ri(a,b,c){for(var d=sb(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!xb(f)){xb(f,function(){Ri(a,b,c)});return}}b.call(a,c)}
function Si(a,b){var c=new O(a,"1.30.3","validate");if(Pi(c)&&Ti(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.R("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}k=Li.prototype;
k.Qb=function(a){void 0===a&&(a=this.f||(this.I?1:Ni));if(!this.C){this.C++;var b=!1,c=!1;this.O=!1;var d=this.K||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Ni){if(Pi(d,this.I)){this.B=new O(this,"1.30.3","failsafe");Pi(this.B)&&(Ui(this,d),a=2,Vi(this.B));this.B.set("timestamp",Ca());Wi(this.B);var e=this.f&&!this.D;if(1==a||Ha("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=Ti(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Pi(d,g):("error"==
f&&"no machine state"!=g?(this.R("Error: "+g),"unable to verify user"==g&&(La("user",""),this.g=null)):this.i(f+": "+g),Vi(d),Pi(d)?(c=Ti(d),e=!0):c=!1))}e&&Si(this,c?d:null)}else 2==a&&d.clear()}else Si(this);delete this.I;delete this.K}e=sb(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.b&&(c=Xi(this,g,d,b,c));b=[d,a,c];-1!=a?Ri(this,this.tc,b):this.tc(b)}};
function Xi(a,b,c,d,e){if(!b.A.ia){b.A.ia=!0;if(b.Ka){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.Ka(f,d)&&f&&(q("Unable to restore state for "+b.type),a.M&&!a.S?(c.clear(),a.f=Ni,window&&window.location.reload()):a.O=!0,b.Ka(null),e=!1)}if(!d&&b.Bc)for(a=b.Bc.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
k.tc=function(a){var b=a[0],c=0>a[1];a=a[2];this.ca=!0;this.A.ia=!0;var d=this.G.power;d&&(d.textContent="Shutdown");this.b&&(Xi(this,this.b,b,c,a),this.sa(),this.b.vb());this.O&&(Ui(this,b),b.clear());!c&&this.B&&(this.B.clear(),delete this.B);this.C=0};
function Ui(a,b){if(Ha("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.g||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.ba;d.user=c;d.type="bug";d.data=b;Da("http://www.pcjs.org/api/v1/report",d,!0)}}
function Ki(a,b,c){var d,e="none";if(a.C)return null;a.C--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),h=Ca();g.set("timestamp",h);f.set("timestamp",h);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.b&&a.b.Ja&&(c&&a.b.da(),d=a.b.Ja(b,c),"object"===typeof d&&f.set(a.b.id,d),c&&(a.b.A.ia=!1,!1===d&&(e=null)));for(var h=sb(a.id),l=0;l<h.length;l++){var m=h[l];m.A.ia&&(m.Ja&&(d=m.Ja(b,c),"object"===typeof d&&f.set(m.id,
d)),c&&(m.A.ia=!1,!1===d&&(e=null)))}e&&(c?(h=d=!1,b?(a.g&&Yi(a,a.g,f.toString()),Wi(g)&&Wi(f)||(e=null,d=h=!0)):a.f&&(d=!0,h=3==a.f),d&&f.clear(h)):e=f.toString());c&&(a.A.ia=!1,b=a.G.power)&&(b.textContent="Power");a.C=0;return e}
k.reset=function(){this.v&&this.v.reset&&(E(this,"Resetting "+this.v.type),this.v.reset());this.b&&this.b.reset&&(E(this,"Resetting "+this.b.type),this.b.reset());for(var a=sb(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.v&&c!==this.b&&c.reset&&(E(this,"Resetting "+c.type),c.reset())}this.sa(-1)};k.start=function(a,b){for(var c=sb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.sa(-1)};
k.stop=function(a,b){for(var c=sb(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.sa(-1)};
k.sa=function(a){if(this.b){var b=this.b,c=a||0,d=b.G.speed;d&&(0>=c||30<=(b.wb+=c))&&(d.textContent=b.A.W?b.pa.toFixed(2)+"Mhz":"Stopped",b.wb=0)}if(this.w&&(b=this.w,a=a||0,b.D)){c=b.b.A.W;d=!!(b.b.J&4);if(0>=a||60<=(b.B+=a)){for(var e=0;e<b.b.u.length;e++)Qb(b,"R"+e,b.b.u[e]);e=bd(b.b);Qb(b,"PS",e);Qb(b,"NF",e&8?1:0,1);Qb(b,"ZF",e&4?1:0,1);Qb(b,"VF",e&2?1:0,1);Qb(b,"CF",e&1?1:0,1);b.B=0}jc(b,0<a&&c&&!d?b.b.Mb:b.va);ic(b,b.rb);a=b.b;a=a.M?a.Ta&16?1:2:4;lc(b,"B22",a&1);lc(b,"B18",a&2);lc(b,"B16",
a&4)}};
k.wa=function(a,b,c){var d=this;switch(b){case "power":return this.G[b]=c,c.onclick=function(){d.C||(d.A.ia?Ki(d,!1,!0):Ri(d,d.Qb))},!0;case "reset":return this.G[b]=c,c.onclick=function(){if(d.A.ia&&!d.C)if(d.f&&!d.H){var a=Ha("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");Ki(d,a,!0);!a&&d.M?window&&window.location.reload():(a||(d.uc=!0),d.Qb(Ni),d.uc=!1)}else d.reset(),d.b&&d.b.vb()},!0;case "save":if(ua(Ga(),"pcjs.org"))c.parentNode.removeChild(c);else return this.G[b]=
c,c.onclick=function(){var a=Oi(d,!0);if(a){var b=!!(d.f&&!d.H||d.M),c=Ki(d,b);b?Yi(d,a,c):d.R("Resume disabled, machine state not saved")}},!0}return!1};
function Oi(a,b){var c=a.g;c||((c=Ka("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=Zi(a,c))||a.R("The user ID is invalid.")):b&&a.R("Browser local storage is not available"));return c}
function Zi(a,b){a.g=null;b=Da(Ga()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(La("user",b.data),a.g=b.data)}catch(d){q(d.message+" ("+c+")")}return a.g}function Qi(a){var b=null;a.g&&(b=Ga()+"/api/v1/user?req=load&user="+a.g+"&state="+$i(a,"1.30.3"));return b}
function Yi(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=$i(a,"1.30.3");d.data=c;b=Da(Ga()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.R("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.R(c),La("user",""),a.g=null)}}
function rh(a){var b;a=sb(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}k.ub=function(a){if(this.Va){var b=0,c=0;!a&&window&&(b=window.scrollX,c=window.scrollY);this.Va.focus();!a&&window&&window.scrollTo(b,c)}};$a(function(){for(var a=D(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=A(c),c=D(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=A(f),g=new Li(g,d,!0);B(g,f);g.L&&Ri(g,g.Qb)}});
Va.show.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=ub("Computer",c.id))&&c.ca&&!c.A.ia&&c.Qb(-1)}});Va.exit.push(function(){for(var a=D(document,"pdp11","computer"),b=0;b<a.length;b++){var c=A(a[b]);(c=ub("Computer",c.id))&&c.A.ia&&Ki(c,!(!c.f||c.H),!0)}});function O(a,b,c){this.id=a.id;this.key=$i(a,b,c);this.j=a.j;Vi(this,a.ad)}function $i(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){Vi(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function Vi(a,b){a[a.id]={};b&&a.set("parms",b);a.b=!1}function Wi(a){var b=!0;if(Ja()){var c=JSON.stringify(a[a.id]);La(a.key,c)||(q("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function Ti(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){q(c.message||c),b=!1}return b}function Pi(a,b){return b?(a[a.id]=b,a.b=!0):a.b?!0:Ja()&&(b=Ka(a.key))?(a[a.id]=b,a.b=!0):!1}var aj=0;
function lj(a,b,c,d,e,f){e("Loading "+a+"...");Da(a,null,!0,function(g,h,l){l?(h||(h="unable to load "+a+" ("+l+")"),f(h,null)):mj(h,a,b,c,d,e,f)})}
function mj(a,b,c,d,e,f,g){function h(a,f){if(f)g(f,null);else{c&&(rb(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(n){f=null,a=n.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?nj(a,f,h):h(a,null):g("no data"+(b?" for file: "+b:""),null)}
function nj(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");Da(e,null,!0,function(f,g,h){if(h||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+h+")");else{if(f=d[3])if(h=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=h[0],m,n=/( [a-z]+=)(['"])(.*?)\2/g;m=n.exec(f);)l=0>l.indexOf(m[1])?l.replace(">",m[0]+">"):l.replace(new RegExp(m[1]+"(['\"])(.*?)\\1"),m[0]);h[0]!=l&&(g=g.replace(h[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);nj(a,b,c)}})}else c(a,null)}
function oj(a,b,c,d){function e(a){if(void 0===h){var b=g&&D(g,"machine-warning");h=b&&b[0]||g}h&&(h.innerHTML=wa(a))}function f(a){e("Error: "+a);l&&(--aj||bb(!0));l=!1}var g,h,l=!0;aj++;jb[a]={};try{if(g=document.getElementById(a)){var m;if("object"==typeof resources&&(m=resources.css)){var n=document.head||document.getElementsByTagName("head")[0],v=document.createElement("style");v.type="text/css";v.styleSheet?v.styleSheet.cssText=m:v.appendChild(document.createTextNode(m));n.appendChild(v)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");m=function(d,h){h?lj(c,null,null,!1,e,function(d,l){l?(rb(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=h.transformNode(l))?(g.outerHTML=l,--aj||bb(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(h,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--aj||bb(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?lj(b,a,d,!0,e,m):mj(b,null,a,d,!1,e,m)}else f("missing machine element: "+a)}catch(r){f(r.message)}return l}window.embedPDP11=function(a,b,c,d){bb(!1);return oj(a,b,c,d)};window.enableEvents=bb;window.sendEvent=cb;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11-dbg.map

View file

@ -40,204 +40,207 @@ function pa(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}
function sa(){function a(a){return(10>a?"0":"")+a}var b=new Date;return b.getFullYear()+"-"+a(b.getMonth()+1)+"-"+a(b.getDate())+" "+a(b.getHours())+":"+a(b.getMinutes())+":"+a(b.getSeconds())}
function r(a,b,c,d){var e=0,f=null,g=null;if("object"==typeof resources&&(f=resources[a]))return d&&d(a,f,e),[f,e];if(c&&"function"==typeof resources)return resources(a,function(b,c){d&&d(a,b,c)}),g;var k=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c&&(k.onreadystatechange=function(){4===k.readyState&&(f=k.responseText,200==k.status||!k.status&&f.length&&"file:"==(window?window.location.protocol:"file:")||(e=k.status||-1),d&&d(a,f,e))});if(b&&"object"==
typeof b){var l="",n;for(n in b)b.hasOwnProperty(n)&&(l&&(l+="&"),l+=n+"="+encodeURIComponent(b[n]));l=l.replace(/%20/g,"+");k.open("POST",a,!!c);k.setRequestHeader("Content-type","application/x-www-form-urlencoded");k.send(l)}else k.open("GET",a,!!c),"bytes"==b&&k.overrideMimeType("text/plain; charset=x-user-defined"),k.send();c||(f=k.responseText,200!=k.status&&(e=k.status||-1),d&&d(a,f,e),g=[f,e]);return g}
function ta(a,b){var c,d={K:null,W:null,ga:null,fa:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ga=g.load;d.fa=g.exec;if(e=g.bytes)d.K=e;else if(e=g.words)for(d.K=Array(2*e.length),f=c=0;c<e.length;c++)d.K[f++]=e[c]&255,d.K[f++]=e[c]>>8&255;else if(e=g.data)for(d.K=Array(4*e.length),f=c=0;c<e.length;c++)d.K[f++]=e[c]&255,
d.K[f++]=e[c]>>8&255,d.K[f++]=e[c]>>16&255,d.K[f++]=e[c]>>24&255;else d.K=g;d.W=g.symbols;d.K.length?1==d.K.length&&(t(d.K[0]),d=null):(t("Empty resource: "+a),d=null)}catch(k){t("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){t("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.K=e)}return d}
function ta(a,b){var c,d={K:null,Y:null,ha:null,ga:null};if("["==b.charAt(0)||"{"==b.charAt(0))try{var e,f,g;if("<"==b.substr(0,1))throw Error(b);g=0>b.indexOf("0x")&&'["'!=b.substr(0,2)?JSON.parse(b.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+b+")");d.ha=g.load;d.ga=g.exec;if(e=g.bytes)d.K=e;else if(e=g.words)for(d.K=Array(2*e.length),f=c=0;c<e.length;c++)d.K[f++]=e[c]&255,d.K[f++]=e[c]>>8&255;else if(e=g.data)for(d.K=Array(4*e.length),f=c=0;c<e.length;c++)d.K[f++]=e[c]&255,
d.K[f++]=e[c]>>8&255,d.K[f++]=e[c]>>16&255,d.K[f++]=e[c]>>24&255;else d.K=g;d.Y=g.symbols;d.K.length?1==d.K.length&&(t(d.K[0]),d=null):(t("Empty resource: "+a),d=null)}catch(k){t("Resource data error ("+a+"): "+k.message),d=null}else{e=[];b=b.replace(/\n/gm," ").replace(/ +$/,"").split(" ");for(c=0;c<b.length;c++){f=parseInt(b[c],16);if(isNaN(f)){t("Resource data error ("+a+"): invalid hex byte ("+b[c]+")");break}e.push(f&255)}c==b.length&&(d.K=e)}return d}
function v(){return"http://"+(window?window.location.host:"www.pcjs.org")}function t(a){window&&window.alert(a)}function ua(a){var b=!1;window&&(b=window.confirm(a));return b}var va=null;function wa(){if(null==va){var a=!1;if(window)try{window.localStorage.setItem("PCjs.localStorage","PCjs.localStorage"),a="PCjs.localStorage"==window.localStorage.getItem("PCjs.localStorage"),window.localStorage.removeItem("PCjs.localStorage")}catch(b){a=!1}va=a}return va}
function ya(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function za(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Aa(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var Ba={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ga(a){Ba.init.push(a)}function Ha(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ia(a){!Ea&&a?(Ea=!0,Ca&&Ja("init"),Da&&Ja("show")):Ea=a}function Ja(a){Ba[a]&&Ha(Ba[a])}Fa("onload",function(){Ca=!0;Ha(Ba.init)});Fa("onpageshow",function(){Da=!0;Ha(Ba.show)});
Fa(Aa("Opera")||Aa("iOS")?"onunload":"onbeforeunload",function(){Ha(Ba.exit)});function x(a,b,c){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Pb=b.comment;this.qd=b;b=this.id.indexOf(".");0>b?this.Ha=this.id:(this.pa=this.id.substr(0,b),this.Ha=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Da:!1,sb:!1,N:!1,error:!1};this.kb=null;this.j.error=!1;this.o={};this.D=null;y.push(this)}var Ka=void 0,La={};
function za(a){var b;if(window)try{b=window.localStorage.getItem(a)}catch(c){}return b}function Aa(a,b){try{return window.localStorage.setItem(a,b),!0}catch(c){}return!1}function Ba(a){if(window){var b=window?window.navigator.userAgent:"";return"iOS"==a&&b.match(/(iPod|iPhone|iPad)/)&&b.match(/AppleWebKit/)||"MSIE"==a&&b.match(/(MSIE|Trident)/)||0<=b.indexOf(a)?!0:!1}return!1}var x={init:[],show:[],exit:[]},Ca=!1,Da=!1,Ea=!0;
function Fa(a,b){if(window){var c=window[a];window[a]="function"!==typeof c?b:function(){c&&c();b()}}}function Ga(a){x.init.push(a)}function Ha(a){if(Ea)try{for(var b=0;b<a.length;b++)a[b]()}catch(c){t(""+("An unexpected exception occurred:\n\n"+c.message+"\n\nPlease send this information to support@pcjs.org. Thanks."))}}function Ia(a){!Ea&&a?(Ea=!0,Ca&&Ja("init"),Da&&Ja("show")):Ea=a}function Ja(a){x[a]&&Ha(x[a])}Fa("onload",function(){Ca=!0;Ha(x.init)});Fa("onpageshow",function(){Da=!0;Ha(x.show)});
Fa(Ba("Opera")||Ba("iOS")?"onunload":"onbeforeunload",function(){Ha(x.exit)});function y(a,b,c,d){this.type=a;b||(b={id:"",name:""});this.id=b.id||"";this.name=b.name;this.Tb=b.comment;this.td=b;b=this.id.indexOf(".");0>b?this.za=this.id:(this.ra=this.id.substr(0,b),this.za=this.id.substr(b+1));this[a]=c;this.j={ready:!1,Da:!1,tb:!1,N:!1,error:!1};this.kb=null;this.j.error=!1;this.o={};this.F=null;this.qd=d||0;z.push(this)}var Ka=void 0,La={};
if(window){Ka||(Ka=window.location.search.substr(1));for(var Ma,Na=/\+/g,Oa=/([^&=]+)=?([^&]*)/g;Ma=Oa.exec(Ka);)La[decodeURIComponent(Ma[1].replace(Na," "))]=decodeURIComponent(Ma[2].replace(Na," "))}function Pa(a){function b(){}if(window){if(!a)throw new TypeError;if(Object.create)return Object.create(a);var c=typeof a;if("object"!==c&&"function"!==c)throw new TypeError;}b.prototype=a;return new b}
function z(a,b){b||(b=x);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Qa=window.PCjs.Machines||(window.PCjs.Machines={}),y=window.PCjs.Components||(window.PCjs.Components=[])}else Qa={},y=[];function Ra(a,b,c){Qa[a]&&b&&(Qa[a][b]=c)}function A(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<y.length;b++){var d=y[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Sa(a){if(void 0!==a){var b;for(b=0;b<y.length;b++)if(y[b].id===a)return y[b]}return null}function Ta(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<y.length;d++)if(c)c==y[d]&&(c=null);else if(!(a!=y[d].type||b&&y[d].id.indexOf(b)))return y[d]}return null}function B(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function C(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=B(f))&&g.binding&&a.Z(g.type,g.binding,f,g.value),l=k.length}}}}
function A(a,b){b||(b=y);a.prototype=Pa(b.prototype);a.prototype.constructor=a;a.prototype.parent=b.prototype}if(window){window.PCjs||(window.PCjs={});var Qa=window.PCjs.Machines||(window.PCjs.Machines={}),z=window.PCjs.Components||(window.PCjs.Components=[])}else Qa={},z=[];function Ra(a,b,c){Qa[a]&&b&&(Qa[a][b]=c)}function B(a){var b,c=[];a&&(a=0<(b=a.indexOf("."))?a.substr(0,b+1):"");for(b=0;b<z.length;b++){var d=z[b];a&&d.id.indexOf(a)||c.push(d)}return c}
function Sa(a){if(void 0!==a){var b;for(b=0;b<z.length;b++)if(z[b].id===a)return z[b]}return null}function Ta(a,b){var c;if(void 0!==a){var d;b&&(b=0<(d=b.indexOf("."))?b.substr(0,d+1):"");for(d=0;d<z.length;d++)if(c)c==z[d]&&(c=null);else if(!(a!=z[d].type||b&&z[d].id.indexOf(b)))return z[d]}return null}function C(a){var b=null;if(a=a.getAttribute("data-value"))try{b=eval("("+a+")")}catch(c){t(c.message+" ("+a+")")}return b}
function D(a,b){b=E(b.parentNode,"pdp11-control");for(var c=0;c<b.length;c++)for(var d=b[c].childNodes,e=0;e<d.length;e++){var f=d[e];if(1===f.nodeType){var g=f.getAttribute("class");if(g)for(var k=g.split(" "),l=0;l<k.length;l++)switch(g=k[l],g){case "pdp11-binding":(g=C(f))&&g.binding&&a.aa(g.type,g.binding,f,g.value),l=k.length}}}}
function E(a,b,c){c&&(b+="-"+c+"-object");if(a.getElementsByClassName)return a.getElementsByClassName(b);var d;c=[];a=a.getElementsByTagName("*");var e=new RegExp("(^| )"+b+"( |$)");b=0;for(d=a.length;b<d;b++)e.test(a[b].className)&&c.push(a[b]);return c}
x.prototype={constructor:x,parent:null,toString:function(){return this.name?this.name:this.id||this.type},Z:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Xa=this.o[b]=c,c.value="",this.T=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.G=function(a){this.T(a,this.Ha)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.Ha+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},ka:function(){return this.j.N=!0},ja:function(a,b){b&&(this.j.N=!1);return!0}};function Ua(a,b){a.j.sb?(a.j.Da=!1,a.j.sb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Da=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.kb,a.kb=null,b&&b()))}
y.prototype={constructor:y,parent:null,toString:function(){return this.name?this.name:this.id||this.type},aa:function(a,b,c){switch(b){case "clear":return this.o[b]||(this.o[b]=c,c.onclick=function(a){return function(){a.o.print&&(a.o.print.value="")}}(this)),!0;case "print":return this.o[b]||(this.Wa=this.o[b]=c,c.value="",this.T=function(a){return function(b,c){8192<a.value.length&&(a.value=a.value.substr(a.value.length-4096));a.value+=(void 0!==c?c+": ":"")+(b||"")+"\n";a.scrollTop=a.scrollHeight}}(c),
this.G=function(a){this.T(a,this.za)}),!0;default:return!1}},log:function(){},T:function(){},status:function(a){this.T(this.za+": "+a)},G:function(a,b,c){c=c||this.type;b||t((c?c+": ":"")+a)},la:function(){return this.j.N=!0},ka:function(a,b){b&&(this.j.N=!1);return!0}};function Ua(a,b){a.j.tb?(a.j.Da=!1,a.j.tb=!1):a.j.error?a.T(a.toString()+" error"):a.j.Da=b}function F(a,b){a.j.error||(a.j.ready=!1!==b,a.j.ready&&(b=a.kb,a.kb=null,b&&b()))}
function Va(a,b){b&&(a.j.ready?b():a.kb=b);return a.j.ready}function Wa(a,b){a.j.error=!0;a.G(b)}Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===a)return b;return-1});Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)});
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c&&a?this:a,d.concat(Array.prototype.slice.call(arguments)))}function c(){}if("function"!=typeof this)throw new TypeError("Function.prototype.bind: non-callable object");var d=Array.prototype.slice.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});var Xa="undefined"!==typeof ArrayBuffer;
function Ya(a){x.call(this,"Panel",a,Ya);this.da=this.i=this.c=this.m=this.w=this.s=0;this.A=this.C=this.v=!1;this.F=Za;this.g={};this.b={START:[1,1,!0,!1,this.tc],STEP:[1,1,!1,!1,this.uc],ENABLE:[1,1,!1,!1,this.pc],CONT:[1,1,!0,!1,this.nc],DEP:[0,0,!0,!1,this.oc],EXAM:[1,1,!0,!1,this.qc],LOAD:[1,1,!0,!1,this.sc],TEST:[0,0,!0,!1,this.rc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.vc,a]}z(Ya);var Za=7;function $a(a,b){return a.b[b]&&a.b[b][1]}h=Ya.prototype;h.reset=function(){this.stop()};
h.Z=function(a,b,c,d){if(this.l&&this.l.Z(a,b,c,d)||this.a&&this.a.Z(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.o[b]=c,this.s++,!0;default:return"led"==a||"rled"==a?(this.o[b]=c,this.g[b]=d?1:0,this.s++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.o[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){ab(a,b)}}(this,
b),a.onmouseup=a.onmouseout=function(a,b){return function(){bb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){ab(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){bb(a,b)}}(this,b),!0):this.parent.Z.call(this,a,b,c,d)}};h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.D=d;cb(b,this,db);eb(b,this.reset.bind(this));fb(this);gb(this)};h.ka=function(a,b){b||(hb(),this.reset());return!0};h.ja=function(){return!0};
function ib(a,b,c){if(a=a.o[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function fb(a,b){for(var c in a.g)ib(a,c,null!=b?b:a.g[c])}function jb(a,b,c){if(a=a.o[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function gb(a){for(var b in a.b)jb(a,b,a.b[b][1])}function kb(a,b,c,d){a.o[b]&&(void 0===c&&(Wa(a,"Value for "+b+" is invalid"),G(a.a)),c=8==(a.D&&a.D.h||8)?ka(c,d):m(c,d),a.o[b].textContent!=c&&(a.o[b].textContent=c))}
function ab(a,b){var c=a.b[b];jb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.A="DEP"==b,a.C="EXAM"==b)}function bb(a,b){var c=a.b[b];c[2]&&c[3]&&(jb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.tc=function(a){a||this.a.j.P||(this.h.reset(),lb(this.a),$a(this,"ENABLE")&&mb(this.a))};h.uc=function(){};h.pc=function(a){a||G(this.a)};
h.nc=function(a){if(!a&&!this.a.j.P)if($a(this,"ENABLE"))mb(this.a);else{a=this.D;var b;if(b=a)a.j.Da&&(a.j.sb=!0),b=!a.j.Da;if(b)Ua(a,!0),a.pb(0),Ua(a,!1);else try{var c=this.a.pb(1);0<c&&(nb(this.a,c),ob(this.a,c,!0),pb(this.a,c))}catch(d){"number"!=typeof d&&Wa(this.a,d.stack||d.message)}this.stop();this.l&&this.l.ya()}};h.oc=function(a){a&&!this.a.j.P&&(this.A&&qb(this),a=rb(this,this.c),this.F==Za?this.h.ob(this.da,a):this.a.ob(this.da,a))};
h.qc=function(a){a||this.a.j.P||(this.C&&qb(this),a=this.F==Za?this.h.mb(this.da):this.a.mb(this.da),rb(this,a))};h.sc=function(a){a||this.a.j.P||sb(this,this.c)};h.rc=function(a){if(a)this.v=!0,fb(this,!0);else if(this.v=!1,fb(this),void 0!==this.o.S0){for(a=this.c=0;22>a;a++)this.b["S"+a][1]=0&1<<a?1:0;gb(this)}};h.vc=function(a,b){this.c=a?this.c|1<<b:this.c&~(1<<b)};
function qb(a){var b=1145>a.a.Ea?8:16,c=65472<=a.da&&a.da<65472+b,b=c?1:2,c=c?15:a.h.na;$a(a,"STEP")||(b=-b);sb(a,a.da&~c|a.da+b&c)}function sb(a,b){a.da=b&a.h.na;b=a.da;for(var c=0;22>c;c++)tb(a,"A"+c,b&1<<c)}function rb(a,b){a.i=b&65535;b=a.i;for(var c=0;16>c;c++)tb(a,"D"+c,b&1<<c);return a.i}function tb(a,b,c){a.g[b]=c;a.v||ib(a,b,c)}h.stop=function(){sb(this,this.a.f[7])};h.setData=function(a,b){b?this.m=a:this.i=a};h.wc=function(a){return(a?this.c:this.m)&65535};h.td=function(a){this.m=a};
var ub={},db=(ub[65400]=[null,null,Ya.prototype.wc,Ya.prototype.td,"CNSW"],ub);function hb(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=B(d),f=Sa(e.id);f||(a=!0,f=new Ya(e));C(f,d);a&&F(f)}}Ga(hb);
function vb(a,b,c){x.call(this,"Bus",a,vb);this.a=b;this.D=c;this.I=a.busWidth||16;this.s=0;this.v=[];this.i=null;this.C=1<<this.I;this.na=this.C-1;this.b=H;this.c=Math.log2(this.b);this.F=this.b>>2;this.l=this.b-1;this.A=this.C/this.b|0;this.za=[];this.g=0;this.m=!1;this.tb=0;this.w=[];this.fc=[wb,xb,yb,zb];a=new I(this);Ab(a,this.D);this.h=Array(this.A);for(b=0;b<this.A;b++)this.h[b]=a;F(this)}z(vb);var H=8192,Bb=H-1;
function wb(a,b){var c=-1,d=this.controller,e=d.za[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.za[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255}
function xb(a,b,c){var d=!1,e=this.controller,f=e.za[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.za[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||J(e,c,16)}function yb(a,b){var c=-1,d=this.controller;a=d.za[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535}
function zb(a,b,c){var d=!1,e=this.controller;a=e.za[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function Cb(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,Db(a,c,H,a.v),a.s=0);b&&(a.s=b,c=1<<b,a.na=c-1,c-=H,a.v=Eb(a,c,H),a.i?Db(a,c,H,a.i):(Fb(a,c,H,Gb,a),a.i=Eb(a,c,H)))}}h=vb.prototype;h.reset=function(){for(var a=0;a<this.w.length;a++)this.w[a]();Cb(this,16)};h.ka=function(a,b){b||this.reset();return!0};
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.La)return l.qb+=l.La-f,l.La=f,!0;if(f>=l.La+l.qb){p=l.size-(f-n);p>g&&(p=g);l.qb=f-l.La+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.D,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.tb+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Eb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function Db(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function Kb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.na)>>>a.c].Cb(b&a.l,b)}function Mb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.na)>>>a.c].V(b&a.l,b)}h.mb=function(a){3932160<=a&&(a=Lb(this.a,a));var b=a&this.l,c=(a&this.na)>>>this.c;this.m=!1;this.g++;a=this.h[c].Xb(b,a);this.g--;return a};
function Nb(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.na)>>>a.c].Hb(b&a.l,c&255,b)}h.$a=function(a,b){3932160<=a&&(a=Lb(this.a,a));this.m=!1;this.g++;this.h[(a&this.na)>>>this.c].Ib(a&this.l,b&255,a);this.g--};function Ob(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.na)>>>a.c].rb(b&a.l,c&65535,b)}h.ob=function(a,b){3932160<=a&&(a=Lb(this.a,a));var c=a&this.l,d=(a&this.na)>>>this.c;this.m=!1;this.g++;this.h[d].dc(c,b&65535,a);this.g--};
function Pb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.h[d];if(e.wa||e.kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Qb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var n=b&Bb;if(void 0!==a.za[n])return t("I/O address already registered: "+m(b,8,!0)),!1;a.za[n]=[d,e,f,g,l||"unknown",k,!1]}return!0}
function cb(a,b,c,d,e){for(var f in c){var g=+f,k=c[f];if(!(k[6]&&k[6]>a.a.Ea)){var l=k[0]?k[0].bind(b):null,n=k[1]?k[1].bind(b):null,p=k[2]?k[2].bind(b):null,u=k[3]?k[3].bind(b):null,w=k[5]||1;65472<=g&&65487>=g&&(!l&&p&&(l=function(a){return function(b){return a(b)&255}.bind(b)}(p)),!n&&u&&(n=function(a){return function(b,c){return a(b,c)}.bind(b)}(u)));for(var D=k[4],U=0;U<w;U++,g+=2)if(D&&1<w&&(D=k[4]+U),!Qb(a,g,g,l,n,p,u,d||64,D||e))return!1}}return!0}function eb(a,b){a.w.push(b)}
function J(a,b,c){a.m=!0;a.g||(c&&(a.a.ea|=c),K(a.a,4,0,b))}function Rb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){x.call(this,"Device",a,L);this.b={L:0,Gb:-1}}z(L);h=L.prototype;h.ia=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.D=d;var e=this;this.b.Gb=Sb(c,function(){e.b.Ya|=128;e.b.Ya&64&&Tb(e.a,e.b.rd);e.l&&e.l.ya(1);Ub(e.a,e.b.Gb,1E3/60)});this.b.rd=Vb(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Ya=128;Ub(this.a,this.b.Gb,1E3/60,!0)};h.Ec=function(){return this.b.Ya};h.Bd=function(a){this.b.Ya=a&192};h.Gc=function(){var a=this.a;return a.I&62337|a.bb<<5|a.cb<<1};h.Dd=function(a){var b=this.a;a&=62337;if(b.I!=a){b.I=a;b.bb=a>>5&3;b.cb=a>>1&15;var c=0;a&257&&(c=4,a&1&&(c|=2));b.Ba!=c&&(b.Ba=c,Xb(b))}};h.Hc=function(){var a=this.a;a.I&57344||(a.Ub=a.$&65535);a=a.Ub;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Ic=function(){var a=this.a;a.I&57344||(a.Vb=a.zb);return a.Vb};
h.Jc=function(){return this.a.Fa};h.Ed=function(a){var b=this.a;1170>b.Ea&&(a&=-49);b.Fa!=a&&(b.Fa=a,b.Sa=a&16?4194303:262143,Xb(b))};h.kd=function(a){a=a>>1&63;var b=this.a.ab[a>>1];return a&1?b>>16:b&65535};h.ee=function(a,b){b=b>>1&63;var c=b>>1;this.a.ab[c]=b&1?this.a.ab[c]&65535|(a&63)<<16:this.a.ab[c]&-65536|a&65534};h.cd=function(a){return this.a.H[1][a>>1&7]};h.Yd=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.ad=function(a){return this.a.H[1][(a>>1&7)+8]};
h.Wd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};h.bd=function(a){return this.a.X[1][a>>1&7]};h.Xd=function(a,b){b=b>>1&7;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.$c=function(a){return this.a.X[1][(a>>1&7)+8]};h.Vd=function(a,b){b=(b>>1&7)+8;this.a.X[1][b]=a;this.a.H[1][b]&=65295};h.Dc=function(a){return this.a.H[0][a>>1&7]};h.Ad=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.Bc=function(a){return this.a.H[0][(a>>1&7)+8]};h.yd=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};
h.Cc=function(a){return this.a.X[0][a>>1&7]};h.zd=function(a,b){b=b>>1&7;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.Ac=function(a){return this.a.X[0][(a>>1&7)+8]};h.xd=function(a,b){b=(b>>1&7)+8;this.a.X[0][b]=a;this.a.H[0][b]&=65295};h.jd=function(a){return this.a.H[3][a>>1&7]};h.de=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.gd=function(a){return this.a.H[3][(a>>1&7)+8]};h.be=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.hd=function(a){return this.a.X[3][a>>1&7]};
h.ce=function(a,b){b=b>>1&7;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.fd=function(a){return this.a.X[3][(a>>1&7)+8]};h.ae=function(a,b){b=(b>>1&7)+8;this.a.X[3][b]=a;this.a.H[3][b]&=65295};h.Na=function(a){a&=7;return this.a.B&2048?this.a.Ga[a]:this.a.f[a]};h.Pa=function(a,b){b&=7;this.a.B&2048?this.a.Ga[b]=a:this.a.f[b]=a};h.Oc=function(){return this.a.B&49152?this.a.oa[0]:this.a.f[6]};h.Jd=function(a){this.a.B&49152?this.a.oa[0]=a:this.a.f[6]=a};h.Rc=function(){return this.a.f[7]};
h.Md=function(a){this.a.f[7]=a};h.Oa=function(a){a&=7;return this.a.B&2048?this.a.f[a]:this.a.Ga[a]};h.Qa=function(a,b){b&=7;this.a.B&2048?this.a.f[b]=a:this.a.Ga[b]=a};h.Pc=function(){return 1==(this.a.B&49152)>>14?this.a.f[6]:this.a.oa[1]};h.Kd=function(a){1==(this.a.B&49152)>>14?this.a.f[6]=a:this.a.oa[1]=a};h.Qc=function(){return 3==(this.a.B&49152)>>14?this.a.f[6]:this.a.oa[3]};h.Ld=function(a){3==(this.a.B&49152)>>14?this.a.f[6]=a:this.a.oa[3]=a};h.yc=function(a){return this.a.$b[a-65504>>1]};
h.vd=function(a,b){this.a.$b[b-65504>>1]=a};h.Wb=function(a){if(65520==a){a=0;switch(Ib){case Ib:a=this.h.tb}a=(a>>6)-1}else a=0;return a};h.cc=function(){};h.ed=function(){return 1};h.$d=function(){};h.xc=function(){return this.a.ea};h.ud=function(){this.a.ea=0};h.Fc=function(){return this.a.Zb};h.Cd=function(a,b){b&1||(a&=255);this.a.Zb=a};h.Kc=function(a){return a?this.a.Eb:0};h.Fd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Eb=a;b.u|=2};
h.dd=function(a){return a?this.a.nb&65280:0};h.Zd=function(a){this.a.nb=a|255};h.Nc=function(){return Zb(this.a)};h.Id=function(a){$b(this.a,a&-1793|Zb(this.a)&1792);this.a.u|=128};h.bc=function(){};
var M={},Wb=(M[61568]=[null,null,L.prototype.kd,L.prototype.ee,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.cd,L.prototype.Yd,"SIPDR",8,1145],M[62608]=[null,null,L.prototype.ad,L.prototype.Wd,"SDPDR",8,1145],M[62624]=[null,null,L.prototype.bd,L.prototype.Xd,"SIPAR",8,1145],M[62640]=[null,null,L.prototype.$c,L.prototype.Vd,"SDPAR",8,1145],M[62656]=[null,null,L.prototype.Dc,L.prototype.Ad,"KIPDR",8,1145],M[62672]=[null,null,L.prototype.Bc,L.prototype.yd,"KDPDR",8,1145],M[62688]=[null,null,L.prototype.Cc,
L.prototype.zd,"KIPAR",8,1145],M[62704]=[null,null,L.prototype.Ac,L.prototype.xd,"KDPAR",8,1145],M[62798]=[null,null,L.prototype.Jc,L.prototype.Ed,"MMR3",1,1145],M[65382]=[null,null,L.prototype.Ec,L.prototype.Bd,"LKS"],M[65402]=[null,null,L.prototype.Gc,L.prototype.Dd,"MMR0",1,1145],M[65404]=[null,null,L.prototype.Hc,L.prototype.bc,"MMR1",1,1145],M[65406]=[null,null,L.prototype.Ic,L.prototype.bc,"MMR2",1,1145],M[65408]=[null,null,L.prototype.jd,L.prototype.de,"UIPDR",8,1145],M[65424]=[null,null,L.prototype.gd,
L.prototype.be,"UDPDR",8,1145],M[65440]=[null,null,L.prototype.hd,L.prototype.ce,"UIPAR",8,1145],M[65456]=[null,null,L.prototype.fd,L.prototype.ae,"UDPAR",8,1145],M[65472]=[null,null,L.prototype.Na,L.prototype.Pa,"R0SET0"],M[65473]=[null,null,L.prototype.Na,L.prototype.Pa,"R1SET0"],M[65474]=[null,null,L.prototype.Na,L.prototype.Pa,"R2SET0"],M[65475]=[null,null,L.prototype.Na,L.prototype.Pa,"R3SET0"],M[65476]=[null,null,L.prototype.Na,L.prototype.Pa,"R4SET0"],M[65477]=[null,null,L.prototype.Na,L.prototype.Pa,
"R5SET0"],M[65478]=[null,null,L.prototype.Oc,L.prototype.Jd,"R6KERNEL"],M[65479]=[null,null,L.prototype.Rc,L.prototype.Md,"R7KERNEL"],M[65480]=[null,null,L.prototype.Oa,L.prototype.Qa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Oa,L.prototype.Qa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Oa,L.prototype.Qa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Oa,L.prototype.Qa,"R3SET1",1,1145],M[65484]=[null,null,L.prototype.Oa,L.prototype.Qa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Oa,
L.prototype.Qa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Pc,L.prototype.Kd,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Qc,L.prototype.Ld,"R6USER",1,1145],M[65504]=[null,null,L.prototype.yc,L.prototype.vd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Wb,L.prototype.cc,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Wb,L.prototype.cc,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.ed,L.prototype.$d,"SYSID",1,1170],M[65526]=[null,null,L.prototype.xc,L.prototype.ud,"CPUERR",1,1170],M[65528]=
[null,null,L.prototype.Fc,L.prototype.Cd,"MB",1,1170],M[65530]=[null,null,L.prototype.Kc,L.prototype.Fd,"PIR"],M[65532]=[null,null,L.prototype.dd,L.prototype.Zd,"SL"],M[65534]=[null,null,L.prototype.Nc,L.prototype.Id,"PSW"],M);Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=B(d);switch(c.type){case "default":c=new L(c);C(c,d);break;case "pc11":c=new ac(c);C(c,d);break;case "rl11":c=new N(c),C(c,d)}}});var bc;
if(Xa){var cc=new ArrayBuffer(2);(new DataView(cc)).setUint16(0,256,!0);bc=256===(new Uint16Array(cc))[0]}else bc=!1;var dc=bc;
function I(a,b,c,d,e,f){this.h=a;this.id=ec+=2;this.a=null;this.La=b;this.qb=c;this.size=d||0;this.type=e||fc;this.l=e==gc;this.controller=null;Ab(this);this.wa=this.kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],hc(this,f.fc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),hc(this,dc?ic:jc);else{a=this.a=Array(this.size>>
function Ya(a){y.call(this,"Panel",a,Ya,2048);this.fa=this.i=this.c=this.m=this.s=this.v=0;this.A=this.B=this.w=!1;this.D=Za;this.g={};this.b={START:[1,1,!0,!1,this.uc],STEP:[1,1,!1,!1,this.vc],ENABLE:[1,1,!1,!1,this.qc],CONT:[1,1,!0,!1,this.oc],DEP:[0,0,!0,!1,this.pc],EXAM:[1,1,!0,!1,this.rc],LOAD:[1,1,!0,!1,this.tc],TEST:[0,0,!0,!1,this.sc]};for(a=0;22>a;a++)this.b["S"+a]=[0,0,!1,!1,this.wc,a]}A(Ya);var Za=7;function $a(a,b){return a.b[b]&&a.b[b][1]}h=Ya.prototype;h.reset=function(){this.stop()};
h.aa=function(a,b,c,d){if(this.l&&this.l.aa(a,b,c,d)||this.a&&this.a.aa(a,b,c,d))return!0;switch(b){case "R0":case "R1":case "R2":case "R3":case "R4":case "R5":case "R6":case "R7":case "NF":case "ZF":case "VF":case "CF":case "PS":return this.o[b]=c,this.v++,!0;default:return"led"==a||"rled"==a?(this.o[b]=c,this.g[b]=d?1:0,this.v++,!0):"switch"==a?(void 0===this.b[b]&&(this.b[b]=[d?1:0,d?1:0]),this.o[b]=c,a=c.parentElement||c,a=a.parentElement||a,a.onmousedown=function(a,b){return function(){ab(a,
b)}}(this,b),a.onmouseup=a.onmouseout=function(a,b){return function(){bb(a,b)}}(this,b),a.ontouchstart=function(a,b){return function(c){ab(a,b);c.preventDefault()}}(this,b),a.ontouchend=function(a,b){return function(){bb(a,b)}}(this,b),!0):this.parent.aa.call(this,a,b,c,d)}};h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;cb(b,this,db);eb(b,this.reset.bind(this));fb(this);gb(this)};h.la=function(a,b){b||(hb(),this.reset());return!0};h.ka=function(){return!0};
function ib(a,b,c){if(a=a.o[b])a.style.backgroundColor=c?"#ff0000":"#000000"}function fb(a,b){for(var c in a.g)ib(a,c,null!=b?b:a.g[c])}function jb(a,b,c){if(a=a.o[b])a.style.marginTop=c?"0px":"20px",a.style.backgroundColor=c?"#00ff00":"#228B22"}function gb(a){for(var b in a.b)jb(a,b,a.b[b][1])}function kb(a,b,c,d){a.o[b]&&(void 0===c&&(Wa(a,"Value for "+b+" is invalid"),G(a.a)),c=8==(a.F&&a.F.h||8)?ka(c,d):m(c,d),a.o[b].textContent!=c&&(a.o[b].textContent=c))}
function ab(a,b){var c=a.b[b];jb(a,b,c[1]=1-c[1]);c[3]=!0;c[4]&&c[4].call(a,c[1],c[5]);"STEP"!=b&&(a.A="DEP"==b,a.B="EXAM"==b)}function bb(a,b){var c=a.b[b];c[2]&&c[3]&&(jb(a,b,c[1]=c[0]),c[4]&&c[4].call(a,c[1],c[5]));c[3]=!1}h.uc=function(a){a||this.a.j.P||(a=this.a,a.h.reset(),lb(a),$a(this,"ENABLE")&&mb(this.a))};h.vc=function(){};h.qc=function(a){a||G(this.a)};
h.oc=function(a){if(!a&&!this.a.j.P)if($a(this,"ENABLE"))mb(this.a);else{a=this.F;var b;if(b=a)a.j.Da&&(a.j.tb=!0),b=!a.j.Da;if(b)Ua(a,!0),a.qb(0,null),Ua(a,!1);else try{var c=this.a.qb(1);0<c&&(nb(this.a,c),ob(this.a,c,!0),pb(this.a,c))}catch(d){"number"!=typeof d&&Wa(this.a,d.stack||d.message)}this.stop();this.l&&this.l.ya()}};h.pc=function(a){a&&!this.a.j.P&&(this.A&&qb(this),a=rb(this,this.c),this.D==Za?this.h.pb(this.fa,a):this.a.pb(this.fa,a))};
h.rc=function(a){a||this.a.j.P||(this.B&&qb(this),a=this.D==Za?this.h.mb(this.fa):this.a.mb(this.fa),rb(this,a))};h.tc=function(a){a||this.a.j.P||sb(this,this.c)};h.sc=function(a){if(a)this.w=!0,fb(this,!0);else if(this.w=!1,fb(this),void 0!==this.o.S0){for(a=this.c=0;22>a;a++)this.b["S"+a][1]=0&1<<a?1:0;gb(this)}};h.wc=function(a,b){this.c=a?this.c|1<<b:this.c&~(1<<b)};
function qb(a){var b=1145>a.a.Ea?8:16,c=65472<=a.fa&&a.fa<65472+b,b=c?1:2,c=c?15:a.h.pa;$a(a,"STEP")||(b=-b);sb(a,a.fa&~c|a.fa+b&c)}function sb(a,b){a.fa=b&a.h.pa;b=a.fa;for(var c=0;22>c;c++)tb(a,"A"+c,b&1<<c)}function rb(a,b){a.i=b&65535;b=a.i;for(var c=0;16>c;c++)tb(a,"D"+c,b&1<<c);return a.i}function tb(a,b,c){a.g[b]=c;a.w||ib(a,b,c)}h.stop=function(){sb(this,this.a.f[7])};h.setData=function(a,b){b?this.m=a:this.i=a};h.xc=function(a,b){return(b?this.m:this.c)&65535};h.vd=function(a){this.m=a};
var ub={},db=(ub[65400]=[null,null,Ya.prototype.xc,Ya.prototype.vd,"CNSW"],ub);function hb(){for(var a=!1,b=E(document,"pdp11","panel"),c=0;c<b.length;c++){var d=b[c],e=C(d),f=Sa(e.id);f||(a=!0,f=new Ya(e));D(f,d);a&&F(f)}}Ga(hb);
function vb(a,b,c){y.call(this,"Bus",a,vb,64);this.a=b;this.F=c;this.I=a.busWidth||16;this.s=0;this.v=[];this.i=null;this.B=1<<this.I;this.pa=this.B-1;this.b=H;this.c=Math.log2(this.b);this.D=this.b>>2;this.l=this.b-1;this.A=this.B/this.b|0;this.Aa=[];this.g=0;this.m=!1;this.ub=0;this.w=[];this.gc=[wb,xb,yb,zb];a=new I(this);Ab(a,this.F);this.h=Array(this.A);for(b=0;b<this.A;b++)this.h[b]=a;F(this)}A(vb);var H=8192,Bb=H-1;
function wb(a,b){var c=-1,d=this.controller,e=d.Aa[a],f=b&65535;e?e[0]?c=e[0](f):e[2]&&(c=f&1?e[2](f&-2)>>8:e[2](f)&255):f&1&&(e=d.Aa[a&-2])&&(e[2]?c=e[2](f&-2)>>8:e[0]&&(c=e[0](f)));if(0<=c)return c;J(d,b,16);return 255}
function xb(a,b,c){var d=!1,e=this.controller,f=e.Aa[a],g=c&65535;if(f)if(f[1])f[1](b,g),d=!0;else{if(f[3]){a=f[2]?f[2](g,!0):0;if(g&1)f[3](a&255|b<<8,g&-2);else f[3](a&-256|b,g);d=!0}}else g&1&&(f=e.Aa[a&-2])&&(f[3]?(g&=-2,a=f[2]?f[2](g,!0):0,f[3](a&255|b<<8,g),d=!0):f[1]&&(f[1](b,g),d=!0));d||J(e,c,16)}function yb(a,b){var c=-1,d=this.controller;a=d.Aa[a];var e=b&65535;a&&(a[2]?c=a[2](e):a[0]&&(c=a[0](e)|a[0](e+1)<<8));if(0<=c)return c;J(d,b,16);return 65535}
function zb(a,b,c){var d=!1,e=this.controller;a=e.Aa[a];var f=c&65535;a&&(a[3]?(a[3](b,f),d=!0):a[1]&&(a[1](b&255,f),a[1](b>>8,f+1),d=!0));d||J(e,c,16)}function Cb(a,b){if(b!=a.s){var c;a.s&&(c=(1<<a.s)-H,Db(a,c,H,a.v),a.s=0);b&&(a.s=b,c=1<<b,a.pa=c-1,c-=H,a.v=Eb(a,c,H),a.i?Db(a,c,H,a.i):(Fb(a,c,H,Gb,a),a.i=Eb(a,c,H)))}}h=vb.prototype;h.reset=function(){for(var a=0;a<this.w.length;a++)this.w[a]();Cb(this,16)};h.la=function(a,b){b||this.reset();return!0};
function Fb(a,b,c,d,e){for(var f=b,g=c,k=f>>>a.c;0<g&&k<a.h.length;){var l=a.h[k],n=k*a.b,p=a.b-(f-n);p>g&&(p=g);if(!e&&l&&l.size){if(l.type==d){if(f+g<=l.Ka)return l.rb+=l.Ka-f,l.Ka=f,!0;if(f>=l.Ka+l.rb){p=l.size-(f-n);p>g&&(p=g);l.rb=f-l.Ka+p;f=n+a.b;g-=p;k++;continue}}return Hb(1,f,g)}f=new I(a,f,p,a.b,d,e);Ab(f,a.F,l);a.h[k++]=f;f=n+a.b;g-=p}return 0>=g?(d==Ib&&(a.ub+=c),a.status((c>>10)+"Kb "+Jb[d]+" at "+ka(b)),!0):Hb(2,b,c)}
function Eb(a,b,c){var d=[];for(b>>>=a.c;0<c&&b<a.h.length;)d.push(a.h[b++]),c-=a.b;return d}function Db(a,b,c,d){var e=0;for(b>>>=a.c;0<c&&b<a.h.length;){var f=d[e++];if(!f)break;a.h[b++]=f;c-=a.b}}function Kb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.pa)>>>a.c].Fb(b&a.l,b)}function Mb(a,b){3932160<=b&&(b=Lb(a.a,b));return a.h[(b&a.pa)>>>a.c].V(b&a.l,b)}h.mb=function(a){3932160<=a&&(a=Lb(this.a,a));var b=a&this.l,c=(a&this.pa)>>>this.c;this.m=!1;this.g++;a=this.h[c].Xb(b,a);this.g--;return a};
function Nb(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.pa)>>>a.c].Jb(b&a.l,c&255,b)}h.$a=function(a,b){3932160<=a&&(a=Lb(this.a,a));this.m=!1;this.g++;this.h[(a&this.pa)>>>this.c].Kb(a&this.l,b&255,a);this.g--};function Ob(a,b,c){3932160<=b&&(b=Lb(a.a,b));a.h[(b&a.pa)>>>a.c].sb(b&a.l,c&65535,b)}h.pb=function(a,b){3932160<=a&&(a=Lb(this.a,a));var c=a&this.l,d=(a&this.pa)>>>this.c;this.m=!1;this.g++;this.h[d].ec(c,b&65535,a);this.g--};
function Pb(a){for(var b=0,c=[],d=0;d<a.A;d++){var e=a.h[d];if(e.wa||e.kc){c[b++]=d;var f=b++;if(e=e.save()){for(var g=0,k=0,l=[];g<e.length;){for(var n=e[g],p=g+1;p<e.length&&e[p]===n;)p++;l[k++]=p-g;l[k++]=n;g=p}l.length<e.length&&(e=l)}c[f]=e}}return c}function Qb(a,b,c,d,e,f,g,k,l){for(;b<=c;b+=2){var n=b&Bb;if(void 0!==a.Aa[n])return t("I/O address already registered: "+m(b,8,!0)),!1;a.Aa[n]=[d,e,f,g,l||"unknown",k,!1]}return!0}
function cb(a,b,c){for(var d in c){var e=+d,f=c[d];if(!(f[6]&&f[6]>a.a.Ea)){var g=f[0]?f[0].bind(b):null,k=f[1]?f[1].bind(b):null,l=f[2]?f[2].bind(b):null,n=f[3]?f[3].bind(b):null;65472<=e&&65487>=e&&(!g&&l&&(g=function(a){return function(b){return a(b)&255}.bind(b)}(l)),!k&&n&&(k=function(a){return function(b,c){return a(b,c)}.bind(b)}(n)));for(var p=f[4],u=f[5]||1,w=0;w<u;w++,e+=2)if(p&&1<u&&(p=f[4]+w),!Qb(a,e,e,g,k,l,n,f[7]||b.qd||64,p||b.za))return!1}}return!0}function eb(a,b){a.w.push(b)}
function J(a,b,c){a.m=!0;a.g||(c&&(a.a.W|=c),K(a.a,4,0,b))}function Rb(a){var b=a.m;a.m=!1;return b}function Hb(a,b,c){t("Memory block error ("+a+": "+m(b)+","+m(c)+")");return!1}function L(a){y.call(this,"Device",a,L,1024);this.b={L:0,Ib:-1}}A(L);h=L.prototype;h.ja=function(a,b,c,d){this.h=b;this.l=a;this.a=c;this.F=d;var e=this;this.b.Ib=Sb(c,function(){e.b.Ya|=128;e.b.Ya&64&&Tb(e.a,e.b.rd);e.l&&e.l.ya(1);Ub(e.a,e.b.Ib,1E3/60)});this.b.rd=Vb(64,6);cb(b,this,Wb);eb(b,this.reset.bind(this));F(this)};
h.reset=function(){this.b.Ya=128;Ub(this.a,this.b.Ib,1E3/60,!0)};h.Fc=function(){return this.b.Ya};h.Dd=function(a){this.b.Ya=a&192};h.Hc=function(){var a=this.a,b=a.X;b&57344||(b=b&-3199|a.bb<<5|a.cb<<1);return b};h.Fd=function(a){Xb(this.a,a&-129|this.a.X&128)};h.Ic=function(){var a=this.a;a.X&57344||(a.Db=a.A>>16&65535);a=a.Db;a&65280&&(a=(a<<8|a>>8)&65535);return a};h.Jc=function(){var a=this.a;a.X&57344||(a.Eb=a.A&65535);return a.Eb};h.Kc=function(){return this.a.Ba};
h.Gd=function(a){var b=this.a;1170>b.Ea&&(a&=-49);b.Ba!=a&&(b.Ba=a,b.Ra=a&16?4194303:262143,Yb(b))};h.ld=function(a){a=a>>1&63;var b=this.a.ab[a>>1];return a&1?b>>16:b&65535};h.ge=function(a,b){b=b>>1&63;var c=b>>1;this.a.ab[c]=b&1?this.a.ab[c]&65535|(a&63)<<16:this.a.ab[c]&-65536|a&65534};h.dd=function(a){return this.a.H[1][a>>1&7]};h.$d=function(a,b){this.a.H[1][b>>1&7]=a&65295};h.bd=function(a){return this.a.H[1][(a>>1&7)+8]};h.Yd=function(a,b){this.a.H[1][(b>>1&7)+8]=a&65295};
h.cd=function(a){return this.a.Z[1][a>>1&7]};h.Zd=function(a,b){b=b>>1&7;this.a.Z[1][b]=a;this.a.H[1][b]&=65295};h.ad=function(a){return this.a.Z[1][(a>>1&7)+8]};h.Xd=function(a,b){b=(b>>1&7)+8;this.a.Z[1][b]=a;this.a.H[1][b]&=65295};h.Ec=function(a){return this.a.H[0][a>>1&7]};h.Cd=function(a,b){this.a.H[0][b>>1&7]=a&65295};h.Cc=function(a){return this.a.H[0][(a>>1&7)+8]};h.Ad=function(a,b){this.a.H[0][(b>>1&7)+8]=a&65295};h.Dc=function(a){return this.a.Z[0][a>>1&7]};
h.Bd=function(a,b){b=b>>1&7;this.a.Z[0][b]=a;this.a.H[0][b]&=65295};h.Bc=function(a){return this.a.Z[0][(a>>1&7)+8]};h.zd=function(a,b){b=(b>>1&7)+8;this.a.Z[0][b]=a;this.a.H[0][b]&=65295};h.kd=function(a){return this.a.H[3][a>>1&7]};h.fe=function(a,b){this.a.H[3][b>>1&7]=a&65295};h.hd=function(a){return this.a.H[3][(a>>1&7)+8]};h.de=function(a,b){this.a.H[3][(b>>1&7)+8]=a&65295};h.jd=function(a){return this.a.Z[3][a>>1&7]};h.ee=function(a,b){b=b>>1&7;this.a.Z[3][b]=a;this.a.H[3][b]&=65295};
h.gd=function(a){return this.a.Z[3][(a>>1&7)+8]};h.ce=function(a,b){b=(b>>1&7)+8;this.a.Z[3][b]=a;this.a.H[3][b]&=65295};h.Ma=function(a){a&=7;return this.a.C&2048?this.a.Fa[a]:this.a.f[a]};h.Oa=function(a,b){b&=7;this.a.C&2048?this.a.Fa[b]=a:this.a.f[b]=a};h.Pc=function(){return this.a.C&49152?this.a.qa[0]:this.a.f[6]};h.Ld=function(a){this.a.C&49152?this.a.qa[0]=a:this.a.f[6]=a};h.Sc=function(){return this.a.f[7]};h.Od=function(a){this.a.f[7]=a};
h.Na=function(a){a&=7;return this.a.C&2048?this.a.f[a]:this.a.Fa[a]};h.Pa=function(a,b){b&=7;this.a.C&2048?this.a.f[b]=a:this.a.Fa[b]=a};h.Qc=function(){return 1==(this.a.C&49152)>>14?this.a.f[6]:this.a.qa[1]};h.Md=function(a){1==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.qa[1]=a};h.Rc=function(){return 3==(this.a.C&49152)>>14?this.a.f[6]:this.a.qa[3]};h.Nd=function(a){3==(this.a.C&49152)>>14?this.a.f[6]=a:this.a.qa[3]=a};h.zc=function(a){return this.a.$b[a-65504>>1]};
h.xd=function(a,b){this.a.$b[b-65504>>1]=a};h.Wb=function(a){if(65520==a){a=0;switch(Ib){case Ib:a=this.h.ub}a=(a>>6)-1}else a=0;return a};h.dc=function(){};h.fd=function(){return 1};h.be=function(){};h.yc=function(){return this.a.W};h.wd=function(){this.a.W=0};h.Gc=function(){return this.a.Zb};h.Ed=function(a,b){b&1||(a&=255);this.a.Zb=a};h.Lc=function(a,b){return b?0:this.a.Gb};h.Hd=function(a){var b=this.a;if(a&=65024){var c=a>>9;do a+=34;while(c>>=1)}b.Gb=a;b.u|=2};
h.ed=function(a,b){return b?0:this.a.ob&65280};h.ae=function(a){this.a.ob=a|255};h.Oc=function(){return Zb(this.a)};h.Kd=function(a){$b(this.a,a&-1793|Zb(this.a)&1792);this.a.u|=128};h.cc=function(){};
var M={},Wb=(M[61568]=[null,null,L.prototype.ld,L.prototype.ge,"UNIMAP",64,1170],M[62592]=[null,null,L.prototype.dd,L.prototype.$d,"SIPDR",8,1145,256],M[62608]=[null,null,L.prototype.bd,L.prototype.Yd,"SDPDR",8,1145,256],M[62624]=[null,null,L.prototype.cd,L.prototype.Zd,"SIPAR",8,1145,256],M[62640]=[null,null,L.prototype.ad,L.prototype.Xd,"SDPAR",8,1145,256],M[62656]=[null,null,L.prototype.Ec,L.prototype.Cd,"KIPDR",8,1145,256],M[62672]=[null,null,L.prototype.Cc,L.prototype.Ad,"KDPDR",8,1145,256],
M[62688]=[null,null,L.prototype.Dc,L.prototype.Bd,"KIPAR",8,1145,256],M[62704]=[null,null,L.prototype.Bc,L.prototype.zd,"KDPAR",8,1145,256],M[62798]=[null,null,L.prototype.Kc,L.prototype.Gd,"MMR3",1,1145,256],M[65382]=[null,null,L.prototype.Fc,L.prototype.Dd,"LKS"],M[65402]=[null,null,L.prototype.Hc,L.prototype.Fd,"MMR0",1,1145,256],M[65404]=[null,null,L.prototype.Ic,L.prototype.cc,"MMR1",1,1145,256],M[65406]=[null,null,L.prototype.Jc,L.prototype.cc,"MMR2",1,1145,256],M[65408]=[null,null,L.prototype.kd,
L.prototype.fe,"UIPDR",8,1145,256],M[65424]=[null,null,L.prototype.hd,L.prototype.de,"UDPDR",8,1145,256],M[65440]=[null,null,L.prototype.jd,L.prototype.ee,"UIPAR",8,1145,256],M[65456]=[null,null,L.prototype.gd,L.prototype.ce,"UDPAR",8,1145,256],M[65472]=[null,null,L.prototype.Ma,L.prototype.Oa,"R0SET0"],M[65473]=[null,null,L.prototype.Ma,L.prototype.Oa,"R1SET0"],M[65474]=[null,null,L.prototype.Ma,L.prototype.Oa,"R2SET0"],M[65475]=[null,null,L.prototype.Ma,L.prototype.Oa,"R3SET0"],M[65476]=[null,null,
L.prototype.Ma,L.prototype.Oa,"R4SET0"],M[65477]=[null,null,L.prototype.Ma,L.prototype.Oa,"R5SET0"],M[65478]=[null,null,L.prototype.Pc,L.prototype.Ld,"R6KERNEL"],M[65479]=[null,null,L.prototype.Sc,L.prototype.Od,"R7KERNEL"],M[65480]=[null,null,L.prototype.Na,L.prototype.Pa,"R0SET1",1,1145],M[65481]=[null,null,L.prototype.Na,L.prototype.Pa,"R1SET1",1,1145],M[65482]=[null,null,L.prototype.Na,L.prototype.Pa,"R2SET1",1,1145],M[65483]=[null,null,L.prototype.Na,L.prototype.Pa,"R3SET1",1,1145],M[65484]=
[null,null,L.prototype.Na,L.prototype.Pa,"R4SET1",1,1145],M[65485]=[null,null,L.prototype.Na,L.prototype.Pa,"R5SET1",1,1145],M[65486]=[null,null,L.prototype.Qc,L.prototype.Md,"R6SUPER",1,1145],M[65487]=[null,null,L.prototype.Rc,L.prototype.Nd,"R6USER",1,1145],M[65504]=[null,null,L.prototype.zc,L.prototype.xd,"CTRL",8,1170],M[65520]=[null,null,L.prototype.Wb,L.prototype.dc,"LSIZE",1,1170],M[65522]=[null,null,L.prototype.Wb,L.prototype.dc,"HSIZE",1,1170],M[65524]=[null,null,L.prototype.fd,L.prototype.be,
"SYSID",1,1170],M[65526]=[null,null,L.prototype.yc,L.prototype.wd,"CPUERR",1,1170],M[65528]=[null,null,L.prototype.Gc,L.prototype.Ed,"MB",1,1170],M[65530]=[null,null,L.prototype.Lc,L.prototype.Hd,"PIR"],M[65532]=[null,null,L.prototype.ed,L.prototype.ae,"SL"],M[65534]=[null,null,L.prototype.Oc,L.prototype.Kd,"PSW"],M);
Ga(function(){for(var a=E(document,"pdp11","device"),b=0;b<a.length;b++){var c,d=a[b];c=C(d);switch(c.type){case "default":c=new L(c);D(c,d);break;case "pc11":c=new ac(c);D(c,d);break;case "rl11":c=new N(c),D(c,d)}}});var bc;if(Xa){var cc=new ArrayBuffer(2);(new DataView(cc)).setUint16(0,256,!0);bc=256===(new Uint16Array(cc))[0]}else bc=!1;var dc=bc;
function I(a,b,c,d,e,f){this.h=a;this.id=ec+=2;this.a=null;this.Ka=b;this.rb=c;this.size=d||0;this.type=e||fc;this.l=e==gc;this.controller=null;Ab(this);this.wa=this.kc=!1;if(this.size)if(f)this.controller=f,a=[null,0],this.a=a[0],hc(this,f.gc);else if(Xa)this.b=new ArrayBuffer(this.size),this.c=new DataView(this.b,0,this.size),this.o=new Uint8Array(this.b,0,this.size),this.s=new Uint16Array(this.b,0,this.size>>1),this.a=new Int32Array(this.b,0,this.size>>2),hc(this,dc?ic:jc);else{a=this.a=Array(this.size>>
2);for(f=0;f<a.length;f++)a[f]=0;hc(this,kc)}else hc(this)}var fc=0,Ib=1,gc=2,Gb=4,Jb=["NONE","RAM","ROM","VID","H/W"],ec=0;
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.wa=!0}return!1},v:function(a,b){J(this.h,b,32);return 255},g:function(a,b,c){J(this.h,c,32)},w:function(a,b){return this.Cb(a++,b++)|
this.Cb(a,b)<<8},A:function(a,b,c){this.Hb(a++,b&255,c++);this.Hb(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},aa:function(a,b){a&1&&J(this.h,b,64);b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},ra:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.wa=!0},va:function(a,b,c){a&1&&J(this.h,c,64);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|
b>>8);this.wa=!0},F:function(a,b){return this.I(a,b)},R:function(a,b){return this.Xb(a,b)},pa:function(a,b,c){this.l?this.g(a,b,c):this.Ib(a,b,c)},ta:function(a,b,c){this.l?this.g(a,b,c):this.dc(a,b,c)},C:function(a){return this.o[a]},J:function(a){return this.o[a]},O:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},$:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},la:function(a,b){this.o[a]=b;this.wa=!0},qa:function(a,b){this.o[a]=b;this.wa=!0},sa:function(a,b,c){a&1&&J(this.h,
c,64);this.c.setUint16(a,b,!0);this.wa=!0},ua:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.wa=!0}};function Ab(a,b,c){a.D=b;a.i=a.m=0;c&&((a.i=c.i)&&mc(a,nc,!1),(a.m=c.m)&&oc(a,nc,!1))}function oc(a,b,c){c&&a.m||(a.Hb=!a.l&&b[1]||a.g,a.rb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Ib=b[1]||a.g,a.dc=b[3]||a.A}function mc(a,b,c){c&&a.i||(a.Cb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Xb=b[2]||a.w}function hc(a,b){b||(b=pc);mc(a,b,void 0);oc(a,b,void 0)}
var pc=[],kc=[I.prototype.M,I.prototype.ra,I.prototype.aa,I.prototype.va],nc=[I.prototype.F,I.prototype.pa,I.prototype.R,I.prototype.ta];if(Xa)var jc=[I.prototype.C,I.prototype.la,I.prototype.O,I.prototype.sa],ic=[I.prototype.J,I.prototype.qa,I.prototype.$,I.prototype.ua];
function qc(a,b){x.call(this,"CPU",a,qc);var c=a.multiplier||1;this.jb=a.cycles||b;this.ta=c;this.Ab=Math.round(this.jb/1E4)/100;this.Ia=this.Ab*this.ta;this.j.P=!1;this.j.Fb=!1;this.j.Wa=a.autoStart;this.j.fb=!1;this.gb=this.Ja=0;this.hb=a.csStart;this.Ta=a.csInterval;this.Ua=a.csStop;this.J=[];this.Tb=this.od.bind(this);F(this)}z(qc);var rc=["power","reset"];h=qc.prototype;
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.D=d;this.w=a.w;for(b=0;b<rc.length;b++)(c=this.o[rc[b]])&&this.l.Z(null,rc[b],c);a=sc(a,"autoStart");null!=a&&(this.j.Wa="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.ka=function(a,b){if(!b){if(a&&this.restore){tc(this);if(!this.restore(a))return!1;uc(this)}else this.reset();this.T("No debugger detected")}return!0};h.ja=function(a){return a?this.save():!0};
h.Wa=function(){return this.j.Wa||void 0===this.o.run?(mb(this),!0):!1};h.Mb=function(){return 0};function uc(a){void 0===a.hb&&(a.hb=0);void 0===a.Ta&&(a.Ta=-1);void 0===a.Ua&&(a.Ua=-1);a.j.fb=0<=a.hb&&0<a.Ta;a.j.fb&&(a.gb=0,a.Ja=a.hb-a.va)}function pb(a,b){if(a.j.fb){var c=!1;a.gb=a.gb+a.Mb()|0;a.Ja-=b;0>=a.Ja&&(a.Ja+=a.Ta,c=!0);0<=a.Ua&&a.Ua<=vc(a)&&(a.Ta=a.Ua=-1,uc(a),G(a),c=!0);c&&a.T(vc(a)+" cycles: checksum="+m(a.gb))}}
h.Z=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.N)a=!0;else{var b=null,c,k=A(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.N);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.kb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){wc(d,d.ta<<1,!0)},c.textContent=this.Ia.toFixed(2)+"Mhz",!0}return!1};h.ya=function(a){this.l&&this.l.ya(a)};function ob(a,b,c){a.va+=b;c&&(a.sa=a.a=a.F=0)}function xc(a,b){var c=1;b&&1<a.ta&&a.qa&&(c=a.qa/a.Ab);a.Rb=Math.round(1E3/30);a.lb=Math.floor(a.jb/30*c);b||(a.Va=a.lb);a.Bb=0}function vc(a){return a.va+a.la+a.sa-a.a}function tc(a){a.qa=0;a.Sb=0;a.va=a.la=a.sa=a.a=a.F=0;uc(a);wc(a,1)}
function wc(a,b,c){if(void 0!==b){.8>a.qa/a.Ia&&(b=1);a.ta=b;b=a.Ab*a.ta;if(a.Ia!=b){a.Ia=b;b=a.Ia.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.T("target speed: "+b)}c&&a.l&&yc(a.l)}ob(a,a.la);a.la=0;a.aa=ra();a.ra=0;xc(a)}function Sb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ub(a,b,c,d){0<=b&&b<a.J.length&&(d||0>a.J[b][0])&&(c=a.jb*a.ta/1E3*c|0,a.j.P&&(c+=zc(a)),a.J[b][0]=c)}
function nb(a,b){for(var c=a.J.length-1;0<=c;c--){var d=a.J[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function zc(a,b){var c=a.sa-=a.a;a.a=a.F=0;b&&(a.sa=0);return c}
h.od=function(){if(this.j.P){this.Bb>=this.jb&&xc(this,!0);this.Ra=0;this.eb=ra();if(this.ra){var a=this.eb-this.ra;a>this.Rb&&(this.aa+=a,this.aa>this.eb&&(this.aa=this.eb))}try{do{for(var b,c=this.j.fb?1:this.lb,d=this.J.length-1;0<=d;d--){var e=this.J[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.pb(b)}catch(f){if("number"!=typeof f)throw f;}b=zc(this,!0);this.Ra+=b;this.la+=b;pb(this,b);nb(this,b);this.Va-=b;if(0>=this.Va){this.Va+=this.lb;15<=++this.Sb&&(this.ya(),this.Sb=0);break}}while(this.j.P)}catch(f){G(this);
this.l&&this.l.stop(ra(),vc(this));Wa(this,f.stack||f.message);return}if(this.j.P){a=setTimeout;b=this.Tb;this.ra=ra();c=this.Rb;this.Ra&&(c=Math.round(c*this.Ra/this.lb));c-=this.ra-this.eb;if(d=this.ra-this.aa)this.qa=Math.round(this.la/(10*d))/100,864E5<=d&&(this.va=0,wc(this));if(0>c||this.qa<this.Ia)-1E3>c&&(this.aa-=c),c=0;this.Bb+=this.Ra;this.ra+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.T(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.P)a.T(a.toString()+" busy");else{wc(a);a.j.P=!0;a.j.Fb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.aa,vc(a));setTimeout(a.Tb,0)}}h.pb=function(){return 0};function G(a){var b=!1;if(a.j.P){zc(a);ob(a,a.la);a.la=0;a.j.P=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),vc(a));b=!0}a.j.complete=void 0;return b}
function Ac(a){this.Ea=+a.model||1170;this.Ob=a.addrReset||0;qc.call(this,a,6666667);this.decode=1120==this.Ea?Bc.bind(this):Cc.bind(this);Dc(this);this.ua=0;this.O=null;this.j.complete=!1}z(Ac,qc);h=Ac.prototype;h.reset=function(){this.status("model "+this.Ea);this.j.P&&G(this);Dc(this);tc(this);this.j.error=!1;this.parent.reset.call(this)};
function Dc(a){a.m=65536;a.g=32768;a.i=65535;a.s=32768;a.B=15;a.f=[0,0,0,0,0,0,0,a.Ob];a.Ga=[0,0,0,0,0,0];a.oa=[0,0,0,0];a.v=0;a.cb=0;a.pd=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.X=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ab=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0];a.$b=[0,0,0,0,0,0,0,0];a.Zb=0;a.u=0;a.A=a.C=0;a.c=a.b=a.xb=0;a.Ka=-1;lb(a)}function lb(a){a.nb=255;a.ea=0;a.Eb=0;a.I=0;a.Ub=0;a.Vb=0;a.Fa=0;a.Ba=0;a.bb=0;a.Sa=262143;a.$=0;a.zb=0;a.O=null;a.h&&Xb(a)}function Xb(a){a.Ba?(a.R=65536,a.M=a.mc,a.V=a.ld,a.rb=a.fe,Cb(a.h,a.Fa&16?22:18)):(a.R=0,a.M=a.lc,a.V=a.Yb,a.rb=a.ec,Cb(a.h,16))}h.Mb=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.va,this.ta]);a.set(2,Pb(this.h));return a.data()};
h.restore=function(a){var b=a[1];this.va=b[1];wc(this,b[3]);a:{b=this.h;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.F){for(var f=0,g=Array(b.F),k=0;k<e.length-1;)for(var l=e[k++],n=e[k++];l--;)g[f++]=n;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function P(a){return a.m&65536?1:0}h.Aa=function(){return this.s&32768?8:0};function Ec(a){var b=a.f[7];a.$=0;a.zb=b;var c=a.V(b);a.f[7]=b+2&65535;return c}
function Fc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function Q(a,b){a.f[7]=b&65535}function Vb(a,b){return{sd:a,Ma:b,next:null}}function Gc(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Tb(a,b){if(b!=a.O){var c=a.O;if(!c||c.Ma<=b.Ma)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.Ma<=b.Ma){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=1}function Hc(a){return a.u&64?(K(a,168,64,-5),!0):a.u&32?(K(a,4,32,-4),!0):a.u&16?(K(a,12,16,-6),!0):!1}
function Zb(a){return a.B=a.B&63728|a.Aa()|(a.i&65535?0:4)|(a.g&32768?2:0)|P(a)}function $b(a,b){a.s=b<<12;a.i=~b&4;a.g=b<<14;a.m=b<<16;if((b^a.B)&2048)for(var c=a.Ga.length;0<=--c;){var d=a.f[c];a.f[c]=a.Ga[c];a.Ga[c]=d}a.v=b>>14&3;c=a.B>>14&3;a.v!=c&&(a.oa[c]=a.f[6],a.f[6]=a.oa[a.v]);a.B=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.g=0)}function Ic(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.g=c||0)}function Jc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^b)&(d^b))}
function Kc(a,b){a.u&128||(a.s=a.i=a.m=b,a.g=a.s^a.m>>1)}function Lc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^d)&(d^b))}function K(a,b,c,d){if(!a.ua){0>a.Ka?a.Ka=Zb(a):a.v||(b=4,a.ea|=4,a.f[6]=4,d=-3);a.zb=b;a.$=0;a.v=0;var e=a.V(b|a.R),f=a.V(b+2&65535|a.R);$b(a,f&-12289|a.Ka>>2&12288);Mc(a,a.Ka);Mc(a,a.f[7]);Q(a,e);a.u&=~(c|18);a.u|=9;a.Ka=-1;if(-3<=d)throw b;}}function Nc(a){var b=Oc(a),c=Oc(a)&-1793;a.B&49152&&(c=c&-225|a.B&63712);Q(a,b);$b(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&a.Fa&32&&(b=a.ab[c]+(b&8190)&4194302,3932160<=b&&4186112>b&&console.log("panic(898)"));return b}
function Pc(a,b,c){var d,e,f;if(!(c&a.Ba))return b;d=b>>13;a.Fa&a.pd[a.v]||(d&=7);e=a.H[a.v][d];f=(a.X[a.v][d]<<6)+(b&8191)&a.Sa;var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(f!=(4194170&a.Sa)||a.v)a.bb=a.v,a.cb=d;b=!1;g&&(g&57344&&(0<=a.Ka&&(g|=128),a.I&57344||(a.I=a.I|g|a.bb<<5|a.cb<<
1),b=!0),a.I&61440||!(f<(4191360&a.Sa)||f>(4194239&a.Sa))||(a.I|=4096,a.I&512&&(a.u|=64)),b&&K(a,168,0,-1));return f}function Oc(a){var b=a.V(a.f[6]|a.R);a.f[6]=a.f[6]+2&65535;return b}function Mc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.$=a.$<<8|246;Qc(a,0,c);a.rb(c,b)}function Qc(a,b,c){!a.v&&c<=a.nb&&(b||4<c)&&(1145<=a.Ea&&c<=a.nb-32?(a.ea|=4,a.f[6]=4,K(a,4,0,-3)):(a.ea|=8,a.u|=32))}
function Rc(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return K(a,4,0,-2),0;case 1:return 6==c&&d&4&&Qc(a,b,a.f[6]),a.a-=3,7==c?a.f[c]:a.f[c]|g;case 2:f=2;e=a.f[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!=c&&(e|=g);e=a.V(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!=c&&(e|=g);e=a.V(e)|g;a.a-=8;break;case 6:return e=a.V(Fc(a,2)),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=a.V(Fc(a,2)),e=e+a.f[c]&
65535,e=a.V(e|a.R)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;a.$=a.$<<8|f<<3&248|c;6==c&&0>f&&Qc(a,b,a.f[6]);return e}h.mb=function(a){if(!this.Ba)return this.h.mb(a);this.ua++;a=this.Yb(Pc(this,a,2));this.ua--;return a};h.$a=function(a,b){this.Ba?(this.ua++,a=Pc(this,a,5),a&1&&this.a--,Nb(this.h,a,b),this.ua--):this.h.$a(a,b)};h.ob=function(a,b){this.Ba?(this.ua++,this.ec(Pc(this,a,4),b),this.ua--):this.h.ob(a,b)};h.lc=function(a,b,c){return Rc(this,a,b,c)};
h.mc=function(a,b,c){return Pc(this,Rc(this,a,b,c),c)};h.Yb=function(a){return Mb(this.h,a)};h.ld=function(a){return Mb(this.h,Pc(this,a,2))};h.ec=function(a,b){Ob(this.h,a,b&65535)};h.fe=function(a,b){Ob(this.h,Pc(this,a,4),b)};function Sc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Rc(a,b,d,2),c&65536||61440!==(a.B&61440)&&(d&=65535),a.v=a.B>>12&3,c=a.V(d|c&a.R),a.v=a.B>>14&3):c=6!=d||(a.B>>2&12288)===(a.B&12288)?a.f[d]:a.oa[a.B>>12&3];return c}
function Tc(a,b,c,d){a.$=22;var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Rc(a,b,e,4),c&65536||(e&=65535),a.v=a.B>>12&3,e=Pc(a,e|c&65536,4),a.v=a.B>>14&3,Ob(a.h,e,d)):6!=e||(a.B>>2&12288)===(a.B&12288)?a.f[e]=d:a.oa[a.B>>12&3]=d}function Uc(a,b){b>>=6;var c=a.C=b&7;(b=a.A=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=-c-1;return a}function Vc(a,b){var c;b>>=6;var d=a.C=b&7;(b=a.A=(b&56)>>3)?c=Mb(a.h,a.M(b,d,2)):c=-d-1;return c}function Wc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Rc(a,b,c,8)}
function Xc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=a.f[c]&255;return a}function Yc(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.h,a.M(b,c,2)):a.f[c]}function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.xb=a.M(b,e,7),c=0>c?a.f[-c-1]&255:c,c=d.call(a,c,Kb(a.h,e)),e&1&&a.a--,Nb(a.h,e,c)):(b=a.f[e],c=0>c?a.f[-c-1]&255:c,a.f[e]=b&65280|d.call(a,c,b&255))}
function T(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.M(b,e,6),Ob(a.h,e,d.call(a,0>c?a.f[-c-1]:c,Mb(a.h,e)))):a.f[e]=d.call(a,0>c?a.f[-c-1]:c,a.f[e])}function Zc(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,e,5),e=c=0>c?a.f[-c-1]&255:c,d&1&&a.a--,Nb(a.h,d,e)):c?(c=0>c?a.f[-c-1]&255:c,a.f[e]=a.f[e]&~d|c<<24>>24&d):a.f[e]&=~d;return c}function $c(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,d,4),Ob(a.h,d,c=0>c?a.f[-c-1]:c)):a.f[d]=c=0>c?a.f[-c-1]:c;return c}
I.prototype={constructor:I,parent:null,save:function(){var a,b;if(this.controller)a=null;else if(Xa)for(a=Array(this.size>>2),b=0;b<a.length;b++)a[b]=this.c.getInt32(b<<2,!0);else a=this.a;return a},restore:function(a){if(this.controller)return!a;if(a&&this.size==a.length<<2){var b;if(Xa)for(b=0;b<a.length;b++)this.c.setInt32(b<<2,a[b],!0);else this.a=a;return this.wa=!0}return!1},v:function(a,b){J(this.h,b,32);return 255},g:function(a,b,c){J(this.h,c,32)},w:function(a,b){return this.Fb(a++,b++)|
this.Fb(a,b)<<8},A:function(a,b,c){this.Jb(a++,b&255,c++);this.Jb(a,b>>8,c)},M:function(a){return this.a[a>>2]>>>((a&3)<<3)&255},ca:function(a,b){a&1&&J(this.h,b,64);b=a>>2;a=(a&3)<<3;var c=this.a[b]>>a;return 24>a?c&65535:c&255|(this.a[b+1]&255)<<8},sa:function(a,b){var c=a>>2;a=(a&3)<<3;this.a[c]=this.a[c]&~(255<<a)|b<<a;this.wa=!0},za:function(a,b,c){a&1&&J(this.h,c,64);c=a>>2;a=(a&3)<<3;24>a?this.a[c]=this.a[c]&~(65535<<a)|b<<a:(this.a[c]=this.a[c]&16777215|b<<24,c++,this.a[c]=this.a[c]&-256|
b>>8);this.wa=!0},D:function(a,b){return this.I(a,b)},R:function(a,b){return this.Xb(a,b)},na:function(a,b,c){this.l?this.g(a,b,c):this.Kb(a,b,c)},ua:function(a,b,c){this.l?this.g(a,b,c):this.ec(a,b,c)},B:function(a){return this.o[a]},J:function(a){return this.o[a]},O:function(a,b){a&1&&J(this.h,b,64);return this.c.getUint16(a,!0)},ba:function(a,b){a&1&&J(this.h,b,64);return this.s[a>>1]},ma:function(a,b){this.o[a]=b;this.wa=!0},ra:function(a,b){this.o[a]=b;this.wa=!0},ta:function(a,b,c){a&1&&J(this.h,
c,64);this.c.setUint16(a,b,!0);this.wa=!0},va:function(a,b,c){a&1&&J(this.h,c,64);this.s[a>>1]=b;this.wa=!0}};function Ab(a,b,c){a.F=b;a.i=a.m=0;c&&((a.i=c.i)&&nc(a,oc,!1),(a.m=c.m)&&pc(a,oc,!1))}function pc(a,b,c){c&&a.m||(a.Jb=!a.l&&b[1]||a.g,a.sb=!a.l&&b[3]||a.A);if(c||void 0===c)a.Kb=b[1]||a.g,a.ec=b[3]||a.A}function nc(a,b,c){c&&a.i||(a.Fb=b[0]||a.v,a.V=b[2]||a.w);if(c||void 0===c)a.I=b[0]||a.v,a.Xb=b[2]||a.w}function hc(a,b){b||(b=qc);nc(a,b,void 0);pc(a,b,void 0)}
var qc=[],kc=[I.prototype.M,I.prototype.sa,I.prototype.ca,I.prototype.za],oc=[I.prototype.D,I.prototype.na,I.prototype.R,I.prototype.ua];if(Xa)var jc=[I.prototype.B,I.prototype.ma,I.prototype.O,I.prototype.ta],ic=[I.prototype.J,I.prototype.ra,I.prototype.ba,I.prototype.va];
function rc(a,b){y.call(this,"CPU",a,rc,1);b=a.cycles||b;var c=a.multiplier||1;this.yb=0;this.jb=b;this.ua=c;this.Bb=Math.round(this.jb/1E4)/100;this.Ha=this.Bb*this.ua;this.j.P=!1;this.j.Hb=!1;this.j.Va=a.autoStart;this.j.fb=!1;this.gb=this.Ia=0;this.hb=a.csStart;this.Sa=a.csInterval;this.Ta=a.csStop;this.J=[];this.bc=this.pd.bind(this);F(this)}A(rc);var sc=["power","reset"];h=rc.prototype;
h.ja=function(a,b,c,d){this.l=a;this.h=b;this.F=d;this.w=a.w;for(b=0;b<sc.length;b++)(c=this.o[sc[b]])&&this.l.aa(null,sc[b],c);a=tc(a,"autoStart");null!=a&&(this.j.Va="true"==a?!0:"false"==a?!1:!!a);F(this)};h.reset=function(){};h.save=function(){return null};h.restore=function(){return!1};h.la=function(a,b){if(!b){if(a&&this.restore){uc(this);if(!this.restore(a))return!1;vc(this)}else this.reset();this.T("No debugger detected")}return!0};h.ka=function(a){return a?this.save():!0};
h.Va=function(){return this.j.Va||void 0===this.o.run?(mb(this),!0):!1};h.Ob=function(){return 0};function vc(a){void 0===a.hb&&(a.hb=0);void 0===a.Sa&&(a.Sa=-1);void 0===a.Ta&&(a.Ta=-1);a.j.fb=0<=a.hb&&0<a.Sa;a.j.fb&&(a.gb=0,a.Ia=a.hb-a.va)}function pb(a,b){if(a.j.fb){var c=!1;a.gb=a.gb+a.Ob()|0;a.Ia-=b;0>=a.Ia&&(a.Ia+=a.Sa,c=!0);0<=a.Ta&&a.Ta<=wc(a)&&(a.Sa=a.Ta=-1,vc(a),G(a),c=!0);c&&a.T(wc(a)+" cycles: checksum="+m(a.gb))}}
h.aa=function(a,b,c){var d=this;switch(b){case "power":case "reset":return this.o[b]=c,!0;case "run":return this.o[b]=c,c.onclick=function(){var a;if(a=d.l)if(a=d.l,a.j.N)a=!0;else{var b=null,c,k=B(a.id);for(c=0;c<k.length&&(b=k[c],b===a||b.j.ready);c++);if(c==k.length)for(c=0;c<k.length&&(b=k[c],b===a||b.j.N);c++);c==k.length&&(b=a);t("The "+b.type+" component ("+b.id+") is not "+(b.j.ready?"powered yet":"ready yet"+(b.kb?" (waiting for notification)":""))+".");a=!1}a&&(d.j.P?G(d):mb(d))},!0;case "speed":return this.o[b]=
c,!0;case "setSpeed":return this.o[b]=c,c.onclick=function(){xc(d,d.ua<<1,!0)},c.textContent=this.Ha.toFixed(2)+"Mhz",!0}return!1};h.ya=function(a){this.l&&this.l.ya(a)};function ob(a,b,c){a.va+=b;c&&(a.ta=a.a=a.I=0)}function yc(a,b){var c=1;b&&1<a.ua&&a.Ga&&(c=a.Ga/a.Bb);a.Ub=Math.round(1E3/30);a.lb=Math.floor(a.jb/30*c);b||(a.Ua=a.lb);a.Cb=0}function wc(a){return a.va+a.na+a.ta-a.a}function uc(a){a.Ga=0;a.Vb=0;a.va=a.na=a.ta=a.a=a.I=0;vc(a);xc(a,1)}
function xc(a,b,c){if(void 0!==b){.8>a.Ga/a.Ha&&(b=1);a.ua=b;b=a.Bb*a.ua;if(a.Ha!=b){a.Ha=b;b=a.Ha.toFixed(2)+"Mhz";var d=a.o.setSpeed;d&&(d.textContent=b);a.T("target speed: "+b)}c&&a.l&&zc(a.l)}ob(a,a.na);a.na=0;a.ca=ra();a.sa=0;yc(a)}function Sb(a,b){var c=a.J.length;a.J.push([-1,b]);return c}function Ub(a,b,c,d){0<=b&&b<a.J.length&&(d||0>a.J[b][0])&&(c=a.jb*a.ua/1E3*c|0,a.j.P&&(c+=Ac(a)),a.J[b][0]=c)}
function nb(a,b){for(var c=a.J.length-1;0<=c;c--){var d=a.J[c];0>d[0]||(d[0]-=b,0>=d[0]&&(d[0]=-1,d[1]()))}}function Ac(a,b){var c=a.ta-=a.a;a.a=a.I=0;b&&(a.ta=0);return c}
h.pd=function(){if(this.j.P){this.Cb>=this.jb&&yc(this,!0);this.Qa=0;this.eb=ra();if(this.sa){var a=this.eb-this.sa;a>this.Ub&&(this.ca+=a,this.ca>this.eb&&(this.ca=this.eb))}try{do{for(var b,c=this.j.fb?1:this.lb,d=this.J.length-1;0<=d;d--){var e=this.J[d];0>e[0]||c>e[0]&&(c=e[0])}b=c;try{this.qb(b)}catch(f){if("number"!=typeof f)throw f;}b=Ac(this,!0);this.Qa+=b;this.na+=b;pb(this,b);nb(this,b);this.Ua-=b;if(0>=this.Ua){this.Ua+=this.lb;15<=++this.Vb&&(this.ya(),this.Vb=0);break}}while(this.j.P)}catch(f){G(this);
this.l&&this.l.stop(ra(),wc(this));Wa(this,f.stack||f.message);return}if(this.j.P){a=setTimeout;b=this.bc;this.sa=ra();c=this.Ub;this.Qa&&(c=Math.round(c*this.Qa/this.lb));c-=this.sa-this.eb;if(d=this.sa-this.ca)this.Ga=Math.round(this.na/(10*d))/100,864E5<=d&&(this.va=0,xc(this));if(0>c||this.Ga<this.Ha)-1E3>c&&(this.ca-=c),c=0;this.Cb+=this.Qa;this.sa+=c;a(b,c)}}};
function mb(a){var b;a.j.error?(a.T(a.toString()+" error"),b=!0):b=!1;if(!b)if(a.j.P)a.T(a.toString()+" busy");else{xc(a);a.j.P=!0;a.j.Hb=!0;if(b=a.o.run)b.textContent="Halt";a.l&&a.l.start(a.ca,wc(a));setTimeout(a.bc,0)}}h.qb=function(){return 0};function G(a){var b=!1;if(a.j.P){Ac(a);ob(a,a.na);a.na=0;a.j.P=!1;if(b=a.o.run)b.textContent="Run";a.l&&a.l.stop(ra(),wc(a));b=!0}a.j.complete=void 0;return b}
function Bc(a){this.Ea=+a.model||1170;this.Sb=a.addrReset||0;rc.call(this,a,6666667);this.decode=1120==this.Ea?Cc.bind(this):Dc.bind(this);Ec(this);this.ma=0;this.O=null;this.j.complete=!1}A(Bc,rc);h=Bc.prototype;h.reset=function(){this.status("model "+this.Ea);this.j.P&&G(this);Ec(this);uc(this);this.j.error=!1;this.parent.reset.call(this)};
function Ec(a){a.m=65536;a.g=32768;a.i=65535;a.s=32768;a.C=15;a.f=[0,0,0,0,0,0,0,a.Sb];a.Fa=[0,0,0,0,0,0];a.qa=[0,0,0,0];a.v=0;a.cb=0;a.sd=[4,2,0,1];a.H=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.Z=[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];a.ab=
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];a.$b=[0,0,0,0,0,0,0,0];a.Zb=0;a.u=0;a.B=a.D=0;a.c=a.b=a.Ab=0;a.Ja=-1;lb(a)}function lb(a){a.X=0;a.Db=0;a.Eb=0;a.Ba=0;a.W=0;a.Gb=0;a.ob=255;a.ba=0;a.bb=0;a.Ra=262143;a.Xa=0;a.A=0;a.O=null;a.h&&Yb(a)}function Yb(a){a.ba?(a.R=65536,a.Rb=a.Ba&16?4186112:253952,a.M=a.nc,a.V=a.md,a.sb=a.he,Cb(a.h,a.Ba&16?22:18)):(a.R=0,a.Rb=57344,a.M=a.mc,a.V=a.Yb,a.sb=a.fc,Cb(a.h,16))}
function Xb(a,b){b&=-3073;if(a.X!=b){b&57344&&!(a.X&57344)&&(a.Db=a.A>>16&65535,a.Eb=a.A&65535);a.X=b;a.bb=b>>5&3;a.cb=b>>1&15;var c=0;b&257&&(c=4,b&1&&(c|=2));a.ba!=c&&(a.ba=c,Yb(a))}}h.Ob=function(){return 0};h.save=function(){var a=new O(this);a.set(0,[]);a.set(1,[this.va,this.ua]);a.set(2,Pb(this.h));return a.data()};
h.restore=function(a){var b=a[1];this.va=b[1];xc(this,b[3]);a:{b=this.h;a=a[2];var c;for(c=0;c<a.length-1;c+=2){var d=a[c],e=a[c+1];if(e&&e.length<b.D){for(var f=0,g=Array(b.D),k=0;k<e.length-1;)for(var l=e[k++],n=e[k++];l--;)g[f++]=n;e=g}f=b.h[d];if(!f||!f.restore(e)){t("Unable to restore memory block "+d);b=!1;break a}}b=!0}return b};function P(a){return a.m&65536?1:0}function Fc(a){return a.s&32768?8:0}function Gc(a){var b=a.f[7];a.A=b;var c=a.V(b);a.f[7]=b+2&65535;return c}
function Hc(a,b){var c=a.f[7];a.f[7]=c+b&65535;return c}function Q(a,b){a.f[7]=b&65535}function Vb(a,b){return{ud:a,La:b,next:null}}function Ic(a,b){var c=a.O;if(c==b)a.O=b.next;else for(;c;){a=c.next;if(a==b){c.next=a.next;break}c=a}}function Tb(a,b){if(b!=a.O){var c=a.O;if(!c||c.La<=b.La)b.next=c,a.O=b;else{do{var d=c.next;if(!d||d.La<=b.La){b.next=d;c.next=b;break}c=d}while(c)}}a.u|=1}function Jc(a){return a.u&64?(K(a,168,64,-5),!0):a.u&32?(K(a,4,32,-4),!0):a.u&16?(K(a,12,16,-6),!0):!1}
function Zb(a){return a.C=a.C&63728|Fc(a)|(a.i&65535?0:4)|(a.g&32768?2:0)|P(a)}function $b(a,b){a.s=b<<12;a.i=~b&4;a.g=b<<14;a.m=b<<16;if((b^a.C)&2048)for(var c=a.Fa.length;0<=--c;){var d=a.f[c];a.f[c]=a.Fa[c];a.Fa[c]=d}a.v=b>>14&3;c=a.C>>14&3;a.v!=c&&(a.qa[c]=a.f[6],a.f[6]=a.qa[a.v]);a.C=b;a.u|=2}function R(a,b){a.u&128||(a.s=a.i=b,a.g=0)}function Kc(a,b,c){a.u&128||(a.s=a.i=a.m=b,a.g=c||0)}function Lc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^b)&(d^b))}
function Mc(a,b){a.u&128||(a.s=a.i=a.m=b,a.g=a.s^a.m>>1)}function Nc(a,b,c,d){a.u&128||(a.s=a.i=a.m=b,a.g=(c^d)&(d^b))}function K(a,b,c,d){if(!a.ma){0>a.Ja?a.Ja=Zb(a):a.v||(b=4,a.W|=4,a.f[6]=4,d=-3);a.A=b|4143316992;a.v=0;var e=a.V(b|a.R),f=a.V(b+2&65535|a.R);$b(a,f&-12289|a.Ja>>2&12288);Oc(a,a.Ja);Oc(a,a.f[7]);Q(a,e);a.u&=~(c|18);a.u|=9;a.Ja=-1;if(-3<=d)throw b;}}function Pc(a){var b=Qc(a),c=Qc(a)&-1793;a.C&49152&&(c=c&-225|a.C&63712);Q(a,b);$b(a,c);a.u&=-17}
function Lb(a,b){var c=b>>13&31;31>c&&(b=a.Ba&32?a.ab[c]+(b&8190)&4194302:b&-3932161);return b}
function Rc(a,b,c){var d,e,f;if(!(c&a.ba))return f=b&65535,57344<=f&&(f|=a.Rb),f;d=b>>13;a.Ba&a.sd[a.v]||(d&=7);e=a.H[a.v][d];f=(a.Z[a.v][d]<<6)+(b&8191)&a.Ra;if(a.ma)return f;f&1&&!(c&1)&&(a.W|=64,K(a,4,0,f));var g=0;switch(e&7){case 1:g=4096;case 2:e|=128;c&4&&(g=8192);break;case 4:g=4096;case 5:c&4&&(g=4096);case 6:e|=c&4?192:128;break;default:g=32768}32512!=(e&32520)&&(e&8?e&32512&&(b&8128)<(e>>2&8128)&&(g|=16384):(b&8128)>(e>>2&8128)&&(g|=16384));a.H[a.v][d]=e;if(f!=(4194170&a.Ra)||a.v)a.bb=
a.v,a.cb=d;g&&(g&57344&&(0<=a.Ja&&(g|=128),a.X&57344||(g|=a.X&4096|a.bb<<5|a.cb<<1,Xb(a,a.X&-61695|g&61694)),K(a,168,64,-1)),a.X&61440||!(f<(4191360&a.Ra)||f>(4194239&a.Ra))||(a.X|=4096,a.X&512&&(a.u|=64)));return f}function Qc(a){var b=a.V(a.f[6]|a.R);a.f[6]=a.f[6]+2&65535;return b}function Oc(a,b){var c=a.f[6]-2&65535;a.f[6]=c;a.A=a.A&65535|(a.A&-65536)<<8|16121856;Sc(a,0,c);a.sb(c,b)}
function Sc(a,b,c){!a.v&&c<=a.ob&&(b||4<c)&&(1145<=a.Ea&&c<=a.ob-32?(a.W|=4,a.f[6]=4,K(a,4,0,-3)):(a.W|=8,a.u|=32))}
function Tc(a,b,c,d){var e,f,g=d&8?0:a.R;switch(b){case 0:return K(a,4,0,-2),0;case 1:return 6==c&&d&4&&Sc(a,b,a.f[6]),a.a-=3,7==c?a.f[c]:a.f[c]|g;case 2:f=2;e=a.f[c];7!=c&&(e|=g,6>c&&d&1&&(f=1));a.a-=3;break;case 3:f=2;e=a.f[c];7!=c&&(e|=g);e=a.V(e);e|=g;a.a-=7;break;case 4:f=-2;6>c&&d&1&&(f=-1);e=a.f[c]+f&65535;7!=c&&(e|=g);a.a-=4;break;case 5:f=-2;e=a.f[c]-2&65535;7!=c&&(e|=g);e=a.V(e)|g;a.a-=8;break;case 6:return e=a.V(Hc(a,2)),e=e+a.f[c]&65535|g,a.a-=6,e;case 7:return e=a.V(Hc(a,2)),e=e+a.f[c]&
65535,e=a.V(e|a.R)|g,a.a-=10,e}a.f[c]=a.f[c]+f&65535;a.A=a.A&65535|(a.A&-65536)<<8|(f<<3&248|c)<<16;6==c&&0>f&&Sc(a,b,a.f[6]);return e}h.mb=function(a){if(!this.ba)return this.h.mb(a);this.ma++;a=this.Yb(Rc(this,a,2));this.ma--;return a};h.$a=function(a,b){this.ba?(this.ma++,a=Rc(this,a,5),a&1&&this.a--,Nb(this.h,a,b),this.ma--):this.h.$a(a,b)};h.pb=function(a,b){this.ba?(this.ma++,this.fc(Rc(this,a,4),b),this.ma--):this.h.pb(a,b)};h.mc=function(a,b,c){return Tc(this,a,b,c)};
h.nc=function(a,b,c){return Rc(this,Tc(this,a,b,c),c)};h.Yb=function(a){return Mb(this.h,this.Xa=a)};h.md=function(a){return Mb(this.h,this.Xa=Rc(this,a,2))};h.fc=function(a,b){Ob(this.h,this.Xa=a,b&65535)};h.he=function(a,b){Ob(this.h,this.Xa=Rc(this,a,4),b)};function Uc(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=Tc(a,b,d,2),c&65536||61440!==(a.C&61440)&&(d&=65535),a.v=a.C>>12&3,c=a.V(d|c&a.R),a.v=a.C>>14&3):c=6!=d||(a.C>>2&12288)===(a.C&12288)?a.f[d]:a.qa[a.C>>12&3];return c}
function Vc(a,b,c,d){a.A=a.A&65535|1441792;var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=Tc(a,b,e,4),c&65536||(e&=65535),a.v=a.C>>12&3,e=Rc(a,e|c&65536,4),a.v=a.C>>14&3,Ob(a.h,e,d)):6!=e||(a.C>>2&12288)===(a.C&12288)?a.f[e]=d:a.qa[a.C>>12&3]=d}function Wc(a,b){b>>=6;var c=a.D=b&7;(b=a.B=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=-c-1;return a}function Xc(a,b){var c;b>>=6;var d=a.D=b&7;(b=a.B=(b&56)>>3)?c=Mb(a.h,a.M(b,d,2)):c=-d-1;return c}function Yc(a,b){var c=a.b=b&7;b=a.c=(b&56)>>3;return Tc(a,b,c,8)}
function Zc(a,b){var c=a.b=b&7;(b=a.c=(b&56)>>3)?(c=a.M(b,c,3),a=Kb(a.h,c)):a=a.f[c]&255;return a}function $c(a,b){var c=a.b=b&7;return(b=a.c=(b&56)>>3)?Mb(a.h,a.M(b,c,2)):a.f[c]}function S(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.Ab=a.M(b,e,7),c=0>c?a.f[-c-1]&255:c,c=d.call(a,c,Kb(a.h,e)),e&1&&a.a--,Nb(a.h,e,c)):(b=a.f[e],c=0>c?a.f[-c-1]&255:c,a.f[e]=b&65280|d.call(a,c,b&255))}
function U(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(e=a.M(b,e,6),Ob(a.h,e,d.call(a,0>c?a.f[-c-1]:c,Mb(a.h,e)))):a.f[e]=d.call(a,0>c?a.f[-c-1]:c,a.f[e])}function ad(a,b,c,d){var e=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,e,5),e=c=0>c?a.f[-c-1]&255:c,d&1&&a.a--,Nb(a.h,d,e)):c?(c=0>c?a.f[-c-1]&255:c,a.f[e]=a.f[e]&~d|c<<24>>24&d):a.f[e]&=~d;return c}function bd(a,b,c){var d=a.b=b&7;(b=a.c=(b&56)>>3)?(d=a.M(b,d,4),Ob(a.h,d,c=0>c?a.f[-c-1]:c)):a.f[d]=c=0>c?a.f[-c-1]:c;return c}
function V(a,b,c){c&&(Q(a,a.f[7]+(b<<24>>23)),a.a-=2);a.a-=3}
h.pb=function(a){this.j.complete=!0;var b=a?this.j.Fb?0:1:-1;this.j.Fb=!1;this.sa=this.a=a;do{if(this.u){if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Eb&224)>>5,e=this.O&&this.O.Ma>d?this.O:null;e&&(c=e.sd,d=e.Ma);d>(this.B&224)>>5?(this.u&4&&(Fc(this,2),this.u&=-5),K(this,c,0,-9),d=!0):d=!1;d&&(e&&Gc(this,e),a=!0)}else this.u&1&&this.u++;a=a&&0>b}if(a)break;if(this.u&112&&Hc(this)&&0>b)break}this.u=this.u&7|this.B&16;this.decode(Ec(this))}while(0<this.a);return this.j.complete?this.sa-
this.a:void 0===this.j.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Ac(d);C(d,c)}});function ad(a,b){var c=b+a;Jc(this,c,a,b);return c&65535}function bd(a,b){var c=b+a;Jc(this,c<<8,a<<8,b<<8);return c&255}function cd(a,b){a=b<<1;Kc(this,a);return a&65535}function dd(a,b){a=b<<1;Kc(this,a<<8);return a&255}function ed(a,b){a=b&32768|b>>1|b<<16;Kc(this,a);return a&65535}function fd(a,b){a=b&128|b>>1|b<<8;Kc(this,a<<8);return a&255}
function gd(a,b){a=b&~a;R(this,a);return a}function hd(a,b){a=b&~a;R(this,a<<8);return a}function id(a,b){a|=b;R(this,a);return a}function jd(a,b){a|=b;R(this,a<<8);return a}function kd(a,b){a=~b|65536;Ic(this,a);return a&65535}function ld(a,b){a=~b|256;Ic(this,a<<8);return a&255}function md(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.g=b&(b^a));return a&65535}function nd(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.g=b&(b^c));return a&255}
function od(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.g=a&(b^a));return a&65535}function pd(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.g=c&(b<<8^c));return a&255}function qd(a,b){a=-b;Ic(this,a,a&b&32768);return a&65535}function rd(a,b){a=-b;Ic(this,a<<8,(a&b&128)<<8);return a&255}function sd(a,b){a=b<<1|this.m>>16&1;Kc(this,a);return a&65535}function td(a,b){a=b<<1|this.m>>16&1;Kc(this,a<<8);return a&255}function ud(a,b){a=(this.m&65536|b)>>1|b<<16;Kc(this,a);return a&65535}
function vd(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Kc(this,a<<8);return a&255}function wd(a,b){var c=b-a;Lc(this,c,a,b);return c&65535}function xd(a,b){var c=b-a;Lc(this,c<<8,a<<8,b<<8);return c&255}function yd(a,b){this.u&128||(this.s=this.i=b&65280,this.g=this.m=0);return(b<<8|b>>8)&65535}function zd(a,b){a^=b;R(this,a);return a&65535}function Ad(a){T(this,a,Vc(this,a),ad);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function Bd(a){var b=Yc(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.m=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.f[a]=c&65535;this.s=this.i=c;this.a-=(this.c?6:7)+b}
function Cd(a){var b=Yc(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.s=d>>16;this.i=d>>16|d;this.a-=(this.c?6:7)+b}function Dd(a){V(this,a,!P(this))}function Ed(a){V(this,a,P(this))}
function Fd(a){T(this,a,Vc(this,a),gd);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function Gd(a){S(this,a,Uc(this,a),hd);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function Hd(a){T(this,a,Vc(this,a),id);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function Id(a){S(this,a,Uc(this,a),jd);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}
function Jd(a){var b=Vc(this,a);a=Yc(this,a);R(this,(0>b?this.f[-b-1]:b)&a);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function Kd(a){var b=Uc(this,a);a=Xc(this,a);R(this,((0>b?this.f[-b-1]&255:b)&a)<<8);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function Ld(a){V(this,a,this.i&65535?0:4)}function Md(a){V(this,a,!this.Aa()==!(this.g&32768))}function Nd(a){V(this,a,!!(this.i&65535)&&!this.Aa()==!(this.g&32768))}
function Od(a){V(this,a,!P(this)&&!!(this.i&65535))}function Pd(a){V(this,a,(this.i&65535?0:4)||!this.Aa()!=!(this.g&32768))}function Qd(a){V(this,a,P(this)||(this.i&65535?0:4))}function Rd(a){V(this,a,!this.Aa()!=!(this.g&32768))}function Sd(a){V(this,a,this.Aa())}function Td(a){V(this,a,!!(this.i&65535))}function Ud(a){V(this,a,!this.Aa())}function Vd(){K(this,12,0,-8);this.a-=5}function Wd(a){V(this,a,!0)}function Xd(a){V(this,a,!(this.g&32768))}function Yd(a){V(this,a,this.g&32768?2:0)}
function W(a){a&1&&(this.m=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.s=0);this.a-=5}function Zd(a){var b=Vc(this,a);a=Yc(this,a);var c=(b=0>b?this.f[-b-1]:b)-a;Lc(this,c,a,b);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}function $d(a){var b=Uc(this,a);a=Xc(this,a);var c=(b=(0>b?this.f[-b-1]&255:b)<<8)-(a<<=8);Lc(this,c,a,b);this.a-=this.c?4+(this.C&&6<=this.b?1:0):(this.A?4:3)+(7==this.b?2:0)}
function ae(a){var b=Yc(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.i=d>>16|d,this.s=d>>16):(this.g=32768,this.i=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.i=this.s=0,this.g=32768,this.m=65536,this.a-=7}function be(){K(this,24,0,-8);this.a-=25}
function ce(){this.B&49152?(this.ea|=128,K(this,4,0,-7)):(this.w&&1120==this.Ea&&this.w.setData(this.f[0],!0),this.D?this.D.b():G(this));this.a-=7}function de(){K(this,16,0,-8);this.a-=25}var ee=[0,7,7,10,7,11,9,13];function fe(a){this.F=this.a;Q(this,Wc(this,a));this.a=this.F-ee[this.c]}var ge=[0,14,14,17,14,18,16,20];function he(a){this.F=this.a;var b=Wc(this,a);a=a>>6&7;Mc(this,this.f[a]);this.f[a]=this.f[7];Q(this,b);this.a=this.F-ge[this.c]}var ie=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function je(a){var b=Vc(this,a);this.F=this.a;R(this,$c(this,a,b));this.a=this.F-ie[(this.A?8:0)+this.c]+(7!=this.b||this.c?0:2)}function ke(a){var b=Uc(this,a);R(this,Zc(this,a,b,65535)<<8);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}var le=[7,13,13,17,14,18,17,21];
function me(a){var b=Yc(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.u&128||(this.s=b>>16,this.i=this.s|b,this.g=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}function ne(){this.a-=5}function oe(){this.B&49152||(this.h.reset(),lb(this));this.a-=667}function pe(a){if(a&8)K(this,8,0,-8);else{var b=Oc(this);a&=7;7==a?Q(this,b):(Q(this,this.f[a]),this.f[a]=b);this.a-=9}}function qe(){Nc(this);this.a-=13}
function X(a){a&1&&(this.m=65536);a&2&&(this.g=32768);a&4&&(this.i=0);a&8&&(this.s=32768);this.a-=5}function re(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)Q(this,this.f[7]-((a&63)<<1)),this.a+=1;this.a-=6}function se(a){T(this,a,Vc(this,a),wd);this.a-=this.c?9+(this.C&&6<=this.b?1:0):(this.A?5:3)+(7==this.b?2:0)}function te(a){T(this,a,0,yd);this.a-=this.c?9:3+(7==this.b?2:0)}function ue(){K(this,28,0,-8);this.a-=5}
function ve(){this.w&&(this.w.da=this.f[7],this.w.setData(this.f[0],!0));this.u|=4;Fc(this,-2);this.a-=3}function we(a){T(this,a,Vc(this,a),zd);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8,0,-8)}function Bc(a){xe[a>>12].call(this,a)}function ye(a){ze[a>>6&3].call(this,a)}function Ae(a){Be[a>>6&3].call(this,a)}function Ce(a){De[a>>6&3].call(this,a)}function Ee(a){Fe[a&15].call(this,a)}function Ge(a){He[a&15].call(this,a)}function Ie(a){Je[a>>6&3].call(this,a)}
function Ke(a){Le[a>>6&3].call(this,a)}function Me(a){Ne[a>>6&3].call(this,a)}
var xe=[function(a){Oe[a>>8&15].call(this,a)},je,Zd,Jd,Fd,Hd,Ad,Y,function(a){Qe[a>>8&15].call(this,a)},ke,$d,Kd,Gd,Id,se,Y],Oe=[function(a){Re[a>>4&15].call(this,a)},Wd,Td,Ld,Md,Rd,Nd,Pd,he,he,ye,Ae,Ce,Y,Y,Y],ze=[function(a){Ic(this,$c(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,kd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,od);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,1,md);this.a-=this.c?9:3+(7==this.b?2:0)}],Be=[function(a){T(this,a,0,
qd);this.a-=this.c?11:6},function(a){T(this,a,P(this)?1:0,ad);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,P(this)?1:0,wd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Yc(this,a);Ic(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],De=[function(a){T(this,a,0,ud);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,sd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,ed);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){T(this,a,0,cd);this.a-=this.c?9:3+(7==this.b?2:0)}],
Re=[function(a){Se[a&15].call(this,a)},Y,Y,Y,fe,fe,fe,fe,pe,Y,Ee,Ge,te,te,te,te],Se=[ce,ve,qe,Vd,de,oe,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],Fe=[ne,function(){this.m=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],He=[ne,function(){this.m=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Qe=[Ud,Sd,Od,Qd,Xd,Yd,Dd,Ed,be,ue,Ie,Ke,Me,Y,Y,Y],Je=[function(a){Ic(this,
Zc(this,a,0,255));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,ld);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,pd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,nd);this.a-=this.c?9:3+(7==this.b?2:0)}],Le=[function(a){S(this,a,0,rd);this.a-=this.c?11:6},function(a){S(this,a,P(this)?1:0,bd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,P(this)?1:0,xd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Xc(this,a);Ic(this,a<<8);this.a-=this.c?4:3+(7==
this.b?2:0)}],Ne=[function(a){S(this,a,0,vd);this.a-=this.c?9+(this.xb&1):3+(7==this.b?2:0)},function(a){S(this,a,0,td);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,fd);this.a-=this.c?9+(this.xb&1):3+(7==this.b?2:0)},function(a){S(this,a,0,dd);this.a-=this.c?9:3+(7==this.b?2:0)}];function Cc(a){Te[a>>12].call(this,a)}
var Te=[function(a){Ue[a>>8&15].call(this,a)},je,Zd,Jd,Fd,Hd,Ad,function(a){Ve[a>>8&15].call(this,a)},function(a){We[a>>8&15].call(this,a)},ke,$d,Kd,Gd,Id,se,Y],Ue=[function(a){Xe[a>>4&15].call(this,a)},Wd,Td,Ld,Md,Rd,Nd,Pd,he,he,ye,Ae,Ce,function(a){Ye[a>>6&3].call(this,a)},Y,Y],Ye=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.V(a|this.R);Q(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Sc(this,a,0);Mc(this,a);R(this,a);this.a-=11},function(a){var b=Oc(this);this.F=
this.a;Tc(this,a,0,b);R(this,b);this.a=this.F-le[this.c]},function(a){R(this,$c(this,a,this.Aa?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Xe=[function(a){Ze[a&15].call(this,a)},Y,Y,Y,fe,fe,fe,fe,pe,function(a){a&8?(this.B&49152||(this.B=this.B&-2017|(a&7)<<5,this.u|=1),this.a-=5):K(this,8,0,-8)},Ee,Ge,te,te,te,te],Ze=[ce,ve,function(){Nc(this);this.u|=this.B&16;this.a-=13},Vd,de,oe,qe,function(){K(this,8,0,-8)},Y,Y,Y,Y,Y,Y,Y,Y],Ve=[me,me,ae,ae,Bd,Bd,Cd,Cd,we,we,Y,Y,Y,Y,re,re],We=[Ud,Sd,Od,Qd,
Xd,Yd,Dd,Ed,be,ue,Ie,Ke,Me,function(a){$e[a>>6&3].call(this,a)},Y,Y],$e=[Y,function(a){a=Sc(this,a,65536);Mc(this,a);R(this,a);this.a-=11},function(a){var b=Oc(this);this.F=this.a;Tc(this,a,65536,b);R(this,b);this.a=this.F-le[this.c]},Y];
function af(a){x.call(this,"ROM",a,af);this.W=this.c=null;this.i=a.addr;this.b=a.size;this.m=!1;this.g=a.alias;this.l=a.file;this.s=q(this.l);if(this.l){a=this.l;var b=la(this.s);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.l+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load ROM resource (error "+f+": "+a+")"),c.l=null):(Ra(c.pa,a,b),(a=ta(a,b))?(c.c=a.K,c.W=a.W):c.l=null);bf(c)})}}z(af);h=af.prototype;
h.ia=function(a,b,c,d){this.h=b;this.a=c;this.D=d;bf(this)};h.ka=function(){this.W&&(this.D&&this.D.a(this.id,this.i,this.b,this.W),delete this.W);return!0};h.ja=function(){return!0};
function bf(a){if(!Va(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(a.c.length!=a.b)Wa(a,"ROM size ("+m(a.c.length,8,!0)+") does not match specified size ("+m(a.b,8,!0)+")");else{var b;a:{b=a.i;a.status(a.b+"-byte ROM at "+ka(b));if(57344<=b&&b<57344+H){var c={};b=(c[b]=[af.prototype.Zc,af.prototype.Ud,null,null,null,a.b>>1],c);if(cb(a.h,a,b,256,a.Ha)){b=a.m=!0;break a}}else if(Fb(a.h,b,a.b,gc)){for(c=0;c<a.c.length;c++)a.h.$a(b+c,a.c[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.g?
b.push(a.g):null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Eb(d.h,d.i,d.b);Db(d.h,e,d.b,f)}a.m||delete a.c}}}F(a)}}h.Zc=function(a){return this.c[a-this.i]};h.Ud=function(){};Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new af(d);C(d,c)}});
function cf(a){x.call(this,"RAM",a,cf);this.W=this.c=null;this.l=a.addr;this.i=a.size;this.ga=a.load;this.fa=a.exec;this.g=!1;this.b=a.file;this.m=q(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load RAM resource (error "+f+": "+a+")"),c.b=null):(Ra(c.pa,a,b),(a=ta(a,b))?(c.c=a.K,c.W=a.W,null==c.ga&&(c.ga=a.ga),null==c.fa&&(c.fa=a.fa)):c.b=null);df(c)})}}z(cf);
cf.prototype.ia=function(a,b,c,d){this.h=b;this.a=c;this.D=d;df(this)};cf.prototype.ka=function(){this.W&&(this.D&&this.D.a(this.id,this.l,this.i,this.W),delete this.W);return!0};cf.prototype.ja=function(){return!0};function df(a){if(a.h&&(!a.g&&a.i&&Fb(a.h,a.l,a.i,Ib)&&(a.g=!0),!Va(a))){if(!a.g)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;ef(a,a.c,a.ga,a.fa,a.l)}F(a)}}
cf.prototype.reset=function(){if(this.g){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Ib(d,g,e.La+d)}c-=a.b;b++;d=0}this.c&&ef(this,this.c,this.ga,this.fa,this.l,!0)}};
function ef(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.$a(p++,b[u++]&255);else p&1?G(a.a):null==d&&(d=p);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.a.$a(c+
g,b[g]);g=!0}g&&null!=d&&(a=a.a,a.Ob=d,a.h.reset(),lb(a),Q(a,d),$b(a,0),!f&&a.D&&(G(a)||a.D.c()));return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new cf(d);C(d,c)}});function ff(a){x.call(this,"Keyboard",a,ff);F(this)}z(ff);ff.prototype.Z=function(){return!1};ff.prototype.ia=function(a,b,c,d){this.l=a;this.a=c;this.D=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new ff(d);C(d,c)}});
function Z(a){this.F=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.O=a.upperCase;this.g=this.m=null;this.J=a.tabSize;this.I=a.charBOL;this.s=0;x.call(this,"SerialPort",a,Z);var b=a.binding;if("console"==b)this.m="";else{var c;a=gf;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.Z(null,a,b))}this.v=this.A=null;this.exports={connect:this.Nb,receiveData:this.Db}}z(Z);var gf="buffer";h=Z.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case gf:return this.o[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.Db(b);return!0},c.onkeypress=function(a){a=a||window.event;d.Db(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.removeAttribute("readonly"),!0}return!1};
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.D=d;var e=this;this.aa=Vb(48,4);this.M=Sb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.O&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&Tb(e.a,e.aa))});this.C=Vb(52,4);this.$=Sb(this.a,function(){e.c|=128;e.c&64&&Tb(e.a,e.C)});cb(b,this,hf);eb(b,this.reset.bind(this));F(this)};
h.Nb=function(){if(!this.v){var a=sc(this.l,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.Ha)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.pa+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.ka=function(a,b){if(!b)if(this.Nb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ja=function(a){return a?this.save():!0};h.reset=function(){jf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return jf(this)};function jf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.Db=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0;b<a.length;b++)this.i.push(a.charCodeAt(b));else this.i=this.i.concat(a);Ub(this.a,this.M,1E3/Math.round(this.F/10));return!0};h.Tc=function(){return this.b&65534};
h.Od=function(a){this.b=this.b&-112|a&111};h.Sc=function(){this.b&=-129;0<this.i.length&&Ub(this.a,this.M,1E3/Math.round(this.F/10));return this.w};h.Nd=function(){};h.nd=function(){return this.c};h.he=function(a){this.c&128&&(a&64?Tb(this.a,this.C):Gc(this.a,this.C));this.c=this.c&-70|a&69};h.md=function(){return 0};
h.ge=function(a){if(a&=255){this.A&&this.A.call(this.v,a);a&=127;if(this.g)if(13==a)this.s=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.I&&!this.s&&c&&(b=String.fromCharCode(this.I)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=
this.m.length)this.T(this.m),this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ub(this.a,this.$,1E3/Math.round(this.R/10))}};var kf={},hf=(kf[65392]=[null,null,Z.prototype.Tc,Z.prototype.Od,"RCSR"],kf[65394]=[null,null,Z.prototype.Sc,Z.prototype.Nd,"RBUF"],kf[65396]=[null,null,Z.prototype.nd,Z.prototype.he,"XCSR"],kf[65398]=[null,null,Z.prototype.md,Z.prototype.ge,"XBUF"],kf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=B(c),d=new Z(d);C(d,c)}});
function ac(a){x.call(this,"PC11",a,ac);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=lf;this.g=mf;this.C=this.i="";this.K=this.ga=this.fa=null;this.I=-1;this.F=!Aa("Mobi")&&window&&"FileReader"in window}z(ac);var lf="",mf=0;h=ac.prototype;
h.Z=function(a,b,c){var d=this,e=mf;switch(b){case "listTapes":return this.o[b]=c,c.onchange=function(){var a=d.o.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){t("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.o[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.o[b]=c,c.onclick=function(){var a=
d.o.listTapes;a&&nf(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.F){c.parentNode.removeChild(c);break}this.o[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;nf(d,q(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.D=d;this.J=of(a);var e=this;if((this.c=sc(this.l,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){t("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.M=Vb(56,4);this.R=Sb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.A=e.v[e.w++]&255,pf(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&Tb(e.a,e.M))});cb(b,this,qf);eb(b,this.reset.bind(this));rf(this,"None",lf,!0);this.F&&
rf(this,"Local Tape","?");rf(this,"Remote Tape","??");sf(this)||F(this)};h.ka=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ja=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.A=0};function sf(a){a.m=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.o.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=q(b,!0)}b&&c?tf(a,c,b,1,!0):uf(a)}return!!a.m}
function nf(a,b,c,d,e){if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=q(c);a.status("Attempting to load "+c+' as "'+b+'"');a.s="??"}else a.s=c;tf(a,b,c,d,!1,e)}else vf(a,!1)}function tf(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.g!=d)g++,vf(a,!0),a.j.Da?a.G("PC11 busy"):(e&&a.m++,wf(a,b,c,d,f)?g++:a.j.Da=!0);g&&xf(a,a.C,a.i,a.g,a.K,a.ga,a.fa)}
function wf(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),xf(a,b,c,d,e),a.s="?");uf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.j.N;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ra(a.pa,e,f),(e=ta(e,f))&&xf(a,b,c,d,e.K,e.ga,e.fa));
a.j.Da=!1;a.m&&(a.m--,a.m||F(a));uf(a)})}function rf(a,b,c,d){if((a=a.o.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function uf(a){var b=a.o.listTapes;if(b&&b.options){a=a.s||a.i;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
function pf(a,b){b|=0;if(b!==a.I){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.I=b}}function xf(a,b,c,d,e,f,g){a.C=b;a.i=c;a.g=d;a.K=e;a.ga=f;a.fa=g;2==d?a.J&&ef(a.J,e,f,g)?a.status("tape loaded: "+b):(a.C="",a.i="",a.s=lf,a.g=mf,a.G("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),pf(a,0))}
function vf(a,b){if(a.i||!1===b)a.C="",a.i="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.s=lf,a.g=mf,uf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Mc=function(){return this.b&65534};h.Hd=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Tb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Ub(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Lc=function(){this.b&=-129;this.b|=2048;return this.A};h.Gd=function(){};
var yf={},qf=(yf[65384]=[null,null,ac.prototype.Mc,ac.prototype.Hd,"PRS"],yf[65386]=[null,null,ac.prototype.Lc,ac.prototype.Gd,"PRB"],yf);function zf(a,b,c){x.call(this,"Disk",{id:a.pa+".disk"+m(++Af,4)},zf);this.controller=a;this.l=a.l;this.D=a.D;this.g=b;this.xa=b.name;this.wb=b.wb;Bf(this,c,b.U,b.Y,b.S,b.ha);F(this)}var Af=0;z(zf);h=zf.prototype;h.ia=function(a,b,c,d){this.D=d};
function Bf(a,b,c,d,e,f){a.mode=b;a.U=c;a.Y=d;a.S=e;a.ha=f;a.a=[];if("preload"!=a.mode){b=Array(a.U);for(c=0;c<b.length;c++){d=Array(a.Y);for(e=0;e<d.length;e++){f=Array(a.S);for(var g=1;g<=f.length;g++)f[g-1]=Cf(null,c,e,g,a.ha,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function Df(a,b,c,d,e){var f=c;if(a.h)return!0;a.xa=b;a.Ca=c;a.ac=q(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.U=e[0];a.Y=e[1];a.S=e[2];a.ha=e[3]||512;c=a.ha>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.U);for(d=0;d<a.a.length;d++)for(var w=a.a[d]=Array(a.Y),D=0;D<w.length;D++)for(var U=w[D]=Array(a.S),xa=0;xa<U.length;xa++){for(var Yb=Cf(null,d,D,xa+1,a.ha,0),Pe=Yb.data,lc=0;lc<c;lc++,f+=4)var eg=Pe[lc]=b.getInt32(f,
!0),e=e+eg&-1;Yb.ba=c;U[xa]=Yb}a.b=e;c=a}else a.G("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.g,c,a.xa,a.Ca),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.wb?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){Ef(a,b,c,d)})}
function Ef(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.N;if(d)a.controller.G('Unable to load disk "'+a.xa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.pa,b,c);try{if(0<q(a.ac,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.xa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(k.length)if(1==k.length)t(k[0]);else{a.U=k.length;a.Y=k[0].length;a.S=k[0][0].length;var l=k[0][0][0];a.ha=l&&l.length||512;for(d=c=0;d<a.U;d++)for(f=0;f<a.Y;f++)for(g=0;g<a.S;g++)if(l=k[d][f][g]){var n=l.length;void 0===n&&(n=l.length=512);var n=n>>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var u=l.data;if(void 0===u){var w=l.bytes;if(void 0!==w&&w.length){for(var D=n<<2,U=w.length;U<D;U++)w[U]=p;Ff(l,w)}else u=[],p=l.pattern=p|p<<8|p<<16|p<<24,l.data=u;delete l.bytes}Cf(l,d,f);for(D=0;D<
u.length;D++)c=c+u[D]&-1}a.a=k;a.b=c;e=a}else t("Empty disk image: "+a.xa)}catch(xa){t("Disk image error ("+b+"): "+xa.message)}}a.h&&(a.h.call(a.i,a.g,e,a.xa,a.Ca),a.h=null)}function Cf(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.ke=b;a.le=c;a.ma=a.ba=0;a.wa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.g,g=this.a[a];if(g){var k=g[b];if(!k&&f.gc&&b<f.Y)for(k=g[b]=Array(f.hc),g=0;g<k.length;g++)k[g]=Cf(null,a,b,g+1,f.Qb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.gc&&9==f.Jb&&(d=k[g]=Cf(null,a,b,f.Jb,f.Qb,0))}}e&&e(d,!1);return d};function Ff(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.ba?f<a.ma?(a.ba+=a.ma-f,a.ma=f):f>=a.ma+a.ba&&(a.ba+=f-(a.ma+a.ba)+1):(a.ma=f,a.ba=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function Gf(a,b){var c=a.Y*a.S,d=b/c|0;return d<a.U?(b%=c,a.seek(d,b/a.S|0,b%a.S+1)):null}function Hf(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}h.save=function(){var a=0,b=[];b[a++]=[this.Ca,this.b,this.U,this.Y,this.S,this.ha];if(!this.c)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.ba){for(var k=[],l=0,n=g.ma,p=g.ma+g.ba;n<p;)k[l++]=g.data[n++];b[a++]=[d,e,f,g.ma,k]}}return b};
h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?Bf(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],l=g[f++],n=g[f++];if(k>=this.a.length||l>=this.a[k].length||n>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+n+") out of range ("+
b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][n]){for(l=k.data.length;l<e;)k.data[l++]=k.pattern;l=0;k.ma=e;for(k.ba=f.length;e<g;)k.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.G("Unable to restore disk '"+this.xa+": "+c);return b};
h.toJSON=function(){var a;a=0;for(var b;b=Gf(this,a++);)If(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function If(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){x.call(this,"RL11",a,N);this.g=a.autoMount||null;this.s=0;this.b=Array(4);this.A=!Aa("Mobi")&&window&&"FileReader"in window}z(N);h=N.prototype;
h.Z=function(a,b,c){var d=this;switch(b){case "listDisks":return this.o[b]=c,c.onchange=function(){var a=d.o.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){t("RL11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.o[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&Jf(d,a)},!0;case "loadDrive":return this.o[b]=
c,c.onclick=function(){var a=d.o.listDisks;a&&Kf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.ca){var b;b="";for(var c=0,k;k=Gf(a,c++);)for(var l=0,n=k.length;l<n;l++)b+=String.fromCharCode(Hf(a,k,l));b=btoa(b);a=a.ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
h.qb=function(a){this.j.complete=!0;var b=a?this.j.Hb?0:1:-1;this.j.Hb=!1;this.ta=this.a=a;do{if(this.u){if(a=this.u&7){a=!1;if(this.u&2){this.u&=-3;var c=160,d=(this.Gb&224)>>5,e=this.O&&this.O.La>d?this.O:null;e&&(c=e.ud,d=e.La);d>(this.C&224)>>5?(this.u&4&&(Hc(this,2),this.u&=-5),K(this,c,0,-9),d=!0):d=!1;d&&(e&&Ic(this,e),a=!0)}else this.u&1&&this.u++;a=a&&0>b}if(a)break;if(this.u&112&&Jc(this)&&0>b)break}this.u=this.u&7|this.C&16;this.decode(Gc(this))}while(0<this.a);return this.j.complete?this.ta-
this.a:void 0===this.j.complete?0:-1};Ga(function(){for(var a=E(document,"pdp11","cpu"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Bc(d);D(d,c)}});function cd(a,b){var c=b+a;Lc(this,c,a,b);return c&65535}function dd(a,b){var c=b+a;Lc(this,c<<8,a<<8,b<<8);return c&255}function ed(a,b){a=b<<1;Mc(this,a);return a&65535}function fd(a,b){a=b<<1;Mc(this,a<<8);return a&255}function gd(a,b){a=b&32768|b>>1|b<<16;Mc(this,a);return a&65535}function hd(a,b){a=b&128|b>>1|b<<8;Mc(this,a<<8);return a&255}
function id(a,b){a=b&~a;R(this,a);return a}function jd(a,b){a=b&~a;R(this,a<<8);return a}function kd(a,b){a|=b;R(this,a);return a}function ld(a,b){a|=b;R(this,a<<8);return a}function md(a,b){a=~b|65536;Kc(this,a);return a&65535}function nd(a,b){a=~b|256;Kc(this,a<<8);return a&255}function od(a,b){a=b-a;this.u&128||(this.s=this.i=a,this.g=b&(b^a));return a&65535}function pd(a,b){a=b-a;var c=a<<8;b<<=8;this.u&128||(this.s=this.i=c,this.g=b&(b^c));return a&255}
function qd(a,b){a=b+a;this.u&128||(this.s=this.i=a,this.g=a&(b^a));return a&65535}function rd(a,b){a=b+a;var c=a<<8;this.u&128||(this.s=this.i=c,this.g=c&(b<<8^c));return a&255}function sd(a,b){a=-b;Kc(this,a,a&b&32768);return a&65535}function td(a,b){a=-b;Kc(this,a<<8,(a&b&128)<<8);return a&255}function ud(a,b){a=b<<1|this.m>>16&1;Mc(this,a);return a&65535}function vd(a,b){a=b<<1|this.m>>16&1;Mc(this,a<<8);return a&255}function wd(a,b){a=(this.m&65536|b)>>1|b<<16;Mc(this,a);return a&65535}
function xd(a,b){a=((this.m&65536)>>8|b)>>1|b<<8;Mc(this,a<<8);return a&255}function yd(a,b){var c=b-a;Nc(this,c,a,b);return c&65535}function zd(a,b){var c=b-a;Nc(this,c<<8,a<<8,b<<8);return c&255}function Ad(a,b){this.u&128||(this.s=this.i=b&65280,this.g=this.m=0);return(b<<8|b>>8)&65535}function Bd(a,b){a^=b;R(this,a);return a&65535}function Cd(a){U(this,a,Xc(this,a),cd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}
function Dd(a){var b=$c(this,a);a=a>>6&7;var c=this.f[a];c&32768&&(c|=4294901760);this.m=this.g=0;b&=63;if(b&32)b=64-b,16<b&&(b=16),this.m=c<<17-b,c>>=b;else if(b)if(16<b)this.g=c,c=0;else{this.m=c<<=b;var d=c>>15&65535;d&&65535!==d&&(this.g=32768)}this.f[a]=c&65535;this.s=this.i=c;this.a-=(this.c?6:7)+b}
function Ed(a){var b=$c(this,a);a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&=63;if(b&32){b=64-b;32<b&&(b=32);var d=c>>b-1;this.m=d<<16;d>>=1;c&2147483648&&(d|=4294967295<<32-b)}else b?(d=c<<b-1,this.m=d>>15,d<<=1,32<b&&(b=32),(c>>=32-b)&&4294967295!==(c|4294967295<<b&4294967295)&&(this.g=32768)):d=c;this.f[a]=d>>16&65535;this.f[a|1]=d&65535;this.s=d>>16;this.i=d>>16|d;this.a-=(this.c?6:7)+b}function Fd(a){V(this,a,!P(this))}function Gd(a){V(this,a,P(this))}
function Hd(a){U(this,a,Xc(this,a),id);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function Id(a){S(this,a,Wc(this,a),jd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function Jd(a){U(this,a,Xc(this,a),kd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function Kd(a){S(this,a,Wc(this,a),ld);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}
function Ld(a){var b=Xc(this,a);a=$c(this,a);R(this,(0>b?this.f[-b-1]:b)&a);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function Md(a){var b=Wc(this,a);a=Zc(this,a);R(this,((0>b?this.f[-b-1]&255:b)&a)<<8);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function Nd(a){V(this,a,this.i&65535?0:4)}function Od(a){V(this,a,!Fc(this)==!(this.g&32768))}function Pd(a){V(this,a,!!(this.i&65535)&&!Fc(this)==!(this.g&32768))}
function Qd(a){V(this,a,!P(this)&&!!(this.i&65535))}function Rd(a){V(this,a,(this.i&65535?0:4)||!Fc(this)!=!(this.g&32768))}function Sd(a){V(this,a,P(this)||(this.i&65535?0:4))}function Td(a){V(this,a,!Fc(this)!=!(this.g&32768))}function Ud(a){V(this,a,Fc(this))}function Vd(a){V(this,a,!!(this.i&65535))}function Wd(a){V(this,a,!Fc(this))}function Xd(){K(this,12,0,-8);this.a-=5}function Yd(a){V(this,a,!0)}function Zd(a){V(this,a,!(this.g&32768))}function $d(a){V(this,a,this.g&32768?2:0)}
function W(a){a&1&&(this.m=0);a&2&&(this.g=0);a&4&&(this.i=1);a&8&&(this.s=0);this.a-=5}function ae(a){var b=Xc(this,a);a=$c(this,a);var c=(b=0>b?this.f[-b-1]:b)-a;Nc(this,c,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}function be(a){var b=Wc(this,a);a=Zc(this,a);var c=(b=(0>b?this.f[-b-1]&255:b)<<8)-(a<<=8);Nc(this,c,a,b);this.a-=this.c?4+(this.D&&6<=this.b?1:0):(this.B?4:3)+(7==this.b?2:0)}
function ce(a){var b=$c(this,a);if(b){a=a>>6&7;var c=this.f[a]<<16|this.f[a|1];this.m=this.g=0;b&32768&&(b|=-65536);var d=~~(c/b);-32768<=d&&32767>=d?(this.f[a]=d&65535,this.f[a|1]=c-d*b&65535,this.i=d>>16|d,this.s=d>>16):(this.g=32768,this.i=d>>15|d,this.s=c>>16,-1===b&&65534===this.f[a]&&(this.f[a]=this.f[a|1]=1));this.a-=53}else this.i=this.s=0,this.g=32768,this.m=65536,this.a-=7}function de(){K(this,24,0,-8);this.a-=25}
function ee(){this.C&49152?(this.W|=128,K(this,4,0,-7)):(this.w&&1120==this.Ea&&this.w.setData(this.f[0],!0),this.F?this.F.b():G(this));this.a-=7}function fe(){K(this,16,0,-8);this.a-=25}var ge=[0,7,7,10,7,11,9,13];function he(a){this.I=this.a;Q(this,Yc(this,a));this.a=this.I-ge[this.c]}var ie=[0,14,14,17,14,18,16,20];function je(a){this.I=this.a;var b=Yc(this,a);a=a>>6&7;Oc(this,this.f[a]);this.f[a]=this.f[7];Q(this,b);this.a=this.I-ie[this.c]}var ke=[3,9,9,13,10,14,12,16,4,9,9,13,10,14,13,17];
function le(a){var b=Xc(this,a);this.I=this.a;R(this,bd(this,a,b));this.a=this.I-ke[(this.B?8:0)+this.c]+(7!=this.b||this.c?0:2)}function me(a){var b=Wc(this,a);R(this,ad(this,a,b,65535)<<8);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}var ne=[7,13,13,17,14,18,17,21];
function oe(a){var b=$c(this,a);a=a>>6&7;b&32768&&(b|=-65536);var c=this.f[a];c&32768&&(c|=-65536);b=~~(b*c);this.f[a]=b>>16&65535;this.f[a|1]=b&65535;this.u&128||(this.s=b>>16,this.i=this.s|b,this.g=0,this.m=-32768>b||32767<b?65536:0);this.a-=23}function pe(){this.a-=5}function qe(){this.C&49152||(this.h.reset(),lb(this),this.w&&this.w.setData(this.f[0],!0));this.a-=667}function re(a){if(a&8)K(this,8,0,-8);else{var b=Qc(this);a&=7;7==a?Q(this,b):(Q(this,this.f[a]),this.f[a]=b);this.a-=9}}
function se(){Pc(this);this.a-=13}function X(a){a&1&&(this.m=65536);a&2&&(this.g=32768);a&4&&(this.i=0);a&8&&(this.s=32768);this.a-=5}function te(a){var b=(a&448)>>6;if(this.f[b]=this.f[b]-1&65535)Q(this,this.f[7]-((a&63)<<1)),this.a+=1;this.a-=6}function ue(a){U(this,a,Xc(this,a),yd);this.a-=this.c?9+(this.D&&6<=this.b?1:0):(this.B?5:3)+(7==this.b?2:0)}function ve(a){U(this,a,0,Ad);this.a-=this.c?9:3+(7==this.b?2:0)}function we(){K(this,28,0,-8);this.a-=5}
function xe(){this.w&&(this.w.fa=this.f[7],this.w.setData(this.f[0],!0));this.u|=4;Hc(this,-2);this.a-=3}function ye(a){U(this,a,this.f[a>>6&7],Bd);this.a-=this.c?9:3+(7==this.b?2:0)}function Y(){K(this,8,0,-8)}function Cc(a){ze[a>>12].call(this,a)}function Ae(a){Be[a>>6&3].call(this,a)}function Ce(a){De[a>>6&3].call(this,a)}function Ee(a){Fe[a>>6&3].call(this,a)}function Ge(a){He[a&15].call(this,a)}function Ie(a){Je[a&15].call(this,a)}function Ke(a){Le[a>>6&3].call(this,a)}
function Me(a){Ne[a>>6&3].call(this,a)}function Oe(a){Pe[a>>6&3].call(this,a)}
var ze=[function(a){Qe[a>>8&15].call(this,a)},le,ae,Ld,Hd,Jd,Cd,Y,function(a){Re[a>>8&15].call(this,a)},me,be,Md,Id,Kd,ue,Y],Qe=[function(a){Se[a>>4&15].call(this,a)},Yd,Vd,Nd,Od,Td,Pd,Rd,je,je,Ae,Ce,Ee,Y,Y,Y],Be=[function(a){Kc(this,bd(this,a,0));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,md);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,qd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,1,od);this.a-=this.c?9:3+(7==this.b?2:0)}],De=[function(a){U(this,a,0,
sd);this.a-=this.c?11:6},function(a){U(this,a,P(this)?1:0,cd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,P(this)?1:0,yd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=$c(this,a);Kc(this,a);this.a-=this.c?4:3+(7==this.b?2:0)}],Fe=[function(a){U(this,a,0,wd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ud);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,gd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){U(this,a,0,ed);this.a-=this.c?9:3+(7==this.b?2:0)}],
Se=[function(a){Te[a&15].call(this,a)},Y,Y,Y,he,he,he,he,re,Y,Ge,Ie,ve,ve,ve,ve],Te=[ee,xe,se,Xd,fe,qe,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y],He=[pe,function(){this.m=0;this.a-=5},function(){this.g=0;this.a-=5},W,function(){this.i=1;this.a-=5},W,W,W,function(){this.s=0;this.a-=5},W,W,W,W,W,W,W],Je=[pe,function(){this.m=65536;this.a-=5},function(){this.g=32768;this.a-=5},X,function(){this.i=0;this.a-=5},X,X,X,function(){this.s=32768;this.a-=5},X,X,X,X,X,X,X],Re=[Wd,Ud,Qd,Sd,Zd,$d,Fd,Gd,de,we,Ke,Me,Oe,Y,Y,Y],Le=[function(a){Kc(this,
ad(this,a,0,255));this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,nd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,rd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,1,pd);this.a-=this.c?9:3+(7==this.b?2:0)}],Ne=[function(a){S(this,a,0,td);this.a-=this.c?11:6},function(a){S(this,a,P(this)?1:0,dd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,P(this)?1:0,zd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){a=Zc(this,a);Kc(this,a<<8);this.a-=this.c?4:3+(7==
this.b?2:0)}],Pe=[function(a){S(this,a,0,xd);this.a-=this.c?9+(this.Ab&1):3+(7==this.b?2:0)},function(a){S(this,a,0,vd);this.a-=this.c?9:3+(7==this.b?2:0)},function(a){S(this,a,0,hd);this.a-=this.c?9+(this.Ab&1):3+(7==this.b?2:0)},function(a){S(this,a,0,fd);this.a-=this.c?9:3+(7==this.b?2:0)}];function Dc(a){Ue[a>>12].call(this,a)}
var Ue=[function(a){Ve[a>>8&15].call(this,a)},le,ae,Ld,Hd,Jd,Cd,function(a){We[a>>8&15].call(this,a)},function(a){Xe[a>>8&15].call(this,a)},me,be,Md,Id,Kd,ue,Y],Ve=[function(a){Ye[a>>4&15].call(this,a)},Yd,Vd,Nd,Od,Td,Pd,Rd,je,je,Ae,Ce,Ee,function(a){Ze[a>>6&3].call(this,a)},Y,Y],Ze=[function(a){a=this.f[7]+((a&63)<<1)&65535;var b=this.V(a|this.R);Q(this,this.f[5]);this.f[6]=a+2&65535;this.f[5]=b;this.a-=8},function(a){a=Uc(this,a,0);Oc(this,a);R(this,a);this.a-=11},function(a){var b=Qc(this);this.I=
this.a;Vc(this,a,0,b);R(this,b);this.a=this.I-ne[this.c]},function(a){R(this,bd(this,a,Fc(this)?65535:0));this.a-=this.c?9:3+(7==this.b?2:0)}],Ye=[function(a){$e[a&15].call(this,a)},Y,Y,Y,he,he,he,he,re,function(a){a&8?(this.C&49152||(this.C=this.C&-2017|(a&7)<<5,this.u|=1),this.a-=5):K(this,8,0,-8)},Ge,Ie,ve,ve,ve,ve],$e=[ee,xe,function(){Pc(this);this.u|=this.C&16;this.a-=13},Xd,fe,qe,se,function(){K(this,8,0,-8)},Y,Y,Y,Y,Y,Y,Y,Y],We=[oe,oe,ce,ce,Dd,Dd,Ed,Ed,ye,ye,Y,Y,Y,Y,te,te],Xe=[Wd,Ud,Qd,Sd,
Zd,$d,Fd,Gd,de,we,Ke,Me,Oe,function(a){af[a>>6&3].call(this,a)},Y,Y],af=[Y,function(a){a=Uc(this,a,65536);Oc(this,a);R(this,a);this.a-=11},function(a){var b=Qc(this);this.I=this.a;Vc(this,a,65536,b);R(this,b);this.a=this.I-ne[this.c]},Y];
function bf(a){y.call(this,"ROM",a,bf,512);this.Y=this.c=null;this.i=a.addr;this.b=a.size;this.m=!1;this.g=a.alias;this.l=a.file;this.s=q(this.l);if(this.l){a=this.l;var b=la(this.s);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.l+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load ROM resource (error "+f+": "+a+")"),c.l=null):(Ra(c.ra,a,b),(a=ta(a,b))?(c.c=a.K,c.Y=a.Y):c.l=null);cf(c)})}}A(bf);h=bf.prototype;
h.ja=function(a,b,c,d){this.h=b;this.a=c;this.F=d;cf(this)};h.la=function(){this.Y&&(this.F&&this.F.a(this.id,this.i,this.b,this.Y),delete this.Y);return!0};h.ka=function(){return!0};
function cf(a){if(!Va(a)){if(a.l){if(!a.c||!a.h)return;a.b||(a.b=a.c.length);if(a.c.length!=a.b)Wa(a,"ROM size ("+m(a.c.length,8,!0)+") does not match specified size ("+m(a.b,8,!0)+")");else{var b;a:{b=a.i;a.status(a.b+"-byte ROM at "+ka(b));if(57344<=b&&b<57344+H){var c={};b=(c[b]=[bf.prototype.$c,bf.prototype.Wd,null,null,null,a.b>>1],c);if(cb(a.h,a,b)){b=a.m=!0;break a}}else if(Fb(a.h,b,a.b,gc)){for(c=0;c<a.c.length;c++)a.h.$a(b+c,a.c[c]);b=!0;break a}b=!1}if(b){b=[];"number"==typeof a.g?b.push(a.g):
null!=a.g&&a.g.length&&(b=a.g);for(c=0;c<b.length;c++){var d=a,e=b[c],f=Eb(d.h,d.i,d.b);Db(d.h,e,d.b,f)}a.m||delete a.c}}}F(a)}}h.$c=function(a){return this.c[a-this.i]};h.Wd=function(){};Ga(function(){for(var a=E(document,"pdp11","rom"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new bf(d);D(d,c)}});
function df(a){y.call(this,"RAM",a,df);this.Y=this.c=null;this.l=a.addr;this.i=a.size;this.ha=a.load;this.ga=a.exec;this.g=!1;this.b=a.file;this.m=q(this.b);if(this.b){a=this.b;var b=la(this.m);"json"!=b&&"hex"!=b&&(a=v()+"/api/v1/dump?file="+this.b+"&format=bytes&decimal=true");var c=this;r(a,null,!0,function(a,b,f){f?(c.G("Unable to load RAM resource (error "+f+": "+a+")"),c.b=null):(Ra(c.ra,a,b),(a=ta(a,b))?(c.c=a.K,c.Y=a.Y,null==c.ha&&(c.ha=a.ha),null==c.ga&&(c.ga=a.ga)):c.b=null);ef(c)})}}A(df);
df.prototype.ja=function(a,b,c,d){this.h=b;this.a=c;this.F=d;ef(this)};df.prototype.la=function(){this.Y&&(this.F&&this.F.a(this.id,this.l,this.i,this.Y),delete this.Y);return!0};df.prototype.ka=function(){return!0};function ef(a){if(a.h&&(!a.g&&a.i&&Fb(a.h,a.l,a.i,Ib)&&(a.g=!0),!Va(a))){if(!a.g)t("No RAM allocated");else if(a.b){if(!a.c||!a.h)return;ff(a,a.c,a.ha,a.ga,a.l)}F(a)}}
df.prototype.reset=function(){if(this.g){for(var a=this.h,b=this.l,c=this.i,d=b&a.l,b=b>>>a.c;0<c&&b<a.h.length;){var e=a.h[b];if(e.controller&&a.i&&a.i.length==a.v.length){var f=a.i.indexOf(e);0<=f&&(e=a.v[f])}if(e){var f=c,g=0,k,d=d||0,g=g&255;void 0===f&&(f=e.size);if(Xa&&e.o)for(k=d;f--&&k<e.o.length;k++)e.o[k]=g;else for(k=d;f--&&k<e.size;k++)e.Kb(d,g,e.Ka+d)}c-=a.b;b++;d=0}this.c&&ff(this,this.c,this.ha,this.ga,this.l,!0)}};
function ff(a,b,c,d,e,f){var g=!1;if(null==c)for(var k=0;k<b.length-1;){var l=b[k]&255|(b[k+1]&255)<<8;if(l)if(l&255){if(1!=l)break;if(k+6>=b.length)break;for(var k=k+2,n=b[k++]&255|(b[k++]&255)<<8,p=b[k++]&255|(b[k++]&255)<<8,l=l+((n&255)+(n>>8)+(p&255)+(p>>8)),u=k,w=n-=6;0<n&&k<b.length;)l+=b[k++]&255,n--;if(n||k>=b.length)break;l+=b[k++]&255;if(l&255)break;if(w)for(;w--;)a.a.$a(p++,b[u++]&255);else p&1?G(a.a):null==d&&(d=p);g=!0}else k++;else k+=2}if(!g&&(null==c&&(c=e),null!=c)){for(g=0;g<b.length;g++)a.a.$a(c+
g,b[g]);g=!0}g&&null!=d&&(a=a.a,a.Sb=d,a.h.reset(),lb(a),Q(a,d),$b(a,0),!f&&a.F&&(G(a)||a.F.c()));return g}Ga(function(){for(var a=E(document,"pdp11","ram"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new df(d);D(d,c)}});function gf(a){y.call(this,"Keyboard",a,gf,65536);F(this)}A(gf);gf.prototype.aa=function(){return!1};gf.prototype.ja=function(a,b,c,d){this.l=a;this.a=c;this.F=d};Ga(function(){for(var a=E(document,"pdp11","keyboard"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new gf(d);D(d,c)}});
function Z(a){this.D=a.baudReceive||9600;this.R=a.baudTransmit||9600;this.O=a.upperCase;this.g=this.m=null;this.J=a.tabSize;this.I=a.charBOL;this.s=0;y.call(this,"SerialPort",a,Z,8388608);var b=a.binding;if("console"==b)this.m="";else{var c;a=hf;b&&(void 0===c&&(c="Panel"),(c=Ta(c,this.id))&&(b=c.o[b])&&this.aa(null,a,b))}this.v=this.A=null;this.exports={connect:this.Pb,receiveData:this.nb}}A(Z);var hf="buffer";h=Z.prototype;
h.aa=function(a,b,c){var d=this;switch(b){case hf:return this.o[b]=this.g=c,c.onkeydown=function(a){a=a||window.event;var b=a.keyCode;if(8===b||a.ctrlKey&&65<=b&&90>=b)a.preventDefault&&a.preventDefault(),64<b&&(b-=64),d.nb(b);return!0},c.onkeypress=function(a){a=a||window.event;d.nb(a.which||a.keyCode);a.preventDefault&&a.preventDefault();return!0},c.onpaste=function(a){a.stopPropagation&&a.stopPropagation();a.preventDefault&&a.preventDefault();(a=a.clipboardData||window.clipboardData)&&d.nb(a.getData("Text"))},
c.removeAttribute("readonly"),!0}return!1};h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;var e=this;this.ca=Vb(48,4);this.M=Sb(this.a,function(){e.b&128||!e.i.length||(e.w=e.i.shift()&255,e.O&&97<=e.w&&122>e.w&&(e.w-=32),e.b|=128,e.b&64&&Tb(e.a,e.ca))});this.B=Vb(52,4);this.ba=Sb(this.a,function(){e.c|=128;e.c&64&&Tb(e.a,e.B)});cb(b,this,jf);eb(b,this.reset.bind(this));F(this)};
h.Pb=function(){if(!this.v){var a=tc(this.l,"connection");if(a){var b=a.split("->");if(2==b.length){var c=pa(b[0]);if(c!=this.za)return;b=pa(b[1]);if(this.v=Sa(b)){var d=this.v.exports;if(d){var e=d.connect;e&&e.call(this.v);if(this.A=d.receiveData){this.status(this.ra+"."+c+" connected to "+b);return}}}}this.status("Unable to establish connection: "+a)}}};h.la=function(a,b){if(!b)if(this.Pb(),!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};
h.ka=function(a){return a?this.save():!0};h.reset=function(){kf(this)};h.save=function(){var a=new O(this);a.set(0,[]);return a.data()};h.restore=function(){return kf(this)};function kf(a){a.w=0;a.b=0;a.c=128;a.i=[];return!0}h.nb=function(a){if("number"==typeof a)this.i.push(a);else if("string"==typeof a)for(var b=0,c,d=0;d<a.length;d++){c=b;b=a.charCodeAt(d);if(10==b){if(13==c)continue;b=13}this.i.push(b)}else this.i=this.i.concat(a);Ub(this.a,this.M,1E3/Math.round(this.D/10));return!0};
h.Uc=function(){return this.b&65534};h.Qd=function(a){this.b=this.b&-112|a&111};h.Tc=function(){this.b&=-129;0<this.i.length&&Ub(this.a,this.M,1E3/Math.round(this.D/10));return this.w};h.Pd=function(){};h.od=function(){return this.c};h.je=function(a){this.c&128&&(a&64?Tb(this.a,this.B):Ic(this.a,this.B));this.c=this.c&-70|a&69};h.nd=function(){return 0};
h.ie=function(a){if(a&=255){this.A&&this.A.call(this.v,a);a&=127;if(this.g)if(13==a)this.s=0;else if(8==a)this.g.value=this.g.value.slice(0,-1),0<this.s&&this.s--;else{var b;b=(b=qa[a])?"<"+b+">":String.fromCharCode(a);var c=b.length;32>a&&1==c&&(c=0);9==a&&(a=this.J||8,c=a-this.s%a,this.J&&(b=" ".slice(0,c)));this.I&&!this.s&&c&&(b=String.fromCharCode(this.I)+b);this.g.value+=b;this.g.scrollTop=this.g.scrollHeight;this.s+=c}else if(null!=this.m){if(10==a||1024<=
this.m.length)this.T(this.m),this.m="";10!=a&&(this.m+=String.fromCharCode(a))}this.c&=-129;Ub(this.a,this.ba,1E3/Math.round(this.R/10))}};var lf={},jf=(lf[65392]=[null,null,Z.prototype.Uc,Z.prototype.Qd,"RCSR"],lf[65394]=[null,null,Z.prototype.Tc,Z.prototype.Pd,"RBUF"],lf[65396]=[null,null,Z.prototype.od,Z.prototype.je,"XCSR"],lf[65398]=[null,null,Z.prototype.nd,Z.prototype.ie,"XBUF"],lf);Ga(function(){for(var a=E(document,"pdp11","serial"),b=0;b<a.length;b++){var c=a[b],d=C(c),d=new Z(d);D(d,c)}});
function ac(a){y.call(this,"PC11",a,ac);this.c=a.autoMount||null;this.m=0;this.O=a.baudReceive||3600;this.w=this.A=this.b=0;this.v=[];this.s=mf;this.g=nf;this.B=this.i="";this.K=this.ha=this.ga=null;this.I=-1;this.D=!Ba("Mobi")&&window&&"FileReader"in window}A(ac);var mf="",nf=0;h=ac.prototype;
h.aa=function(a,b,c){var d=this,e=nf;switch(b){case "listTapes":return this.o[b]=c,c.onchange=function(){var a=d.o.descTape,b=c.options[c.selectedIndex];if(a&&b){var e={};if(b=b.getAttribute("data-value"))try{e=eval("("+b+")")}catch(l){t("PC11 option error: "+l.message)}b=e.desc;void 0===b&&(b="");e=e.href;void 0!==e&&(b='<a href="'+e+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descTape":return this.o[b]=c,!0;case "loadTape":e=2;case "attachTape":return e||(e=1),this.o[b]=c,c.onclick=
function(){var a=d.o.listTapes;a&&of(d,a.options[a.selectedIndex].text,a.value,e)},!0;case "mountTape":if(!this.D){c.parentNode.removeChild(c);break}this.o[b]=c;c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length});c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;of(d,q(b,!0),b,1,a)}return!1};return!0;case "readProgress":return this.o[b]=c,!0}return!1};
h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;this.J=pf(a);var e=this;if((this.c=tc(this.l,"autoMount")||this.c)&&"string"==typeof this.c)try{this.c=eval("("+this.c+")")}catch(f){t("PC11 auto-mount error: "+f.message+" ("+this.c+")"),this.c=null}this.M=Vb(56,4);this.R=Sb(this.a,function(){1==(e.b&32769)&&!(e.b&128)&&e.w<e.v.length&&(e.A=e.v[e.w++]&255,qf(e,e.w/e.v.length*100),e.b|=128,e.b&=-2049,e.b&64&&Tb(e.a,e.M))});cb(b,this,rf);eb(b,this.reset.bind(this));sf(this,"None",mf,!0);this.D&&
sf(this,"Local Tape","?");sf(this,"Remote Tape","??");tf(this)||F(this)};h.la=function(a,b){if(!b)if(!a||!this.restore)this.reset();else if(!this.restore(a))return!1;return!0};h.ka=function(a){return a?this.save():!0};h.reset=function(){this.b&=-2241;this.A=0};function tf(a){a.m=0;if(a.c){var b=a.c.path||"",c;if(!(c=a.c.name))a:{if((c=a.o.listTapes)&&c.options)for(var d=0;d<c.options.length;d++){var e=c.options[d];if(e.value==b){c=e.text;break a}}c=q(b,!0)}b&&c?uf(a,c,b,1,!0):vf(a)}return!!a.m}
function of(a,b,c,d,e){if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to select and load a local tape.');else{if("??"==c){c=window.prompt("Enter the URL of a remote tape image.","")||"";if(!c)return;b=q(c);a.status("Attempting to load "+c+' as "'+b+'"');a.s="??"}else a.s=c;uf(a,b,c,d,!1,e)}else wf(a,!1)}function uf(a,b,c,d,e,f){var g=-1;if(a.i.toLowerCase()!=c.toLowerCase()||a.g!=d)g++,wf(a,!0),a.j.Da?a.G("PC11 busy"):(e&&a.m++,xf(a,b,c,d,f)?g++:a.j.Da=!0);g&&yf(a,a.B,a.i,a.g,a.K,a.ha,a.ga)}
function xf(a,b,c,d,e){var f=c;if(e){var g=new FileReader;g.onload=function(){var e=g.result;e&&(e=new Uint8Array(e,0,e.byteLength),yf(a,b,c,d,e),a.s="?");vf(a)};g.readAsArrayBuffer(e);return!0}0>c.indexOf("/api/v1/dump")&&(e=la(c),f="json"==e||"gz"==e?encodeURI(c):v()+"/api/v1/dump?path="+encodeURIComponent(c)+"&format=json");return!!r(f,null,!0,function(e,f,g){var k=0>g&&a.l&&!a.l.j.N;g?a.G('Unable to load tape "'+b+'" (error '+g+": "+e+")",k):(Ra(a.ra,e,f),(e=ta(e,f))&&yf(a,b,c,d,e.K,e.ha,e.ga));
a.j.Da=!1;a.m&&(a.m--,a.m||F(a));vf(a)})}function sf(a,b,c,d){if((a=a.o.listTapes)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}function vf(a){var b=a.o.listTapes;if(b&&b.options){a=a.s||a.i;for(var c=0;c<b.options.length;c++)if(b.options[c].value==a){b.selectedIndex!=c&&(b.selectedIndex=c);break}c==b.options.length&&(b.selectedIndex=0)}}
function qf(a,b){b|=0;if(b!==a.I){var c=a.o.readProgress;c&&(c=(c=E(c,"pcjs-progress-bar"))&&c[0])&&c.style&&(c.style.width=b+"%");a.I=b}}function yf(a,b,c,d,e,f,g){a.B=b;a.i=c;a.g=d;a.K=e;a.ha=f;a.ga=g;2==d?a.J&&ff(a.J,e,f,g)?a.status("tape loaded: "+b):(a.B="",a.i="",a.s=mf,a.g=nf,a.G("No load address available for tape: "+b)):(a.w=0,a.v=e,a.status("tape attached: "+b),qf(a,0))}
function wf(a,b){if(a.i||!1===b)a.B="",a.i="",b||(a.g&&a.status(1==a.g?"tape detached":"tape unloaded"),a.s=mf,a.g=nf,vf(a))}h.save=function(){return(new O(this)).data()};h.restore=function(){return!0};h.Nc=function(){return this.b&65534};h.Jd=function(a){a&1&&(this.b&32768?(a&=-2,this.b&64&&Tb(this.a,this.M)):(this.b&=-129,this.b|=2048,this.A=0,Ub(this.a,this.R,1E3/Math.round(this.O/10))));this.b=this.b&-66|a&65};h.Mc=function(){this.b&=-129;this.b|=2048;return this.A};h.Id=function(){};
var zf={},rf=(zf[65384]=[null,null,ac.prototype.Nc,ac.prototype.Jd,"PRS"],zf[65386]=[null,null,ac.prototype.Mc,ac.prototype.Id,"PRB"],zf);function Af(a,b,c){y.call(this,"Disk",{id:a.ra+".disk"+m(++Bf,4)},Af,4194304);this.controller=a;this.l=a.l;this.F=a.F;this.g=b;this.xa=b.name;this.xb=b.xb;Cf(this,c,b.U,b.$,b.S,b.ia);F(this)}var Bf=0;A(Af);h=Af.prototype;h.ja=function(a,b,c,d){this.F=d};
function Cf(a,b,c,d,e,f){a.mode=b;a.U=c;a.$=d;a.S=e;a.ia=f;a.a=[];if("preload"!=a.mode){b=Array(a.U);for(c=0;c<b.length;c++){d=Array(a.$);for(e=0;e<d.length;e++){f=Array(a.S);for(var g=1;g<=f.length;g++)f[g-1]=Df(null,c,e,g,a.ia,0);d[e]=f}b[c]=d}a.a=b}a.b=null}
function Ef(a,b,c,d,e){var f=c;if(a.h)return!0;a.xa=b;a.Ca=c;a.ac=q(c);a.h=e;a.i=a.controller;if(d){var g=new FileReader;g.onload=function(){var b=g.result,c,d=b?b.byteLength:0,e=ia[d];if(e){a.U=e[0];a.$=e[1];a.S=e[2];a.ia=e[3]||512;c=a.ia>>2;var f=e=0,b=new DataView(b,0,d);a.a=Array(a.U);for(d=0;d<a.a.length;d++)for(var w=a.a[d]=Array(a.$),T=0;T<w.length;T++)for(var xa=w[T]=Array(a.S),ya=0;ya<xa.length;ya++){for(var lc=Df(null,d,T,ya+1,a.ia,0),fg=lc.data,mc=0;mc<c;mc++,f+=4)var gg=fg[mc]=b.getInt32(f,
!0),e=e+gg&-1;lc.da=c;xa[ya]=lc}a.b=e;c=a}else a.G("Unrecognized disk format ("+d+" bytes)");a.h&&(a.h.call(a.controller,a.g,c,a.xa,a.Ca),a.h=null)};g.readAsArrayBuffer(d);return!0}0>c.indexOf("/api/v1/dump")&&(b=la(c),"json"==b||"gz"==b?f=encodeURI(c):(d="path",e="&mbhd=10",!c.indexOf("http:")||!c.indexOf("ftp:")||0<="dsk ima img 360 720 12 144".split(" ").indexOf(b)?(d="disk",e="&mbhd=0"):ma(c,"/")&&(d="dir"),f=v()+"/api/v1/dump?"+d+"="+encodeURIComponent(c)+(a.xb?"":e)+"&format=json"));return!!r(f,
null,!0,function(b,c,d){Ff(a,b,c,d)})}
function Ff(a,b,c,d){var e=null;a.c=!1;var f=0>d&&a.l&&!a.l.j.N;if(d)a.controller.G('Unable to load disk "'+a.xa+'" (error '+d+": "+b+")",f);else{Ra(a.controller.ra,b,c);try{if(0<q(a.ac,!0).toLowerCase().indexOf("-readonly"))a.c=!0;else{var g=c.indexOf("\n");0<g&&1024>g&&0<c.substring(0,g).indexOf("write-protected")&&(a.c=!0)}var k;"<"==c.substr(0,1)?k=["Missing disk image: "+a.xa]:k=0>c.indexOf("0x")&&'["'!=c.substr(0,2)?JSON.parse(c.replace(/([a-z]+):/gm,'"$1":').replace(/\/\/[^\n]*/gm,"")):eval("("+
c+")");if(k.length)if(1==k.length)t(k[0]);else{a.U=k.length;a.$=k[0].length;a.S=k[0][0].length;var l=k[0][0][0];a.ia=l&&l.length||512;for(d=c=0;d<a.U;d++)for(f=0;f<a.$;f++)for(g=0;g<a.S;g++)if(l=k[d][f][g]){var n=l.length;void 0===n&&(n=l.length=512);var n=n>>2,p=l.pattern;void 0===p&&(p=l.pattern=0);var u=l.data;if(void 0===u){var w=l.bytes;if(void 0!==w&&w.length){for(var T=n<<2,xa=w.length;xa<T;xa++)w[xa]=p;Gf(l,w)}else u=[],p=l.pattern=p|p<<8|p<<16|p<<24,l.data=u;delete l.bytes}Df(l,d,f);for(T=
0;T<u.length;T++)c=c+u[T]&-1}a.a=k;a.b=c;e=a}else t("Empty disk image: "+a.xa)}catch(ya){t("Disk image error ("+b+"): "+ya.message)}}a.h&&(a.h.call(a.i,a.g,e,a.xa,a.Ca),a.h=null)}function Df(a,b,c,d,e,f){a||(a={sector:d,length:e,data:[],pattern:f});a.me=b;a.ne=c;a.oa=a.da=0;a.wa=!1;return a}
h.seek=function(a,b,c,d,e){d=null;var f=this.g,g=this.a[a];if(g){var k=g[b];if(!k&&f.hc&&b<f.$)for(k=g[b]=Array(f.ic),g=0;g<k.length;g++)k[g]=Df(null,a,b,g+1,f.Qb,0);if(k){for(g=0;g<k.length;g++)if(k[g]&&k[g].sector==c){d=k[g];break}!d&&f.hc&&9==f.Lb&&(d=k[g]=Df(null,a,b,f.Lb,f.Qb,0))}}e&&e(d,!1);return d};function Gf(a,b){for(var c=0,d=a.length>>2,e=Array(d),f=0;f<d;f++)e[f]=b[c]|b[c+1]<<8|b[c+2]<<16|b[c+3]<<24,c+=4;a.data=e}
h.read=function(a,b){var c=-1;if(a&&b<a.length)var c=a.data,d=b>>2,c=(d<c.length?c[d]:a.pattern)>>((b&3)<<3)&255;return c};h.write=function(a,b,c){if(this.c)return!1;if(b<a.length){if(c!=this.read(a,b,!0)){var d=a.data,e=a.pattern,f=b>>2;b=(b&3)<<3;for(var g=d.length;g<=f;g++)d[g]=e;a.da?f<a.oa?(a.da+=a.oa-f,a.oa=f):f>=a.oa+a.da&&(a.da+=f-(a.oa+a.da)+1):(a.oa=f,a.da=1);d[f]=d[f]&~(255<<b)|c<<b}return!0}return null};
function Hf(a,b){var c=a.$*a.S,d=b/c|0;return d<a.U?(b%=c,a.seek(d,b/a.S|0,b%a.S+1)):null}function If(a,b,c){for(var d=1,e=0,f=0;d--;){var g=a.read(b,c++);if(0>g)break;e|=g<<f;f+=8}return e}h.save=function(){var a=0,b=[];b[a++]=[this.Ca,this.b,this.U,this.$,this.S,this.ia];if(!this.c)for(var c=this.a,d=0;d<c.length;d++)for(var e=0;e<c[d].length;e++)for(var f=0;f<c[d][e].length;f++){var g=c[d][e][f];if(g&&g.da){for(var k=[],l=0,n=g.oa,p=g.oa+g.da;n<p;)k[l++]=g.data[n++];b[a++]=[d,e,f,g.oa,k]}}return b};
h.restore=function(a){var b=0,c="unsupported restore format";if(a&&0<a.length){var d=0,e=a[d++];e&&2<=e.length&&(!this.a.length&&6<=e.length?Cf(this,"local",e[2],e[3],e[4],e[5]):null!=e[1]&&null!=this.b&&e[1]!=this.b&&(c="original checksum ("+e[1]+") differs from current checksum ("+this.b+")",b=-2));for(this.a.length||(b=-1);d<a.length&&0<=b;){var f=0,g=a[d++],k=g[f++],l=g[f++],n=g[f++];if(k>=this.a.length||l>=this.a[k].length||n>=this.a[k][l].length){c="sector (CHS="+k+":"+l+":"+n+") out of range ("+
b+" changes applied)";b=-1;break}if(this.c){c="unable to modify write-protected disk";b=-1;break}e=g[f++];f=g[f++];g=e+f.length;if(k=this.a[k][l][n]){for(l=k.data.length;l<e;)k.data[l++]=k.pattern;l=0;k.oa=e;for(k.da=f.length;e<g;)k.data[e++]=f[l++];b++}}}0>b&&-2!=b&&this.controller.G("Unable to restore disk '"+this.xa+": "+c);return b};
h.toJSON=function(){var a;a=0;for(var b;b=Hf(this,a++);)Jf(b);a=JSON.stringify(this.a,function(a,b){if("file"!=a)return b});a=a.replace(/,"length":512/gm,"").replace(/,"pattern":0/gm,"");a=a.replace(/"(sector|length|data|pattern)":/gm,"$1:");a=a.replace(/,"[^"]*":([0-9]+|true|false)/gm,"");a=a.replace(/(sector|length|data|pattern):/gm,'"$1":');return a=a.replace(/([\]}]),/gm,"$1,\n")};
function Jf(a){var b=a.data,c=b.length;if(c<<2==a.length){for(var d=c-1,e=b[d],f=0;d--&&b[d]===e;)f++;f++&&(b.length=c-f,a.pattern=e)}}function N(a){y.call(this,"RL11",a,N,4194304);this.g=a.autoMount||null;this.s=0;this.b=Array(4);this.A=!Ba("Mobi")&&window&&"FileReader"in window}A(N);h=N.prototype;
h.aa=function(a,b,c){var d=this;switch(b){case "listDisks":return this.o[b]=c,c.onchange=function(){var a=d.o.descDisk,b=c.options[c.selectedIndex];if(a&&b){var g={};if(b=b.getAttribute("data-value"))try{g=eval("("+b+")")}catch(k){t("RL11 option error: "+k.message)}b=g.desc;void 0===b&&(b="");g=g.href;void 0!==g&&(b='<a href="'+g+'" target="_blank">'+b+"</a>");a.innerHTML=b}},!0;case "descDisk":case "listDrives":return this.o[b]=c,c.onchange=function(){var a=ja(c.value);null!=a&&Kf(d,a)},!0;case "loadDrive":return this.o[b]=
c,c.onclick=function(){var a=d.o.listDisks;a&&Lf(d,a.options[a.selectedIndex].text,a.value)},!0;case "saveDrive":if(!this.A){c.parentNode.removeChild(c);break}this.o[b]=c;c.onclick=function(){var a=d.o.listDrives;if(a&&a.options&&d.b)if(a=d.b[ja(a.value)||0])if(a=a.ea){var b;b="";for(var c=0,k;k=Hf(a,c++);)for(var l=0,n=k.length;l<n;l++)b+=String.fromCharCode(If(a,k,l));b=btoa(b);a=a.ac.replace(".json",".img");c=null;b="data:application/octet-stream;base64,"+b;a&&(c=document.createElement("a"),"string"!=
typeof c.download&&(c=null));c?(c.href=b,c.download=a,document.body.appendChild(c),c.click(),document.body.removeChild(c),a="Check your Downloads folder for "+a+"."):(window.open(b),a="Check your browser for a new window/tab containing the requested data"+(a?" ("+a+")":"")+".");t(a)}else d.G("No disk loaded in drive.");else d.G("No disk drive selected.")};return!0;case "mountDrive":if(this.A)return this.o[b]=c,c.addEventListener("change",function(){var a=c.children[0];a.children[1].disabled=!a.children[0].files.length}),
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Kf(d,q(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ia=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.D=d;if((this.g=sc(this.l,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){t("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}Lf(this);this.F=Vb(112,5);cb(b,this,Mf,4194304);eb(b,this.reset.bind(this));Nf(this,"None","",!0);this.A&&Nf(this,"Local Disk","?");Nf(this,"Remote Disk","??");Of(this)||F(this)};
h.ka=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Lb){for(a=0;a<this.b.length;a++)Pf(this,a,!0);Of(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Jf(this,0)}}return!0};h.ja=function(a){return a?this.save():!0};h.reset=function(){Lf(this)};h.save=function(){return(new O(this)).data()};
h.restore=function(a){return Lf(this,a[0])};function Of(a,b){b||(a.s=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.o.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=q(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!Qf(a,g,f,e,!0)&&b&&F(a,!1);continue}a.G("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.s}
function Kf(a,b,c,d){var e=a.o.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||e>=a.b.length)a.G("Unable to load the selected drive");else if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=q(c);a.status("Attempting to load "+c+' as "'+b+'"')}Qf(a,e,b,c,!1,d)}else Pf(a,e)}
function Qf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.Ca.toLowerCase()!=d.toLowerCase()&&(g++,Pf(a,b,!0),k.vb?a.G("RL11 busy"):(k.vb=!0,e&&(k.ub=!0,a.s++),k.ib=!!f,Df(new zf(a,k,"preload"),c,d,f,a.ic)&&g++));return g}
h.ic=function(a,b,c,d,e){var f;a.vb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.U||f[1]>a.Y)&&(this.G('Disk "'+c+'" too large for drive '+("RL"+a.yb)),b=null);b?(a.ca=b,a.xa=c,a.Ca=d,this.G('Mounted disk "'+c+'" in drive '+("RL"+a.yb),a.ub||e),this.l&&yc(this.l)):a.ib=!1;a.ub&&(a.ub=!1,--this.s||F(this));Jf(this,a.yb)};
function Nf(a,b,c,d){if((a=a.o.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Jf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.ib?"?":c.Ca,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Pf(a,b,c){var d=a.b[b];if(d.ca||!1===c)d.xa="",d.Ca="",d.ca=null,d.ib=!1,c||(a.G("Drive RL"+b+" unloaded",c),Jf(a,b))}
function Lf(a,b){var c=0;b||(b=[]);a.L=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.yb=b;d.vb=d.ib=!1;d.name=c.Ha;d.U=512;d.Y=2;d.S=40;d.ha=256;d.wb=!0;d.je=0;d.ie=0;d.Jb=1;d.hc=d.S;d.Qb=d.ha;d.me=0;d.ne=null;d.ca||(d.Ca="");d.status=29|(512==d.U?128:0)}return!0}
c.onsubmit=function(a){if(a=a.currentTarget[1].files[0]){var b=a.name;Lf(d,q(b,!0),b,a)}return!1},!0;c.parentNode.removeChild(c)}return!1};
h.ja=function(a,b,c,d){this.l=a;this.h=b;this.a=c;this.F=d;if((this.g=tc(this.l,"autoMount")||this.g)&&"string"==typeof this.g)try{this.g=eval("("+this.g+")")}catch(e){t("RL11 auto-mount error: "+e.message+" ("+this.g+")"),this.g=null}Mf(this);this.D=Vb(112,5);cb(b,this,Nf);eb(b,this.reset.bind(this));Of(this,"None","",!0);this.A&&Of(this,"Local Disk","?");Of(this,"Remote Disk","??");Pf(this)||F(this)};
h.la=function(a,b){if(!b){if(!a||!this.restore){if(this.reset(),this.l.Nb){for(a=0;a<this.b.length;a++)Qf(this,a,!0);Pf(this,!0)}}else if(!this.restore(a))return!1;if(a=this.o.listDrives){for(;a.firstChild;)a.removeChild(a.firstChild);a.value="";for(b=0;4>b;b++){var c=document.createElement("option");c.value=b;c.text="RL"+b;a.appendChild(c)}a.value="0";Kf(this,0)}}return!0};h.ka=function(a){return a?this.save():!0};h.reset=function(){Mf(this)};h.save=function(){return(new O(this)).data()};
h.restore=function(a){return Mf(this,a[0])};function Pf(a,b){b||(a.s=0);if(a.g)for(var c in a.g){var d=a.g[c],e=d.path||"",f;if(!(f=d.name))a:{if((f=a.o.listDisks)&&f.options)for(var g=0;g<f.options.length;g++){var k=f.options[g];if(k.value==e){f=k.text;break a}}f=q(e,!0)}if(e&&f&&(g=-1,c&&(g=c.charCodeAt(c.length-1)-48,0>g||9<g)&&(g=-1),0<=g&&g<a.b.length)){!Rf(a,g,f,e,!0)&&b&&F(a,!1);continue}a.G("Incorrect auto-mount settings for drive "+c+" ("+JSON.stringify(d)+")")}return!!a.s}
function Lf(a,b,c,d){var e=a.o.listDrives,e=e&&ja(e.value);if(void 0===e||0>e||e>=a.b.length)a.G("Unable to load the selected drive");else if(c)if("?"==c)a.G('Use "Choose File" and "Mount" to select and load a local disk.');else{if("??"==c){c=window.prompt("Enter the URL of a remote disk image.","")||"";if(!c)return;b=q(c);a.status("Attempting to load "+c+' as "'+b+'"')}Rf(a,e,b,c,!1,d)}else Qf(a,e)}
function Rf(a,b,c,d,e,f){var g=-1,k=a.b[b];k.Ca.toLowerCase()!=d.toLowerCase()&&(g++,Qf(a,b,!0),k.wb?a.G("RL11 busy"):(k.wb=!0,e&&(k.vb=!0,a.s++),k.ib=!!f,Ef(new Af(a,k,"preload"),c,d,f,a.lc)&&g++));return g}
h.lc=function(a,b,c,d,e){var f;a.wb=!1;b&&(f=b.a.length?[b.a.length,b.a[0].length,b.a[0][0].length,b.a[0][0][0].length]:[0,0,0,0],b&&f[0]>a.U||f[1]>a.$)&&(this.G('Disk "'+c+'" too large for drive '+("RL"+a.zb)),b=null);b?(a.ea=b,a.xa=c,a.Ca=d,this.G('Mounted disk "'+c+'" in drive '+("RL"+a.zb),a.vb||e),this.l&&zc(this.l)):a.ib=!1;a.vb&&(a.vb=!1,--this.s||F(this));Kf(this,a.zb)};
function Of(a,b,c,d){if((a=a.o.listDisks)&&a.options){for(var e=0;e<a.options.length;e++)if(a.options[e].value==c)return;e=document.createElement("option");e.text=b;e.value=c;d&&a.childNodes[0]?a.insertBefore(e,a.childNodes[0]):a.appendChild(e)}}
function Kf(a,b){if(0<=b&&b<a.b.length){var c=a.b[b],d=a.o.listDisks;a=a.o.listDrives;if(d&&a&&d.options&&a.options&&(a=ja(a.value),c=c.ib?"?":c.Ca,!isNaN(a)&&a==b)){for(b=0;b<d.options.length;b++)if(d.options[b].value==c){d.selectedIndex!=b&&(d.selectedIndex=b);break}b==d.options.length&&(d.selectedIndex=0)}}}function Qf(a,b,c){var d=a.b[b];if(d.ea||!1===c)d.xa="",d.Ca="",d.ea=null,d.ib=!1,c||(a.G("Drive RL"+b+" unloaded",c),Kf(a,b))}
function Mf(a,b){var c=0;b||(b=[]);a.L=b[c++]||0;a.v=b[c++]||0;a.c=b[c++]||0;a.i=b[c++]||0;a.m=b[c++]||0;a.w=b[c]||0;for(b=0;b<a.b.length;b++){var d=a.b[b];void 0===d&&(d=a.b[b]={});c=a;d.zb=b;d.wb=d.ib=!1;d.name=c.za;d.U=512;d.$=2;d.S=40;d.ia=256;d.xb=!0;d.le=0;d.ke=0;d.Lb=1;d.ic=d.S;d.Qb=d.ia;d.oe=0;d.pe=null;d.ea||(d.Ca="");d.status=29|(512==d.U?128:0)}return!0}
h.jc=function(a,b,c,d,e,f){this.v=f&65535;this.L=this.L&-49|f>>12&48;this.w=f>>16&63;this.i=this.c=b<<7|(c?64:0)|d&63;this.m=65536-e&65535;a&&(this.L=this.L|a|32768);return!0};
h.zc=function(a,b,c,d,e,f,g){var k=0,l=a.ca,n=null,p;l||(k=5120,e=0);for(;e--;){if(!n){n=a.ca.seek(b,c,d+1);if(!n){k=5120;break}p=0}var u,w;if(0>(u=a.ca.read(n,p++))||0>(w=a.ca.read(n,p++))){k=5120;break}Ob(this.h,f,u|w<<8);if(Rb(this.h)){k=8192;break}f+=2;if(p>=l.ha&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};
h.wd=function(a,b,c,d,e,f,g){var k=0,l=a.ca,n=null,p;l||(k=5120,e=0);for(;e--;){var u=Mb(this.h,f);if(Rb(this.h)){k=8192;break}f+=2;if(!n){n=a.ca.seek(b,c,d+1,!0);if(!n){k=5120;break}p=0}if(!a.ca.write(n,p++,u&255)||!a.ca.write(n,p++,u>>8)){k=5120;break}if(p>=l.ha&&(n=null,++d>=l.S&&(d=0,++c>=l.Y&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};h.Wc=function(){return this.L&65535};
h.Rd=function(a){this.L=this.L&-1023|a&1022;this.C=this.C&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.zc;case 10:b||(b=this.wd),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.U||f>=c.S?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.jc.bind(this)))}a&&(this.L|=129,this.L&64&&Tb(this.a,this.F))}};h.Uc=function(){return this.v};h.Pd=function(a){this.v=a&65534};h.Xc=function(){return this.c};h.Sd=function(a){this.c=a};h.Yc=function(){return this.m};h.Td=function(a){this.m=a};h.Vc=function(){return this.w};h.Qd=function(a){this.w=a&63};
var Rf={},Mf=(Rf[63744]=[null,null,N.prototype.Wc,N.prototype.Rd,"RLCS"],Rf[63746]=[null,null,N.prototype.Uc,N.prototype.Pd,"RLBA"],Rf[63748]=[null,null,N.prototype.Xc,N.prototype.Sd,"RLDA"],Rf[63750]=[null,null,N.prototype.Yc,N.prototype.Td,"RLMP"],Rf[63752]=[null,null,N.prototype.Vc,N.prototype.Qd,"RLBE"],Rf);
function Sf(a,b,c){x.call(this,"Computer",a,Sf);this.j.N=!1;Tf(this,b);this.A=sc(this,"autoPower",a);this.l=0;this.M=a.busWidth||a.buswidth;this.b=Uf;this.s=null;this.i=this.I=!1;this.O=sc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Vf(this);if(this.a=Ta("CPU",this.id)){this.D=Ta("Debugger",this.id);this.h=new vb({id:this.pa+".bus",busWidth:this.M},this.a,this.D);var d,e=A(this.id);if((this.w=Ta("Panel",this.id))&&this.w.Xa)for(b=0;b<e.length;b++)d=e[b],d.G=this.w.G,d.T=this.w.T,d.Xa=this.w.Xa;
this.T("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.T("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ia&&d.ia(this,this.h,this.a,this.D);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.m=d:this.b=parseInt(d,10));var f;if(a=sc(this,"state")||(f=!0,a.state))b=this.C=a,f||(this.i=!0,this.b=Uf),this.b&&(this.v=new O(this,
"1.30.3"),Wf(this.v)?b=null:delete this.v);!b&&this.b&&(b=Xf(this))&&(this.i=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.s=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Yf(this,this.Za)}else t("Unable to find CPU component")}z(Sf);var Uf=0;
function Tf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.J=b}function sc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Yf(a,b,c){for(var d=A(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Va(f)){Va(f,function(){Yf(a,b,c)});return}}b.call(a,c)}
function Zf(a,b){var c=new O(a,"1.30.3","validate");if(Wf(c)&&$f(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.G("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Sf.prototype;
h.Za=function(a){void 0===a&&(a=this.b||(this.s?1:Uf));if(!this.l){this.l++;var b=!1,c=!1;this.F=!1;var d=this.v||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Uf){if(Wf(d,this.s)){this.g=new O(this,"1.30.3","failsafe");Wf(this.g)&&(ag(this,d),a=2,bg(this.g));this.g.set("timestamp",sa());cg(this.g);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=$f(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Wf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(za("user",""),this.c=null)):this.T(f+": "+g),bg(d),Wf(d)?(c=$f(d),e=!0):c=!1))}e&&Zf(this,c?d:null)}else 2==a&&d.clear()}else Zf(this);delete this.s;delete this.v}e=A(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=dg(this,g,d,b,c));b=[d,a,c];-1!=a?Yf(this,this.Kb,b):this.Kb(b)}};
function dg(a,b,c,d,e){if(!b.j.N){b.j.N=!0;if(b.ka){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.ka(f,d)&&f&&(t("Unable to restore state for "+b.type),a.C&&!a.I?(c.clear(),a.b=Uf,window&&window.location.reload()):a.F=!0,b.ka(null),e=!1)}if(!d&&b.Pb)for(a=b.Pb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Kb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.N=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(dg(this,this.a,b,c,a),this.ya(),this.a.Wa());this.F&&(ag(this,b),b.clear());!c&&this.g&&(this.g.clear(),delete this.g);this.l=0};
function ag(a,b){if(ua("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function fg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ja&&(c&&G(a.a),d=a.a.ja(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.N=!1,!1===d&&(e=null)));for(var k=A(a.id),l=0;l<k.length;l++){var n=k[l];n.j.N&&(n.ja&&(d=n.ja(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.N=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&gg(a,a.c,f.toString()),cg(g)&&cg(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.N=!1,b=a.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();this.a&&this.a.reset&&this.a.reset();for(var a=A(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c!==this.a&&c.reset&&c.reset()}this.ya(-1)};
h.start=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ya(-1)};h.stop=function(a,b){for(var c=A(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ya(-1)};
h.ya=function(a){if(this.a){var b=this.a,c=b.o.speed;c&&(c.textContent=b.j.P&&b.qa?b.qa.toFixed(2)+"Mhz":"Stopped")}if(this.w&&(b=this.w,b.s)){var c=b.a.j.P,d=!!(b.a.u&4);if(!(0<a&&60>(b.w+=a))){for(var e=0;e<b.a.f.length;e++)kb(b,"R"+e,b.a.f[e]);e=Zb(b.a);kb(b,"PS",e);kb(b,"NF",e&8?1:0,1);kb(b,"ZF",e&4?1:0,1);kb(b,"VF",e&2?1:0,1);kb(b,"CF",e&1?1:0,1);b.w=0}sb(b,0<a&&c&&!d?b.a.f[7]:b.da);rb(b,b.m);a=b.a.Ba?b.a.Fa&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",a&4)}};
h.Z=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.N?fg(d,!1,!0):Yf(d,d.Za))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.N&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");fg(d,a,!0);!a&&d.C?window&&window.location.reload():(a||(d.Lb=!0),d.Za(Uf),d.Lb=!1)}else d.reset(),d.a&&d.a.Wa()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);
else return this.o[b]=c,c.onclick=function(){var a=Vf(d,!0);if(a){var b=!!(d.b&&!d.m||d.C),c=fg(d,b);b?gg(d,a,c):d.G("Resume disabled, machine state not saved")}},!0}return!1};
function Vf(a,b){var c=a.c;c||((c=ya("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=hg(a,c))||a.G("The user ID is invalid.")):b&&a.G("Browser local storage is not available"));return c}
function hg(a,b){a.c=null;b=r(v()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(za("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Xf(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+ig(a,"1.30.3"));return b}
function gg(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=ig(a,"1.30.3");d.data=c;b=r(v()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.G("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.G(c),za("user",""),a.c=null)}}
function of(a){var b;a=A(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function yc(a){if(a.Xa){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Xa.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=B(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=B(f),g=new Sf(g,d,!0);C(g,f);g.A&&Yf(g,g.Za)}});
Ba.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.N&&c.Za(-1)}});Ba.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=B(a[b]);(c=Ta("Computer",c.id))&&c.j.N&&fg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=ig(a,b,c);this.D=a.D;bg(this,a.qd)}function ig(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){bg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function bg(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function cg(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);za(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function $f(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Wf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=ya(a.key))?(a[a.id]=b,a.a=!0):!1}var jg=0;
function kg(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),f(k,null)):lg(k,a,b,c,d,e,f)})}
function lg(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(Ra(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?mg(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
function mg(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");r(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],n,p=/( [a-z]+=)(['"])(.*?)\2/g;n=p.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);mg(a,b,c)}})}else c(a,null)}
function ng(a,b,c,d){function e(a){if(void 0===k){var b=g&&E(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=oa(a))}function f(a){e("Error: "+a);l&&(--jg||Ia(!0));l=!1}var g,k,l=!0;jg++;Qa[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText=n:u.appendChild(document.createTextNode(n));p.appendChild(u)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");n=function(d,k){k?kg(c,null,null,!1,e,function(d,l){l?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--jg||Ia(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--jg||Ia(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?kg(b,a,d,!0,e,n):lg(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(w){f(w.message)}return l}window.embedPDP11=function(a,b,c,d){Ia(!1);return ng(a,b,c,d)};window.enableEvents=Ia;window.sendEvent=Ja;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11.map
h.Ac=function(a,b,c,d,e,f,g){var k=0,l=a.ea,n=null,p;l||(k=5120,e=0);for(;e--;){if(!n){n=a.ea.seek(b,c,d+1);if(!n){k=5120;break}p=0}var u,w;if(0>(u=a.ea.read(n,p++))||0>(w=a.ea.read(n,p++))){k=5120;break}Ob(this.h,f,u|w<<8);if(Rb(this.h)){k=8192;break}f+=2;if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.$&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};
h.yd=function(a,b,c,d,e,f,g){var k=0,l=a.ea,n=null,p;l||(k=5120,e=0);for(;e--;){var u=Mb(this.h,f);if(Rb(this.h)){k=8192;break}f+=2;if(!n){n=a.ea.seek(b,c,d+1,!0);if(!n){k=5120;break}p=0}if(!a.ea.write(n,p++,u&255)||!a.ea.write(n,p++,u>>8)){k=5120;break}if(p>=l.ia&&(n=null,++d>=l.S&&(d=0,++c>=l.$&&(c=0,++b>=l.U)))){k=5120;break}}return g(k,b,c,d,e,f)};h.Xc=function(){return this.L&65535};
h.Td=function(a){this.L=this.L&-1023|a&1022;this.B=this.B&-4|(a&48)>>4;if(!(this.L&128)){var b;a=!0;var c=this.b[(this.L&768)>>8],d,e,f,g;this.L&=-2;switch(this.L&14){case 4:this.c&8&&(this.L&=63);this.m=c.status|this.i&64;break;case 6:1==(this.c&3)&&(b=this.c&65408,c=(this.c&16)<<2,this.i=this.c&4?this.i+b:this.i-b,this.c=this.i=this.i&65408|c);break;case 8:this.m=this.i;break;case 12:b=this.Ac;case 10:b||(b=this.yd),d=this.c>>7,e=this.c&64?1:0,f=this.c&63,d>=c.U||f>=c.S?this.L|=37888:(g=(this.w&
63)<<16|this.v,a=65536-this.m&65535,a=b.call(this,c,d,e,f,a,g,this.jc.bind(this)))}a&&(this.L|=129,this.L&64&&Tb(this.a,this.D))}};h.Vc=function(){return this.v};h.Rd=function(a){this.v=a&65534};h.Yc=function(){return this.c};h.Ud=function(a){this.c=a};h.Zc=function(){return this.m};h.Vd=function(a){this.m=a};h.Wc=function(){return this.w};h.Sd=function(a){this.w=a&63};
var Sf={},Nf=(Sf[63744]=[null,null,N.prototype.Xc,N.prototype.Td,"RLCS"],Sf[63746]=[null,null,N.prototype.Vc,N.prototype.Rd,"RLBA"],Sf[63748]=[null,null,N.prototype.Yc,N.prototype.Ud,"RLDA"],Sf[63750]=[null,null,N.prototype.Zc,N.prototype.Vd,"RLMP"],Sf[63752]=[null,null,N.prototype.Wc,N.prototype.Sd,"RLBE"],Sf);
function Tf(a,b,c){y.call(this,"Computer",a,Tf,67108864);this.j.N=!1;Uf(this,b);this.A=tc(this,"autoPower",a);this.l=0;this.M=a.busWidth||a.buswidth;this.b=Vf;this.s=null;this.i=this.I=!1;this.O=tc(this,"url")||"";(Math.random()+.1).toString(36);this.c=Wf(this);if(this.a=Ta("CPU",this.id)){this.F=Ta("Debugger",this.id);this.h=new vb({id:this.ra+".bus",busWidth:this.M},this.a,this.F);var d,e=B(this.id);if((this.w=Ta("Panel",this.id))&&this.w.Wa)for(b=0;b<e.length;b++)d=e[b],d.G=this.w.G,d.T=this.w.T,
d.Wa=this.w.Wa;this.T("PDPjs v1.30.3\nCopyright \u00a9 2012-2016 Jeff Parsons <Jeff@pcjs.org>\nLicense: GPL version 3 or later <http://gnu.org/licenses/gpl.html>");this.T("Portions adapted from the PDP-11/70 Emulator v1.4 by Paul Nankervis <paulnank@hotmail.com>");for(b=0;b<e.length;b++)d=e[b],d.ja&&d.ja(this,this.h,this.a,this.F);b=null;d=a.resume;void 0!==d&&(1<d.length?b=this.m=d:this.b=parseInt(d,10));var f;if(a=tc(this,"state")||(f=!0,a.state))b=this.B=a,f||(this.i=!0,this.b=Vf),this.b&&(this.v=
new O(this,"1.30.3"),Xf(this.v)?b=null:delete this.v);!b&&this.b&&(b=Yf(this))&&(this.i=!0);if(b){var g=this;r(b,null,!0,function(a,b,c){c?(g.m=null,g.i=!1,g.G("Unable to load machine state from server (error "+c+(b?": "+pa(b):"")+")")):(g.s=b,g.I=!0);F(g)})}else F(this);this.o.power||(this.A=!0);!c&&this.A&&Zf(this,this.Za)}else t("Unable to find CPU component")}A(Tf);var Vf=0;
function Uf(a,b){if(!b){var c;if("object"==typeof resources&&(c=resources.parms))try{b=eval("("+c+")")}catch(d){t(d.message+" ("+c+")")}}a.J=b}function tc(a,b,c){var d=b.toLowerCase(),d=La[b]||La[d];void 0===d&&a.J&&(d=a.J[b]);void 0===d&&c&&(d=c[b]);void 0===d&&"object"==typeof resources&&resources[b]&&(d=b);return d}function Zf(a,b,c){for(var d=B(a.id),e=0;e<=d.length;e++){var f=e<d.length?d[e]:a;if(!Va(f)){Va(f,function(){Zf(a,b,c)});return}}b.call(a,c)}
function $f(a,b){var c=new O(a,"1.30.3","validate");if(Xf(c)&&ag(c)){var d=c.get("timestamp"),e=b?b.get("timestamp"):"unknown";d!=e&&(a.G("Machine state may be out-of-date\n("+d+" vs. "+e+")\nCheck your browser's local storage limits"),b||c.clear())}}h=Tf.prototype;
h.Za=function(a){void 0===a&&(a=this.b||(this.s?1:Vf));if(!this.l){this.l++;var b=!1,c=!1;this.D=!1;var d=this.v||new O(this,"1.30.3");if(-1==a)b=!0;else if(a>Vf){if(Xf(d,this.s)){this.g=new O(this,"1.30.3","failsafe");Xf(this.g)&&(bg(this,d),a=2,cg(this.g));this.g.set("timestamp",sa());dg(this.g);var e=this.b&&!this.i;if(1==a||ua("Click OK to restore the previous PDPjs machine state, or CANCEL to reset the machine.")){if(c=ag(d)){var f=d.get("code"),g=d.get("data");f&&("ok"==f?Xf(d,g):("error"==
f&&"no machine state"!=g?(this.G("Error: "+g),"unable to verify user"==g&&(Aa("user",""),this.c=null)):this.T(f+": "+g),cg(d),Xf(d)?(c=ag(d),e=!0):c=!1))}e&&$f(this,c?d:null)}else 2==a&&d.clear()}else $f(this);delete this.s;delete this.v}e=B(this.id);for(f=0;f<e.length;f++)g=e[f],g!==this&&g!=this.a&&(c=eg(this,g,d,b,c));b=[d,a,c];-1!=a?Zf(this,this.Mb,b):this.Mb(b)}};
function eg(a,b,c,d,e){if(!b.j.N){b.j.N=!0;if(b.la){var f=null;e&&((f=c.get(b.id))||(f=c.get(b.id.replace(/[a-z0-9]\./i,"."))));"string"===typeof f&&(f=null);!b.la(f,d)&&f&&(t("Unable to restore state for "+b.type),a.B&&!a.I?(c.clear(),a.b=Vf,window&&window.location.reload()):a.D=!0,b.la(null),e=!1)}if(!d&&b.Tb)for(a=b.Tb.split("|"),c=0;c<a.length;c++)b.status(a[c])}return e}
h.Mb=function(a){var b=a[0],c=0>a[1];a=a[2];this.R=!0;this.j.N=!0;var d=this.o.power;d&&(d.textContent="Shutdown");this.a&&(eg(this,this.a,b,c,a),this.ya(),this.a.Va());this.D&&(bg(this,b),b.clear());!c&&this.g&&(this.g.clear(),delete this.g);this.l=0};
function bg(a,b){if(ua("There may be a problem with your PDPjs machine.\n\nTo help us diagnose it, click OK to send this PDPjs machine state to http://www.pcjs.org.")){var c=a.c||"";b=b.toString();var d={app:"PDPjs",ver:"1.30.3"};d.url=a.O;d.user=c;d.type="bug";d.data=b;r("http://www.pcjs.org/api/v1/report",d,!0)}}
function hg(a,b,c){var d,e="none";if(a.l)return null;a.l--;var f=new O(a,"1.30.3"),g=new O(a,"1.30.3","validate"),k=sa();g.set("timestamp",k);f.set("timestamp",k);f.set("version","1.30.3");f.set("url",window?window.location.href:null);f.set("browser",window?window.navigator.userAgent:"");a.a&&a.a.ka&&(c&&G(a.a),d=a.a.ka(b,c),"object"===typeof d&&f.set(a.a.id,d),c&&(a.a.j.N=!1,!1===d&&(e=null)));for(var k=B(a.id),l=0;l<k.length;l++){var n=k[l];n.j.N&&(n.ka&&(d=n.ka(b,c),"object"===typeof d&&f.set(n.id,
d)),c&&(n.j.N=!1,!1===d&&(e=null)))}e&&(c?(k=d=!1,b?(a.c&&ig(a,a.c,f.toString()),dg(g)&&dg(f)||(e=null,d=k=!0)):a.b&&(d=!0,k=3==a.b),d&&f.clear(k)):e=f.toString());c&&(a.j.N=!1,b=a.o.power)&&(b.textContent="Power");a.l=0;return e}h.reset=function(){this.h&&this.h.reset&&this.h.reset();this.a&&this.a.reset&&this.a.reset();for(var a=B(this.id),b=0;b<a.length;b++){var c=a[b];c!==this&&c!==this.h&&c!==this.a&&c.reset&&c.reset()}this.ya(-1)};
h.start=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.start&&e.start(a,b)}this.ya(-1)};h.stop=function(a,b){for(var c=B(this.id),d=0;d<c.length;d++){var e=c[d];"CPU"!=e.type&&e!==this&&e.stop&&e.stop(a,b)}this.ya(-1)};
h.ya=function(a){if(this.a){var b=this.a,c=a||0,d=b.o.speed;d&&(0>=c||30<=(b.yb+=c))&&(d.textContent=b.j.P?b.Ga.toFixed(2)+"Mhz":"Stopped",b.yb=0)}if(this.w&&(b=this.w,a=a||0,b.v)){c=b.a.j.P;d=!!(b.a.u&4);if(0>=a||60<=(b.s+=a)){for(var e=0;e<b.a.f.length;e++)kb(b,"R"+e,b.a.f[e]);e=Zb(b.a);kb(b,"PS",e);kb(b,"NF",e&8?1:0,1);kb(b,"ZF",e&4?1:0,1);kb(b,"VF",e&2?1:0,1);kb(b,"CF",e&1?1:0,1);b.s=0}sb(b,0<a&&c&&!d?b.a.Xa:b.fa);rb(b,b.m);a=b.a;a=a.ba?a.Ba&16?1:2:4;tb(b,"B22",a&1);tb(b,"B18",a&2);tb(b,"B16",
a&4)}};
h.aa=function(a,b,c){var d=this;switch(b){case "power":return this.o[b]=c,c.onclick=function(){d.l||(d.j.N?hg(d,!1,!0):Zf(d,d.Za))},!0;case "reset":return this.o[b]=c,c.onclick=function(){if(d.j.N&&!d.l)if(d.b&&!d.m){var a=ua("Click OK to save changes to this PDPjs machine.\n\nWARNING: If you CANCEL, all disk changes will be discarded.");hg(d,a,!0);!a&&d.B?window&&window.location.reload():(a||(d.Nb=!0),d.Za(Vf),d.Nb=!1)}else d.reset(),d.a&&d.a.Va()},!0;case "save":if(ma(v(),"pcjs.org"))c.parentNode.removeChild(c);else return this.o[b]=
c,c.onclick=function(){var a=Wf(d,!0);if(a){var b=!!(d.b&&!d.m||d.B),c=hg(d,b);b?ig(d,a,c):d.G("Resume disabled, machine state not saved")}},!0}return!1};
function Wf(a,b){var c=a.c;c||((c=za("user"),void 0!==c)?!c&&b&&(b=null,window&&(b=window.prompt("Saving machine states on the pcjs.org server is currently unsupported.\n\nIf you're running your own server, enter your user ID below.","")),c=b)&&((c=jg(a,c))||a.G("The user ID is invalid.")):b&&a.G("Browser local storage is not available"));return c}
function jg(a,b){a.c=null;b=r(v()+"/api/v1/user?req=verify&user="+b);var c=b[1];if(!b[0]&&c)try{b=eval("("+c+")"),b.code&&"ok"==b.code&&(Aa("user",b.data),a.c=b.data)}catch(d){t(d.message+" ("+c+")")}return a.c}function Yf(a){var b=null;a.c&&(b=v()+"/api/v1/user?req=load&user="+a.c+"&state="+kg(a,"1.30.3"));return b}
function ig(a,b,c){if(c){var d={req:"store"};d.user=b;d.state=kg(a,"1.30.3");d.data=c;b=r(v()+"/api/v1/user",d);d=b[0];if(b[1]){if(d){var e=d.indexOf("\n");0<e&&(d=d.substr(0,e));d.indexOf("Error: ")||(d=d.substr(7))}d='{"code":'+b[1]+',"data":"'+d+'"}'}b=JSON.parse(d);b&&"ok"==b.code?a.G("Machine state saved to server"):c&&(c=b&&b.data||"unable to save machine state",c="error"==b.code?"Error: "+c:"Error "+b.code+": "+c,a.G(c),Aa("user",""),a.c=null)}}
function pf(a){var b;a=B(a.id);for(var c=0;c<a.length;c++){var d=a[c];if(b)b==d&&(b=null);else if("RAM"==d.type)return d}return null}function zc(a){if(a.Wa){var b=0,c=0;window&&(b=window.scrollX,c=window.scrollY);a.Wa.focus();window&&window.scrollTo(b,c)}}Ga(function(){for(var a=E(document,"pdp11-machine"),b=0;b<a.length;b++)for(var c=a[b],d=C(c),c=E(c,"pdp11","computer"),e=0;e<c.length;e++){var f=c[e],g=C(f),g=new Tf(g,d,!0);D(g,f);g.A&&Zf(g,g.Za)}});
x.show.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.R&&!c.j.N&&c.Za(-1)}});x.exit.push(function(){for(var a=E(document,"pdp11","computer"),b=0;b<a.length;b++){var c=C(a[b]);(c=Ta("Computer",c.id))&&c.j.N&&hg(c,!(!c.b||c.m),!0)}});function O(a,b,c){this.id=a.id;this.key=kg(a,b,c);this.F=a.F;cg(this,a.td)}function kg(a,b,c){a=a.id;if(b){var d=b.indexOf(".");0<d&&(a+=".v"+b.substr(0,d))}c&&(a+="."+c);return a}
O.prototype={constructor:O,set:function(a,b){try{this[this.id][a]=b}catch(c){}},get:function(a){return this[this.id][a]||null},value:function(){return this[this.id]},data:function(){return this[this.id]},toString:function(){var a=this[this.id];return"string"==typeof a?a:JSON.stringify(a)},clear:function(a){cg(this);var b=[];try{for(var c=0,d=window.localStorage.length;c<d;c++)b.push(window.localStorage.key(c))}catch(e){}for(c=0;c<b.length;c++)if((d=b[c])&&(a||d.substr(0,this.key.length)==this.key)){try{window.localStorage.removeItem(d)}catch(e){}b.splice(c,
1);c=0}}};function cg(a,b){a[a.id]={};b&&a.set("parms",b);a.a=!1}function dg(a){var b=!0;if(wa()){var c=JSON.stringify(a[a.id]);Aa(a.key,c)||(t("Unable to store "+c.length+" bytes in browser local storage"),b=!1)}return b}function ag(a){var b=!0;try{a[a.id]=JSON.parse(a[a.id])}catch(c){t(c.message||c),b=!1}return b}function Xf(a,b){return b?(a[a.id]=b,a.a=!0):a.a?!0:wa()&&(b=za(a.key))?(a[a.id]=b,a.a=!0):!1}var lg=0;
function mg(a,b,c,d,e,f){e("Loading "+a+"...");r(a,null,!0,function(g,k,l){l?(k||(k="unable to load "+a+" ("+l+")"),f(k,null)):ng(k,a,b,c,d,e,f)})}
function ng(a,b,c,d,e,f,g){function k(a,f){if(f)g(f,null);else{c&&(Ra(c,b,a),(f=b)&&0>f.indexOf("/")&&"/"==window.location.pathname.slice(-1)&&(f=window.location.pathname+f),d?"}"==d.slice(-1)?(d=d.slice(0,-1),1<d.length&&(d+=",")):d='{state:"'+d+'",':d="{",d+='url:"'+f+'"}',"object"==typeof resources&&(f=null),a=a.replace(/(<machine[^>]*\sid=)(['"]).*?\2/,"$1$2"+c+"$2"+(d?" parms='"+d+"'":"")+(f?' url="'+f+'"':"")));e||(a=a.replace(/(<xsl:variable name="APPNAME">).*?(<\/xsl:variable>)/,"$1PDPjs$2"),
a=a.replace(/(<xsl:variable name="APPCLASS">).*?(<\/xsl:variable>)/,"$1pdp11$2"));f=null;if("<"==a.charAt(0))try{e||(a=a.replace(/<!DOCTYPE(.|[\r\n])*]>\s*/g,"")),window.ActiveXObject||"ActiveXObject"in window?(f=new window.ActiveXObject("Microsoft.XMLDOM"),f.async=!1,f.loadXML(a)):f=(new window.DOMParser).parseFromString(a,"text/xml")}catch(p){f=null,a=p.message}else a="unrecognized XML: "+(255<a.length?a.substr(0,255)+"...":a);g(a,f)}}a?e?og(a,f,k):k(a,null):g("no data"+(b?" for file: "+b:""),null)}
function og(a,b,c){var d;if(d=/<([a-z]+)\s+ref="(.*?)"(.*?)\/>/g.exec(a)){var e=d[2];b("Loading "+e+"...");r(e,null,!0,function(f,g,k){if(k||!g)c(a,"unable to resolve XML reference: "+d[0]+" ("+k+")");else{if(f=d[3])if(k=g.match(new RegExp("<"+d[1]+"[^>]*>"))){for(var l=k[0],n,p=/( [a-z]+=)(['"])(.*?)\2/g;n=p.exec(f);)l=0>l.indexOf(n[1])?l.replace(">",n[0]+">"):l.replace(new RegExp(n[1]+"(['\"])(.*?)\\1"),n[0]);k[0]!=l&&(g=g.replace(k[0],l))}else{c(a,"missing <"+d[1]+"> in "+e);return}g=g.replace(/<\?xml[^>]*>[\r\n]*/,
"");a=a.replace(d[0],g);og(a,b,c)}})}else c(a,null)}
function pg(a,b,c,d){function e(a){if(void 0===k){var b=g&&E(g,"machine-warning");k=b&&b[0]||g}k&&(k.innerHTML=oa(a))}function f(a){e("Error: "+a);l&&(--lg||Ia(!0));l=!1}var g,k,l=!0;lg++;Qa[a]={};try{if(g=document.getElementById(a)){var n;if("object"==typeof resources&&(n=resources.css)){var p=document.head||document.getElementsByTagName("head")[0],u=document.createElement("style");u.type="text/css";u.styleSheet?u.styleSheet.cssText=n:u.appendChild(document.createTextNode(n));p.appendChild(u)}c||
(c="/versions/pdpjs/1.30.3/components.xsl");n=function(d,k){k?mg(c,null,null,!1,e,function(d,l){l?(Ra(a,c,d),e("Processing "+b+"..."),window.ActiveXObject||"ActiveXObject"in window?(l=k.transformNode(l))?(g.outerHTML=l,--lg||Ia(!0)):f("transformNodeToObject failed"):document.implementation&&document.implementation.createDocument?(d=new XSLTProcessor,d.importStylesheet(l),(l=d.transformToFragment(k,document))?g.parentNode?(g.parentNode.replaceChild(l,g),--lg||Ia(!0)):f("invalid machine element: "+
a):f("transformToFragment failed")):f("unable to transform XML: unsupported browser")):f(d)}):f(d)};"<"!=b.charAt(0)?mg(b,a,d,!0,e,n):ng(b,null,a,d,!1,e,n)}else f("missing machine element: "+a)}catch(w){f(w.message)}return l}window.embedPDP11=function(a,b,c,d){Ia(!1);return pg(a,b,c,d)};window.enableEvents=Ia;window.sendEvent=Ja;})();//# sourceMappingURL=/tmp/pdpjs/1.30.3/pdp11.map