Path: utzoo!utgpu!attcan!uunet!husc6!m2c!applix!scott From: scott@applix.UUCP (Scott Evernden) Newsgroups: comp.arch Subject: Re: Self-modifying code Message-ID: <759@applix.UUCP> Date: 4 Aug 88 05:09:49 GMT References: <5254@june.cs.washington.edu> <76700032@p.cs.uiuc.edu> <1189@ficc.UUCP> <3084@tekig5.PEN.TEK.COM> Reply-To: scott@applix.UUCP (Scott Evernden) Organization: APPLiX Inc., Westboro MA Lines: 91 In article <3084@tekig5.PEN.TEK.COM> wayneck@tekig5.PEN.TEK.COM (Wayne Knapp) writes: >In article <1189@ficc.UUCP>, peter@ficc.UUCP (Peter da Silva) writes: >> >> The Blitter can be used to pump LIFE along at a bit over 20 generations >> per second. The 68000 can't hope to catch up. How's the 68030? > >Okay, so how does blitter help if the cell array is the frame buffer. The blitter can be used as a sort of "parallel processor". You allocate 5 bitmaps, and then blit to and fro simulating a parallel adder. Here's the generation section of am Amiga program I wrote in early '86 which did about 5 gens/sec for a 320 x 200 grid. I needed 39 2-input blits per generation. Wiser folks than I have since improved this to about 20/sec by going straight to the blitter and using its 3 input capability, requiring 9 blits. (See 'Amazing Computing' vol.2 #12 thru vol.3 #2.). Inspired by Mark D. Niemiec's "Life Algorithms" in Byte, Jan '79... ---------------------------------------------- /* Blitter op-codes */ #define MOV 0xC0 #define COM 0x50 #define XOR 0x60 #define BIC 0x20 #define BIS 0xE0 #define AND 0x80 /* Blitter use */ #define SBLIT(s,l,t,d,c) BltBitMap(s,l, t, d,Left,Top,Wid,Hyt,c,0xFF,0) #define BBLIT(s,d,c) BltBitMap(s,Left,Top,d,Left,Top,Wid,Hyt,c,0xFF,0) generation() /* * The blitter "program" to produce the next generation. * I think it might be possible to work directly with the blitter * to utilize its 3-input capability, but this is for some other day... */ { /* add up the neighbor's above each cell */ SBLIT(bm[SCREEN], Left-CellX, Top-CellY, bm[0], MOV); SBLIT(bm[SCREEN], Left, Top-CellY, bm[1], MOV); SBLIT(bm[SCREEN], Left+CellX, Top-CellY, bm[2], MOV); BBLIT(bm[1], bm[0], XOR); BBLIT(bm[0], bm[1], BIC); BBLIT(bm[2], bm[0], XOR); BBLIT(bm[0], bm[2], BIC); BBLIT(bm[2], bm[1], BIS); /* add up the neighbor's below each cell */ SBLIT(bm[SCREEN], Left-CellX, Top+CellY, bm[2], MOV); SBLIT(bm[SCREEN], Left, Top+CellY, bm[3], MOV); SBLIT(bm[SCREEN], Left+CellX, Top+CellY, bm[4], MOV); BBLIT(bm[3], bm[2], XOR); BBLIT(bm[2], bm[3], BIC); BBLIT(bm[4], bm[2], XOR); BBLIT(bm[2], bm[4], BIC); BBLIT(bm[4], bm[3], BIS); /* now add the 'above' and 'below' counts */ BBLIT(bm[2], bm[0], XOR); BBLIT(bm[0], bm[2], BIC); BBLIT(bm[2], bm[1], XOR); BBLIT(bm[1], bm[2], BIC); BBLIT(bm[3], bm[1], XOR); BBLIT(bm[1], bm[3], BIC); BBLIT(bm[3], bm[2], BIS); /* left and right */ SBLIT(bm[SCREEN], Left-CellX, Top, bm[3], MOV); SBLIT(bm[SCREEN], Left+CellX, Top, bm[4], MOV); BBLIT(bm[4], bm[3], XOR); BBLIT(bm[3], bm[4], BIC); /* grand total neighbors */ BBLIT(bm[3], bm[0], XOR); BBLIT(bm[0], bm[3], BIC); BBLIT(bm[3], bm[1], XOR); BBLIT(bm[1], bm[3], BIC); BBLIT(bm[4], bm[1], XOR); BBLIT(bm[1], bm[4], BIC); BBLIT(bm[3], bm[2], BIS); BBLIT(bm[4], bm[2], BIS); /* add 'self' in and put on screen */ SBLIT(bm[SCREEN], Left, Top, bm[0], BIS); BBLIT(bm[2], bm[0], BIC); BBLIT(bm[1], bm[0], AND); SBLIT(bm[0], Left, Top, bm[SCREEN], MOV); } -scott