diff --git a/mach/pdp/libem/Makefile b/mach/pdp/libem/Makefile new file mode 100644 index 000000000..7bc76fc01 --- /dev/null +++ b/mach/pdp/libem/Makefile @@ -0,0 +1,39 @@ +l=../lib + +install: cp + +cp: all + cp head_em $l/head_em + cp tail_em $l/tail_em + rm -f head_em tail_em + +cmp: all + cmp head_em $l/head_em + cmp tail_em $l/tail_em + rm -f head_em tail_em + +all: head_em tail_em + +head_em: head_em.s + pdp -c head_em.s ; mv head_em.o head_em + +tail_em: tail_em.s.a + mkdir tmp; \ + cd tmp; \ + ar x ../tail_em.s.a; \ + for i in *.s; \ + do \ + pdp -c $$i; \ + done; \ + ar cr tail.a `lorder *.o | tsort`; \ + cp tail.a ../tail_em; \ + cd ..; \ + rm -r tmp + +clean: + -rm -f `ar t tail_em.s.a` ; rm -rf temp ; rm -f *.o +opr: + make pr | opr +pr: + @pr `pwd`/Makefile `pwd`/head_em.s + @ar pv tail_em.s.a | pr -h `pwd`/tail_em.s.a diff --git a/mach/pdp/libem/RT.s b/mach/pdp/libem/RT.s new file mode 100644 index 000000000..c6e14d3ca --- /dev/null +++ b/mach/pdp/libem/RT.s @@ -0,0 +1,10 @@ + .globl RT,RTr2,RTr2r4 + +RTr2r4: + mov (sp)+,r4 +RTr2: + mov (sp)+,r2 +RT: + mov r5,sp + mov (sp)+,r5 + rts pc diff --git a/mach/pdp/libem/aar.s b/mach/pdp/libem/aar.s new file mode 100644 index 000000000..5b98774dc --- /dev/null +++ b/mach/pdp/libem/aar.s @@ -0,0 +1,12 @@ +.text +.globl aar~ + +/r0 : description address +/r1 : element number +/base address is on stack +aar~: + sub (r0),r1 + mov 04(r0),r0 + mul r0,r1 + add r1,02(sp) + rts pc diff --git a/mach/pdp/libem/adf.s b/mach/pdp/libem/adf.s new file mode 100644 index 000000000..b3bfc9166 --- /dev/null +++ b/mach/pdp/libem/adf.s @@ -0,0 +1,13 @@ +.text +.globl adf~ +.globl setfloat~ + +/size in r0 +adf~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp)+,r0 + addf (sp)+,r0 + movf r0,-(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/adi.s b/mach/pdp/libem/adi.s new file mode 100644 index 000000000..8f896d7f6 --- /dev/null +++ b/mach/pdp/libem/adi.s @@ -0,0 +1,19 @@ +.text +.globl adi~ +.globl unknown~ + +/size in r0 +adi~: + mov (sp)+,r1 + cmp r0,$04 + bgt 1f + cmp r0,$02 + bgt 2f + add (sp)+,(sp) + jmp (r1) +2: add (sp)+,02(sp) + add (sp)+,02(sp) + adc (sp) + jmp (r1) +1: + jmp unknown~ diff --git a/mach/pdp/libem/and.s b/mach/pdp/libem/and.s new file mode 100644 index 000000000..76d6596ff --- /dev/null +++ b/mach/pdp/libem/and.s @@ -0,0 +1,13 @@ +.text +.globl and~ +.globl save1~ + +and~: + mov (sp)+,save1~ + mov sp,r1 + add r0,r1 + asr r0 +1: com (sp) + bic (sp)+,(r1)+ + sob r0,1b + jmp *save1~ diff --git a/mach/pdp/libem/blm.s b/mach/pdp/libem/blm.s new file mode 100644 index 000000000..73f47585b --- /dev/null +++ b/mach/pdp/libem/blm.s @@ -0,0 +1,28 @@ +.globl blm~ +.globl save~,retu~ + +/ Size in r0 +blm~: + jsr pc,save~ + mov (sp)+,r2 + mov (sp)+,r3 + mov r0,r1 + asr r0 + beq 2f +/ Now avoid wrong copy. +/ The pieces may overlap ! + cmp r3,r2 + beq 2f + blt 3f +1: + mov (r3)+,(r2)+ + sob r0,1b +2: + jmp retu~ +3: + add r1,r3 + add r1,r2 +4: + mov -(r3),-(r2) + sob r0,4b + br 2b diff --git a/mach/pdp/libem/cff.s b/mach/pdp/libem/cff.s new file mode 100644 index 000000000..c8c6c59df --- /dev/null +++ b/mach/pdp/libem/cff.s @@ -0,0 +1,14 @@ +.text +.globl cff~ +.globl setfloat~ + +cff~: + mov (sp)+,r1 + mov (sp)+,r0 + cmp (sp)+,r0 + beq 1f + jsr pc,setfloat~ + movof (sp)+,r0 + movf r0,-(sp) + setl +1: jmp (r1) diff --git a/mach/pdp/libem/cfi.s b/mach/pdp/libem/cfi.s new file mode 100644 index 000000000..8dbb51317 --- /dev/null +++ b/mach/pdp/libem/cfi.s @@ -0,0 +1,14 @@ +.text +.globl cfi~ +.globl setfloat~,setint~ + +cfi~: + mov (sp)+,r1 + mov (sp)+,r0 + jsr pc,setint~ + mov (sp)+,r0 + jsr pc,setfloat~ + movf (sp)+,r0 + movfi r0,-(sp) + setl;seti + jmp (r1) diff --git a/mach/pdp/libem/cif.s b/mach/pdp/libem/cif.s new file mode 100644 index 000000000..e7bf0dd34 --- /dev/null +++ b/mach/pdp/libem/cif.s @@ -0,0 +1,24 @@ +.text +.globl cif~,cuf~ +.globl setint~,setfloat~ + +cif~: + mov (sp)+,r1 + mov (sp)+,r0 + jsr pc,setfloat~ + mov (sp)+,r0 +1: jsr pc,setint~ + movif (sp)+,r0 + movf r0,-(sp) + setl;seti + jmp (r1) +cuf~: + mov (sp)+,r1 + mov (sp)+,r0 + jsr pc,setfloat~ + mov (sp)+,r0 + cmp r0,$02 + bne 1b + clr -(sp) + mov $04,r0 + br 1b diff --git a/mach/pdp/libem/cii.s b/mach/pdp/libem/cii.s new file mode 100644 index 000000000..fb442f722 --- /dev/null +++ b/mach/pdp/libem/cii.s @@ -0,0 +1,23 @@ +.text +.globl cii~ +.globl save1~ + +/convert int to int +/ 1 byte -> ? : sign extension +cii~: + mov (sp)+,save1~ + mov (sp)+,r0 + sub (sp)+,r0 + ble 1f + asr r0 + bcc 2f + movb (sp),r1 + mov r1,(sp) +2: tst r0 + beq 3f + tst (sp) +4: sxt -(sp) + sob r0,4b +3: jmp *save1~ +1: sub r0,sp + jmp *save1~ diff --git a/mach/pdp/libem/ciu.s b/mach/pdp/libem/ciu.s new file mode 100644 index 000000000..6ce2ee0a3 --- /dev/null +++ b/mach/pdp/libem/ciu.s @@ -0,0 +1,13 @@ +.text +.globl cuu~ +cuu~: + mov (sp)+,r1 + mov (sp)+,r0 + sub (sp)+,r0 + ble 1f + asr r0 +2: clr -(sp) + sob r0,2b + jmp (r1) +1: sub r0,sp + jmp (r1) diff --git a/mach/pdp/libem/cmf.s b/mach/pdp/libem/cmf.s new file mode 100644 index 000000000..abe6c956e --- /dev/null +++ b/mach/pdp/libem/cmf.s @@ -0,0 +1,19 @@ +.text +.globl cmf~ +.globl setfloat~ + +cmf~: + jsr pc,setfloat~ + mov (sp)+,r1 + movf (sp)+,r0 + movf (sp)+,r1 + clr r0 + cmpf r0,r1 + setl + cfcc + beq 1f + blt 2f + dec r0 + jmp (r1) +2: inc r0 +1: jmp (r1) diff --git a/mach/pdp/libem/cmi.s b/mach/pdp/libem/cmi.s new file mode 100644 index 000000000..c17775c3b --- /dev/null +++ b/mach/pdp/libem/cmi.s @@ -0,0 +1,17 @@ +.text +.globl cmi~ +.globl cmi4~,unknown~ + +/ Size in r0 +cmi~: + cmp r0,$02 + bne 1f + mov (sp)+,r1 + mov (sp)+,r0 + sub (sp)+,r0 + neg r0 + jmp (r1) +1: cmp r0,$04 + bne 2f + jmp cmi4~ +2: jmp unknown~ diff --git a/mach/pdp/libem/cmi4.s b/mach/pdp/libem/cmi4.s new file mode 100644 index 000000000..6aec66bfa --- /dev/null +++ b/mach/pdp/libem/cmi4.s @@ -0,0 +1,21 @@ +.text +.globl cmi4~ +.globl save1~ + +cmi4~: + mov (sp)+,r1 + clr r0 + cmp (sp),4(sp) + bgt 1f + blt 2f + cmp 2(sp),6(sp) + bhi 1f + beq 3f +2: + inc r0 + br 3f +1: + dec r0 +3: + add $10,sp + jmp (r1) diff --git a/mach/pdp/libem/cms.s b/mach/pdp/libem/cms.s new file mode 100644 index 000000000..9d7fedd8f --- /dev/null +++ b/mach/pdp/libem/cms.s @@ -0,0 +1,16 @@ +.text +.globl cms~ +.globl save~,retu~ + +cms~: + jsr pc,save~ + mov r0,r2 + add sp,r2 + mov r2,r4 + add r0,r4 + asr r0 +2: cmp (sp)+,(r2)+ + bne 1f + sob r0,2b +1: mov r4,sp + jmp retu~ diff --git a/mach/pdp/libem/cmu.s b/mach/pdp/libem/cmu.s new file mode 100644 index 000000000..11ccc459b --- /dev/null +++ b/mach/pdp/libem/cmu.s @@ -0,0 +1,22 @@ +.text +.globl cmu~ +.globl unknown~,cmu4~ + +cmu~: + cmp r0,$02 + bne 3f + mov (sp)+,r1 + clr r0 + cmp (sp)+,(sp)+ + beq 2f + bhi 1f + inc r0 + br 2f +1: + dec r0 +2: + jmp (r1) +3: cmp r0,$04 + bne 2f + jmp cmu4~ +2: jmp unknown~ diff --git a/mach/pdp/libem/cmu4.s b/mach/pdp/libem/cmu4.s new file mode 100644 index 000000000..e81f03861 --- /dev/null +++ b/mach/pdp/libem/cmu4.s @@ -0,0 +1,20 @@ + .text + .globl cmu4~ + .globl save~,retu~ +cmu4~: + mov (sp)+,r1 + clr r0 + cmp (sp),4(sp) + bhi 1f + blo 2f + cmp 2(sp),6(sp) + bhi 1f + beq 3f +2: + inc r0 + br 3f +1: + dec r0 +3: + add $10,sp + jmp (r1) diff --git a/mach/pdp/libem/csa.s b/mach/pdp/libem/csa.s new file mode 100644 index 000000000..46fb2d650 --- /dev/null +++ b/mach/pdp/libem/csa.s @@ -0,0 +1,21 @@ +.text +.globl csa~ +.globl fat~ + +ECASE = 20. + +csa~: + sub 02(r0),r1 + blt 1f + cmp 04(r0),r1 + blo 1f + asl r1 + add r1,r0 + mov 06(r0),r1 + beq 2f + jmp (r1) +1: mov (r0),r0 + beq 2f + jmp (r0) +2: mov $ECASE,-(sp) + jmp fat~ diff --git a/mach/pdp/libem/csb.s b/mach/pdp/libem/csb.s new file mode 100644 index 000000000..2feba2d88 --- /dev/null +++ b/mach/pdp/libem/csb.s @@ -0,0 +1,25 @@ +.text +.globl csb~ +.globl fat~ + +ECASE = 20. + +csb~: + mov r3,-(sp) + mov (r0)+,-(sp) + mov (r0)+,r3 + beq 1f +3: cmp (r0)+,r1 + beq 2f + tst (r0)+ + sob r3,3b +1: mov (sp)+,r1 + br 4f +2: tst (sp)+ + mov (r0),r1 +4: beq 5f + mov (sp)+,r3 + jmp (r1) +5: mov (sp)+,r3 + mov $ECASE,-(sp) + jmp fat~ diff --git a/mach/pdp/libem/dup.s b/mach/pdp/libem/dup.s new file mode 100644 index 000000000..a47ebc71b --- /dev/null +++ b/mach/pdp/libem/dup.s @@ -0,0 +1,12 @@ +.text +.globl dup~ +.globl save1~ + +dup~: + mov (sp)+,save1~ + mov sp,r1 + add r0,r1 + asr r0 +1: mov -(r1),-(sp) + sob r0,1b + jmp *save1~ diff --git a/mach/pdp/libem/dvf.s b/mach/pdp/libem/dvf.s new file mode 100644 index 000000000..db8b9e1a1 --- /dev/null +++ b/mach/pdp/libem/dvf.s @@ -0,0 +1,13 @@ +.text +.globl dvf~ +.globl setfloat~ + +dvf~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp)+,r0 + movf (sp)+,r1 + divf r0,r1 + movf r1,-(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/dvi.s b/mach/pdp/libem/dvi.s new file mode 100644 index 000000000..f50b93924 --- /dev/null +++ b/mach/pdp/libem/dvi.s @@ -0,0 +1,19 @@ +.text +.globl dvi~ +.globl save1~,unknown~,dvi4~ + +dvi~: + mov (sp)+,save1~ + cmp r0,$04 + bgt 1f + beq 2f + mov 02(sp),r1 + sxt r0 + div (sp)+,r0 + mov r0,(sp) + br 3f +2: jsr pc,dvi4~ + mov r1,-(sp) + mov r0,-(sp) +3: jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/dvi4.s b/mach/pdp/libem/dvi4.s new file mode 100644 index 000000000..0708330a2 --- /dev/null +++ b/mach/pdp/libem/dvi4.s @@ -0,0 +1,81 @@ +.text +.globl dvi4~ +.globl save~,retu~ + +dvi4~: + jsr pc,save~ + mov 02(sp),r3 + sxt r4 + bpl 1f + neg r3 +1: cmp r4,(sp) + bne hardldiv + mov 06(sp),r2 + mov 04(sp),r1 + bge 2f + neg r1 + neg r2 + sbc r1 + com r4 +2: mov r4,-(sp) + clr r0 + div r3,r0 + mov r0,-(sp) + mov r1,r0 + mov r1,r4 + mov r2,r1 + div r3,r0 + bvc 3f + mov r2,r1 + mov r4,r0 + sub r3,r0 + div r3,r0 + tst r1 + sxt r1 + add r1,r0 +3: mov r0,r1 + mov (sp)+,r0 + br 4f +hardldiv: + clr -(sp) + mov 010(sp),r2 + mov 06(sp),r1 + bpl 5f + com (sp) + neg r1 + neg r2 + sbc r1 +5: clr r0 + mov 02(sp),r3 + bge 6f + neg r3 + neg 04(sp) + sbc r3 + com (sp) +6: mov $16.,r4 +9: clc + rol r2 + rol r1 + rol r0 + cmp r3,r0 + bhi 7f + bcs 8f + cmp 04(sp),r1 + blos 8f +7: sob r4,9b + br 1f +8: sub 04(sp),r1 + sbc r0 + sub r3,r0 + inc r2 + sob r4,9b +1: + mov r2,r1 + clr r0 +4: tst (sp)+ + beq 1f + neg r0 + neg r1 + sbc r0 +1: add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/dvu.s b/mach/pdp/libem/dvu.s new file mode 100644 index 000000000..d70910c49 --- /dev/null +++ b/mach/pdp/libem/dvu.s @@ -0,0 +1,17 @@ +.text +.globl dvu~ +.globl save1~,unknown~,dvu4~,dvu2~ + +dvu~: + mov (sp)+,save1~ + cmp r0,$04 + bgt 1f + beq 2f + jsr pc,dvu2~ + mov r0,-(sp) + br 3f +2: jsr pc,dvu4~ + mov r1,-(sp) + mov r0,-(sp) +3: jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/dvu2.s b/mach/pdp/libem/dvu2.s new file mode 100644 index 000000000..2107c0365 --- /dev/null +++ b/mach/pdp/libem/dvu2.s @@ -0,0 +1,15 @@ +.text +.globl dvu2~ +dvu2~: + clr r0 + mov 04(sp),r1 + tst 02(sp) + blt 1f + div 02(sp),r0 +2: mov (sp)+,r1 + add $04,sp + jmp (r1) +1: cmp 02(sp),r1 + bhi 2b + inc r0 + br 2b diff --git a/mach/pdp/libem/dvu4.s b/mach/pdp/libem/dvu4.s new file mode 100644 index 000000000..974f1e083 --- /dev/null +++ b/mach/pdp/libem/dvu4.s @@ -0,0 +1,61 @@ +.text +.globl dvu4~ +.globl save~,retu~ + +dvu4~: + jsr pc,save~ + clr r0 + tst (sp) + bne harddvu4 + tst 02(sp) + blt harddvu4 + mov 06(sp),r2 + mov 04(sp),r1 + mov 02(sp),r3 + div r3,r0 + mov r0,-(sp) + mov r1,r0 + mov r1,r4 + mov r2,r1 + div r3,r0 + bvc 1f + mov r2,r1 + mov r4,r0 + sub r3,r0 + div r3,r0 + tst r1 + sxt r1 + add r1,r0 +1: mov r0,r1 + mov (sp)+,r0 + br 2f +harddvu4: + mov 06(sp),r2 + mov 04(sp),r1 + mov (sp),r3 + mov $17.,r4 + br 3f +6: rol r2 + rol r1 + rol r0 +3: cmp r3,r0 + bhi 4f + blo 5f + cmp 02(sp),r1 + blos 5f +4: clc + sob r4,6b + br 7f +5: sub 02(sp),r1 + sbc r0 + sub r3,r0 + sec + sob r4,6b +7: rol r2 + bcc 8f + mov $01,r0 + br 9f +8: clr r0 +9: mov r2,r1 +2: add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/eret.s b/mach/pdp/libem/eret.s new file mode 100644 index 000000000..cce078fa4 --- /dev/null +++ b/mach/pdp/libem/eret.s @@ -0,0 +1,8 @@ + .globl eret + +eret: + mov r5,sp + mov (sp)+,r5 + mov (sp)+,r4 + mov (sp)+,r2 + rts pc diff --git a/mach/pdp/libem/exg.s b/mach/pdp/libem/exg.s new file mode 100644 index 000000000..7b5119382 --- /dev/null +++ b/mach/pdp/libem/exg.s @@ -0,0 +1,18 @@ + .text + .globl exg~ +exg~: jsr pc,save~ + mov sp,r4 + sub r0,sp + mov sp,r3 + mov r0,r1 +1: + mov (r4)+,(r3)+ + sob r0,1b + asr r1 + mov sp,r4 +1: + mov (r4)+,(r3)+ + sob r1,1b + mov r4,sp + jmp retu~ + diff --git a/mach/pdp/libem/fef.s b/mach/pdp/libem/fef.s new file mode 100644 index 000000000..bd4b56a04 --- /dev/null +++ b/mach/pdp/libem/fef.s @@ -0,0 +1,13 @@ +.text +.globl fef~ +.globl setfloat~ + +fef~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp),r0 + movei r0,-(sp) + movie $0,r0 + movf r0,02(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/fif.s b/mach/pdp/libem/fif.s new file mode 100644 index 000000000..7382cfabe --- /dev/null +++ b/mach/pdp/libem/fif.s @@ -0,0 +1,13 @@ +.text +.globl fif~ +.globl setfloat~ + +fif~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp)+,r0 + modf (sp)+,r0 + movf r0,-(sp) + movf r1,-(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/gto.s b/mach/pdp/libem/gto.s new file mode 100644 index 000000000..845ae9232 --- /dev/null +++ b/mach/pdp/libem/gto.s @@ -0,0 +1,17 @@ +.text +.globl gto~ + +gto~: +; mov (sp)+,r4 +; mov 4(r4),r5 +; mov 2(r4),sp +; jmp *(r4) + + mov (sp)+,r3 +1: cmp 4(r3),r5 + jeq 2f + mov 2(r5),r4 + mov 4(r5),r2 + br 1b +2: mov 2(r3),sp + jmp *(r3) diff --git a/mach/pdp/libem/head_em.s b/mach/pdp/libem/head_em.s new file mode 100644 index 000000000..de7fba87e --- /dev/null +++ b/mach/pdp/libem/head_em.s @@ -0,0 +1,75 @@ + .globl LINO_AD,FILN_AD + .globl ERANGE,ESET,EHEAP,EILLINS,ECASE + .globl hol0,trppc~,trpim~,reghp~ + +rti = 2 +stst = 170300 ^ tst + +.float = 1 / this should be parameterized somehow +.hardfp = 1 / only relevant if .float on + +LINO_AD = 0. +FILN_AD = 4. + +ERANGE = 1. +ESET = 2. +EFOVFL = 4. +EFUNFL = 5. +EFDIVZ = 7. +EFUND = 9. +ECONV = 10. +EHEAP = 17. +EILLINS = 18. +ECASE = 20. + +.if .float +/ .globl fltused; fltused: +.if 1 - .hardfp +/ sys 48.;4.;fptrap / if not commented it will appear as undefined +.endif + sys 48.;8.;sig8 + ldfps $7600 +.endif + mov 2(sp),r0 + clr -2(r0) + mov sp,r0 + sub $4,sp + mov 4(sp),(sp) + tst (r0)+ + mov r0,2(sp) +1: + tst (r0)+ + bne 1b + cmp r0,*2(sp) + blo 1f + tst -(r0) +1: + mov r0,4(sp) + jsr pc,_m_a_i_n +/ next two lines for as long as tail needs printf +/ mov r0,-(sp) +/ jsr pc,*$_exit + sys 1. + + .data +hol0: 0;0 / line no + 0;0 / file +trppc~: 0 +trpim~: 0 +reghp~: _end + + .text +sig8: +.if .float + mov r0,-(sp) + stst r0 + mov 1f(r0),-(sp) + jsr pc,trp~ + sys 48.;8.;sig8 + mov (sp)+,r0 + rti + + .data +1: EILLINS; EILLINS; EFDIVZ; ECONV; EFOVFL; EFUNFL; EFUND; EILLINS + .text +.endif diff --git a/mach/pdp/libem/hlt.s b/mach/pdp/libem/hlt.s new file mode 100644 index 000000000..799feaedc --- /dev/null +++ b/mach/pdp/libem/hlt.s @@ -0,0 +1,10 @@ +.text +.globl hlt~ + +exit = 1 + +hlt~: + mov (sp)+,r0 + bne 1f + sys exit +1: 4 diff --git a/mach/pdp/libem/iaar.s b/mach/pdp/libem/iaar.s new file mode 100644 index 000000000..317d91745 --- /dev/null +++ b/mach/pdp/libem/iaar.s @@ -0,0 +1,18 @@ +.text +.globl iaar~ +.globl aar~,trp~ + +EILLINS = 18. + +iaar~: + mov (sp)+,r0 + cmp (sp)+,$02 + bne 1f + mov 02(sp),r1 + mov r0,02(sp) + mov (sp)+,r0 + jmp aar~ +1: mov $EILLINS,-(sp) + jsr pc,trp~ + add $06,sp + jmp (r0) diff --git a/mach/pdp/libem/ilar.s b/mach/pdp/libem/ilar.s new file mode 100644 index 000000000..0b36a8778 --- /dev/null +++ b/mach/pdp/libem/ilar.s @@ -0,0 +1,18 @@ +.text +.globl ilar~ +.globl lar~,trp~ + +EILLINS = 18. + +ilar~: + mov (sp)+,r0 + cmp (sp)+,$02 + bne 1f + mov 02(sp),r1 + mov r0,02(sp) + mov (sp)+,r0 + jmp lar~ +1: mov $EILLINS,-(sp) + jsr pc,trp~ + add $06,sp + jmp (r0) diff --git a/mach/pdp/libem/inn.s b/mach/pdp/libem/inn.s new file mode 100644 index 000000000..fdd1cd677 --- /dev/null +++ b/mach/pdp/libem/inn.s @@ -0,0 +1,22 @@ +.text +.globl inn~ + +inn~: + mov r0,-(sp) + clr r0 + div $010,r0 + cmp r0,(sp) + bcc 1f + add sp,r0 + add $4,r0 + bitb bits(r1),(r0) + beq 1f + mov $01,r0 + br 2f +1: clr r0 +2: mov 02(sp),r1 + add (sp)+,sp + tst (sp)+ + jmp (r1) +.data +bits: .byte 1,2,4,10,20,40,100,200 diff --git a/mach/pdp/libem/isar.s b/mach/pdp/libem/isar.s new file mode 100644 index 000000000..5a3c1863c --- /dev/null +++ b/mach/pdp/libem/isar.s @@ -0,0 +1,18 @@ +.text +.globl isar~ +.globl sar~,trp~ + +EILLINS = 18. + +isar~: + mov (sp)+,r0 + cmp (sp)+,$02 + bne 1f + mov 02(sp),r1 + mov r0,02(sp) + mov (sp)+,r0 + jmp sar~ +1: mov $EILLINS,-(sp) + jsr pc,trp~ + add $06,sp + jmp (r0) diff --git a/mach/pdp/libem/lar.s b/mach/pdp/libem/lar.s new file mode 100644 index 000000000..d242f21d7 --- /dev/null +++ b/mach/pdp/libem/lar.s @@ -0,0 +1,20 @@ +.text +.globl lar~ +.globl save1~ + +lar~: + mov (sp)+,save1~ + sub (r0),r1 + mov 04(r0),r0 + mul r0,r1 + add (sp)+,r1 + add r0,r1 + asr r0 + beq 1f +2: mov -(r1),-(sp) + sob r0,2b + jmp *save1~ +1: clr r0 + bisb -(r1),r0 + mov r0,-(sp) + jmp *save1~ diff --git a/mach/pdp/libem/los2.s b/mach/pdp/libem/los2.s new file mode 100644 index 000000000..e270e7d09 --- /dev/null +++ b/mach/pdp/libem/los2.s @@ -0,0 +1,16 @@ +.text +.globl los2~ +.globl save1~ + +los2~: + mov (sp)+,save1~ + cmp r0,$01 + bne 1f + clr -(sp) + bisb (r1),(sp) + jmp *save1~ +1: add r0,r1 + asr r0 +2: mov -(r1),-(sp) + sob r0,2b + jmp *save1~ diff --git a/mach/pdp/libem/mlf.s b/mach/pdp/libem/mlf.s new file mode 100644 index 000000000..b5b355a30 --- /dev/null +++ b/mach/pdp/libem/mlf.s @@ -0,0 +1,12 @@ +.text +.globl mlf~ +.globl setfloat~ + +mlf~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp)+,r0 + mulf (sp)+,r0 + movf r0,-(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/mli.s b/mach/pdp/libem/mli.s new file mode 100644 index 000000000..80399e941 --- /dev/null +++ b/mach/pdp/libem/mli.s @@ -0,0 +1,19 @@ +.text +.globl mli~ +.globl save1~,unknown~,mli4~ + +mli~: + cmp r0,$04 + bgt 1f + beq 2f + mov (sp)+,r0 + mov (sp)+,r1 + mul (sp)+,r1 + mov r1,-(sp) + jmp (r0) +2: mov (sp)+,save1~ + jsr pc,mli4~ + mov r1,-(sp) + mov r0,-(sp) + jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/mli4.s b/mach/pdp/libem/mli4.s new file mode 100644 index 000000000..b8f0d0798 --- /dev/null +++ b/mach/pdp/libem/mli4.s @@ -0,0 +1,19 @@ +.text +.globl mli4~ +.globl save~,retu~ + +mli4~: + jsr pc,save~ + mov 02(sp),r2 + sxt r1 + sub (sp),r1 + mov 06(sp),r0 + sxt r3 + sub 04(sp),r3 + mul r0,r1 + mul r2,r3 + add r1,r3 + mul r2,r0 + sub r3,r0 + add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/mlu.s b/mach/pdp/libem/mlu.s new file mode 100644 index 000000000..8bd5c9188 --- /dev/null +++ b/mach/pdp/libem/mlu.s @@ -0,0 +1,19 @@ +.text +.globl mlu~ +.globl save1~,unknown~,mlu4~ + +mlu~: + cmp r0,$04 + bgt 1f + beq 2f + mov (sp)+,r0 + mov (sp)+,r1 + mul (sp)+,r1 + mov r1,-(sp) + jmp (r0) +2: mov (sp)+,save1~ + jsr pc,mlu4~ + mov r1,-(sp) + mov r0,-(sp) + jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/mlu4.s b/mach/pdp/libem/mlu4.s new file mode 100644 index 000000000..46f8c2358 --- /dev/null +++ b/mach/pdp/libem/mlu4.s @@ -0,0 +1,23 @@ +.text +.globl mlu4~ +.globl save~,retu~ + +mlu4~: + jsr pc,save~ + clr r0 + mov 02(sp),r1 + mov 06(sp),r3 + mul r3,r0 + tst r3 + bge 1f + ashc $15.,r0 +1: mov 02(sp),r3 + clr r2 + mul 04(sp),r2 + add r3,r0 + mov 06(sp),r3 + clr r2 + mul (sp),r2 + add r3,r0 + add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/mon.s b/mach/pdp/libem/mon.s new file mode 100644 index 000000000..a4a61adb0 --- /dev/null +++ b/mach/pdp/libem/mon.s @@ -0,0 +1,145 @@ +.text +.globl mon~ +.globl sigtrp~,save~,retu~,save1~ + +indir = 0 +fork = 2 +getpid = 20. +sigtrp = 48. +EBADMON = 25. + +HBMASK = 0177400 +REG01M = 030 +REG1M = 020 +ERRMASK = 040 + +/ Associated with every monitor call is a descriptor. +/ The low order three bits describe how values are returned, +/ the next two bits specify if arguments are expected in +/ r0 and/or r1, the next bit is not used, and the next +/ three bits specify the number of arguments disregarding +/ arguments in registers. + +mon~: + cmp 02(sp),$sigtrp + bne 1f + jmp sigtrp~ +1: jsr pc,save~ + mov (sp)+,r4 + mov r4,r2 + asl r4 + mov args(r4),r3 + mov r3,r4 + bit $ERRMASK,r4 + bne err + cmp r2,$fork + bne 2f + jbr fork~ +2: bic $HBMASK,r2 + bis $sys,r2 + mov r2,9f + bit $REG01M,r3 + beq 1f + mov (sp)+,r0 + bit $REG1M,r3 + beq 1f + mov (sp)+,r1 +1: ash $-6,r3 + beq 2f + mov $[9f+2],r2 +1: mov (sp)+,(r2)+ + sob r3,1b +2: sys indir ; 9f + bcs 2f + clr r3 +4: asr r4 + bcc 1f + mov r0,-(sp) +1: asr r4 + bcc 1f + mov r1,-(sp) +1: asr r4 + bcc 1f + clr -(sp) +1: jmp retu~ +2: mov r0,-(sp) + mov r0,-(sp) + jmp retu~ +fork~: + sys fork + br 1f + bcs 2b + clr r1 + br 4b +1: mov $1,r1 + br 4b +err: + mov $EBADMON,-(sp) + jsr pc,trp~ + tst (sp)+ + jmp retu~ +.data +.even +9: .=.+12. +args: ERRMASK / 0 : error + 010 / 1 : exit(st); --- + 07 / 2 : fork(); e10 + 0215 / 3 : read(addr,nb,fild); e-0 + 0215 / 4 : write(addr,nb,fild); e-0 + 0205 / 5 : open(str,flag); e-0 + 014 / 6 : close(fild); e-- + 07 / 7 : wait(); e10 + 0205 / 8 : creat(str,mode); e-0 + 0204 / 9 : link(str1,str2); e-- + 0104 /10 : unlink(str); e-- + ERRMASK /11 : error + 0104 /12 : chdir(str); e-- + 03 /13 : time(); -10 + 0304 /14 : mknod(str,mode,addr); e-- + 0204 /15 : chmod(str,mode); e-- + 0304 /16 : chown(str,owner,grp); e-- + ERRMASK /17 : error + 0204 /18 : stat(str,buf); e-- + 0217 /19 : lseek(high,low,fild); e10 + 01 /20 : getpid(); --0 + 0304 /21 : mount(str1,str2,fl); e-- + 0104 /22 : umount(str); e-- + 014 /23 : setuid(uid); e-- + 03 /24 : getuid(); -01 + 024 /25 : stime(high,low); e-- + 0315 /26 : ptrace(pid,addr,req,d); e-0 + 011 /27 : alarm(sec); --0 + 0114 /28 : fstat(buf,fild); e-- + 0 /29 : pause(); --- + 0204 /30 : utime(str,timep); e-- + ERRMASK /31 : error + ERRMASK /32 : error + 0204 /33 : access(str,mode): e-- + 010 /34 : nice(incr); --- + 0100 /35 : ftime(bufp); --- + 0 /36 : sync(); --- + 0114 /37 : kill(sig,pid); e-- + ERRMASK /38 : error + ERRMASK /39 : error + ERRMASK /40 : error + 025 /41 : dup(fild,newfild); e-0 + 07 /42 : pipe(); e10 + 0100 /43 : times(buf); --- + 0400 /44 : profil(buff,siz,off,sc); --- + ERRMASK /45 : error + 014 /46 : setgid(gid); e-- + 03 /47 : getgid(); -01 + 0 /48 : sigtrp(trap,sig); e-0; SPECIAL TREATMENT + ERRMASK /49 : error + ERRMASK /50 : error + 0104 /51 : acct(file); e-- + 0304 /52 : phys(seg,siz,phaddr); e-- + 0104 /53 : lock(flag); e-- + 0304 /54 : ioctl(fild,req,argp); e-- + ERRMASK /55 : error + 0204 /56 : mpxcall(cmd,vec); e-- + ERRMASK /57 : error + ERRMASK /58 : error + 0304 /59 : exece(name,argv,envp); e-- + 0104 /60 : umask(complmode); e-- + 0104 /61 : chroot(str); e-- diff --git a/mach/pdp/libem/ngf.s b/mach/pdp/libem/ngf.s new file mode 100644 index 000000000..64c1d2fe3 --- /dev/null +++ b/mach/pdp/libem/ngf.s @@ -0,0 +1,10 @@ +.text +.globl ngf~ +.globl setfloat~ + +ngf~: + mov (sp)+,r1 + jsr pc,setfloat~ + negf (sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/ngi.s b/mach/pdp/libem/ngi.s new file mode 100644 index 000000000..db248cbab --- /dev/null +++ b/mach/pdp/libem/ngi.s @@ -0,0 +1,17 @@ +.text +.globl ngi~ +.globl unknown~ + +ngi~: + mov (sp)+,r1 + cmp r0,$02 + bgt 1f + neg (sp) + jmp (r1) +1: cmp r0,$04 + bgt 2f + neg (sp) + neg 02(sp) + sbc (sp) + jmp (r1) +2: jmp unknown~ diff --git a/mach/pdp/libem/nop.s b/mach/pdp/libem/nop.s new file mode 100644 index 000000000..bb11d432d --- /dev/null +++ b/mach/pdp/libem/nop.s @@ -0,0 +1,12 @@ +.text +.globl nop~ +.globl hol0,prf~ + +nop~: + mov hol0,-(sp) + mov $fmt,-(sp) + jsr pc,prf~ + add $04,sp + rts pc +.data +fmt: diff --git a/mach/pdp/libem/prf.s b/mach/pdp/libem/prf.s new file mode 100644 index 000000000..d93b8c6f5 --- /dev/null +++ b/mach/pdp/libem/prf.s @@ -0,0 +1,33 @@ +.text +.globl prf~ +.globl save~,retu~,hol0,_printf + +prf~: + jsr pc,save~ + mov hol0,-(sp) + mov hol0+4,r0 + beq 1f + mov r0,r2 + mov $40.,r1 +3: movb (r2)+,r3 + beq 2f + cmpb r3,$0177 + bge 1f + cmpb r3,$040 + blt 1f + sob r1,3b + clrb (r2) +2: mov sp,r1 + mov r1,-(sp) + mov r0,-(sp) + mov $fmt,-(sp) + jsr pc,_printf + add $010,sp + jsr pc,_printf + jmp retu~ +1: mov $name,r0 + br 2b + +.data +fmt: <"%s", sp = %d, line %d: \0> +name: <_unknown file_\0> diff --git a/mach/pdp/libem/printf.s b/mach/pdp/libem/printf.s new file mode 100644 index 000000000..f690ae1e8 --- /dev/null +++ b/mach/pdp/libem/printf.s @@ -0,0 +1,62 @@ +.text +.globl _printf + +write = 4 + +_printf: + mov r2,-(sp) + mov r3,-(sp) + mov r4,-(sp) + mov sp,r3 + mov $buff,r4 + add $010,r3 + mov (r3)+,r2 +prloop: + movb (r2)+,r0 + beq ready + cmpb r0,$045 + bne 1f + movb (r2)+,r0 + cmpb r0,$0144 + beq 2f + cmpb r0,$0163 + beq 3f +1: movb r0,(r4)+ + br prloop +2: mov (r3)+,r1 + bge 4f + movb $055,(r4)+ + neg r1 +4: jsr pc,printn + br prloop +printn: + clr r0 + div $010,r0 + beq 5f + mov r1,-(sp) + mov r0,r1 + jsr pc,printn + mov (sp)+,r1 +5: add $060,r1 + movb r1,(r4)+ + rts pc +3: mov (r3)+,r1 +7: movb (r1)+,r0 + bne 6f + br prloop +6: movb r0,(r4)+ + br 7b +ready: + movb r0,(r4)+ + sub $buff,r4 + mov $01,r0 + mov $buff,9f + mov r4,9f+2 + sys write +9: 0; 0 + mov (sp)+,r4 + mov (sp)+,r3 + mov (sp)+,r2 + rts pc +.data +buff: .=.+256. diff --git a/mach/pdp/libem/rck.s b/mach/pdp/libem/rck.s new file mode 100644 index 000000000..029ef5a5c --- /dev/null +++ b/mach/pdp/libem/rck.s @@ -0,0 +1,15 @@ +.text +.globl rck~ +.globl trp~ + +ERANGE = 1 + +rck~: + mov (sp)+,r1 + cmp (sp),(r0) + blt 1f + cmp (sp),02(r0) + ble 2f +1: mov $ERANGE,-(sp) + jsr pc,trp~ +2: jmp (r1) diff --git a/mach/pdp/libem/ret.s b/mach/pdp/libem/ret.s new file mode 100644 index 000000000..718948bc9 --- /dev/null +++ b/mach/pdp/libem/ret.s @@ -0,0 +1,31 @@ +.text +.globl ret~,lfr~,retar +.globl save1~ +.globl unknown~ + +/ Size in r0 +ret~: + mov r0,r1 + beq 1f + asr r1 + add $retar,r0 + cmp r0,$retend + bhi 9f +3: mov (sp)+,-(r0) + sob r1,3b +1: mov r5,sp + mov (sp)+,r5 + rts pc +9: jmp unknown~ +lfr~: + mov (sp)+,save1~ + asr r0 + beq 4f + mov $retar,r1 +5: mov (r1)+,-(sp) + sob r0,5b +4: jmp *save1~ + +.data +retar: .=.+16. +retend: diff --git a/mach/pdp/libem/rmi.s b/mach/pdp/libem/rmi.s new file mode 100644 index 000000000..ce36fb8f4 --- /dev/null +++ b/mach/pdp/libem/rmi.s @@ -0,0 +1,19 @@ +.text +.globl rmi~ +.globl save1~,unknown~,rmi4~ + +rmi~: + mov (sp)+,save1~ + cmp r0,$04 + bgt 1f + beq 2f + mov 02(sp),r1 + sxt r0 + div (sp)+,r0 + mov r1,(sp) + br 3f +2: jsr pc,rmi4~ + mov r1,-(sp) + mov r0,-(sp) +3: jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/rmi4.s b/mach/pdp/libem/rmi4.s new file mode 100644 index 000000000..a1e2eb413 --- /dev/null +++ b/mach/pdp/libem/rmi4.s @@ -0,0 +1,75 @@ +.text +.globl rmi4~ +.globl save~,retu~ + +rmi4~: + jsr pc,save~ + mov 02(sp),r3 + sxt r4 + bpl 1f + neg r3 +1: cmp r4,(sp) + bne hardrmi4 + mov 06(sp),r2 + mov 04(sp),r1 + mov r1,r4 + bge 2f + neg r1 + neg r2 + sbc r1 +2: mov r4,-(sp) + clr r0 + div r3,r0 + mov r1,r0 + mov r1,r4 + mov r2,r1 + div r3,r0 + bvc 3f + mov r2,r1 + mov r4,r0 + sub r3,r0 + div r3,r0 + tst r1 + beq 3f + add r3,r1 +3: tst (sp)+ + bpl 4f + neg r1 +4: sxt r0 + br 9f +hardrmi4: + mov 06(sp),r2 + mov 04(sp),r1 + bpl 5f + neg r1 + neg r2 + sbc r1 +5: clr r0 + mov (sp),r3 + bge 6f + neg r3 + neg 02(sp) + sbc r3 +6: mov $16.,r4 +1: clc + rol r2 + rol r1 + rol r0 + cmp r3,r0 + bhi 7f + bcs 8f + cmp 02(sp),r1 + blos 8f +7: sob r4,1b + br 2f +8: sub 02(sp),r1 + sbc r0 + sub r3,r0 + sob r4,1b +2: tst 04(sp) + bge 9f + neg r0 + neg r1 + sbc r0 +9: add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/rmu.s b/mach/pdp/libem/rmu.s new file mode 100644 index 000000000..a73830e17 --- /dev/null +++ b/mach/pdp/libem/rmu.s @@ -0,0 +1,19 @@ +.text +.globl rmu~ +.globl save1~,rmu2~,rmu4~,unknown~ + +rmu~: + mov (sp)+,save1~ + cmp r0,$04 + bgt 1f + beq 2f + cmp r0,$02 + bne 1f + jsr pc,rmu2~ + mov r1,-(sp) + jmp *save1~ +2: jsr pc,rmu4~ + mov r1,-(sp) + mov r0,-(sp) + jmp *save1~ +1: jmp unknown~ diff --git a/mach/pdp/libem/rmu2.s b/mach/pdp/libem/rmu2.s new file mode 100644 index 000000000..77c0cfbcd --- /dev/null +++ b/mach/pdp/libem/rmu2.s @@ -0,0 +1,16 @@ +.text +.globl rmu2~ + +rmu2~: + mov 04(sp),r1 + tst 02(sp) + blt 1f + clr r0 + div 02(sp),r0 +2: mov (sp)+,r0 + add $04,sp + jmp (r0) +1: cmp 02(sp),r1 + bhi 2b + sub 02(sp),r1 + br 2b diff --git a/mach/pdp/libem/rmu4.s b/mach/pdp/libem/rmu4.s new file mode 100644 index 000000000..2d6f0d0aa --- /dev/null +++ b/mach/pdp/libem/rmu4.s @@ -0,0 +1,52 @@ +.text +.globl rmu4~ +.globl save~,retu~ + +rmu4~: + jsr pc,save~ + clr r0 + tst (sp) + bne hardrmu4 + tst 02(sp) + blt hardrmu4 + mov 06(sp),r2 + mov 04(sp),r1 + mov 02(sp),r3 + div r3,r0 + mov r1,r0 + mov r1,r4 + mov r2,r1 + div r3,r0 + bvc 1f + mov r2,r1 + mov r4,r0 + sub r3,r0 + div r3,r0 + tst r1 + beq 1f + add r3,r1 +1: clr r0 + br 2f +hardrmu4: + mov 06(sp),r2 + mov 04(sp),r1 + mov (sp),r3 + mov $17.,r4 + br 3f +6: clc + rol r2 + rol r1 + rol r0 +3: cmp r3,r0 + bhi 4f + bcs 5f + cmp 02(sp),r1 + blos 5f +4: sob r4,6b + br 2f +5: sub 02(sp),r1 + sbc r0 + sub r3,r0 + sob r4,6b +2: add $010,sp + jmp retu~ diff --git a/mach/pdp/libem/rol.s b/mach/pdp/libem/rol.s new file mode 100644 index 000000000..20790807e --- /dev/null +++ b/mach/pdp/libem/rol.s @@ -0,0 +1,19 @@ +.text +.globl rol~ +.globl save~,retu~ + +rol~: + jsr pc,save~ + mov (sp)+,r3 +3: add r0,sp + mov r0,r1 + asr r1 + clc +1: rol -(sp) + sob r1,1b + bcc 2f + mov sp,r1 + add r0,r1 + bis $01,-(r1) +2: sob r3,3b + jmp retu~ diff --git a/mach/pdp/libem/ror.s b/mach/pdp/libem/ror.s new file mode 100644 index 000000000..7c62e9917 --- /dev/null +++ b/mach/pdp/libem/ror.s @@ -0,0 +1,18 @@ +.text +.globl ror~ +.globl save~,retu~ + +ror~: + asr r0 + jsr pc,save~ + mov (sp)+,r3 +3: mov sp,r1 + mov r0,-(sp) + clc +1: ror (r1)+ + sob r0,1b + bcc 2f + bis $0100000,02(sp) +2: mov (sp)+,r0 + sob r3,3b + jmp retu~ diff --git a/mach/pdp/libem/sar.s b/mach/pdp/libem/sar.s new file mode 100644 index 000000000..d94bb3fed --- /dev/null +++ b/mach/pdp/libem/sar.s @@ -0,0 +1,17 @@ +.text +.globl sar~ +.globl save1~ + +sar~: + mov (sp)+,save1~ + sub (r0),r1 + mov 04(r0),r0 + mul r0,r1 + add (sp)+,r1 + asr r0 + beq 1f +2: mov (sp)+,(r1)+ + sob r0,2b + jmp *save1~ +1: movb (sp)+,(r1) + jmp *save1~ diff --git a/mach/pdp/libem/save.s b/mach/pdp/libem/save.s new file mode 100644 index 000000000..533ba5909 --- /dev/null +++ b/mach/pdp/libem/save.s @@ -0,0 +1,25 @@ +.text +.globl save~,retu~,save1~ + +save~: + mov r5,savearea + mov $[savearea+2],r5 + mov r4,(r5)+ + mov r3,(r5)+ + mov r2,(r5)+ + mov (sp)+,r2 + mov (sp)+,(r5)+ + jmp (r2) +retu~: + mov -(r5),-(sp) + mov -(r5),r2 + mov -(r5),r3 + mov -(r5),r4 + mov -(r5),r5 + rts pc + +.data +.even +savearea: + .=.+12. +save1~: 0 diff --git a/mach/pdp/libem/sbf.s b/mach/pdp/libem/sbf.s new file mode 100644 index 000000000..d45e9610b --- /dev/null +++ b/mach/pdp/libem/sbf.s @@ -0,0 +1,13 @@ +.text +.globl sbf~ +.globl setfloat~ + +sbf~: + mov (sp)+,r1 + jsr pc,setfloat~ + movf (sp)+,r0 + subf (sp)+,r0 + negf r0 + movf r0,-(sp) + setl + jmp (r1) diff --git a/mach/pdp/libem/sbi.s b/mach/pdp/libem/sbi.s new file mode 100644 index 000000000..79755db06 --- /dev/null +++ b/mach/pdp/libem/sbi.s @@ -0,0 +1,18 @@ +.text +.globl sbi~ +.globl unknown~ + +sbi~: + mov (sp)+,r1 + cmp r0,$04 + bgt 1f + cmp r0,$02 + bgt 2f + sub (sp)+,(sp) + jmp (r1) +2: sub (sp)+,02(sp) + sub (sp)+,02(sp) + sbc (sp) + jmp (r1) +1: + jmp unknown~ diff --git a/mach/pdp/libem/set.s b/mach/pdp/libem/set.s new file mode 100644 index 000000000..d7972519b --- /dev/null +++ b/mach/pdp/libem/set.s @@ -0,0 +1,24 @@ +.text +.globl set~ +.globl save~,retu~,trp~ + +ESET = 2 + +set~: + jsr pc,save~ + mov r0,r2 + asr r0 +1: clr -(sp) + sob r0,1b + div $8.,r0 + cmp r0,r2 + blo 2f + mov $ESET,-(sp) + jsr pc,trp~ + jmp retu~ +2: add sp,r0 + bisb bits(r1),(r0) + jmp retu~ + +.data +bits: .byte 1,2,4,10,20,40,100,200 diff --git a/mach/pdp/libem/setfl.s b/mach/pdp/libem/setfl.s new file mode 100644 index 000000000..00d0540c4 --- /dev/null +++ b/mach/pdp/libem/setfl.s @@ -0,0 +1,21 @@ +.text +.globl setfloat~,setint~ +.globl unknown~ + +setfloat~: + cmp r0,$8. + bne 1f + rts pc +1: cmp r0,$04 + bne 3f + setf +2: rts pc +3: jmp unknown~ +setint~: + cmp r0,$04 + bne 4f + setl + rts pc +4: cmp r0,$02 + bne 3b +5: rts pc diff --git a/mach/pdp/libem/sigtrp.s b/mach/pdp/libem/sigtrp.s new file mode 100644 index 000000000..8ee37269f --- /dev/null +++ b/mach/pdp/libem/sigtrp.s @@ -0,0 +1,92 @@ +.text +.globl sigtrp~ +.globl trp~,save~,retu~ + +indir = 0 +signal = 48. + +rti = 2 + +sig1: mov sig.trp+0.,-(sp) + br 1f +sig2: mov sig.trp+2.,-(sp) + br 1f +sig3: mov sig.trp+4.,-(sp) + br 1f +sig4: mov sig.trp+6.,-(sp) + br 1f +sig5: mov sig.trp+8.,-(sp) + br 1f +sig6: mov sig.trp+10.,-(sp) + br 1f +sig7: mov sig.trp+12.,-(sp) + br 1f +sig10: mov sig.trp+18.,-(sp) + br 1f +sig11: mov sig.trp+20.,-(sp) + br 1f +sig12: mov sig.trp+22.,-(sp) + br 1f +sig13: mov sig.trp+24.,-(sp) + br 1f +sig14: mov sig.trp+026.,-(sp) + br 1f +sig15: mov sig.trp+028.,-(sp) + br 1f +sig16: mov sig.trp+030.,-(sp) + br 1f +1: + jsr pc,trp~ + rti + +sigtrp~: + jsr pc,save~ + tst (sp)+ + mov (sp)+,r1 + mov (sp)+,r0 + ble sig.bad + cmp r0,$16. + bhi sig.bad + mov r0,call+02 + asl r0 + mov sig.trp-2(r0),r3 + cmp r1,$256. + bhis 1f + mov sig.adr-2(r0),r2 + bne 2f +sig.bad: + mov $-1,r0 +sigbad: + mov r0,-(sp) + mov r0,-(sp) + jmp retu~ +1: cmp r1,$-3 + blo sig.bad + mov r1,r2 + inc r2 + inc r2 +2: mov r1,sig.trp-2(r0) + mov r2,call+04 + sys indir ; call + bcs sigbad + asr r0 + bcc 1f + mov $-3,-(sp) + clr -(sp) + jmp retu~ +1: mov r3,-(sp) + clr -(sp) + jmp retu~ + +.data +call: sys signal; 0; 0 +sig.trp: + -2; -2; -2; -2 + -2; -2; -2; -2 + -2; -2; -2; -2 + -2; -2; -2; -2 +sig.adr: + sig1; sig2; sig3; sig4 + sig5; sig6; sig7; 0 + 0; sig10; sig11; sig12 + sig13; sig14; sig15; sig16 diff --git a/mach/pdp/libem/sim.s b/mach/pdp/libem/sim.s new file mode 100644 index 000000000..7599b77ff --- /dev/null +++ b/mach/pdp/libem/sim.s @@ -0,0 +1,28 @@ +.text +.globl sim~ +.globl trpim~,save1~ + +.float = 1 + +sim~: + mov (sp)+,save1~ + mov (sp)+,r0 + mov r0,trpim~ +.if .float + stfps r1 + bis $07400,r1 + bit $020,r0 + beq 0f + bic $01000,r1 +0: bit $040,r0 + beq 0f + bic $02000,r1 +0: bit $01000,r0 + beq 0f + bic $04000,r1 +0: bit $02000,r0 + beq 0f + bic $0400,r1 +0: ldfps r1 +.endif + jmp *save1~ diff --git a/mach/pdp/libem/sli.s b/mach/pdp/libem/sli.s new file mode 100644 index 000000000..5b39ee2fd --- /dev/null +++ b/mach/pdp/libem/sli.s @@ -0,0 +1,22 @@ +.text +.globl sli~ +.globl save1~,unknown~ + +sli~: + mov (sp)+,save1~ + cmp r0,$02 + bgt 1f + mov (sp)+,r1 + mov (sp)+,r0 + ash r1,r0 + mov r0,-(sp) + jmp *save1~ +1: cmp r0,$04 + bgt 2f + mov 02(sp),r0 + mov 04(sp),r1 + ashc (sp)+,r0 + mov r0,(sp) + mov r1,02(sp) + jmp *save1~ +2: jmp unknown~ diff --git a/mach/pdp/libem/sri.s b/mach/pdp/libem/sri.s new file mode 100644 index 000000000..5620ee981 --- /dev/null +++ b/mach/pdp/libem/sri.s @@ -0,0 +1,25 @@ +.text +.globl sri~ +.globl unknown~,save1~ + +/ Size in r0 +sri~: + mov (sp)+,save1~ + cmp r0,$02 + bgt 1f + mov (sp)+,r1 + mov (sp)+,r0 + neg r1 + ash r1,r0 + mov r0,-(sp) + jmp *save1~ +1: cmp r0,$04 + bgt 2f + mov 02(sp),r0 + mov 04(sp),r1 + neg (sp) + ashc (sp)+,r0 + mov r0,(sp) + mov r1,02(sp) + jmp *save1~ +2: jmp unknown~ diff --git a/mach/pdp/libem/sru.s b/mach/pdp/libem/sru.s new file mode 100644 index 000000000..5f2ebef46 --- /dev/null +++ b/mach/pdp/libem/sru.s @@ -0,0 +1,30 @@ +.text +.globl sru~,slu~ +.globl save1~,unknown~ + +sru~: + neg 2(sp) +slu~: + mov (sp)+,save1~ + cmp r0,$02 + bgt 1f + mov 2(sp),r1 + clr r0 + ashc (sp)+,r0 +2: mov r1,-(sp) + jmp *save1~ +1: cmp r0,$04 + bgt 3f + mov 02(sp),r0 + mov 04(sp),r1 + tst (sp) + beq 4f + ashc $-1,r0 + bic $0100000,r0 + inc (sp) + beq 4f + ashc (sp)+,r0 +4: mov r0,(sp) + mov r1,02(sp) + jmp *save1~ +3: jmp unknown~ diff --git a/mach/pdp/libem/sto2.s b/mach/pdp/libem/sto2.s new file mode 100644 index 000000000..3260bd722 --- /dev/null +++ b/mach/pdp/libem/sto2.s @@ -0,0 +1,15 @@ +.text +.globl sto2~ +.globl save1~ + +sto2~: + mov (sp)+,save1~ + cmp r0,$01 + bne 1f + movb (sp),(r1) + tst (sp)+ + jmp *save1~ +1: asr r0 +2: mov (sp)+,(r1)+ + sob r0,2b + jmp *save1~ diff --git a/mach/pdp/libem/strhp.s b/mach/pdp/libem/strhp.s new file mode 100644 index 000000000..47fd56bc3 --- /dev/null +++ b/mach/pdp/libem/strhp.s @@ -0,0 +1,24 @@ +.text +.globl strhp~ +.globl fat~,reghp~,_end +indir = 0 + +break = 17. +EHEAP = 17. + +strhp~: + mov (sp)+,r0 + mov (sp)+,r1 + mov r1,reghp~ + cmp r1,2f+2 + blos 1f + add $01777,r1 + bic $01777,r1 + mov r1,2f+2 + sys indir ; 2f + bcs 3f +1: jmp (r0) +3: mov $EHEAP,-(sp) + jmp fat~ +.data +2: sys break; _end diff --git a/mach/pdp/libem/trp.s b/mach/pdp/libem/trp.s new file mode 100644 index 000000000..1fd18ef01 --- /dev/null +++ b/mach/pdp/libem/trp.s @@ -0,0 +1,60 @@ +.text +.globl trp~,fat~ +.globl trppc~,trpim~ + write=4. + +fat~: + jsr pc,trp~ + 4 + +trp~: + mov r0,-(sp) + mov 04(sp),r0 + mov 02(sp),04(sp) + mov (sp),02(sp) + mov r1,(sp) + cmp r0,$16. + jhis 0f + mov $01,r1 + ashc r0,r1 + bit r1,trpim~ + bne 8f +0: mov r2,-(sp) + mov r3,-(sp) + mov r4,-(sp) + movf r0,-(sp) + movf r1,-(sp) + movf r2,-(sp) + movf r3,-(sp) + stfps -(sp) + mov r0,-(sp) + mov trppc~,r0 + beq 9f + clr trppc~ + jsr pc,(r0) + tst (sp)+ + ldfps (sp)+ + movf (sp)+,r3 + movf (sp)+,r2 + movf (sp)+,r1 + movf (sp)+,r0 + mov (sp)+,r4 + mov (sp)+,r3 + mov (sp)+,r2 +8: mov (sp)+,r1 + mov (sp)+,r0 + rts pc +9: mov (sp)+,r0 + mov $buf+11,r1 + mov $4,r2 +1: mov r0,r3 + bic $177770,r3 + bisb r3,-(r1) + ash $-3,r0 + sob r2,1b + mov $2,r0 + sys write;buf;11. + 4 + +.data +buf: diff --git a/mach/pdp/libem/unknown.s b/mach/pdp/libem/unknown.s new file mode 100644 index 000000000..623f0b11c --- /dev/null +++ b/mach/pdp/libem/unknown.s @@ -0,0 +1,9 @@ +.text +.globl unknown~ +.globl fat~ + +EILLSIZ = 19. + +unknown~: + mov $EILLSIZ,-(sp) + jmp fat~ diff --git a/mach/pdp/libem/xor.s b/mach/pdp/libem/xor.s new file mode 100644 index 000000000..213205963 --- /dev/null +++ b/mach/pdp/libem/xor.s @@ -0,0 +1,13 @@ +.globl xor~ +.globl save~,retu~ + +xor~: + jsr pc,save~ + mov sp,r1 + add r0,r1 + asr r0 +1: + mov (sp)+,r2 + xor r2,(r1)+ + sob r0,1b + jmp retu~