1 eÿaar.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\1c\ 3.define .aar
8 ! (on entry d0 contains the integer size in the descriptor)
12 move.l #EILLINS, -(sp)
16 ! a0: descriptor address
20 ! The address is calculated by taking the relative index
21 ! (index - lower bound), multiplying that with the element
22 ! size and adding the result to the array base address.
24 move.l (sp)+,a1 ! return address
25 move.l (sp)+, a0 ! descriptor address
26 move.l (sp)+, d0 ! index
27 sub.l (a0), d0 ! relative index
30 move.l 8(a0), -(sp) ! # bytes / element
33 move.l (sp)+, a0 ! array base address
34 lea 0(a0, d1.l), a0 ! address of array element
37 lar.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\19\ 4.define .lar
43 ! (on entry d0 contains the integer size in the descriptor)
47 move.l #EILLINS, -(sp)
51 ! a0: descriptor address, later base addres
54 ! d2: #bytes / element
56 ! For address calculation; see comment in 'aar.s'.
58 move.l (sp)+, a1 ! return address
59 move.l (sp)+, a0 ! descriptor address
60 move.l (sp)+, d0 ! index
61 sub.l (a0), d0 ! relative index
62 move.l 8(a0), d2 ! #bytes / element
63 move.l (sp)+, a0 ! array base address
67 move.b 0(a0, d0.l), d1 ! one byte element
74 move.w 0(a0, d0.l), d1 ! two byte element
83 add.l d1, a0 ! address of 4n byte element
84 add.l d2, a0 ! because of predecrement
93 \0sar.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\03
\ 4.define .sar
100 ! (on entry d0 contains the integer size in the descriptor)
104 move.l #EILLINS, -(sp)
108 ! a0: descriptor address, later base address
111 ! d2: # bytes / element
113 ! For address calculation; see comment in 'aar.s'.
114 ! If the element size is a fraction of EM_WSIZE (4)
115 ! the calculation is done by adding.
117 move.l (sp)+,a1 ! return address
121 move.l 8(a0), d2 ! # bytes / element
127 move.b d1, 0(a0, d0.l) ! store one byte element
134 move.w d1, 0(a0, d0.l) ! store two byte element
136 4: ! here: 4n byte element
142 add.l d1, a0 ! address of 4n byte element
151 \0cii.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0â
\ 1.define .cii
159 move.l (sp)+,a0 ! return address
160 move.l (sp)+,d0 ! destination size
176 sub.l d0,sp ! pop extra bytes
193 cmi.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ê
\ 1.define .cmi
200 ! on entry d0: # bytes of 1 block
203 move.l (sp)+, d2 ! return address
204 move.l sp, a0 ! address of top block
205 lea 0(sp, d0.l), a1 ! address of lower block
218 add.l d1, sp ! new sp; two blocks popped
222 cmp.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ì
\0.define .cmp
230 move.l (sp)+,d2 ! return address
244 cmu.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0é
\ 1.define .cmu
251 ! on entry d0: # bytes of 1 block
254 move.l (sp)+, d2 ! return address
255 move.l sp, a0 ! address of top block
256 lea 0(sp, d0.l), a1 ! address of lower block
263 bne 1b ! note: on equal carry is set
269 add.l d1, sp ! new sp; two blocks popped
273 rcsa.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\ 6\ 2.define .csa4
281 ! case descriptor in a0
283 move.l (a0)+,a1 ! default address
284 sub.l (a0)+,d0 ! index - lower bound
286 cmp.l (a0)+,d0 ! rel. index <-> upper - lower bound
290 move.l (a0),d0 ! test jump address
295 move.l a1,d0 ! test default jump address
297 move.l a1,-(sp) ! jump address
305 csb.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¶
\ 1.define .csb4
313 ! case descriptor in a0
315 move.l (a0)+,a1 ! default jump address
316 move.l (a0)+,d1 ! # entries
322 tst.l (a0)+ ! skip jump address
325 move.l a1,d1 ! default jump address
330 move.l (a0)+,a1 ! get jump address
335 cuu.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0)
\ 1.define .ciu
347 move.l (sp)+,a0 ! return address
348 move.l (sp)+,d0 ! destination size
361 dexg.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\00
\ 1.define .exg
368 ! d0 : exchange size in bytes
370 lea 4(sp, d0), a0 ! address of bottom block
371 lea 4(sp), a1 ! address of top block
381 inn.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\17\ 2.define .inn
389 ! d1 setsize in bytes
390 ! on exit: 0 or 1 in d0
394 asr.l #3, d2 ! offset .sect from sp in bytes
395 eor.l #3, d2 ! longs are stored in high-to-low order
397 bge 1f ! bitnumber too large
409 move.l (sp)+, a0 ! return address
410 add.l d1, sp ! pop bitset
413 ,lfr.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0,
\ 1.define .lfr
439 move.l #EILLINS,-(sp)
442 los.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ë
\ 1.define .los
449 ! a0 : source address
470 add.l d0,a0 !>=4 bytes
473 4: move.l -(a0),-(sp)
479 0rck.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ÿ
\0.define .rck
488 move.l (sp)+,a0 ! descriptor address
501 mret.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0(
\ 1.define .ret
528 move.l #EILLINS,-(sp)
531 set.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ñ
\ 1.define .set
539 ! d1 setsize in bytes
550 asr.l #3, d2 ! offset .sect from sp in bytes
551 eor.l #3, d2 ! longs are stored in high-to-low order
555 move.l #ESET, -(sp) ! bitnumber too large
562 tsts.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\89\ 1.define .sts
569 ! a0 : destination address
596 enop.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ñ
\0.define .nop
612 fmt: .asciz "test %d, sp 0x%x.\n"
615 mon.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ó
\0.define .mon
630 fmt: .asciz "system call %d not implemented\n"
632 mdvi.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\8d\v.define .dvi
639 !-----------------------------------------------------------------------------
640 ! rewritten by Kai-Uwe Bloem (i5110401@dbstu1.bitnet) for speed.
641 ! #1 01/12/90 initial revision. Minor reduce of shift operations.
642 ! #2 03/07/90 use 68000 divu instruction whereever possible. This change
643 ! makes #1 superflous. (derived from my GNU division routine)
644 !-----------------------------------------------------------------------------
645 ! Some common cases can be handled in a special, much faster way :
647 ! => cause trap, then return to user. Result is undefined
648 ! 2) dividend < divisor
649 ! => quotient = 0, remainder = dividend
650 ! 3) divisor < 0x10000 ( i.e. divisor is only 16 bits wide )
651 ! => quotient and remainder can be calculated quite fast by repeated
652 ! application of 68000 divu operations (ca. 400 cycles)
653 ! 4) otherwise (due to #2, #3 dividend, divisor both wider then 16 bits)
654 ! => do slow division by shift and subtract
655 !-----------------------------------------------------------------------------
666 move.l (sp)+,a1 ! return address
667 move.l (sp)+,d0 ! divisor
668 move.l (sp)+,d2 ! dividend
669 move.l d3,a0 ! save d3
670 move.l d4,-(sp) ! save result sign register
673 bpl 0f ! dividend is negative ?
674 neg.l d2 ! yes - negate
675 not.l d4 ! and note negation in d4
678 bpl 0f ! divisor is negative ?
679 neg.l d0 ! yes - negate
680 not.w d4 ! note negation
682 clr.l d1 ! prepare quotient
683 ! === case 1: divisor = 0
684 tst.l d0 ! divisor = 0 ?
685 beq 9f ! yes - divide by zero trap
686 ! === case 2: dividend < divisor
687 cmp.l d0,d2 ! dividend < divisor ?
688 bcs 8f ! yes - division already finished
689 ! === case 3: divisor <= 0x0ffff
690 cmp.l #0x0ffff,d0 ! is divisor only 16 bits wide ?
692 move.w d2,d3 ! save dividend.l
693 clr.w d2 ! prepare dividend.h for divu operation
695 beq 0f ! dividend.h is all zero, no divu necessary
697 0: move.w d2,d1 ! save quotient.h
699 move.w d3,d2 ! divide dividend.l
700 divu d0,d2 ! (d2.h = remainder of prev divu)
701 move.w d2,d1 ! save qoutient.l
702 clr.w d2 ! get remainder
705 ! === case 4: divisor and dividend both > 0x0ffff
707 move #32-1,d3 ! loop count
709 lsl.l #1,d2 ! shift dividend ...
710 roxl.l #1,d1 ! ... into d1
711 cmp.l d0,d1 ! compare with divisor
713 sub.l d0,d1 ! bigger, subtract divisor
714 add #1,d2 ! note subtraction in result
717 exg d1,d2 ! get results in the correct registers
719 tst.w d4 ! quotient < 0 ?
721 neg.l d1 ! yes - negate
722 0: tst.l d4 ! remainder < 0 ?
725 0: move.l (sp)+,d4 ! restore d4
726 move.l a0,d3 ! restore d3
730 9: move.w #EIDIVZ,-(sp)
732 \0mli.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0p
\ 1.define .mli
769 mlu.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\92\ 2.define .mlu
775 ! entry : d0 multiplicand
777 ! exit : d0 high order result
778 ! d1 low order result
782 movem.l d3/d4/d6,-(sp)
816 movem.l (sp)+,d3/d4/d6
821 shp.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0Ý
\ 1.define .strhp
829 move.l 4(sp), d1 ! new heap pointer
836 jsr BRK ! allocate 1K bytes of extra storage
841 move.l 4(sp), .reghp ! store new value of heap pointer
852 lsig.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0µ
\0.define .sig
861 move.l (sp)+,a1 ! trap pc
866 1cms.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0¼
\ 1.define .cms
873 ! d0 contains set size
874 ! on exit d0 is zero for equal, non-zero for not equal
876 move.l (sp)+, d2 ! return address
877 move.l sp, a0 ! address of top block
878 lea 0(sp, d0.l), a1 ! address of lower block
888 add.l d1, sp ! two blocks popped
892 fat.s
\0\0\0\0\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0q
\0.define .fatal
903 zfp68881.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
904 .define .ngf4, .ngf8, .fif4, .fif8, .fef4, .fef8
905 .define .cif4, .cif8, .cuf4, .cuf8, .cfi, .cfu, .cff4, .cff8
912 ! $Id: fp68881.s,v 1.2 1994/06/24 13:05:14 ceriel Exp $
914 ! Implement interface to floating point package for M68881
1019 and.l #0x2000,d0 ! set if Infinity
1024 move.l #0x3f000000,4(a1)
1027 move.l #0xbf000000,4(a1)
1050 and.l #0x2000,d0 ! set if Infinity
1055 move.l #0x3fe00000,4(a1)
1059 move.l #0xbfe00000,4(a1)
1094 fsub.l #-2147483648,fp0
1095 fsub.l #-2147483648,fp0
1105 fsub.l #-2147483648,fp0
1106 fsub.l #-2147483648,fp0
1133 cmp.l #0x4f000000,8(sp)
1139 fadd.l #-2147483648,fp0
1148 cmp.l #0x41e00000,8(sp)
1154 fadd.l #-2147483648,fp0
1202 trp.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ó
\ 1.define .trp
1240 fmt: .asciz "EM trap %d called\n"
1242 fdia.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0\r\b.define .diagnos
1287 .ascii "0123456789abcdef"
1291 movem.l d0/d1/d2/a0/a1/a2/a3/a4/a5/a6, -(sp)
1292 lea 44(sp), a6 ! a6 <- address of arguments
1293 move.l (a6)+, a5 ! a5 <- address of format
1294 next: move.b (a5)+, d0
1298 put: move.l d0, -(sp)
1299 jsr putchar ! long argument on stack
1303 procnt: move.b (a5)+, d0
1304 cmp.b #'d', d0 ! NOTE: %d means unsigned.
1310 cmp.b #'%', d0 ! second % has to be printed.
1312 tst.b -(a5) ! normal char should be printed
1315 string: move.l (a6)+, a2 ! a2 <- address of string
1316 sloop: move.b (a2)+, d0
1319 jsr putchar ! long argument on stack
1323 digit: move.l (a6)+, d1 ! d1 <- integer
1324 move.l #getal+12, a2 ! a2 <- ptr to last part of buf
1325 clr.b -(a2) ! stringterminator
1329 jsr .dvu ! d1 <- qotient; d0 <- remainder
1332 tst.l d1 ! if quotient = 0 then ready
1334 bra sloop ! print digitstring.
1336 hex: move.l (a6)+, d1 ! d1 <- integer
1337 move.l #getal+12, a2 ! a2 <- ptr to last part of buf
1338 clr.b -(a2) ! stringterminator
1339 move.l #7, d2 ! loop control
1344 move.b (a0), -(a2) ! hex digit
1350 movem.l (sp)+, d0/d1/d2/a0/a1/a2/a3/a4/a5/a6
1363 fmt: .asciz "%s, line %d: "
1364 unknwn: .asciz "unknown file"
1366 )dvu.s
\01.s
\0\0\0\0\0\0\0\0\0\ 2\ 2¤
\ 1\0\0ø .define .dvu
1372 ! unsigned long divide
1373 !-----------------------------------------------------------------------------
1374 ! rewritten by Kai-Uwe Bloem (i5110401@dbstu1.bitnet) for speed.
1375 ! #1 01/12/90 initial revision. Minor reduce of shift operations.
1376 ! #2 03/07/90 use 68000 divu instruction whereever possible. This change
1377 ! makes #1 superflous. (derived from my GNU division routine)
1378 !-----------------------------------------------------------------------------
1379 ! Some common cases can be handled in a special, much faster way :
1381 ! => cause trap, then return to user. Result is undefined
1382 ! 2) dividend < divisor
1383 ! => quotient = 0, remainder = dividend
1384 ! 3) divisor < 0x10000 ( i.e. divisor is only 16 bits wide )
1385 ! => quotient and remainder can be calculated quite fast by repeated
1386 ! application of 68000 divu operations (ca. 400 cycles)
1387 ! 4) otherwise (due to #2, #3 dividend, divisor both wider then 16 bits)
1388 ! => do slow division by shift and subtract
1389 !-----------------------------------------------------------------------------
1395 ! exit : d1 quotient
1400 move.l d3,a0 ! save d3
1401 move.l (sp)+,a1 ! return address
1402 move.l (sp)+,d0 ! divisor
1403 move.l (sp)+,d2 ! dividend
1404 clr.l d1 ! prepare quotient
1405 ! === case 1: divisor = 0
1406 tst.l d0 ! divisor = 0 ?
1407 beq 9f ! yes - divide by zero trap
1408 ! === case 2: dividend < divisor
1409 cmp.l d0,d2 ! dividend < divisor ?
1410 bcs 8f ! yes - division already finished
1411 ! === case 3: divisor <= 0x0ffff
1412 cmp.l #0x0ffff,d0 ! is divisor only 16 bits wide ?
1414 move.w d2,d3 ! save dividend.l
1415 clr.w d2 ! prepare dividend.h for divu operation
1417 beq 0f ! dividend.h is all zero, no divu necessary
1419 0: move.w d2,d1 ! save quotient.h
1421 move.w d3,d2 ! divide dividend.l
1422 divu d0,d2 ! (d2.h = remainder of prev divu)
1423 move.w d2,d1 ! save qoutient.l
1424 clr.w d2 ! get remainder
1427 ! === case 4: divisor and dividend both > 0x0ffff
1429 move #32-1,d3 ! loop count
1431 lsl.l #1,d2 ! shift dividend ...
1432 roxl.l #1,d1 ! ... into d1
1433 cmp.l d0,d1 ! compare with divisor
1435 sub.l d0,d1 ! bigger, subtract divisor
1436 add #1,d2 ! note subtraction in result
1439 exg d1,d2 ! get results in the correct registers
1441 move.l a0,d3 ! restore d3
1445 9: move.w #EIDIVZ,-(sp)