Previous Thread
Next Thread
Print Thread
Page 3 of 11 1 2 3 4 5 10 11
Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172
Oh, I don't think it needs to be exactly 192 T-states, (the upd7810 has 3 clock cycles to a T-state I think) it just has to be around that. The timing doesn't need to be anywhere that exact. Once it does 4 analog measurements (4 * 192) it should be around 768 T states before it will fire an INTAD interrupt.

Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172
Ok, I looked at it again, and the original code doesn't seem to have timing problems. I possibly (probably) screwed up the code while I was doing some experiments and trying to figure out what it actually does. (and then thought it was the original code)


I made a pull request for a few things on the upd7810 and the ap2000, if it's horrible let me know.

The NMI problem is still there, but the ap2000 controls seem to be working with just minor changes. It starts up in the "offline" mode so if you hit keypad 0 it will put it online.


Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172
I fiddled and fiddled and couldn't get the ap2000 to go past the initialization. It was totally baffling. I put in delays and delays and hit the NMI multiple times.

Then I read the datasheet over and over again and I got a clue:

[Linked Image from i.imgur.com]

It says that you can sample the NMI input by using SKIT and SKNIT.

So it hits the SKIT NMI at $011E and never skips past the JMP $0000.

Code
010A: 48 48       SKIT    FAD
010C: 48 48       SKIT    FAD
010E: FD          JR      $010C
010F: 53          DCR     C
0110: FB          JR      $010C
0111: 4C E1       MOV     A,CR1
0113: 74 4A 02    ONI     B,$02
0116: C5          JR      $011C
0117: 37 CA       LTI     A,$CA
0119: 6A FD       MVI     B,$FD
011B: E8          JR      $0104
011C: 37 CA       LTI     A,$CA
011E: 48 40       SKIT    NMI
0120: 54 00 00    JMP     $0000

Code
--- a/src/devices/cpu/upd7810/upd7810_opcodes.cpp
+++ b/src/devices/cpu/upd7810/upd7810_opcodes.cpp
@@ -343,7 +343,7 @@ void upd7810_device::DIV_C()
 /* 48 40: 0100 1000 0100 0000 */
 void upd7810_device::SKIT_NMI()
 {
-       if (IRR & INTNMI)
+       if (IRR & INTNMI || m_nmi)
                PSW |= SK;
        IRR &= ~INTNMI;
 }
@@ -487,7 +487,7 @@ void upd7810_device::SKIT_SB()
 /* 48 60: 0100 1000 0110 0000 */
 void upd7810_device::SKNIT_NMI()
 {
-       if (0 == (IRR & INTNMI))
+       if (0 == (IRR & INTNMI) || !m_nmi)
                PSW |= SK;
        IRR &= ~INTNMI;
 }

So I think that would be right, setting the skip flag if m_nmi is set for SKIT_NMI and if m_nmi is not set.

This gets it past this spot so it will start up.

Joined: Dec 2015
Posts: 172
Likes: 11
A
AJR Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2015
Posts: 172
Likes: 11
That datasheet is a bit misleading. As a later manual explains, SKIT NMI and SKNIT NMI do not actually test INTFNMI (which makes sense since the flip-flop is cleared as soon as a NMI is taken and a NMI must always be taken), only the actual level of the NMI pin.

Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172

Hi AJR,

Yes, I think I understand now exactly what that means. The subtle distinctions make all the difference. Thanks for fixing this.


With my latest changes the ap2000 should start up properly and go "on-line" without having to manually hit the "on-line button".




It still drops characters though, do you guys have any objections to having a buffer to hold the incoming overflow characters until it's figured out?




Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
If it's all working now I'd like to look at the A2 parallel cards again and see if I have the handshake wrong or something.

Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172
Hi RB, I think it pretty much works now except for dropping chars if my latest commit is added.

Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
Yeah, I just saw that commit go in, great!

Joined: Feb 2014
Posts: 1,100
Likes: 172
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,100
Likes: 172

Throwing in a buffer in between gets us Reggie!


Code
 
 WRITE_LINE_MEMBER( e05a30_device::centronics_input_strobe )
 {

        // using a buffer to hold the incoming data when printer can't keep up.
        // This is obviously not correct, but until the answer is found,
        // allows the ap2000 to function without dropping characters.

//     if (m_centronics_strobe == true && state == false && !m_centronics_busy) {
       if (m_centronics_strobe == true && state == false) {

           if (m_centronics_data_latched) { // will lose data, so put into buffer
               minibuffer[minibufferhead] = m_centronics_data;
               minibufferhead ++;
               minibufferhead %= minibuffersize;
           }
           else {
               m_centronics_data_latch   = m_centronics_data;
 
                m_centronics_data_latched = true;
                m_centronics_busy         = true;
                m_write_centronics_busy(m_centronics_busy);
            }
        }
 
        m_centronics_strobe = state;
@@ -203,6 +219,15 @@ uint8_t e05a30_device::read(offs_t offset)
        case 0x03:
                result = m_centronics_data_latch;
                m_centronics_data_latched = false;
+
+               if (minibufferhead != minibuffertail) {
+                       m_centronics_data_latch   = minibuffer[minibuffertail++];
+                       minibuffertail %= minibuffersize;
+                       m_centronics_data_latched = true;
+                       m_centronics_busy         = true;
+                       m_write_centronics_busy(m_centronics_busy);
+                }
+
                break;
        case 0x04:
                result |= m_centronics_busy << 0;
diff --git a/src/devices/machine/e05a30.h b/src/devices/machine/e05a30.h
index 5dfb51ac81c..d7220c4bc89 100644
--- a/src/devices/machine/e05a30.h
+++ b/src/devices/machine/e05a30.h
@@ -76,6 +76,11 @@ private:
        uint8_t m_centronics_strobe;
        uint8_t m_centronics_data_latch;
        uint8_t m_centronics_data_latched;
+
+       static const int minibuffersize=1e6;  // temporary fix for dropping characters
+       int minibuffer[minibuffersize];
+       int minibufferhead;
+       int minibuffertail;
 };
 
 DECLARE_DEVICE_TYPE(E05A30, e05a30_device)



[Linked Image from i.imgur.com]

Playing with Amiga graphic dump:

[Linked Image from i.imgur.com]

Interesting that the a2 PIC Parallel firmware seems to be slightly better than the Centronics in that you don't get it sending 9E and 1D to the printer (hardcoded in the firmware for switching a Centronics Microprinter into 40 and 80 column mode).

Appleworks apple+H screen dump:

[Linked Image from i.imgur.com]


Joined: Mar 2001
Posts: 17,215
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,215
Likes: 234
What are your DIP switch settings? I have some idea how to fix it without a buffer, but I can't get any program (including Triple-Dump) to print much of anything.

Page 3 of 11 1 2 3 4 5 10 11

Link Copied to Clipboard
Who's Online Now
2 members (Waremonger, Heihachi_73), 230 guests, and 1 robot.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,929
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com