Previous Thread
Next Thread
Print Thread
Page 3 of 10 1 2 3 4 5 9 10
Re: Ap2000 signs of life [Re: AJR] #117665 08/14/20 08:02 PM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473
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.

Re: Ap2000 signs of life [Re: Golden Child] #117667 08/15/20 12:44 AM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473
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.


Re: Ap2000 signs of life [Re: Golden Child] #117669 08/15/20 11:30 AM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473
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.

Re: Ap2000 signs of life [Re: Golden Child] #117670 08/15/20 05:16 PM
Joined: Dec 2015
Posts: 119
A
AJR Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2015
Posts: 119
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.

Re: Ap2000 signs of life [Re: AJR] #117671 08/15/20 06:56 PM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473

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?

Re: Ap2000 signs of life [Re: Golden Child] #117672 08/15/20 08:31 PM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
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.

Re: Ap2000 signs of life [Re: Golden Child] #117673 08/15/20 09:10 PM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473
Hi RB, I think it pretty much works now except for dropping chars if my latest commit is added.

Re: Ap2000 signs of life [Re: Golden Child] #117674 08/15/20 10:20 PM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
Yeah, I just saw that commit go in, great!

Re: Ap2000 signs of life [Re: R. Belmont] #117675 08/16/20 11:22 AM
Joined: Feb 2014
Posts: 473
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 473

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]

Re: Ap2000 signs of life [Re: Golden Child] #117676 08/16/20 12:33 PM
Joined: Mar 2001
Posts: 16,590
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,590
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 10 1 2 3 4 5 9 10

Who's Online Now
1 registered members (algrun), 52 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,818
Posts116,083
Members4,915
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.3