|
|
1.1 ! root 1: This is a OS/2 implementation of the game of Life. It is designed to be bound ! 2: to allow it to operate in both the protect mode of OS/2 and in earlier MS-DOS ! 3: versions. The program uses a mouse if one is installed, but one is not needed. ! 4: If no mouse is installed, the F9 and INS buttons act as if they were the ! 5: left mouse button and the F10 and DEL buttons act as the right mouse buttons. ! 6: The cursor keys move the mouse pointer. ! 7: When not in the active screen group, Life does not print to the screen and ! 8: can thus execute in the background. ! 9: ! 10: Life was invented by mathematician John Conway. Life is played on a grid ! 11: that contains cells which are either on or off. At the start, a pattern of ! 12: cells are turned on in the grid. The following three rules are then applied to ! 13: the entire grid simultaneously. One full aplication of the rules to the grid ! 14: is called a "generation." The three rules are: ! 15: ! 16: 1) If a cell has two neighbors (counting both cells immediately ! 17: adjacent and diagonal from the one in question), the cell ! 18: remains in its current state (on or off). ! 19: ! 20: 2) If a cell has three neighbors, it is turned on (or remains on ! 21: if that was already its state). ! 22: ! 23: 3) If a cell has one or fewer or four or more neighbors, it is ! 24: turned off (or remains off if that was already its state). ! 25: ! 26: The history of Life and many patterns of cells which produce interesting ! 27: results, including those contained here, can be found in the Scientific ! 28: American articles that introduced the game (October 1970 and February 1971) and ! 29: the book The Recursive Universe, by William Poundstone (Contemporary Books: ! 30: Chicago, 1985). ! 31: ! 32: ****************************************************************************** ! 33: ! 34: Files: ! 35: LIFE.C - main Life program source code ! 36: LIFE2.ASM - fast assembler routines called by LIFE.C ! 37: MOUAPI.C - real mode mouse calls to simulate protect mode calls ! 38: INT33H.ASM - short routine to call mouse real mode API, used by MOUAPI ! 39: MOUAPI.LIB - library created from MOUAPI for linking with BIND to LIFE ! 40: LIFE - directions for MAKE.EXE to build LIFE.EXE ! 41: LIFE.EXE - the executable program built from the files listed above ! 42: *.LIF - sample files which can be read by LIFE.EXE ! 43: ! 44: ****************************************************************************** ! 45: ! 46: This program illustrates the following concepts used in OS/2 programs: ! 47: ! 48: * Binding programs for use in both OS/2 and earlier versions of MS-DOS ! 49: ! 50: Tools: BIND.EXE, API.LIB, LIB.EXE ! 51: ! 52: * Calling OS/2 functions from C and assembler ! 53: ! 54: * Screen graphics in protect mode ! 55: ! 56: Calls: VioGetMode, VioSetMode, VioGetPhysBuf, VioScrLock, ! 57: VioScrUnLock, VioGetFont ! 58: ! 59: * Mouse support in protect and real graphics modes ! 60: ! 61: Calls: MouOpen, MouSetDevStatus, MouReadEventQue, MouSetPtrPos ! 62: MouGetNumQueEl ! 63: Int 33h functions 0, 3, and 4 ! 64: ! 65: * Memory allocation and reallocation ! 66: ! 67: Calls: DosAllocSeg, DosReAllocSeg ! 68: ! 69: * Keyboard input ! 70: ! 71: Calls: KbdCharIn, KbdPeek ! 72: ! 73: * File input and output ! 74: ! 75: Calls: DosOpen, DosRead, DosWrite, DosClose ! 76: ! 77: * Signal handling ! 78: ! 79: Calls: DosSetSigHandler ! 80: ! 81: * Other functions ! 82: ! 83: Calls: DosExit, DosBeep
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.