9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] drawterm for Mac OS 10.1
@ 2002-04-13  9:36 Geoff Collyer
  0 siblings, 0 replies; only message in thread
From: Geoff Collyer @ 2002-04-13  9:36 UTC (permalink / raw)
  To: 9fans

I just got drawterm running under X on Mac OS 10.1.  It only works
with 8 bits per pixel and I don't know why.  At other depths, once the
first rio window scrolls, all the characters, already drawn and those
yet to be drawn, become invisible.  I don't know why and I've wasted
enough time on X, so it's left an exercise for the bored to find out
why.

To get drawterm running on OS 10.1, you need to get XFree86 for Mac OS
(`XDarwin') and install it.  You can just load

	http://www.opensource.apple.com/projects/xonx/XInstall_10.1.sit

and open it (e.g., click on it).  I believe the result is a binary
called XInstall; open it and answer its questions.

Edit the last line of /Applications/XDarwin.app/Contents/Resources/startXClients
to add -fbbpp, -depth and -wm options:

	exec xinit $clientargs -- /usr/X11R6/bin/XDarwinStartup "$1" \
		-idle -fbbpp 8 -depth 8 -wm

In the drawterm source directory on your Mac, make these changes:

diff ./mkfile /usr/geoff/imac/src/cmd/drawterm/mkfile
2c2,4
< DSRC=/n/emelie/sys/src/cmd/unix/drawterm
---
> CONF=FreeBSD-power
> #DSRC=/n/emelie/sys/src/cmd/unix/drawterm
> DSRC=.
: cpu; diff `{yesterday .} os.h
2a3,6
> #ifdef MACOSX
> #	define abort dt_abort	/* avoid conflicts with libSystem (libc) */
> #	define panic dt_panic
> #endif

and add these files, and you should then be able to build drawterm,
start XDarwin and run drawterm:

# To unbundle, run from here down
echo mkfile-FreeBSD-power
sed 's/^X//' >mkfile-FreeBSD-power <<'!'
WIN=x11
OS=posix

CC=cc
CFLAGS=-g -c -DFREEBSD -DMACOSX -I/usr/X11R6/include
TARG=drawterm
O=o
LD=cc
LDFLAGS= -g -o drawterm

DEVIP=devip-unix
DEVFS=devunixfs
OSFILES=md-iprint.$O canlock-power-gcc.$O
LIBS=-lm -L/usr/X11R6/lib -lX11

ml-%.$O:	$DSRC/libmemlayer/%.c
X	$CC $CFLAGS -o ml-$stem.o $DSRC/libmemlayer/$stem.c

md-%.$O:	$DSRC/libmemdraw/%.c
X	$CC $CFLAGS -o md-$stem.o $DSRC/libmemdraw/$stem.c

d-%.$O:	$DSRC/libdraw/%.c
X	$CC $CFLAGS -o d-$stem.o $DSRC/libdraw/$stem.c

!
echo canlock-power-gcc.c
sed 's/^X//' >canlock-power-gcc.c <<'!'
X#include "lib9.h"
X#include "sys.h"
X#include "error.h"

X/*
X * first argument (l) is in r3 at entry.
X * r3 contains return value upon return.
X */
int
canlock(Lock *l)
X{
X	int     v;

X	/*
X	 * this __asm__ works with gcc 2.95.2 (mac os x 10.1).
X	 * this assembly language destroys r0 (0), some other register (v),
X	 * r4 (&l->val) and r5 (temp).
X	 */
X	__asm__("\n	sync\n"
X	"	li	r0,0\n"
X	"	mr	r4,%1		/* &l->val */\n"
X	"	lis	r5,0xdead	/* assemble constant 0xdeaddead */\n"
X	"	ori	r5,r5,0xdead	/* \" */\n"
X	"tas1:\n"
X	"	dcbf	r4,r0	/* cache flush; \"fix for 603x bug\" */\n"
X	"	lwarx	%0,r4,r0	/* v = l->val with reservation */\n"
X	"	cmp	cr0,0,%0,r0	/* v == 0 */\n"
X	"	bne	tas0\n"
X	"	stwcx.	r5,r4,r0   /* if (l->val same) l->val = 0xdeaddead */\n"
X	"	bne	tas1\n"
X	"tas0:\n"
X	"	sync\n"
X	"	isync\n"
X	: "=r" (v)
X	: "r"  (&l->val)
X	: "cc", "memory", "r0", "r4", "r5"
X	);
X	switch(v) {
X	case 0:		return 1;
X	case 0xdeaddead: return 0;
X	default:	print("canlock: corrupted 0x%lux\n", v);
X	}
X	return 0;
X}
!


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-13  9:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-13  9:36 [9fans] drawterm for Mac OS 10.1 Geoff Collyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).