Hi guys,

I thought I'd start a separate thread for this.

There's something strange about how the upd7810 does the analog/digital conversion.

08 is written to the ANM register, which is supposed to do scan mode on inputs AN4 - AN7 and write them to CR0-CR3, but instead of getting the proper value for AN5, 0xFF gets written to CR1.

Code
 
               if (m_adcnt > m_adtot)
                {
                        m_adcnt -= m_adtot;
                        switch (m_adout)
                        {
//                              case 0: CR0 = m_tmpcr ? 0xff:0x00; break;
//                              case 1: CR1 = m_tmpcr ? 0xff:0x00; break;
//                              case 2: CR2 = m_tmpcr ? 0xff:0x00; break;
//                              case 3: CR3 = m_tmpcr ? 0xff:0x00; break;
                                case 0: CR0 = m_tmpcr; break;
                                case 1: CR1 = m_tmpcr; break;
                                case 2: CR2 = m_tmpcr; break;
                                case 3: CR3 = m_tmpcr; break;
                        }
                        m_adin  = (m_adin  + 1) & 0x07;
                        m_adout = (m_adout + 1) & 0x03;
                        if (m_adout == 0)
                                {IRR |= INTFAD;
                                printf(".IRR=%x ",IRR);}

                        m_shdone = 0;

With that mangling above, CR1 gets the expected value, 0xCB.


Code
focus 1
bp 1dee
g

Stopped at breakpoint 1
[MAME]> 

>history 1,10
1DF0: LXI     EA,$0000
1DEE: MOV     A,CR1
1DEB: MVI     EOM,$07
1DE7: SHLD    $C005
1DE3: LHLD    $9925
981A: JMP     $1DE3
001A: JMP     $981A
0019: EXA     
0018: EXX     
2091: RET     
208E: OFFIW   VV:11,$02
208D: RET     
208B: BIT     6,VV:14
2089: BIT     7,VV:11
3162: CALT    ($009A)
3168: JR      $3162
[MAME]> 

>print anm
8
>print a
CB

Before this, I would get 5 beeps which according to the service manual is a voltage error. Now it shows a little bit more life, not working properly yet.

[Linked Image from i.imgur.com]