From 14a3683f85892e9c65f4e71774c261309b8d60d3 Mon Sep 17 00:00:00 2001 From: keie Date: Mon, 23 Jul 1984 11:49:00 +0000 Subject: [PATCH] *** empty log message *** --- mach/mantra/int/Makefile | 34 +++ mach/mantra/int/copyright | 77 ++++++ mach/mantra/int/deffile | 78 ++++++ mach/mantra/int/header | 8 + mach/mantra/int/mloop0 | 503 ++++++++++++++++++++++++++++++++++++++ mach/mantra/int/mloop1 | 364 +++++++++++++++++++++++++++ mach/mantra/int/mloop2 | 344 ++++++++++++++++++++++++++ mach/mantra/int/mloop3 | 191 +++++++++++++++ mach/mantra/int/mloop4 | 236 ++++++++++++++++++ mach/mantra/int/mloop5 | 186 ++++++++++++++ mach/mantra/int/mloop6 | 362 +++++++++++++++++++++++++++ mach/mantra/int/mloop7 | 120 +++++++++ mach/mantra/int/mloop8 | 234 ++++++++++++++++++ mach/mantra/int/mloop9 | 296 ++++++++++++++++++++++ mach/mantra/int/mloopa | 341 ++++++++++++++++++++++++++ mach/mantra/int/mloopb | 58 +++++ mach/mantra/int/mloopc | 503 ++++++++++++++++++++++++++++++++++++++ mach/mantra/int/mloope | 6 + mach/mantra/int/prep | 3 + 19 files changed, 3944 insertions(+) create mode 100644 mach/mantra/int/Makefile create mode 100644 mach/mantra/int/copyright create mode 100644 mach/mantra/int/deffile create mode 100644 mach/mantra/int/header create mode 100644 mach/mantra/int/mloop0 create mode 100644 mach/mantra/int/mloop1 create mode 100644 mach/mantra/int/mloop2 create mode 100644 mach/mantra/int/mloop3 create mode 100644 mach/mantra/int/mloop4 create mode 100644 mach/mantra/int/mloop5 create mode 100644 mach/mantra/int/mloop6 create mode 100644 mach/mantra/int/mloop7 create mode 100644 mach/mantra/int/mloop8 create mode 100644 mach/mantra/int/mloop9 create mode 100644 mach/mantra/int/mloopa create mode 100644 mach/mantra/int/mloopb create mode 100644 mach/mantra/int/mloopc create mode 100644 mach/mantra/int/mloope create mode 100755 mach/mantra/int/prep diff --git a/mach/mantra/int/Makefile b/mach/mantra/int/Makefile new file mode 100644 index 000000000..e63be3afa --- /dev/null +++ b/mach/mantra/int/Makefile @@ -0,0 +1,34 @@ +P = mloop +em2tl: a.out + cv a.out em2tl + rm a.out +a.out: $P02tl.s $P12tl.s $P22tl.s $P32tl.s $P42tl.s $P52tl.s $P62tl.s $P72tl.s $P82tl.s $P92tl.s $Pa2tl.s $Pb2tl.s $Pc2tl.s $Pe2tl.s + m68k2 -s $P?2tl.s >symem2tl +$P02tl.s: $P0 + prep $P0 $P02tl.s +$P12tl.s: $P1 + prep $P1 $P12tl.s +$P22tl.s: $P2 + prep $P2 $P22tl.s +$P32tl.s: $P3 + prep $P3 $P32tl.s +$P42tl.s: $P4 + prep $P4 $P42tl.s +$P52tl.s: $P5 + prep $P5 $P52tl.s +$P62tl.s: $P6 + prep $P6 $P62tl.s +$P72tl.s: $P7 + prep $P7 $P72tl.s +$P82tl.s: $P8 + prep $P8 $P82tl.s +$P92tl.s: $P9 + prep $P9 $P92tl.s +$Pa2tl.s: $Pa + prep $Pa $Pa2tl.s +$Pb2tl.s: $Pb + prep $Pb $Pb2tl.s +$Pc2tl.s: $Pc + prep $Pc $Pc2tl.s +$Pe2tl.s: $Pe + prep $Pe $Pe2tl.s diff --git a/mach/mantra/int/copyright b/mach/mantra/int/copyright new file mode 100644 index 000000000..7328f6bc4 --- /dev/null +++ b/mach/mantra/int/copyright @@ -0,0 +1,77 @@ +! (c) copyright 1980 by the Vrije Universiteit, Amsterdam, The Netherlands. +! Explicit permission is hereby granted to universities to use or duplicate +! this program for educational or research purposes. All other use or dup- +! lication by universities, and all use or duplication by other organiza- +! tions is expressly prohibited unless written permission has been obtained +! from the Vrije Universiteit. Requests for such permissions may be sent to + +! Dr. Andrew S. Tanenbaum +! Wiskundig Seminarium +! Vrije Universiteit +! Postbox 7161 +! 1007 MC Amsterdam +! The Netherlands + +! Organizations wishing to modify part of this software for subsequent sale +! must explicitly apply for permission. The exact arrangements will be +! worked out on a case by case basis, but at a minimum will require the or- +! ganization to include the following notice in all software and documenta- +! tion based on our work: + +! This product is based on the Pascal system developed by +! Andrew S. Tanenbaum, Johan W. Stevenson and Hans van Staveren +! of the Vrije Universiteit, Amsterdam, The Netherlands. +! +!========================================================================= + +! This is an interpreter for EM programs with no virtual memory for the +! the PMDS-II . This interpreter is adapted from an interpreter which was +! made for the pdp11 by Evert Wattel and Hans van Staveren . The present +! version is made by Freek van Schagen +! Vrije Universiteit +! Amsterdam. + + +!------------------------------------------------------------------------- + +! The program requires preprocessing by the C-preprocessor . There are +! several options : +! lword: 4byte word size in stead of 2 byte word size ; +! test: checking for undefined variables , nil pointers +! array indices , overflow , etc ; +! last: generation of a file with the last 16 lines executed ; +! count: generation of a file with a flow count ; +! flow: generation of a file with a flow bitmap ; +! prof: generation of a file with a runtime profile ; +! opfreq: generation of a file with a frequency count per opcode. + +!-------------------------------------------------------------------------- + +! Memory layout: + +! -------------------------------------------------------------------------- +! | | | | | | | | | | +! | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | +! | | | | | | | | | | +! -------------------------------------------------------------------------- + +! 1: Interpreter text+data+bss. +! 2: EM text. +! 3: EM procedure descriptors. +! 4: EM global data area. +! 5: tables for flow , count , profile. +! 6: EM heap area. +! 7: EM local data and stack. +! 8: Arguments to the interpreter . + + +!REGISTER USE +! pc programcounter +! a7=sp stackpointer d7 if lword: 1 , if not lword: 0 +! a6 external base= eb d6 0 +! a5 scratch d5 scratch +! a4 address of loop d4 scratch +! a3 EM programcounter d3 scratch +! a2 local base =lb d2 scratch +! a1 address of return area d1 scratch +! a0 scratch d0 opcode byte and scratch diff --git a/mach/mantra/int/deffile b/mach/mantra/int/deffile new file mode 100644 index 000000000..6ed008612 --- /dev/null +++ b/mach/mantra/int/deffile @@ -0,0 +1,78 @@ +#ifdef lword +#define word 4 +#define wrd #4 +#define wmu #2 +#define und #-0x80000000 +#define ad add.l +#define an and.l +#define asle asl.l +#define asri asr.l +#define cl clr.l +#define comp cmp.l +#define exor eor.l +#define extend ! +#define inor or.l +#define lsle lsl.l +#define lsri lsr.l +#define nega neg.l +#define mov move.l +#define nt not.l +#define rotl rol.l +#define rotr ror.l +#define subt sub.l +#define testen tst.l +#define l0 16 +#define l1 20 +#define l2 24 +#define l3 28 +#define l_1 -4 +#define l_2 -8 +#define l_3 -12 +#define l_4 -16 +#define l_5 -20 +#define l_6 -24 +#define l_7 -28 +#define l_8 -32 +#define checksize cmp.l #4,d0 ; beq 4f ; cmp.l #8,d0 ; bne 9f ; bsr no8bar ; \ +9: bra e_oddz +#else +#define word 2 +#define wrd #2 +#define wmu #1 +#define und #-0x8000 +#define ad add.w +#define an and.w +#define asle asl.w +#define asri asr.w +#define cl clr.w +#define comp cmp.w +#define exor eor.w +#define extend ext.l +#define inor or.w +#define lsle lsl.w +#define lsri lsr.w +#define nega neg.w +#define mov move.w +#define nt not.w +#define rotl rol.w +#define rotr ror.w +#define subt sub.w +#define testen tst.w +#define l0 16 +#define l1 18 +#define l2 20 +#define l3 22 +#define l_1 -2 +#define l_2 -4 +#define l_3 -6 +#define l_4 -8 +#define l_5 -10 +#define l_6 -12 +#define l_7 -14 +#define l_8 -16 +#define checksize cmp.w #2,d0 ; beq 2f ; cmp.w #4,d0 ; beq 4f ; bra e_oddz +#endif +#define adroff move.b (a3)+,(a1) ; move.b (a3)+,1(a1) +#define claimstack tst.b -1024(sp) + + diff --git a/mach/mantra/int/header b/mach/mantra/int/header new file mode 100644 index 000000000..ff0fa03e4 --- /dev/null +++ b/mach/mantra/int/header @@ -0,0 +1,8 @@ +!definitions +!#define lword +!#define FLTRAP +#define opfreq 0 +#define last 1 +#define test 1 +#define count 0 +#define flow 0 diff --git a/mach/mantra/int/mloop0 b/mach/mantra/int/mloop0 new file mode 100644 index 000000000..1fbb3b0e2 --- /dev/null +++ b/mach/mantra/int/mloop0 @@ -0,0 +1,503 @@ +!--------------------------------------------------------------------------- +! START OF THE PROGRAM +!--------------------------------------------------------------------------- + + lea retarea,a1 !a1 POINTS AT RETURN AREA + move.l nd,-(sp) !nd contains endbss + bsr _break + add.l wrd,sp +#if last + move.l #30,d0 !initialise lasttable + lea lasttable,a5 +0: clr.l (a5)+ + dbra d0,0b + move.l #-1,(a5) + move.l #linused-8,linused +#endif + move.l 4(sp),a2 + move.l (a2),filb !interpreter name in filb + sub.l #1,(sp) + bgt 0f + .data +emfile: .asciz "e.out" + .align 2 + .text + move.l 4(sp),a0 !4(sp) is argv + move.l #emfile,(a0) !pointer to e.out in argp1 + add.l #1,(sp) !only 1 argument in this case + bra 1f +0: add.l #4,4(sp) !skip name of interpreter +1: add.l #4-word,sp + move.l sp,ml + move.l word(sp),a2 + cl -(sp) + move.l (a2),-(sp) + lea eb,a6 + bsr _open + testen (sp)+ + bne nofile + mov (sp)+,savefd + move.l (a2),filb !load file name in filb + !information about file for error mess. + move.l #16,-(sp) ; pea header + mov savefd,-(sp) !skip first header + bsr _read ; testen (sp)+ + bne badarg1 + move.l #32,(sp) + pea header + mov savefd,-(sp) + bsr _read + testen (sp)+ + bne badarg1 + cmp.l #32,(sp)+ + bne badarg1 + lea header,a0 + move.l #5,d0 !convert em integer to integer +0: add.l #4,a1 + move.b (a0)+,-(a1) ; move.b (a0)+,-(a1) + move.b (a0)+,-(a1) ; move.b (a0)+,-(a1) + move.l (a1),-4(a0) ; dbra d0,0b + move.l nd,a0 ; move.l a0,pb !Bottom emtext + add.l ntext,a0 ; move.l a0,pd !proc. descr. base + move.l nproc,d1 ; asl.l #3,d1 !2 pointers +#if count + prof + flow + mulu #3,d1 !or 6 pointers +#endif + add.l d1,a0 ; move.l a0,eb !external base + add.l szdata,a0 ; move.l a0,tblmax + move.l a0,globmax ; move.l a0,hp + add.l #2000,a0 ; move.l a0,-(sp) + bsr _break !ask for core + testen (sp)+ ; bne toolarge + move.l eb,a6 ; move.l filb,4(a6) + move.l ntext,-(sp) + move.l pb,-(sp) + mov savefd,-(sp) + bsr _read + testen (sp)+ ; bne badarg + add.l #4,sp +#if float +! PM +#endif + +lblbuf: sub.l #2048,sp + claimstack + move.l sp,a4 !transport ptr a4 + move.l sp,a5 + move.l #2048,-(sp) ; move.l a4,-(sp) + mov savefd,-(sp) ; bsr _read + testen (sp)+ ; bne badarg + move.l (sp)+,d0 + cmp.l #2048,d0 ; bcs 0f + add.l #1024,a5 ; bra 1f !a5 =buffer middle +0: add.l d0,a5 !a5 = buffer end +1: move.l eb,a3 !At a3 filling has to start + clr.l d1 ; clr.l d2 + move.l #datswi,a6 + +datloop: cmp.l a4,a5 ; bhi 9f !Go on filling data + bsr blshift !shift block down , read next block +9: sub.l #1,ndata ; blt finito + move.b (a4)+,d1 ; beq dat0 !type byte in d1 + move.l a3,a2 ; move.b (a4)+,d2 !count byte in d2 + asl.l #2,d1 ; move.l -4(a6,d1),a0 + jmp (a0) + + .data +datswi: .long dat1; .long dat2; .long dat3; .long dat4 + .long dat5; .long dat6; .long dat6; .long dofloat + .text + +dat0: add.l #4,a1 + move.b (a4)+,-(a1) ; move.b (a4)+,-(a1) + move.b (a4)+,-(a1) ; move.b (a4)+,-(a1) + move.l (a1),d0 ; move.l a3,d4 !d0 =count + sub.l a2,d4 !reconstruct byte count of previous describtor + sub.l #1,d0 ; sub.l #1,d4 +1: move.l d4,d3 +2: move.b (a2)+,(a3)+ ; dbra d3,2b + dbra d0,1b ; bra datloop + +dat1: mov und,(a3)+ ; sub.b #1,d2 + bne dat1 ; bra datloop + +dat2: move.b (a4)+,(a3)+ ; sub.b #1,d2 + bne dat2 ; bra datloop + +dat3: move.w wrd,d1 ; add.l d1,a3 !wrd = 2 or 4 +3: move.b (a4)+,-(a3) ; sub.b #1,d1 ; bgt 3b + add.l wrd,a3 ; sub.b #1,d2 + bne dat3 ; bra datloop + +dat4: move.l eb,d4 ; bra 4f +dat5: move.l pb,d4 +4: add.l #4,a3 + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + add.l d4,(a3)+ ; sub.b #1,d2 + bne 4b ; bra datloop + +dat6: add.l d2,a3 ; move.l d2,d3 +6: move.b (a4)+,-(a3) ; sub.b #1,d2 + bne 6b ; add.l d3,a3 + bra datloop + +dofloat: add.l d2,a3 + bsr atof ; bra datloop + +!DUMMY ASCII TO FLOAT ROUTINE +atof: tst.b (a4)+ ; bne atof + rts + +blshift: move.l a5,a0 ; move.l #1024,d0 + sub.l d0,a0 ; move.l d0,-(sp) + sub.l d0,a4 !update pointer + asr.l #2,d0 +0: move.l (a5)+,(a0)+ ; sub.w #1,d0 + bgt 0b ; move.l a0,a5 + move.l a5,-(sp) ; mov savefd,-(sp) + bsr _read + testen (sp)+ ; bne badarg + move.l (sp)+,d0 + cmp.l #1024,d0 ; beq 1f + add.l d0,a5 +1: rts + +finito: cmp.l hp,a3 ; bne badarg !load file error + move.l eb,a6 !eb IN a6 NOW + lea 4(a6),a0 !filb CONTAINS eb+4 + move.l a0,filb + +!WE START TO READ THE PROCEDURE DESCRIPTORS + + move.l nproc,d1 ; move.l pd,a3 + asl.l #3,d1 !proc. descr. is 8 bytes +4: move.l a5,d2 ; sub.l a4,d2 !What is available? + add.l #7,d2 ; and.w #-0x8,d2 !multiple of 8! + sub.l d2,d1 !subtract what can + asr.l #3,d2 !be read. divide by 8 + sub.l #1,d2 +2: add.l #4,a3 + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + add.l #8,a3 + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + move.b (a4)+,-(a3) ; move.b (a4)+,-(a3) + move.l pb,d0 ; add.l d0,(a3)+ !em address to machine address + +#if count+prof+flow + clr.l (a3)+ + clr.l (a3)+ + clr.l (a3)+ + clr.l (a3)+ +#endif + dbra d2,2b ; tst.l d1 + ble 3f ; bsr blshift !more or ready + bra 4b +3: cmp.l eb,a3 ; bne badarg + move.l savefd,-(sp) ; bsr _close + move.l ml,sp !refresh stack + +#if count+prof+flow +! |=======================| +! Here we fill the fields in the procedure | current file name | +! descriptor with table information. The |-----------------------| +! procedure descriptor has six fields, | link to next proc | +! like described in this picture. We |-----------------------| +! construct a linked list of the procedure | first line number | +! descriptors, such that the defined |-----------------------| +! order of procedures is compatible | count pointer | +! with the text order. Thereafter we |-----------------------| +! scan the text for line information to | start address | +! fill the count pointer and startline |-----------------------| +! field. The link to the first procedure | bytes for locals | +! is in firstp , links are descriptor |=======================| +! start addresses. The last procedure +! links to the external base. All lines in the text get a count +! number, lines of a procedure get consecutive count numbers, +! the procedure count pointer gives the number of the first line. +! Count pointer zero is reserved for the case that no line number +! is yet defined. + +! Register use: a6 is external base ("eb"), a1 points at return area, other +! registers are free + +makelink: move.l pd,a0 + move.l #0,a2 + move.l a0,a3 !a3 will point at the first proc. + move.l a0,a4 !a4 will point at proc descr base +0: move.l a0,a5 !keep former descr pointer in a5 + add.l #24,a0 !a0 points at next one + cmp.l a0,a6 !top of descriptor space + bls 4f !yes? ready! +1: move.l 4(a0),d0 !start address of current proc in d0 + cmp.l 4(a5),d0 !compair start address with previous + bcc 2f !d0 large? follow link! + sub.l #24,a5 !d0 small? compair with previous + cmp.l a5,a4 !is a5 smaller than pd + bls 1b !no? try again + move.l a3,16(a0) !yes? then smallest text add up to now + move.l a0,a3 !remind a3 is to point at first proc + bra 0b !next descriptor +2: move.l 16(a5),d1 !follow the link to find place + beq 3f !if 0 then no link defined + move.l d1,a2 + cmp.l 4(a2),d0 !compair start address + bcs 3f !start addr between those of a5 and a2 + move.l a2,a5 !d0 above start address of a5 + bra 2b !go on looking +3: move.l a0,16(a5) !a0 follows a5 + move.l d1,16(a0) !a2 follows a0 + bra 0b +4: move.l a3,firstp !firstp links to first procedure + +! Register use: a3 points at first procedure , d0 opcode byte , a5 base of +! table , d1 keeps min line nr , d2 keeps max line nr , d3 current line nr , +! maxcount in d4 + +procinf: move.l #1,maxcount !count pointer for first procedure + move.l #1,d4 + move.l #0,d3 + move.l #0,d0 +0: move.l a3,-(sp) !stack current procedure + move.l #-1,d1 !minimal line number on 0xFFFFFFFF + move.l #0,d2 !maximal line number on 0 + tst.l 16(a3) !bottom address next procedure + beq 6f !if 0 last procedure + move.l 16(a3),a4 + move.l 4(a4),a4 !a4 points at top of current proc + bra 2f +6: move.l pd,a4 +2: move.l 4(a3),a3 !start address of current procedure +8: move.b (a3)+,d0 !start scanning + cmp.b #-2,d0 + beq 1f !case escape1 + cmp.b #-1,d0 + beq 6f !case escape2 + cmp.b #-106,d0 + bhi 7f !ordinary skip at 7 + beq 2f !case lni at 2 + cmp.b #-108,d0 !lin_l ? + bcs 7f !ordinary skip at 7 + beq 3f !lin_l at 3 + move.l #0,d3 + move.b (a3)+,d3 !lin_s0 here + bra 4f !compare at 4 +2: add.l #1,d3 + bra 4f +3: adroff + move.l #0,d3 + move.w (a1),d3 + bra 4f +6: move.b (a3)+,d0 + cmp.b #35,d0 !lin_q ? + bne 6f !skip for escape2 at 6f + move.b (a3)+,(a1)+ + move.b (a3)+,(a1)+ + move.b (a3)+,(a1)+ + move.b (a3)+,(a1) + sub.l #3,a1 + move.l (a1),d3 +4: cmp.l d1,d3 !d3 less than minimum ? + bcc 5f + move.l d3,d1 +5: cmp.l d3,d2 !d3 more than maximum ? + bcc 9f + move.l d3,d2 + bra 9f +6: add.l #4,a3 + bra 9f +1: move.b (a3)+,d0 + move.l d0,a2 !escape1 opcodes treated here + add.l #256,a2 !second table + bra 1f +7: move.l d0,a2 +1: move.b skipdisp(a2),d0 !look for argument size + add.l d0,a3 +9: cmp.l a3,a4 !still more text + bhi 8b + move.l (sp)+,a3 !bottom back + sub.l d1,d2 !compute number of lines + bcs 9f !no line so no information + move.l d4,8(a3) + move.l d1,12(a3) + add.l #1,d2 + add.l d2,d4 !this is the new maxcount + move.l d4,maxcount +9: tst.l 16(a3) !follow link to next procedure + beq 1f + move.l 16(a3),a3 + bra 0b +1: +countlabel: + + .data +skipdisp: +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 2; .byte 0; +.byte 0; .byte 1; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1; +.byte 1; .byte 1; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1; + +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0; +.byte 1; .byte 0; .byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0; +.byte 1; .byte 1; .byte 0; .byte 1; .byte 0; .byte 2; .byte 0; .byte 2; +.byte 1; .byte 0; .byte 0; .byte 0; .byte 1; .byte 1; .byte 0; .byte 1; +.byte 2; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; + +.byte 2; .byte 2; .byte 0; .byte 0; .byte 1; .byte 1; .byte 1; .byte 0; +.byte 0; .byte 2; .byte 1; .byte 0; .byte 1; .byte 0; .byte 0; .byte 1; +.byte 1; .byte 1; .byte 0; .byte 0; .byte 2; .byte 1; .byte 0; .byte 2; +.byte 0; .byte 1; .byte 1; .byte 2; .byte 1; .byte 1; .byte 1; .byte 1; +.byte 1; .byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 2; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 2; .byte 2; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 0; .byte 0; .byte 0; .byte 1; .byte 1; .byte 0; .byte 0; + +.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; +.byte 0; .byte 0; .byte 1; .byte 0; .byte 0; .byte 1; .byte 1; .byte 1; +.byte 1; .byte 0; .byte 2; .byte 1; .byte 1; .byte 1; .byte 2; .byte 0; +.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 1; +.byte 2; .byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; .byte 0; +.byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 0; .byte 2; .byte 1; +.byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; .byte 1; +.byte 2; .byte 1; .byte 0; .byte 0; .byte 1; .byte 2; .byte 7; .byte 5; + +!escaped opcodes + +.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 0; .byte 2; +.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 0; .byte 0; .byte 0; .byte 2; .byte 2; .byte 2; +.byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; +.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2; + +.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2; +.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 1; +.byte 2; .byte 2; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; +.byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 0; .byte 2; +.byte 0; .byte 2; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; +.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 2; .byte 2; +.byte 2; .byte 2; .byte 0; .byte 0; .byte 2; .byte 2; .byte 0; .byte 2; + +.byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; .byte 0; .byte 2; +.byte 2; .byte 0; .byte 1; .byte 0; .byte 0; .byte 0; .byte 2; .byte 0; +.byte 2; .byte 0; .byte 2; .byte 2; .byte 2; .byte 2; .byte 2; .byte 2; +.byte 0; .byte 2; .byte 0; .byte 1; .byte 2; .byte 0; .byte 0; .byte 2; + + .text + move.l globmax,d1 + move.l d1,a3 +#if prof + move.l d1,ltime + move.l d1,profile !PROFILE POINTER FOR CURRENT PROC + move.l maxcount,d0 + add.l #1,d0 + asl.l #2,d0 !4 BYTES FOR EACH LINE + add.l d0,d1 + move.l d0,profsiz !profsiz CONTAINS NEEDED MEM SIZE +#endif +#if flow + move.l d1,lflow + move.l maxcount,d0 + asr.l #3,d0 !divide by 8 ; byte is 8 bits ,you know + add.l #2,d0 + bclr #0,d0 !make integer number of words (2 byte!) + add.l d0,d1 + move.l d0,flowsiz +#endif +#if count + move.l d1,lcount + move.l maxcount,d0 + add.l #1,d0 + asl.l #2,d0 + add.l d0,d1 + move.l d0,countsiz +#endif + move.l d1,tblmax + add.l #1024,d1 + cmp.l nd,d1 + bcs 2f + move.l d1,-(sp) + bsr _break + testen (sp)+ + bne toolarge +2: sub.l a3,d1 + asr.l wmu,d1 +3: cl (a3)+ + dbra d1,3b + sub.l #1024,a3 + move.l a3,hp +cfp: move.l ml,sp !LABEL FOR DEBUGGING + +#endif + +!---------------------------------------------------------------------------- +! START CALLING SEQUENCE HERE +!----------------------------------------------------------------------------- + + lea loop,a4 + move.l pb,a3 + move.l #0,a2 + move.l wmu-1,d7 + clr.l d6 +lblsp: move.l entry,-(sp) !start procedure to call + bra cai_z + + +nofile: mov #0xD,d0 ; bra notrap1 +badarg: move.l eb,a6 +badarg1: mov #0xE,d0 ; bra notrap1 +toolarge: mov #0xF,d0 ; bra notrap1 + .data +retsize: .space 2 +retarea: .space 32 + + + .bss +argc: .space 4 +argv: .space 4 +envp: .space 4 +savefd: .space 4 +header: +ntext: .space 4 +ndata: .space 4 +nproc: .space 4 +entry: .space 4 +nline: .space 4 +szdata: .space 4 +firstp: .space 4 +maxcount: .space 4 + +tblmax: .space 4 +globmax: .space 4 +ml: .space 4 +eb: .space 4 !EXPLICITELY REQUIRED eb, filb, curproc IN +filb: .space 4 !THIS ORDER +curproc: .space 4 +pb: .space 4 +pd: .space 4 +hp: .space 4 + + .define filb + .define curproc + .define pd + .define nproc + .define retarea + .define retsize + .define hp + .define globmax + .define tblmax + .define ml + .define argc + + .text diff --git a/mach/mantra/int/mloop1 b/mach/mantra/int/mloop1 new file mode 100644 index 000000000..a7d24ef1a --- /dev/null +++ b/mach/mantra/int/mloop1 @@ -0,0 +1,364 @@ +!------------------------------------------------------------------------------- +! Main loop of the interpreter starts here +!---------------------------------------------------------------------------- + +loop: move.l #0,d0 + move.b (a3)+,d0 !opcode in d0 + add.w d0,d0 !opcode to index in table + add.w d0,d0 +#if prof + move.l profile,a0 + lea timeinf,a5 + move.l 0(a5,d0),d1 !get operation time + add.l d1,(a0) +#endif +#if opfreq + lea counttab,a5 + add.l #1,0(a5,d0) +#endif + jmp dispat(pc,d0) !jump to branch to the operation + + +!--------------------------------------------------------------------------- +! the BRANCH LIST follows +!-------------------------------------------------------------------------- + + +dispat: + + +bra loc_0 ; bra loc_1 ; bra loc_2 ; bra loc_3 +bra loc_4 ; bra loc_5 ; bra loc_6 ; bra loc_7 +bra loc_8 ; bra loc_9 ; bra loc_10 ; bra loc_11 +bra loc_12 ; bra loc_13 ; bra loc_14 ; bra loc_15 +bra loc_16 ; bra loc_17 ; bra loc_18 ; bra loc_19 +bra loc_20 ; bra loc_21 ; bra loc_22 ; bra loc_23 +bra loc_24 ; bra loc_25 ; bra loc_26 ; bra loc_27 +bra loc_28 ; bra loc_29 ; bra loc_30 ; bra loc_31 +bra loc_32 ; bra loc_33 ; bra aar_1W ; bra adf_s0 +bra adi_1W ; bra adi_2W ; bra adp_l ; bra adp_1 +bra adp_2 ; bra adp_s0 ; bra adp_s_1 ; bra ads_1W +bra and_1W ; bra asp_1W ; bra asp_2W ; bra asp_3W +bra asp_4W ; bra asp_5W ; bra asp_w0 ; bra beq_l +bra beq_s0 ; bra bge_s0 ; bra bgt_s0 ; bra ble_s0 +bra blm_s0 ; bra blt_s0 ; bra bne_s0 ; bra bra_l +bra bra_s_1 ; bra bra_s_2 ; bra bra_s0 ; bra bra_s1 +bra cal_1 ; bra cal_2 ; bra cal_3 ; bra cal_4 +bra cal_5 ; bra cal_6 ; bra cal_7 ; bra cal_8 +bra cal_9 ; bra cal_10 ; bra cal_11 ; bra cal_12 +bra cal_13 ; bra cal_14 ; bra cal_15 ; bra cal_16 +bra cal_17 ; bra cal_18 ; bra cal_19 ; bra cal_20 +bra cal_21 ; bra cal_22 ; bra cal_23 ; bra cal_24 +bra cal_25 ; bra cal_26 ; bra cal_27 ; bra cal_28 +bra cal_s0 ; bra cff_z ; bra cif_z ; bra cii_z +bra cmf_s0 ; bra cmi_1W ; bra cmi_2W ; bra cmp_z +bra cms_s0 ; bra csa_1W ; bra csb_1W ; bra dec_z +bra dee_w0 ; bra del_w_1 ; bra dup_1W ; bra dvf_s0 +bra dvi_1W ; bra fil_l ; bra inc_z ; bra ine_lw +bra ine_w0 ; bra inl__1W ; bra inl__2W ; bra inl__3W +bra inl_w_1 ; bra inn_s0 ; bra ior_1W ; bra ior_s0 +bra lae_l ; bra lae_w0 ; bra lae_w1 ; bra lae_w2 +bra lae_w3 ; bra lae_w4 ; bra lae_w5 ; bra lae_w6 +bra lal_p ; bra lal_n ; bra lal_0 ; bra lal__1 +bra lal_w0 ; bra lal_w_1 ; bra lal_w_2 ; bra lar_1W +bra ldc_0 ; bra lde_lw ; bra lde_w0 ; bra ldl_0 +bra ldl_w_1 ; bra lfr_1W ; bra lfr_2W ; bra lfr_s0 +bra lil_w_1 ; bra lil_w0 ; bra lil_0 ; bra lil_1W +bra lin_l ; bra lin_s0 ; bra lni_z ; bra loc_l +bra loc__1 ; bra loc_s0 ; bra loc_s_1 ; bra loe_lw +bra loe_w0 ; bra loe_w1 ; bra loe_w2 ; bra loe_w3 +bra loe_w4 ; bra lof_l ; bra lof_1W ; bra lof_2W +bra lof_3W ; bra lof_4W ; bra lof_s0 ; bra loi_l +bra loi_1 ; bra loi_1W ; bra loi_2W ; bra loi_3W +bra loi_4W ; bra loi_s0 ; bra lol_pw ; bra lol_nw +bra lol_0 ; bra lol_1W ; bra lol_2W ; bra lol_3W +bra lol__1W ; bra lol__2W ; bra lol__3W ; bra lol__4W +bra lol__5W ; bra lol__6W ; bra lol__7W ; bra lol__8W +bra lol_w0 ; bra lol_w_1 ; bra lxa_1 ; bra lxl_1 +bra lxl_2 ; bra mlf_s0 ; bra mli_1W ; bra mli_2W +bra rck_1W ; bra ret_0 ; bra ret_1W ; bra ret_s0 +bra rmi_1W ; bra sar_1W ; bra sbf_s0 ; bra sbi_1W +bra sbi_2W ; bra sdl_w_1 ; bra set_s0 ; bra sil_w_1 +bra sil_w0 ; bra sli_1W ; bra ste_lw ; bra ste_w0 +bra ste_w1 ; bra ste_w2 ; bra stf_l ; bra stf_1W +bra stf_2W ; bra stf_s0 ; bra sti_1 ; bra sti_1W +bra sti_2W ; bra sti_3W ; bra sti_4W ; bra sti_s0 +bra stl_pw ; bra stl_nw ; bra stl_0 ; bra stl_1W +bra stl__1W ; bra stl__2W ; bra stl__3W ; bra stl__4W +bra stl__5W ; bra stl_w_1 ; bra teq_z ; bra tgt_z +bra tlt_z ; bra tne_z ; bra zeq_l ; bra zeq_s0 +bra zeq_s1 ; bra zer_s0 ; bra zge_s0 ; bra zgt_s0 +bra zle_s0 ; bra zlt_s0 ; bra zne_s0 ; bra zne_s_1 +bra zre_lw ; bra zre_w0 ; bra zrl__1W ; bra zrl__2W +bra zrl_w_1 ; bra zrl_nw + +.errnz .-dispat-1016 +!----------------------------------------------------------------------------- +! Two byte opcodes come here for decoding of second byte +!---------------------------------------------------------------------------- + +escape1: + move.l #0,d0 + bra 1f + bra escape2 +1: move.b (a3)+,d0 !second byte ,extended opcode + add.w d0,d0 !make index of address + add.w d0,d0 + cmp.w #640,d0 !check for range + bhi e_illins !jump to ill instruction procedure +#if prof + lea timeinf1,a5 + move.l 0(a5,d0),d1 + add.l d1,(a0) +#endif +#if opfreq + lea counttab+1024,a5 + add.l #1,0(a5,d0) +#endif + jmp dispae1(pc,d0) !jump to the operation + +!------------------------------------------------------------------------------ +! now dispatch table for escaped opcodes +!------------------------------------------------------------------------------ + +dispae1: !dispatch escaped opcodes 1 + +bra aar_l ; bra aar_z ; bra adf_l ; bra adf_z +bra adi_l ; bra adi_z ; bra ads_l ; bra ads_z +bra adu_l ; bra adu_z ; bra and_l ; bra and_z +bra asp_lw ; bra ass_l ; bra ass_z ; bra bge_l +bra bgt_l ; bra ble_l ; bra blm_l ; bra bls_l +bra bls_z ; bra blt_l ; bra bne_l ; bra cai_z +bra cal_l ; bra cfi_z ; bra cfu_z ; bra ciu_z +bra cmf_l ; bra cmf_z ; bra cmi_l ; bra cmi_z +bra cms_l ; bra cms_z ; bra cmu_l ; bra cmu_z +bra com_l ; bra com_z ; bra csa_l ; bra csa_z +bra csb_l ; bra csb_z ; bra cuf_z ; bra cui_z +bra cuu_z ; bra dee_lw ; bra del_pw ; bra del_nw +bra dup_l ; bra dus_l ; bra dus_z ; bra dvf_l +bra dvf_z ; bra dvi_l ; bra dvi_z ; bra dvu_l +bra dvu_z ; bra fef_l ; bra fef_z ; bra fif_l +bra fif_z ; bra inl_pw ; bra inl_nw ; bra inn_l +bra inn_z ; bra ior_l ; bra ior_z ; bra lar_l +bra lar_z ; bra ldc_l ; bra ldf_l ; bra ldl_pw +bra ldl_nw ; bra lfr_l ; bra lil_pw ; bra lil_nw +bra lim_z ; bra los_l ; bra los_z ; bra lor_s0 +bra lpi_l ; bra lxa_l ; bra lxl_l ; bra mlf_l +bra mlf_z ; bra mli_l ; bra mli_z ; bra mlu_l +bra mlu_z ; bra mon_z ; bra ngf_l ; bra ngf_z +bra ngi_l ; bra ngi_z ; bra nop_z ; bra rck_l +bra rck_z ; bra ret_l ; bra rmi_l ; bra rmi_z +bra rmu_l ; bra rmu_z ; bra rol_l ; bra rol_z +bra ror_l ; bra ror_z ; bra rtt_z ; bra sar_l +bra sar_z ; bra sbf_l ; bra sbf_z ; bra sbi_l +bra sbi_z ; bra sbs_l ; bra sbs_z ; bra sbu_l +bra sbu_z ; bra sde_l ; bra sdf_l ; bra sdl_pw +bra sdl_nw ; bra set_l ; bra set_z ; bra sig_z +bra sil_pw ; bra sil_nw ; bra sim_z ; bra sli_l + + +bra sli_z ; bra slu_l ; bra slu_z ; bra sri_l +bra sri_z ; bra sru_l ; bra sru_z ; bra sti_l +bra sts_l ; bra sts_z ; bra str_s0 ; bra tge_z +bra tle_z ; bra trp_z ; bra xor_l ; bra xor_z +bra zer_l ; bra zer_z ; bra zge_l ; bra zgt_l +bra zle_l ; bra zlt_l ; bra zne_l ; bra zrf_l +bra zrf_z ; bra zrl_pw ; bra dch_z ; bra exg_s0 +bra exg_l ; bra exg_z ; bra lpb_z ; bra gto_l + +.errnz .-dispae1-640 + +!---------------------------------------------------------------------------- + +escape2: + move.l #0,d0 + move.b (a3)+,d0 !opcode + sub.l #4,sp + move.b (a3)+,(sp) + move.b (a3)+,1(sp) + move.b (a3)+,2(sp) + move.b (a3)+,3(sp) + add.w d0,d0 + add.w d0,d0 + cmp.w #220,d0 + bhi e_illins +#if prof + lea timeinf2,a5 + move.l 0(a5,d0),d1 + add.l d1,(a0) +#endif +#if opfreq + lea counttab+1664,a5 + add.l #1,0(a5,d0) +#endif + jmp dispae2(pc,d0) + + +!--------------------------------------------------------------------------- +! BRANCH TABLE FOR SECOND ESCAPED OPCODES +!--------------------------------------------------------------------------- + +dispae2: +bra ldc_q ; bra lae_q ; bra lal_qp ; bra lal_qn +bra lde_qw ; bra ldf_q ; bra ldl_qpw ; bra ldl_qnw +bra lil_qpw ; bra lil_qnw ; bra loc_q ; bra loe_qw +bra lof_q ; bra lol_qpw ; bra lol_qnw ; bra lpi_q +bra adp_q ; bra asp_qw ; bra beq_q ; bra bge_q +bra bgt_q ; bra ble_q ; bra blm_q ; bra blt_q +bra bne_q ; bra bra_q ; bra cal_q ; bra dee_qw +bra del_qpw ; bra del_qnw ; bra fil_q ; bra gto_q +bra ine_qw ; bra inl_qpw ; bra inl_qnw ; bra lin_q +bra sde_q ; bra sdf_q ; bra sdl_qpw ; bra sdl_qnw +bra sil_qpw ; bra sil_qnw ; bra ste_qw ; bra stf_q +bra stl_qpw ; bra stl_qnw ; bra zeq_q ; bra zge_q +bra zgt_q ; bra zle_q ; bra zlt_q ; bra zne_q +bra zre_qw ; bra zrl_qpw ; bra zrl_qnw + +.errnz .-dispae2-220 + +!------------------------------------------------------------------------------ +! timeinf tables, first the unescaped opcodes +! these tables are parallel to the tables dispat , dispae1 and dispae2 +! Each entry contains a reasonable estimate of +! the number of processor state cycles needed to +! execute that instruction. The exact amount cannot be +! supplied, since this can depend rather heavily on the +! size of the object in set, array case instructions etc. +! The table timeinf also contains, added to each entry, +! the number of processor state cycles needed to find the instruction. +! This number is currently 22.Also the number of processor state +! cycles to return from the instruction is included. +! The number is computed for +! the case that all check and runinf options are off. +!------------------------------------------------------------------------------ + +#if prof + + .data + +timeinf: +.long 33 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 35 ; .long 35 +.long 35 ; .long 35 ; .long 127 ; .long 00 +.long 36 ; .long 42 ; .long 56 ; .long 40 +.long 40 ; .long 42 ; .long 42 ; .long 42 +.long 36 ; .long 39 ; .long 39 ; .long 39 +.long 39 ; .long 39 ; .long 41 ; .long 67 +.long 48 ; .long 48 ; .long 48 ; .long 48 +.long 97 ; .long 48 ; .long 48 ; .long 55 +.long 45 ; .long 45 ; .long 36 ; .long 43 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 211 ; .long 211 ; .long 211 ; .long 211 +.long 213 ; .long 00 ; .long 00 ; .long 66 +.long 00 ; .long 50 ; .long 54 ; .long 54 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 + +timeinf1: +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 + +timeinf2: +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 ; .long 00 +.long 00 ; .long 00 ; .long 00 + +#endif + .text diff --git a/mach/mantra/int/mloop2 b/mach/mantra/int/mloop2 new file mode 100644 index 000000000..5cb5ae7aa --- /dev/null +++ b/mach/mantra/int/mloop2 @@ -0,0 +1,344 @@ +!-------------------------------------------------------------------------- +! Laod constant , load local , store local +!-------------------------------------------------------------------------- + +loc_0: mov d6,-(sp) + jmp (a4) +loc_1: loc_2: loc_3: loc_4: loc_5: loc_6: loc_7: loc_8: +loc_9: loc_10: loc_11: loc_12: loc_13: loc_14: loc_15: loc_16: +loc_17: loc_18: loc_19: loc_20: loc_21: loc_22: loc_23: loc_24: +loc_25: loc_26: loc_27: loc_28: loc_29: loc_30: loc_31: loc_32: +loc_33: + asr.w #2,d0 !make the multiplication undone + mov d0,-(sp) + jmp (a4) +loc__1: + mov #-1,-(sp) + jmp (a4) +loc_s0: clr.w d0 + move.b (a3)+,d0 + mov d0,-(sp) + jmp (a4) +loc_s_1: mov #-1,d0 + move.b (a3)+,d0 + mov d0,-(sp) + jmp (a4) +lpi_l: + adroff + move.w (a1),d0 + move.l d0,-(sp) + jmp (a4) +lpi_q: jmp (a4) + +loc_q: jmp (a4) +#ifndef lword + bra e_illins +#endif +loc_l: adroff + move.w (a1),d0 + ext.l d0 + mov d0,-(sp) + jmp (a4) +ldc_0: cl -(sp) + cl -(sp) + jmp (a4) +ldc_l: + adroff + move.w (a1),d0 + ext.l d0 !ext works only on d register +4: move.l d0,-(sp) !adapt for l , then "move.2l" signextended +#ifdef lword + bmi 0f + clr.l -(sp) + bra 1f +0: move.l #-1,-(sp) +1: +#endif + jmp (a4) +ldc_q: +#ifdef lword + clr.l -(sp) +#endif + jmp (a4) + +!------------------------------------------------------------------------- +! offsets should be adapted for wordsize 4 .Use identifiers +! l3 to l_8 for the offsets in lol_3W to lol__8 . Use the +! preprocessor for conditional definitions . + +lol_0: mov l0(a2),-(sp) ; jmp (a4) +lol_1W: mov l1(a2),-(sp) ; jmp (a4) +lol_2W: mov l2(a2),-(sp) ; jmp (a4) +lol_3W: mov l3(a2),-(sp) ; jmp (a4) +lol__1W: mov l_1(a2),-(sp) ; jmp (a4) +lol__2W: mov l_2(a2),-(sp) ; jmp (a4) +lol__3W: mov l_3(a2),-(sp) ; jmp (a4) +lol__4W: mov l_4(a2),-(sp) ; jmp (a4) +lol__5W: mov l_5(a2),-(sp) ; jmp (a4) +lol__6W: mov l_6(a2),-(sp) ; jmp (a4) +lol__7W: mov l_7(a2),-(sp) ; jmp (a4) +lol__8W: mov l_8(a2),-(sp) ; jmp (a4) +lol_w0: clr.w d0 + move.b (a3)+,d0 +5: asl.l wmu,d0 + mov 16(a2,d0),-(sp) + jmp (a4) + +lol_w_1: move.l #-1,d0 + move.b (a3)+,d0 +2: asl.l wmu,d0 + mov 0(a2,d0),-(sp) + jmp (a4) +lol_pw: adroff + move.w (a1),d0 + bra 5b + +lol_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 2b +lol_qnw: move.l (sp)+,d0 + bra 2b +lol_qpw: move.l (sp)+,d0 + bra 5b + + +!-------------------------------------------------------------------------- + +ldl_0: mov l1(a2),-(sp) !offset code + mov l0(a2),-(sp) !offset code + jmp (a4) +ldl_w_1: move.l #-1,d0 + move.b (a3)+,d0 +2: asl.l wmu,d0 + mov word(a2,d0),-(sp) + mov 0(a2,d0),-(sp) + jmp (a4) +ldl_pw: adroff + move.w (a1),d0 +5: asl.l wmu,d0 + mov l1(a2,d0),-(sp) + mov l0(a2,d0),-(sp) + jmp (a4) +ldl_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 2b +ldl_qpw: move.l (sp)+,d0 + bra 5b +ldl_qnw: move.l (sp)+,d0 + bra 2b + +!------------------------------------------------------------------------- +loe_lw: adroff + move.w (a1),d0 + bra 1f +loe_qw: move.l (sp)+,d0 + bra 1f + +loe_w0: loe_w1: loe_w2: loe_w3: loe_w4: + sub.w #624,d0 + asl.w #6,d0 + move.b (a3)+,d0 +1: ext.l d0 + asl.l wmu,d0 + mov 0(a6,d0),-(sp) + jmp (a4) + +lde_lw: adroff + move.w (a1),d0 + bra 1f +lde_qw: move.l (sp)+,d0 + bra 1f + +lde_w0: clr.w d0 + move.b (a3)+,d0 +1: asl.l wmu,d0 + mov word(a6,d0),-(sp) + mov 0(a6,d0),-(sp) + jmp (a4) + +!------------------------------------------------------------------------------ +lil_0: move.l l0(a2),a0 + mov (a0),-(sp) + jmp (a4) +lil_1W: move.l l1(a2),a0 + mov (a0),-(sp) + jmp (a4) +lil_pw: adroff + move.w (a1),d0 + bra 1f +lil_qpw: move.l (sp)+,d0 + bra 1f + +lil_w0: clr.w d0 + move.b (a3)+,d0 +1: asl.l wmu,d0 + move.l l0(a2,d0),a0 + mov (a0),-(sp) + jmp (a4) + +lil_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 1f +lil_qnw: move.l (sp)+,d0 + bra 1f + +lil_w_1: move.l #-1,d0 + move.b (a3)+,d0 +1: asl.l wmu,d0 + move.l 0(a2,d0),a0 + mov (a0),-(sp) + jmp (a4) + +!--------------------------------------------------------------------------- +lof_s0: move.l d6,d0 + move.b (a3)+,d0 + bra 1f +lof_l: adroff + move.w (a1),d0 + ext.l d0 + bra 1f +lof_q: move.l (sp)+,d0 + bra 1f +lof_1W: move.l #1,d0 +2: asl.w wmu,d0 +1: move.l (sp)+,a0 + mov 0(a0,d0),-(sp) + jmp (a4) +lof_2W: move.l #2,d0 ; bra 2b +lof_3W: move.l #3,d0 ; bra 2b +lof_4W: move.l #4,d0 ; bra 2b +ldf_l: adroff + move.w (a1),d0 + ext.l d0 +2: move.l (sp)+,a0 + mov word(a0,d0),-(sp) + mov 0(a0,d0),-(sp) + jmp (a4) +ldf_q: move.l (sp)+,d0 + bra 2b + +!------------------------------------------------------------------------- + +lal_p: adroff + move.w (a1),d0 + bra 1f +lal_qp: move.l (sp)+,d0 + bra 1f +lal_0: pea 16(a2) + jmp (a4) +lal_w0: clr.w d0 + move.b (a3)+,d0 + asl.l wmu,d0 +1: add.l #16,d0 + bra 3f +lal_n: adroff + move.w (a1),d0 + ext.l d0 + bra 3f +lal_qn: move.l (sp)+,d0 + bra 3f +lal__1: move.l #-1,d0 +3: pea 0(a2,d0) + jmp (a4) +lal_w_1: move.l #-1,d0 +2: move.b (a3)+,d0 + asl.l wmu,d0 + bra 3b +lal_w_2: move.l #-512,d0 + bra 2b +lae_l: adroff + move.w (a1),d0 + bra 1f +lae_q: move.l (sp)+,d0 + bra 1f +lae_w0: lae_w1: lae_w2: lae_w3: lae_w4: +lae_w5: lae_w6: + sub.w #484,d0 + asl.w #6,d0 + move.b (a3)+,d0 + asl.w wmu,d0 +1: pea 0(a6,d0) + jmp (a4) + +!--------------------------------------------------------------------------- +lxl_1: move.l 16(a2),-(sp) + jmp (a4) +lxl_l: adroff + move.w (a1),d0 + beq 5f + bgt 1f + blt e_oddz +1: sub.l #1,d0 + bra 2f +lxl_2: move.w #1,d0 +2: move.l a2,a0 +3: move.l 16(a0),a0 + dbra d0,3b + move.l a0,-(sp) + jmp (a4) +5: move.l a2,-(sp) + jmp (a4) + +lxa_1: move.l #0,d0 + bra 3f +lxa_l: adroff + move.w (a1),d0 + bgt 1f + blt e_oddz + pea 16(a2) + jmp (a4) +1: sub.l #1,d0 +3: move.l a2,a0 +2: move.l 16(a0),a0 + dbra d0,2b + pea 16(a0) + jmp (a4) + +!----------------------------------------------------------------------- + +loi_l: adroff + clr.l d1 + move.w (a1),d1 + bra 8f +loi_s0: clr.l d1 + move.b (a3)+,d1 +8: cmp.w #1,d1 + beq loi_1 + cmp.w #2,d1 + beq 2f + move.w d1,d0 + move.w d7,d2 +3: asr.w #1,d0 ; dbcs d2,3b + bcs e_oddz + bra 5f +loi_1W: loi_2W: loi_3W: loi_4W: + asr.w #2,d0 + sub.w #168,d0 + move.l d0,d1 + asl.w wmu,d1 +5: move.l (sp)+,a0 + add.l d1,a0 + sub.w #1,d0 +1: mov -(a0),-(sp) + dbra d0,1b + jmp (a4) +2: move.l (sp)+,a0 + move.w (a0),d0 + mov d0,-(sp) + jmp (a4) +loi_1: move.l (sp)+,a0 + move.w d6,d0 + move.b (a0),d0 + mov d0,-(sp) + jmp (a4) + +los_z: mov (sp)+,d0 + bra 0f +los_l: adroff + move.w (a1),d0 +0: checksize +2: move.l #0,d1 ; move.w (sp)+,d1 ; bra 8b +4: move.l (sp)+,d1 ; bra 8b diff --git a/mach/mantra/int/mloop3 b/mach/mantra/int/mloop3 new file mode 100644 index 000000000..7262d182a --- /dev/null +++ b/mach/mantra/int/mloop3 @@ -0,0 +1,191 @@ +!--------------------------------------------------------------------- +! STORE GROUP +!--------------------------------------------------------------------- + +stl_pw: adroff + move.w (a1),d0 +3: asl.l wmu,d0 + mov (sp)+,16(a2,d0) + jmp (a4) +stl_qpw: move.l (sp)+,d0 + bra 3b + +stl_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 1f +stl_qnw: move.l (sp)+,d0 + bra 1f +stl_w_1: move.l #-1,d0 + move.b (a3)+,d0 +1: asl.l wmu,d0 + mov (sp)+,0(a2,d0) + jmp (a4) +stl_0: mov (sp)+,16(a2) ; jmp (a4) +stl_1W: mov (sp)+,l1(a2) ; jmp (a4) +stl__1W: mov (sp)+,l_1(a2) ; jmp (a4) +stl__2W: mov (sp)+,l_2(a2) ; jmp (a4) +stl__3W: mov (sp)+,l_3(a2) ; jmp (a4) +stl__4W: mov (sp)+,l_4(a2) ; jmp (a4) +stl__5W: mov (sp)+,l_5(a2) ; jmp (a4) +sdl_w_1: move.l #-1,d0 + move.b (a3)+,d0 +2: asl.l wmu,d0 + mov (sp)+,0(a2,d0) + mov (sp)+,word(a2,d0) + jmp (a4) +sdl_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 2b +sdl_qnw: move.l (sp)+,d0 + bra 2b +sdl_qpw: move.l (sp)+,d0 + bra 4f +sdl_pw: adroff + move.w (a1),d0 +4: asl.l wmu,d0 + mov (sp)+,l0(a2,d0) + mov (sp)+,l1(a2,d0) + jmp (a4) + +!------------------------------------------------------------------------ + +sde_q: move.l (sp)+,d0 + bra 1f +sde_l: adroff + move.w (a1),d0 +1: mov (sp)+,0(a6,d0) + mov (sp)+,word(a6,d0) + jmp (a4) +ste_qw: move.l (sp)+,d0 + bra 1f +ste_lw: adroff + move.w (a1),d0 + bra 1f +ste_w2: move.w #512,d0 ; bra 0f +ste_w1: move.w #256,d0 ; bra 0f +ste_w0: clr.w d0 +0: move.b (a3)+,d0 +1: asl.l wmu,d0 + mov (sp)+,0(a6,d0) + jmp (a4) + +!------------------------------------------------------------------------- + +stf_q: move.l (sp)+,a0 + bra 6f +stf_l: adroff + move.l #0,a0 + move.w (a1),a0 + bra 6f +stf_2W: move.l wrd,a0 ; add.l a0,a0 + bra 6f +stf_s0: clr.w d0 + move.b (a3)+,d0 + move.l d0,a0 + bra 6f +stf_1W: move.l wrd,a0 +6: add.l (sp)+,a0 + mov (sp)+,(a0) + jmp (a4) +sdf_q: move.l (sp)+,a0 + bra 7f +sdf_l: adroff + move.l d6,a0 + move.w (a1),a0 +7: add.l (sp)+,a0 + mov (sp)+,(a0)+ + mov (sp)+,(a0) + jmp (a4) + + +!----------------------------------------------------------------------------- +sil_w0: move.w d6,d0 + move.b (a3)+,d0 + asl.l wmu,d0 +5: move.l 16(a2,d0),a0 + mov (sp)+,(a0) + jmp (a4) +sil_w_1: move.l #-1,d0 + move.b (a3)+,d0 + asl.l wmu,d0 +2: move.l 0(a2,d0),a0 + mov (sp)+,(a0) + jmp (a4) +sil_pw: adroff + move.w (a1),d0 + bra 5b +sil_qpw: move.l (sp)+,d0 + bra 5b +sil_nw: adroff + move.w (a1),d0 + ext.l d0 + bra 2b +sil_qnw: move.l (sp)+,d0 + bra 2b + +!---------------------------------------------------------------------------- +sti_1: move.l (sp)+,a0 + move.b word-1(sp),(a0) !lsb,msb goed? + add.l wrd,sp + jmp (a4) +sti_l: adroff ; move.w (a1),d0 ; bra 0f +sti_s0: clr.w d0 ; move.b (a3)+,d0 +0: asr.l #1,d0 ; bne 1f + bcs sti_1 ; bra e_oddz +1: bcs e_oddz +#ifdef lword + asr.l #1,d0 ; bne 2f + move.l (sp)+,a0; lea 2(sp),sp + move.w (sp)+,(a0); jmp (a4) +2: bcs e_oddz +#endif + sub.w #1,d0 ; bra 3f +sti_1W: sti_2W: sti_3W: sti_4W: + sub.w #876,d0 ; asr.w #2,d0 +3: move.l (sp)+,a0 +4: mov (sp)+,(a0)+ + dbra d0,4b + jmp (a4) +sts_l: adroff ; move.w (a1),d0 +6: checksize +4: move.l (sp)+,d0; bra 0b +2: move.w (sp)+,d0; bra 0b +sts_z: mov (sp)+,d0 + bra 6b + +!------------------------------------------------------------------------------ +! POINTER ARITHMETIC +!------------------------------------------------------------------------------ +adp_l: adroff ; move.w (a1),d0 + ext.l d0 + add.l d0,(sp); jmp (a4) +adp_q: move.l (sp)+,d0 ; add.l d0,(sp) + jmp (a4) +adp_1: add.l #1,(sp); jmp (a4) +adp_2: add.l #2,(sp); jmp (a4) +adp_s0: move.l d6,d0 ; move.b (a3)+,d0 + add.l d0,(sp); jmp (a4) +adp_s_1: move.l #-1,d0 ; move.b (a3)+,d0 + add.l d0,(sp) ; jmp (a4) +ads_l: adroff ; move.w (a1),d0 + bra 0f +ads_z: mov (sp)+,d0 +0: checksize +4: move.l (sp)+,d1 ; add.l d1,(sp) ; jmp (a4) +2: move.w (sp)+,d1 ; ext.l d1 + add.l d1,(sp) ; jmp (a4) +ads_1W: mov (sp)+,d0 +#ifndef lword + ext.l d0 +#endif + add.l d0,(sp); jmp (a4) +sbs_l: adroff ; move.w (a1),d0 + bra 0f +sbs_z: mov (sp)+,d0 !d0 contains objectsize +0: checksize +4: move.l (sp)+,d1 ; sub.l d1,(sp) + jmp (a4) +2: move.l (sp)+,d1 ; sub.l d1,(sp) + clr.w (sp)+ ; jmp (a4) diff --git a/mach/mantra/int/mloop4 b/mach/mantra/int/mloop4 new file mode 100644 index 000000000..faec08179 --- /dev/null +++ b/mach/mantra/int/mloop4 @@ -0,0 +1,236 @@ +!---------------------------------------------------------------------------- +! CLEARS , INCREMENTS , DECREMENTS +!----------------------------------------------------------------------------- + +inc_z: move.l sp,a0 +4: +#if test + comp und,(a0) + bne 3f ; bsr e_iund +3: +#endif + ad #1,(a0) ; bvs 9f + jmp (a4) +#ifdef lword +inl__1W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b +inl__2W: move.l a2,a0 ; sub.l #8,a0 ; bra 4b +inl__3W: move.l a2,a0 ; sub.l #12,a0 ; bra 4b +#else +inl__1W: move.l a2,a0 ; sub.l #2,a0 ; bra 4b +inl__2W: move.l a2,a0 ; sub.l #4,a0 ; bra 4b +inl__3W: move.l a2,a0 ; sub.l #6,a0 ; bra 4b +#endif +inl_w_1: move.l #-1,d0 ; move.b (a3)+,d0 +2: asl.l wmu,d0 +1: move.l a2,a0 ; add.l d0,a0 ; bra 4b +inl_pw: adroff ; move.w (a1),d0 +6: asl.l wmu,d0 ; add.l #16,d0 + bra 1b +inl_qpw: move.l (sp)+,d0 ; bra 6b +inl_nw: adroff ; move.w (a1),d0 + ext.l d0 ; bra 2b +inl_qnw: move.l (sp)+,d0 ; bra 2b +ine_lw: adroff ; move.w (a1),d0 ; bra 5f +ine_qw: move.l (sp)+,d0 ; bra 5f +ine_w0: clr.w d0 ; move.b (a3)+,d0 +5: asl.l wmu,d0 ; move.l d0,a0 + add.l a6,a0 ; bra 4b + +!--------------------------------------------------------------------------- + +dec_z: move.l sp,a0 +4: +#if test + !let op , test gebruikt voor tst? + comp und,(a0) ;bne 3f + bsr e_iund +3: +#endif + subt #1,(a0) ; bvs 9f + jmp (a4) +del_w_1: move.l #-1,d0 ; move.b (a3)+,d0 +1: asl.l wmu,d0 +2: move.l a2,a0 ; add.l d0,a0 ; bra 4b +del_pw: adroff ; move.w (a1),d0 +5: asl.l wmu,d0 ; add.l #16,d0 ; bra 2b +del_qpw: move.l (sp)+,d0 ; bra 5b +del_nw: adroff ; move.w (a1),d0 + ext.l d0 ; bra 1f +del_qnw: move.l (sp)+,d0 ; bra 1f +dee_w0: clr.w d0 ; move.b (a3)+,d0 +0: asl.l wmu,d0 ; move.l d0,a0 + add.l a6,a0 ; bra 4b +dee_lw: adroff ; move.w (a1),d0 ; bra 0b +dee_qw: move.l (sp)+,d0 ; bra 0b + +9: bsr e_iovfl !error routine for integer overflow + jmp (a4) + +!---------------------------------------------------------------------------- + +zrl__1W: cl l_1(a2) ; jmp (a4) +zrl__2W: cl l_2(a2) ; jmp (a4) +zrl_w_1: move.l #-1,d0 ; move.b (a3)+,d0 +1: asl.l wmu,d0 ; cl 0(a2,d0) + jmp (a4) +zrl_nw: adroff ; move.w (a1),d0 + ext.l d0 ; bra 1b +zrl_qnw: move.l (sp)+,d0 ; bra 1b +zrl_pw: adroff ; move.w (a1),d0 +2: asl.l wmu,d0 ; cl 16(a2,d0) + jmp (a4) +zrl_qpw: move.l (sp)+,d0 ; bra 2b +zre_lw: adroff ; move.w (a1),d0 ; bra 7f +zre_qw: move.l (sp)+,d0 ; bra 7f +zre_w0: clr.w d0 ; move.b (a3)+,d0 +7: asl.l wmu,d0 ; cl 0(a6,d0) + jmp (a4) +zrf_l: adroff ; move.w (a1),d0 ; bra 8f +zrf_z: mov (sp)+,d0 +8: move.l d7,d1 +3: asr.w #1,d0 ; dbcs d1,3b + bcs e_oddz ; sub.w #1,d0 +0: cl -(sp) ; dbra d0,0b + jmp (a4) +zer_s0: clr.w d0 ; move.b (a3)+,d0 ; bra 8b +zer_l: adroff ; move.w (a1),d0 ; bra 8b +zer_z: mov (sp),d0 ; bra 8b +! The test on illegal argument takes some time , specially in 4byte case. + +!----------------------------------------------------------------------- +! LOGICAL GROUP +!------------------------------------------------------------------------- + +and_1W: mov (sp)+,d1 + an d1,(sp) + jmp (a4) +and_l: adroff ; move.w (a1),d0 ; bra 1f +and_z: mov (sp)+,d0 +1: ble e_oddz ; move.l d0,a0 + move.l d7,d2 +2: asr.l #1,d0 ; dbcs d2,2b ; bcs e_oddz + add.l sp,a0 ; sub.l #1,d0 +3: mov (sp)+,d1; an d1,(a0)+ + dbra d0,3b ; jmp (a4) + +!------------------------------------------------------------------------------ + +ior_1W: mov (sp)+,d1; inor d1,(sp) + jmp (a4) +ior_s0: clr.w d0 ; move.b (a3)+,d0; bra 4f +ior_l: adroff ; move.w (a1),d0 ; bra 4f +ior_z: mov (sp)+,d0 +4: ble e_oddz ; move.l d0,a0 + move.l d7,d2 +5: asr.l #1,d0 ; dbcs d2,5b ; bcs e_oddz + add.l sp,a0 ; sub.l #1,d0 + move.l d6,d1 +3: mov (sp)+,d1 + inor d1,(a0)+; dbra d0,3b + jmp (a4) + +!---------------------------------------------------------------------------- + +xor_l: adroff ; move.w (a1),d0 ; bra 6f +xor_z: mov (sp)+,d0 +6: ble e_oddz ; move.l d0,a0 + move.l d7,d2 +8: asr.l #1,d0 ; dbcs d2,8b ; bcs e_oddz + add.l sp,a0 ; sub.l #1,d0 +7: mov (sp)+,d1 + exor d1,(a0)+; dbra d0,7b + jmp (a4) + +!---------------------------------------------------------------------------- + +com_l: adroff ; move.w (a1),d0 ; bra 0f +com_z: mov (sp)+,d0 +0: ble e_oddz ; move.l d7,d2 +1: asr.l #1,d0 ; dbcs d2,1b ; bcs e_oddz + move.l sp,a0 ; sub.l #1,d0 +2: nt (a0)+ ; dbra d0,2b + jmp (a4) + +!--------------------------------------------------------------------------- + +rol_l: adroff ; move.w (a1),d0 ; bra 3f +rol_z: mov (sp)+,d0 +3: ble e_oddz ; move.l d7,d2 +4: asr.l #1,d0 ; dbcs d2,4b + bcs e_oddz + sub.l #1,d0 + mov (sp)+,d1 + bmi 2f +0: move.l sp,a0 !d0 = #words-1 , d1 = shift count +5: mov (a0),d2 ; rotl d1,d2 + mov d2,(a0)+; dbra d0,5b + jmp (a4) +2: nega d1 ; bra 0f +2: nega d1 ; bra 0b +ror_l: adroff ; move.w (a1),d0 ; bra 6f +ror_z: mov (sp)+,d0 +6: ble e_oddz ; move.l d7,d2 +7: asr.l #1,d0 ; dbcs d2,7b + bcs e_oddz ; sub.l #1,d0 + mov (sp)+,d1 + bmi 2b +0: move.l sp,a0 +8: mov (a0),d2 ; rotr d1,d2 + mov d2,(a0)+; dbra d0,8b + jmp (a4) + +!----------------------------------------------------------------------------- +! SET GROUP +!------------------------------------------------------------------------------ + +set_s0: clr.w d0 ; move.b (a3)+,d0 +0: ble e_oddz ; clr.l d1 + mov (sp)+,d1; move.l d0,d2 + move.l d7,d3 +1: asr.l #1,d2 ; dbcs d3,1b + bcs e_oddz ; sub.l #1,d2 +2: cl -(sp) ; dbra d2,2b + move.l sp,a0 ; move.l d1,d2 + asr.l #3,d2 ; cmp.l d0,d2 !d2 byte number + bmi 3f ; bsr e_set + jmp (a4) +3: +#ifdef lword + bchg #1,d2 !0->3,1->2 +#endif + bchg #0,d2 ; add.l d2,a0 + bset d1,(a0) ; jmp (a4) !d1 mod 8 bit set +set_l: adroff ; move.w (a1),d0 ; bra 0b +set_z: mov (sp)+,d0; bra 0b + +!---------------------------------------------------------------------------- + +inn_s0: clr.w d0 ; move.b (a3)+,d0 +0: ble e_oddz + move.l d6,d1 ; mov (sp)+,d1 + btst #0,d0 ; bne e_oddz +#ifdef lword + btst #1,d0 ; bne e_oddz +#endif + move.l sp,a0 ; add.l d0,sp + move.l d1,d2 ; asri #3,d2 + comp d2,d0 ; bhi 3f + cl -(sp) +!#if test +! bsr e_set +!#endif + jmp (a4) +3: +#ifdef lword + bchg #1,d2 +#else + ext.l d2 +#endif + bchg #0,d2 ; add.l d2,a0 + btst d1,(a0) ; beq 7f + mov #1,-(sp); jmp (a4) +7: cl -(sp) ; jmp (a4) +inn_l: adroff ; move.w (a1),d0 ; bra 0b +inn_z: mov (sp)+,d0; bra 0b + + diff --git a/mach/mantra/int/mloop5 b/mach/mantra/int/mloop5 new file mode 100644 index 000000000..80b54c440 --- /dev/null +++ b/mach/mantra/int/mloop5 @@ -0,0 +1,186 @@ +!-----------------------------------------------------------------------------. +! ARRAY GROUP +!------------------------------------------------------------------------------- +!subroutine +calcarr: move.l (sp)+,d3 !save return address + move.l (sp)+,a0 !address of array describtor + mov (sp)+,d0 !index + subt (a0)+,d0 !relative address + blt 9f + comp (a0)+,d0 !check upper bound + bgt 9f + move.l #0,d1 + mov (a0),d1 + mulu d1,d0 !objectsize in d1 + move.l (sp)+,a0 + ad d0,a0 !a0 address of array element + move.l d3,-(sp) + rts +9: bsr e_array ;tst.l (sp)+ ; jmp (a4) + +aar_1W: bsr calcarr ; move.l a0,-(sp) + jmp (a4) +aar_l: adroff ; cmp.w wrd,(a1) +0: bne e_illins ; bra aar_1W +aar_z: comp wrd,(sp)+ ; bra 0b + +lar_1W: bsr calcarr ; add.l d1,a0 + asr.w #1,d1 ; bcc 5f + clr.l d1 ; move.b -(a0),d1 + mov d1,-(sp); jmp (a4) +5: +#ifdef lword + asr.w #1,d1 ; bcc 6f + move.w -(a0),d1; move.l d1,-(sp) + jmp (a4) +#endif +6: sub.l #1,d1 +7: mov -(a0),-(sp); dbra d1,7b + jmp (a4) + +lar_l: adroff ; cmp.w wrd,(a1) +8: bne e_illins; bra lar_1W +lar_z: comp wrd,(sp)+ ; bra 8b + +sar_1W: bsr calcarr ; asr.w #1,d1 + bcc 5f ; testen (sp)+ + move.b -1(sp),(a0); jmp (a4) +5: +#ifdef lword + asr.w #1,d1 ; bcc 6f + tst.w (sp)+ ; move.w (sp)+,(a0) + jmp (a4) +#endif +6: sub.l #1,d1 +7: mov (sp)+,(a0)+ ; dbra d1,7b + jmp (a4) +sar_z: comp wrd,(sp)+ ; bra 1f +sar_l: adroff ; cmp.w wrd,(a1) +1: bne e_illins ; bra sar_1W + +!------------------------------------------------------------------------- +! CONVERT GROUP +!-------------------------------------------------------------------------w + +cii_z: mov (sp)+,d0 ; mov (sp)+,d1 ; !d0 destination size + !d1 source size +#if test + cmp.w wrd,d1 ; bne 0f + comp und,(sp) ; bne 0f + bsr e_iund +#endif +0: cmp.w d0,d1 ; bne 1f ; jmp (a4) +1: bge 6f ; mov (sp)+,d2 + cmp.w #1,d1 ; bne 3f !d1> temp.c +cpp -P temp.c >$2