Research V5 development
authorDennis Ritchie <dmr@research.uucp>
Tue, 26 Nov 1974 23:13:21 +0000 (18:13 -0500)
committerDennis Ritchie <dmr@research.uucp>
Tue, 26 Nov 1974 23:13:21 +0000 (18:13 -0500)
Work on file usr/source/s1/as28.s
Work on file usr/source/s1/as22.s
Work on file usr/source/s1/as17.s

Synthesized-from: v5

usr/source/s1/as17.s [new file with mode: 0644]
usr/source/s1/as22.s [new file with mode: 0644]
usr/source/s1/as28.s [new file with mode: 0644]

diff --git a/usr/source/s1/as17.s b/usr/source/s1/as17.s
new file mode 100644 (file)
index 0000000..7ec6359
--- /dev/null
@@ -0,0 +1,221 @@
+/
+/ copyright 1972 bell telephone laboratories inc.
+/
+
+/  a7 -- pdp-11 assembler pass 1
+
+expres:
+       mov     r5,-(sp)
+       mov     $'+,-(sp)
+       clr     opfound
+       clr     r2
+       mov     $1,r3
+       br      1f
+advanc:
+       jsr     pc,readop
+1:
+       mov     r4,r0
+       jsr     r5,betwen; 0; 177
+               br .+4
+       br      7f
+       movb    (r4),r0
+       mov     2(r4),r1
+       br      oprand
+7:
+       cmp     r4,$141
+       blo     1f
+       cmp     r4,$141+10.
+       bhis    2f
+       movb    curfbr-141(r4),r0
+       asl     r4
+       mov     curfb-[2*141](r4),r2
+       bpl     oprand
+       jsr     r5,error; 'f
+       br      oprand
+2:
+       clr     r3
+       clr     r2
+       br      oprand
+1:
+       mov     $esw1,r1
+1:
+       cmp     (r1)+,r4
+       beq     1f
+       tst     (r1)+
+       bne     1b
+       tst     opfound
+       bne     2f
+       jsr     pc,errore
+2:
+       tst     (sp)+
+       mov     (sp)+,r5
+       rts     pc
+1:
+       jmp     *(r1)
+
+esw1:
+       '+;     binop
+       '-;     binop
+       '*;     binop
+       '/;     binop
+       '&;     binop
+       037;    binop
+       035;    binop
+       036;    binop
+       '%;     binop
+       '[;     brack
+       '^;     binop
+       1;      exnum
+       '!;     binop
+       0;      0
+
+binop:
+       cmpb    (sp),$'+
+       beq     1f
+       jsr     pc,errore
+1:
+       movb    r4,(sp)
+       br      advanc
+
+exnum:
+       mov     numval,r1
+       mov     $1,r0
+       br      oprand
+
+brack:
+       mov     r2,-(sp)
+       mov     r3,-(sp)
+       jsr     pc,readop
+       jsr     pc,expres
+       cmp     r4,$']
+       beq     1f
+       jsr     r5,error; ']
+1:
+       mov     r3,r0
+       mov     r2,r1
+       mov     (sp)+,r3
+       mov     (sp)+,r2
+
+oprand:
+       inc     opfound
+       mov     $exsw2,r5
+1:
+       cmp     (sp),(r5)+
+       beq     1f
+       tst     (r5)+
+       bne     1b
+       br      eoprnd
+1:
+       jmp     *(r5)
+
+exsw2:
+       '+; exadd
+       '-; exsub
+       '*; exmul
+       '/; exdiv
+       037; exor
+       '&; exand
+       035;exlsh
+       036;exrsh
+       '%; exmod
+       '!; exnot
+       '^; excmbin
+       0;  0
+
+excmbin:
+       mov     r0,r3                   / give left flag of right
+       br      eoprnd
+
+exrsh:
+       neg     r1
+       beq     exlsh
+       inc     r1
+       clc
+       ror     r2
+exlsh:
+       jsr     r5,combin; 0
+       als     r1,r2
+       br      eoprnd
+
+exmod:
+       jsr     r5,combin; 0
+       mov     r1,-(sp)
+       mov     r2,r1
+       clr     r0
+       dvd     (sp)+,r0
+       mov     r1,r2
+       br      eoprnd
+
+exadd:
+       jsr     r5,combin; 0
+       add     r1,r2
+       br      eoprnd
+
+exsub:
+       jsr     r5,combin; 1
+       sub     r1,r2
+       br      eoprnd
+
+exand:
+       jsr     r5,combin; 0
+       com     r1
+       bic     r1,r2
+       br      eoprnd
+
+exor:
+       jsr     r5,combin; 0
+       bis     r1,r2
+       br      eoprnd
+
+exmul:
+       jsr     r5,combin; 0
+       mpy     r2,r1
+       mov     r1,r2
+       br      eoprnd
+
+exdiv:
+       jsr     r5,combin; 0
+       mov     r1,-(sp)
+       mov     r2,r1
+       clr     r0
+       dvd     (sp)+,r0
+       mov     r0,r2
+       br      eoprnd
+
+exnot:
+       jsr     r5,combin; 0
+       com     r1
+       add     r1,r2
+       br      eoprnd
+
+eoprnd:
+       mov     $'+,(sp)
+       jmp     advanc
+
+combin:
+       mov     r0,-(sp)
+       bis     r3,(sp)
+       bic     $!40,(sp)
+       bic     $!37,r0
+       bic     $!37,r3
+       cmp     r0,r3
+       ble     1f
+       mov     r0,-(sp)
+       mov     r3,r0
+       mov     (sp)+,r3
+1:
+       tst     r0
+       beq     1f
+       tst     (r5)+
+       beq     2f
+       cmp     r0,r3
+       bne     2f
+       mov     $1,r3
+       br      2f
+1:
+       tst     (r5)+
+       clr     r3
+2:
+       bis     (sp)+,r3
+       rts     r5
+
diff --git a/usr/source/s1/as22.s b/usr/source/s1/as22.s
new file mode 100644 (file)
index 0000000..49b74ad
--- /dev/null
@@ -0,0 +1,145 @@
+/
+/ copyright 1972 bell telephone laboratories inc.
+/
+
+/ a2 -- pdp-11 assembler pass 2
+
+outw:
+       cmp     dot-2,$4
+       beq     9f
+       bit     $1,dot
+       bne     1f
+       add     $2,dot
+       tstb    passno
+       beq     8f
+       clr     -(sp)
+       rol     r3
+       adc     (sp)
+       asr     r3              / get relative pc bit
+       cmp     r3,$40
+       bne     2f
+/ external references
+       mov     $666,outmod             / make nonexecutable
+       mov     xsymbol,r3
+       sub     $usymtab,r3
+       asl     r3
+       bis     $4,r3           / external relocation
+       br      3f
+2:
+       bic     $40,r3          / clear any ext bits
+       cmp     r3,$5
+       blo     4f
+       mov     $1,r3           / make absolute
+4:
+       cmp     r3,$2
+       blo     5f
+       cmp     r3,$4
+       bhi     5f
+       tst     (sp)
+       bne     4f
+       add     dotdot,r2
+       br      4f
+5:
+       tst     (sp)
+       beq     4f
+       sub     dotdot,r2
+4:
+       dec     r3
+       bpl     3f
+       clr     r3
+3:
+       asl     r3
+       bis     (sp)+,r3
+       mov     r2,r0
+       jsr     r5,putw; txtp
+       add     $2,*tseekp
+       mov     r3,r0
+       jsr     r5,putw; relp
+       add     $2,*rseekp
+8:
+       rts     pc
+1:
+       jsr     r5,error; 'o
+       clr     r3
+       jsr     pc,outb
+       rts     pc
+
+9:
+       jsr     r5,error; 'x
+       rts     pc
+
+outb:
+       cmp     dot-2,$4                / test bss mode
+       beq     9b
+       cmp     r3,$1
+       blos    1f
+       jsr     r5,error; 'r
+1:
+       tstb    passno
+       beq     2f
+       mov     r2,r0
+       bit     $1,dot
+       bne     1f
+       jsr     r5,putw; txtp
+       clr     r0
+       jsr     r5,putw; relp
+       add     $2,*rseekp
+       add     $2,*tseekp
+       br      2f
+1:
+       mov     txtp,r0
+       movb    r2,-1(r0)
+2:
+       inc     dot
+       rts     pc
+
+error:
+       mov     $666,outmod             / make nonexecutable
+       mov     r3,-(sp)
+       mov     r2,-(sp)
+       mov     r1,-(sp)
+       mov     r0,-(sp)
+       mov     $argb,r1
+1:
+       movb    (r1),ch
+       beq     1f
+       clrb    (r1)+
+       mov     $1,r0
+       sys     write; ch; 1
+       br      1b
+1:
+       mov     (r5)+,r0
+       movb    r0,0f
+       mov     line,r3
+       mov     $0f+6,r0
+       mov     $4,r1
+2:
+       clr     r2
+       dvd     $10.,r2
+       add     $'0,r3
+       movb    r3,-(r0)
+       mov     r2,r3
+       sob     r1,2b
+       mov     $1,r0
+       sys     write; 0f; 7
+       mov     (sp)+,r0
+       mov     (sp)+,r1
+       mov     (sp)+,r2
+       mov     (sp)+,r3
+       rts     r5
+
+       .data
+0:     <f xxxx\n>
+       .even
+       .text
+
+betwen:
+       cmp     r0,(r5)+
+       blt     1f
+       cmp     (r5)+,r0
+       blt     2f
+1:
+       tst     (r5)+
+2:
+       rts     r5
+
diff --git a/usr/source/s1/as28.s b/usr/source/s1/as28.s
new file mode 100644 (file)
index 0000000..6db1d32
--- /dev/null
@@ -0,0 +1,78 @@
+/
+/ copyright 1972 bell telephone laboratories inc.
+/
+
+/ as8 -- PDP-11 assembler pass 2
+
+qnl:   <?\n>
+a.out: <a.out\0>
+
+.even
+a.outp:        a.out
+
+       .data
+a.tmp1:        0
+a.tmp2:        0
+a.tmp3:        0
+
+tseekp:        txtseek
+rseekp:        trelseek
+
+txtmagic:
+       br      .+20
+txtsiz:        .=.+2
+datsiz:        .=.+2
+bsssiz:        .=.+2
+symsiz:        .=.+2
+stksiz:        .=.+2
+exorig:        .=.+2
+       .=.+2
+
+txtseek: 20
+datseek:.=.+2
+       .=.+2
+trelseek:.=.+2
+drelseek:.=.+2
+       .=.+2
+symseek:.=.+2
+
+.bss
+
+brlen  = 1024.
+brtab: .=.+[brlen\/8.]
+brtabp:        .=.+2
+brdelt:        .=.+2
+fbbufp:        .=.+2
+defund:        .=.+2
+savdot:        .=.+6
+datbase:.=.+2
+bssbase:.=.+2
+fbfil: .=.+2
+fin:   .=.+2
+ibufc: .=.+2
+txtfil:        .=.+2
+symf:  .=.+2
+adrbuf:        .=.+12.
+xsymbol:.=.+2
+fout:  .=.+2
+ch:    .=.+2
+wordf: .=.+2
+argb:  .=.+22.
+line:  .=.+2
+savop: .=.+2
+curfb: .=.+20.
+nxtfb: .=.+20.
+numval:        .=.+2
+maxtyp:        .=.+2
+relfil:        .=.+2
+ibufp: .=.+2
+txtp:  .=.+6+512.
+relp:  .=.+6+512.
+swapf: .=.+2
+rlimit:        .=.+2
+passno:        .=.+2
+endtable:.=.+2
+usymtab:.=.+20.
+end:
+
+.text