	.TITLE		MENUX
/
/	CHANGES TO MAKE IT WATRAN COMPATIBLE
/	R. SENSKE     APRIL 16/74
/
/
/   STORAGE AREAS
HEAD    51003
        0
        .DEC
IMAGE   .BLOCK  81
END     0
CRDHED  0
        0
CRDBUF  .BLOCK  34
FREE    FREE
TAGTAB  .BLOCK  100     /KEEP TAGS OF EACH PAGE SEQUENTIALLY
FILBUF  .BLOCK  100     /BUILD DISPLY FILE HERE
ADIN1   0
DUM     0
M       1000
C       100
ANX     10
I       1
        .OCT
PARAM   34110
XWRD    74000
YWRD    234000
ADIN0   0
TAGIN   0
XPOS    0
YPOS    0
SCLIN   0
INTIN   0
ADD     0               /ADDRESS IN LOOKUP TABLE
SCRTCH  .SIXBT  'SCRTCHSRC'
FCN     .DSA    0
TAG     .DSA    0
IVECT   .DSA    0
FST     .DSA    0
LAST    .DSA    0
PARSAV  0
ESC     0
WORD    0
NAMEAD  NAME
NAME    0
NAME2   0
EXTN    0
SRC     232203
BIN     21116
DK6=2
DK5=1
CRD=7
IN=0
OUT=1
COUNT1  -2
COUNT2  0
LSTSW   0
PLACE   .BLOCK  4
ACDB    .ASCII  'CD'<15>
ADK6    .ASCII  'DK6'<15>
ADK5    .ASCII  'DK5'<15>
APR     .ASCII  'PR'<15>
DEVAD   0
ZCRD    7
ZDK6    2
ZDK5    1
ZPR     5
WHERE   .ASCII  '     WHERE IS YOUR DATA?'<15>
WHAT    .ASCII  '     FILE NAME?'<15>
ARO     .ASCII  '     >'<175>
DSKSW   0
EOM     1006
EOF     1005
        .DEFINE SDEV,ARG1,ARG2
        LAC     ARG1
        AND     (777000
        TAD*    ARG2
        DAC     ARG1
        .ENDM
STRT    .INIT -3,1,STRT
        .WRITE -3,2,WHERE,2
        .WRITE -3,2,ARO,2
        .WAIT -3
        .READ -2,2,PLACE,10
        .WAIT -2
        LAC     PLACE+2
        SAD     ACDB
        JMP     CARDS
        SAD     APR
        JMP     TAPE
        LAC     PLACE+3
        SAD     ADK5+1
        JMP     DISK5
        SAD     ADK6+1
        JMP     DISK6
ERR     XX
CARDS   LAC     (ZCRD
        DAC     DEVAD
        JMP     START
TAPE    LAC     (ZPR
        DAC     DEVAD
        LAC     (SAD EOM
        DAC     SD
        JMP     DEVIN
DISK5   LAC     (ZDK5
        DAC     DEVAD
        LAC     (SAD EOF
        DAC     SD
        JMP     INSTR
DISK6   LAC     (ZDK6
        DAC     DEVAD
        LAC     (SAD EOF
        DAC     SD
        SDEV INI,DEVAD
        SDEV SEK,DEVAD
INSTR   .INIT -3,1,INSTR
        .WRITE -3,2,WHAT,2
        .WRITE -3,2,ARO,2
        .WAIT -3
        .READ -2,2,CRDHED,10
        .WAIT -2
        LAW     -1
        DAC     DSKSW
        JMP     INUP
OPN     LAC     SRC
        DAC     EXTN
INI     .INIT DK5,IN,INI
SEK     .SEEK DK5,NAME
DEVIN   SDEV START+3,DEVAD
        SDEV NAMEIT,DEVAD
        SDEV NAMEIT+4,DEVAD
        SDEV MNLUP,DEVAD
        SDEV MNLUP+4,DEVAD
        SDEV RTEX,DEVAD
        SDEV RTEX+4,DEVAD
        JMP     START
ENDMRK  51003   /AN END MARKER FOR THE FILE ON DISK
        0
        33
        15
/   NOW THE PROGRAM
/
/
        .GLOBL DISPLY,CLEAR,UNPACK,START
        .GLOBL .FP,.FX,.FI,.FB,.FG,PACK
        .IODEV  CRD,DK6,DK5,4,5
START   LAC     DSKSW
        SZA
        JMP     DZ
        .INIT CRD,IN,START
DZ      DZM     DSKSW
        .INIT DK6,OUT,START
        JMS*    CLEAR
        JMP     BOO
        .DSA    (-1
BOO     .ENTER  DK6,SCRTCH      /SCRATCH FILE ON DK6
        LAC     (TAGTAB-1
        DAC*    (14             /USE AUTO IND. FOR TABLE
/
/   PUT IN THE NAME
/
NAMEIT  .READ   CRD,2,CRDHED,36
        .WAIT   CRD
INUP    LAC     (CRDBUF
        DAC     UP+1
        LAC     (IMAGE
        DAC     UP+2
UP      JMS*    UNPACK
        0
        0
        SMA
        JMP     UP
/   PUT THIS ON DISK
        LAC     DSKSW
        SZA
        JMP     P.KLUP
        LAC     (015
        DAC     IMAGE+6
        .WRITE DK6,3,HEAD,82
        .WAIT DK6
/  PACK SIXBIT
P.KLUP  LAC     (IMAGE-1
        DAC*    (10
        LAW     -2
        DAC     COUNT1
PAKLUP  LAC*    10
        AND     (77
        ALS 14
        DAC*    NAMEAD
        LAC*    10
        AND     (77
        ALS 6
        TAD*    NAMEAD
        DAC*    NAMEAD
        LAC*    10
        AND     (77
        TAD*    NAMEAD
        DAC*    NAMEAD
        ISZ     NAMEAD
        ISZ     COUNT1
        JMP     PAKLUP
        LAC     (NAME
        DAC     NAMEAD
        LAC     DSKSW
        SZA
        JMP     OPN
MNLUP   .READ   CRD,2,CRDHED,36
        .WAIT   CRD
        LAC     CRDHED
SD      SAD     EOM     /EOM? OR EOF?
        JMP     LSTCRD
        LAC     (CRDBUF
        DAC     UNDO+1
        LAC     (IMAGE
        DAC     UNDO+2
UNDO    JMS*    UNPACK
        0
        0
        SMA
        JMP     UNDO
/   CHECK FOR PAGE
        LAC     IMAGE
        SAD     (120    /A 'P'?
        JMP     PAGE    /PAGE CARD
/
/   BUILD PARAM,X,Y WORDS
/ TAGN XWRD YWRD S I  -- IN THIS FORMAT
/
        LAC     (ADIN0
        DAC*    (10
        LAW     -5
        DAC     COUNT2
ZERO    DZM*    10
        ISZ     COUNT2  /ZERO LOCATIONS
        JMP     ZERO
        LAC     (IMAGE-1
        DAC*    (10
        LAW     -3
        DAC     COUNT2
        LAC     (TAGIN
        DAC     ADIN0
        LAC     (DUM
        DAC     ADIN1
        LAW     -5
        DAC     COUNT1
LUP1    LAC*    10
        AND     (17
        DAC     MCN1
        CLL
        LAC*    ADIN1
        MUL
MCN1    0
        LACQ
        TAD*    ADIN0
        DAC*    ADIN0
        ISZ     ADIN1
        ISZ     COUNT1
        JMP     LUP1
        ISZ     ADIN0
        ISZ     COUNT2
        JMP     LUP1-4
/   SCALE AND INT
        LAW     -2
        DAC     COUNT1
LUP2    LAC*    10
        LAC*    10
        AND     (17
        DAC*    ADIN0
        ISZ     ADIN0
        ISZ     COUNT1
        JMP     LUP2
/   NUMBERS ARE NOW CONSTRUCTED
        DZM     FILBUF
        LAC     INTIN
        SZA
        JMP     PARA
        LAC     (7
PARA    TAD     PARAM
        DAC     PARSAV
        LAC     SCLIN
        AND     (3
        ALS 4
        TAD     PARSAV
        DAC     FILBUF+1
        LAC     YPOS
        AND     (1777
        TAD     YWRD
        DAC     FILBUF+2
        LAC     XPOS
        AND     (1777
        TAD     XWRD
        DAC     FILBUF+3
/   PUT IN WRD PR CNT AND WRITE ON DK6
        LAC     (015    /PUT IN CR
        DAC*    10
        .WRITE  DK6,3,HEAD,82
        .WAIT   DK6
RTEX    .READ   CRD,2,CRDHED,36
        .WAIT   CRD     /NOW THE TEXT CARD
        LAC     (CRDBUF
        DAC     UNDO2+1
        LAC     (IMAGE
        DAC     UNDO2+2
UNDO2   JMS*    UNPACK
        0
        0
        SMA
        JMP     UNDO2
/   FIND THE LAST LETTER
        LAC     (END-2
        DAC     END
LUP3    LAC*    END
        SAD     (40
        JMP     AGN
        JMP     LETTER
AGN     LAC     END
        TAD     (-1
        DAC     END
        JMP     LUP3
LETTER  ISZ     END     /WEVE GONE PAST SO ADD 1
        LAC     (015
        DAC*    END
/   NOW PACK SIXBIT
        JMP     AROUND
ESCAPE  XX
        LAW     -1
        DAC     ESC
        LAC     (37
        JMP*    ESCAPE
AL      ALSS 14
        ALSS 6
        NOP
/
JDISP   XX
        JMS*    DISPLY
        JMP     BACK
        .DSA    FCN
        .DSA    TAG
        .DSA    IVECT
        .DSA    FST
        .DSA    LAST
BACK    JMP*    JDISP
/
AROUND  LAC     (IMAGE-1
        DAC*    (10
        LAC     (FILBUF+3
        DAC*    (13
ZWRD    DZM     WORD
        LAC     (XCT AL
        DAC     EX
        LAW     -3
        DAC     COUNT1
SIXPAK  LAC*    10
        SAD     (015
        JMS     ESCAPE
        AND     (77
EX      XX
        TAD     WORD
        DAC     WORD
        LAC     ESC
        SZA
        JMP     STOPIT
        ISZ     EX
        ISZ     COUNT1
        JMP     SIXPAK
        LAC     WORD
        DAC*    13
        JMP     ZWRD
STOPIT  LAC     WORD
        DAC*    13
        DZM     ESC
        LAC     (160000
        DAC*    13
        DZM*    13
/   FILE NOW COMPLETE
/       WRITE ON DK6
        .WRITE  DK6,3,HEAD,82
        .WAIT   DK6
        LAC     (FILBUF
        DAC     IVECT
        CMA
        TAD     (2
        TAD*    (13
        DAC     LAST
        LAC     (1
        DAC     FST
        LAC     TAGIN
        DAC*    14      /PUT IN TAG TABLE
        DAC     TAG
        LAC     (6
        DAC     FCN
        JMS     JDISP   /DISPLY
        JMP     MNLUP   /PICK UP NEXT FILE
/
PAGE    LAC     (5
        DAC     FCN
        LAC     FREE
        TAD     (1
        DAC     ADD
XOUT    LAC*    ADD
        SNA
        JMP     DID
        DAC     TAG
        JMS     JDISP
        ISZ     ADD
        JMP     XOUT
DID     LAC     FREE
        CMA
        TAD     (1
        TAD*    (14
        DAC*    FREE
        LAC*    (14
        TAD     (1
        DAC     FREE
        DZM*	14          /SETS 12
        LAC     LSTSW
        SZA
        JMP     LSTCRD+3
        LAC     (IMAGE+6
        SAD     (40
        JMP     OVNIN
        LAC     (015
        DAC     IMAGE+6
        JMP     WRPG
OVNIN   LAC     (015
        DAC     IMAGE+7
WRPG    .WRITE DK6,3,HEAD,82
        .WAIT DK6
        JMP     MNLUP
LSTCRD  LAW     -1
        DAC     LSTSW
        JMP     PAGE
        .WRITE DK6,3,ENDMRK,82
        .WAIT DK6
        .CLOSE DK6
        .CLOSE DK5
/   MENU REVIEW
        JMP     ASK
REV     .ASCII  '     REVIEW? (Y OR N)'<15>
TYP     .ASCII  '     PAGE NO. OR OK WHEN DONE'<15>
N       .ASCII  'N'<15>
OK      .ASCII  'OK'<15>
/
ASK     .INIT -3,1,ASK
        .WRITE -3,2,REV,2
        .WAIT -3
        .WRITE -3,2,ARO,2
        .WAIT -3
        .READ -2,2,PLACE,10
        .WAIT -2
        LAC     PLACE+2
        SAD     N
        JMP     D.SK1
YES     .INIT -3,1,YES
        .WRITE -3,2,TYP,2
        .WAIT -3
WARO    .INIT -3,1,WARO
        .WRITE -3,2,ARO,2
        .WAIT -3
        .READ -2,2,PLACE,10
        .WAIT -2
        LAC     PLACE+2
        SAD     OK
        JMP     D.SK1
        LRS 13
        AND     (17
        CMA
        TAD     (1
        DAC     COUNT1
        LAC     (FREE
        DAC*    (10
REVLUP  LAC*    10
        CMA
        TAD     (1
        DAC     COUNT2
        SNA
        JMP     WARO
        ISZ     COUNT1
        SKP
        JMP     GOTPAG
        LAC     (5
        DAC     FCN
OFFLUP  LAC*    10
        DAC     TAG
        JMS     JDISP
        ISZ     COUNT2
        JMP     OFFLUP
        JMP     REVLUP
GOTPAG  LAC     (4
        DAC     FCN
        JMP     OFFLUP
D.SK1   LAC     BIN
        DAC     EXTN
        JMS*    .FP
        .INIT DK5,OUT,D.SK1
        JMS*    .FX
        .DSA    (DK5
        .ENTER  DK5,NAME
TABLUP  JMS*    .FX
        .DSA    (DK5
        ISZ     TABADD
        JMS*    .FI
TABADD  .DSA    FREE
        JMS*    .FG
        LAC*    TABADD
        SZA
        JMP     TABLUP
/   WRITE DISPLAY FILES ONTO DK5.  USE IMAGE BLOCK FOR TRANFR AREA
        JMP     RECOV
FILTAG  0
FILSIZ  0
        0
        0
FILARY  IMAGE
/
RECOV   LAC     (FREE
        DAC*    (15
        LAC     FILARY
        DAC     IVECT
        LAC     (2
        DAC     FCN
        LAC     (1
        DAC     FST
        DZM     LAST
R.LUP   LAC*    15
        SNA
        JMP     D.NE
        CMA
        TAD     (1
        DAC     COUNT1
/
RECLUP  LAC*    15
        DAC     TAG
        JMS     JDISP
        LAC     LAST
        DAC     FILSIZ
        JMS*    .FX
        .DSA    (DK5
        JMS*    .FI
        .DSA    FILSIZ
        JMS*    .FI
        .DSA    TAG
        JMS*    .FB
        .DSA    FILARY
        JMS*    .FG
        ISZ     COUNT1
        JMP     RECLUP
        JMP     R.LUP
D.NE    JMS*    .FX
        .DSA    (DK5
        JMS*    .FI
        .DSA    FILSIZ
        JMS*    .FI
        .DSA    FILTAG
        JMS*    .FB
        .DSA    FILARY
        JMS*    .FG
        .CLOSE  DK5
/   NOW IMAGE FROM DK6,  5/7 ONTO DK5.  USE IMAGE BLOCK
RS      .INIT DK6,IN,RS
        .INIT DK5,OUT,RS
        LAC     SRC
        DAC     EXTN
        .SEEK DK6,SCRTCH
        .ENTER DK5,NAME
SRCLUP  .READ DK6,3,HEAD,82
        .WAIT DK6
        LAC     IMAGE
        SAD     (33
        JMP     SRCCLS
/   CR INSERTED INTO FILE BEFORE
        LAC     (IMAGE
        DAC     UNDO3+1
        LAC     (CRDBUF
        DAC     UNDO3+2
UNDO3   JMS*    PACK
        0
        0
        SMA
        JMP     UNDO3
        TAD     (CRDHED
        CMA
        TAD     UNDO3+2
        ALSS 10
        TAD     (2
        DAC     CRDHED
        .WRITE DK5,2,CRDHED,36
        .WAIT DK5
        JMP     SRCLUP
SRCCLS  .CLOSE DK5
        .CLOSE DK6
        .DLETE DK6,SCRTCH
        .EXIT
        .END    STRT
