Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
Ap2000 signs of life #117564 07/17/20 08:14 AM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
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]

Re: Ap2000 signs of life [Re: Golden Child] #117565 07/17/20 01:04 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
[Linked Image from i.imgur.com]

I got it to print some data, but it seems to drop characters while it's printing, probably some handshaking problem.

It should print PRINT "DATA TO PRINTER" and have DATA TO PRINTER underneath each line.

But it's a little closer 8-)

The Apple parallel interface sends 8 bit data, and the high bit is set, I just cleared the high bit and the printer liked that data a lot better.

Re: Ap2000 signs of life [Re: Golden Child] #117572 07/19/20 01:47 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
More fiddling around, it seems that the timing for the AD conversion is somehow inconsistent, and setting the conversion delay to a very high value actually makes the online and lf buttons usable.

It also seems that data sent by the Apple parallel interface card doesn't bother to check the acknowledge, it just hits the strobe, so there isn't any flow control.

There's still some characters being dropped by the ap2000, haven't been able to figure that out yet.

I added some blinkenlights to show writes to the portABC and C000-C00F, and it helps to see what's going on. Man, I love blinkenlights.

[Linked Image from i.imgur.com]

Re: Ap2000 signs of life [Re: Golden Child] #117573 07/19/20 08:39 PM
Joined: Mar 2001
Posts: 16,539
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,539
The source for the parallel card's ROM is available; it's possible the ACK isn't hooked up properly.

Re: Ap2000 signs of life [Re: R. Belmont] #117575 07/20/20 10:01 AM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
I looked at the PIC manual, and there's a source code listing for both the ROMs but neither one bothers to look at the ACK, they just seem to write to C0x0 and assume it gets read.

I guess the apple was slow enough that it wasn't a problem but theoretically that could cause dropped characters.

This really surprised me that there's no real flow control as it wouldn't have been hard to add.

[Linked Image from i.imgur.com]

I wrote a little crap BASIC program to write data directly to the parallel card via I/O locations, it's slow enough that it doesn't go too fast for the printer.

Code
  NEW
    1  GOTO 90
    2 POKE PO,C : ? C,PEEK(PI),PEEK(PI)  : RETURN  :   REM PRINT CHAR AND SHOW THE ACK STATUS
    90 C = PEEK(49152+256)   : REM READ FROM C100 TO ACTIVATE AUTOSTROBE
   100 PO = 49152 + 9*16 : PI =  PO+4   : REM C090 FOR OUTPUT C094 FOR ACK INPUT
   105 FOR J = 1 TO 24
   106 C=64+J : GOSUB 2 : Z$=STR$(J) :GOSUB 3000
   110 C = 27:GOSUB 2 : C = ASC("L") : GOSUB 2  : REM ESC L TO ACTIVATE GRAPHICS
   111 C = 127:GOSUB 2
   112 C = 0  : GOSUB 2
   120 FOR I=0 TO 127 : C = I : GOSUB 2 :NEXT
   150 C=13:GOSUB 2:C=10:GOSUB 2
   160 NEXT
   1999 END
   3000 FOR Z = 1 TO LEN(Z$) : C=ASC(MID$(Z$,Z,1)): GOSUB 2 : NEXT : RETURN

RUN


[Linked Image from i.imgur.com]

Another thing that was totaly puzzling me was why the LF wasn't working right, it seemed like I had to hit it twice, and then I noticed that it had PORT_TOGGLE set. Man, that was really baffling to me. I guess it pays to read the code 8-)


Code
        PORT_START("FORMFEED")
        PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Form Feed") PORT_CODE(KEYCODE_7_PAD) //PORT_TOGGLE
        PORT_START("LINEFEED")
        PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_9_PAD) //PORT_TOGGLE


Re: Ap2000 signs of life [Re: Golden Child] #117576 07/20/20 11:10 AM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
I modified the basic program to wait until ACK goes low, printing a dot every time it checks and the high bit is set. It's interesting that when it's printing that the acks doesn't finish right away.

Code
NEW
   1 GOTO 90
   2 POKE PO,C : ? C" ";:X = PEEK(PI) 
   3  IF  X < 128 GOTO 5
   4 ?".";:X=PEEK(PI):GOTO 3
   5 ? : RETURN

    90 C=PEEK(49152+256)   : REM READ FROM C100 TO ACTIVATE AUTOSTROBE
   100 PO = 49152 + 9*16 : PI =  PO+4
   105 FOR J = 1 TO 24
   106 C=64+J : GOSUB 2 : Z$=STR$(J) :GOSUB 3000
   110 C = 27:GOSUB 2 : C = ASC("L") : GOSUB 2
   111 C = 127:GOSUB 2
   112 C = 0  : GOSUB 2
   120 FOR I=0 TO 127 : C = I : GOSUB 2 :NEXT
   150 C=13:GOSUB 2:C=10:GOSUB 2
   160 NEXT
   1999 END
   3000 FOR Z = 1 TO LEN(Z$) : C=ASC(MID$(Z$,Z,1)): GOSUB 2 : NEXT : RETURN

RUN


It sends the 13 and 10 (CR LF)
then ESC L
then num of chars as two bytes

and you can see the dots get very long there, probably very likely to drop chars there if you're not checking the ACK.

[Linked Image from i.imgur.com]

Re: Ap2000 signs of life [Re: Golden Child] #117578 07/21/20 03:07 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
I got really aggravated trying to get it to print graphics because it kept dropping characters. So I thought, why not cheat a little and make a little buffer to hold the data.

And so I finally got some graphics to print. It's still glitching here and there, more to solve, but it was really gratifying to finally see something that looks halfway normal.

Some zoom grafix:

[Linked Image from i.imgur.com]

Trying Triple Dump (some glitching):

[Linked Image from i.imgur.com]

Re: Ap2000 signs of life [Re: Golden Child] #117579 07/21/20 04:04 PM
Joined: Mar 2001
Posts: 16,539
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,539
Interesting. I would assume Triple Dump actually does watch the handshaking, but maybe not.

The card itself apparently does some clever Woz stuff where it changes the PROM address mapping after STROBE is set until ACK comes in. Will need to investigate further.

Last edited by R. Belmont; 07/21/20 04:12 PM.
Re: Ap2000 signs of life [Re: R. Belmont] #117580 07/21/20 05:58 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
Yes, it's puzzling because you'd think there would be some kind of flow control.

I saw that my "minibuffer" was getting overrun and that was causing the glitches, so let's boost the size. The buffer has gone from mini to maxi: 8 bytes to 16k and now I said what the heck, 1 meelllion bytes.


Paper Graphics
[Linked Image from i.imgur.com]
Using the 144 vertical dpi (which overprints in multiple passes looks kinda odd) but 72 dpi looks good.

Triple Dump
[Linked Image from i.imgur.com]




Re: Ap2000 signs of life [Re: Golden Child] #117581 07/21/20 09:14 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
Thought I'd give it a spin with PrintMaster on the Amiga.

I tried with the cpc6128 and I was able to start Printmaster using the cpm startup disk with typing "|cpm", but it required a thousand disk swaps and it seemed to have trouble handshaking and dropping characters (even with my buffer). Oddly on the 6128, the arrow keys wouldn't work with Printmaster unless I held down the left arrow key and keeping it pressed, pressed the right arrow key.

As far as I can tell, the Amiga does watch the ack and busy lines and won't send any data while the printer isn't ready.

[Linked Image from i.imgur.com]

Re: Ap2000 signs of life [Re: Golden Child] #117582 07/21/20 11:53 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
Making calendars with Printmaster:

(I wonder how many people in the world are still using Printmaster and Dot Matrix Printers?)

[Linked Image from i.imgur.com]

While fiddling around with the cpc6128 I did encounter a strange bug. For some reason when running with the cpc6128 some of the ap2000's input ports all of a sudden went from active low to active high. This makes the printer boot up into "Data Dump Mode" because it thinks I'm holding down the Line Feed and Form Feed buttons when it starts. It's really weird that the cpc6128's doing that, because the apple2 and the amiga don't have that problem.

I'm doing a subtarget/sources build, could that be causing a problem?

Re: Ap2000 signs of life [Re: Golden Child] #117583 07/22/20 03:48 AM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
So let's see if the ibm5150 will work with print shop.

Testing the printer gives an error.

[Linked Image from i.imgur.com]

So let's see if we can figure out where it's hanging up.

We'll set an i/o watchpoint with wpi 378,8,r and then when it hits, set al=df (ack is active low) and then printshop will continue.
After doing that we disable the watchpoint.

[Linked Image from i.imgur.com]

This diagram from art of asm shows the status register.

So going into src/devices/machine/pc_lpt.cpp and adding an xor on STATUS_ACK seems to fix the error message.
Code
int8_t pc_lpt_device::status_r()
{
        return m_cent_status_in->read() ^ STATUS_BUSY ^ STATUS_ACK;
}



[Linked Image from i.imgur.com]

Re: Ap2000 signs of life [Re: Golden Child] #117623 08/05/20 10:46 PM
Joined: Feb 2014
Posts: 401
G
Golden Child Online Content OP
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 401
Just for fun, I thought I'd play with svgedit and inkscape to see if I could make something that looks like the control panel.

[Linked Image from i.imgur.com]

Page 1 of 2 1 2

Who's Online Now
2 registered members (TeamE, AJR), 59 guests, and 2 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,791
Posts115,714
Members4,908
Most Online890
Jan 17th, 2020
Powered by UBB.threads™ PHP Forum Software 7.7.3