richard@bigtuna.UUCP (Richard Foulk) (06/28/85)
I'm trying to get the Maryland Z80 cross assembler running on a Dual 68K box (System V). It requires the bsd4.1 loader, ld, which we have VAX sources to. The problem is an asm() call in the function called bwrite (which is the same in both 4.1 and 4.2.) Could someone please give me an idea what C code I can replace the following asm() call with: > to = bp->b_ptr; > asm("movc3 r8,(r11),(r7)"); > bp->b_ptr += put; The b_ptr member is a (char *). The leadin to bwrite looks like this: > bwrite(p, cnt, bp) > register char *p; > register int cnt; > register struct biobuf *bp; > { > register int put; > register char *to; > I hope this is enough information to figure things out. thanks much. -- Richard Foulk (..islenet!bigtuna!richard) Honolulu, Hawaii
jack@boring.UUCP (07/01/85)
This brings me to one of my favorite flames : NEVER USE ASM() STATEMENTS!! If you do, do something like #ifdef FUNNY_MACHINE asm("movm r3,r4,r5"); #else while(i-->0) *p++ = *q++; #endif FUNNY_MACHINE or, if this is impossible, the least you should do is #ifdef FUNNY_MACHINE asm("barf r0"); #else This instruction should flash all the lights on the console, turn all the terminals off, and turn on the coffee machine; #endif FUNNY_MACHINE How the h*ll should anyone with a different machine now what your assembly language is like, *even if you're running on a VAX*? -- Jack Jansen, jack@mcvax.UUCP The shell is my oyster.
farhad@ISM780.UUCP (07/02/85)
If you care about the speed, try to find equivalent instruction for movc3. If not, do the following changes. > if (bp->b_nleft) { > . . > . . > . . > . . > to = bp->b_ptr; . > asm("movc3 r8,(r11),(r7)"); ==> cnt -= put; > . ==> while (put--) > . ==> *to++ = *p++; > . ==> bp->b_ptr = to; > . ==> goto top; > } > if (cnt >= BUF... --farhad
jim@ISM780B.UUCP (07/02/85)
Under SysV, the asm line can be replaced with memcpy(to, p, put); -- Jim Balter, INTERACTIVE Systems (ima!jim)