Help understanding how the replica 1 works

Talk about your replica, what you have done and what you use it for

Help understanding how the replica 1 works

Postby mr_stivo » Oct Thu 26, 2017 2:57 pm

I know the Replica 1 Plus is no longer being produced but I found the project very interesting and spent some time examining the schematics and firmware. While most things seem easy to understand there are a few things I’m confused about. I was hoping there were some people still around that may be able to enlighten me.

On the propeller chip, why are pins 8 (P7) and 15 (P10) both connected to PB7 on the 6821? On the propeller chip, what magic is taking place with pins 15(P10) and 16 (P11)? How about this source code, what exactly is it doing?

Code: Select all
DAT

        org 0
INVERSE

mask_INV  LONG (|<11)            ' Inverter input pin
mask_INVO LONG (|<10)            ' Inverted pin out  \
shift     LONG 1                 ' number of positions to shift data
'temp      LONG 0
temp2     LONG 0
        mov  dira, mask_INVO     ' make px output pin
INVLOOP
       
        mov   temp2, INA
        xor   temp2, mask_INV    ' invert bit 10
        shr   temp2, shift       ' shift so bit 10 is moved to bit 9
        mov   OUTA, temp2
        jmp   #INVLOOP



On the propeller chip, what are pins 33 (P24) and 34 (P25) doing? On the schematic P25 goes to a mysterious “ASCII” label. Also, the comments in the source code say “P25 is ASCII keyboard buffer pin” and the code itself has references to these pins. For instance:

Code: Select all
repeat until INA[24] == 0
  dira[25]~
dira[25]~~


Is this an unimplemented feature?

Thanks in advance for any help you can provide. I may have more questions. =)
mr_stivo
 
Posts: 1
Joined: Oct Thu 26, 2017 12:18 pm

Re: Help understanding how the replica 1 works

Postby jac_goudsmit » Nov Sun 19, 2017 2:35 pm

mr_stivo wrote:I know the Replica 1 Plus is no longer being produced but I found the project very interesting and spent some time examining the schematics and firmware. While most things seem easy to understand there are a few things I’m confused about. I was hoping there were some people still around that may be able to enlighten me.


I come here every once in a while but not often. If you (or anyone else) have further questions, I recommend the forums at 6502.org. There are a lot more people there, and most of them can answer your questions.

On the propeller chip, why are pins 8 (P7) and 15 (P10) both connected to PB7 on the 6821?


Previous versions of the Replica 1 had a 74LS04 to invert PB7 and feed it back into CB2 of the PIA. In the latest version, Vince decided he could save a chip by emulating the inverter in the Propeller. That's what the INVERSE code does. But he must have overlooked that he already had DA connected at P7 on the Propeller.

By the way this code could be improved to shorten the propagation delay of the virtual inverter:

Code: Select all
' IMPROVED VERSION OF INVERTER CODE
' This is at the bottom of replica110plusREV03.spin
' The improved code changes the propagation delay from 250ns to 150ns.
DAT
              org       0
INVERSE
              ' NOTE: the Propeller starts executing here. In Vince's code there's data here.
              ' As it happens, the data decodes to NOP instructions so they don't cause any problems
              ' but obviously it's dangerous to do this, and he probably didn't intend to do so.

              mov       DIRA, mask_INVO         ' Make p11 output pin
INVLOOP
              test      mask_INV, INA wz        ' Z=1 if P10 is low
              muxz      OUTA, mask_INVO         ' Set P11 high if Z=1
              jmp       #INVLOOP

mask_INV      LONG      (|<11)                  ' Inverter input  pin
mask_INVO     LONG      (|<10)                  ' Inverter output pin


On the propeller chip, what are pins 33 (P24) and 34 (P25) doing? On the schematic P25 goes to a mysterious “ASCII” label.


That's not really a label, it's a text. Apparently Vince thought of implementing some feature that didn't make it into the final schematic; he deleted it but left the "ASCII" text and a short line from P24.

From the leftovers in the firmware, I suspect that he wanted to add hardware flow control to the serial port, and/or the possibility to attach an external ASCII keyboard (or maybe the ASCII keyboard was a feature in an earlier version of the hardware that was deleted for the latest version?). I think he intended P24 to be strobe input from an external keyboard, and P25 would go to the RTS output. CTS would be disconnected from RTS. But at 115200 bits per second, you can't simply tell the computer on the other side to stop sending and expect that it will stop right away: it may take a couple of characters before the other computer sees the change. It's not too hard to implement this in software but you have to look ahead by a couple of characters and keep an eye on your own buffer and turn RTS off when it's almost full but not quite. Obviously the leftovers in the firmware didn't do that so it wouldn't have worked.

By the way I just noticed a couple more bugs in the firmware: in the Spin code there are a couple of places where the code apparently compares two values and is supposed to do something when it's higher-or-equal or lower-or-equal, but the code uses "if a << b" instead of "if a =< b", and it uses "if a >> b" instead of "if a => b". In the Spin language, "<=" and ">=" mean something else than in other languages, but "<<" and ">>" are for bitwise shifts. I think here too, Vince gets away with it because the intended code is almost (but not quite!) equal to the generated code.

I'm away on a business trip, but when I get back home I'll see if I can make some improvements and fix some bugs on the Replica 1. Thanks for bringing these to our attention!

===Jac
User avatar
jac_goudsmit
 
Posts: 74
Joined: Jun Mon 14, 2010 4:22 pm
Location: Rancho Cucamonga, California


Return to replica 1 General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron