--- vt102/vt102 2014/12/03 02:15:18 1.16 +++ vt102/vt102 2014/12/03 02:16:30 1.17 @@ -107,8 +107,6 @@ my $INTMASK = 7; # 8085 half interrupts my $INTPEND = 0; # 8085 half interrupts -my $x; # dummy temp for instructions - my $CLK; # rather inexact clock ############################################################################# @@ -294,6 +292,8 @@ ############################################################################# # 8085 cpu opcodes and flag handling +my $x; # dummy scratchpad for opcodes + sub sf { # set flags (ZSC - AP not implemented) $FS = $_[0] & 0x080; $FZ = !($_[0] & 0x0ff); @@ -802,11 +802,11 @@ # trap vt125 mbi init h(?) my $vec; - $x = $INTPEND & ~$INTMASK; + my $pend = $INTPEND & ~$INTMASK; - if ($x & 1) { $vec = 0x2c; $INTPEND &= ~1; - } elsif ($x & 2) { $vec = 0x34; $INTPEND &= ~2; - } elsif ($x & 4) { $vec = 0x3c; $INTPEND &= ~4; + if ($pend & 1) { $vec = 0x2c; $INTPEND &= ~1; + } elsif ($pend & 2) { $vec = 0x34; $INTPEND &= ~2; + } elsif ($pend & 4) { $vec = 0x3c; $INTPEND &= ~4; # } elsif ($RST ) { $vec = $RST * 8; $RST = 0; # the vt102 firmware doesn't like combined interrupts } elsif ($RST & 1) { $vec = 0x08; $RST &= ~1; # separate is better for vt102 } elsif ($RST & 2) { $vec = 0x10; $RST &= ~2;