1 eÿfp68881.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ÿ
\ f.define .adf4, .adf8, .sbf4, .sbf8, .mlf4, .mlf8, .dvf4, .dvf8
2 .define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
3 .define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
10 ! $Id: fp68881.s,v 1.6 1994/06/24 13:06:44 ceriel Exp $
12 ! Implement interface to floating point package for M68881
117 and.l #0x2000,d0 ! set if Infinity
122 move.l #0x3f000000,(4,a1)
125 move.l #0xbf000000,(4,a1)
148 and.l #0x2000,d0 ! set if Infinity
153 move.l #0x3fe00000,(4,a1)
157 move.l #0xbfe00000,(4,a1)
192 fsub.l #-2147483648,fp0
193 fsub.l #-2147483648,fp0
203 fsub.l #-2147483648,fp0
204 fsub.l #-2147483648,fp0
231 cmp.l #0x4f000000,(8,sp)
237 fadd.l #-2147483648,fp0
246 cmp.l #0x41e00000,(8,sp)
252 fadd.l #-2147483648,fp0
300 \0aar.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Þ
\ 2.define .aar
308 .aar: ! (on entry d0 contains the integer size in the descriptor)
312 move.l #EILLINS, -(sp)
316 ! a0: descriptor address
320 ! The address is calculated by taking the relative index
321 ! (index - lower bound), multiplying that with the element
322 ! size and adding the result to the array base address.
324 move.l (sp)+, a1 ! return address
325 move.l (sp)+, a0 ! descriptor address
326 move.l (sp)+, d0 ! index
327 sub.l (a0), d0 ! relative index
329 move.l (sp)+, a0 ! array base address
330 add.l d0, a0 ! address of array element
333 lar.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ô
\ 3.define .lar
340 ! (on entry d0 contains the integer size in the descriptor)
344 move.l #EILLINS, -(sp)
348 ! a0: descriptor address
351 ! d1: # bytes / element
353 ! For address calculation; see comment in 'aar.s'.
355 move.l (sp)+, d1 ! return address
356 move.l (sp)+, a0 ! descriptor address
357 move.l (sp)+, d0 ! index
358 move.l (sp)+, a1 ! array base address
359 sub.l (a0), d0 ! relative index
361 move.l (8,a0), d1 ! # bytes / element
366 move.b (a1,d0.l), (3,sp) ! one byte element
373 move.w (a1,d0.l*2), (2,sp) ! two byte element
377 add.l d0, a1 ! address of 4n byte element
378 add.l d1, a1 ! because of predecrement
387 sar.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0#
\ 4.define .sar
395 ! (on entry d0 contains the integer size in the descriptor)
399 move.l #EILLINS, -(sp)
403 ! a0: descriptor address
406 ! d1: # bytes / element
408 ! For address calculation; see comment in 'aar.s'.
409 ! If the element size is a fraction of EM_WSIZE (4)
410 ! the calculation is done by adding.
412 move.l (sp)+, d1 ! return address
416 move.l d1,-(sp) ! return address
418 move.l (8,a0), d1 ! # bytes / element
423 move.b d1, (a1,d0.l) ! store one byte element
430 move.w d1, (a1,d0.l*2) ! store two byte element
432 4: ! here: 4n byte element
434 add.l d0, a1 ! address of 4n byte element
444 csa.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0á
\ 1.define .csa4
456 ! jump table address in a0
459 move.l (a0)+, a1 ! default address
460 sub.l (a0)+, d0 ! index - lower bound
462 cmp.l (a0)+, d0 ! rel. index, upper - lower bound
464 move.l (a0,d0.l*4), d1 ! jump address
471 jmp (a1) ! jump to specified address
476 rcsb.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¡
\ 1.define .csb4
488 ! case descriptor in a0
491 move.l (a0)+, a1 ! default jump address
492 move.l (a0)+, d1 ! # entries
496 cmp.l (a0,d1.w*8), d0
499 move.l (4,a0,d1.w*8), a1 ! jump address
508 eshp.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0
519 move.l (sp), d1 ! new heap pointer
520 cmp.l (.limhp), d1 ! compare new heap pointer with limit
527 jsr (BRK) ! allocate 1K bytes of extra storage
533 move.l (sp)+, (.reghp) ! store new value
540 set.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0%
\ 2.define .set
549 ! d1 setsize in bytes
563 asr.l #3, d2 ! offset from sp in bytes
564 eor.l #3, d2 ! longs are stored in high-to-low order
567 move.l #ESET, -(sp) ! bitnumber too large
577 inn.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\e\ 2.define .inn
587 ! d1 setsize in bytes
588 ! on exit: 0 or 1 in d0
592 asr.l #3, d2 ! offset from sp in bytes
593 eor.l #3, d2 ! longs are stored in high-to-low order
595 bge 1f ! bitnumber too large
607 move.l (sp)+, a0 ! return address
608 add.l d1, sp ! pop bitset
612 fat.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0t
\0.define .fatal
623 trp.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ó
\ 2#
633 movem.l d0/d1/a0, -(sp)
634 move.l (12, sp), a0 ! return address
635 move.l (16, sp), d0 ! error number
648 movem.l d2-d7/a1-a5,-(sp)
650 fmovem.x fp0-fp7,-(sp)
656 fmovem.x (sp)+,fp0-fp7
658 movem.l (sp)+,d2-d7/a1-a5
660 movem.l (sp)+, d0/d1/a0
673 otrpstr.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ý
\ 3#include <em_abs.h>
679 case EARRAY: return "array bound error";
680 case ERANGE: return "range bound error";
681 case ESET: return "set bound error";
682 case EIOVFL: return "integer overflow";
683 case EFOVFL: return "floating overflow";
684 case EFUNFL: return "floating underflow";
685 case EIDIVZ: return "divide by 0";
686 case EFDIVZ: return "divide by 0.0";
687 case EIUND: return "undefined integer";
688 case EFUND: return "undefined real";
689 case ECONV: return "conversion error";
690 case ESTACK: return "stack overflow";
691 case EHEAP: return "heap overflow";
692 case EILLINS: return "illegal instruction";
693 case EODDZ: return "illegal size argument";
694 case ECASE: return "case error";
695 case EMEMFLT: return "addressing non-existent memory";
696 case EBADPTR: return "bad pointer used";
697 case EBADPC: return "program counter out of range";
698 case EBADMON: return "bad monitor call";
703 return "strange trap";
707 +mon.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ù
\0.define .mon
722 fmt: .asciz "system call %d not implemented\n"
724 nop.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0$
\ 1.define .nop
732 move.l (.limhp),-(sp)
733 move.l (.reghp),-(sp)
742 fmt: .asciz "test %d, sp 0x%x, .reghp 0x%x, .limhp 0x%x.\n"
744 dia.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0D
\b.define .diagnos
754 .range: .data1 space, del-1
759 movem.l d0/d1/d2/a0, -(sp)
760 move.l (.lino), -(sp)
776 movem.l (sp)+, d0/d1/d2/a0
792 .ascii "0123456789abcdef"
796 movem.l d0/d1/d2/a0/a1/a2/a3/a4/a5/a6, -(sp)
797 lea (44, sp), a6 ! a6 <- address of arguments
798 move.l (a6)+, a5 ! a5 <- address of format
799 next: move.b (a5)+, d0
803 put: move.l d0, -(sp)
804 jsr (putchar) ! long argument on stack
808 procnt: move.b (a5)+, d0
809 cmp.b #'d', d0 ! NOTE: %d means unsigned.
815 cmp.b #'%', d0 ! second % has to be printed.
817 tst.b -(a5) ! normal char should be printed
820 string: move.l (a6)+, a2 ! a2 <- address of string
821 sloop: move.b (a2)+, d0
824 jsr (putchar) ! long argument on stack
828 digit: move.l (a6)+, d1 ! d1 <- integer
829 move.l #getal+12, a2 ! a2 <- ptr to last part of buf
830 clr.b -(a2) ! stringterminator
831 1: divul.l #10, d2:d1 ! d1 <- qotient; d2 <- remainder
834 tst.l d1 ! if quotient = 0 then ready
836 bra sloop ! print digitstring.
838 hex: move.l (a6)+, d1 ! d1 <- integer
839 move.l #getal+12, a2 ! a2 <- ptr to last part of buf
840 clr.b -(a2) ! stringterminator
841 move.l #7, d2 ! loop control
844 move.b (hexs,d0.w), -(a2) ! hex digit
850 movem.l (sp)+, d0/d1/d2/a0/a1/a2/a3/a4/a5/a6
864 fmt: .asciz "%s, line %d: "
865 unknwn: .asciz "unknown file"
867 cii.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\92\ 1.define .cii
875 move.l (sp)+, a0 ! return address
876 move.l (sp)+, d0 ! destination size
877 sub.l (sp)+, d0 ! destination - source size
879 sub.l d0, sp ! pop extra bytes
885 not.l d1 ! d1 contains sign of source
894 cuu.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0a
\ 1.define .ciu, .cui, .cuu
901 ! only converts between sizes of multiples of four
905 move.l (sp)+, a0 ! return address
906 move.l (sp)+, d0 ! destination size
919 cmi.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ß
\ 1.define .cmi
926 ! on entry d0: # bytes in 1 block
929 move.l (sp)+, d1 ! return address
930 move.l sp, a0 ! address of top block
931 lea (sp,d0.l), a1 ! address of lower block
945 lea (sp,d1.l*2), sp ! new sp; two blocks popped
948 cms.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ï
\ 1.define .cms
955 ! d0 contains set size
956 ! on exit d0 is zero for equal, non-zero for not equal
958 move.l (sp)+, d1 ! return address
959 move.l sp, a0 ! address of top block
960 lea (sp,d0.l), a1 ! address of lower block
971 lea (sp,d1.l*2), sp ! new sp; two blocks popped
974 rcmu.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ô
\ 1.define .cmu
981 ! on entry d0: # bytes in 1 block
984 move.l (sp)+, d1 ! return address
985 move.l sp, a0 ! address of top block
986 lea (sp,d0.l), a1 ! address of lower block
994 bne 1b ! note: on equal carry is set
1000 lea (sp,d1.l*2), sp ! new sp; two blocks popped
1003 cvf.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\04
\ 1.define .cfi, .cif,.cfu,.cuf,.cff
1011 ! this is a dummy float conversion routine
1017 move.l (sp)+, a0 ! return address
1018 move.l (sp)+, d0 ! destination size
1019 sub.l (sp)+, d0 ! diff. in sizes
1023 exg.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0-
\ 1.define .exg
1030 ! d0 : exchange size in bytes
1032 lea (4,sp,d0), a0 ! address of bottom block
1033 lea (4,sp), a1 ! address of top block
1043 llos.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0È
\ 1.define .los
1050 ! a0 : source address
1051 ! a1 : return address
1060 move.b (a0), (3,sp) !1 byte
1066 move.w (a0), (2,sp) !2 bytes
1069 add.l d0, a0 !>=4 bytes
1072 4: move.l -(a0), -(sp)
1078 sts.s
\0.c
\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0«
\ 1.define .sts
1085 ! a0 : destination address
1086 ! a1 : return address