PROGRAM 11             !PIA (U5) Test 

   DPY-PIA TEST <U5>#
   SYNC ADDRESS
   EXECUTE PROGRAM 12                 !delay
   DPY-+2-CONT#
   STOP
   REG1 = 0                         !test number clear

1: LABEL 1 
   INC REG1                         !increment test number
   REG3 = 0                         !clear bit number
   IF REG1 = 6 GOTO F               
IF REG1 = 5 GOTO 7                  !which test is next?
IF REG1 = 4 GOTO 4 
IF REG1 = 3 GOTO 3 
IF REG1 = 2 GOTO 2
DPY-#TEST PORT A OUTPUT 
EXECUTE PROGRAM 12                  !delay
DPY-TESTER PULSE HIGH, LOW OUT-
DPY-+CONT#
STOP
WRITE @ 100C1 = 0
WRITE @ REGF DEC = FF                !pia port a to output Part of
WRITE @ REGF INC = 4                                       Test 1
REG2 = 2                             !1st pia pin number
REG6 = A00                           !expected signature
REGF = 100C0                         !pia port a address
GOTO 5

2: LABEL 2
   DPY-#TEST PORT B OUTPUT
   EXECUTE PROGRAM 12
   WRITE @ 100C3 = 0
   WRITE @ REGF DEC = FF             !pia port b to output  Part of
   WRITE @ REGF INC = 4                                     Test 2
   REG2 = 10                         !enter 1st pia pin number
   REG6 = A00                        !expected signature
   REGF = 100C2                      !pia port b address
   GOTO 5

3: LABEL 3
   DPY-TEST PORT A INPUT#
   EXECUTE PROGRAM 12
   WRITE @ 100C1 = 0                 !PIA port a to input    Part of
   WRITE @ REGF DEC = 0                                      Test 3
   WRITE @ REGF INC = 4
   DPY-TESTER PULSE HIGH, LOW IN-
   DPY-+CONT#
   STOP
   REG2 = 2                          !1st pia pin number
   REG6 = 1                          !expected signature
   REGF = 100C0                      !port a address
   GOTO 5

4: LABEL 4
DPY-TEST PORT B INPUT#
EXECUTE PROGRAM 12
WRITE @ 100C3 = 0                                      ! Part of
WRITE @ REGF DEC = 0               !pia port b to input! Test 4
WRITE @ REGF INC = 4
REG2 = 101                         !st pia pin number
REG6 = 1                           !expected signature
REGF = 100C2                       !port b address

5: LABEL 5
DPY-PR0BE U22 PIN $2               !does oper wish to probe current pia pin?
DPY-+, YES/NO #?7
IF REG7 = 0 GOTO D                 !no - increment pin and bit number
READ PROBE                         !yes - read probe
IF REG1 = 5 GOTO 8                 !if test 4 complete, check cb2 line
IF REG1 > 2 GOTO 6                 !if test 2 complete, continue with test 3, or 4
WRITE @ REGF = 0                   !sets pia port to 0
DTOG @ REGF = FF BIT REG3          !toggle the bit no. in reg. 3 Part of Test 1 and 2
DTOG @ REGF = REGE BIT REGD        !repeat toggle using default reg.
WRITE @ REGF = 0                   !pia to zero
READ PROBE                         !gather signature
IF REG0 AND FFFF00 = REG6 GOTO C   !mask off all but sig and check against reg. 6
GOTO E

6: LABEL 6
READ @ REGF                        !read pulse at pia port                    !Part
REG8 = REGE                        !save data                                 !of
READ @ REGF                             !read pulse at pia port               !Test
IF REG8 AND REG6 = REGE AND REG6 GOTO E !if pulse present at each read, error !3 and 4
SHL REG6                                !move the test bit to next position for next pia pin check
GOTO C

7: LABEL 7
DPY-#CB2 TEST
EXECUTE PROGRAM 12
DPY-TESTER PULSE HIGH, LOW OUT
DPY-+CONT#
STOP
REG2 = 19                           !cb2 pin no.
REG3 = 7                            !full count in bit counter
REG6 = 2                            !expected event count
GOTO 5

8: LABEL 8
WRITE @ 100C3 = 38
WRITE @ REGF = 30                   !stimulate cb2 line
WRITE @ REGF = 38
WRITE @ REGF = 30
READ PROBE                          !gather event count
IF REG0 AND 7F = REG6 GOTO C        !verity event count - o.k. goto a
GOTO E                              !not correct count - goto e

C: LABEL C                          !sig o.k.
DPY-+, GOOD
EXECUTE PROGRAM 12                  !delay

D: LABEL D
INC REG2                            !increment pin
INC REG3                            !increment bit
IF REG3 = 8 GOTO 1
GOTO 5

E: LABEL E                          !sig. failure
DPY-'U22 PIN $2 BIT $3 FAILURE
DPY-+ LOOP'?5                       !repeat test
IF REG5 = 1 GOTO 5                  !yes
DPY-TEST FAIL#
STOP

F: LABEL F
DPY-PIA TEST PASSED#