Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!cmcl2!rutgers!lll-lcc!pyramid!decwrl!sqm.dec.com!jmsynge From: jmsynge@sqm.dec.com (James M Synge, DTN 381-1545) Newsgroups: comp.sys.amiga Subject: Re: A shared library (mostly) in C Message-ID: <10113@decwrl.DEC.COM> Date: Sat, 30-May-87 02:21:52 EDT Article-I.D.: decwrl.10113 Posted: Sat May 30 02:21:52 1987 Date-Received: Sun, 31-May-87 16:36:42 EDT Sender: daemon@decwrl.DEC.COM Organization: Digital Equipment Corporation Lines: 89 [ For all I do, dis bugs for me ] My line eater comment really expresses the current state of the library I posted. I made a mistake in the assembly code in the file Protect.i, and failed to catch it before I sent it out. Thats what I get for hacking till late and not carefully checking all the versions. That last minute change killed the program. So, I'm following my signature with a shar file with that one file. James Synge USENET: {decvax, ucbvax, allegra}!decwrl!sqm.dec.com!jmsynge ARPAnet: jmsynge%sqm.DEC@decwrl.DEC.COM #include So many ratholes, so little time! # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # Protect.i # This archive created: Fri May 29 20:42:26 1987 cat << \SHAR_EOF > Protect.i ;; Protect.i Copyright 1987 by James M Synge ;; ;; An assembly macro for protecting registers. ;; Not for the weak of heart. macro protect if NARG <> 2 fail ; Must specify the number of args! mexit endc iflt \2 fail ; Negative number of args! mexit endc ; Until a bug fix arrives for the assembler so that the \0 ; macro works, we must assume the argument size is 4 bytes. \@elementsize set 4 \@bytes set \@elementsize * \2 \@offset set \@bytes + (AztecBugSize * 4) movem.l AztecBugList,-(sp) ; Save some regs ; Push the argument(s). We'll use D0 as our scratch ; register. It is free for that use according to ; the register convention. It is used as the result ; register. ifne \2 ; If there are any arguments moveq #\2,d0 ; Number of arguments to move \@loop move.l \@offset(sp),-(sp) ; Push an arg subq.l #1,d0 ; Last argument? bne \@loop ; If so, loop again? endc jsr \1 ; Call the C routine ifne \2 ; Pop any arguments ifge 8 - \@bytes ; Can we use addq.l? addq.l #\@bytes,sp ; Yup! else lea \@bytes(sp),sp ; Otherwise use lea endc endc movem.l (sp)+,AztecBugList ; Restore regs rts ; And return endm ; End of the protect macro SHAR_EOF if test 1189 -ne "`wc -c Protect.i`" then echo shar: error transmitting Protect.i '(should have been 1189 characters)' fi # End of shell archive exit 0