Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site mako.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!cornell!uw-beaver!tektronix!orca!mako!jans From: jans@mako.UUCP (Jan Steinman) Newsgroups: net.works,net.arch Subject: Assembly VS HOL: A (admittedly biased) Challenge. Message-ID: <741@mako.UUCP> Date: Tue, 30-Apr-85 13:13:34 EDT Article-I.D.: mako.741 Posted: Tue Apr 30 13:13:34 1985 Date-Received: Thu, 2-May-85 01:09:13 EDT References: <1220@topaz.ARPA> <511@terak.UUCP> <1440@amdahl.UUCP> <518@terak.UUCP> Reply-To: jans@mako.UUCP (Jan Steinman) Organization: Tektronix, Wilsonville OR Lines: 40 Xref: watmath net.works:1021 net.arch:1134 Summary: Here's a short register dump routine. It works fine on UTek (a Berklyoid), but I don't have access to V or true 4.2. It is probably non-portable to those. I wrote it in under an hour and it worked the first time. I used assembly because I couldn't figure out how to do it in C, but I don't claim to be a seasoned C hacker. Would others care to demonstrate HOL approaches to the problem, preferably in a friendly, non-inflamitory manner? To assemble on your favorite NS32000-based system: cpp dumpRegs.s | as -o dumpRegs.o ------------------------------ cut here -------------------------------------- /**** dumpRegs ****************************************************** * * This is a simple register dump routine. It accepts one parameter, which * must be a pointer to a zero-terminated string. It's return value is * undefined: whatever was in R0 upon call. All general-purpose registers are * preserved. */ .data L_fmt: .asciz "\t%s\n r7 r6 r5 r4 r3 r2 r1 r0\n%8x %8x %8x %8x %8x %8x %8x %8x\n fp sp sb upsr\n%8X %8x %8x %8x\n\n" .text .globl _printf .globl _dumpRegs _dumpRegs: sprd upsr,tos /*Stack parameters in reverse order. */ sprd sb,tos sprd sp,tos sprd fp,tos save $0xff /*Registers display in reverse order. */ movd 13*4(sp),tos /*Stack the caller's message pointer, */ addr L_fmt,tos /* and our "print" template. */ jsr _printf /*Print the stuff, */ adjspb $-2*4 /* delete the string parameters, */ restore $0xff /* restore the genereal registers, */ adjspb $-4*4 /* and delete the other parameters. */ ret $0 /*Caller must delete the msg pointer. */ -- :::::: Jan Steinman Box 1000, MS 61-161 (w)503/685-2843 :::::: :::::: tektronix!tekecs!jans Wilsonville, OR 97070 (h)503/657-7703 ::::::