From c0d87aaa1641ce33361a83512d3c503f3e11d2a8 Mon Sep 17 00:00:00 2001 From: keie Date: Thu, 7 Feb 1985 22:06:32 +0000 Subject: [PATCH] *** empty log message *** --- mach/m68k4/libem/aciaio.s | 33 ++++++++++++ mach/m68k4/libem/ara.s | 103 ++++++++++++++++++++++++++++++++++++++ mach/m68k4/libem/ari.s | 36 +++++++++++++ mach/m68k4/libem/cii.s | 24 +++++++++ mach/m68k4/libem/cmi.s | 22 ++++++++ mach/m68k4/libem/cmp.s | 19 +++++++ mach/m68k4/libem/cms.s | 22 ++++++++ mach/m68k4/libem/cmu.s | 29 +++++++++++ mach/m68k4/libem/csa.s | 29 +++++++++++ mach/m68k4/libem/csb.s | 28 +++++++++++ mach/m68k4/libem/cuu.s | 21 ++++++++ mach/m68k4/libem/cvf.s | 16 ++++++ mach/m68k4/libem/dia.s | 37 ++++++++++++++ mach/m68k4/libem/dvi.s | 42 ++++++++++++++++ mach/m68k4/libem/dvu.s | 34 +++++++++++++ mach/m68k4/libem/exg.s | 26 ++++++++++ mach/m68k4/libem/fat.s | 7 +++ mach/m68k4/libem/inn.s | 31 ++++++++++++ mach/m68k4/libem/lfr.s | 25 +++++++++ mach/m68k4/libem/los.s | 36 +++++++++++++ mach/m68k4/libem/mli.s | 36 +++++++++++++ mach/m68k4/libem/mlu.s | 47 +++++++++++++++++ mach/m68k4/libem/mon.s | 12 +++++ mach/m68k4/libem/nop.s | 13 +++++ mach/m68k4/libem/printf.s | 77 ++++++++++++++++++++++++++++ mach/m68k4/libem/rck.s | 20 ++++++++ mach/m68k4/libem/ret.s | 26 ++++++++++ mach/m68k4/libem/sav.s | 13 +++++ mach/m68k4/libem/set.s | 32 ++++++++++++ mach/m68k4/libem/shp.s | 23 +++++++++ mach/m68k4/libem/sig.s | 13 +++++ mach/m68k4/libem/sts.s | 33 ++++++++++++ mach/m68k4/libem/trp.s | 29 +++++++++++ 33 files changed, 994 insertions(+) create mode 100644 mach/m68k4/libem/aciaio.s create mode 100644 mach/m68k4/libem/ara.s create mode 100644 mach/m68k4/libem/ari.s create mode 100644 mach/m68k4/libem/cii.s create mode 100644 mach/m68k4/libem/cmi.s create mode 100644 mach/m68k4/libem/cmp.s create mode 100644 mach/m68k4/libem/cms.s create mode 100644 mach/m68k4/libem/cmu.s create mode 100644 mach/m68k4/libem/csa.s create mode 100644 mach/m68k4/libem/csb.s create mode 100644 mach/m68k4/libem/cuu.s create mode 100644 mach/m68k4/libem/cvf.s create mode 100644 mach/m68k4/libem/dia.s create mode 100644 mach/m68k4/libem/dvi.s create mode 100644 mach/m68k4/libem/dvu.s create mode 100644 mach/m68k4/libem/exg.s create mode 100644 mach/m68k4/libem/fat.s create mode 100644 mach/m68k4/libem/inn.s create mode 100644 mach/m68k4/libem/lfr.s create mode 100644 mach/m68k4/libem/los.s create mode 100644 mach/m68k4/libem/mli.s create mode 100644 mach/m68k4/libem/mlu.s create mode 100644 mach/m68k4/libem/mon.s create mode 100644 mach/m68k4/libem/nop.s create mode 100644 mach/m68k4/libem/printf.s create mode 100644 mach/m68k4/libem/rck.s create mode 100644 mach/m68k4/libem/ret.s create mode 100644 mach/m68k4/libem/sav.s create mode 100644 mach/m68k4/libem/set.s create mode 100644 mach/m68k4/libem/shp.s create mode 100644 mach/m68k4/libem/sig.s create mode 100644 mach/m68k4/libem/sts.s create mode 100644 mach/m68k4/libem/trp.s diff --git a/mach/m68k4/libem/aciaio.s b/mach/m68k4/libem/aciaio.s new file mode 100644 index 000000000..eabc9a63f --- /dev/null +++ b/mach/m68k4/libem/aciaio.s @@ -0,0 +1,33 @@ +.define .outch1,.outch2,.inch1,.inch2 + + ! a0,d4 used + ! character in d1 + + .text +.inch1: + move.l #acia1,a0 + bra .inch +.inch2: + move.l #acia2,a0 +.inch: + move.b (a0),d1 + asr #1,d1 + bcc .inch + move.b 2(a0),d1 + and #0x7f,d1 + rts + +.outch1: + move.l #acia1,a0 + bra .outch +.outch2: + move.l #acia2,a0 +.outch: + move.b (a0),d4 + asr #2,d4 + bcc .outch + move.b d1,2(a0) + rts + + +.align 2 diff --git a/mach/m68k4/libem/ara.s b/mach/m68k4/libem/ara.s new file mode 100644 index 000000000..24869056d --- /dev/null +++ b/mach/m68k4/libem/ara.s @@ -0,0 +1,103 @@ +.define .sar +.define .lar +.define .aar + + !register usage: + ! a0 : descriptor address + ! d0 : index + ! a1 : base address + .text +.aar: + movem.l d0/d1/a0/a1,.savreg + move.l (sp)+,.retara ! return address + move.l (sp)+,a0 ! descriptor address + move.l (sp)+,d0 ! index + move.l (sp)+,a1 ! base address + sub.l (a0),d0 ! index - lower bound : relative index + move.l 8(a0),-(sp) ! # bytes / element + move.l d0,-(sp) + jsr .mlu + add.l d1,a1 ! address of element + move.l a1,-(sp) ! returned on stack + move.l .retara,-(sp) + movem.l d0/d1/a0/a1,.savreg + rts + + +.lar: + ! register usage: like .aar + ! d2 : # bytes / element + + movem.l d0/d1/d2/a0/a1,.savreg + move.l (sp)+,.retara ! return address + move.l (sp)+,a0 + move.l (sp)+,d0 + move.l (sp)+,a1 + sub.l (a0),d0 + move.l 8(a0),d2 ! # bytes / element + move.l d0,-(sp) + move.l d2,-(sp) + jsr .mlu + add.l d1,a1 ! address of element + add.l d2,a1 ! a1++ because of predecrement + clr.l d1 !?nodig? + asr #1,d2 + bne 3f + move.b -(a1),d1 ! 1 byte element + move.l d1,-(sp) + bra 5f +3: + asr #1,d2 + bne 4f + move.w -(a1),d1 ! 2 byte element + move.l d1,-(sp) + bra 5f +4: + sub.l #1,d2 +1: + move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...) + dbf d2,1b +5: + move.l .retara,-(sp) + movem.l .savreg,d0/d1/d2/a0/a1 + rts + + +.sar: + !register usage: same as lar + + movem.l d0/d1/a0/a1,.savreg + move.l (sp)+,.retara + move.l (sp)+,a0 + move.l (sp)+,d0 + move.l (sp)+,a1 + sub.l (a0),d0 + move.l 8(a0),d2 ! # bytes / element + move.l d0,-(sp) + move.l d2,-(sp) + jsr .mlu + add.l d1,a1 + clr.l d1 !?nodig? + asr #1,d2 + bne 3f + move.l (sp)+,d1 + move.b d1,(a1) ! 1 byte element + bra 4f +3: + asr #1,d2 + bne 5f + move.l (sp)+,d1 + move.w d1,(a1) ! 2 byte element + bra 4f +5: + sub.l #1,d2 +1: + move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...) + dbf d2,1b +4: + move.l .retara,-(sp) + movem.l .savreg,d0/d1/a0/a1 + rts +.data +.retara: .long 0 +.align 2 diff --git a/mach/m68k4/libem/ari.s b/mach/m68k4/libem/ari.s new file mode 100644 index 000000000..19d642608 --- /dev/null +++ b/mach/m68k4/libem/ari.s @@ -0,0 +1,36 @@ +.define .sari +.define .lari +.define .aari + + .text +.aari: + move.l (sp)+,.retari ! return address + cmp.l #4, (sp)+ ! size of descriptor elements + bne 9f + jsr .aar + move.l .retari,-(sp) + rts + + +.lari: + move.l (sp)+,.retari ! return address + cmp.l #4, (sp)+ ! size of descriptor elements + bne 9f + jsr .lar + move.l .retari,-(sp) + rts +9: + move.w #EILLINS,-(sp) + jmp .fat + + +.sari: + move.l (sp)+,.retari ! return address + cmp.l #4, (sp)+ ! size of descriptor elements + bne 9b + jsr .sar + move.l .retari,-(sp) + rts +.data +.retari: .long 0 +.align 2 diff --git a/mach/m68k4/libem/cii.s b/mach/m68k4/libem/cii.s new file mode 100644 index 000000000..fc827aa5a --- /dev/null +++ b/mach/m68k4/libem/cii.s @@ -0,0 +1,24 @@ +.define .cii + + .text +.cii: + movem.l a0/d0/d1,.savreg + move.l (sp)+,a0 ! return address + move (sp)+,d0 ! destination size + sub (sp)+,d0 ! destination - source size + bgt 1f + sub d0,sp ! pop extra bytes + bra 3f +1: + move (sp),d1 + ext.l d1 + swap d1 + asr #1,d0 +2: + move.w d1,-(sp) + dbf d0,2b +3: + move.l a0,-(sp) + movem.l .savreg,a0/d0/d1 + rts +.align 2 diff --git a/mach/m68k4/libem/cmi.s b/mach/m68k4/libem/cmi.s new file mode 100644 index 000000000..79616ba5e --- /dev/null +++ b/mach/m68k4/libem/cmi.s @@ -0,0 +1,22 @@ +.define .cmi, .cmi_ + + ! NUM == 4 + ! result in d1 + .text +.cmi: +.cmi_: + move.l (sp)+,.savret + move.l d0,.savd0 + move.l #1,d1 + move.l (sp)+,d0 + cmp.l (sp)+,d0 + bne 1f + clr.l d1 + 1: + ble 2f + neg.l d1 + 2: + move.l .savd0,d0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/cmp.s b/mach/m68k4/libem/cmp.s new file mode 100644 index 000000000..61bdabba6 --- /dev/null +++ b/mach/m68k4/libem/cmp.s @@ -0,0 +1,19 @@ +.define .cmp + + .text +.cmp: + move.l (sp)+,.savret ! return address + move.l d0,.savd0 + move.l #1,d1 + move.l (sp)+,d0 + cmp.l (sp)+,d0 + bne 1f + clr.l d1 + 1: + bcs 2f + neg.l d1 + 2: + move.l .savd0,d0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/cms.s b/mach/m68k4/libem/cms.s new file mode 100644 index 000000000..7b67d0fe7 --- /dev/null +++ b/mach/m68k4/libem/cms.s @@ -0,0 +1,22 @@ +.define .cms + + ! d0 contains set size + + .text +.cms: + move.l (sp)+,a2 ! return address + move.l sp,a0 + move.l sp,a1 + add d0,a1 + move.w d0,d1 + asr #1,d0 +1: + cmp (a0)+,(a1)+ + bne 2f + dbf d0,1b +2: + asl #1,d1 + add d1,sp + move.l d0,-(sp) + jmp (a2) +.align 2 diff --git a/mach/m68k4/libem/cmu.s b/mach/m68k4/libem/cmu.s new file mode 100644 index 000000000..b69ef89cd --- /dev/null +++ b/mach/m68k4/libem/cmu.s @@ -0,0 +1,29 @@ +.define .cmu + + ! d0 : # bytes of 1 block + .text +.cmu: + movem.l d2/a0/a1/a2,.savreg + move.l (sp)+,a2 ! reta + move.l sp,a0 ! top block + move.l sp,a1 + add.l d0,a1 ! lower block + move.l d0,d2 + asr.l #2,d0 + sub.l #1,d0 + move.l #1,d1 ! greater +1: + cmp.l (a0)+,(a1)+ + bne 2f + dbf d0,1b + clr.l d1 ! equal +2: + bcc 3f + neg.l d1 ! less +3: + asl.l #1,d2 + add.l d2,sp ! new sp + move.l a2,-(sp) + movem.l .savreg,d2/a0/a1/a2 + rts +.align 2 diff --git a/mach/m68k4/libem/csa.s b/mach/m68k4/libem/csa.s new file mode 100644 index 000000000..3f81ce1c0 --- /dev/null +++ b/mach/m68k4/libem/csa.s @@ -0,0 +1,29 @@ +.define .csa + + .text +.csa: + movem.l d0/a0/a1/a2,.savreg + move.l (sp)+,a0 ! case descriptor + move.l (sp)+,d0 ! index + move.l (a0)+,a1 ! default address + sub.l (a0)+,d0 ! index - lower bound + blt 1f + cmp.l (a0)+,d0 ! rel. index <-> upper - lower bound + bgt 1f + asl.l #2,d0 + add.l d0,a0 + move.l (a0),d0 ! test jump address + beq 1f + move.l d0,-(sp) + bra 3f +1: + move.l a1,d0 ! test default jump address + beq 2f + move.l a1,-(sp) ! jump address +3: + movem.l .savreg,d0/a0/a1/a2 + rts ! not a real rts +2: + move.w #ECASE,-(sp) + jmp .fat +.align 2 diff --git a/mach/m68k4/libem/csb.s b/mach/m68k4/libem/csb.s new file mode 100644 index 000000000..88ed8043f --- /dev/null +++ b/mach/m68k4/libem/csb.s @@ -0,0 +1,28 @@ +.define .csb + + .text +.csb: + movem.l d0/d1/a0/a1,.savreg + move.l (sp)+,a0 ! case descriptor + move.l (sp)+,d0 ! index + move.l (a0)+,a1 ! default jump address + move.l (a0)+,d1 ! # entries + beq 2f + sub.l #1,d1 +1: + cmp.l (a0)+,d0 + beq 3f + tst.l (a0)+ ! skip jump address + dbf d1,1b +2: + move.l a1,d1 ! default jump address + bne 4f + move.l #ECASE,-(sp) + jmp .fat +3: + move.l (a0)+,a1 ! get jump address +4: + move.l a1,-(sp) + movem.l .savreg,d0/d1/a0/a1 + rts +.align 2 diff --git a/mach/m68k4/libem/cuu.s b/mach/m68k4/libem/cuu.s new file mode 100644 index 000000000..3e56221ee --- /dev/null +++ b/mach/m68k4/libem/cuu.s @@ -0,0 +1,21 @@ +.define .ciu +.define .cui +.define .cuu + + .text +.ciu: +.cui: +.cuu: + move.l (sp)+,a0 ! return address + move (sp)+,d0 ! destination size + sub (sp)+,d0 + bgt 1f + sub d0,sp + jmp (a0) +1: + asr #1,d0 +2: + clr -(sp) + dbf d0,2b + jmp (a0) +.align 2 diff --git a/mach/m68k4/libem/cvf.s b/mach/m68k4/libem/cvf.s new file mode 100644 index 000000000..59cc742ba --- /dev/null +++ b/mach/m68k4/libem/cvf.s @@ -0,0 +1,16 @@ +.define .cfi,.cif,.cfu,.cuf,.cff + + .text + + ! this is a dummy float conversion routine +.cfi: +.cif: +.cfu: +.cuf: +.cff: + move.l (sp)+,a0 ! return address + move (sp)+,d0 ! destination size + sub (sp)+,d0 ! diff. in sizes + sub d0,sp + jmp (a0) +.align 2 diff --git a/mach/m68k4/libem/dia.s b/mach/m68k4/libem/dia.s new file mode 100644 index 000000000..a9d7a0bd3 --- /dev/null +++ b/mach/m68k4/libem/dia.s @@ -0,0 +1,37 @@ +.define .diagnos + +space = 040 +del = 0177 + + .text +.diagnos: + move.l hol0,-(sp) + move.l hol0+FILN_AD,d2 + beq 1f + move.l d2,a0 + move.l #40,d0 +3: + move.b (a0)+,d1 + beq 2f + cmp.b #del,d1 + bge 1f + cmp.b #space,d1 + blt 1f + sub #1,d0 + bgt 3b + clr.b (a1) +2: + move.l d2,-(sp) + pea fmt + jsr _printf + add #12,sp + jmp _printf + +1: + move.l #unknwn,d2 + bra 2b + + .data +fmt: .asciz "%s, line %d: " +unknwn: .asciz "unknown file" +.align 2 diff --git a/mach/m68k4/libem/dvi.s b/mach/m68k4/libem/dvi.s new file mode 100644 index 000000000..fc74fb4dd --- /dev/null +++ b/mach/m68k4/libem/dvi.s @@ -0,0 +1,42 @@ +.define .dvi + + ! signed long divide + .text +.dvi: + movem.l d0/d4,.savdvi + move.l (sp)+,.retdvi + move.l (sp)+,d0 + move.l (sp)+,d1 + clr.l d4 + tst.l d0 ! divisor + bpl 1f + neg.l d0 + not d4 +1: + tst.l d1 ! dividend + bpl 2f + neg.l d1 + not d4 + swap d4 + not d4 + swap d4 +2: + move.l d1,-(sp) + move.l d0,-(sp) + jsr .dvu + tst d4 + beq 5f + neg.l d1 ! quotient +5: + tst.l d4 + bpl 6f + neg.l d2 ! remainder +6: + movem.l .savdvi,d0/d4 + move.l .retdvi,-(sp) + rts +.data +.savdvi: .space 12 +.retdvi: .long 0 +.text +.align 2 diff --git a/mach/m68k4/libem/dvu.s b/mach/m68k4/libem/dvu.s new file mode 100644 index 000000000..9f595d6fe --- /dev/null +++ b/mach/m68k4/libem/dvu.s @@ -0,0 +1,34 @@ +.define .dvu + + ! unsigned long divide + ! register usage: + ! : d0 divisor + ! d1 dividend + ! exit : d1 quotient + ! d2 remainder + .text +.dvu: + movem.l d0/d3,.savreg + move.l (sp)+,.savret + move.l (sp)+,d0 + move.l (sp)+,d1 + tst.l d0 + bne 0f + move.w #EIDIVZ,-(sp) + jsr .trp +0: + clr.l d2 + move.l #31,d3 +3: + lsl.l #1,d1 + roxl.l #1,d2 + cmp.l d0,d2 + blt 4f + sub.l d0,d2 + add #1,d1 +4: + dbf d3,3b + movem.l .savreg,d0/d3 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/exg.s b/mach/m68k4/libem/exg.s new file mode 100644 index 000000000..0107f799e --- /dev/null +++ b/mach/m68k4/libem/exg.s @@ -0,0 +1,26 @@ +.define .exg + + ! d0 : exchange size in bytes + .text +.exg: + move.l (sp)+,.savret + movem.l d1/a1/a2,.savreg + move.l sp,a1 + sub.l d0,sp + move.l sp,a2 + asr #1,d0 + move.l d0,d1 +1: + move.l (a1)+,(a2)+ + sub #1,d0 + bgt 1b + move.l sp,a1 + asr #1,d1 +1: + move.l (a1)+,(a2)+ + sub #1,d1 + bgt 1b + move.l a1,sp + movem.l .savreg,d1/a1/a2 + move.l .savret,-(sp) + rts diff --git a/mach/m68k4/libem/fat.s b/mach/m68k4/libem/fat.s new file mode 100644 index 000000000..e6fbbb032 --- /dev/null +++ b/mach/m68k4/libem/fat.s @@ -0,0 +1,7 @@ +.define .fat + + .text +.fat: + jsr .trp + jmp EXIT +.align 2 diff --git a/mach/m68k4/libem/inn.s b/mach/m68k4/libem/inn.s new file mode 100644 index 000000000..83e1c9256 --- /dev/null +++ b/mach/m68k4/libem/inn.s @@ -0,0 +1,31 @@ +.define .inn + +! d0 : set size in bytes +! d1 : bitnumber + + .text +.inn: + movem.l d1/d2/a0/a1,.savreg + move.l (sp)+,.savret + move.l (sp)+,d1 + move.l sp,a1 + add.l d0,a1 + move.l sp,a0 + move.l d1,d2 + asr.l #4,d2 + !bchg.l #0,d2 + cmp.l d0,d2 + bcc 1f + add.l d2,a0 + move.l (a0),d2 + btst d1,d2 !eigenlijk .l + beq 1f + move.l #1,d0 + bra 2f +1: + clr.l d0 +2: + move.l a1,sp + movem.l .savreg,d1/d2/a0/a1 + move.l .savret,-(sp) + rts diff --git a/mach/m68k4/libem/lfr.s b/mach/m68k4/libem/lfr.s new file mode 100644 index 000000000..51c066976 --- /dev/null +++ b/mach/m68k4/libem/lfr.s @@ -0,0 +1,25 @@ +.define .lfr + + .text +.lfr: + move.l (sp)+,a0 + cmp #2,d7 + bne 1f + move d0,-(sp) + bra 3f +1: + cmp #4,d7 + bne 2f + move.l d0,-(sp) + bra 3f +2: + cmp #8,d7 + bne 4f + move.l d1,-(sp) + move.l d0,-(sp) +3: + jmp(a0) +4: + move.w #EILLINS,-(sp) + jmp .fat +.align 2 diff --git a/mach/m68k4/libem/los.s b/mach/m68k4/libem/los.s new file mode 100644 index 000000000..c15dc814d --- /dev/null +++ b/mach/m68k4/libem/los.s @@ -0,0 +1,36 @@ +.define .los + + ! d0 : # bytes + ! a0 : source address + .text +.los: + movem.l d0/a0,.savreg + move.l (sp)+,.savret + move.l (sp)+,d0 + move.l (sp)+,a0 + cmp.l #1,d0 + bne 1f + clr.l d0 !1 byte + move.b (a0),d0 + move.l d0,-(sp) + bra 3f +1: + cmp.l #2,d0 + bne 2f + clr.l d0 !2 bytes + add.l #2,a0 + move.w (a0),d0 + move.l d0,-(sp) + bra 3f +2: + add.l d0,a0 !>=4 bytes + asr.l #2,d0 + +4: move.l -(a0),-(sp) + sub.l #1,d0 + bgt 4b +3: + movem.l .savreg,d0/a0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/mli.s b/mach/m68k4/libem/mli.s new file mode 100644 index 000000000..fe2e0ddce --- /dev/null +++ b/mach/m68k4/libem/mli.s @@ -0,0 +1,36 @@ +.define .mli + + + .text +.mli: + move.l d5,.savmli + move.l (sp)+,.retmli + move.l (sp)+,d1 + move.l (sp)+,d0 + clr d5 + tst.l d0 + bpl 1f + neg.l d0 + not d5 +1: + tst.l d1 + bpl 2f + neg.l d1 + not d5 +2: + move.l d0,-(sp) + move.l d1,-(sp) + jsr .mlu + tst d5 + beq 3f + neg.l d1 + negx.l d0 +3: + move.l .savmli,d5 + move.l .retmli,-(sp) + rts +.data +.savmli: .long 0 +.retmli: .long 0 +.text +.align 2 diff --git a/mach/m68k4/libem/mlu.s b/mach/m68k4/libem/mlu.s new file mode 100644 index 000000000..0235ec262 --- /dev/null +++ b/mach/m68k4/libem/mlu.s @@ -0,0 +1,47 @@ +.define .mlu + + ! entry : d0 multiplicand + ! d1 multiplier + ! exit : d0 high order result + ! d1 low order result + + .text +.mlu: + move.l (sp)+,.savret + move.l (sp)+,d1 + move.l (sp)+,d0 + cmp.l #32768,d0 + bgt 1f + cmp.l #32768,d1 + bls 2f +1: movem.l d2/d3/d4/d6,.savreg + move.l d1,d3 + move.l d1,d2 + swap d2 + move.l d2,d4 + mulu d0,d1 + mulu d0,d2 + swap d0 + mulu d0,d3 + mulu d4,d0 + clr.l d6 + swap d1 + add d2,d1 + addx.l d6,d0 + add d3,d1 + addx.l d6,d0 + swap d1 + clr d2 + clr d3 + swap d2 + swap d3 + add.l d2,d0 + add.l d3,d0 + movem.l .savreg,d2/d3/d4/d6 + move.l .savret,-(sp) + rts +2: mulu d0,d1 + clr d0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/mon.s b/mach/m68k4/libem/mon.s new file mode 100644 index 000000000..dabe65a92 --- /dev/null +++ b/mach/m68k4/libem/mon.s @@ -0,0 +1,12 @@ +.define .mon + .text +.mon: + move.l (sp)+,a0 + pea fmt + jsr .diagnos + add #6,sp + jmp EXIT + + .data +fmt: .asciz "system call %d not implemented" +.align 2 diff --git a/mach/m68k4/libem/nop.s b/mach/m68k4/libem/nop.s new file mode 100644 index 000000000..9b8f3dd8e --- /dev/null +++ b/mach/m68k4/libem/nop.s @@ -0,0 +1,13 @@ +.define .nop + + .text +.nop: + move.l hol0,-(sp) + pea fmt + jsr .diagnos + add.l #8,sp + rts + + .data +fmt: .asciz "test %d\n" +.align 2 diff --git a/mach/m68k4/libem/printf.s b/mach/m68k4/libem/printf.s new file mode 100644 index 000000000..287cb0217 --- /dev/null +++ b/mach/m68k4/libem/printf.s @@ -0,0 +1,77 @@ +.define _printf +.define _putchar +.define _getal +.define _char +.bss +_getal: + .space 12 +_char: + .space 1 +.data +sav: + .long 0 +.text +_printf: + movem.l d0/d1/d3/a0/a1/a2/a3/a4/a5/a6,.savreg + move.l (sp)+,sav !return address + move.l sp,a6 !a6 <- address of arguments + move.l (a6)+,a5 !a5 <- address of format + clr.l d0 !d0 <- char to be printed +next: move.b (a5)+,d0 + beq out + cmp.b #'%',d0 + beq procnt +put: move.l d0,-(sp) + jsr _putchar !argument is long en op de stack + tst.l (sp)+ + jmp next + +procnt: move.b (a5)+,d0 + cmp.b #'d',d0 !NOTE: %d means unsigned. + beq digit + cmp.b #'s',d0 + beq string + cmp.b #'%',d0 !second % has to be printed. + beq put + tst.b -(a5) !normal char should be printed + jmp next + +string: move.l (a6)+,a2 !a2 <- address of string +sloop: move.b (a2)+,d0 + beq next + move.l d0,-(sp) + jsr _putchar !argument is long en op de stack + tst.l (sp)+ + jmp sloop + +digit: move.l (a6)+,d1 !d1 <- integer + move.l #_getal+12,a3 !a3 <- ptr to last part of buf + move.b #0,-(a3) !stringterminator +dloop: move.l d1,-(sp) + move.l #10,-(sp) + jsr .dvu !d1 <- quotient d3 <- remainder + add.l #'0',d3 + move.b d3,-(a3) + tst.l d1 !if quotient = 0 then ready + bne dloop + move.l a3,a2 + jmp sloop !print digitstring. + +out: + move.l sav,-(sp) + movem.l .savreg,d0/d1/d3/a0/a1/a2/a3/a4/a5/a6 + rts + + +_putchar: + movem.l d0,.savreg + move.l 4(sp),d0 + move.b d0,_char + move.l #1,-(sp) + move.l #_char,-(sp) + move.l #1,-(sp) + jsr _write + add.l #12,sp + movem.l .savreg,d0 + rts +.align 2 diff --git a/mach/m68k4/libem/rck.s b/mach/m68k4/libem/rck.s new file mode 100644 index 000000000..6d935e865 --- /dev/null +++ b/mach/m68k4/libem/rck.s @@ -0,0 +1,20 @@ +.define .rck + + .text +.rck: + movem.l d0/a0,.savreg + move.l (sp)+,.savret + move.l (sp)+,a0 ! descriptor address + move.l (sp),d0 + cmp.l (a0),d0 + blt 1f + cmp.l 2(a0),d0 + ble 2f +1: + move.l #ERANGE,-(sp) + jsr .trp +2: + movem.l .savreg,d0/a0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/ret.s b/mach/m68k4/libem/ret.s new file mode 100644 index 000000000..ba5c2f038 --- /dev/null +++ b/mach/m68k4/libem/ret.s @@ -0,0 +1,26 @@ +.define .ret + + .text +.ret: + beq 3f + cmp #2,d0 + bne 1f + move (sp)+,d0 + bra 3f +1: + cmp #4,d0 + bne 2f + move.l (sp)+,d0 + bra 3f +2: + cmp #8,d0 + bne 4f + move.l (sp)+,d0 + move.l (sp)+,d1 +3: + unlk a6 + rts +4: + move.w #EILLINS,-(sp) + jmp .fat +.align 2 diff --git a/mach/m68k4/libem/sav.s b/mach/m68k4/libem/sav.s new file mode 100644 index 000000000..5f29178c0 --- /dev/null +++ b/mach/m68k4/libem/sav.s @@ -0,0 +1,13 @@ +.define .savd0 +.define .savret +.define .savreg + +.data +.savd0: + .long 0 +.savret: + .long 0 +.savreg: + .space 128 +.text +.align 2 diff --git a/mach/m68k4/libem/set.s b/mach/m68k4/libem/set.s new file mode 100644 index 000000000..c5c6038b8 --- /dev/null +++ b/mach/m68k4/libem/set.s @@ -0,0 +1,32 @@ +.define .set + + ! d0 : setsize in bytes + ! d1 : bitnumber + .text +.set: + movem.l d1/d2/a1,.savreg + move.l (sp)+,.savret + move.l (sp)+,d1 + move.l d0,d2 + asr.l #2,d2 +1: + clr.l -(sp) !create empty set + sub.l #1,d2 + bgt 1b + move.l sp,a1 ! set base + move.l d1,d2 + asr.l #4,d2 + !bchg #0,d2 + cmp.l d0,d2 + bcs 1f + move.w #ESET,-(sp) + move.l .savret,-(sp) + jmp .trp +1: + add.l d2,a1 + move.l (a1),d2 + bset d1,d2 + move.l d2,(a1) + movem.l .savreg,d1/d2/a1 + move.l .savret,-(sp) + rts diff --git a/mach/m68k4/libem/shp.s b/mach/m68k4/libem/shp.s new file mode 100644 index 000000000..2e60f1b02 --- /dev/null +++ b/mach/m68k4/libem/shp.s @@ -0,0 +1,23 @@ +.define .strhp + + .text +.strhp: + move.l d0,.savreg + move.l (sp)+,.savret + move.l (sp)+,d0 ! heap pointer + move.l d0,.reghp + cmp.l .limhp,d0 + blt 1f + add.l #0x400,d0 + and.l #~0x3ff,d0 + move.l d0,.limhp + cmp.l d0,sp + ble 2f +1: + move.l .savreg,d0 + move.l .savret,-(sp) + rts +2: + move.w #EHEAP,-(sp) + jmp .fat +.align 2 diff --git a/mach/m68k4/libem/sig.s b/mach/m68k4/libem/sig.s new file mode 100644 index 000000000..491d0cf5f --- /dev/null +++ b/mach/m68k4/libem/sig.s @@ -0,0 +1,13 @@ +.define .sig + + .text +.sig: + movem.l a1/a2,.savreg + move.l (sp)+,.savret + move.l (sp)+,a1 ! trap pc + move.l .trppc,-(sp) + move.l a1,.trppc + movem.l .savreg,a1/a2 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/sts.s b/mach/m68k4/libem/sts.s new file mode 100644 index 000000000..17d788073 --- /dev/null +++ b/mach/m68k4/libem/sts.s @@ -0,0 +1,33 @@ +.define .sts + + ! d0 : # bytes + ! a0 : destination address + .text +.sts: + movem.l d0/a0,.savreg + move.l (sp)+,.savret + move.l (sp)+,d0 + move.l (sp)+,a0 + cmp #1,d0 + bne 1f + move.l (sp)+,d0 + move.b d0,(a0) + bra 4f + +1: cmp #2,d0 + bne 2f + move.l (sp)+,d0 + add.l #2,a0 + move.w d0,(a0) + bra 4f +2: + asr #2,d0 + sub.l #1,d0 +3: + move.l (sp)+,(a0)+ + dbf d0,3b +4: + movem.l .savreg,d0/a0 + move.l .savret,-(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/trp.s b/mach/m68k4/libem/trp.s new file mode 100644 index 000000000..1d5b4e902 --- /dev/null +++ b/mach/m68k4/libem/trp.s @@ -0,0 +1,29 @@ +.define .trp + + .text +.trp: + move.l (sp)+,a2 ! return address + move.w (sp)+,d0 ! error number + move.l a2,-(sp) + move.w d0,-(sp) + cmp #16,d0 + bcc 1f + btst d0,.trpim + bne 3f +1: + move.l .trppc,a0 + move.l a0,d0 + beq 9f + clr.l .trppc + jsr (a0) +3: + add #2,sp + rts +9: + pea fmt + jsr .diagnos + jmp EXIT + + .data +fmt: .asciz "trap %d called\n" +.align 2 -- 2.34.1