Previous Thread
Next Thread
Print Thread
Page 1 of 11 1 2 3 10 11
#117564 07/17/20 08:14 AM
Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]

Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
[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.

Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]


Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
The source for the parallel card's ROM is available; it's possible the ACK isn't hooked up properly.

Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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

Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]


Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]

Joined: Mar 2001
Posts: 17,234
Likes: 259
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,234
Likes: 259
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.
Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]




Joined: Feb 2014
Posts: 1,124
Likes: 193
G
Very Senior Member
OP Offline
Very Senior Member
G
Joined: Feb 2014
Posts: 1,124
Likes: 193
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]

Page 1 of 11 1 2 3 10 11

Link Copied to Clipboard
Who's Online Now
3 members (Luengo, 2 invisible), 179 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,328
Posts122,128
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