
ASMB,A,B,L,N,C     2100 VERSION       5/15/75 
      ORG 0 
* 
* 
* 
*             2000/ACCESS COMMUNICATIONS PROCESSOR
*                      FIRMWARE DIAGNOSTIC
* 
* 
* 
* 
* 
*     NOTE - THE FOLLOWING CONTROL PARAMETERS CAUSE 
*            THE INCLUSION OF NECESSARY BLOCKS OF CODE
*            FOR THE CPU OPTION INDICATED:
* 
* 
*            N - HP 2100 SERIES 
* 
*            Z - HP 21MX SERIES 
      HED GENERAL OPERATING PROCEDURE 
      SUP 
*     GENERAL OPERATING PROCEDURE 
* 
*         A. LOAD DIAGNOSTIC CONFIGURATOR AND SET IT UP.
*         B. LOAD DIAGNOSTIC MAIN PROGRAM 
*         C. IF THERE IS NO TBG SET P TO 2000B AND GO TO E
*         D. LOAD S-REG WITH SC OF TBG AND SET P TO 100B
*         E. PRESS RUN AND WAIT FOR HALT 107074.
*         F. LOAD SWITCH REGISTER 
*                   IF SET =: 
*                   15 = HALT AT END OF EACH TEST 
*                   14 = SUPRESS ERROR HALTS
*                   13 = LOOP ON LAST TEST
*                   12 = LOOP ON DIAGNOSTIC 
*                        (SUPPRESS ALL OPERATOR INTERVENTION) 
*                   11 = SUPRESS ERROR MESSAGES 
*                   10 = SUPRESS NON-ERROR MESSAGES 
*                    9 = GO TO USER CONTROL SECTION 
*                        AT END OF PRESENT TEST 
*                    8= SUPPRESS OPERATOR INTERVENTION TESTS
*                    7
*                      = DIAGNOSTIC OPTIONS 
*                    0
*         NOTE: STANDARD RUN SHOULD BE WITH SW. REG. = 0
*               USER CONTROL WILL ASK FOR A 32 BIT WORD.
*               EACH BIT WILL = 1 TEST
* 
*         G. PRESS RUN. 
*         H. RESTART - LOAD ADDRESS 2000B 
*         I. RECONFIGURE IF TESTING I/O INTERFACE - LOAD ADDRESS 100B 
* 
*         GENERAL COMPUTER HALTS
* 
*         1020XX    E OR H  000 TO 067
*         1060XX    E OR H  100 TO 167
*         1030XX    E OR H  200 TO 267
*         1070XX    E OR H  300 TO 367
* 
*         CONTROL PROGRAM HALT MESSAGES 
* 
*         102077    END OF DIAG (A = PASS COUNT)
*         102076    END OF TEST (A = TEST #)
*         102075    USER SELECTION REQUEST
*         102074    SELECT CODE INPUT COMPLETE
*         102073    USER SELECT CODE ERROR
*         102072    RESERVED
*         102071    RESERVED
*         102070    RESERVED
* 
*         106077    TRAP CELL HALT
* 
* 
* 
      HED PROGRAM ORGANIZATION CHART
*         ******************************************* 
*         *         CONFIGURATOR            100B    * 
*         *            LINKAGE TABLE                * 
*         ******************************************* 
*         *         EXECUTIVE               130B    * 
*         *         LINKAGE                         * 
*         ******************************************* 
*         *         CONSTANTS               150B    * 
*         *            AND                          * 
*         *         STORAGE                         * 
*         ******************************************* 
*         *                                2000B    * 
*         *         EXECUTIVE CONTROL               * 
*         *                                         * 
*         ******************************************* 
*         *         IF USED                         * 
*         *         BASIC I/O TESTS (TEST 00)       * 
*         *                                ZCEND    * 
*         ******************************************* 
*         *         TABLE OF TEST POINTERS          * 
*         *         TABLE OF I/O INSTR POINTERS     * 
*         ******************************************* 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         *         MAIN DIAGNOSTICS (1-31)         * 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         *                                         * 
*         ******************************************* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
      HED CONFIGURATOR LINKAGE TABLE
A     EQU 0         A REGISTER REFERENCE
B     EQU 1         B REGISTER REFERENCE
SW    EQU 1         SWITCH REGISTER REFERENCE 
INTP  EQU 0         INTERRUPT CHANNEL REFERENCE 
* 
* 
      ORG 100B
* 
      JMP CFIG,I    GO TO CONFIGURATION SECTION 
FAIN  BSS 1         FAST INPUT (PHOTO READER) 
SLOP  BSS 1         SLOW OUTPUT (LIST)
FAOP  BSS 1         FAST OUTPUT (DUMP OR PUNCH) 
SLIN  BSS 1         SLOW INPUT (KEYBOARD) 
FWAM  DEF FWAA      FIRST WORD OF AVBL. MEMORY
LWAM  BSS 1         LAST WORD OF AVBL. MEMORY 
      BSS 1         NOT USED (MAG TAPE) 
OTMC  BSS 1         1 MILL SEC TIME OUT COUNT 
      BSS 4         SELECT CODES FOR I/O
CPTO  BSS 1         COMPUTER TYPE/OPTIONS 
USSC  BSS 1         USER CARD TYPE AND SELECT CODE
MEMO  BSS 1         MEMORY SIZE AND TYPE
ISWR  BSS 1         INTERNAL SWITCH REGISTER
TMRR  BSS 1         1 MILL SEC TIMER
SWRC  BSS 1         CONFIGURATOR SWITCH CK PTR
I2AS  BSS 1         INTEGER TO ASCII CONVERSION 
O2AS  BSS 1         OCTAL TO ASCII CONVERSION 
AS2N  BSS 1         ASCII CONVERSION
DSNL  BSS 1         DIAGNOSTIC SERIAL NUMBER
FMTR  BSS 1         FORMATTER 
* 
* 
*         CONTROL LINKAGE AND DATA REFERENCES 
* 
CFIG  DEF ZCONF     CONFIGURATION SECTION 
MSGC  DEF ZMSGC     MESSAGE WITH NO HALT
MSGH  DEF ZMSGH     MESSAGE WITH HALT 
ERMS  DEF ZERMS     ERROR MESSAGE 
SWRT  DEF ZSWRT     SWITCH REGISTER CHECK ROUTINE 
TSTN  OCT 0         CURRENT TEST NUMBER 
EXRT  DEF ZEXRT     RETURN TO CONTROL PROGRAM 
      NOP           RESERVED
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
      HED EXECUTIVE CONTROL 
      ORG 2000B 
ZSTEX CLC INTP,C    TURN I/O SYSTEM OFF 
      JSB MSGC,I    DO CRLF 
      DEF ZRTLF 
      LDA HDMP      GET INTRODUCTORY MESSAGE
      STA *+2 
      JSB MSGC,I    OUT PUT IT
      NOP 
      CLA           CLEAR PASS
      STA ZEOLC       COUNT 
      LDB ZSW9      CHECK FOR USER SELECTION REQ
      JSB SWRT,I
      JMP ZUSR      IT'S USERS CHOICE 
ZNUSR LDA STDA      GET STANDARD TEST RUN 
      LDB STDB      * 
      JMP ZEXC
* 
ZUSR  LDA ZSINA     RETRIEVE PREVIOUS RUN 
      LDB ZSINB 
      HLT 75B       WAIT FOR USER INPUT 
      NOP 
      NOP 
      NOP 
ZEXC  STA ZUINA     SAVE
      STB ZUINB       USER
      STA ZSINA         INPUT 
      STB ZSINB           PROGRAM 
      LDB ZSW9      CHECK IF SW9 IS DOWN
      JSB SWRT,I
      JMP ZUSR      NO GO AND WAIT
      CCA           SET TEST NUMBER 
      STA TSTN      =-1 
      CLA 
      STA ZTSTA     CLEAR TEST RUN FLAG 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
      SKP 
ZEXCL LDA ZUINA     RESTORE A REG.
      LDB ZUINB     RESTORE B REG.
      ERA,RAL       ROTATE
      ERB             FIRST 
      ERA               TEST BIT
      STA ZUINA     SAVE POSITIONS
      STB ZUINB 
      ISZ TSTN      MOVE TEST UP ONE
      NOP 
ZXCL1 LDA TSTN
      ADA TSTP      GET IT'S
      LDA A,I         ADDRESS 
      CPA Z.M1      IS IT END OF LIST 
      JMP ZEOL      YES 
      LDB ZUINB 
      SSB,RSS       SHOULD IT BE RUN? 
      JMP ZEXCL     NO
      STA ZTSTA     YES - SAVE TEST ADDRESS 
      JSB ZITCH     INITIALIZE TRAP CELL HALTS
      JSB ZTSTA,I   GO DO TEST
ZEXRT LDA TSTN      DISPLAY TEST NUMBER IF HALTED 
      LDB ZSW15     CHECK FOR HALT AT END OF TEST 
      JSB SWRT,I
      HLT 76B       YES WAIT FOR OPERATOR 
      LDB ZSW9      CHECK FOR ABORT 
      JSB SWRT,I
      JMP ZUSR      YES 
      LDB ZSW13     CHECK FOR LOOP ON ROUTINE 
      JSB SWRT,I
      JMP ZXCL1     YES - LOOP
      JMP ZEXCL     CONTINUE
* 
ZEOL  LDA ZTSTA     CHECK IF ANY TESTS WERE RUN 
      SZA,RSS       ? 
      JMP ZNUSR     NO  SO PICK UP STANDARD RUN 
      LDA ZEOLC     UP DATE PASS COUNT
      INA 
      STA ZEOLC 
      CCE 
      LDB ZPSCA     GET PASS COUNT
      ADB Z.2         ADDRESS 
      JSB O2AS,I    CONVERT IT
      JSB MSGC,I    CALL PRINT ROUTINE
ZPSCA DEF ZPSC
      LDB ZSW12     CHECK FOR LOOP ON DIAG. 
      JSB SWRT,I
      JMP *+3       YES 
      LDA ZEOLC 
      HLT 77B       NO WAIT AND DISPLAY PASS COUNT
      LDA ZSINA     RESTORE ORIGINAL
      LDB ZSINB       PROGRAM 
      JMP ZEXC      DO IT ALL AGAIN 
* 
      SKP 
*         MESSAGE OUTPUT WITH OUT HALT
* 
ZMSGC NOP           ENTRY 
      JSB ZMSG      OUTPUT MESSAGE
      OCT 2000      SWITCH 10 CHECK 
      JMP ZMSGC,I   RETURN TO CALLER
* 
*         MESSAGE OUTPUT WITH HALT
* 
ZMSGH NOP           ENTRY 
      JSB ZMSG      OUTPUT MESSAGE
      OCT 2000      SWITCH 10 CHECK 
      LDA ZHLT      GET HALT CODE 
      STA *+2       PUT IT IN PLACE 
      LDA ZSAVA     RESTORE A REGISTER
      NOP           HALT FOR DISPLAY
      JMP ZMSGH,I   RETURN TO CALLER
* 
*         ERROR MESSAGE WITH HALT 
* 
ZERMS NOP           ENTRY 
      JSB ZMSG      OUTPUT MESSAGE
      OCT 4000      SWITCH 11 CHECK 
      CLA 
      LDB ZSW14     CHECK SWR BIT 14 TO SUPPRESS
      JSB SWRT,I    HALT
      STA *+3       PUT  HALT IN PLACE
      LDA ZSAVA     RESTORE A & B 
      LDB ZSAVB 
ZHLT  NOP           WAIT FOR OPERATOR 
      JMP ZERMS,I   RETURN TO CALLER
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
      SKP 
*         OUTPUT MESSAGE
* 
ZMSG  NOP 
      STA ZSAVA     SAVE A AND B REGISTERS
      STB ZSAVB 
      LDB ZMSG,I    GET SWITCH REGISTER BIT 
      LDA ZMSG
      ADA Z.M2      DECREMENT RETURN ADDRESS
      STA ZMSG
      JSB SWRT,I    CHECK TO SUPPRESS MESSAGE 
      JMP ZMSG0     YES 
      LDA ZMSG,I    CHECK IF ERROR
      LDA A,I 
      LDA A,I       IF SO 
      ALF,ALF 
      AND Z.177 
      CPA ZA.E
      JSB ZCFTN     CHECK TO OUTPUT TEST NUMBER 
      LDA ZMSG,I    NO RETRIEVE FORMAT
      LDB A,I         ADDRESS 
      CLA,CLE 
      JSB FMTR,I
ZMSG0 LDA ZMSG,I    CONVERT HALT CODE 
      LDB A,I         FROM ASCII STRING 
      CCA,CCE 
      JSB AS2N,I
      STA ZN2AO     SAVE RESULT 
      AND Z.300     DECODE
      LDB ZH2         HALT CODE 
      CPA Z.100 
      LDB ZH6 
      CPA Z.200 
      LDB ZH3 
      CPA Z.300 
      LDB ZH7 
      LDA ZN2AO     GET HALT NUMBER 
      AND Z.77
      IOR B 
      STA ZHLT      SAVE IT 
      ISZ ZMSG,I    ADJUST RETURN POINTERS
      ISZ ZMSG
      ISZ ZMSG
      ISZ ZMSG
      LDA ZSAVA     RESTORE A AND B REGISTERS 
      LDB ZSAVB 
      JMP ZMSG,I
* 
* 
* 
* 
* 
* 
      SKP 
ZCFTN NOP 
      LDA TSTN      GET TEST NUMBER 
      CPA ZCFTT     IS IT THE SAME ONE? 
      JMP ZCFTN,I   YES SKIP OUTPUT 
      STA ZCFTT     NO - THEN UPDATE IT 
      JSB ZN2AO     CONVERT IT
      STA ZTSTN     PUT IT IN STRING
      CLA           DO A CRLF 
      JSB SLOP,I
      CLA,CLE       INDICATE START OF FORMAT
      LDB ZTSTF 
      JSB FMTR,I
      JMP ZCFTN,I   RETURN
* 
* 
* 
* 
ZSAVA NOP 
ZSAVB NOP 
ZEOLC NOP 
ZTSTA NOP 
ZSINA NOP 
ZSINB NOP 
ZUINA NOP 
ZUINB NOP 
ZBTMP NOP 
Z.2   OCT 2 
Z.7   OCT 7 
Z.10  OCT 10
Z.60  OCT 60
Z.77  OCT 77
Z.177 OCT 177 
Z.M1  DEC -1
Z.M2  DEC -2
ZD100 DEC -100
ZIOM  OCT 177700
ZSW15 OCT 100000
ZSW14 OCT 40000 
ZSW13 OCT 20000 
ZSW12 OCT 10000 
ZS812 OCT 010400
ZSW9  OCT 1000
Z.100 OCT 100 
Z.200 OCT 200 
Z.300 OCT 300 
ZH2   OCT 102000
ZH6   OCT 106000
ZH3   OCT 103000
ZH7   OCT 107000
ZCFTT DEC -1
ZTSTF DEF *+1 
      ASC 3,TEST
ZTSTN ASC 2,XX//
ZRTLF ASC 1,//
ZPSC  ASC 6,PASS XXXXXX/
ZA.E  OCT 105 
      HED GENERAL ROUTINES
* 
* 
ZN2AO NOP 
      STA ZIOAD     SAVE NUMBER 
      AND Z.7       CONVERT FIRST 
      IOR Z.60        NUMBER
      STA B         SAVE IT 
      LDA ZIOAD     GET 
      RAR,RAR         SECOND
      RAR               NUMBER
      AND Z.7       CONVERT 
      IOR Z.60        IT
      ALF,ALF       MOVE TO UPPER HALF
      IOR B         ADD LOWER 
      JMP ZN2AO,I   AND RETURN
* 
* 
* 
*         SWITCH REGISTER CHECK 
* 
ZSWRT NOP 
      STA ZN2AO     SAVE A REGISTER 
      LIA SW        GET SWITCH REG. 
      AND B         MASK OUT BIT
      SZA,RSS       IS IT UP? 
      ISZ ZSWRT     NO
      LDA ZN2AO     RESTORE A REGISTER
      LIB SW        LET B = SWITCH REGISTER 
      JMP ZSWRT,I   RETURN TO CALLER
* 
* 
* 
*         INITIALIZE TRAP CELL HALTS
* 
ZITCH NOP 
      LDA ZTSH      GET STARTING TRAP CELL HALT 
      LDB Z.2       GET FIRST TRAP CELL LOCATION
ZTSHL STA B,I       PUT IT IN PLACE 
      CPB Z.77      AM I FINISHED 
      JMP ZITCH,I   YES 
      INB             NEXT ADDRESS
      JMP ZTSHL 
* 
ZTSH  OCT 106077
* 
* 
* 
      SKP 
*         PUT JSB INSTRUCTION IN TRAP CELL
* 
ZTCJI NOP 
      LDB ZJSBI     GET INSTRUCTION 
      STB ZIOSC,I   PUT IT IN TRAP CELL 
      LDA ZTCJI,I   GET LOCATION
      STA 3B        SAVE IT FOR JSB INSTRUCTION 
      ISZ ZTCJI     ADJUST RETURN 
      JMP ZTCJI,I   RETURN TO CALLER
* 
ZJSBI JSB 3B,I      JSB INSTRUCTION 
* 
* 
*         INITIALIZE SELECT CODE I/O INSTRUCTIONS 
* 
ZISC  NOP 
      STA ZIOSC     SAVE SELECT CODE
      STB ZIOAD     SAVE TABLE ADDRESS
ZIOL  LDB ZIOAD,I   GET ADDRESS OF LOCATION 
      CPB Z.M1      IS IT THE TERMINATOR
      JMP ZISC,I    YES RETURN TO CALLER
      LDA B,I       NO - GET CONTENTS 
      AND ZIOM      MASK OFF OLD SELECT CODE
      IOR ZIOSC     ADD IN NEW SELECT CODE
      STA B,I       RESTORE  IT 
      ISZ ZIOAD     MOVE TO NEXT ADDRESS
      JMP ZIOL      DO IT 
* 
ZIOSC NOP 
ZIOAD NOP 
* 
* 
* 
* 
      SKP 
*         CONFIGURATION SECTION 
* 
ZCONF CLC INTP,C    TURN I/O SYSTEM OFF 
      LIA SW        GET SELECT CODE AND OPTIONS 
      STA USSC      SAVE THEM 
      AND Z.77      ELIMINATE OPTIONS 
      LDB A 
      CMB,INB       CHECK THAT SC > 7 
      ADB Z.7 
      SSB           ? 
      JMP *+3       OK GO ON
      HLT 73B       NO
      JMP ZCONF     TRY AGAIN 
      LDB IOIP      INITIALIZE TEST I/O 
      JSB ZISC        INSTRUCTIONS
      HLT 74B       ALLOW OPERATOR TO CHANGE SWIT 
      JMP ZSTEX     GO TO EXEC CONTROL SECTION
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
ZCEND EQU * 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
* 
      HED BASE PAGE AND LINKAGES
      ORG 126B
      IFN 
      OCT 101016    2100 DIAGNOSTIC SERIAL NUMBER 
      XIF 
      IFZ 
      OCT 101017    21MX DIAGNOSTIC SERIAL NUMBER 
      XIF 
* 
      ORG 140B
IOIP  DEF IOID
TSTP  DEF TSTD
HDMP  DEF HDMS
      IFN 
STDA  OCT 1777
      XIF 
      IFZ 
STDA  OCT 777 
      XIF 
STDB  OCT 0 
      SUP 
* 
      ORG 150B
      IFN 
HDMS  ASC 19,2100 2000-ACCESS COMM. PROC. FIRMWARE
      ASC 6,DIAGNOSTIC/ 
      XIF 
      IFZ 
HDMS  ASC 19,21MX 2000-ACCESS COMM. PROC. FIRMWARE
      ASC 6,DIAGNOSTIC/ 
      XIF 
* 
IOID  EQU * 
      DEF TBGSC 
      DEF TBGIP 
      DEF TBGIT 
      DEC -1
TSTD  EQU * 
      DEF TST00 
      DEF TST01 
      DEF TST02 
      DEF TST03 
      DEF TST04 
      DEF TST05 
      DEF TST06 
      DEF TST07 
      DEF TST08 
      IFN 
      DEF TST09 
      XIF 
      DEC -1
      SKP 
* 
* DEFINE MICROS 
* 
      IFZ 
LAI   EQU 420B
SAI   EQU 420B
CRC   EQU 460B
RESTR EQU 461B
READF EQU 462B
INS   EQU 463B
ENQ   EQU 464B
PENQ  EQU 465B
DEQ   EQU 466B
TRSLT EQU 467B
IAL   EQU 470B
PFREI EQU 471B
PFREX EQU 472B
PFRIO EQU 473B
SAVE  EQU 474B
      XIF 
      IFN 
IAL   EQU 0 
LAI   EQU 40B 
SAI   EQU 100B
BMVE  EQU 120B
CRC   EQU 150B
TRSLT EQU 160B
MOVE  EQU 200B
READF EQU 220B
PFRIO EQU 221B
PFREI EQU 222B
PFREX EQU 223B
ENQ   EQU 240B
PENQ  EQU 257B
DEQ   EQU 260B
SAVE  EQU 362B
STBYT EQU 300B
LBYTE EQU 320B
RESTR EQU 340B
      XIF 
* 
* 
* 
* 
      SUP 
      DEC -40,-39,-38,-37,-36,-35,-34,-33 
      DEC -32,-31,-30,-29,-28,-27,-26,-25 
      DEC -24,-23,-22,-21,-20,-19,-18,-17 
      DEC -16,-15,-14,-13,-12,-11,-10,-9
      DEC -8,-7,-6,-5,-4,-3,-2,-1 
.     DEC 0,1,2,3,4,5,6,7 
      DEC 8,9,10,11,12,13,14,15 
      DEC 16,17,18,19,20,21,22,23 
      DEC 24,25,26,27,28,29,30,31 
      UNS 
* 
M500  DEC -500
* 
* 
MRGHT OCT 377 
MLEFT OCT 177400
* 
* 
* 
* 
* 
* RNDGN PUTS A PSUEDO RANDOM NUMBER IN A EACH TIME
* IT IS CALLED
* 
RNDGN NOP 
      LDA BASE
      ADA PRIME 
      SSA 
      LDA BASE
      CLE,ELA 
      STA BASE
      RAR 
      JMP RNDGN,I 
* 
PRIME DEC -31069
BASE  OCT 34521 
* 
* 
* 
** REGCK
* 
* THIS ROUTINE CHECKS IF THE REGISTERS HAVE BEEN MODIFIED 
* SINCE THE LAST CALL TO SAVR.  A FOUR BIT VECTOR IS RE-
* TORNED IN THE LOW BITS OF REGST TO INDICATE ANY CHANGES.
* BIT 3 IS SET IF (A) HAS CHANGED, BIT 2 IF (B), BIT 1 IF 
* (E) AND BIT 0 IF (O).  THE REMAINING BITS IN REGST ARE
* CLEARED.
* 
REGCK NOP 
      STA REGCA 
      XOR SAVRA 
      SZA,RSS       (A) CHANGED?
      JMP *+3       NO
      CLA           YES 
      RSS 
      INA 
      ALS 
      CPB SAVRB     (B) CHANGED?
      INA           NO
      ALS           YES 
      SEZ,RSS       (E) SET?
      INA           NO
      ALS 
      SOS           (O) SET?
      INA           NO
      XOR REGEO 
      CMA 
      AND .+17B 
      STA REGST 
      LDA REGCA     RESTORE (A) 
      JMP REGCK,I 
* 
REGCA BSS 1 
REGST BSS 1 
* 
* 
** SAVRG
* 
* THIS ROUTINE RECORDS THE CONTENTS OF THE REGISTERS. 
* 
*     SAVA <= (A) 
*     SAVB <= (B) 
*     REGEO <= (E)/(O), IN BITS 1/0 
* 
SAVRG NOP 
      STA SAVRA 
      STB SAVRB 
      CLA 
      SEZ 
      INA 
      ALS 
      SOC 
      INA 
      STA REGEO 
      LDA SAVRA 
      JMP SAVRG,I 
* 
SAVRA BSS 1 
SAVRB BSS 1 
REGEO BSS 1 
* 
** RANEO
* 
* THIS ROUTINE SET (E) AND (O) WITH RANDOM VALUES 
* 
RANEO NOP 
      STA RANA
      JSB RNDGN     GET A RANDOM NUMBER 
      ALF 
      SLA 
      JMP *+3 
      CLE 
      RSS 
      CCE 
      SSA 
      JMP *+3 
      CLO 
      RSS 
      STO 
      LDA RANA
      JMP RANEO,I 
* 
RANA  BSS 1 
* 
* 
* 
**  GET BYTE
* 
* CALLING SEQUENCE
* 
*         LDB BYADR       BYTE ADDR OF CHAR 
*         JSB GBYTE       RESULT IN A 
*         <RETURN>
* 
* (B) IS RESTORED ON EXIT 
* 
GBYTE NOP 
      STB GBYTB      SAVE B 
      RBR            MAKE ADDR INTO WORD ADDR 
      ELB,CLE,ERB    CLEAR BIT15
      LDA B,I        GET WORD CONTAINING BYTE 
      LDB GBYTB      GET BYTE ADDR
      SLB            LEFT BYTE? 
      JMP *+4        NO 
      AND MLEFT      YES
      ALF,ALF 
      RSS 
      AND MRGHT      EXTRACT RIGHT BYTE 
* 
      LDB GBYTB      RESTORE B
      JMP GBYTE,I    RETURN 
* 
* 
GBYTB BSS 1 
* 
* 
* 
**  STORE BYTE
* 
* 
* CALLING SEQUENCE
* 
*         LDA CHAR
*         LDB BYADR     BYTE ADDR 
*         JSB SBYTE 
* 
*         <RETURN>
* 
* (B) IS RESTORED ON EXIT 
* 
* 
SBYTE NOP 
      STB SBYTB      SAVE B 
      STA SBYTA 
      AND MRGHT 
      STA SBYCH      SAVE CHAR
      RBR 
      ELB,CLE,ERB 
      STB SBYTD      SAVE DESTINATION ADDRESS 
      LDA B,I        GET DESTINATION WORD 
      LDB SBYTB 
      SLB            STORE INTO LEFT BYTE?
      JMP SRGHT      NO 
      AND MRGHT      YES
      ALF,ALF 
      ADA SBYCH     INSERT CHAR 
      ALF,ALF 
      JMP *+3 
SRGHT AND MLEFT 
      ADA SBYCH      INSERT CHAR
      STA SBYTD,I 
* 
      LDA SBYTA      RESTORE A
      LDB SBYTB        AND B
      JMP SBYTE,I    RETURN 
* 
* 
SBYTA BSS 1 
SBYTB BSS 2 
SBYTD BSS 1 
SBYCH BSS 1 
* 
* 
* 
* 
** TBGIC
* 
* THIS ROUTINE STARTS THE TIME BASE GENERATOR 
* AND LOOPS UNTIL ABOUT 25 MICROSECONDS BEFORE
* THE INTERRUPT 
* 
* 
TBGIC NOP 
      STA TBGIA     SAVE (A)
      LDA TBGSU     LOAD INTERRUPT
      STA TBGSC,I     TRAP CELL 
      CLA           SET UP TBG FOR
TBGIP OTA TBG         .1 MILLISECOND
TBGIT STC TBG,C         PERIOD
      LDA .-15      LOOP
      ISZ A 
      JMP *-1 
      STF 0 
      LDA TBGIA     RESTORE (A) 
      JMP TBGIC,I   EXIT
* 
TBGSU JSB INTMB 
TBGIA BSS 1 
TBG   EQU 0         DUMMY TBG SC
TBGSC OCT 0 
* 
* INTERRUPT HANDLER FOR MOVE AND BYTE MOVE AND TRSLT
* 
INTMB NOP 
      CLF 0 
      STA INTMT     SAVE (A)
      LDA INTMB     WAS MICROPROGRAM INTERRUPTED? 
      IFN 
      CPA MOVEA 
      JMP *+4 
      CPA BMVEA 
      RSS           YES 
      XIF 
      CPA TRSTA     NO
      RSS           YES 
      JMP INTMB,I   NO, EXIT
      CLA,INA       INDICATE THE MICRO PROGRAM
      STA INTFG       WAS INTERRUPTED 
      LDA INTMT     RESTORE (A) 
      JMP INTMB,I   RETURN
* 
INTFG BSS 1 
INTMT BSS 1 
      IFN 
BMVEA DEF BMVAD 
MOVEA DEF MVEAD 
      XIF 
TRSTA DEF TRSAD 
      HED CRC TEST
* 
**  CRC TEST
* 
* 
* 1. GET AND EIGHT BIT CHAR 
* 2. CALCULATE CRC WITH PROGRAM 
* 3. CALCULATE CRC WITH MICRO-PROGRAM 
* 4. COMPARE
* 
* 
TST00 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS030 
      CLA 
      STA CRCPR      CLEAR CRC
      STA CRCMP 
      LDA N500
      STA CRCTC      DO 500 CHARS 
CRCT1 JSB RNDGN      GET A RANDOM NUMBER
      AND MRGHT      EXTRACT RIGHT EIGHT BITS 
      STA CRCMC      SAVE CHAR
* 
* CALCULATE CRC WITH PROGRAM
* 
      JSB CCRC
CRCPR BSS 1 
* 
* CALCULATE CRC WITH MICRO-PROGRAM
* 
      JSB RNDGN      SET (B) TO A RANDOM
      STA B            VALUE
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA CRCMC 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+CRC     =RAM CRC
CRCMP BSS 1 
* 
* COMPARE RESULTS 
* 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS032 
      JMP TST00,I 
      LDA CRCPR 
      CPA CRCMP 
      JMP *+4 
      JSB ERMS,I     ERROR, OUTPUT
      DEF MS031        MESSAGE
      JMP *+3 
* 
      ISZ CRCTC      DONE?
      JMP CRCT1      NO 
      JMP TST00,I 
* 
* 
N500  DEC -500
CRCTC BSS 1 
CRCMC BSS 1 
      SKP 
* 
* 
**  CALCULATE CRC 
* 
* 
* CALLING SEQUENCE
* 
*         LDA CHAR
*         JSB CCRC
*   CRCR  BSS 1 
*         <RETURN>
* 
* 
* (A) AND (B) ARE NOT AFFECTED
* 
* 
CCRC  NOP 
      STA CRCA      SAVE REGISTERS
      STB CRCB
      LDB .-8 
      STB CRCCT 
* 
      XOR CCRC,I
CRC1  SLA,RAR 
      XOR POLYN 
      ISZ CRCCT 
      JMP CRC1
      STA CCRC,I
      ISZ CCRC
* 
      LDA CRCA       RESTORE REGISTERS
      LDB CRCB
      JMP CCRC,I     RETURN 
* 
CRCA  BSS 1 
CRCB  BSS 1 
CRCCT BSS 1 
POLYN OCT 020001
* 
* 
* 
* 
* 
      HED ENQUE AND DEQUE TESTS 
* 
* 
**  ENQUE AND DEQUE TESTS 
* 
* 1. INITIALIZE QHEAD, QTAIL, AND LINK WORDS
* 2. QUEUE ELEMENT 1
* 3. QUEUE ELEMENT 3
* 4. PRIOTITY QUEUE ELEMENT 2 
* 5. QUEUE ELEMENT 5
* 6. QUEUE ELEMENT 4
* 7. SCAN THROUGH QUEUE 
* 
* 1. DEQUEUE AN ELEMENT 
* 2. DEQUEUE ANOTHER
* 3. DEQUEUE ANOTHER
* 4. DEQUEUE ANOTHER
* 5. DEQUEUE ANOTHER
* 6. CHECK IF SKIP RETURN IS TAKEN WHEN A DEQUE IS TRIED ON AN
*    EMPTY QUEUE
* 
* 
TST01 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS040 
      CLA 
      STA ELEM1-1    CLEAR
      STA ELEM2-1      LINK WORDS 
      STA ELEM3-1 
      STA ELEM4-1 
      STA ELEM5-1 
      STA QHEAD      DEFINE 
      LDA QHEDP        AN EMPTY 
      INA                QUEUE
      STA QTAIL 
* 
      LDA QHEDP      => TO QHEAD/QTAIL
      LDB ELMP1      ENQUE ELEM1
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+ENQ  =RAM ENQ 
      RSS            EMPTY QUEUE RETURN 
      JMP ENQ12      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ17      ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      LDB ELMP3      ENQUE ELEM3
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+ENQ  =RAM ENQ 
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ17      ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      LDB ELMP2      PRIORITY ENQUE 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+PENQ  OF ELEM2
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ17      ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      LDB ELMP5      ENQUE ELEM5
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+ENQ  =RAM ENQ 
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ17      ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      LDB ELMP4      ENQUE ELMP4
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+ENQ  =RAM ENQ 
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ17      ERROR
* 
* 
* 
* SCAN THROUGH QUEUE TO CHECK FOR CORRECTNESS 
* 
      LDA QHEAD     => TO FIRST ELEMENT 
      LDB A,I       GET IT
      CPB .+1       SHOULD BE ONE 
      RSS 
      JMP ENQ15      ENQ OR PENQ ERROR
      ADA .-1 
      LDA A,I        => TO NEXT ELEMENT 
      LDB A,I        GET IT 
      CPB .+2        SHOULD BE 2
      RSS 
      JMP ENQ15      ENQ OR PENQ ERROR
      ADA .-1 
      LDA A,I        => TO NEXT ELEMENT 
      LDB A,I        GET IT 
      CPB .+3        SHOULD BE 3
      RSS 
      JMP ENQ15      ENQ OR PENQ ERROR
      ADA .-1 
      LDA A,I        => TO NEXT ELEMENT 
      LDB A,I        GET IT 
      CPB .+4        SHOULD BE 4
      RSS 
      JMP ENQ15      ENQ OR PENQ ERROR
      ADA .-1 
      LDA A,I        => TO NEXT ELEMENT 
      LDB A,I        GET IT 
      CPB .+5        SHOULD BE 5
      RSS 
      JMP ENQ15      ENQ OR PENQ ERROR
      CPA QTAIL      QTAIL SHOULD POINT TO THIS 
      RSS              ENTRY
      JMP ENQ15      ENQ OR PENQ ERROR
* 
* 
** TEST DEQUE 
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQUE 1ST ENTRY
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
      LDB B,I 
      CPB .+1        SHOULD BE 1
      RSS 
      JMP ENQ16      DEQ ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQUE 2ND ENTRY
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
      LDB B,I 
      CPB .+2        SHOULD BE 2
      RSS 
      JMP ENQ16      DEQ ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQ 3RD ENTRY
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
      LDB B,I 
      CPB .+3        SHOULD BE 3
      RSS 
      JMP ENQ16      DEQ ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQUE 4TH ENTRY
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
      LDB B,I 
      CPB .+4        SHOULD BE 4
      RSS 
      JMP ENQ16      DEQ ERROR
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQUE 5TH ENTRY
      JMP ENQ11      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
      LDB B,I 
      CPB .+5        SHOULD BE 5
      RSS 
      JMP ENQ16      DEQ ERROR
* 
* THE QUEUE IS NOW EMPTY
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA QHEDP      => TO QHEAD/QTAIL
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+DEQ  DEQUE
      RSS            EMPTY RETURN 
      JMP ENQ12      ERROR, WRONG RETURN TAKEN
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+13B      A,E AND O SHOULD BE UNCHANGED
      SZA            ALL REGISTERS RESTORED?
      JMP ENQ21      ERROR
* 
      LDA QHEAD      QHEAD SHOULD 
      SZA              BE ZERO
      JMP ENQ13      ERROR
      LDA QHEDP      QTAIL SHOULD POINT 
      INA              TO ITSELF
      CPA QTAIL 
      RSS 
      JMP ENQ14      ERROR
      JMP TST01,I 
* 
* 
* 
* ERROR EXITS 
* 
ENQ11 JSB ERMS,I
      DEF MS041 
      JMP TST01,I 
ENQ12 JSB ERMS,I
      DEF MS042 
      JMP TST01,I 
ENQ13 JSB ERMS,I
      DEF MS043 
      JMP TST01,I 
ENQ14 JSB ERMS,I
      DEF MS044 
      JMP TST01,I 
ENQ15 JSB ERMS,I
      DEF MS045 
      JMP TST01,I 
ENQ16 JSB ERMS,I
      DEF MS046 
ENQ17 JSB ERMS,I
      DEF MS047 
      JMP TST01,I 
ENQ21 JSB ERMS,I
      DEF MS051 
      JMP TST01,I 
* 
* 
* 
QHEDP DEF QHEAD 
QHEAD BSS 1 
QTAIL BSS 1 
* 
* 
* ELEMENTS
* 
      BSS 1 
ELEM1 DEC 2 
* 
      BSS 1 
ELEM2 DEC 1 
* 
      BSS 1 
ELEM3 DEC 3 
* 
      BSS 1 
ELEM4 DEC 5 
* 
      BSS 1 
ELEM5 DEC 4 
* 
* 
ELMP1 DEF ELEM1 
ELMP2 DEF ELEM2 
ELMP3 DEF ELEM3 
ELMP4 DEF ELEM4 
ELMP5 DEF ELEM5 
* 
* 
* 
      HED IAL TEST
* 
**  IAL TEST
* 
* 
* 1. GENERATE A LIST ADDRESS
* 2. CLEAR THE DESTINATION AREA 
* 3. EXECUTE MICROPROGRAM 
* 4. CHECK RESULTS
* 
* 
TST02 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS060 
      LDA M500
      STA IALCT 
* 
IAL00 JSB RNDGN      GET LENGTH 
      AND .+37B 
      SZA,RSS 
      JMP *-3 
      STA IALSZ      SAVE LENGTH
      STA IALCK 
* 
* GET SOURCE LIST ADDRESS 
* 
      JSB RNDGN 
      SZA 
      ELA,CLE,ERA 
      STA IALLS      SAVE IT
      STA IALRS 
* 
* CLEAR DESTINATION AREA
* 
      LDA .-32
      STA IALCC 
      CLA 
      STA IALI
* 
IAL10 CLA 
      LDB IALBP      => TO DESTINATION AREA 
      ADB IALI       INDEX
      STA B,I 
      ISZ IALI
      ISZ IALCC      DONE?
      JMP IAL10      NO 
* 
* 
* EXECUTE MICROPROGRAM
* 
      JSB RNDGN      SET (B) TO A RANDOM
      STA B            VALUE
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
* 
      LDA IALLS      ADDR OF UNIQUE STORAGE AREA
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+IAL  =RAM IAL 
      DEF IALBF 
IALSZ DEC 0          LENGTH OF LIST SET ABOVE 
* 
* CHECK RESULTS 
* 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+7        B,E AND O SHOULD BE UNCHANGED
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS063 
      JMP TST02,I 
      LDA IALCK      # OF WORDS MOVED 
      CMA,INA 
      STA IALCC 
      CLA 
      STA IALI
      LDB IALRS 
* 
IAL20 LDA IALBP      => DESTINATION BUFFER
      ADA IALI       INDEX
      LDA A,I        GET WORD 
      CPA B          SHOULD BE EQUAL
      JMP *+4 
      JSB ERMS,I     BAD INDIRECT ADDRESS 
      DEF MS061        LIST GENERATED 
      JMP TST02,I 
      INB 
      ISZ IALI       BUMP ENDEX 
      ISZ IALCC      DONE?
      JMP IAL20      NO, CONTINUE COMPARE 
* 
      LDA IALBP      THE NEXT WORD
      ADA IALI        IN THE DESTINATION
      LDA A,I            LIST SHOULD BE ZERO
      SZA,RSS 
      JMP *+4 
      JSB ERMS,I     INDIRECT ADDRESS LONGER
      DEF MS062        THAN REQUESTED 
      JMP TST02,I 
* 
* 
* 
* 
* 
      ISZ IALCT      DONE?
      JMP IAL00      NO, CONTINUE 
* 
      JMP TST02,I 
* 
* 
* 
IALCT BSS 1 
IALCC BSS 1 
IALI  BSS 1 
IALCK BSS 1 
* 
IALBP DEF IALBF 
IALBF BSS 32       DESTINATION AREA 
* 
IALLS BSS 1 
IALRS BSS 1 
      HED INS, READF, SAVE AND RESTR TESTS
* 
**  INS, READF, SAVE AND RESTR TESTS
* 
* 
* 1. SET STACK POINTER AND CHECK STACK POINTER
* 2. SAVE REGISTERS AND CHECK STACK POINTER 
* 3. SAVE REGISTERS AND CHECK STACK POINTER 
* 4. RESTORE REGISTERS AND CHECK STACK POINTER
* 5. RESTORE REGISTERS AND CHECK STACK POINTER
* 
* 
TST03 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS110 
      LDA INSP
      IFN 
      OTA 5          SET STACK POINTER
      XIF 
      IFZ 
      JSB RANEO      PUT RANDOM 5ALUES INTO E/O 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+INS  INITIALIZE STACK POINTER 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA,RSS        ALL REGISTERS RESTORED 
      JMP *+4        YES
      JSB ERMS,I
      DEF MS115 
      JMP TST03,I 
      XIF 
      CLA 
      ABS 105000B+READF  READ STACK POINTER 
      CPA INSP       SHOULD BE EQUAL
      JMP *+4 
      JSB ERMS,I     INS/READF ERROR
      DEF MS111 
      JMP TST03,I    ABORT TESTS
* 
* SAVE REGISTERS
* 
      CLA            CLEAR
      CLB              ALL
      CLO                REGISTERS
      CLE 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+SAVE  SAVE REGISTERS
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS117 
      JMP TST03,I 
* 
* 
* CHECK STACK POINTER (F) 
* 
      JSB RNDGN      SET (B) TO A RANDOM
      STA B            VALUE
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      CLA 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+READF  READ F 
      STA REDFP      SAVE STACK POINTER 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+7        B, E AND O SHOULD BE UNCHANGED 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS116 
      JMP TST03,I 
      LDA REDFP      RETRIEVE STACK POINTER 
      ADA .-3 
      CPA INSP
      JMP *+4 
      JSB ERMS,I     STACK POINTER BAD
      DEF MS113        AFTER A SAVE 
      JMP TST03,I 
* 
* SAVE REGISTERS
* 
      CLA,INA        SET (A) TO 1 
      CCB            SET (B) TO -1
      STO            SET (O)
      CLE            CLEAR (E)
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+SAVE  SAVE REGISTERS
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS117 
      JMP TST03,I 
* 
* CHECK STACK POINTER (F) 
* 
      CLA 
      ABS 105000B+READF  READ F 
      ADA .-6 
      CPA INSP
      JMP *+4 
      JSB ERMS,I     STACK POINTER BAD
      DEF MS113        AFTER A SAVE 
      JMP TST03,I 
* 
* 
* TEST RESTORE
* 
      CLA 
      CLB 
      CLO 
      CLE 
      ABS 105000B+RESTR  RESTORE REGISTERS
      CPA .+1        (A) SHOULD BE 1
      RSS 
      JMP RES10      SAVE OR RESTORE ERROR
      CPB .-1        (B) SHOULD BE -1 
      RSS 
      JMP RES10      SAVE OR RESTORE ERROR
      SOC            (O) SHOULD BE SET
      SEZ            (E) SHOULD HAVE BEEN CLEARED 
      JMP RES10      SAVE OR RESTORE ERROR
* 
* CHECK STACK POINTER (F) 
* 
      CLA 
      ABS 105000B+READF  READ F 
      ADA .-3 
      CPA INSP
      RSS 
      JMP RES20      STACK POINTER BAD AFTER RESTORE
* 
* RESTORE REGISTERS 
* 
      CCA 
      CLB,INB 
      STO 
      CCE 
      ABS 105000B+RESTR  RESTORE REGISTERS
      SZA            (A) SHOULD BE ZERO 
      JMP RES10      SAVE OR RESTORE ERROR
      SZB            (B) SHOULD BE ZERO 
      JMP RES10      SAVE OR RESTORE ERROR
      SEZ            (E) SHOULD HAVE BEEN CLEARED 
      JMP RES10      SAVE OR RESTORE ERROR
      SOC            (O) SHOULD HAVE BEEN CLEARED 
      JMP RES10      SAVE OR RESTORE ERROR
* 
* CHECK STACK POINTER (F) 
* 
      CLA 
      ABS 105000B+READF  READ F 
      CPA INSP
      RSS 
      JMP RES20      STACK POINTER BAD AFTER RESTORE
* 
      JMP TST03,I 
* 
* 
RES10 JSB ERMS,I     SAVE OR RESTORE
      DEF MS112        ERROR
      JMP TST03,I 
RES20 JSB ERMS,I     STACK POINTER BAD AFTER RESTORE
      DEF MS114 
      JMP TST03,I 
* 
INSP  DEF *+1 
      BSS 10          STACK 
REDFP BSS 1 
* 
      HED LAI AND SAI TESTS 
      ORG 4000B 
* 
* 
** LAI AND SAI TESTS
* 
* 1. CLEAR TWO BUFFERS (ONE FOR PROG AND ONE FOR MICROPROG) 
* 2. GET A NUMBER 
* 3. GET AN INDEX 
* 4. DO SAI WITH PROGRAM AND MICROPROGRAM 
* 5. COMPARE BUFFER AFTER STORES
* 
* 1. GET AN INDEX 
* 2. DO LAI WITH PROGRAM AND MICROPROGRAM 
* 3. COMPARE RESULTS
* 4. COMPARE BUFFERS AS FINAL CHECK 
* 
* 
TST04 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS120 
      LDA LSBF       => TO BUFFERS
      STA LSIP
      LDB N64 
      CLA 
LSIT1 STA LSIP,I     CLEAR THE 32 
      ISZ LSIP         WORD BUFFERS 
      ISZ B 
      JMP LSIT1 
* 
* 
* TEST SAI BY STORING INTO THE BUFFERS RANDOM 
* NUMBERS WITH RANDOM INDICES 
* 
      LDA M500
      STA LSICT 
* 
LSIT5 JSB RNDGN      GET A RANDOM NUMBER
      AND .+37B      CONVERT IT TO
      ADA .-16         AN INDEX 
      STA LAISI      SAVE IT
* 
* CONFIGURE THE MICROINSTRUCTION
* 
      ADA SAIUI      GET THE UNCONFIGURED INSTR 
      STA SAIMI      PUT INTO PROGRAM 
* 
* STORE VIA PROGRAM 
* 
      JSB RNDGN      GET A RANDOM NUM TO STORE
      STA SAICH 
      LDB LSBFP      => TO ITS BUFFER 
      JSB SAIS       STORE
* 
* STORE VIA MICROPROGRAM
* 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      LDA SAICH 
      LDB LSBFM      => TO ITS BUFFER 
      JSB SAVRG      RECORD REGISTER VALUES 
SAIMI ABS 101000B+SAI  THIS INSTR CONFIGD ABOVE 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS125 
      JMP TST04,I 
* 
* 
      ISZ LSICT      DONE?
      JMP LSIT5      NO, DO MORE STORES 
* 
* 
* COMPARE BUFFERS AFTER STORES
* 
      LDA .-32       32 WORDS 
      STA LSICT        PER BUFFER 
      CLA 
      STA LSIP       INDEX
LST10 LDA LSBF       => TO PROGRAM BUFFER 
      ADA LSIP       INDEX INTO IT
      LDA A,I        GET AN ELEMENT 
      LDB LSBB       => TO MICROPROG BUFFER 
      ADB LSIP       INDEX
      CPA B,I        SHOULD BE EQUAL
      JMP *+4        OK 
      JSB ERMS,I     SAI ERROR
      DEF MS121 
      JMP TST04,I 
      ISZ LSIP       BUMP INDEX 
      ISZ LSICT      DONE WITH COMPARE? 
      JMP LST10      NO 
* 
* SAI TESTING NOW COMPLETE
* 
* 
* 
* START LAI TESTS 
* 
      LDA M500
      STA LSICT 
* 
LST20 JSB RNDGN      GET A RANDOM NUMBETR 
      AND .+37B      CONVERT IT TO
      ADA .-16         AN INDEX 
      STA LAISI      SAVE IT
* 
* CONFIGURE THE LAI MICROPROGRAM INSTRUCTION
* 
      ADA LAIUI      GET THE UNCONFIGD LAI INSTR
      STA LAIMI      PUT INTO PROGRAM 
* 
* 
* LOAD VIA PROGRAM
* 
      LDB LSBFP 
      JSB LAIS
      STA LSAIR      SAVE WORD RETRIEVED
* 
* LOAD VIA MICROPROGRAM 
* 
      CLA 
      LDB LSBFM      => TO BUFFER 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      JSB SAVRG      RECORD REGISTER VALUES 
LAIMI ABS 105000B+LAI  THIS INSTR CONFIGD ABOVE 
* 
* COMPARE RESULTS OF LOADS
* 
      CPA LSAIR      COMPARE
      JMP *+4        OK 
      JSB ERMS,I     LAI ERROR
      DEF MS122 
      JMP TST04,I 
* 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+7        B, E AND O SHOULD BE UNCHANGED 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS124 
      JMP TST04,I 
      ISZ LSICT      DONE WITH LOADS? 
      JMP LST20      NO 
* 
* 
* COMPARE BUFFERS AS FINAL CHECK
* 
      LDA .-32       32 WORDS 
      STA LSICT        PER BUFFER 
      CLA 
      STA LSIP
LST30 LDA LSBF       PROGRAM BUFFER 
      ADA LSIP       INDEX
      LDA A,I        GET AN ELEMENT 
      LDB LSBB       MICROPROG BUF
      ADB LSIP       INDEX
      CPA B,I        SHOULD BE THE SAME 
      JMP *+4        OK 
      JSB ERMS,I     LAI ALTERS DATA
      DEF MS123        READ 
      JMP TST04,I 
      ISZ LSIP       BUMP INDEX 
      ISZ LSICT      DONE?
      JMP LST30      NO 
* 
      JMP TST04,I 
* 
* 
* 
LSICT BSS 1 
LSIP  BSS 1 
LSAIR BSS 1 
SAICH BSS 1 
LAIUI ABS 105000B+LAI  =RAM LAI 
      IFZ 
SAIUI ABS 101000B+SAI 
      XIF 
      IFN 
SAIUI ABS 105000B+100B
      XIF 
N64   DEC -64 
* 
LSBFP DEF LSBFA+16
LSBFM DEF LSBFB+16
LSBF  DEF LSBFA 
LSBB  DEF LSBFB 
LSBFA BSS 32         BUFFER USED BY PROGRAM FOR TESTS 
LSBFB BSS 32         BUFFER USED BY MICROPROG FOR TEST
      HED LOAD AND STORE (A) INDEXED
* 
* 
**  LOAD (A) INDEXED
* 
* CALLING SEQUENCE
* 
*         LAISI = N THE INDEX 
*         LDB BASAD      BASE ADDRESS OF 16 WORD AREA 
*         JSB LAIS       (A) IS LOADED WITH THE BASAD+N WORD
*         <RETURN>
* 
* (B) IS UNCHANGED
* 
* 
LAIS  NOP 
      STB A 
      ADA LAISI      => TO BASE ADDR + N
      LDA A,I         LOAD (A) WITH CONTENTS
      JMP LAIS,I      RETURN
* 
* 
LAISI BSS 1 
* 
* 
* 
* 
**  STORE (A) INDEXED 
* 
* CALLING SEQUENCE
* 
*         LAISI = N THE INDEX 
*         LDA VALUE     VALUE TO BE STORED
*         LDB BASAD     BASE ADDRESS OF 16 WORD AREA
*         JSB SAIS
*         <RETURN>
* 
* (B) IS UNCHANGED
* 
* 
SAIS  NOP 
      STB SAISB      SAVE B 
      ADB LAISI      ADD INDEX
      STA B,I 
      LDB SAISB      RESTORE B
      JMP SAIS,I     RETURN 
* 
* 
* 
SAISB BSS 1 
* 
      HED PFREX TEST
* 
**  PFREX TEST
* 
* 
* 
* 
TST05 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS130 
      LDA PFXEE      SET RETURN ADDRESS IN
      STA PFXEP        SIMULATED ENTRY POINT
      JSB RNDGN      SET (A) AND (B)
      STA B            WITH RANDOM
      JSB RNDGN          VALUES 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+PFREX  SHOULD RESULT IN A JMP 
      DEF PFXEP        TO PFX10 
      JSB ERMS,I     SHOULD NEVER COME
      DEF MS131        HERE 
      JMP TST05,I 
* 
PFX10 JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+16B      A, B AND E SHOULD BE UNCHANGED 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS133 
      JMP TST05,I 
      LDA PFXEP      GET RETURN ADDR
      SZA,RSS        SHOULD BE ZERO 
      JMP *+3 
      JSB ERMS,I
      DEF MS132 
      JMP TST05,I 
* 
* 
PFXEP NOP            SIMULATED ENTRY POINT
PFXEE DEF PFX10 
      HED PFREI TEST
* 
**  PFREI TEST
* 
* 
* 
TST06 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS140 
      LDA PFIEE      SET RETURN ADDRESS IN
      STA PFIEP        SIMULATED ENTRY POINT
      CLA            CLEAR
      STA PFIFL        FLAG 
      STO 
      JSB RNDGN      SET (A) AND (B)
      STA B            WITH RANDOM
      JSB RNDGN          VALUES 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+PFREI  SHOULD RESULT IN A "CLO" 
      CLO              SETTING OF PFIFL, CLEARING 
PFIFL BSS 1              OF RETURN ADDR AND XFER TO PFI10 
      DEF PFIEP            PFI10
      JSB ERMS,I     TRANSFER 
      DEF MS141        ERROR
PFI10 JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+16B      A, B AND E SHOULD BE UNCHANGED 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4 
      JSB ERMS,I
      DEF MS145 
      JMP TST06,I 
      LDA PFIFL 
      CPA .+1        FLAG SHOULD BE SET 
      JMP *+3 
      JSB ERMS,I     SOFTWARE FLAG
      DEF MS143        NOT SET
      SOS 
      JMP *+3 
      JSB ERMS,I     I/O NOT PERFORMED
      DEF MS142 
      LDA PFIEP      GET RETURN ADDRESS CELL
      SZA,RSS 
      JMP *+3 
      JSB ERMS,I     ENTRY POINT
      DEF MS144        NOT CLEARED
      JMP TST06,I 
* 
* 
* 
PFIEP NOP 
PFIEE DEF PFI10 
      HED PFRIO TEST
* 
**  PFRIO TEST
* 
* 
* 
* 
TST07 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS150 
      CLA 
      STA PFOFL      ZERO FLAG
      STO            SET (O)
      JSB RNDGN      SET (A) AND (B)
      STA B            WITH RANDOM
      JSB RNDGN          VALUES 
      JSB SAVRG      RECORD REGISTER VALUES 
      ABS 105000B+PFRIO  =RAM PFRIO 
      CLO 
PFOFL BSS 1 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+16B      A, B AND E SHOULD BE UNCHANGED 
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4        YES
      JSB ERMS,I
      DEF MS153 
      JMP TST07,I 
      CLA 
      LDA PFOFL 
      CPA .+1        SHOULD BE 1
      JMP *+3 
      JSB ERMS,I     SOFTWARE FLAG
      DEF MS151        NOT SET
      SOS            (O) SHOULD BE CLEARED
      JMP *+3 
      JSB ERMS,I     I/O NOT
      DEF MS152       PERFORMED 
      JMP TST07,I 
      HED BYTE READ/STORE TESTS 
      IFN 
* 
* 1. CLEAR TWO BUFFERS
* 2. GET A BYTE 
* 3. GET A BYTE ADDRESS 
* 4. STORE BYTE VIA PROGRAM 
* 5. STORE BYTE VIA MICROPROGRAM
* 6. COMPARE RESULTS
* 
* 1. FILL TWO BUFFER
* 2. GET A BYTE ADDRESS 
* 3. LOAD BYTE VIA PROGRAM
* 4. COMPARE RESULTS
* 5. COMPARE BUFFER AS FINAL TEST 
* 
* 
* 
      ORG 6000B 
TST08 NOP 
      JSB MSGC,I    ANNOUNCE TEST 
      DEF MS160 
* 
      LDA .-32      32 WORD BUFFERS 
      STA SBYCT 
      CLA           ZERO
      STA SBYI        INDEX 
SBY10 LDB SBYBP     CLEAR 
      ADB SBYI        FIRST 
      STA B,I           BUFFER
      LDB SBYBM     CLEAR 
      ADB SBYI        SECOND
      STA B,I 
      ISZ SBYI
      ISZ SBYCT 
      JMP SBY10 
* 
* 
* 
      LDA M500
      STA SBYCT 
SBY20 JSB RNDGN 
      AND .+37B 
      STA SBYI
* 
* STORE VIA PROGRAM 
* 
      LDB SBYBP     GET BYTE ADDRESS
      CLE,ELB         OF THE BUFFER 
      ADB A         INDEX 
      JSB RNDGN 
      JSB SBYTE 
* 
* 
* STORE VIA MICROPROGRAM
* 
      LDB SBYBM     GET BYTE ADDRESS
      CLE,ELB         OF THE BUFFER 
      ADB SBYI      INDEX 
      STB SBYAM     SAVE BYTE ADDRESS 
      JSB RANEO     PUT RANDOM VALUES INTO E/O
      JSB SAVRG     RECORD REGISTER VALUES
      ABS 105000B+STBYT 
* 
      JSB REGCK     CHECK IF REGS HAVE CHANGED
      LDA REGST 
      AND .+13B     A,E AND O SHOULD BE UNCHANGED 
      SZA,RSS       ALL REGISTERS RESTORED? 
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS212 
      JMP TST08,I 
      CMB,INB       HAS BYTE
      INB 
      ADB SBYAM       ADDRESS BEEN
      SZB,RSS           BUMPED? 
      JMP *+4 
      JSB ERMS,I
      DEF MS211 
      JMP TST08,I 
* 
* COMPARE THE RESULT OF THE TWO STORES
* 
      LDA .-32
      STA SBYC1 
      CLA 
      STA SBYI
SBY30 LDA SBYBP     => BUFFER USED BY PROGRAM 
      ADA SBYI      INDEX 
      LDA A,I 
      LDB SBYBM     => BUFFER USED BY MICROPROGRAM
      ADB SBYI      INDEX 
      CPA B,I 
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS213 
      JMP TST08,I 
      ISZ SBYI      BUMP INDEX
      ISZ SBYC1     DONE? 
      JMP SBY30     NO
* 
      ISZ SBYCT     DONE WITH SAVE BYTE TEST? 
      JMP SBY20     NO
* 
* 
* 
* START LOAD BYTE TEST
* 
      LDA M500
      STA SBYCT 
* 
SBY40 JSB RNDGN 
      AND .+37B 
      STA SBYI
* 
* LOAD VIA PROGRAM
* 
      CLA 
      LDB SBYBP     GET BYTE ADDRESS
      CLE,ELB         OF THE BUFFER 
      ADB SBYI      INDEX 
      JSB GBYTE 
      STA GBYRT 
* 
* LOAD VIA MICROPROGRAM 
* 
      CLA 
      LDB SBYBM     GET BYTE ADDRESS
      CLE,ELB         OF THE BUFFER 
      ADB SBYI      INDEX 
      STB SBYAM     SAVE B
      JSB RANEO     PUT RANDOM VALUES INTO E/O
      JSB SAVRG     RECORD REGISTER VALUES
      ABS 105000B+LBYTE 
      CPA GBYRT     SAME AS ABOVE?
      JMP *+4       NO, ERROR 
      JSB ERMS,I
      DEF MS223 
      JMP TST08,I 
      JSB REGCK     CHECK IF REGS HAVE CHANGED
      LDA REGST 
      AND .+3       E AND O SHOULD BE UNCHANGED 
      SZA,RSS       ALL REGS RESTORED?
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS222 
      JMP TST08,I 
      CMB,INB 
      INB 
      ADB SBYAM 
      SZB,RSS       HAS B BEEN BUMPED?
      JMP *+4       YES 
      JSB ERMS,I    NO,ERROR
      DEF MS221 
      JMP TST08,I 
* 
      ISZ SBYCT 
      JMP SBY40 
* 
* COMPARE BUFFERS AS A FINAL CHECK
* 
      LDA .-32
      STA SBYCT 
      CLA 
      STA SBYI
SBY50 LDA SBYBP     => BUFFER USED BY PROGRAM 
      ADA SBYI      INDEX 
      LDA A,I 
      LDB SBYBM     => BUFFER USED BY MICROPROG 
      ADB SBYI      INDEX 
      CPA B,I       SAME? 
      JMP *+4       YES 
      JSB ERMS,I    NO, ERROR 
      DEF MS224 
      JMP TST08,I 
      ISZ SBYI      BUMP INDEX
      ISZ SBYCT     DONE
      JMP SBY50     NO
* 
      JMP TRS00     RUN TRSLT TEST
* 
SBYCT BSS 1 
SBYC1 BSS 1 
SBYI  BSS 1 
SBYAM BSS 1 
GBYRT BSS 1 
* 
SBYBP DEF *+1 
      BSS 32
SBYBM DEF *+1 
      BSS 32
      XIF 
      HED TRSLT TEST
* 
** TRSLT TEST 
* 
* 
* 1. BUILD TRANSLATION TABLES (TWO COPIES)
* 2. BUILD TWO STRINGS (TWO COPIES) 
* 3. TRANSLATE WITH PROGRAM AND MICROPROGRAM
* 4. COMPARE RESULTS
* 5. COMPARE TABLES AS A FINAL CHECK
* 
* 
* 
      IFZ 
      ORG 6000B 
TST08 NOP 
      JSB MSGC,I     ANNOUNCE TEST
      DEF MS160 
      XIF 
* 
* 
TRS00 LDA M128
      STA TRSCT 
      CLA 
      STA TRSI
TRS10 JSB RNDGN 
      LDB TRSTP      => PROGRAM TRANSLATION TABLE 
      ADB TRSI       INDEX
      STA B,I        STORE
      LDB TRSTM      => MICROPROGRAM TRANSLATION TABLE
      ADB TRSI       INDEX
      STA B,I        STORE
* 
      ISZ TRSI       BUMP INDEX 
      ISZ TRSCT      DONE?
      JMP TRS10      CONTINUE BUILDING TABLES 
* 
      LDA .-32      CLEAR 
      STA TRSCT       BUFFERS 
      CLA               FOR STRINGS 
      STA TRSI            TO BE 
TRS15 LDB TRSSP             TRANSLATED
      ADB TRSI
      STA B,I 
      LDB TRSSM 
      ADB TRSI
      STA B,I 
      ISZ TRSI
      ISZ TRSCT 
      JMP TRS15 
* 
* 
* 
      LDA M500
      STA TRSCT 
* 
* 
* GET LENGTH
* 
TRS20 JSB RNDGN     GET RANDOM NUMBER 
      AND .+37B     GET LENGTH FROM IT
      SZA,RSS       ZERO? 
      JMP *-3       YES, GET ANOTHER
      STA TRSPN     PUT LENGTH INTO PROGRAM 
      STA TRSMN       AND MICRO CALL
* 
* BUILD STRING
* 
      ARS           CONVERT 
      INA             LENGTH
      CMA,INA           INTO -WORDS 
      STA TRSC1 
      CLA           ZERO
      STA TRSI        INDEX 
TRS30 JSB RNDGN     GET A RANDOM NUMBER 
      LDB TRSSP     => PROG STRING
      ADB TRSI      INDEX 
      STA B,I       STORE 
      LDB TRSSM     => TO MICRO PROG STRING 
      ADB TRSI      INDEX 
      STA B,I       STORE 
      ISZ TRSI
      ISZ TRSC1     DONE? 
      JMP TRS30     NO, CONTINUE BUILDING STRINGS 
* 
* 
* TRANSLATE VIA PROGRAM 
* 
      LDB TRSSP      => TO STRING TO TRANSLATE
      CLE,ELB        CONVERT TO BYTE POINTER
      LDA TRSCT 
      SZA 
      INB           BUMP BYTE ADDR
      LDA TRSTP     => TRANSLATION TABLE
      JSB TRSLS     DO IT 
TRSPN DEC 0         LENGTH (SET ABOVE)
* 
* 
* TRANSLATE VIA MICROPROGRAM
* 
      CLA            INITIALIZE INTERRUPT 
      STA INTFG        FLAG 
      LDA TBGSC 
      SZA,RSS       TBG?
      JMP TRSNI     NONE
      LDA TRSMN      INTERRUPT ONLY 
      ADA .-8         IF BUF LENGTH 
      SSA               IS GREATER THAN 8 
      JMP TRSNI 
      LDA TRSII     GET JSB TO TBGIC
      STA TRSIN     STORE IN PROGRAM
      JMP *+3 
TRSNI CLA           DON'T INTERRUPT THIS TIME 
      STA TRSIN 
* 
      LDB TRSSM     => TO STRING TO TRANSLATE 
      CLE,ELB        CONVERT TO BYTE POINTER
      LDA TRSCT 
      SZA 
      INB           BUMP BYTE ADDR
      LDA TRSTM      => TRANSLATION TABLE 
      JSB RANEO      PUT RANDOM VALUES INTO E/O 
      JSB SAVRG      RECORD REGISTER VALUES 
TRSIN NOP            MAY CONTAIN  JSB TBGIC 
TRSAD ABS 105000B+TRSLT  =RAM TRSLT 
TRSMN DEC 0          LENGTH (SET ABOVE) 
* 
* 
* COMPARE RESULTS 
* 
      CLF 0          DISABLE INTERRUPT SYSTEM 
      JSB REGCK      CHECK IF REGS HAVE CHANGED 
      LDA REGST 
      AND .+3        E AND O SHOULD BE UNCHANGED
      SZA,RSS        ALL REGISTERS RESTORED?
      JMP *+4 
      JSB ERMS,I
      DEF MS163 
      JMP TST08,I 
* 
* CHECK IF MICROPROGRAM WAS INTERRUPTED 
* 
      LDA TRSIN      WERE WE TESTING
      SZA,RSS          INTERRUPTIBILITY?
      JMP TRS33      NO 
      LDA INTFG 
      CPA .+1        INTERRUPTED? 
      JMP *+4        YES
      JSB ERMS,I     NO, ERROR
      DEF MS165 
      JMP TST08,I 
* 
TRS33 LDA .-32
      STA TRSC1 
      CLA 
      STA TRSI
TRS35 LDA TRSSP      GET A WORD FROM
      ADA TRSI        STRING TRANSLATED 
      LDA A,I           BY PROGRAM
      LDB TRSSM     COMPARE WITH ONE
      ADB TRSI        TRANSLATED BY MICRO PROG
      CPA B,I       SHOULD BE EQUAL 
      JMP *+4 
      JSB ERMS,I     TRANSLATION
      DEF MS161        ERROR
      JMP TST08,I 
* 
      ISZ TRSI
      ISZ TRSC1      DONE?
      JMP TRS35      NO 
* 
      ISZ TRSCT      DONE WITH TESTS? 
      JMP TRS20      NO 
* 
* 
* CHECK IF THE TRANSLATION TABLES HAVE BEEN ALTERED 
* 
      LDA M128
      STA TRSC1 
      CLA 
      STA TRSI
TRS40 LDA TRSTP     GET A WORD FROM THE TRANSLATION 
      ADA TRSI        TABLE USED BY THE 
      LDA A,I           PROGRAM 
      LDB TRSTM     COMPARE IT WITH ONE 
      ADB TRSI        IN TRANSLATION TABLE USED 
      CPA B,I           BY MICROPROGRAM 
      JMP *+4 
      JSB ERMS,I     TRANSLATION TABLE
      DEF MS162        ALTERED
      JMP TST08,I 
      ISZ TRSI       BUMP INDEX 
      ISZ TRSC1      DONE?
      JMP TRS40      NO 
* 
      IFZ 
      JMP TST08,I 
      XIF 
      IFN 
      JMP BMV00      RUN BYTE MOVE TEST 
      XIF 
* 
* 
* 
* 
* 
TRSCT BSS 1 
TRSC1 BSS 1 
TRSI  BSS 1 
TRSII JSB TBGIC 
* 
* 
TRSTP DEF *+1       TRANSLATION TABLE TO BE USED BY PROGRAM 
      BSS 128 
TRSSP DEF *+1       STRING TO BE TRANSLATED BY PROGRAM
      BSS 32
* 
TRSTM DEF *+1       TRANSLATION TABLE FOR MICROPROGRAM
      BSS 128 
TRSSM DEF *+1       STRING TO TRANSLATE BY MICROPROGRAM 
      BSS 32
* 
M128  DEC -128
      HED TRANSLATE 
* 
* 
* 
* 
**  TRANSLATE 
* 
* 
* CALLING SEQUENCE
* 
*         LDA TABLP     ADDRESS OF TABLE
*         LDB BYADR     BYTE ADDRESS OF STRING
* 
*         JSB TRSLS 
*         DEC N         # OF BYTES TO TRANSLATE 
*         <RETURN>
**
* 
* 
* 
TRSLS NOP 
      STA TABAD     SAVE TABLE ADDR 
      LDA TRSLS,I   GET # OF BYTES TO PORCESS 
      SZA,RSS       ANY?
* 
      JMP TEXIT 
      CMA,INA 
      STA TRNOB     -# OF BYTES TO PROCESS
      STB TBYAD     SAVE BYTE ADDR OF STRING
* 
TRSL1 JSB GBYTE      GET A BYTE FROM THE STRING 
      ADA TABAD     CALCULATE THE BYTE ADDR IN
      ADA TABAD       THE TABLE OF THE CHAR TO SWAP 
      STA B 
      JSB GBYTE     GET BYTE FROM TABLE 
      LDB TBYAD 
      JSB SBYTE     STORE BYTE IN STRING
* 
      INB 
      STB TBYAD 
      ISZ TRNOB     DONE? 
      JMP TRSL1     NO
* 
TEXIT ISZ TRSLS 
      JMP TRSLS,I    RETURN 
* 
* 
TABAD BSS 1 
TRNOB BSS 1 
TBYAD BSS 1 
      HED BYTE MOVE TEST
      IFN 
** BYTE MOVE TEST 
* 
* 
* 1. BUILD SOURCE BUFFER (2 COPIES) 
* 2. GET A RANDOM LENGTH
* 3. MOVE VIA MICROPROGRAM
* 4. CHECK RESULTS
* 5. CHECK IF SOURCE BUFFER HAS BEEN ALTERED
* 
* 
* 
BMV00 LDA .-16
      STA BMVCT       STRING
      CLA           ZERO
      STA BMVI        INDEX 
BMV10 JSB RNDGN     GET A RANDOM NUMBER 
      LDB BMVBS     => SOURCE BUFFER
      ADB BMVI      INDEX 
      STA B,I 
      LDB BMVBR     => REFERENCE STRING 
      ADB BMVI      INDEX 
      STA B,I 
      ISZ BMVI      BUMP INDEX
      ISZ BMVCT     DONE? 
      JMP BMV10     NO
* 
      LDA M500
      STA BMVCT 
* 
BMV15 LDA .-16      CLEAR 
      STA BMVC1       DESTINATION 
      CLA               AREA
      STA BMVI
BMV20 LDB BMVBD 
      ADB BMVI
      STA B,I 
      ISZ BMVI      BUMP INDEX
      ISZ BMVC1     DONE? 
      JMP BMV20     NO
* 
      JSB RNDGN 
      AND .+37B 
      ADA .-1 
      STA BMVSL 
      STA BMVSR 
* 
      CLA           INITIALIZE INTERRUPT
      STA INTFG       FLAG
      LDA TBGSC 
      SZA,RSS       TBG?
      JMP BMVNI     NONE
      LDA BMVSR     INTERRUPT ONLY
      ADA .-10        IF BUF LENGTH IS
      SSA               GREATER THAN 9
      JMP BMVNI 
      LDA BMVII     GET JSB TO TBGIC
      STA BMVIN     PUT INTO PROGRAM
      JMP *+3 
BMVNI CLA           DONT INTERRUPT
      STA BMVIN       THIS TIME 
* 
      LDA BMVBS 
      CLE,ELA 
      LDB BMVCT 
      SLB 
      INA 
      STA BMVSA     SAVE SOURCE ADDR
      LDB BMVBD     => TO DESTINATION ADDR
      CLE,ELB       CONVERT TO BYTE ADDR
      JSB RANEO     PUT RANDOM VALUES INTO E/O
      SEZ 
      INB 
      STB BMVDA     SAVE DESTINATION ADDR 
      LDA BMVSA 
      JSB SAVRG     RECORD REGISTER CONTENTS
* 
* MOVE BYTES VIA MICROPROGRAM 
* 
BMVIN NOP           MAY CONTAIN  JSB TBGIC
BMVAD ABS 105000B+BMVE
      DEF BMVSL     => TO COUNT 
      OCT 0 
* 
* CHECK RESULTS 
* 
      CLF 0 
      JSB REGCK     CHECK IF REGS HAVE CHANGED
      LDA REGST 
      AND .+3       E AND O SHOULD BE UNCHANGED 
      SZA,RSS       ALL REGISTERS RESTORED? 
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS243 
      JMP TST08,I 
* 
      LDA BMVIN     TESTING 
      SZA,RSS         INTERRUPTIBILITY? 
      JMP BMV33     NO
      LDA INTFG 
      CPA .+1       INTERRUPTED?
      JMP *+4       YES 
      JSB ERMS,I    NO, ERROR 
      DEF MS245 
      JMP TST08,I 
* 
BMV33 LDB BMVSR     GET # OF BYTES MOVED
      SSB           NEGATIVE? 
      JMP *+3       YES 
      SZB           ZERO? 
      JMP BMV35     NO
      LDA BMVBD,I   GET 1ST WORD OF DESTINATION BUF 
      SZA,RSS       ZERO? 
      JMP *+4       YES 
      JSB ERMS,I    NO, ERROR 
      DEF MS242 
      JMP TST08,I 
      JMP BMV50 
* 
BMV35 CMB,INB       NEGATE #OF BYTES MOVED
      STB BMVC1 
      CLA 
      STA BMVI
BMV40 LDB BMVSA     => SOURCE ADDR USED IN MOVE 
      ADB BMVI      INDEX 
      JSB GBYTE     GET BYTE IN (A) 
      STA BMVRT     SAVE IT 
      LDB BMVDA 
      ADB BMVI
      JSB GBYTE 
      CPA BMVRT 
      JMP *+4 
      JSB ERMS,I
      DEF MS241 
      JMP TST08,I 
      ISZ BMVI      BUMP INDEX
      ISZ BMVC1     DONE? 
      JMP BMV40     NO
* 
      LDB BMVDA 
      ADB BMVI
      JSB GBYTE 
      SZA,RSS       BETTER BE ZERO
      JMP *+4       OK
      JSB ERMS,I    MORE BYTES MOVED THAN REQUESTED 
      DEF MS242 
      JMP TST08,I 
* 
BMV50 ISZ BMVCT     DONE WITH MOVES?
      JMP BMV15     NO
* 
* CHECK IF THE SOURCE BUFFER HAS BEEN ALTERED 
* 
      LDA .-32
      STA BMVCT 
      CLA 
      STA BMVI
BMV60 LDA BMVBS     => SOURCE BUFFER
      ADA BMVI      INDEX 
      LDA A,I 
      LDB BMVBR     => REFERENCE BUFFER 
      ADB BMVI      INDEX 
      CPA B,I       SAME? 
      JMP *+4       YES 
      JSB ERMS,I    NO, ERROR 
      DEF MS244 
      JMP TST08,I 
      ISZ BMVC1     BUMP INDEX
      ISZ BMVCT     DONE? 
      JMP BMV60     NO
* 
      JMP TST08,I   DONE, EXIT
* 
* 
* 
BMVII JSB TBGIC 
BMVCT BSS 1 
BMVC1 BSS 1 
BMVI  BSS 1 
BMVSA BSS 1 
BMVDA BSS 1 
BMVSR BSS 1 
BMVRT BSS 1 
BMVSL BSS 1 
BMVBR DEF *+1       REFERENCE BUFFER
      BSS 16
BMVBS DEF *+1       SOURCE BUFFER 
      BSS 16
BMVBD DEF *+1       DESTINATION BUFFER
      BSS 16
* 
* 
* 
      XIF 
      HED WORD MOVE TEST
      IFN 
      ORG 10000B
** WORD MOVE TEST 
* 
* 
* 1. BUILD A SOURCE LIST
* 2. CLEAR DESTINATION AREA 
* 3. MOVE 
* 4. CHECK RESULTS
* 5. CHECK IF LIST HAS BEEN ALTERED 
* 
* 
TST09 NOP 
      JSB MSGC,I    ANNOUNCE TEST 
      DEF MS230 
* 
      LDA .-32
      STA WMVCT 
      CLA           CLEAR 
      STA WMVI        INDEX 
WMV00 JSB RNDGN     GET A RANDOM NUMBER 
      LDB WMBFS     => SOURCE BUFFER
      ADB WMVI      INDEX 
      STA B,I       SAVE
      LDB WMBFR     ANOTHER 
      ADB WMVI        COPY
      STA B,I 
      ISZ WMVI      BUMP INDEX
      ISZ WMVCT     DONE? 
      JMP WMV00     NO
* 
      LDA M500
      STA WMVCT 
WMV05 LDA .-32
      STA WMVC1 
      CLA 
      STA WMVI
WMV10 LDB WMBFD     DESTINATION ADDRESS 
      ADB WMVI      INDEX 
      STA B,I       CLEAR 
      ISZ WMVI      BUMP INDEX
      ISZ WMVC1     DONE? 
      JMP WMV10     NO
* 
      JSB RNDGN     GET # OF WORDS
      AND .+37B       TO MOVE 
      STA WMVNM 
      STA WMVCK 
* 
      CLA           INITIALIZE INTERRUPT
      STA INTFG       FLAG
      LDA TBGSC 
      SZA,RSS       TBG?
      JMP WMVNI     NONE
      LDA WMVCK     INTERRUPT ONLY IF 
      ADA .-16        BUF LENGTH IS 
      SSA               GREATER THAN 15 
      JMP WMVNI 
      LDA WMVII     GET JSB TO TBGIC
      STA WMVIN     STORE IN PROGRAM
      JMP *+3 
WMVNI CLA           DON'T INTERRUPT 
      STA WMVIN       THIS TIME 
* 
* MOVE WORD VIA MICRO PROGRAM 
* 
      LDA WMBFS     SOURCE ADDRESS
      LDB WMBFD     DESTINATION ADDRESS 
      JSB RANEO     PUT RANDOM VALUES INTO E/O
      JSB SAVRG     RECORD REGISTER VALUES
WMVIN NOP           MAY CONTAIN  JSB TBGIN
MVEAD ABS 105000B+MOVE
      DEF WMVNM     => TO COUNT 
      OCT 0 
* 
* CHECK RESULTS 
* 
      CLF 0 
      JSB REGCK     CHECK IF REGS HAVE CHANGED
      LDA REGST 
      AND .+3       E OR O SHOULD BE UNCHANGED
      SZA,RSS       ALL REGISTERS RESTORED? 
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS233 
      JMP TST09,I 
* 
      LDA WMVIN     TESTING 
      SZA,RSS         INTERRUPTIBILITY? 
      JMP WMV15     NO
      LDA INTFG     YES 
      CPA .+1      INTERRUPTED? 
      JMP *+4       YES 
      JSB ERMS,I    NO, ERROR 
      DEF MS234 
      JMP TST09,I 
* 
WMV15 LDA WMVCK 
      CMA,INA       NEGATE # OF WORDS 
      STA WMVC1       MOVED 
      SZA           ZERO? 
      JMP WMV20     NO
      LDA WMBFD,I   YES 
      SZA,RSS       BETTER BE ZERO
      JMP *+4 
      JSB ERMS,I
      DEF MS231 
      JMP TST09,I 
      JMP WVM40 
* 
WMV20 CLA 
      STA WMVI
WMV30 LDA WMBFD     DESTINATION ADDRESS 
      ADA WMVI      INDEX 
      LDA A,I 
      LDB WMBFR 
      ADB WMVI
      CPA B,I       SHOULD BE EQUAL 
      JMP *+4 
      JSB ERMS,I
      DEF MS232 
      JMP TST09,I 
      ISZ WMVI      BUMP INDEX
      ISZ WMVC1     DONE? 
      JMP WMV30     NO
* 
      LDA WMBFD     THE NEXT
      ADA WMVI        WORD SHOULD 
      LDA A,I           BE ZERO 
      SZA,RSS       IS IT?
      JMP *+4       YES 
      JSB ERMS,I
      DEF MS231 
      JMP TST09,I 
* 
WVM40 ISZ WMVCT     DONE? 
      JMP WMV05     NO
* 
* 
* AS A FINAL TEST CHECK IF SOURCE STRING
* HAVE BEEN ALTERED 
* 
      LDA .-32
      STA WMVCT 
      CLA 
      STA WMVI
WMV50 LDA WMBFR     REFERENCE STRING
      ADA WMVI      INDEX 
      LDA A,I 
      LDB WMBFS     SOURCE STRING 
      ADB WMVI      INDEX 
      CPA B,I       COMPARE 
      JMP *+4 
      JSB ERMS,I
      DEF MS236 
      JMP TST09,I 
      ISZ WMVI
      ISZ WMVCT 
      JMP WMV50 
* 
      JMP TST09,I 
* 
* 
WMVII JSB TBGIC 
WMVNM BSS 1 
WMBFD DEF *+1 
      BSS 32
WMBFS DEF *+1 
      BSS 32
WMBFR DEF *+1 
      BSS 32
* 
WMVCT BSS 1 
WMVC1 BSS 1 
WMVI  BSS 1 
WMVCK BSS 1 
      XIF 
      HED MESSAGES
      SUP 
MS030 ASC 7,H030 CRC TEST/
MS031 ASC  8,E031 CRC ERROR/
MS032 ASC 19,E032 REGISTER(S) NOT RESTORED IN CRC/
MS040 ASC 15,H040 ENQ, DEQ AND PENQ TESTS/
MS041 ASC 18,E041 EMPTY QUEUE RETURN TAKEN ON AN
      OCT 6412
      ASC 8,NON-EMPTY QUEUE/
MS042 ASC 18,E042 EMPTY QUEUE RETURN NOT TAKEN ON 
      OCT 6412
      ASC 8,AN EMPTY QUEUE/ 
MS043 ASC 19,E043 QHEAD NOT ZERO IN AN EMPTY QUEUE/ 
MS044 ASC 19,E044 QTAIL DOES NOT POINT TO ITSELF IN 
      OCT 6412
      ASC 8,AN EMPTY QUEUE/ 
MS045 ASC 10,E045 ENQ-PENQ ERROR/ 
MS046 ASC 9,E046 DEQUE ERROR/ 
MS047 ASC 19,E047 REGISTER(S) NOT RESTORED IN ENQ/
MS051 ASC 17,E051 A,E OR O NOT RESTORED IN DEQ/ 
MS060 ASC 7,H060 IAL TEST/
MS061 ASC 19,E061 BAD INDIRECT ADDRESS LIST GENERAT 
      ASC 2,ED/ 
MS062 ASC 19,E062 INDIRECT ADDRESS LIST LONGER THAN 
      OCT 6412
      ASC 5,REQUESTED/
MS063 ASC 18,E063 B, E OR O NOT RESTORED IN IAL/
      IFN 
MS110 ASC 17,H110 READF, SAVE AND RESTR TESTS/
      XIF 
      IFZ 
MS110 ASC 19,H110 INS,READF, SAVE AND RESTR TESTS/
      XIF 
MS111 ASC 11,E111 INS-READF ERROR/
MS112 ASC 11,E112 SAVE-RESTR ERROR/ 
MS113 ASC 17,E113 STACK POINTER BAD AFTER SAVE/ 
MS114 ASC 19,E114 STACK POINTER BAD AFTER RESTORE/
MS115 ASC 19,E115 REGISTER(S) NOT RESTORED IN INS/
MS116 ASC 19,E116 B, E OR O NOT RESTORED IN READF/
MS117 ASC 19,E117 REGISTER(S) NOT RESTORED IN SAVE/ 
MS120 ASC 12,H120 LAI AND SAI TESTS/
MS121 ASC 8,E121 SAI ERROR/ 
MS122 ASC 8,E122 LAI ERROR/ 
MS123 ASC 13,E123 LAI ALTERS DATA READ/ 
MS124 ASC 18,E124 B, E OR O NOT RESTORED IN LAI/
MS125 ASC 19,E125 REGISTER(S) NOT RESTORED IN SAI/
MS130 ASC 8,H130 PFREX TEST/
MS131 ASC 13,E131 PFREX TRANSFER ERROR/ 
MS132 ASC 15,E132 ENTRY POINT NOT CLEARED/
MS133 ASC 19,E133 A, B OR E NOT RESTORED IN PFREX/
MS140 ASC 8,H140 PFREI TEST/
MS141 ASC 13,E141 PFREI TRANSFER ERROR/ 
MS142 ASC 12,E142 I-O NOT PERFORMED/
MS143 ASC 14,E143 SOFTWARE FLAG NOT SET/
MS144 ASC 15,E144 ENTRY POINT NOT CLEARED/
MS145 ASC 19,E145 A, B OR E NOT RESTORED IN PFREI/
MS150 ASC 8,H150 PFRIO TEST/
MS151 ASC 14,E151 SOFTWARE FLAG NOT SET/
MS152 ASC 12,E152 I-O NOT PERFORMED/
MS153 ASC 19,E153 A, B OR E NOT RESTORED IN PFRIO/
      IFN 
MS160 ASC 14,H160 STORE-LOAD BYTE, TRSLT
      OCT 6412
      ASC 10,AND BYTE MOVE TEST/
      XIF 
      IFZ 
MS160 ASC 8,H160 TRSLT TEST/
      XIF 
MS161 ASC 12,E161 TRANSLATION ERROR/
MS162 ASC 16,E162 TRANSLATION TABLE ALTERED/
MS163 ASC 15,E163 REGISTER(S) NOT RESTORED/ 
MS165 ASC 15,E165 TRSLT NOT INTERRUPTIBLE/
MS211 ASC 18,E211 B NOT BUMPED AFTER STORE BYTE/
MS212 ASC 19,E212 REGISTER(S) NOT RESTORED IN STORE 
      OCT 6412
      ASC 3,BYTE/ 
MS213 ASC 11,E213 STORE BYTE ERROR/ 
MS221 ASC 17,E221 B NOT BUMPED AFTER LOAD BYTE/ 
MS222 ASC 19,E222 E OR O NOT RESTORED IN LOAD BYTE/ 
MS223 ASC 11,E223 LOAD BYTE ERROR/
MS224 ASC 16,E224 LOAD BYTE ALTERS DATA READ/ 
MS230 ASC 10,H230 WORD MOVE TEST/ 
MS231 ASC 19,E231 MORE WORDS MOVED THAN REQUESTED/
MS232 ASC 11,E232 WORD MOVE ERROR/
MS233 ASC 19,E233 E OR O NOT RESTORED IN WORD MOVE/ 
MS234 ASC 17,E234 WORD MOVE NOT INTERRUPTIBLE/
MS236 ASC 18,E236 SOURCE STRING ALTERED IN MOVE/
MS241 ASC 11,E241 MOVE BYTE ERROR/
MS242 ASC 19,E242 MORE BYTES MOVED THAN REQUESTED/
MS243 ASC 19,E243 E OR O NOT RESTORED IN MOVE BYTE/ 
MS244 ASC 18,E244 MOVE BYTE ALTERS SOURCE BUFFER/ 
MS245 ASC 17,E245 BYTE MOVE NOT INTERRUPTIBLE/
* 
* 
FWAA  EQU * 
* 
* 
* 
* 
* 
      END 
