*** empty log message ***
This commit is contained in:
parent
eebc753306
commit
14a3683f85
34
mach/mantra/int/Makefile
Normal file
34
mach/mantra/int/Makefile
Normal file
|
@ -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
|
77
mach/mantra/int/copyright
Normal file
77
mach/mantra/int/copyright
Normal file
|
@ -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
|
78
mach/mantra/int/deffile
Normal file
78
mach/mantra/int/deffile
Normal file
|
@ -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)
|
||||
|
||||
|
8
mach/mantra/int/header
Normal file
8
mach/mantra/int/header
Normal file
|
@ -0,0 +1,8 @@
|
|||
!definitions
|
||||
!#define lword
|
||||
!#define FLTRAP
|
||||
#define opfreq 0
|
||||
#define last 1
|
||||
#define test 1
|
||||
#define count 0
|
||||
#define flow 0
|
503
mach/mantra/int/mloop0
Normal file
503
mach/mantra/int/mloop0
Normal file
|
@ -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
|
364
mach/mantra/int/mloop1
Normal file
364
mach/mantra/int/mloop1
Normal file
|
@ -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
|
344
mach/mantra/int/mloop2
Normal file
344
mach/mantra/int/mloop2
Normal file
|
@ -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
|
191
mach/mantra/int/mloop3
Normal file
191
mach/mantra/int/mloop3
Normal file
|
@ -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)
|
236
mach/mantra/int/mloop4
Normal file
236
mach/mantra/int/mloop4
Normal file
|
@ -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
|
||||
|
||||
|
186
mach/mantra/int/mloop5
Normal file
186
mach/mantra/int/mloop5
Normal file
|
@ -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<d0
|
||||
ext.w d2
|
||||
#ifndef lword
|
||||
cmp.w #2,d0 ; bne 3f
|
||||
move.w d2,-(sp); jmp (a4)
|
||||
#endif
|
||||
3: ext.l d2 ; move.l d2,-(sp); jmp (a4)
|
||||
6:
|
||||
#ifdef lword
|
||||
bsr e_conv ; add.l #4,sp
|
||||
#else
|
||||
move.w (sp)+,d2
|
||||
#if test
|
||||
bne 7f ; tst.w (sp) ; bge 9f
|
||||
8: bsr e_conv ; jmp (a4)
|
||||
7: comp #-1,d2 ; bne 8b
|
||||
tst.w (sp) ; bge 8b
|
||||
#endif
|
||||
#endif
|
||||
9: jmp (a4)
|
||||
|
||||
cui_z: mov (sp)+,d0 ; mov (sp)+,d1
|
||||
sub.w d1,d0 ; bne 2f
|
||||
#if test
|
||||
testen (sp) ; bpl 1f
|
||||
0: bsr e_conv
|
||||
#endif
|
||||
1: jmp (a4)
|
||||
2:
|
||||
#ifdef lword
|
||||
sub.l d0,sp ; bsr e_conv
|
||||
#else
|
||||
bgt 3f ; cmp.w #-2,d0 ; beq 5f
|
||||
bsr e_conv
|
||||
#if test
|
||||
tst.w (sp) ; bne 0b
|
||||
tst.w 2(sp) ; bmi 0b
|
||||
#endif
|
||||
5: sub.l #-2,sp ; jmp (a4)
|
||||
3: cmp.w #2,d0 ; beq 4f
|
||||
bsr e_conv
|
||||
4: clr.w -(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
|
||||
ciu_z: mov (sp)+,d0 ; mov (sp)+,d1
|
||||
#if test
|
||||
cmp.w wrd,d1 ; bne 0f
|
||||
comp und,(sp) ; bne 0f
|
||||
bsr e_iund
|
||||
#endif
|
||||
0: sub.w d1,d0 ; bne 1f
|
||||
jmp (a4)
|
||||
#ifndef lword
|
||||
1: bgt 4f ; cmp.w #-2,d0
|
||||
beq 5f ; bsr e_conv
|
||||
5:
|
||||
#if test
|
||||
move.w (sp),d1 ; beq 6f
|
||||
not.w d1 ; beq 6f
|
||||
bsr e_conv
|
||||
#endif
|
||||
6: add.l #2,sp ; jmp (a4)
|
||||
#endif
|
||||
4: 1: bclr #0,d0 ; beq 2f
|
||||
#ifdef lword
|
||||
clr.b 2(sp)
|
||||
#else
|
||||
clr.b (sp)
|
||||
#endif
|
||||
2: bclr #1,d0 ; beq 3f
|
||||
#ifdef lword
|
||||
clr.w (sp)
|
||||
#else
|
||||
clr.w -(sp)
|
||||
#endif
|
||||
3: jmp (a4)
|
||||
|
||||
cuu_z: mov (sp)+,d0 ; mov (sp)+,d1
|
||||
sub.w d1,d0 ; bne 1f
|
||||
jmp (a4)
|
||||
1:
|
||||
#ifdef lword
|
||||
bsr e_conv ; sub.l d0,sp
|
||||
#else
|
||||
blt 3f
|
||||
#if test
|
||||
cmp.w #2,d0 ; beq 2f
|
||||
bsr e_conv
|
||||
#endif
|
||||
2: clr.w -(sp) ; jmp (a4)
|
||||
3:
|
||||
#if test
|
||||
cmp.w #-2,d0 ; beq 4f
|
||||
bsr e_conv
|
||||
#endif
|
||||
4: tst.w (sp)+
|
||||
#if test
|
||||
beq 5f ; bsr e_conv
|
||||
#endif
|
||||
#endif
|
||||
5: jmp (a4)
|
||||
|
||||
!--------------------------------------------------------------------------
|
||||
cuf_z: cfu_z: cff_z: cfi_z: cif_z:
|
||||
mov (sp)+,d0 ; subt (sp)+,d0
|
||||
ext.l d0
|
||||
sub.l d0,sp
|
||||
#ifdef FLTRAP
|
||||
bra flnim !floating point not implemented
|
||||
#else
|
||||
jmp (a4)
|
||||
#endif
|
362
mach/mantra/int/mloop6
Normal file
362
mach/mantra/int/mloop6
Normal file
|
@ -0,0 +1,362 @@
|
|||
!----------------------------------------------------------------------------
|
||||
! SIGNED INTEGER ARITHMETIC
|
||||
!------------------------------------------------------------------------------
|
||||
|
||||
adi_l: adroff ; move.w (a1),d0 ; bra 1f
|
||||
adi_z: mov (sp)+,d0
|
||||
1: sub.w wrd,d0 ; beq adi_1W
|
||||
sub.w wrd,d0 ; beq adi_2W
|
||||
bra e_oddz
|
||||
adi_1W:
|
||||
#if test
|
||||
comp und,(sp) ; beq 6f
|
||||
comp und,word(sp); bne 7f
|
||||
6: bsr e_iund
|
||||
#endif
|
||||
7: mov (sp)+,d0 ; ad d0,(sp)
|
||||
#if test
|
||||
bvs 9f
|
||||
#endif
|
||||
jmp (a4)
|
||||
adi_2W:
|
||||
#ifdef lword
|
||||
bsr no8bar ; add.l #8,sp
|
||||
jmp (a4)
|
||||
#else
|
||||
move.l (sp)+,d0 ; add.l d0,(sp)
|
||||
#endif
|
||||
#if test
|
||||
bvs 9f
|
||||
#endif
|
||||
jmp (a4)
|
||||
|
||||
!--------------------------------------------------------------------------
|
||||
|
||||
sbi_z: mov (sp)+,d0 ; bra 1f
|
||||
sbi_l: adroff ; move.w (a1),d0
|
||||
1: sub.w wrd,d0 ; beq sbi_1W
|
||||
sub.w wrd,d0 ; beq sbi_2W
|
||||
bra e_oddz
|
||||
sbi_1W:
|
||||
#if test
|
||||
comp und,(sp) ; beq 6f
|
||||
comp und,word(sp) ; bne 7f
|
||||
6: bsr e_iund
|
||||
#endif
|
||||
7: mov (sp)+,d0 ; subt d0,(sp)
|
||||
#if test
|
||||
bvs 9f
|
||||
#endif
|
||||
jmp (a4)
|
||||
sbi_2W:
|
||||
#ifdef lword
|
||||
add.l #8,sp ; bsr no8bar
|
||||
jmp (a4)
|
||||
#else
|
||||
move.l (sp)+,d0 ; sub.l d0,(sp)
|
||||
#endif
|
||||
#if test
|
||||
bvs 9f
|
||||
#endif
|
||||
jmp (a4)
|
||||
9: bsr e_iovfl ; jmp (a4)
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
mli_z: mov (sp)+,d0 ; bra 0f
|
||||
mli_l: adroff ; move.w (a1),d0
|
||||
0: sub.w wrd,d0 ; beq mli_1W
|
||||
sub.w wrd,d0 ; beq mli_2W
|
||||
bra e_oddz
|
||||
mli_1W: mov (sp)+,d0
|
||||
#if test
|
||||
comp und,d0 ; beq 1f
|
||||
comp und,(sp) ; bne 2f
|
||||
1: bsr e_iund
|
||||
#endif
|
||||
2:
|
||||
#ifdef lword
|
||||
move.l (sp)+,d1 ; bra 4f
|
||||
#else
|
||||
muls (sp),d0 ; move.w d0,(sp)
|
||||
#if test
|
||||
bpl 3f ; not.l d0
|
||||
3: swap d0 ; tst.w d0 ; bne 9b
|
||||
#endif
|
||||
jmp (a4)
|
||||
#endif
|
||||
mli_2W:
|
||||
#ifdef lword
|
||||
bsr no8bar ; add.l #4,sp
|
||||
move.l (sp)+,d0 ; add.l #4,sp
|
||||
move.l (sp)+,d1
|
||||
#else
|
||||
move.l (sp)+,d0 ; move.l (sp)+,d1
|
||||
#endif
|
||||
4: clr.w d5 ; tst.l d0 ; bpl 5f
|
||||
neg.l d0 ; not.w d5
|
||||
5: tst.l d1 ; bpl 6f
|
||||
neg.l d1 ; not.w d5
|
||||
6: bsr mlu4
|
||||
#if test
|
||||
tst.l d4 ; bne 7f
|
||||
tst.l d0 ; bpl 8f
|
||||
7: bsr e_iovfl
|
||||
#endif
|
||||
8: tst.w d5 ; beq 0f
|
||||
neg.l d0
|
||||
0: move.l d0,-(sp)
|
||||
!next 4 lines only in case 8 byte arithmetic
|
||||
!#ifdef lword
|
||||
! bmi 1f ; clr.l -(sp) ; bra 2f
|
||||
!1: move.l #-1,-(sp)
|
||||
!#endif
|
||||
2: jmp (a4)
|
||||
|
||||
!subroutine for unsigned 4byte multiplication . Expects multiplier in d0 and
|
||||
! multiplicant in d1 . Returns 4 byte result in d0 . If d4=0 overflow did
|
||||
! not occur on the multiplication , else it did .
|
||||
|
||||
.define mlu4
|
||||
.text
|
||||
|
||||
mlu4: move.l d1,d3 ; move.l d0,d2
|
||||
swap d2 ; swap d3
|
||||
#if test
|
||||
move.l d3,d4 ; mulu d2,d4
|
||||
#endif
|
||||
mulu d0,d3 ; swap d3
|
||||
mulu d1,d2 ; swap d2
|
||||
#if test
|
||||
or.w d3,d4 ; or.w d2,d4
|
||||
#endif
|
||||
clr.w d3 ; clr.w d2
|
||||
mulu d1,d0 ; add.l d3,d0
|
||||
#if test
|
||||
bvc 1f ; bset #0,d4
|
||||
#endif
|
||||
1: add.l d2,d0
|
||||
#if test
|
||||
bvc 2f ; bset #0,d4
|
||||
#endif
|
||||
2: rts
|
||||
|
||||
!---------------------------------------------------------------------------
|
||||
|
||||
dvi_z: mov (sp)+,d0 ; bra 0f
|
||||
dvi_l: adroff ; move.w (a1),d0
|
||||
0: sub.w wrd,d0 ; beq dvi_1W
|
||||
sub.w wrd,d0 ; beq dvi_2W
|
||||
bra e_oddz
|
||||
dvi_1W:
|
||||
#ifdef lword
|
||||
bsr dvi4 ; move.l d1,-(sp)
|
||||
#else
|
||||
bsr dvi2 ; move.w d1,-(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
dvi_2W:
|
||||
#ifdef lword
|
||||
bsr no8bar ; tst.l (sp)+
|
||||
move.l (sp)+,(sp) ; bsr dvi4
|
||||
move.l d1,-(sp) ; clr.l -(sp)
|
||||
#else
|
||||
bsr dvi4 ; move.l d1,-(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
|
||||
rmi_z: mov (sp)+,d0 ; bra 1f
|
||||
rmi_l: adroff ; move.w (a1),d0
|
||||
1: sub.l wrd,d0 ; beq rmi_1W
|
||||
sub.l wrd,d0 ; beq rmi_2W
|
||||
bra e_oddz
|
||||
rmi_1W:
|
||||
#ifdef lword
|
||||
bsr dvi4 ; move.l d3,-(sp)
|
||||
#else
|
||||
bsr dvi2 ; swap d1
|
||||
move.w d1,-(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
rmi_2W:
|
||||
#ifdef lword
|
||||
bsr no8bar ; tst.l (sp)+
|
||||
move.l (sp)+,(sp) ; bsr dvi4
|
||||
move.l d3,-(sp) ; clr.l -(sp)
|
||||
#else
|
||||
bsr dvi4 ; move.l d3,-(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
|
||||
! 2byte division . In d1: quotient=low word ; remainder=high word
|
||||
dvi2: move.l (sp)+,d2
|
||||
move.w (sp)+,d0 !divisor
|
||||
move.w (sp)+,d1 ; ext.l d1 !dividend
|
||||
#if test
|
||||
cmp.w und,d1 ; bne 1f
|
||||
bsr e_iund
|
||||
1: cmp.w und,d0 ; bne 2f
|
||||
bsr e_iund
|
||||
2: tst.w d0 ; bne 3f
|
||||
bsr e_idivz ; move.l und,d1 ; bra 4f
|
||||
3:
|
||||
#endif
|
||||
divs d0,d1
|
||||
4: move.l d2,-(sp) ; rts
|
||||
|
||||
! long signed division . quotient in d1 , remainder in d3
|
||||
dvi4: move.l (sp)+,d5
|
||||
move.l (sp)+,d0 !divisor
|
||||
move.l (sp)+,d1 !dividend
|
||||
#ifdef lword
|
||||
cmp.l und,d0 ; beq 0f
|
||||
cmp.l und,d1 ; bne 1f
|
||||
0: bsr e_iund
|
||||
1:
|
||||
#endif
|
||||
clr.l d4 !sign in d4
|
||||
tst.l d0 ; bpl 1f
|
||||
neg.l d0 ; not.w d4
|
||||
1: tst.l d1 ; bpl 2f
|
||||
neg.l d1
|
||||
not.w d4 ; swap d4
|
||||
not.w d4 ; swap d4
|
||||
2: bsr dvu4
|
||||
tst.w d4 ; beq 3f
|
||||
neg.l d1 !quotient
|
||||
3: tst.l d4 ; bpl 4f
|
||||
neg.l d3 !remainder
|
||||
4: move.l d5,-(sp) ; rts
|
||||
|
||||
!Expects d0 divisor , d1 dividend. Gives d1 quotient ,d3 remainder
|
||||
|
||||
.define dvu4
|
||||
.text
|
||||
dvu4:
|
||||
#if test
|
||||
tst.l d0 ; bne 1f
|
||||
bsr e_idivz
|
||||
1:
|
||||
#endif
|
||||
clr.l d3 ; move.l #32,d2
|
||||
3: lsl.l #1,d1 ; roxl.l #1,d3
|
||||
cmp.l d0,d3 ; blt 4f
|
||||
sub.l d0,d3 ; add.l #1,d1
|
||||
4: sub.w #1,d2 ; bgt 3b
|
||||
rts
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
ngi_z: mov (sp)+,d0 ; bra 0f
|
||||
ngi_l: adroff ; move.w (a1),d0
|
||||
0: sub.l wrd,d0 ; bne 2f
|
||||
#if test
|
||||
comp und,(sp) ; bne 1f
|
||||
bsr e_iund
|
||||
1:
|
||||
#endif
|
||||
nega (sp) ; jmp (a4)
|
||||
2: cmp.l wrd,d0 ; beq 3f
|
||||
bra e_oddz
|
||||
3:
|
||||
#ifdef lword
|
||||
bsr no8bar ; not.l (sp)
|
||||
neg.l 4(sp)
|
||||
#else
|
||||
neg.l (sp)
|
||||
#endif
|
||||
#if test
|
||||
bvc 4f ; bsr e_iovfl
|
||||
4:
|
||||
#endif
|
||||
jmp (a4)
|
||||
|
||||
!--------------------------------------------------------------------------
|
||||
|
||||
sli_z: mov (sp)+,d0 ; bra 0f
|
||||
sli_l: adroff ; move.w (a1),d0
|
||||
0: sub.w wrd,d0 ; beq sli_1W
|
||||
sub.w wrd,d0 ; beq sli2
|
||||
bra e_oddz
|
||||
sli_1W: mov (sp)+,d0 !d0 contains the shift count
|
||||
bmi 5f
|
||||
9: mov (sp)+,d1 !integer to shift
|
||||
#if test
|
||||
comp und,d0 ; bne 1f
|
||||
bsr e_iund
|
||||
1:
|
||||
#endif
|
||||
asle d0,d1 ! ASLE
|
||||
#if test
|
||||
bvc 2f ; bsr e_iovfl
|
||||
2:
|
||||
#endif
|
||||
mov d1,-(sp) ; jmp (a4)
|
||||
sli2:
|
||||
#ifdef lword
|
||||
bsr no8bar ; move.l (sp)+,d1
|
||||
move.l (sp)+,d2 ; move.l (sp)+,d0
|
||||
3: asl.l #1,d0 ; roxl.l #1,d2
|
||||
sub.l #1,d1 ; bgt 3b
|
||||
move.l d0,-(sp) ; move.l d2,-(sp)
|
||||
#else
|
||||
move.w (sp)+,d0
|
||||
bmi 6f
|
||||
8: move.l (sp),d1
|
||||
asl.l d0,d1
|
||||
#if test
|
||||
bvc 4f ; bsr e_iovfl
|
||||
4:
|
||||
#endif
|
||||
move.l d1,(sp)
|
||||
#endif
|
||||
jmp (a4)
|
||||
5: nega d0 ; bra 8f
|
||||
#ifndef lword
|
||||
6: neg.w d0 ; bra 9f
|
||||
#endif
|
||||
|
||||
!------------------------------------------------------------------------------
|
||||
7: nega d0 ; bra 9b
|
||||
#ifndef lword
|
||||
6: neg.w d0 ; bra 8b
|
||||
#endif
|
||||
|
||||
sri_z: mov (sp)+,d0 ; bra 0f
|
||||
sri_l: adroff ; move.w (a1),d0
|
||||
0: sub.w wrd,d0 ; bne sri2
|
||||
mov (sp)+,d0
|
||||
bmi 7b
|
||||
8: mov (sp)+,d1
|
||||
#if test
|
||||
comp und,d0 ; bne 1f
|
||||
bsr e_iund
|
||||
1:
|
||||
#endif
|
||||
asri d0,d1
|
||||
#if test
|
||||
bvc 2f ; bsr e_iovfl
|
||||
2:
|
||||
#endif
|
||||
mov d1,-(sp) ; jmp (a4)
|
||||
sri2: sub.w wrd,d0 ; beq 3f
|
||||
bra e_oddz
|
||||
3:
|
||||
#ifdef lword
|
||||
bsr no8bar ; move.l (sp)+,d1
|
||||
move.l (sp)+,d2 ; move.l (sp),d0
|
||||
sub.l #1,d1
|
||||
4: asr.l #1,d2 ; roxr.l #1,d0 ; dbra d1,4b
|
||||
move.l d0,(sp) ; move.l d2,-(sp)
|
||||
#else
|
||||
move.w (sp)+,d0
|
||||
bmi 6b
|
||||
9: move.l (sp),d1
|
||||
asr.l d0,d1
|
||||
#if test
|
||||
bvc 5f ; bsr e_iovfl
|
||||
5:
|
||||
#endif
|
||||
move.l d1,(sp)
|
||||
#endif
|
||||
jmp (a4)
|
120
mach/mantra/int/mloop7
Normal file
120
mach/mantra/int/mloop7
Normal file
|
@ -0,0 +1,120 @@
|
|||
!------------------------------------------------------------------------------
|
||||
! UNSIGNED ARITHMETIC
|
||||
!-----------------------------------------------------------------------------
|
||||
|
||||
adu_z: mov (sp)+,d0 ; bra 0f
|
||||
adu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d1 ; add.w d1,(sp)
|
||||
jmp (a4)
|
||||
4: move.l (sp)+,d1; add.l d1,(sp)
|
||||
jmp (a4)
|
||||
|
||||
sbu_z: mov (sp)+,d0 ; bra 0f
|
||||
sbu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d1 ; sub.w d1,(sp)
|
||||
jmp (a4)
|
||||
4: move.w (sp)+,d1 ; sub.l d1,(sp)
|
||||
jmp (a4)
|
||||
|
||||
!------------------------------------------------------------------------------
|
||||
|
||||
mlu_z: mov (sp)+,d0 ; bra 0f
|
||||
mlu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d0 ; mulu (sp),d0
|
||||
move.w d0,(sp) ; jmp (a4)
|
||||
4: move.l (sp)+,d0 ; move.l (sp),d1
|
||||
bsr mlu4 ; move.l d0,(sp)
|
||||
jmp (a4)
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
dvu_z: mov (sp)+,d0 ; bra 0f
|
||||
dvu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d1 ; beq 3f
|
||||
move.w (sp),d0 ; divu d1,d0
|
||||
move.w d0,(sp) ; jmp (a4)
|
||||
3: bsr e_idivz ; move.w #-1,(sp)
|
||||
jmp (a4)
|
||||
4: move.l (sp)+,d0 ; move.l (sp),d1
|
||||
bsr dvu4 ; move.l d1,(sp)
|
||||
jmp (a4)
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
rmu_z: mov (sp)+,d0 ; bra 0f
|
||||
rmu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d1 ; beq 3f
|
||||
move.w (sp),d0 ; divu d1,d0
|
||||
swap d0 ; move.w d0,(sp)
|
||||
jmp (a4)
|
||||
3: bsr e_idivz ; clr.w (sp)
|
||||
jmp (a4)
|
||||
4: move.l (sp)+,d0 ; move.l (sp),d1
|
||||
bsr dvu4 ; move.l d3,(sp)
|
||||
jmp (a4)
|
||||
|
||||
!------------------------------------------------------------------------.
|
||||
|
||||
slu_z: mov (sp)+,d0 ; bra 0f
|
||||
slu_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d0
|
||||
bmi 7f
|
||||
3: move.w (sp),d1
|
||||
lsl.w d0,d1 ; move.w d1,(sp)
|
||||
jmp (a4)
|
||||
4: mov (sp)+,d0
|
||||
bmi 9f
|
||||
5: move.l (sp),d1
|
||||
lsl.l d0,d1 ; move.l d1,(sp)
|
||||
jmp (a4)
|
||||
|
||||
7: neg.w d0 ; bra 3f
|
||||
9: nega d0 ; bra 5f
|
||||
7: neg.w d0 ; bra 3b
|
||||
9: nega d0 ; bra 5b
|
||||
|
||||
sru_z: mov (sp)+,d0 ; bra 0f
|
||||
sru_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d0
|
||||
bmi 7b
|
||||
3: move.w (sp),d1
|
||||
lsr.w d0,d1 ; move.w d1,(sp)
|
||||
jmp (a4)
|
||||
4: mov (sp)+,d0
|
||||
bmi 9b
|
||||
5: move.l (sp),d1
|
||||
lsr.l d0,d1 ; move.l d1,(sp)
|
||||
jmp (a4)
|
||||
|
||||
!------------------------------------------------------------------------------
|
||||
! DUMMY FLOATING POINT ROUTINES
|
||||
!------------------------------------------------------------------------------
|
||||
adf_l: sbf_l: mlf_l: dvf_l:
|
||||
adroff ; move.w (a1),d0
|
||||
1: add.l d0,sp
|
||||
#ifdef FLTRAP
|
||||
bra flnim
|
||||
#else
|
||||
jmp (a4)
|
||||
#endif
|
||||
adf_z: sbf_z: mlf_z: dvf_z:
|
||||
mov (sp)+,d0 ; bra 1b
|
||||
adf_s0: sbf_s0: mlf_s0: dvf_s0:
|
||||
move.l #0,d0 ; move.b (a3)+,d0
|
||||
bra 1b
|
||||
fef_l: sub.l wrd,sp
|
||||
fif_l: ngf_l: adroff
|
||||
fef_z:
|
||||
#ifdef FLTRAP
|
||||
bra flnim
|
||||
#else
|
||||
jmp (a4)
|
||||
#endif
|
||||
ngf_z: fif_z: add.l wrd,sp ; bra fef_z
|
234
mach/mantra/int/mloop8
Normal file
234
mach/mantra/int/mloop8
Normal file
|
@ -0,0 +1,234 @@
|
|||
!-------------------------------------------------------------------------
|
||||
! TEST AND BRANCH GROUP
|
||||
!-------------------------------------------------------------------------
|
||||
|
||||
tlt_z: testen (sp)+ ; blt true ; cl -(sp) ; jmp (a4)
|
||||
tle_z: testen (sp)+ ; ble true ; cl -(sp) ; jmp (a4)
|
||||
teq_z: testen (sp)+ ; beq true ; cl -(sp) ; jmp (a4)
|
||||
tne_z: testen (sp)+ ; bne true ; cl -(sp) ; jmp (a4)
|
||||
tge_z: testen (sp)+ ; bge true ; cl -(sp) ; jmp (a4)
|
||||
tgt_z: testen (sp)+ ; bgt true ; cl -(sp) ; jmp (a4)
|
||||
|
||||
true: mov #1,-(sp) ; jmp (a4)
|
||||
|
||||
zlt_s0: testen (sp)+ ; blt bra_s0 ; bra nobr2
|
||||
zlt_l: testen (sp)+ ; blt bra_l ; bra nobr3
|
||||
zlt_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; blt 1f ; jmp (a4)
|
||||
zle_s0: testen (sp)+ ; ble bra_s0 ; bra nobr2
|
||||
zle_l: testen (sp)+ ; ble bra_l ; bra nobr3
|
||||
zle_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; ble 1f ; jmp (a4)
|
||||
zeq_s0: testen (sp)+ ; beq bra_s0 ; bra nobr2
|
||||
zeq_s1: testen (sp)+ ; beq bra_s1 ; bra nobr2
|
||||
zeq_l: testen (sp)+ ; beq bra_l ; bra nobr3
|
||||
zeq_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; beq 1f ; jmp (a4)
|
||||
zne_s0: testen (sp)+ ; bne bra_s0 ; bra nobr2
|
||||
zne_s_1: testen (sp)+ ; bne bra_s_1 ; bra nobr2
|
||||
zne_l: testen (sp)+ ; bne bra_l ; bra nobr3
|
||||
zne_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; bne 1f ; jmp (a4)
|
||||
zge_s0: testen (sp)+ ; bge bra_s0 ; bra nobr2
|
||||
zge_l: testen (sp)+ ; bge bra_l ; bra nobr3
|
||||
zge_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; bge 1f ; jmp (a4)
|
||||
zgt_s0: testen (sp)+ ; bgt bra_s0 ; bra nobr2
|
||||
zgt_l: testen (sp)+ ; bgt bra_l ; bra nobr3
|
||||
zgt_q: move.l (sp)+,d0
|
||||
testen (sp)+ ; bgt 1f ; jmp (a4)
|
||||
|
||||
blt_s0: comp (sp)+,(sp)+ ; blt bra_s0 ; bra nobr2
|
||||
blt_l: comp (sp)+,(sp)+ ; blt bra_l ; bra nobr3
|
||||
blt_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; blt 1f ; jmp (a4)
|
||||
ble_s0: comp (sp)+,(sp)+ ; ble bra_s0 ; bra nobr2
|
||||
ble_l: comp (sp)+,(sp)+ ; ble bra_l ; bra nobr3
|
||||
ble_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; ble 1f ; jmp (a4)
|
||||
beq_s0: comp (sp)+,(sp)+ ; beq bra_s0 ; bra nobr2
|
||||
beq_l: comp (sp)+,(sp)+ ; beq bra_l ; bra nobr3
|
||||
beq_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; beq 1f ; jmp (a4)
|
||||
bne_s0: comp (sp)+,(sp)+ ; bne bra_s0 ; bra nobr2
|
||||
bne_l: comp (sp)+,(sp)+ ; bne bra_l ; bra nobr3
|
||||
bne_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; bne 1f ; jmp (a4)
|
||||
bge_s0: comp (sp)+,(sp)+ ; bge bra_s0 ; bra nobr2
|
||||
bge_l: comp (sp)+,(sp)+ ; bge bra_l ; bra nobr3
|
||||
bge_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; bge 1f ; jmp (a4)
|
||||
bgt_s0: comp (sp)+,(sp)+ ; bgt bra_s0 ; bra nobr2
|
||||
bgt_l: comp (sp)+,(sp)+ ; bgt bra_l ; bra nobr3
|
||||
bgt_q: move.l (sp)+,d0
|
||||
comp (sp)+,(sp)+ ; bgt 1f ; jmp (a4)
|
||||
|
||||
bra_s0:
|
||||
move.l d6,d0
|
||||
0: move.b (a3)+,d0
|
||||
1: add.l d0,a3 ; jmp (a4)
|
||||
bra_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
|
||||
move.w (sp)+,d0 ; ext.l d0
|
||||
bra 1b
|
||||
bra_q:
|
||||
move.l (sp)+,d0 ; bra 1b
|
||||
bra_s1: move.w #0x100,d0 ; bra 0b
|
||||
bra_s_1: move.l #-1,d0 ; bra 0b
|
||||
bra_s_2: move.l #-0x200,d0 ; bra 0b
|
||||
nobr2: add.l #1,a3 ; jmp (a4)
|
||||
nobr3: add.l #2,a3 ; jmp (a4)
|
||||
|
||||
!---------------------------------------------------------------------------
|
||||
! COMPARE GROUP
|
||||
!-----------------------------------------------------------------------------
|
||||
|
||||
cmi_z: mov (sp)+,d0 ; bra 0f
|
||||
cmi_l: adroff ; move.w (a1),d0
|
||||
0: sub.w wrd,d0 ; beq cmi_1W
|
||||
sub.w wrd,d0 ; beq cmi_2W
|
||||
bra e_oddz
|
||||
cmi_1W: comp (sp)+,(sp)+ ; bgt 1f ; beq 2f
|
||||
3: mov #-1,-(sp) ; jmp (a4)
|
||||
1: mov #1,-(sp) ; jmp (a4)
|
||||
2: cl -(sp) ; jmp (a4)
|
||||
cmi_2W:
|
||||
#ifdef lword
|
||||
bsr no8bar ; bra e_oddz
|
||||
#endif
|
||||
cmp.l (sp)+,(sp)+ ; blt 3b ; beq 2b
|
||||
bra 1b
|
||||
|
||||
cmu_z: mov (sp)+,d0 ; bra 4f
|
||||
cmu_l: adroff ; move.w (a1),d0
|
||||
4: sub.w wrd,d0 ; bne 5f
|
||||
comp (sp)+,(sp)+ ; bcs 3b
|
||||
beq 2b ; bra 1b
|
||||
5: sub.w wrd,d0 ; bne e_oddz
|
||||
#ifdef lword
|
||||
bsr no8bar ; bra e_oddz
|
||||
#endif
|
||||
cmp_z: cmp.l (sp)+,(sp)+ ; bcs 3b
|
||||
beq 2b ; bra 1b
|
||||
|
||||
cms_l: adroff ; move.w (a1),d0
|
||||
bra 0f
|
||||
cms_z: mov (sp)+,d0 ; bra 0f
|
||||
cms_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
0: move.l d0,d1 ; move.l sp,a0
|
||||
asri wmu,d1 ; subt #1,d1
|
||||
add.l d0,sp ; move.l sp,d2
|
||||
1: comp (a0)+,(sp)+ ; bne 2f
|
||||
dbra d1,1b
|
||||
mov d6,-(sp) ; jmp (a4)
|
||||
2: add.l d0,d2 ; move.l d2,sp
|
||||
move.l #1,d1 ; mov d1,-(sp)
|
||||
jmp (a4)
|
||||
|
||||
|
||||
! DUMMY FLOAT ROUTINES. POINTER ADJUSTMENT AND WARNING
|
||||
|
||||
cmf_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
9: add.w d0,d0 ; add.l d0,sp
|
||||
cl -(sp)
|
||||
#ifdef FLTRAP
|
||||
bra flnim
|
||||
#else
|
||||
jmp (a4)
|
||||
#endif
|
||||
cmf_l: adroff ; move.w (a1),d0 ; bra 9b
|
||||
cmf_z: mov (sp)+,d0 ; bra 9b
|
||||
|
||||
!-------------------------------------------------------------------------
|
||||
! CALL AND RETURN GROUP
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
cai_z: move.l (sp)+,d0 ; bra 1f
|
||||
cal_q: move.l (sp)+,d0 ; bra 1f
|
||||
cal_l: adroff ; move.w (a1),d0 ; bra 1f
|
||||
cal_s0: move.w d6,d0 ; move.b (a3)+,d0 ; bra 1f
|
||||
cal_1: cal_2: cal_3: cal_4: cal_5: cal_6: cal_7: cal_8:
|
||||
cal_9: cal_10: cal_11: cal_12: cal_13: cal_14: cal_15: cal_16:
|
||||
cal_17: cal_18: cal_19: cal_20: cal_21: cal_22: cal_23: cal_24:
|
||||
cal_25: cal_26: cal_27: cal_28:
|
||||
asr.w #2,d0 ; sub.w #0x3F,d0
|
||||
lblcal:
|
||||
1: cmp.l nproc,d0 ; bhi e_badpc
|
||||
asl.l #3,d0
|
||||
#if flow + count + prof
|
||||
move.l d0,d1 ; asl.l #1,d1
|
||||
add.l d1,d0 !PROC DES. 24 BYTES
|
||||
#endif
|
||||
move.l (a6),-(sp)
|
||||
move.l 4(a6),-(sp) ; move.l a3,-(sp)
|
||||
link a2,#0 ; move.l d0,a0
|
||||
add.l pd,a0 !a0 points at proc. des.
|
||||
#if prof+count+flow
|
||||
tst.l 20(a0) !A FILE NAME DEFINED IN THIS PROC
|
||||
bne 4f !YES ? CONTINUE
|
||||
move.l 8(sp),20(a0) !NO ? TAKE OLD FILE NAME
|
||||
4: move.l curproc,8(sp) !SAVE OLD PROCEDURE DESCRIPTOR
|
||||
move.l a0,curproc !CONTINUE WITH NEW ONE
|
||||
move.l 8(a0),d0 !COUNT POINTER MINUS LINE NUMBER
|
||||
sub.l 12(a0),d0 !OF FIRST LINE IN countfld
|
||||
move.l d0,countfld
|
||||
#endif
|
||||
move.l (a0)+,d1 ; sub.l d1,sp
|
||||
claimstack ; add.l d1,sp
|
||||
tst.l d1 ; beq 3f
|
||||
sub.l #1,d1 ; asr.l wmu,d1
|
||||
2: mov und,-(sp) ; dbra d1,2b
|
||||
3: move.l (a0),a3 ; jmp (a4)
|
||||
|
||||
ret_l: adroff ; move.w (a1),d0
|
||||
bra 1f
|
||||
ret_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
bra 1f
|
||||
ret_1W: move.w d6,d0 ; bra 5f
|
||||
1: blt e_oddz ; beq ret_0
|
||||
comp #32,d0 ; ble 2f
|
||||
bsr e_badlfr
|
||||
2: sub.w #1,d0 ; asr.w wmu,d0
|
||||
5: move.w d0,retsize !RETSIZE CONTAINS
|
||||
3: mov (sp)+,(a1)+ ; dbra d0,3b ! #WORDS-1
|
||||
lea retarea,a1 ; bra 4f
|
||||
ret_0: move.w #-1,retsize
|
||||
4: unlk a2 ; cmp.l a2,d6
|
||||
beq hlt_z ; move.l (sp)+,a3
|
||||
move.l (sp)+,a0 !FILE OR PROC DES BASE IN a0
|
||||
#if count+flow+prof
|
||||
move.l a0,curproc !SAVE PROC DES BASE CUR PROC
|
||||
move.l 8(a0),d0 !d0 IS COUNT
|
||||
sub.l 12(a0),d0 !d0 IS COUNT-FIRST LINE
|
||||
move.l d0,countfld !RESTORE POINTER
|
||||
add.l (sp),d0 !ADD LINE NUMBER
|
||||
move.l d0,countptr
|
||||
#if prof
|
||||
beq 5f
|
||||
asl.l #2,d0
|
||||
add.l ltime,d0
|
||||
move.l d0,profile !profile POINTS AT COUNT
|
||||
5:
|
||||
#endif
|
||||
move.l 20(a0),a0 !POINTER TO FILE NAME IN a0
|
||||
#endif
|
||||
move.l a0,4(a6) !OLD FILE ADDRESS
|
||||
move.l (sp)+,(a6) !OLD LINE NUMBER
|
||||
jmp (a4)
|
||||
|
||||
lfr_1W: move.w d6,d0 ; move.l wrd,d1
|
||||
0: cmp.w retsize,d0 ; beq 1f
|
||||
bsr e_badlfr
|
||||
1: add.l d1,a1
|
||||
2: mov -(a1),-(sp) ; dbra d0,2b
|
||||
5: jmp (a4)
|
||||
lfr_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
|
||||
move.w (sp)+,d0 ; bra 3f
|
||||
lfr_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
3: move.l d7,d2 ; move.l d0,d1
|
||||
4: asr.w #1,d0 ; bcs e_illins
|
||||
dbra d2,4b ; beq 5b
|
||||
sub.w #1,d0 ; bra 0b
|
||||
lfr_2W: move.l wrd,d1 ; add.l d1,d1
|
||||
move.l #1,d0 ; bra 0b
|
||||
|
||||
e_badlfr: mov 0xD,-(sp) ; bra error
|
296
mach/mantra/int/mloop9
Normal file
296
mach/mantra/int/mloop9
Normal file
|
@ -0,0 +1,296 @@
|
|||
!---------------------------------------------------------------------------
|
||||
! MISCELLANEOUS
|
||||
!----------------------------------------------------------------------------
|
||||
ass_z: mov (sp)+,d0 ; bra 5f
|
||||
ass_l: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
|
||||
move.w (sp)+,d0
|
||||
5: checksize
|
||||
bra e_oddz
|
||||
4: move.l (sp)+,d0 ; bpl 3f
|
||||
asr.l wmu,d0 ; bra 8f
|
||||
2: move.w (sp)+,d0 ; bpl 3f
|
||||
asr.w #1,d0 ; ext.l d0
|
||||
bra 8f
|
||||
|
||||
asp_1W: asp_2W: asp_3W: asp_4W: asp_5W:
|
||||
sub.w #176,d0
|
||||
#ifndef lword
|
||||
asr.l #1,d0
|
||||
#endif
|
||||
3: add.l d0,sp ; jmp (a4)
|
||||
asp_w0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
5: asl.l wmu,d0 ; bra 3b
|
||||
asp_lw: move.b (a3)+,-(sp) ; move.b (a3)+,1(sp)
|
||||
move.w (sp)+,d0 ; ext.l d0
|
||||
6: bmi 8f
|
||||
asl.l wmu,d0 ; bra 3b
|
||||
8: neg.l d0 ; sub.l #1,d0
|
||||
1: mov und,-(sp) ; dbra d0,1b
|
||||
jmp (a4)
|
||||
asp_qw: move.l (sp)+,d0 ; bra 6b
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
bls_z: mov (sp)+,d0 ; bra 0f
|
||||
bls_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d0 ; bra 0f
|
||||
4: move.l (sp)+,d0 ; bra 0f
|
||||
|
||||
blm_q: move.l (sp)+,d0 ; bra 0f
|
||||
blm_l: adroff ; move.w (a1),d0
|
||||
bra 0f
|
||||
blm_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
0: move.l d0,d2 ; asr.w wmu,d2
|
||||
beq 5f ; move.l a1,d1
|
||||
sub.w #1,d2 ; move.l (sp)+,a0 !dest. address
|
||||
move.l (sp)+,a1 ; cmp.l a0,a1
|
||||
!a1 contains source address. beware of overlap of pieces
|
||||
beq 3f ; bcs 2f
|
||||
1: mov (a1)+,(a0)+ ; dbra d2,1b
|
||||
3: move.l d1,a1
|
||||
5: jmp (a4)
|
||||
2: add.l d0,a1 ; add.l d0,a0
|
||||
4: mov -(a1),-(a0) ; dbra d2,4b
|
||||
bra 3b
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
csa_z: mov (sp)+,d0 ; bra 0f
|
||||
csa_l: adroff ; move.w (a1),d0
|
||||
0: sub.l wrd,d0 ; bne e_illins
|
||||
csa_1W: move.l (sp)+,a0 ; mov (sp)+,d0
|
||||
ext.l d0
|
||||
add.l #4,a0 ; subt (a0),d0
|
||||
blt 6f
|
||||
comp word(a0),d0 ; bhi 6f
|
||||
asl.l #2,d0 ; add.l wrd,d0
|
||||
move.l word(a0,d0),d1 ; bne 5f
|
||||
6: sub.l #4,a0 ; move.l (a0),d1
|
||||
beq e_case
|
||||
5: move.l d1,a3 ; jmp (a4)
|
||||
|
||||
csb_z: mov (sp)+,d0 ; bra 0f
|
||||
csb_l: adroff ; move.w (a1),d0
|
||||
0: comp wrd,d0 ; bne e_illins
|
||||
csb_1W: move.l (sp)+,a0 ; mov (sp)+,d0
|
||||
mov 4(a0),d1 ; sub.l #1,d1
|
||||
move.l a0,a3
|
||||
!Use a3 as a general register
|
||||
move.l wrd,d2 ; add.l #4,d2
|
||||
1: add.l d2,a0 ; comp (a0),d0
|
||||
dbeq d1,1b ; bne 2f
|
||||
move.l word(a0),d1 ; beq e_case
|
||||
move.l d1,a3 ; jmp (a4)
|
||||
2: move.l (a3),d1 ; beq e_case
|
||||
move.l d1,a3 ; jmp (a4)
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
dch_z: move.l (sp)+,a0 ; move.l (a0),-(sp)
|
||||
move.l ml,a0 ; cmp.l (sp),a0
|
||||
bls e_badptr ; jmp (a4)
|
||||
|
||||
lpb_z: add.l #16,(sp) ; jmp (a4)
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
|
||||
dup_1W: mov (sp),-(sp) ; jmp (a4)
|
||||
dup_l: adroff ; move.w (a1),d0
|
||||
bra 1f
|
||||
dus_z: mov (sp)+,d0 ; bra 0f
|
||||
dus_l: adroff ; move.w (a1),d0
|
||||
0: checksize
|
||||
2: move.w (sp)+,d0 ; bra 1f
|
||||
4: move.l (sp)+,d0
|
||||
1: ble e_oddz ; bclr #0,d0
|
||||
move.l sp,a0 ; add.l d0,a0
|
||||
asr.l wmu,d0 ; sub.l #1,d0
|
||||
3: mov -(a0),-(sp) ; dbra d0,3b
|
||||
jmp (a4)
|
||||
!We do not test if d0 is indeed a word multiple . This can eventually be done
|
||||
!in the usual way.
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
exg_z: mov (sp)+,d0 ; bra 0f
|
||||
exg_l: adroff ; move.w (a1),d0
|
||||
bra 0f
|
||||
exg_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
0: move.l d7,d1 ; move.l d0,a0
|
||||
1: asri #1,d0 ; dbcs d1,1b
|
||||
bcs e_oddz ; sub.l #1,d0
|
||||
add.l a0,sp ; add.l sp,a0
|
||||
2: mov -(sp),d1 ; mov -(a0),(sp)
|
||||
mov d1,(a0) ; dbra d0,2b
|
||||
jmp (a4)
|
||||
|
||||
gto_q: move.l (sp)+,a0 ; bra 3f
|
||||
gto_l: move.l d6,a0 ; move.b (a3)+,-(sp)
|
||||
move.b (a3)+,1(sp) ; move.w (sp)+,a0
|
||||
3: add.l a6,a0 ; move.l (a0)+,a3
|
||||
move.l (a0)+,sp ; move.l (a0),a2
|
||||
jmp (a4)
|
||||
|
||||
lim_z: move.w ignmask,-(sp) ; jmp (a4)
|
||||
sim_z: move.w (sp)+,ignmask ; jmp (a4)
|
||||
|
||||
.bss
|
||||
ignmask: .space 2
|
||||
.define ignmask
|
||||
.text
|
||||
|
||||
!---------------------------------------------------------------------------
|
||||
lor_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
bne 1f ; move.l a2,-(sp)
|
||||
jmp (a4)
|
||||
1: sub.w #1,d0 ; bne 2f
|
||||
move.l sp,-(sp) ; jmp (a4)
|
||||
2: sub.w #1,d0 ; bne e_illins
|
||||
move.l hp,-(sp) ; jmp (a4)
|
||||
|
||||
str_s0: move.l d6,d0 ; move.b (a3)+,d0
|
||||
bne 1f ; move.l (sp)+,a2
|
||||
jmp (a4)
|
||||
1: sub.w #1,d0 ; bne 2f
|
||||
move.l (sp)+,sp ; claimstack
|
||||
jmp (a4)
|
||||
2: sub.w #1,d0 ; bne e_illins
|
||||
move.l (sp)+,d1 ; cmp.l nd,d1
|
||||
bcc 3f !break
|
||||
cmp.l tblmax,d1 ; bcs 4f
|
||||
5: move.l d1,hp ; jmp (a4)
|
||||
3: move.l d1,-(sp) ; add.l #1280,(sp)
|
||||
bsr _break ; testen (sp)+
|
||||
4: bne e_heap ; bra 5b
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
rck_z: mov (sp)+,d0 ; bra 0f
|
||||
rck_l: adroff ; move.w (a1),d0
|
||||
0: sub.l wrd,d0 ; beq rck_1W
|
||||
sub.l wrd,d0 ; bne e_oddz
|
||||
move.l (sp)+,a0
|
||||
mov (sp),d0 ; comp (a0),d0 ; blt 9f
|
||||
add.l wrd,a0 ; bra 1f
|
||||
rck_1W: move.l (sp)+,a0
|
||||
mov (sp),d0 ; comp (a0),d0 ; blt 9f
|
||||
1: comp word(a0),d0 ; bgt 9f
|
||||
jmp (a4)
|
||||
9: bra e_range
|
||||
!Temp. solution until trp_z is implemented
|
||||
|
||||
!--------------------------------------------------------------------------
|
||||
nop_z:
|
||||
lblnop: lea nopln+16,a0 ; move.l (a6),d1
|
||||
bsr itoa
|
||||
lea nopln+33,a0 ; move.l sp,d1
|
||||
bsr itoa
|
||||
move.l #45,-(sp)
|
||||
pea nopln ; mov #1,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
jmp (a4)
|
||||
|
||||
.data
|
||||
nopln: .asciz "line number nop sp \n"
|
||||
.align 2
|
||||
.text
|
||||
!unsigned to ascii for integers , a0 is address of first character
|
||||
! d1 contains integer. Output is 11 characters of which the first is a space.
|
||||
|
||||
.define itoa
|
||||
.text
|
||||
|
||||
itoa: move.l #9,d4 ; add.l #11,a0
|
||||
move.l #10,d0
|
||||
0: bsr dvu4 ; add.w #48,d3
|
||||
move.b d3,-(a0) ; tst.l d1
|
||||
dbeq d4,0b
|
||||
1: move.b #32,-(a0) ; dbra d4,1b
|
||||
rts
|
||||
|
||||
!------------------------------------------------------------------------------
|
||||
fil_q: move.l (sp)+,a0 ; bra 3f
|
||||
fil_l: adroff ; move.w (a1),d0
|
||||
move.l d0,a0
|
||||
3: add.l a6,a0 ; cmp.l 4(a6),a0
|
||||
beq 0f
|
||||
#if flow+count+prof
|
||||
move.l curproc,a5
|
||||
move.l 8(a5),d0
|
||||
sub.l 12(a5),d0
|
||||
move.l d0,countfld !START COUNTPTR FOR THIS PROC
|
||||
move.l a0,20(a5) !FILE POINTER IN PROC DES
|
||||
#endif
|
||||
move.l a0,4(a6)
|
||||
0: jmp (a4)
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
lni_z: add.l #1,(a6)
|
||||
#if count+flow+prof
|
||||
add.l #1,countptr
|
||||
#if prof
|
||||
add.l #4,profile
|
||||
#endif
|
||||
#endif
|
||||
bra 8f
|
||||
lin_l: adroff ; move.w (a1),d0 ; bra 1f
|
||||
lin_q: move.l (sp)+,d0 ; bra 1f
|
||||
lin_s0: move.l #0,d0 ; move.b (a3)+,d0
|
||||
1: cmp.l (a6),d0 ; beq 9f
|
||||
move.l d0,(a6)
|
||||
#if count+flow+prof
|
||||
move.l countfld,d1
|
||||
add.l d0,d1
|
||||
move.l d1,countptr
|
||||
#if prof
|
||||
asl.l #2,d1
|
||||
add.l ltime,d1
|
||||
move.l d1,profile
|
||||
#endif
|
||||
#endif
|
||||
8:
|
||||
#if last
|
||||
bsr nexttab ; move.l 4(a6),(a5)+ !store new line
|
||||
move.l (a6),(a5) !number in buffer lasttable
|
||||
#endif
|
||||
#if count
|
||||
move.l countptr,d1 !LINE NUMBER IN d1
|
||||
asl.l #2,d1 !MULTIPLY BY 4
|
||||
move.l lcount,a0
|
||||
add.l #1,0(a0,d1) !ADD 1 TO THE CORRESPONDING COUNT
|
||||
#endif
|
||||
#if flow
|
||||
move.l countptr,d1 !LINE NUMBER IN d1
|
||||
move.l #8,d0
|
||||
bsr dvu4
|
||||
!QUOTIENT IN d1 REST IN d3
|
||||
move.l lflow,a0
|
||||
bset d3,0(a0,d1)
|
||||
!ATTENTION BIT 0 CORR TO LINE 0
|
||||
#endif
|
||||
!9: bra nop_z
|
||||
9: jmp (a4)
|
||||
!----------------------------------------------------------------------------
|
||||
mon_z: mov (sp)+,d0 ; bmi e_badmon
|
||||
cmp.l #64,d0 ; bge e_badmon
|
||||
move.l a4,-(sp) ; asl.l #2,d0
|
||||
add.l #syscal,d0 ; move.l d0,a0
|
||||
move.l (a0),a0 ; jmp (a0)
|
||||
|
||||
.data
|
||||
syscal:
|
||||
.long e_badmon ; .long hlt_z ; .long _fork ; .long _read
|
||||
.long _write ; .long _open ; .long _close ; .long _wait
|
||||
.long _creat ; .long _link ; .long _unlink ; .long e_badmon
|
||||
.long _chdir ; .long e_badmon ; .long _mknod ; .long _chmod
|
||||
.long _chown ; .long _break ; .long _stat ; .long _lseek
|
||||
.long _getpid ; .long _mount ; .long _umount ; .long _setuid
|
||||
.long _getuid ; .long _stime ; .long _ptrace ; .long _alarm
|
||||
.long _fstat ; .long _pause ; .long _utime ; .long e_badmon
|
||||
.long e_badmon ; .long _access ; .long _nice ; .long _ftime
|
||||
.long _sync ; .long _kill ; .long e_badmon ; .long e_badmon
|
||||
.long e_badmon ; .long _dup ; .long _pipe ; .long _times
|
||||
.long _profil ; .long e_badmon ; .long _setgid ; .long _getgid
|
||||
.long _sigtrp ; .long e_badmon ; .long e_badmon ; .long _acct
|
||||
.long e_badmon ; .long _lock ; .long _ioctl ; .long e_badmon
|
||||
.long _mpxcall ; .long e_badmon ; .long e_badmon ; .long _exece
|
||||
.long _umask ; .long _chroot ; .long e_badmon ; .long e_badmon
|
||||
|
||||
.text
|
341
mach/mantra/int/mloopa
Normal file
341
mach/mantra/int/mloopa
Normal file
|
@ -0,0 +1,341 @@
|
|||
e_array: cl -(sp) ; bra error
|
||||
e_range: mov #0x1,-(sp) ; bra error
|
||||
e_set: mov #0x2,-(sp) ; bra error
|
||||
e_iovfl: mov #0x3,-(sp) ; bra error
|
||||
e_fovfl: mov #0x4,-(sp) ; bra error
|
||||
e_funfl: mov #0x5,-(sp) ; bra error
|
||||
e_idivz: mov #0x6,-(sp) ; bra error
|
||||
e_fdivz: mov #0x7,-(sp) ; bra error
|
||||
e_iund: mov #0x8,-(sp) ; bra error
|
||||
e_fund: mov #0x9,-(sp) ; bra error
|
||||
e_conv: mov #0xA,-(sp) ; bra error
|
||||
e_stack: mov #0x10,-(sp) ; bra fatal
|
||||
e_heap: mov #0x11,-(sp) ; bra fatal
|
||||
e_illins: mov #0x12,-(sp) ; bra fatal
|
||||
e_oddz: mov #0x13,-(sp) ; bra fatal
|
||||
e_case: mov #0x11,-(sp) ; bra fatal
|
||||
e_memflt: mov #0x15,-(sp) ; bra fatal
|
||||
e_badptr: mov #0x16,-(sp) ; bra fatal
|
||||
e_badpc: mov #0x17,-(sp) ; bra fatal
|
||||
e_badlae: mov #0x18,-(sp) ; bra error
|
||||
e_badmon: mov #0x19,-(sp) ; bra error
|
||||
e_badlin: mov #0x1A,-(sp) ; bra error
|
||||
e_badgto: mov #0x1B,-(sp) ; bra error
|
||||
|
||||
flnim: mov #0xB,-(sp) ; bra error
|
||||
no8bar: mov #0xC,-(sp) ; bra error
|
||||
.define e_memflt
|
||||
!---------------------------------------------------------------------------
|
||||
! ERRORS AND TRAPS
|
||||
!----------------------------------------------------------------------------
|
||||
fatal: clr.l -(sp) !dummy return address
|
||||
pea hlt_z !RETURN FROM FATAL HALTS
|
||||
mov 8(sp),-(sp)
|
||||
|
||||
error: movem.l d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6,-(sp)
|
||||
mov 60(sp),d0 !ERROR NUMBER IN d0
|
||||
lea retsize,a5
|
||||
move.l #16,d1
|
||||
1: move.w -(a5),-(sp)
|
||||
dbra d1,1b
|
||||
cmp.w #0xB,d0
|
||||
bge 0f !FATAL ERROR , START ERROR HANDLING
|
||||
move.l #0x1,d1
|
||||
asl.l d0,d1
|
||||
move.w ignmask,d2
|
||||
not.w d2
|
||||
and.w d2,d1
|
||||
bne 0f
|
||||
move.l #16,d1
|
||||
lea retsize,a5
|
||||
1: move.w (sp)+,(a5)+
|
||||
dbra d1,1b
|
||||
movem.l (sp)+,d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
|
||||
|
||||
add.l wrd,sp !REMOVE ERROR NUMBER
|
||||
rts
|
||||
|
||||
0: move.l uerrorp,a0
|
||||
cmp.l #-1,a0
|
||||
beq notrap
|
||||
mov d0,-(sp)
|
||||
move.l uerrorp,-(sp)
|
||||
move.l #-1,uerrorp !USER MUST SET TRAP AGAIN
|
||||
bra cai_z
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
rtt_z: move.l a2,sp
|
||||
add.l #0x10,sp !REMOVE RETURN STATUS BLOCK
|
||||
add.l wrd,sp !REMOVE ERROR NUMBER
|
||||
move.l #16,d0
|
||||
lea retsize,a5
|
||||
1: move.w (sp)+,(a5)+
|
||||
dbra d0,1b
|
||||
movem.l (sp)+,d0/d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
|
||||
add.l wrd,sp
|
||||
rts
|
||||
|
||||
trp_z: sub.l #4,sp
|
||||
mov 4(sp),(sp) !COPY ERROR NUMBER
|
||||
move.l a4,word(sp) !RETURN ADDRESS TO MAIN LOOP
|
||||
bra error
|
||||
|
||||
sig_z: move.l (sp),d0
|
||||
move.l uerrorp,(sp)
|
||||
move.l d0,uerrorp
|
||||
jmp (a4)
|
||||
|
||||
.data
|
||||
uerrorp: .long 0x-1
|
||||
.text
|
||||
|
||||
!-----------------------------------------------------------------------------
|
||||
!FIRST INFORMATION ABOUT THE KIND OF THE ERROR
|
||||
notrap: add.l #38,sp
|
||||
movem.l (sp)+,d1/d2/d3/d4/d5/d6/d7/a0/a1/a2/a3/a4/a5/a6
|
||||
notrap1: comp #28,d0 !ERROR NUMBER STILL IN d0
|
||||
!still to make a routine that prints the number of a user set error
|
||||
1: mulu #21,d0
|
||||
lea emerr,a0
|
||||
move.l #20,-(sp)
|
||||
pea 0(a0,d0)
|
||||
mov #2,-(sp) !STANDARD ERROR
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
!NEXT INFORMATION ABOUT THE LINE NUMBER
|
||||
move.l (a6),d1
|
||||
lea emess+14,a0
|
||||
bsr itoa
|
||||
move.l #30,-(sp)
|
||||
pea emess
|
||||
mov #2,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
!NOW INFORMATION ABOUT THE FILES
|
||||
2: move.l 4(a6),a0
|
||||
cmp.l #0,a0
|
||||
beq 5f
|
||||
move.l a0,a5
|
||||
sub.l #4,sp
|
||||
move.l a5,-(sp)
|
||||
move.l #-1,d0
|
||||
1: add.l #1,d0
|
||||
tst.b (a5)+
|
||||
bne 1b
|
||||
move.l d0,4(sp)
|
||||
mov #2,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
5: move.w #0x0A,-(sp)
|
||||
move.l #2,-(sp)
|
||||
pea 4(sp)
|
||||
mov #2,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+6,sp
|
||||
comp #0xB,(sp)
|
||||
beq 1f
|
||||
|
||||
move.l #-1,argc
|
||||
clr.l -(sp) !dummy return address
|
||||
bra hlt_z
|
||||
|
||||
1: add.l wrd,sp
|
||||
jmp (a4)
|
||||
|
||||
!---------------------------------------------------------------------------
|
||||
! EXIT HANDLING
|
||||
!--------------------------------------------------------------------------
|
||||
hlt_z: add.l #4,sp !remove return address
|
||||
#if prof
|
||||
.data
|
||||
emprof: .asciz "em_profile\0"
|
||||
.align 2
|
||||
.bss
|
||||
profile: .space 4
|
||||
ltime: .space 4
|
||||
profsiz: .space 4
|
||||
.text
|
||||
mov #0x1B6,-(sp)
|
||||
pea emprof
|
||||
bsr _creat
|
||||
testen (sp)+
|
||||
mov (sp)+,d0
|
||||
move.l profsiz,-(sp)
|
||||
move.l ltime,-(sp) !LTIME IS POINTER AT TABLE
|
||||
mov d0,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
#endif
|
||||
#if flow
|
||||
mov #0x1B6,-(sp)
|
||||
pea emflow
|
||||
bsr _creat
|
||||
testen (sp)+
|
||||
mov (sp)+,d0
|
||||
move.l flowsiz,-(sp)
|
||||
move.l lflow,-(sp)
|
||||
mov d0,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
.data
|
||||
emflow: .asciz "em_flow\0"
|
||||
.align 2
|
||||
.bss
|
||||
lflow: .space 4
|
||||
flowsiz: .space 4
|
||||
.text
|
||||
#endif
|
||||
#if count
|
||||
mov #0x1B6,-(sp)
|
||||
pea emcount
|
||||
bsr _creat
|
||||
testen (sp)+
|
||||
mov (sp)+,d0
|
||||
move.l countsiz,-(sp)
|
||||
move.l lcount,-(sp)
|
||||
mov d0,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
.data
|
||||
emcount: .asciz "em_count\0"
|
||||
.align 2
|
||||
.bss
|
||||
lcount: .space 4
|
||||
countsiz: .space 4
|
||||
#endif
|
||||
#if opfreq
|
||||
.data
|
||||
emopf: .asciz "em_opfreq\0"
|
||||
.align
|
||||
.bss
|
||||
counttab: .space 1884
|
||||
.text
|
||||
mov #0x1B6,-(sp)
|
||||
pea emopf
|
||||
bsr _creat
|
||||
testen (sp)+
|
||||
mov (sp)+,d0
|
||||
move.l #1884,-(sp)
|
||||
pea counttab
|
||||
mov d0,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
#endif
|
||||
#if count+flow+prof
|
||||
.bss
|
||||
countfld: .space 4 !COUNT NUMBER - NUMBER OF LINE 1 OF PROC
|
||||
countptr: .space 4 !COUNT NUMBER OF CURRENT LINE
|
||||
#endif
|
||||
#if last
|
||||
.text
|
||||
mov #0x1B6,-(sp)
|
||||
pea emlast
|
||||
bsr _creat
|
||||
testen (sp)+
|
||||
mov (sp)+,d6 !d6 contains file descriptor
|
||||
cmp.l #-1,linused-4 !test if buffer is fully used
|
||||
beq 0f
|
||||
bsr nexttab
|
||||
bra 1f
|
||||
0: lea lasttable,a5
|
||||
1: tst.l (a5)
|
||||
bne 2f !exists entry in table
|
||||
move.l #22,-(sp) !here case no lines processed
|
||||
pea mess1
|
||||
mov d6,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
bra 9f
|
||||
2: move.l #7,-(sp) !announce new file name
|
||||
pea mess2
|
||||
mov d6,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
move.l (a5),d7
|
||||
move.l d7,a0 !keep file pointer in d7
|
||||
clr.l (a5)+ !this will stop the printing
|
||||
move.l #-1,d1 !d1 will contain length of file name
|
||||
3: add.l #1,d1
|
||||
tst.b (a0)+
|
||||
bne 3b
|
||||
move.l d1,-(sp)
|
||||
move.l d7,-(sp)
|
||||
mov d6,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
4: move.l (a5),d1 !next print line numbers
|
||||
lea mess3,a0
|
||||
bsr itoa
|
||||
move.l #12,-(sp)
|
||||
pea mess3
|
||||
mov d6,-(sp)
|
||||
bsr _write
|
||||
add.l wrd+4,sp
|
||||
bsr nexttab
|
||||
tst.l (a5) !in case 0 no more lines
|
||||
beq 9f
|
||||
cmp.l (a5),d7
|
||||
bne 2b !new file name
|
||||
clr.l (a5)+ !skip file name
|
||||
bra 4b !only new line
|
||||
9:
|
||||
.data
|
||||
emlast: .asciz "em_last"
|
||||
mess1: .asciz "no line processed yet\n"
|
||||
mess2: .asciz "\nfile :"
|
||||
mess3: .asciz " \n"
|
||||
.align 2
|
||||
.bss
|
||||
lasttable: .space 128
|
||||
linused: .space 4
|
||||
#endif
|
||||
.text
|
||||
halt: bsr _exit
|
||||
|
||||
.data
|
||||
emerr:
|
||||
.asciz "ARRAY BOUND ERROR \n"
|
||||
.asciz "RANGE BOUND ERROR \n"
|
||||
.asciz "SET BOUND ERROR \n"
|
||||
.asciz "INTEGER OVERFLOW \n"
|
||||
.asciz "FLOATING OVERFLOW \n"
|
||||
.asciz "FLOATING UNDERFLOW \n"
|
||||
.asciz "INT. DIV. BY ZERO \n"
|
||||
.asciz "DIVIDE BY 0.0 \n"
|
||||
.asciz "UNDEFINED INTEGER \n"
|
||||
.asciz "UNDEFINED FLOAT \n"
|
||||
.asciz "CONVERSION ERROR \n"
|
||||
.asciz "NO FLOATING POINT \n"
|
||||
.asciz "NO 8 BYTE ARITH. \n"
|
||||
.asciz "NO LOAD FILE \n"
|
||||
.asciz "LOAD FILE ERROR \n"
|
||||
.asciz "PROGRAM TOO LARGE \n"
|
||||
.asciz "STACK OVERFLOW \n"
|
||||
.asciz "HEAP OVERFLOW \n"
|
||||
.asciz "ILLEGAL INSTRUCTION\n"
|
||||
.asciz "ILLEGAL SIZE ARG. \n"
|
||||
.asciz "CASE ERROR \n"
|
||||
.asciz "ADDRESS NON EX. MEM\n"
|
||||
.asciz "BAD POINTER USED \n"
|
||||
.asciz "PR COUNT. OUT RANGE\n"
|
||||
.asciz "BAD ARG. OF LAE \n"
|
||||
.asciz "BAD MONITOR CALL \n"
|
||||
.asciz "ARG OF LIN TOO HIGH\n"
|
||||
.asciz "GTO DESCR. ERROR \n"
|
||||
.asciz "BAD RETURN SIZE \n"
|
||||
emess:
|
||||
.asciz "ON SOURCE LINE OF\n"
|
||||
.align 2
|
||||
!-----------------------------------------------------------------------------
|
||||
! SUBROUTINES FOR THE INTERPRETOR
|
||||
!------------------------------------------------------------------------------
|
||||
.text
|
||||
#if last
|
||||
nexttab: move.l linused,a5
|
||||
add.l #8,a5
|
||||
cmp.l #linused,a5 !top of buffer reached?
|
||||
bne 1f !if so back to bottom
|
||||
sub.l #128,a5
|
||||
1: move.l a5,linused
|
||||
rts
|
||||
#endif
|
58
mach/mantra/int/mloopb
Normal file
58
mach/mantra/int/mloopb
Normal file
|
@ -0,0 +1,58 @@
|
|||
_sigtrp: mov (sp)+,d1 !trapno in d1
|
||||
mov (sp)+,d4 !signo in d4
|
||||
extend d4
|
||||
extend d1
|
||||
comp #16,d4
|
||||
bhi sig_bad
|
||||
tst.l d4
|
||||
beq sig_bad
|
||||
move.l d4,a0
|
||||
add.l a0,a0
|
||||
add.l a0,a0
|
||||
lea sig_trp-4(a0),a5
|
||||
move.l (a5),d2 !previous trap number in d2
|
||||
comp #256,d1 !-2 and -1 special
|
||||
bcc 1f
|
||||
move.l sig_adr-4(a0),d3 !Get the pointer to the trap-
|
||||
bne 2f !procedure to give as argument to
|
||||
sig_bad: mov 22,-(sp) !_signal. If pointer 0 trapping is
|
||||
mov 22,-(sp) !not legal
|
||||
jmp (a4)
|
||||
1: comp #-3,d1 !-2:reset default , -3: ignore
|
||||
bmi sig_bad
|
||||
move.l d1,d3
|
||||
ad #2,d3 !0:reset default for signal, -1: ignore
|
||||
2: move.l d1,(a5) !set new trapno
|
||||
move.l d3,-(sp) !set arguments to signal:
|
||||
mov d4,-(sp) !pointer ,signo to be trapped
|
||||
bsr _signal
|
||||
cl -(sp) !set code for no error
|
||||
.data
|
||||
sig_adr: .long sig1 ; .long sig2 ; .long sig3 ; .long 0
|
||||
.long 0 ; .long 0 ; .long 0 ; .long 0
|
||||
.long 0 ; .long 0 ; .long sig11 ; .long sig12
|
||||
.long sig13 ; .long sig14 ; .long sig15 ; .long sig16
|
||||
sig_trp: .long -2 ; .long -2 ; .long -2 ; .long -2
|
||||
.long -2 ; .long -2 ; .long -2 ; .long -2
|
||||
.long -2 ; .long -2 ; .long 21 ; .long 25
|
||||
.long -2 ; .long -2 ; .long -2 ; .long -2
|
||||
.text
|
||||
!the next procedures map the catched signal to em errors. The em error
|
||||
!procedure will handle this.
|
||||
sig1: sig2: sig3: sig8: sig13: sig14: sig15: sig16:
|
||||
pea retutrap
|
||||
mov d1,-(sp)
|
||||
bra error
|
||||
retutrap: rtr
|
||||
|
||||
sig12: pea sig12
|
||||
mov #12,-(sp)
|
||||
bsr _signal
|
||||
bsr e_badmon
|
||||
rtr
|
||||
sig11: move.l 4(a1),d0
|
||||
sub.l sp,d0
|
||||
bcs e_memflt !in this case error handling possible
|
||||
move.l ml,sp !refresh stack and stop .
|
||||
bra notrap1
|
||||
|
503
mach/mantra/int/mloopc
Normal file
503
mach/mantra/int/mloopc
Normal file
|
@ -0,0 +1,503 @@
|
|||
!THIS FILE CONTAINS THE SYSTEM CALLS FOR PMDS-II AS SUBROUTINES FOR THE
|
||||
!EM-INTERPRETER. a1 CONTAINS A POINTER TO THE RETURN AREA . EACH SUBROUTINE
|
||||
!EXPECTS ITS DATA IN THE FORM EM PRODUCES AND GIVES ITS RESULTS AS EM
|
||||
!REQUIRES
|
||||
|
||||
_exit: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 1
|
||||
|
||||
_fork: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 2
|
||||
lea 4(sp),sp
|
||||
bcs 2f
|
||||
tst.l d0 !PID OF CHILD IN PARENT, 0 IN CHILD
|
||||
bne 1f
|
||||
trap #0
|
||||
.short 20
|
||||
mov d1,-(sp) !PID OF PARENT IN d1
|
||||
mov #1,-(sp) !(PID OF CHILD IN D0),FLAG 1 IN CHILD
|
||||
bra 0f
|
||||
1: mov d0,-(sp) !PID OF CHILD IN d0
|
||||
cl -(sp) !FLAG 0 IN PARENT
|
||||
0: cl -(sp)
|
||||
bra 3f
|
||||
2: mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
3: move.l (a1),a0
|
||||
jmp (a0)
|
||||
!_fork is special
|
||||
|
||||
_read: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 3
|
||||
sys0: lea 16(sp),sp
|
||||
bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: move.l d0,-(sp)
|
||||
cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_write: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 4
|
||||
bra sys0
|
||||
|
||||
_open: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st243
|
||||
#endif
|
||||
trap #0
|
||||
.short 5
|
||||
sys1: lea 12(sp),sp
|
||||
sys5: bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: mov d0,-(sp)
|
||||
cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_close: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 6
|
||||
sys3: lea 8(sp),sp
|
||||
sys4: bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_wait: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 7
|
||||
sys6: lea 4(sp),sp
|
||||
bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: mov d1,-(sp) ! ??
|
||||
mov d0,-(sp)
|
||||
cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_creat: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st243
|
||||
#endif
|
||||
trap #0
|
||||
.short 8
|
||||
bra sys1
|
||||
|
||||
_link: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 9
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_unlink: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 10
|
||||
bra sys3
|
||||
|
||||
_chdir: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 12
|
||||
bra sys3
|
||||
|
||||
_mknod: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st244
|
||||
#endif
|
||||
trap #0
|
||||
.short 14
|
||||
lea 16(sp),sp
|
||||
bra sys4
|
||||
|
||||
_chmod: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st243
|
||||
#endif
|
||||
trap #0
|
||||
.short 15
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_chown: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st244
|
||||
#endif
|
||||
trap #0
|
||||
.short 16
|
||||
lea 16(sp),sp
|
||||
bra sys4
|
||||
|
||||
_break: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 17
|
||||
lea 8(sp),sp
|
||||
bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: move.l -4(sp),nd
|
||||
cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
.data
|
||||
nd: .long endbss
|
||||
.text
|
||||
|
||||
_stat: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 18
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_lseek: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st245
|
||||
#endif
|
||||
trap #0
|
||||
.short 19
|
||||
lea 16(sp),sp
|
||||
bcc 1f
|
||||
mov d0,-(sp)
|
||||
mov d0,-(sp)
|
||||
bra 2f
|
||||
1: move.l d1,-(sp)
|
||||
mov d0,-(sp)
|
||||
cl -(sp)
|
||||
2: move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
|
||||
_getpid: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 20
|
||||
add.l #4,sp
|
||||
mov d0,-(sp)
|
||||
move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_mount: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st246
|
||||
#endif
|
||||
trap #0
|
||||
.short 21
|
||||
lea 16(sp),sp
|
||||
bra sys4
|
||||
|
||||
_umount: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 22
|
||||
bra sys3
|
||||
|
||||
_setuid: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 23
|
||||
bra sys3
|
||||
|
||||
_getuid: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 24
|
||||
sys7: add.l #4,sp
|
||||
mov d1,-(sp)
|
||||
mov d0,-(sp)
|
||||
move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_stime: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 25
|
||||
bra sys3
|
||||
|
||||
_ptrace: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st247
|
||||
#endif
|
||||
trap #0
|
||||
.short 26
|
||||
lea 20(sp),sp
|
||||
bra sys5
|
||||
|
||||
_alarm: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
sub.l #2,sp
|
||||
clr.w 4(sp)
|
||||
#endif
|
||||
trap #0
|
||||
.short 27
|
||||
lea 8(sp),sp
|
||||
mov d0,-(sp)
|
||||
move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_fstat: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 28
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_pause: trap #0
|
||||
.short 29
|
||||
rts
|
||||
|
||||
_utime: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 30
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_access: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st248
|
||||
#endif
|
||||
trap #0
|
||||
.short 33
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_nice:
|
||||
#ifndef lword
|
||||
bsr 241
|
||||
#endif
|
||||
trap #0
|
||||
.short 34
|
||||
move.l (sp)+,(sp)
|
||||
rts
|
||||
|
||||
_ftime: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 35
|
||||
bra sys3
|
||||
|
||||
_sync: trap #0
|
||||
.short 36
|
||||
rts
|
||||
|
||||
_kill: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st248
|
||||
#endif
|
||||
trap #0
|
||||
.short 37
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_dup: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st248
|
||||
#endif
|
||||
trap #0
|
||||
.short 38
|
||||
bra sys1
|
||||
|
||||
_pipe: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 42
|
||||
bra sys6
|
||||
|
||||
_times: trap #0
|
||||
.short 43
|
||||
move.l (sp),a0
|
||||
add.l #8,sp
|
||||
jmp (a0)
|
||||
|
||||
_profil: trap #0
|
||||
.short 44
|
||||
move.l (sp),a0
|
||||
lea 20(sp),sp
|
||||
jmp (a0)
|
||||
|
||||
_setgid: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 46
|
||||
bra sys3
|
||||
|
||||
_getgid: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 47
|
||||
bra sys7
|
||||
|
||||
|
||||
_signal: move.l (sp)+,retaddr
|
||||
mov (sp)+,d4
|
||||
extend d4
|
||||
move.l d4,-(sp)
|
||||
move.l retaddr,-(sp)
|
||||
trap #0
|
||||
.short 48
|
||||
mov d0,-(sp)
|
||||
bne 1f
|
||||
mov d0,-(sp)
|
||||
1: move.l retaddr,a0
|
||||
jmp (a0)
|
||||
.data
|
||||
retaddr: .long 0
|
||||
.text
|
||||
|
||||
_acct: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 51
|
||||
bra sys3
|
||||
_lock: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 53
|
||||
bra sys3
|
||||
|
||||
_ioctl: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st248
|
||||
#endif
|
||||
trap #0
|
||||
.short 54
|
||||
lea 16(sp),sp
|
||||
bra sys4
|
||||
|
||||
_mpxcall: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 56
|
||||
lea 12(sp),sp
|
||||
bra sys4
|
||||
|
||||
_exece: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 59
|
||||
lea 16(sp),sp
|
||||
bra sys4
|
||||
|
||||
_umask: move.l (sp),(a1)
|
||||
#ifndef lword
|
||||
bsr st241
|
||||
#endif
|
||||
trap #0
|
||||
.short 60
|
||||
add.l #8,sp
|
||||
mov d0,-(sp)
|
||||
move.l (a1),a0
|
||||
jmp (a0)
|
||||
|
||||
_chroot: move.l (sp),(a1)
|
||||
trap #0
|
||||
.short 61
|
||||
bra sys3
|
||||
|
||||
|
||||
!----------------------------------------------------------------------------
|
||||
! STACK ADJUSTMENT FOR THE TWO BYTE INTERPRETER
|
||||
!-----------------------------------------------------------------------------
|
||||
#ifndef lword
|
||||
|
||||
st241: sub.l #2,sp
|
||||
move.l 2(sp),(sp)
|
||||
move.l 6(sp),4(sp)
|
||||
move.w 10(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,8(sp)
|
||||
rts
|
||||
|
||||
st243: sub.l #2,sp
|
||||
move.l 2(sp),(sp)
|
||||
move.l 6(sp),4(sp)
|
||||
move.l 10(sp),8(sp)
|
||||
move.w 14(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,12(sp)
|
||||
rts
|
||||
|
||||
st244: move.l (sp),-(sp)
|
||||
move.l 8(sp),4(sp)
|
||||
move.l 12(sp),8(sp)
|
||||
move.w 16(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,12(sp)
|
||||
move.w 18(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,16(sp)
|
||||
rts
|
||||
|
||||
st245: move.l (sp),-(sp)
|
||||
move.l 8(sp),4(sp)
|
||||
move.w 12(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,8(sp)
|
||||
move.l 14(sp),12(sp)
|
||||
move.w 18(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,16(sp)
|
||||
rts
|
||||
|
||||
st246: sub.l #2,sp
|
||||
move.l 2(sp),(sp)
|
||||
move.l 6(sp),4(sp)
|
||||
move.l 10(sp),8(sp)
|
||||
move.l 14(sp),12(sp)
|
||||
move.w 18(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,16(sp)
|
||||
rts
|
||||
|
||||
st247: sub.l #6,sp
|
||||
move.l 6(sp),(sp)
|
||||
move.l 10(sp),4(sp)
|
||||
move.w 14(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,8(sp)
|
||||
move.w 16(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,12(sp)
|
||||
move.l 18(sp),16(sp)
|
||||
move.w 22(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,20(sp)
|
||||
rts
|
||||
|
||||
st248: move.l (sp),-(sp)
|
||||
move.l 8(sp),4(sp)
|
||||
move.w 12(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,8(sp)
|
||||
move.w 14(sp),d0
|
||||
ext.l d0
|
||||
move.l d0,12(sp)
|
||||
rts
|
||||
|
||||
#endif
|
6
mach/mantra/int/mloope
Normal file
6
mach/mantra/int/mloope
Normal file
|
@ -0,0 +1,6 @@
|
|||
.text
|
||||
end:
|
||||
.bss
|
||||
endbss:
|
||||
.data
|
||||
enddata:
|
3
mach/mantra/int/prep
Executable file
3
mach/mantra/int/prep
Executable file
|
@ -0,0 +1,3 @@
|
|||
rm temp.c
|
||||
cat header deffile $1 >> temp.c
|
||||
cpp -P temp.c >$2
|
Loading…
Reference in a new issue