… | |
… | |
105 | |
105 | |
106 | my $RST = 0; # 8080 pending interrupts |
106 | my $RST = 0; # 8080 pending interrupts |
107 | my $INTMASK = 7; # 8085 half interrupts |
107 | my $INTMASK = 7; # 8085 half interrupts |
108 | my $INTPEND = 0; # 8085 half interrupts |
108 | my $INTPEND = 0; # 8085 half interrupts |
109 | |
109 | |
110 | my $x; # dummy temp for instructions |
|
|
111 | |
|
|
112 | my $CLK; # rather inexact clock |
110 | my $CLK; # rather inexact clock |
113 | |
111 | |
114 | ############################################################################# |
112 | ############################################################################# |
115 | # the dreaded NVR1400 chip. not needed to get it going, but provided anyway |
113 | # the dreaded NVR1400 chip. not needed to get it going, but provided anyway |
116 | |
114 | |
… | |
… | |
291 | sub in_17 { 0xff } # vt102 unknown, printer status clear by reading? |
289 | sub in_17 { 0xff } # vt102 unknown, printer status clear by reading? |
292 | sub in_1b { 0xff } # vt102 unknown |
290 | sub in_1b { 0xff } # vt102 unknown |
293 | |
291 | |
294 | ############################################################################# |
292 | ############################################################################# |
295 | # 8085 cpu opcodes and flag handling |
293 | # 8085 cpu opcodes and flag handling |
|
|
294 | |
|
|
295 | my $x; # dummy scratchpad for opcodes |
296 | |
296 | |
297 | sub sf { # set flags (ZSC - AP not implemented) |
297 | sub sf { # set flags (ZSC - AP not implemented) |
298 | $FS = $_[0] & 0x080; |
298 | $FS = $_[0] & 0x080; |
299 | $FZ = !($_[0] & 0x0ff); |
299 | $FZ = !($_[0] & 0x0ff); |
300 | $FC = $_[0] & 0x100; |
300 | $FC = $_[0] & 0x100; |
… | |
… | |
800 | # 6.5 vt125 mb7 read ready (something modem?) |
800 | # 6.5 vt125 mb7 read ready (something modem?) |
801 | # 7.5 vt125 mb7 vblank h(?) |
801 | # 7.5 vt125 mb7 vblank h(?) |
802 | # trap vt125 mbi init h(?) |
802 | # trap vt125 mbi init h(?) |
803 | my $vec; |
803 | my $vec; |
804 | |
804 | |
805 | $x = $INTPEND & ~$INTMASK; |
805 | my $pend = $INTPEND & ~$INTMASK; |
806 | |
806 | |
807 | if ($x & 1) { $vec = 0x2c; $INTPEND &= ~1; |
807 | if ($pend & 1) { $vec = 0x2c; $INTPEND &= ~1; |
808 | } elsif ($x & 2) { $vec = 0x34; $INTPEND &= ~2; |
808 | } elsif ($pend & 2) { $vec = 0x34; $INTPEND &= ~2; |
809 | } elsif ($x & 4) { $vec = 0x3c; $INTPEND &= ~4; |
809 | } elsif ($pend & 4) { $vec = 0x3c; $INTPEND &= ~4; |
810 | # } elsif ($RST ) { $vec = $RST * 8; $RST = 0; # the vt102 firmware doesn't like combined interrupts |
810 | # } elsif ($RST ) { $vec = $RST * 8; $RST = 0; # the vt102 firmware doesn't like combined interrupts |
811 | } elsif ($RST & 1) { $vec = 0x08; $RST &= ~1; # separate is better for vt102 |
811 | } elsif ($RST & 1) { $vec = 0x08; $RST &= ~1; # separate is better for vt102 |
812 | } elsif ($RST & 2) { $vec = 0x10; $RST &= ~2; |
812 | } elsif ($RST & 2) { $vec = 0x10; $RST &= ~2; |
813 | } elsif ($RST & 4) { $vec = 0x20; $RST &= ~4; |
813 | } elsif ($RST & 4) { $vec = 0x20; $RST &= ~4; |
814 | } else { |
814 | } else { |