
/
/MICHAEL P STRYKER
/PHILLIP J BEST
/BRAIN RESEARCH LAB
/UNIVERSITY OF MICHIGAN
/ANN ARBOR, MICHIGAN
/
/INCREMENTAL PLOTTER PRINTOUT SUBROUTINES
/
/THESE ROUTINES, WHICH OCCUPY FIVE PAGES OF MEMORY, MUST
/BE USED WITH DIGITAL 8-12-U PLOT SUBROUTINE.
/
/THE FIVE PAGES MAY BE ASSEMBLED STARTING AT THE FIRST
/LOCATION OF ANY PAGE OF MEMORY.  TO ASSEMBLE, FIRST  MAKE
/A TAPE AS FOLLOWS TO PRECEDE THE TAPE OF THE PRINTOUT SUB-
/ROUTINES:  "*XXXX; PLOTX=YYYY; PAUSE; ", WHERE XXXX IS
/THE FIRST LOCATION OF THE PAGE WHERE THE PRINTOUT 
/ROUTINES ARE TO START, AND YYYY IS THE FIRST LOCATION
/OF "PLOTX" (DIGITAL 8-12-U).
/
/ALL THE PRINTOUT ROUTINES EXIT WITH CURRENT PEN LOCATION
/CORRECTLY HELD IN "PLOTNX,Y" OF "PLOTX" (8-12-U).
/


/DECPLT  --  A SIGNED DECIMAL PRINTOUT ROUTINE FOR
/INCREMENTAL PLOTTER.  THIS ROUTINE USES PLTSTG; DIGITS
/ARE PRINTED OUT IN THE SAME FORMAT AS THAT OF THE PREVIOUS
/CALL OF TYPLOT.  LEADING ZEROS AND THE "+" SIGN ARE
/SUPPRESSED.
/THIS ROUTINE IS A MODIFICATION OF DIGITAL 8-22-U-SYM.
/
/CALL WITH NUMBER TO BE PRINTED OUT IN C(AC)

DECPLT,   0
          SMA
          JMP PLUS
          CIA
          DCA VALUE
          TAD L55    /"-" SIGN
          JMP .+3
PLUS,     DCA VALUE
          TAD L40    /SPACE
          JMS PLT1
          DCA SKPF
          TAD M4
          DCA CNT4
          DCA DIGIT           /CLEAR
          TAD CNTRZA
          DCA CNTRZB          /SET COUNTER TO FOUR
          TAD ADDRZA
          DCA ARROW           /SET TABLE POINTER
          SKP
          DCA VALUE           /SAVE
          CLL
          TAD VALUE
ARROW,    TAD TENPWR          /SUBTRACT POWER OF TEN
          SZL
          ISZ DIGIT           /DEVELOP BCD DIGIT
          SZL
          JMP ARROW-3         /LOOP
          CLA                 /HAVE BCD DIGIT
          TAD DIGIT           /GET DIGIT
          ISZ CNT4   /IS THIS THE LAST 0?
          SKP        /NO
          JMP .+3     /YES, DON'T SUPPRESS IT.
          SNA
          JMP CK
          ISZ SKPF
          TAD K60
OUT,      JMS PLT1   /PLOT OUT THE DIGIT
          DCA DIGIT           /CLEAR
          ISZ ARROW           /UPDATE POINTER
          ISZ CNTRZB          /DONE ALL FOUR?
          JMP ARROW-1         /NO: CONTINUE
          JMP I      DECPLT  /YES:  EXTI
ADDRZA,   TAD TENPWR
CNTRZA,   -4
TENPWR,   -1750               /ONE THOUSAND
          -0144               /ONE HUNDRED
          -0012               /TEN
          -0001               /ONE
VALUE,    0
DIGIT,    0
CNTRZB,   0
CK,       TAD SKPF
          SNA CLA
          TAD M20
          JMP OUT-1
SKPF,     0
CNT4,     0
M4=CNTRZA
L55,      55
M20,      -20
L40,      40
K60,      60

/PLT1  --  PRINTS OUT ONE CHARACTER HELD IN  AC 6-11
/
*DECPLT+100
PLT1,     0          /ENTER WITH 1 CHR IN AC
          RTL
          RTL
          RTL
          AND L7700  /MASK TO ASSURE EXIT
          DCA STG
            TAD STG+1
          JMS I RPLTST  /JMS PLTSTG
          CLA CLL
          JMP I PLT1
STG,      0
          STG
L7700,    7700


*DECPLT+144

/TYPLOT    ROUTINE TO FETCH CONTROL CHARACTER AND PLOT A
/STRING OF CHARACTERS.  ENTER WITH ADDRESS OF STRING IN AC
/AND CONTROL CHARACTER IN THE NEXT LOCATION FOLLOWING THE 
/CALL.    SAMPLE:    TAD STGADD
/                    JMS TYPLOT
/                    WXYZ       (CONTROL CHARACTER--OCTAL)
/CONTROL CHARACTER IS TO BE INTERPRETED AS FOLLOWS:
/W:  THE DIRECTION THE LINE IS TO RUN.  W-0; NEXT CHARACTER
/         IS TO LEFT.  W=1; NEXT CHARACTER IS ABOVE PREVIOUS CHR.
/X:  THE ORIENTATION OF THE CHRS.  X=0; CHRS ARE RIGHT SIDE UP
/         X=1; CHRS ARE INVERTED.  X=2; CHRS ARE ROTATED 90
/         DEGREES TO THE RIGHT.  X=3; ROTATED 90 DEG. LEFT.
/YZ:  TAKEN TOGETHER AS A TWO-DIGIT NUMBER INDICATE THE SIZE
/         OF THE CHRS = THE NUMBER OF MULTIPLES OF THE BASIC
/         6 BY 4 PLOTTER-STEP SIZE.
/
/
/
TYPLOT,   0
          DCA S      /STORE ADDRESS OF STRING
          TAD I TYPLOT          /GET CONTROL CHR
          AND L77    /MASK FOR YZ (ABOVE)
          CIA
          DCA I RSCLML          /-YZ => SCLMLT
          TAD I TYPLOT
          RTR
          RTR
          RTR
          AND L7     /MASK FOR X
          DCA I RTRANS          /X => TRANSQ
          TAD I TYPLOT
          RTL
          RTL
          AND L7
          DCA I RLINRU          /W => LINRUN
          ISZ TYPLOT /TO EXIT AFTER CONTROL CHR
          TAD S
          JMS I RPLTST          /CALL PLTSTG
          JMP I TYPLOT          /EXIT

RSCLML,   SCLMLT
RTRANS,   TRANSQ
RLINRU,   LINRUN
RPLTST,   PLTSTG

L77,      77
L7,       7
S,        0



/MOVE & SPC    MOVE MAKES 10 PEN MOVEMENTS FOR EACH
/CHARACTER, ACCORDING  TO CODE AT ADDRESS "L" THROUGH
/"L+4".   SPC MOVES PEN TO (5,0) OR (0,7) ACCORDING TO
/LINRUN.
/
MOVE,     0
          TAD        MMM5       /SET WORD COUNTER
          DCA        MMM5GO
          DCA        OLDRX      /ZERO PREVIOUS X-MVMT
TIM1,     TAD        MMM2       /SET MVMT COUNTER  2/WORD
          DCA        MMM2GO
          TAD I      L
          DCA        M          /CONTAINS TWO MOVEMENTS
TIM2,     TAD        M
          AND        LLL7       /MASK  4TH BITE
          DCA        RAWY
          TAD        M
          RTR
          RAR                   /BITE3 =>  BITE4
          AND        LLL7       /MASK AGAIN
          TAD        MMM5       /6,7 - 5 > 0
          SMA        /IS IT A PNUPDN  COMMAND (EG., 6 OR7)
          JMS I      RPNUPD     /YES, CALL PNUPDN
          TAD        LLL5       /RESTORE RAWX
          DCA        RAWX       /X-COORDINATE OF MVT
          TAD        RAWX       /FOR PNUPDN
          DCA        OLDRX
          JMS        SCLPLT     /TO TRANSFORM, SCALE, & PLOT

          JMS        PLOTIT     /PLOT IT!
          CLA
          TAD        M
          RTR
          RTR
          RTR        /BITES 1&2  =>  BITES 3&4
          DCA        M
          ISZ        MMM2GO     /GONE THRU TWICE?
          JMP        TIM2       /NO, DO  IT AGAIN.
          ISZ        MMM5GO     /YES, HAVE WE DONE 5 L'S?
          SKP
          JMP        SPC        /YES, SPACE AND EXIT
          ISZ        L          /NO, INCR L & AWAY AGAIN.
          JMP        TIM1


/ROUTINE TO RAISE PEN & MOVE TO (5,0) OR (0,7).
SPC,      JMS I      RPNUPD     /LIFT PEN
          CLA
          TAD        LINRUN     /=0?
          SNA CLA
          JMP        .+5
          TAD        LLL7       /LINRUN = 1
          DCA        RAWY
          DCA        RAWX
          JMP        .+4
          TAD        LLL5       /LINRUN = 0
          DCA        RAWX
          DCA        RAWY
          JMS        SCLPLT
          JMS        PLOTIT     /SCALE & PLOT THE SPACE
          JMP I      MOVE       /EXIT

RAWX,0
RAWY,0
SCLMLT,0
TRANSQ,0
LINRUN,0
OLDRX,0
L,0
M,0

LLL5,     5
LLL7,     7
MMM5,     -5
MMM2,     -2

MMM2GO,0
MMM5GO,0
CNTR,0

RPNUPD,   PNUPDN




/PLOTIT    ROUTINE TO CALL PLOTX (DIGITAL 8-12-U) WITH
/PROPER PARAMETERS.
PLOTIT,   0
PNSTAT,   CLA IAC    /PEN UP OR DOWN?
          JMS I PLOT
XMVT,     0
YMVT,     0
          JMP I PLOTIT
PLOT,     PLOTX


/SCLPLT    ROUTINE TO TRANSFORM ACCORDING TO TRANSQ
/AND SCALE ACCORDING TO SCLMLT EACH MOVEMENT.  INPUT IS
/RAWX, RAWY; OUTPUT INTO XMVT, YMVT OF PLOTIT.
SCLPLT,   0
          TAD        TRANSQ     /ORIENTATION OF CHRS
          SNA
          JMP        STRAIT     /TRANSQ=0; NO TRANSFORM
          TAD        MMM2
          SNA
          JMP        ROTRIT     /TRANSQ=2; ROTATE 90 DEG. RIGHT
          SPA
          JMP        INVRT      /TRANSQ=1; INVERT EACH CHR
                                /TRANSQ=3; ROTATE LEFT

ROTLFT,   CLA        /TO ROTATE EACH CHR LEFT 90 DEGREES
          TAD        RAWX
          DCA        TRY        /RAWX =>  TRY
          TAD        RAWY
          CIA
          TAD        LLL7
          DCA        TRX        /7 - RAWY => TRX
          JMP        SCALE

ROTRIT,   TAD        RAWX       /TO ROTATE EACG CHR RIGHT 90 DEG.
          CIA
          TAD        LLL5
          DCA        TRY        /5-RAWX => TRY
          TAD        RAWY
          DCA        TRX        /RAWY => TRX
          JMP        SCALE

INVRT,    TAD        RAWX       /TO INVERT EACH CHR
          CIA
          TAD        LLL5
          DCA        TRX        /5-RAWX =>  TRX
          TAD        RAWY
          CIA
          TAD        LLL7
          DCA        TRY        /7-RAWY => TRY
          JMP        SCALE

STRAIT,   TAD        RAWX       /NO TRANSFORM
          DCA        TRX
          TAD        RAWY
          DCA        TRY        /RAWX,Y => TRX,Y

SCALE,    TAD        SCLMLT
          DCA        CNTR
          TAD        TRX
          ISZ        CNTR       /TAD LOOP TO MULTIPLY
          JMP        .-2
          DCA        XMVT
          TAD        SCLMLT
          DCA        CNTR
          TAD        TRY
          ISZ        CNTR
          JMP        .-2
          DCA        YMVT

          JMP I      SCLPLT     /EXIT

TRX=XMVT
TRY=YMVT




/PLTSTG    ROUTINE TO PLOT A STRING OF CHARACTERS ACCORDING
/TO CONTROL CHR SET BY TYPLOT.  ENTER WITH ADDRESS OF STRING
/IN AC.  EXITS WITH THE CURRENT VALUES OF PLTNX,Y (DIGITAL
/8-12-U) RELATIVE TO THOSE VALUES AT CALL OF PLTSTG.
/STRING IS PACKED TWO 6-BIT TRIMMED ASCII CHARACTERS TO A 
/WORD, WITH '00' SERVING AS THE TERMINATOR.
/
*MOVE+200
/
PLTSTG,   0
          DCA STRADD
          TAD I OLDX  /=TAD PLTNX - CURRENT X-COORDINATE
          DCA COLDX  /SAVE IT
          TAD I OLDY
          DCA COLDY
RDPACK,   TAD MM2
          DCA MM2GO  /SET PASS COUNTER
          TAD I STRADD
          DCA SAV
RDPK2,    TAD SAV
          RTR; RTR; RTR
RDPK3,    AND LL77   /MASK
          SNA        /00 TERMINATES THE STRING
          JMP TYPFIN



/CHRTR    ROUTINE TO DETERMINE CHARACTER SET
CHRTR,    TAD MM40
          SNA        /IS IT A SPACE (=40)?
          TAD MM5    /YES, SUBRATCT 5
          SMA
          TAD MM10   /CHR > 44: SUBTRACT 10
          TAD LL40   /RESTORE



/BASAD    ROUTINE TO MULTIPLY CODE BY 5 & ADD TO BASE
/TO DEVELOP THE ADDRESS OF MOVEMENT CODE.

BASAD,    DCA CODE
          TAD MM5
          DCA CNTR2
          TAD CODE
          ISZ CNTR2
          JMP .-2
          TAD BASE
          DCA I RL   /DCA L NEXT PAGE



/UPDATE    ROUTINE TO PUT SCALED (0,0) INTO PLTNX,Y;
/CALL 'MOVE'; AND UPDATE COLDX,Y
/
UPDATE,   JMS SCL00  /GET SCALED & TRANSFORMED (0,0)
          DCA I OLDX    /PUT X0 INTO PLTNX
          TAD I RYMVT
          DCA I OLDY /SAME WITH Y0
          JMS I RMOVE   /CALL "MOVE"
          JMS SCL00
          CIA        /- X0
          TAD I OLDX /+ PLTNX (CURRENT X)  = DELTA X
          TAD COLDX  /+ PREVIOUS X COORDINATE
          DCA COLDX  /UPDATED
          TAD I RYMVT  /Y0
          CIA         /- Y0
          TAD I OLDY /+ PLTNY  =  DELTA Y
          TAD COLDY
          DCA COLDY  /UPDATED



/RDPK4 & TYPFIN

RDPK4,    TAD SAV
          ISZ MM2GO   /2 TIMES THRU?
          JMP RDPK3   /NO, GET 2ND PACKED CHARACTER
          CLA
          ISZ STRADD  /INCREMENT STRING ADDRESS
          JMP RDPACK  /GET NEXT WORD IN STRING


TYPFIN,   CLA
          TAD COLDX  /CURRENT X-COORDINATE REL TO CALL
          DCA I OLDX /PUT CURRENT X INTO PLTNX, REL.
                     /TO PLTNX AT CALL OF PLTSTG.
          TAD COLDY
          DCA I OLDY /SAME WITH Y-COORD.
          JMP I PLTSTG          /EXIT


/PNUPDN    ROUTINE TO LOWER PEN IF C(AC)=2; RAISE
/PEN OTHERWISE.  EXITS WITH PREVIOUS X-COORD (OLDRX)
/IN AC.
PNUPDN,   0
          TAD MM2
          SZA CLA
          JMP .+4
          TAD DN
          DCA I RPNSTA          /LOWER PEN
          JMP .+3
          TAD UP
          DCA I RPNSTA
          TAD I ROLDRX
          TAD MM5
          JMP I PNUPDN          /EXIT

DN,       CLA
UP,       CLA IAC
RPNSTA,   PNSTAT
ROLDRX,   OLDRX


/ROUTINE TO TRANSFORM & SCALE (0,0).  EXITS WITH X0
/IN AC; Y0 IS IN YMVT OF PLOTIT
SCL00,    0
          CLA
          DCA I RRAWX           /ZERO RAWX,Y
          DCA I RRAWY
          JMS I RSCLPL
          TAD I RXMVT
          JMP I SCL00   /EXIT

RRAWX, RAWX
RRAWY, RAWY
RSCLPL, SCLPLT
RXMVT, XMVT



/VARIABLES FOR PLTSTG

STRADD,0
MM2GO,0
SAV,0
CODE,0
CNTR2,0

MM2,      -2
LL77,     77
MM5,      -5

COLDX,0
COLDY,0
OLDX,     PLOTX+162
OLDY,     PLOTX+163
RL,L
RYMVT,    YMVT
RMOVE,    MOVE

BASE,     .-1
MM40,-40
MM10,-10
LL40,40




/
/MOVEMENT CODES FOR EACH CHARACTER
/
1370; 1333; 4026; 4040; 4040    /A
4676; 3343; 3303; 4042; 4000
4660; 1676; 0105; 4010; 4040
3676; 4145; 0030; 0000; 0000
4676; 0306; 0333; 4000; 4040
4676; 0306; 0333; 0000; 0000
4660; 1676; 0105; 4010; 2242   /G
0376; 4643; 4040; 4040; 4040
7010; 2030; 1626; 3636; 3636
0072; 3630; 4626; 4646; 4646    /J
0276; 4013; 4613; 4646; 4646    /K
0076; 4040; 4040; 4040; 4040    /L
2376; 4046; 4040; 4040; 4040    /M
4076; 4646; 4646; 4646; 4646    /N
7561; 3616; 4145; 1030; 0501    /O
4676; 0343; 4643; 0006; 0000    /P
1645; 4146; 0030; 2262; 4072    /Q
4676; 0343; 4013; 4040; 4040    /R
3070; 4241; 1333; 0504; 4616    /S
7620; 0646; 0606; 0606; 0606    /T
7601; 1001; 4130; 4646; 4646    /U
7606; 4620; 4646; 4646; 4646    /V
7606; 2310; 4630; 4646; 4646    /W
4670; 0666; 4076; 4040; 4040    /X
7320; 2306; 4646; 4646; 4646    /Y
7606; 0046; 4040; 4040; 4040    /Z

0000; 0000; 0000; 0000; 0000    /SPACE

7521; 3424; 1314; 3233; 1212    /$
7525; 1514; 1135; 3231; 2121    /%
7521; 3424; 2314; 3212; 3232    /&
7323; 2615; 2335; 2323; 2323    /'
7636; 1325; 3021; 3030; 3030    /(
7010; 3321; 1625; 1616; 1616    /)
7521; 1423; 2332; 3412; 2323    /*
7521; 0323; 2343; 2121; 2121    /+
7211; 2122; 2111; 1010; 1010    /,
7313; 6333; 3333; 3333; 3333    /-
7110; 2021; 1110; 0464; 0404    /.
4670; 4066; 4040; 4040; 4040    /SLASH(/)
7501; 3616; 4145; 1030; 4501    /0
7010; 2030; 1526; 2626; 2626    /1
7505; 3616; 4445; 0001; 4140    /2
7606; 1346; 4334; 3041; 0110    /3
7630; 4333; 0603; 0606; 0606    /4
7646; 0306; 3414; 4143; 0030    /5
1372; 4233; 3041; 0500; 3616    /6
7505; 4616; 3222; 2212; 1010    /7
4472; 0646; 4204; 0040; 0000    /8
7540; 1636; 0405; 3313; 4544    /9
7211; 2122; 6411; 2575; 1424    /:
7210; 2122; 6410; 2575; 1424    /;
7545; 4103; 4141; 4141; 4141    /<
7202; 6342; 0373; 0303; 0303    /=
7101; 0543; 0505; 0505; 0505    />
7505; 3616; 4445; 2123; 7060    /?


$


