From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.openmailbox.org ([5.79.108.160]) by ur; Wed Apr 26 15:50:25 EDT 2017 Received: by mail.openmailbox.org (Postfix, from userid 20002) id C2C7950FFFB; Wed, 26 Apr 2017 21:50:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1493236222; bh=+iV1rvZS9cJvjzkySKjMothOZL6Uq3oBnk1jpDLVYlo=; h=Subject:To:References:From:Cc:Date:In-Reply-To:From; b=now6HmlbjnLs51mbkaf1bE5qoWXC4G5tgUCFuSpnBuOIwik25wHJZeGPcR2Sh4l7O Tp+G0HvDK9cu9K/xjHoUnyD5yJqVfBvAqUU5h1GB713bffT78OvRjbVOmvlaof4hGd 7gJ1j6JV89WfDt5/t2jnnNlVgmFFm6MShJPQjmSs= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ZDZR003 X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=NO_RECEIVED,NO_RELAYS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Subject: Re: [9front] Fwd: [TUHS] 8th Edition Research Unix on SIMH DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=openmailbox.org; s=openmailbox; t=1493236221; bh=+iV1rvZS9cJvjzkySKjMothOZL6Uq3oBnk1jpDLVYlo=; h=Subject:To:References:From:Cc:Date:In-Reply-To:From; b=iwnsP2g3ciP/6qHqJp6lsz58GAYW10ZbmKRaR/aXyjG8X9k0X6X7S42IsuJRMLPsu WtZLVQGvoUMf5HdQw34zuH9bIYljzj9WMLSUbwJTgLEEXntjt4+1/dQAsIpaks3Yol mGfBcZKDHVIcPakVYAMXtgJGWgnwAfEIRv6i1bfs= To: tim.newsham@gmail.com References: <3AA1B338-5347-40BE-BB5E-C4BDC5B0021F@stanleylieber.com> From: Tony Kaku Cc: 9front@9front.org, tuhs@tuhs.org Message-ID: <497749ae-2a3b-6932-ba9c-288153b2129f@openmailbox.org> Date: Wed, 26 Apr 2017 21:52:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <3AA1B338-5347-40BE-BB5E-C4BDC5B0021F@stanleylieber.com> Content-Type: multipart/mixed; boundary="------------268D8C2758C3366C17C8E335" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: open open-source API CMS high-performance locator This is a multi-part message in MIME format. --------------268D8C2758C3366C17C8E335 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 04/26/2017 05:25 AM, Stanley Lieber wrote: > > > > Begin forwarded message: > >> *From:* Tim Newsham > > >> *Date:* April 25, 2017 at 11:05:25 PM EDT >> *To:* mjkerpan@kerpan.com >> *Cc:* The Eunuchs Hysterical Society > > >> *Subject:* *Re: [TUHS] 8th Edition Research Unix on SIMH* >> >> I got the 9front blit sources to build and run in plan9port. There's >> some serious graphics issue right now causing a lot of flicker and >> sometimes causing the graphics to not appear at all.. Anyone here >> good with plan9port graphics ports? >> >> https://github.com/timnewsham/blit >> >> Tim, I've already done my own port of the blit emulator to plan9port, but I didn't publish it anywhere. Although I see on your GitHub page that you've already solved the flicker problem, I thought I'd share my own solution as well. The attached patch was made with plain diff (I didn't put my port under version control) against 9front prior to changeset 5896 and only covers blit.c. It also changes the virtual screen drawing algorithm so it always displays the top left corner, as opposed to centering on the middle. This is handy on small resolution screens since apparently rsc's devdraw doesn't allow resizing windows to larger dimensions than the screen, and not displaying the top of the blit's screen causes the blit's cursor to be offset from the host system's. You can also use the added -m flag to supress hiding of the host cursor to make sure they are aligned. tkk --------------268D8C2758C3366C17C8E335 Content-Type: text/x-patch; name="blit.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="blit.patch" --- ../others/plan9front/sys/src/games/blit/blit.c 2017-04-26 21:26:05.918471287 +0200 +++ blit.c 2017-04-14 15:55:19.338245717 +0200 @@ -10,7 +10,6 @@ int baud = 40000; int scale = 1; -Rectangle picr; Image *tmp, *bg; Channel *keych, *uartrxch, *uarttxch; Mousectl *mc; @@ -22,14 +21,11 @@ Rectangle updated; u32int colbgv, colfgv; Image *colbg, *colfg; int realcolors; +Keyboardctl *keyboard; static void screeninit(void) { - Point p; - - p = divpt(addpt(screen->r.min, screen->r.max), 2); - picr = (Rectangle){subpt(p, Pt(scale * SX/2, scale * SY/2)), addpt(p, Pt(scale * SX/2, scale * SY/2))}; if(tmp != nil) freeimage(tmp); tmp = allocimage(display, Rect(0, 0, scale * SX, scale > 1 ? 1 : scale * SY), CHAN1(CMap, 1), scale > 1, 0); if(bg != nil) freeimage(bg); @@ -50,15 +46,15 @@ redraw(void) Mouse m; Rectangle r; - if(nbrecvul(mc->resizec) > 0){ + if((long)nbrecvul(mc->resizec) > 0){ if(getwindow(display, Refnone) < 0) sysfatal("resize failed: %r"); screeninit(); } while(nbrecv(mc->c, &m) > 0){ - if(ptinrect(m.xy, picr)){ - mousex = picr.max.x - m.xy.x - 1; - mousey = picr.max.y - m.xy.y - 1; + if(ptinrect(m.xy, screen->r)){ + mousex = screen->r.max.x - m.xy.x - 1; + mousey = screen->r.max.y - m.xy.y - 1; } n = m.buttons >> 2 & 1 | m.buttons & 2 | m.buttons << 2 & 4; if(n != mousebut){ @@ -88,44 +84,41 @@ redraw(void) loadimage(tmp, r, pic+o, Dy(r)*(SX/8)); if(realcolors){ - draw(screen, rectaddpt(r, picr.min), colfg, nil, r.min); - draw(screen, rectaddpt(r, picr.min), colbg, tmp, r.min); + draw(screen, rectaddpt(r, screen->r.min), colfg, nil, r.min); + draw(screen, rectaddpt(r, screen->r.min), colbg, tmp, r.min); }else - draw(screen, rectaddpt(r, picr.min), tmp, nil, r.min); + draw(screen, rectaddpt(r, screen->r.min), tmp, nil, r.min); updated = Rect(SX, SY, 0, 0); flushimage(display, 1); } static uchar keymap[] = { - [Kup-KF] 0xf1, - [Kdown-KF] 0xf2, - [Kleft-KF] 0xf3, - [Kright-KF] 0xf4, - [1] 0xf6, /* PF1 */ - [2] 0xf7, /* PF2 */ - [3] 0xf8, /* PF3 */ - [4] 0xf9, /* PF4 */ - [12] 0xfe, /* SET-UP */ - [Kpgdown-KF] 0xb0, /* SCROLL */ - [Kins-KF] 0xe0, /* BREAK */ + [Kup-KF] = 0xf1, +// [Kdown-KF] = 0xf2, + [0x80] = 0xf2, + [Kleft-KF] = 0xf3, + [Kright-KF] = 0xf4, + [1] = 0xf6, /* PF1 */ + [2] = 0xf7, /* PF2 */ + [3] = 0xf8, /* PF3 */ + [4] = 0xf9, /* PF4 */ + [12] = 0xfe, /* SET-UP */ + [Kpgdown-KF] = 0xb0, /* SCROLL */ + [Kins-KF] = 0xe0, /* BREAK */ }; - +/* static void -keyproc(void *) +keyproc(void *unused) { - int fd, cfd, ch, rc; + int fd, ch, rc; static char buf[256]; char *p; Rune r; - fd = open("/dev/cons", OREAD); + fd = open("/dev/tty", OREAD); if(fd < 0) sysfatal("open: %r"); - cfd = open("/dev/consctl", OWRITE); - if(cfd < 0) - sysfatal("open: %r"); - fprint(cfd, "rawon"); for(;;){ rc = read(fd, buf, sizeof(buf) - 1); if(rc <= 0) @@ -146,6 +139,29 @@ keyproc(void *) } } } +*/ + +static void +keyproc(void *unused) +{ + int ch; + Rune r; + + for(;;){ + recv(keyboard->c, &r); + if(r == Kend) + threadexitsall(nil); + ch = r; + if(ch == '\n') ch = '\r'; + else if(ch >= KF){ + if(ch >= KF + nelem(keymap)) continue; + ch = keymap[ch - KF]; + if(ch == 0) continue; + }else if(ch >= 0x80) continue; + //fprint(2, "%s", ch); + send(keych, &ch); + } +} void usage(void) @@ -157,12 +173,13 @@ usage(void) void threadmain(int argc, char **argv) { - int n; + int n, ms; static Cursor blank; char *telnet; char *p; extern int diag; + ms = 0; telnet = nil; ARGBEGIN{ case 'b': @@ -184,6 +201,9 @@ threadmain(int argc, char **argv) case 'd': diag++; break; + case 'm': + ms++; + break; default: usage(); }ARGEND; if(argc != 0) usage(); @@ -197,11 +217,13 @@ threadmain(int argc, char **argv) sysfatal("initdraw: %r"); screeninit(); + keyboard = initkeyboard(nil); proccreate(keyproc, nil, mainstacksize); mc = initmouse(nil, screen); if(mc == nil) sysfatal("initmouse: %r"); - setcursor(mc, &blank); + if(!ms) + setcursor(mc, &blank); cpureset(); for(;;){ --------------268D8C2758C3366C17C8E335--