*****
***** TEST OF SIGMA 5-9 XEROX ASSEMBLY PROGRAM.
***** BASED ON THE PREVIOUS MACROSYMBOL TESTS.
*****
*****
         REF      M:LO
         SYSTEM   SIG9P
*
***** VERIFY DIRECTIVES, DATA-TYPES, ADDRESS FUNCTIONS.
*
* CONSTANTS
*  X: HEXADECIMAL
         DATA     X'12345678',X'ABCDEF',X'FFFFFFFF'
*  O: OCTAL
         DATA     O'1234',O'7654321'
*  INTEGER
*  MAXIMUM POSITIVE INTEGER VALUE = 2**31-1 = 2147483647
         DATA     2147483647
*  D: DECIMAL
         DATA     D'99',D'+99',D'-99',D'+1234567'
         DATA,16  D'+999999999999999999999999999999' BIG DEC CONST.
*  FX: FIXED POINT DECIMAL
         DATA     FX'1B1',FX'1B4',FX'-1B1',FX'-1B4'
         DATA     FX'3.69E-2B2',FX'-.0832B18E+4',FX'3.75B4'
         DATA     FX'3.75B4',FX'.0625B-2'
         BOUND    4
*  FS: FLOATING POINT SHORT
*  GENERATES THE ONE WORD FLOATING POINT NUMBER
         DATA     FS'5.5E-3',FS'1',FS'1.',FS'-1',FS'0'
         DATA     FS'50.E10',FS'16.'
         BOUND    8
*  FL: FLOATING POINT LONG
*  GENERATES THE TWO WORD FLOATING POINT NUMBER
         DATA,8   FL'29875748399928.E-11'
         DATA,8   FL'5.5E-3',FL'1',FL'1.',FL'-1',FL'0'
*  C: CHARACTER STRING
         DATA     C'1',C'ABCD','1','ABCD',C'AB''C'
         DATA,16  C'ABCDEFGHIJKLMNOP'
* LITERALS
*  A LITERAL IS A 32 BIT QUANTITY.
AB       LW,1     L(-185)
         LW,1     L(X'5DF')
         LW,1     L(AB)
         LW,1     =-185
         LW,1     =X'5DF'
         LW,1     =AB
         LW,1     L(C'BYTE')
         LW,1     L(X'F0F0')
         LW,1     L(O'7777')
         LW,1     L(D'37879')
         LW,1     L(D'+12345')
         LW,1     L(FX'78.2E1B10')
         LW,1     L(FS'-8.935410E-02')
* ADDRESSING FUNCTIONS
*
ADRS     EQU      BA(%)+1   INTRINSIC RESOLUTION OF ADRS IS BYTE
         LI,1     ADRS
         LI,1     BA(ADRS)
         LI,1     HA(ADRS)
         LI,1     WA(ADRS)
         LI,1     DA(ADRS)
         DATA     BA(ADRS)+5,HA(ADRS)+5,ADRS+5,DA(ADRS)+5
*COMPOUND FUNCTIONS
         LI,1     WA(BA(DA(ADRS)))+5
         LI,1     BA(DA(ADRS))+5
         LI,1     BA(ADRS+5)
         LI,1     BA(WA(BA(ADRS)))
*ADDRESSING FUNCTIONS MAY BE APPLIED TO LITERALS
         LI,1     BA(HA(L(5)))
*
*  RULES GOVERNING THE MODE (ABSOLUTE OR RELOCATABLE) OF AN EXPRESSION
*  ARE ILLUSTRATED BELOW. SYMBOLS BEGINNING WITH 'A' ARE ABSOLUTE,
*  BEGINNING WITH 'R' ARE RELOCATABLE.
A1       EQU      5
A2       EQU      6
R1       DATA     1
R2       DATA     2
R3       DATA     3
         DATA     R1+A1,R1-A1
         DATA     R1-R2+A1
         DATA     R1-R2+R3-A1+A2
         DATA     A1+A2,A1-A2
* DO1 ITERATION CONTROL
NDO1     EQU      2
L1BDO1   DO1      NDO1+3
         LW,1     L(1)
* THE LABEL ON A DO1 (IF PRESENT) IDENTIFIES THE FIRST BYTE GENERATED
* WITHIN THE ITERATION
         LI,1     L1BDO1
         GEN,8    -1
L2BDO1   DO1      NDO1+3
         GEN,8    -1
         LI,1     BA(L2BDO1)
*
* GOTO  CONDITIONAL BRANCH
NGOTO    EQU      3
         GOTO,NGOTO-1  GOTO1,GOTO2,GOTO3
GOTO1    DATA     1
         GOTO     PROCEED           K ABSENT IMPLIES K=1
GOTO2    DATA     2
         GOTO     PROCEED
GOTO3    DATA     3
PROCEED  DATA     %
*
* LOCAL   DECLARE LOCAL SYMBOLS
LOCA     DATA     %
LOCB     DATA     %
LOCC     DATA     %
LOCD     DATA     %
LOCE     DATA     %
LOCF     DATA     %
         LOCAL    LOCA,LOCB,LOCC
LOCA     DATA     %
LOCB     DATA     %
LOCC     DATA     %
         DATA     LOCA,LOCB,LOCC,LOCD,LOCE,LOCF
* TERMINATE ABOVE LOCAL REGION, BEGIN A NEW ONE
         LOCAL    LOCA
LOCA     DATA     %
         DATA     LOCA,LOCB,LOCC,LOCD,LOCE,LOCF
*
* GEN   GENERATE A VALUE
         BOUND    4
GEN1     GEN,4,12,8,3,5     1,-5,C'5',-1,O'17'
GEN2     GEN,8    2
GEN3     GEN,8    3
         LI,1     BA(GEN1)
         LI,1     BA(GEN2)
         LI,1     BA(GEN3)
*
* COM  COMMAND DEFINITION
*    WITHOUT INTRINSIC FUNCTIONS
COM1     COM,8,8  35,X'3C'
         COM1
         COM1
*    WITH INTRINSIC FUNCTIONS  CF, AF, AFA
         BOUND    4
COM2     COM,1,3,4,8,8,8   AFA(2),CF(2),AF(1),CF(3),AF(2),AF(1)
         COM2,-1,X'CC'     O'14',*10
COM3     COM,1,7,4,3,17    AFA(1),CF(2),CF(3),AF(2),AF(1)
         COM3,X'28'        *%+5,4
*
ALPHA    EQU      5
XYZ      COM,16,16         AF(1),AF(2)
         XYZ               65,ALPHA+X'FC'
* TEXT AND TEXTC
TEXT1    TEXT     'VALUE OF X'
TEXT2    TEXTC    'VALUE OF X'
*
* RES    RESERVE  AN AREA
         BOUND    4
RES1     RES      2                 K ABSENT IMPLIES K=4.RESERVE 2 WORDS
RES2     RES,1    2                 RESERVE 2 BYTES
RES3     RES,5    2                 RESERVE 2  5 BYTE UNITS
*
         LI,1     BA(RES3)+5
         LI,1     BA(RES2)+2
         PAGE
*****   VERIFY INTRINSIC COMMAND MNEMONICS.
*
** '0X' TYPE OPERATION CODES
*
         LCFI     X'B',5            02 3 000 B 5
         CAL1,0   BLUB              04
         CAL2,0   BLUB              05
         CAL3,0   BLUB              06
         CAL4,0   BLUB              07
         PLW,0    BLUB              08
         PSW,0    BLUB              09
         PLM,0    BLUB              0A
         PSM,0    BLUB              0B
         LPSD,0   BLUB              0E
         XPSD,0   BLUB              0F
*
** '1X' TYPE OPERATION CODES
*
         AD,0     BLUB              10
         CD,0     BLUB              11
         LD,0     BLUB              12
         MSP,0    BLUB              13
         STD,0    BLUB              15
         SD,0     BLUB              18
         CLM,0    BLUB              19
         LCD,0    BLUB              1A
         LAD,0    BLUB              1B
         FSL,0    BLUB              1C
         FAL,0    BLUB              1D
         FDL,0    BLUB              1E
         FML,0    BLUB              1F
*
** '2X' TYPE OPERATION CODES
*
         AI,0     0                 20
         CI,0     0                 21
         LI,0     0                 22
         MI,0     0                 23
         SF,0     0                 24
         S,0      0                 25
         LAS,0    BLUB              26
         CVS,0    BLUB              28
         CVA,0    BLUB              29
         LM,0     BLUB              2A
         STM,0    BLUB              2B
         LMS,0    BLUB              2D
         WAIT     BLUB              2E
         LRP      BLUB              2F
*
** '3X' TYPE OPERATION CODES
*
         AW,0     BLUB              30
         CW,0     BLUB              31
         LW,0     BLUB              32
         MTW,0    BLUB              33
         STW,0    BLUB              35
         DW,0     BLUB              36
         MW,0     BLUB              37
         SW,0     BLUB              38
         CLR,0    BLUB              39
         LCW,0    BLUB              3A
         LAW,0    BLUB              3B
         FSS,0    BLUB              3C
         FAS,0    BLUB              3D
         FDS,0    BLUB              3E
         FMS,0    BLUB              3F
*
** '4X' TYPE OPERATION CODES
*
         TTBS,0   1                 40
         TBS,0    1                 41
         ANLZ,0   BLUB              44
         CS,0     BLUB              45
         XW,0     BLUB              46
         STS,0    BLUB              47
         EOR,0    BLUB              48
         OR,0     BLUB              49
         LS,0     BLUB              4A
         AND,0    BLUB              4B
         SIO,0    BLUB              4C
         TIO,0    BLUB              4D
         TDV,0    BLUB              4E
         HIO,0    BLUB              4F
         RIO,3    X'1F'             4F 30 5F 00
         POLP,3   21                4F 30 95 00
         POLR,3   3                 4F 30 C3 00
*
** '5X' TYPE OPERATION CODES
*
         AH,0     BLUB              50
         CH,0     BLUB              51
         LH,0     BLUB              52
         MTH,0    BLUB              53
         STH,0    BLUB              55
         DH,0     BLUB              56
         MH,0     BLUB              57
         SH,0     BLUB              58
         LCH,0    BLUB              5A
         LAH,0    BLUB              5B
*
** '6X' TYPE OPERATION CODES
*
         CBS,0    1                 60
         MBS,0    1                 61
         EBS,0    1                 63
         BDR,0    BLUB              64
         BIR,0    BLUB              65
         AWM,0    BLUB              66
         EXU      BLUB              67
         BCR,0    BLUB              68
         BCS,0    BLUB              69
         BAL,0    BLUB              6A
         INT,0    BLUB              6B
         RD,0     BLUB              6C
         WD,0     BLUB              6D
         AIO,0    BLUB              6E
         MMC,0    2                 6F 04
*
** '7X' TYPE OPERATION CODES
*
         LCF      BLUB              70
         CB,0     BLUB              71
         LB,0     BLUB              72
         MTB,0    BLUB              73
         STCF     BLUB              74
         STB,0    BLUB              75
         PACK,0   BLUB              76
         UNPK,0   BLUB              77
         DS,0     BLUB              78
         DA,0     BLUB              79
         DD,0     BLUB              7A
         DM,0     BLUB              7B
         DSA      BLUB              7C
         DC,0     BLUB              7D
         DL,0     BLUB              7E
         DST,0    BLUB              7F
*
*        NON-BASIC MNEMONICS
*
CF       DATA,1   X'A7'             REFERENCE FOR LC AND LF
         LCI      X'A'              02 2 000 A 0
         LFI      7                 02 1 000 0 7
         LC       CF                70 2 -----
         LF       CF                70 1 -----
*
*        SHIFTS
S        SLS,2    17,1              25220 011
         SLD,2    -5,1              25220 17B
         SCS,2    5,1               25220 205
         SCD,2    -17,1             25220 36F
         SAS,2    17,1              25220 411
         SAD,2    -5,1              25220 57B
         SSS,2    5,1               25220 605
         SSD,2    -17,1             25220 76F
         SFS,2    5                 24200 005
         SFL,2    -5                24200 17B
*
*        BRANCHES
B        B        S                 680
         BE       B                 683
         BG       B                 692
         BL       B                 691
         BGE      B                 681
         BLE      B                 682
         BNE      B                 693
         BEZ      B                 683
         BGZ      B                 692
         BLZ      B                 691
         BGEZ     B                 681
         BLEZ     B                 682
         BNEZ     B                 693
         BOV      B                 694
         BNOV     B                 684
         BC       B                 698
         BNC      B                 688
         BNCNO    B                 68C
         BDP      B                 694
         BWP      B                 684
         BAZ      B                 684
         BANZ     B                 694
         BEV      B                 688
         BOD      B                 698
         BID      B                 698
         BLD      B                 688
         BSU      B                 692
         BNSU     B                 68A
         BSE      B                 691
         BSNE     B                 681
         BSF      B                 694
         BSNF     B                 68F
         BSO      B                 698
         BNSO     B                 688
         BIOAR    B                 688
         BIOANR   B                 698
         BIODO    B                 694
         BIODNO   B                 684
         BIOSP    B                 684
         BIOSNP   B                 694
         BIOSS    B                 684
         BIOSNS   B                 694
*
*        MISCELLANEOUS
         NOP                        02000000
         PZE      *S,7              800E----
         LLOCKS,2                   6F22----
         LMAP,2                     6F28----
         LPC,2                      6F24----
         LMAPRE,2                   6F2A----
*
BLUB     DATA     X'0'
*  ROUTINE TO VERIFY LOAD & EXECUTION.
*
MSG      TEXT     ' LOAD & EXECUTION WERE SUCCESSFUL.'
SIZE     EQU      BA(%)-BA(MSG)
*
PRINTMSG GEN,8,24 X'11',M:LO
         GEN,4,28 X'3',X'10'
         DATA     MSG,SIZE
*
START    EQU      %
         CAL1,1   PRINTMSG
         CAL1,9   1
         END      START

