├── games ├── hip_man │ ├── HIPMAN.SCO │ ├── hiplink.bat │ ├── hipman.h │ ├── hipscore.c │ ├── hipenemy.c │ ├── hipinit.c │ └── hipman.c ├── egypt │ └── Egypt.c ├── oichokabu │ └── OICHO.c └── mole │ └── mole.c ├── .gitattributes ├── .gitignore ├── dos1 ├── achg.bat ├── amake.bat ├── cchg.bat └── cmake.bat ├── dos2 ├── achg.bat ├── cc.bat ├── amake.bat ├── cchg.bat └── cmake.bat ├── examples ├── screen.c ├── rnd.c ├── kilbuf.c ├── srnd.c ├── color.c ├── sound.c ├── boxfil.c ├── calbio.c ├── sgn.c ├── ldirmv.c ├── palett.c ├── filvrm.c ├── line.c ├── vpeek.c ├── putspr.c ├── ldirvm.c ├── vpoke.c ├── gtpad.c ├── gtstck.c ├── cpym2v.c ├── snsmat.c ├── cpyv2v.c ├── gttrig.c └── colspr.c ├── include ├── msxclib.h └── msxalib.h ├── lib ├── msxclib.c └── msxalib.mac └── README.MD /games/hip_man/HIPMAN.SCO: -------------------------------------------------------------------------------- 1 | 534 FUKENKO 2 | 251 fukenko 3 | 229 fukenko 4 |  -------------------------------------------------------------------------------- /games/hip_man/hiplink.bat: -------------------------------------------------------------------------------- 1 | l80 ck,hipinit,hipenemy,hipscore,hipman,msxclib/s,msxalib/s,clib/s,crun/s, cend, %1/n/e -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.c text eol=crlf 4 | *.h text eol=crlf 5 | *.bat text eol=crlf 6 | *.mac text eol=crlf 7 | *.sco text eol=crlf 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Composer is a development-only dependency (in this example) 2 | # Do not version it. 3 | 4 | *.com 5 | *.rel 6 | 7 | # OS-X Files 8 | .DS_Store 9 | 10 | -------------------------------------------------------------------------------- /dos1/achg.bat: -------------------------------------------------------------------------------- 1 | mx msxalib %1 2 | m80 =%1/z 3 | lib80 /e temp=msxalib<..%1-1>,%1,msxalib<%1+1..> 4 | copy temp.rel msxalib.rel 5 | del temp.rel 6 | del %1.mac 7 | del %1.rel 8 | -------------------------------------------------------------------------------- /dos2/achg.bat: -------------------------------------------------------------------------------- 1 | mx msxalib %1 2 | m80 =%1/z 3 | lib80 /e temp=msxalib<..%1-1>,%1,msxalib<%1+1..> 4 | copy temp.rel msxalib.rel 5 | del temp.rel 6 | del %1.mac 7 | del %1.rel 8 | -------------------------------------------------------------------------------- /dos2/cc.bat: -------------------------------------------------------------------------------- 1 | CF %2 %1 2 | CG -k %3 %1 3 | M80 =%1/z 4 | L80 B:\LIB\CK,%1,B:\lib\mlib/s,B:\LIB\CLIB/S,B:\LIB\CRUN/S,B:\LIB\CEND,%1/N/Y/E:xmain 5 | DEL %1.mac 6 | DEL %1.rel 7 | DEL %1.tco 8 | -------------------------------------------------------------------------------- /examples/screen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID main() 5 | { 6 | screen(1); 7 | puts("SCREEN 1"); 8 | getch(); 9 | screen(0); 10 | puts("SCREEN 0"); 11 | } -------------------------------------------------------------------------------- /dos2/amake.bat: -------------------------------------------------------------------------------- 1 | del msxalib.rel 2 | ren *.rel *.rrr 3 | mx -l msxalib > temp.bat 4 | echo del *.rel >> temp.bat 5 | echo ren *.rrr *.rel >> temp.bat 6 | echo ren msxalib.lib msxalib.rel >> temp.bat 7 | temp 8 | -------------------------------------------------------------------------------- /examples/rnd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID main() 5 | { 6 | int i, r; 7 | 8 | for (i = 0; i < 10; ++i) { 9 | r = rnd(1000); 10 | printf("%3d ", r); 11 | } 12 | } -------------------------------------------------------------------------------- /dos1/amake.bat: -------------------------------------------------------------------------------- 1 | del msxalib.rel 2 | ren *.rel *.rrr 3 | mx -l msxalib > temp.bat 4 | echo "del *.rel" >> temp.bat 5 | echo "ren *.rrr *.rel" >> temp.bat 6 | echo "ren msxalib.lib msxalib.rel" >> temp.bat 7 | temp 8 | -------------------------------------------------------------------------------- /examples/kilbuf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID main() 5 | { 6 | puts("Type some words!\n"); 7 | puts(" and hit [RETURN] key to exit.\n"); 8 | while ((snsmat(7) & 0x80) != 0); 9 | kilbuf(); 10 | } -------------------------------------------------------------------------------- /dos1/cchg.bat: -------------------------------------------------------------------------------- 1 | cf msxclib 2 | mx msxclib %1 3 | cg %1 4 | m80 =%1/z 5 | lib80 /e temp=msxclib<..%1-1>,%1,msxclib<%1+1..> 6 | copy temp.rel msxclib.rel 7 | del temp.rel 8 | del msxclib.tco 9 | del %1.tco 10 | del %1.mac 11 | del %1.rel 12 | -------------------------------------------------------------------------------- /dos2/cchg.bat: -------------------------------------------------------------------------------- 1 | cf msxclib 2 | mx msxclib %1 3 | cg %1 4 | m80 =%1/z 5 | lib80 /e temp=msxclib<..%1-1>,%1,msxclib<%1+1..> 6 | copy temp.rel msxclib.rel 7 | del temp.rel 8 | del msxclib.tco 9 | del %1.tco 10 | del %1.mac 11 | del %1.rel 12 | -------------------------------------------------------------------------------- /examples/srnd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | VOID main() 7 | { 8 | int i, r; 9 | 10 | srnd(); 11 | for (i = 0; i < 10; ++i) { 12 | r = rnd(1000); 13 | printf("%3d ", r); 14 | } 15 | } -------------------------------------------------------------------------------- /dos2/cmake.bat: -------------------------------------------------------------------------------- 1 | del msxclib.rel 2 | ren *.rel *.rrr 3 | del msxclib.tco 4 | cf msxclib 5 | mx -l msxclib > temp.bat 6 | echo del msxclib.tco >> temp.bat 7 | echo del *.rel >> temp.bat 8 | echo ren *.rrr *.rel >> temp.bat 9 | echo ren msxclib.lib msxclib.rel >> temp.bat 10 | temp 11 | -------------------------------------------------------------------------------- /dos1/cmake.bat: -------------------------------------------------------------------------------- 1 | del msxclib.rel 2 | ren *.rel *.rrr 3 | del msxclib.tco 4 | cf msxclib 5 | mx -l msxclib > temp.bat 6 | echo "del msxclib.tco" >> temp.bat 7 | echo "del *.rel" >> temp.bat 8 | echo "ren *.rrr *.rel" >> temp.bat 9 | echo "ren msxclib.lib msxclib.rel" >> temp.bat 10 | temp 11 | -------------------------------------------------------------------------------- /include/msxclib.h: -------------------------------------------------------------------------------- 1 | VOID screen(); 2 | VOID color(); 3 | VOID inispr(); 4 | VOID sprite(); 5 | VOID putspr(); 6 | VOID colspr(); 7 | TINY gtstck(); 8 | TINY gttrig(); 9 | int gtpad(); 10 | TINY snsmat(); 11 | VOID kilbuf(); 12 | VOID gicini(); 13 | VOID sound(); 14 | int sgn(); 15 | VOID srnd(); -------------------------------------------------------------------------------- /examples/color.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID main() 5 | { 6 | int i, j, k; 7 | 8 | screen(1); 9 | 10 | for (i = 1; i <= 15; ++i) { 11 | for (j = 1; j <= 15; ++j) { 12 | color(15, j, i); 13 | for (k = 0; k < 18000; ++k); 14 | } 15 | } 16 | color (15, 1, 1); 17 | screen(0); 18 | } -------------------------------------------------------------------------------- /examples/sound.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID main() 5 | { 6 | static int datapsg[14] = { 7 | 55, 0, 0, 0, 0, 0, 29, 54, 8 | 16, 0, 0, 116, 1, 12 }; 9 | 10 | int i; 11 | 12 | gicini(); 13 | 14 | for (i = 0; i < 14; ++i) { 15 | sound(i, datapsg[i]); 16 | } 17 | 18 | getch(); 19 | gicini(); 20 | } -------------------------------------------------------------------------------- /examples/boxfil.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | VOID main() 6 | { 7 | int i; 8 | 9 | ginit(); 10 | srnd(); 11 | screen(8); 12 | 13 | while(!kbhit()) { 14 | boxfil(rnd(256), rnd(212), 15 | rnd(256), rnd(212), rnd(256), 0); 16 | for (i = 0; i < 8000; ++i); 17 | } 18 | screen(0); 19 | } -------------------------------------------------------------------------------- /games/hip_man/hipman.h: -------------------------------------------------------------------------------- 1 | #define SPACE 0 2 | #define CHIP 1 3 | #define DOT 2 4 | #define WALL 3 5 | 6 | #define RED 0 7 | #define PINK 1 8 | #define GREEN 2 9 | #define WEAK 3 10 | #define FAINT 4 11 | 12 | struct enemy { 13 | int st; 14 | int x; 15 | int y; 16 | int tx; 17 | int ty; 18 | int wt; 19 | }; 20 | -------------------------------------------------------------------------------- /include/msxalib.h: -------------------------------------------------------------------------------- 1 | struct regs { 2 | char f; 3 | char a; 4 | unsigned bc; 5 | unsigned de; 6 | unsigned hl; 7 | }; 8 | 9 | VOID ginit(); 10 | VOID calbio(); 11 | VOID vpoke(); 12 | VOID vpeek(); 13 | VOID ldirvm(); 14 | VOID ldirmv(); 15 | VOID filvrm(); 16 | VOID boxfil(); 17 | VOID line(); 18 | VOID cpym2v(); 19 | VOID cpyv2v(); 20 | VOID palett(); 21 | unsigned rnd(); 22 |  -------------------------------------------------------------------------------- /examples/calbio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID capson() 5 | { 6 | struct regs r; 7 | 8 | r.a = 0; 9 | calbio(0x0132, &r); 10 | } 11 | 12 | VOID capsoff() 13 | { 14 | struct regs r; 15 | 16 | r.a = 1; 17 | calbio(0x0132, &r); 18 | } 19 | 20 | VOID main() 21 | { 22 | int i, j; 23 | 24 | for (i = 0; i < 10; ++i) { 25 | capson(); 26 | for (j = 0; j < 2000; ++j); 27 | capsoff(); 28 | for (j = 0; j < 2000; ++j); 29 | } 30 | } -------------------------------------------------------------------------------- /examples/sgn.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | VOID plot(x, y, ch) 6 | int x, y, ch; 7 | { 8 | printf("\33Y%c%c%c\n", y+32, x+32, ch); 9 | } 10 | 11 | VOID main() 12 | { 13 | int x, y, c; 14 | 15 | srnd(); 16 | puts("\33x5\f"); 17 | 18 | for (c = 'A'; c <= 'Z'; ++c) { 19 | x = rnd(40); 20 | y = rnd(22); 21 | do { 22 | plot(x, y, ' '); 23 | x += sgn(20 - x); 24 | y += sgn(10 - y); 25 | plot(x, y, c); 26 | } while (x != 20 || y != 10); 27 | } 28 | } -------------------------------------------------------------------------------- /examples/ldirmv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define T32CGP *((int *)0xf3c1) 6 | 7 | VOID main() 8 | { 9 | char data[8]; 10 | int i, j; 11 | 12 | ginit(); 13 | screen(1); 14 | ldirmv(data, T32CGP + 'A' * 8, 8); 15 | 16 | for (i = 0; i < 8; ++i) { 17 | for (j = 0; j < 8; ++j) { 18 | if ((data[i] & 0x80) == 0) 19 | putchar(' '); 20 | else 21 | putchar('A'); 22 | data[i] <<= 1; 23 | } 24 | putchar('\n'); 25 | } 26 | getch(); 27 | screen(0); 28 | } -------------------------------------------------------------------------------- /examples/palett.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int Red[14] = {1,2,3,4,5,6,7,6,5,4,3,2,1,0}; 6 | int Grn[14] = {1,0,1,2,3,4,5,6,7,6,5,4,3,2}; 7 | int Blu[14] = {3,2,1,0,1,2,3,4,5,6,7,6,5,4}; 8 | 9 | VOID main() 10 | { 11 | int i, j, k; 12 | 13 | ginit(); 14 | color(15, 1, 1); 15 | 16 | while (!kbhit()) { 17 | for (i = 0; i < 14; ++i) { 18 | palett(1, Red[i], Grn[i], Blu[i]); 19 | for (k = 0; k < 1000; ++k); 20 | } 21 | } 22 | 23 | palett(1, 0, 0, 0); 24 | } -------------------------------------------------------------------------------- /examples/filvrm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | VOID erase() 6 | { 7 | int i, j; 8 | 9 | for (i = 0; i <= 7; ++i) { 10 | for (j = i; j <= 211; j += 8) 11 | filvrm(j * 128, 128, (char)0); 12 | for (j = 0; j < 7000; ++j); 13 | } 14 | } 15 | 16 | VOID main() 17 | { 18 | int i; 19 | 20 | ginit(); 21 | srnd(); 22 | color(15, 1, 1); 23 | screen(5); 24 | for (i = 0; i <= 40; ++i) 25 | boxfil(rnd(256),rnd(212),rnd(256),rnd(212),rnd(15),0); 26 | 27 | for(i = 0; i < 30000; ++i); 28 | erase(); 29 | for(i = 0; i < 30000; ++i); 30 | screen(0); 31 | } -------------------------------------------------------------------------------- /examples/line.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | VOID main() 6 | { 7 | unsigned x1, y1, x2, y2, c, i, j; 8 | 9 | ginit(); 10 | screen(5); 11 | color(15, 1, 1); 12 | x1 = 128; 13 | y1 = 106; 14 | c = 0; 15 | i = j = 1; 16 | 17 | while(!kbhit()) { 18 | x2 = 256 - x1; 19 | y2 = 212 - y1; 20 | line(x1, y1, x2, y1, c, 3); 21 | line(x1, y2, x2, y2, c, 3); 22 | line(x1, y1, x1, y2, c, 3); 23 | line(x2, y1, x2, y2, c, 3); 24 | if ((x1 += i) == 6 || x1 == 250) i = -i; 25 | if ((y1 += j) == 2 || y1 == 210) j = -j; 26 | if (++c == 16) c = 0; 27 | } 28 | 29 | screen(0); 30 | } -------------------------------------------------------------------------------- /examples/vpeek.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define SCRMOD *((char *)0xfcaf) 5 | #define LINLEN *((char *)0xf3b0) 6 | #define TXTNAM *((unsigned *)0xf3b3) 7 | #define T32NAM *((unsigned *)0xf3bd) 8 | 9 | VOID main() 10 | { 11 | unsigned i, a1, a2, adtop, len; 12 | char ch1, ch2; 13 | 14 | ginit(); 15 | if (SCRMOD == 0) { 16 | adtop = TXTNAM; 17 | len = (LINLEN > 40)? 80: 40; 18 | } 19 | else { 20 | adtop = T32NAM; 21 | len = 32; 22 | } 23 | for (i = 0; i < 24; ++i) { 24 | a1 = adtop + len * i; 25 | a2 = a1 + len -1; 26 | do { 27 | ch1 = vpeek(a1); 28 | ch2 = vpeek(a2); 29 | vpoke(a1, ch2); 30 | vpoke(a2, ch1); 31 | } while (++a1 < --a2); 32 | } 33 | } -------------------------------------------------------------------------------- /examples/putspr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char Ptspr[32] = { 6 | 0x07, 0x1f, 0x37, 0x7f, 0x8f, 0xdf, 0xdf, 0xdf, 7 | 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x1f, 0x07, 8 | 0xe0, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 9 | 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xf8, 0xe0 10 | }; 11 | 12 | VOID main() 13 | { 14 | int x, y, dx, dy, i; 15 | 16 | color(15, 1, 1); 17 | screen(2); 18 | inispr(2); 19 | sprite(0, Ptspr); 20 | 21 | for(x=0, y=4, dx=3, dy=0; y<175 || dy; ++dy) { 22 | putspr(0, x, y, y, 0); 23 | putspr(1, 240-x, y, 8, 0); 24 | if ((x += dx) == 240 || x == 0) dx = -dx; 25 | if ((y += dy) == 175) dy = -dy; 26 | for (i = 0; i < 1000; ++i); 27 | } 28 | 29 | screen(0); 30 | } -------------------------------------------------------------------------------- /examples/ldirvm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define T32CGP (*(unsigned *)0xf3c1) 6 | 7 | char data[10][8] = { 8 | { 0x00, 0x00, 0x00, 0xf0, 0x90, 0x90, 0xf0, 0x00 }, 9 | { 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 }, 10 | { 0xf8, 0x08, 0x08, 0xf8, 0x80, 0x80, 0xf8, 0x00 }, 11 | { 0xf8, 0x88, 0x08, 0xf8, 0x08, 0x88, 0xf8, 0x00 }, 12 | { 0x90, 0x90, 0x90, 0x90, 0xf8, 0x10, 0x10, 0x00 }, 13 | { 0xf0, 0x80, 0x80, 0xf8, 0x08, 0x08, 0xf8, 0x00 }, 14 | { 0x80, 0x80, 0x80, 0xf0, 0x88, 0x88, 0xf8, 0x00 }, 15 | { 0xf8, 0x88, 0x10, 0x10, 0x20, 0x20, 0x20, 0x00 }, 16 | { 0xf8, 0x88, 0x88, 0xf8, 0x88, 0x88, 0xf8, 0x00 }, 17 | { 0xf8, 0x88, 0x88, 0xf8, 0x08, 0x08, 0x08, 0x00 }, 18 | }; 19 | 20 | VOID main() 21 | { 22 | int i; 23 | ginit(); 24 | screen(1); 25 | puts("\f0123456789\n"); 26 | getch(); 27 | ldirvm(T32CGP + '0' * 8, data, 80); 28 | getch(); 29 | screen(0); 30 | } -------------------------------------------------------------------------------- /examples/vpoke.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define T32NAM *((int *)0xf3bd) 6 | 7 | VOID fill(ch) 8 | char ch; 9 | { 10 | int i, j, k; 11 | int ad = T32NAM - 1; 12 | int x = 32; 13 | int y = 23; 14 | 15 | for (i = 0; i <= 11; ++i) { 16 | for (j = 0; j < x; ++j) { 17 | vpoke(++ad, ch); 18 | for (k = 0; k < 1000; ++k); 19 | } 20 | --x; 21 | for (j = 0; j < y; ++j) { 22 | vpoke(ad += 32, ch); 23 | for (k = 0; k < 1000; ++k); 24 | } 25 | --y; 26 | for (j = 0; j < x; ++j) { 27 | vpoke(--ad, ch); 28 | for (k = 0; k < 1000; ++k); 29 | } 30 | --x; 31 | for (j = 0; j < y; ++j) { 32 | vpoke(ad -= 32, ch); 33 | for (k = 0; k < 1000; ++k); 34 | } 35 | --y; 36 | } 37 | } 38 | 39 | VOID main() 40 | { 41 | int i; 42 | ginit(); 43 | color(15, 0, 0); 44 | screen(1); 45 | fill('?'); 46 | fill(' '); 47 | screen(0); 48 | } -------------------------------------------------------------------------------- /examples/gtpad.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char Spr[8] = { 6 | 0xfc, 0xf0, 0xf8, 0xfc, 0xbe, 0x9f, 0x0e, 0x04 7 | }; 8 | 9 | char Col[8] = { 10 | 40, 40, 40, 40, 40, 40, 40, 40 11 | }; 12 | 13 | int Cx = 128; 14 | int Cy = 106; 15 | 16 | VOID mouse() 17 | { 18 | gtpad(12); 19 | Cx += gtpad(13); 20 | Cy += gtpad(14); 21 | if (Cx < 8) Cx = 8; 22 | if (Cx > 240) Cx = 240; 23 | if (Cy < 8) Cy = 8; 24 | if (Cy > 200) Cy = 200; 25 | putspr(0, Cx + 1, Cy, 0, 0); 26 | } 27 | 28 | VOID draw() 29 | { 30 | int x, y; 31 | 32 | do { 33 | x = Cx; 34 | y = Cy; 35 | mouse(); 36 | if (gttrig(1)) 37 | line(Cx, Cy, x, y, 15, 0); 38 | if (gttrig(3)) 39 | filvrm(0, 0x6a00, 0); 40 | } while ((snsmat(7) & 0x80) != 0); 41 | } 42 | 43 | VOID main() 44 | { 45 | ginit(); 46 | color(15, 1, 1); 47 | screen(5); 48 | inispr(0); 49 | sprite(0, Spr); 50 | colspr(0, Col); 51 | draw(); 52 | screen(0); 53 | kilbuf(); 54 | } -------------------------------------------------------------------------------- /examples/gtstck.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char ptspr0[32] = { 5 | 0x00, 0x03, 0x03, 0x13, 0x13, 0x16, 0x14, 0x3d, 6 | 0x3c, 0x35, 0x75, 0x75, 0x7c, 0x7e, 0x77, 0x33, 7 | 0x80, 0xc0, 0xc0, 0xc8, 0xc8, 0x68, 0x28, 0x3c, 8 | 0x3c, 0x2c, 0x2e, 0x2e, 0x3e, 0x7e, 0xee, 0xcc 9 | }; 10 | 11 | int Ytrns[9] = { 0, -64, -45, 0, 45, 64, 45, 0, -45}; 12 | int Xtrns[9] = { 0, 0, 45, 64, 45, 0, -45, -64, -45}; 13 | 14 | VOID move() 15 | { 16 | static int x = 120 * 64; 17 | static int y = 120 * 64; 18 | int i; 19 | 20 | i = gtstck(0) | gtstck(1); 21 | x += Xtrns[i]; 22 | if (x >= 225 * 64) 23 | x = 224 * 64; 24 | else if (x < 16 *64) 25 | x = 16 * 64; 26 | 27 | y += Ytrns[i]; 28 | if (y >= 165 * 64) 29 | y = 164 * 64; 30 | else if (y < 28 * 64) 31 | y = 28 * 64; 32 | 33 | putspr(0, x/64, y/64, 15, 0); 34 | } 35 | 36 | VOID main() 37 | { 38 | int i; 39 | 40 | color(15, 1, 1); 41 | screen(1); 42 | inispr(2); 43 | sprite(0, ptspr0); 44 | while((snsmat(7) & 0x80) != 0) { 45 | move(); 46 | for (i = 0; i < 500; ++i); 47 | } 48 | color(15, 0, 0); 49 | screen(0); 50 | kilbuf(); 51 | } 52 | -------------------------------------------------------------------------------- /examples/cpym2v.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char Ptn[4+13*19] = { 13, 0, 10, 0, 6 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 7 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 8 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 9 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 10 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 11 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 12 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 13 | 0, 0, 0,11,11, 8, 8, 8,11,11, 0, 0, 0, 14 | 0, 4, 4, 4,11,11,11,11,11, 4, 4, 4, 0, 15 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 16 | 4, 4, 4, 4, 4, 4,11, 4, 4, 4, 4, 4, 4, 17 | 11,11, 4, 4, 4, 4, 4, 4, 4, 4, 4,11,11, 18 | 11,11, 4,11, 4,11,11,11, 4,11, 4,11,11, 19 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 20 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 21 | 0, 8, 8, 0,11,11, 0,11,11, 0, 8, 8, 0, 22 | 8, 8, 8, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8, 23 | 8, 8, 8, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8 24 | }; 25 | 26 | VOID main() 27 | { 28 | int i; 29 | 30 | ginit(); 31 | srnd(); 32 | color(15, 1, 1); 33 | screen(5); 34 | 35 | while(!kbhit()) { 36 | cpym2v(Ptn, 0, 37 | rnd(250), rnd(195), 0, 8); 38 | for (i = 0; i < 4000; ++i); 39 | } 40 | screen(0); 41 | } -------------------------------------------------------------------------------- /examples/snsmat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char Ptspr0[32] = { 5 | 0x0f,0x3f,0x63,0x41,0x41,0x41,0x63,0x7f, 6 | 0x4f,0x1e,0x01,0x07,0x00,0x00,0x00,0x00, 7 | 0xc0,0xe0,0xf0,0xf0,0xf8,0xf8,0x78,0x78, 8 | 0x78,0xf0,0xf3,0xf4,0xf6,0x6e,0x3e,0x1c 9 | }; 10 | 11 | char Ptspr1[32] = { 12 | 0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00, 13 | 0x00,0x00,0x00,0x00,0x07,0x07,0x03,0x01, 14 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 15 | 0x00,0x00,0x00,0x00,0x00,0x80,0xc0,0xe0 16 | }; 17 | 18 | char Ptspr2[32] = { 19 | 0x00,0x00,0x00,0x00,0x0f,0x3f,0x7f,0xff, 20 | 0xfc,0xff,0xf7,0xfb,0xfb,0x7b,0x77,0x3f, 21 | 0x00,0x00,0x00,0x00,0x80,0xe0,0xf8,0xfc, 22 | 0x7c,0xbe,0xde,0xde,0xde,0x53,0x53,0xbc 23 | }; 24 | 25 | TINY stop() 26 | { 27 | static TINY old_s = 0; 28 | TINY s, r; 29 | 30 | s = ((snsmat(7) & 0x10) == 0); 31 | r = (s && !old_s); 32 | old_s = s; 33 | return r; 34 | } 35 | 36 | VOID main() 37 | { 38 | char x = 0; 39 | int i; 40 | color(15, 1, 1); 41 | screen(1); 42 | inispr(2); 43 | sprite(0, Ptspr0); 44 | sprite(4, Ptspr1); 45 | sprite(8, Ptspr2); 46 | 47 | while ((snsmat(7) & 0x80) != 0) { 48 | if (stop()) { 49 | putspr(0, x, 150, 4, 8); 50 | putspr(1, x, 216, 0, 0); 51 | while (!stop()); 52 | } 53 | x -= 2; 54 | putspr(0, x, 150, 4, 0); 55 | putspr(1, x, 150, 15, 4); 56 | for (i = 0; i < 2000; ++i); 57 | } 58 | screen(0); 59 | } -------------------------------------------------------------------------------- /examples/cpyv2v.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char Ptn[4+13*20] = { 13, 0, 20, 0, 6 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 8 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 9 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 10 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 11 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 12 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 13 | 0, 0, 4, 4, 4, 4, 4, 4, 4,15, 4, 0, 0, 14 | 0, 0, 0,11,11, 8, 8, 8,11,11, 0, 0, 0, 15 | 0, 4, 4, 4,11,11,11,11,11, 4, 4, 4, 0, 16 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 17 | 4, 4, 4, 4, 4, 4,11, 4, 4, 4, 4, 4, 4, 18 | 11,11, 4, 4, 4, 4, 4, 4, 4, 4, 4,11,11, 19 | 11,11, 4,11, 4,11,11,11, 4,11, 4,11,11, 20 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 21 | 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 22 | 0, 8, 8, 0,11,11, 0,11,11, 0, 8, 8, 0, 23 | 8, 8, 8, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8, 24 | 8, 8, 8, 8, 8, 8, 0, 8, 8, 8, 8, 8, 8 25 | }; 26 | 27 | VOID main() 28 | { 29 | int i, j; 30 | 31 | ginit(); 32 | color(15, 1, 1); 33 | screen(5); 34 | cpym2v(Ptn, 0, 10, 10, 1, 0); 35 | 36 | while (!kbhit()) { 37 | for (j = 0; j < 30000; ++j); 38 | cpyv2v(10, 10, 22, 29, 1, 100, 100, 0, 0); 39 | for (j = 0; j < 20000; ++j); 40 | for (i = 101; i <= 108; ++i) { 41 | cpyv2v(10, 10, 22, 18, 1, 100, i, 0, 0); 42 | for (j = 0; j < 2000; ++j); 43 | } 44 | } 45 | screen(0); 46 | } -------------------------------------------------------------------------------- /examples/gttrig.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char Ypos[5]; 5 | 6 | char Ptspr0[32] = { 7 | 0x01, 0x13, 0x13, 0x37, 0x37, 0x76, 0x74, 0x64, 8 | 0xfc, 0xf4, 0xb4, 0xb4, 0xbe, 0xf7, 0xf7, 0x63, 9 | 0x80, 0xc8, 0xc8, 0xec, 0xec, 0x6e, 0x2e, 0xaa, 10 | 0xbf, 0xaf, 0x2d, 0xad, 0x7d, 0xef, 0xef, 0xc6 11 | }; 12 | 13 | char Ptspr1[32] = { 14 | 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x02, 15 | 0x01, 0x02, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 16 | 0x80, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 17 | 0x00, 0xc0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80 18 | }; 19 | 20 | VOID beam() 21 | { 22 | int i; 23 | for (i = 0; i <= 4; ++i) { 24 | if (Ypos[i] != 255) { 25 | Ypos[i] -= 2; 26 | if (Ypos[i] < 212) 27 | putspr(i, 120, Ypos[i]-15, 10, 4); 28 | else { 29 | Ypos[i] = 255; 30 | putspr(i, 0, 217, 0, 0); 31 | } 32 | } 33 | } 34 | } 35 | 36 | VOID shot() 37 | { 38 | int i; 39 | static int wait = 0; 40 | if ((gttrig(0) | gttrig(1)) == 0) { 41 | wait -= 4; 42 | if (wait < 0) 43 | wait = 0; 44 | } else { 45 | --wait; 46 | if (wait <= 0) { 47 | for (i = 0; i <= 4; i++) { 48 | if (Ypos[i] == 255) { 49 | Ypos[i] = 182; 50 | break; 51 | } 52 | } 53 | } 54 | } 55 | } 56 | 57 | VOID main() 58 | { 59 | int i; 60 | 61 | color(15, 1, 1); 62 | screen(2); 63 | inispr(2); 64 | sprite(0, Ptspr0); 65 | sprite(1, Ptspr1); 66 | putspr(5, 120, 170, 15, 0); 67 | for (i = 0; i <= 4; ++i) { 68 | Ypos[i] = 255; 69 | } 70 | 71 | while ((snsmat(7) & 0x80) != 0) { 72 | shot(); 73 | beam(); 74 | for (i = 0; i < 150; ++i); 75 | } 76 | 77 | screen(0); 78 | kilbuf(); 79 | } -------------------------------------------------------------------------------- /examples/colspr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char Ptspr0[32] = { 6 | 0x04, 0x72, 0xfa, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 7 | 0x72, 0x1a, 0x36, 0x76, 0x7e, 0x7c, 0xd8, 0x80, 8 | 0x40, 0x9c, 0xbe, 0x7e, 0xfe, 0xfe, 0xfe, 0xfe, 9 | 0x9c, 0xb0, 0xd8, 0xdc, 0xfc, 0x7c, 0x36, 0x02 10 | }; 11 | 12 | char Ptspr1[32] = { 13 | 0x00, 0x00, 0x20, 0x01, 0x43, 0x01, 0x01, 0x41, 14 | 0x0d, 0x05, 0x09, 0x28, 0x00, 0x10, 0x00, 0x00, 15 | 0x00, 0x00, 0x08, 0x00, 0x84, 0x00, 0x00, 0x04, 16 | 0x60, 0x40, 0x20, 0x28, 0x00, 0x10, 0x00, 0x00 17 | }; 18 | 19 | char Clspr0[16] = { 20 | 1, 1, 1, 1, 1, 1, 1, 1, 21 | 1, 1, 1, 1, 1, 1, 1, 8 22 | }; 23 | 24 | char Clspr1[16] = { 25 | 12+64,12+64,12+64,12+64,12+64, 6+64, 6+64,12+64, 26 | 12+64,12+64,12+64,12+64,12+64,12+64,12+64,12+64 27 | }; 28 | 29 | int Xpos[12], Ypos[12]; 30 | 31 | VOID move() 32 | { 33 | int i, x, y; 34 | 35 | for (i = 0; i < 12; ++i) { 36 | x = Xpos[i] + rnd(3) - 1; 37 | y = Ypos[i] + rnd(3) - 1; 38 | if (x < 0) x = 0; 39 | if (x > 240) x = 240; 40 | if (y < -1) y = -1; 41 | if (y > 195) y = 195; 42 | putspr(i * 2, x, y, 0, 0); 43 | putspr(i * 2 + 1, x, y, 0, 4); 44 | Xpos[i] = x; 45 | Ypos[i] = y; 46 | } 47 | } 48 | 49 | VOID main() 50 | { 51 | int i; 52 | 53 | srnd(); 54 | ginit(); 55 | color(15, 10, 10); 56 | palett(13, 4, 7, 5); 57 | screen(5); 58 | inispr(2); 59 | sprite(0, Ptspr0); 60 | sprite(4, Ptspr1); 61 | 62 | for (i = 0; i < 12; ++i) { 63 | Xpos[i] = rnd(120) + 60; 64 | Ypos[i] = rnd(120) + 38; 65 | colspr(i * 2, Clspr0); 66 | colspr(i * 2 + 1, Clspr1); 67 | } 68 | 69 | while (!kbhit()) { 70 | move() 71 | for (i = 0; i < 400; ++i); 72 | } 73 | 74 | color(15, 1, 1); 75 | palett(13, 6, 2, 5); 76 | screen(0); 77 | } 78 | -------------------------------------------------------------------------------- /games/egypt/Egypt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma nonrec 3 | 4 | #define NCAMP 10 5 | 6 | #define RKEY '\x1C' 7 | #define LKEY '\x1D' 8 | #define UKEY '\x1E' 9 | #define DKEY '\x1F' 10 | 11 | VOID locate(x, y) 12 | int x, y; 13 | { 14 | printf("\33Y%c%c", y+32, x+32); 15 | } 16 | 17 | VOID plot(p, h, c) 18 | int p, h, c; 19 | { 20 | locate(4 + p * 2, 5 + h); 21 | printf("%c\b", c); 22 | } 23 | 24 | int across() 25 | { 26 | int p, q, f, step; 27 | int s[NCAMP]; 28 | 29 | for (p = 0; p < NCAMP; ++p) 30 | s[p] = 0; 31 | 32 | for (p = -1, step = 0; ;) { 33 | 34 | locate(7, 0); 35 | printf("Step: %d", step); 36 | 37 | if (p == -1) 38 | f = 5; 39 | 40 | plot(p, -1, '0' + f); 41 | plot(p, 0, '@'); 42 | 43 | if (p == NCAMP) 44 | return step; 45 | 46 | if (p >= 0 && f + s[p] == 0) 47 | return -step; 48 | 49 | q = p; 50 | 51 | /* fflush(stdout); */ 52 | 53 | switch (getch()) { 54 | 55 | case LKEY: 56 | if (p >= 0 && f > 0) { 57 | --p; 58 | --f; 59 | ++step; 60 | } 61 | break; 62 | 63 | case RKEY: 64 | if (f > 0) { 65 | ++p; 66 | --f; 67 | ++step; 68 | } 69 | break; 70 | 71 | case UKEY: 72 | if (p >= 0 && s[p] > 0 && f < 5) { 73 | ++f; 74 | plot(p, s[p]--, ' '); 75 | } 76 | break; 77 | 78 | case DKEY: 79 | if (p >= 0 && s[p] <4 && f > 0) { 80 | --f; 81 | plot(p, ++s[p], '*'); 82 | } 83 | break; 84 | } 85 | 86 | if (q != p) { 87 | plot(q, -1, ' '); 88 | plot(q, 0, (q<0)? 'A': (q==NCAMP)? 'B': '-'); 89 | } 90 | } 91 | } 92 | 93 | VOID main() 94 | { 95 | int i, score; 96 | 97 | printf("\f\33x5"); 98 | 99 | plot(-1, 0, 'A'); 100 | for (i = 0; i < NCAMP; ++i) 101 | plot(i, 0, '-'); 102 | plot(NCAMP, 0, 'B'); 103 | 104 | score = across(); 105 | 106 | locate(0, 18); 107 | if (score < 0) { 108 | printf("Sorry...\n"); 109 | printf("You died after %d step moves.\n",-score); 110 | } 111 | else { 112 | printf("Congratulations!\n"); 113 | printf("You completed your mission in %d steps.\n", score); 114 | } 115 | } 116 |  -------------------------------------------------------------------------------- /games/hip_man/hipscore.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #pragma nonrec 5 | 6 | #define MAXNUM 10 7 | 8 | struct score { 9 | int ext; 10 | int sco; 11 | char nam[12]; 12 | }; 13 | 14 | struct score Hiscore[MAXNUM + 1]; 15 | static char ScoreFile[] = "hipman.sco"; 16 | extern unsigned Score; 17 | 18 | static int cmp(p1, p2) 19 | struct score *p1, *p2; 20 | { 21 | int d; 22 | 23 | d = (p2->sco) - (p1->sco); 24 | if (d == 0) 25 | d = (p1->ext) - (p2->ext); 26 | return d; 27 | } 28 | 29 | static char *yourname() 30 | { 31 | static char name[12]; 32 | int i; 33 | char c; 34 | 35 | screen(1); 36 | kilbuf(); printf("Input your name:"); 37 | 38 | for (i = 0; ;) { 39 | /* fflush(stdout); */ 40 | c = getch(); 41 | if (c == '\r') { 42 | if (i > 0) { 43 | name[i] = '\0'; 44 | return name; 45 | } 46 | } 47 | else if (c == '\b') { 48 | if (i > 0) { 49 | --i; 50 | printf("\b \b"); 51 | } 52 | } 53 | else if (c > ' ') { 54 | if (i < 11) { 55 | name[i++] = c; 56 | putchar(c); 57 | } 58 | } 59 | } 60 | } 61 | 62 | VOID highscore() 63 | { 64 | int i, n; 65 | char name[20]; 66 | unsigned sc; 67 | FILE *fp; 68 | 69 | Hiscore[0].ext = 0; 70 | Hiscore[0].sco = Score; 71 | strcpy(Hiscore[0].nam, yourname()); 72 | 73 | i = 0; 74 | if ((fp = fopen(ScoreFile, "r")) != NULL) { 75 | while (i < MAXNUM && fscanf(fp, "%d %s", &sc, name) != -1) { 76 | ++i; 77 | Hiscore[i].ext = i; 78 | Hiscore[i].sco = sc; 79 | strcpy(Hiscore[i].nam, name); 80 | } 81 | fclose(fp); 82 | } 83 | n = i; 84 | 85 | qsort(Hiscore, n+1, sizeof(struct score), cmp); 86 | if (n < MAXNUM) 87 | ++n; 88 | 89 | printf("\n\nRank Score Name\n"); 90 | for (i = 0; i < n; ++i) 91 | printf("%2d) %6d %s\n", i+1, Hiscore[i].sco, Hiscore[i].nam); 92 | 93 | if ((fp = fopen(ScoreFile, "w")) == NULL) 94 | puts("\nCan't make score file.\n"); 95 | else { 96 | for (i = 0; i < n; ++i) 97 | fprintf(fp, "%d %s\n", Hiscore[i].sco, Hiscore[i].nam); 98 | fclose(fp); 99 | } 100 | } 101 |  -------------------------------------------------------------------------------- /games/hip_man/hipenemy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hipman.h" 5 | #pragma nonrec 6 | 7 | extern TINY Maze[23][25]; 8 | extern int Hx; 9 | extern int Hy; 10 | extern int Ecl[5]; 11 | extern struct enemy E[3]; 12 | 13 | static VOID rndmvenemy(ep) 14 | struct enemy *ep; 15 | { 16 | static int movex[7] = { 0, 1, 0, -1, 0, 1, 0 }; 17 | static int movey[7] = { -1, 0, 1, 0, -1, 0, 1 }; 18 | int tx, ty, i, count; 19 | 20 | for (count = 0, i = rnd(4); count < 4; ++count, ++i) { 21 | tx = movex[i]; 22 | ty = movey[i]; 23 | if (Maze[ep->y + ty][ep->x + tx] != WALL 24 | && (ep->tx != -tx || ep->ty != -ty)) { 25 | ep->tx = tx; 26 | ep->ty = ty; 27 | return; 28 | } 29 | } 30 | ep->tx = 0; 31 | ep->ty = 0; 32 | } 33 | 34 | static TINY chasex(ep) 35 | struct enemy *ep; 36 | { 37 | int tx; 38 | 39 | tx = sgn(Hx - ep->x); 40 | 41 | if (tx == 0) 42 | return 0; 43 | 44 | if (tx == -(ep->tx)) 45 | return 0; 46 | 47 | if (Maze[ep->y][ep->x + tx] == WALL) 48 | return 0; 49 | 50 | ep->tx = tx; 51 | ep->ty = 0; 52 | return 1; 53 | } 54 | 55 | static TINY chasey(ep) 56 | struct enemy *ep; 57 | { 58 | int ty; 59 | 60 | ty = sgn(Hy - ep->y); 61 | 62 | if (ty == 0) 63 | return 0; 64 | 65 | if (ty == -(ep->y)) 66 | return 0; 67 | 68 | if (Maze[ep->y + ty][ep->x] == WALL) 69 | return 0; 70 | 71 | ep->tx = 0; 72 | ep->ty = ty; 73 | return 1; 74 | } 75 | 76 | static VOID refresh(ep) 77 | struct enemy *ep; 78 | { 79 | ep->tx = 0; 80 | ep->ty = 0; 81 | ep->st = (ep - &E[0]); 82 | } 83 | 84 | static VOID red(ep) 85 | struct enemy *ep; 86 | { 87 | if (!chasex(ep) && !chasey(ep)) 88 | rndmvenemy(ep); 89 | } 90 | 91 | static VOID pink(ep) 92 | struct enemy *ep; 93 | { 94 | if (!chasey(ep) && !chasex(ep)) 95 | rndmvenemy(ep); 96 | } 97 | 98 | static VOID green(ep) 99 | struct enemy *ep; 100 | { 101 | rndmvenemy(ep); 102 | } 103 | 104 | static VOID weaking(ep) 105 | struct enemy *ep; 106 | { 107 | if (--(ep->wt) == 0) 108 | refresh(ep); 109 | else 110 | rndmvenemy(ep); 111 | } 112 | 113 | static VOID fainting(ep) 114 | struct enemy *ep; 115 | { 116 | if (--(ep->wt) == 0) 117 | refresh(ep); 118 | } 119 | 120 | VOID putenemy(ep) 121 | struct enemy *ep; 122 | { 123 | int col, i; 124 | 125 | i= ep - &E[0]; 126 | 127 | if ((ep->wt & 1) != 0 || ep->wt >= 10) 128 | col = Ecl[ep->st]; 129 | else 130 | col = Ecl[i]; 131 | putspr(i+1, (ep->x) * 8, (ep->y) * 8, col, 0); 132 | } 133 | 134 | VOID mvenemy() 135 | { 136 | static VOID (*adr[5])() = {red,pink,green,weaking,fainting}; 137 | struct enemy *ep; 138 | 139 | for (ep = &E[0]; ep <= &E[2]; ++ep) { 140 | (*adr[ep->st])(ep); 141 | ep->x += ep->tx; 142 | ep->y += ep->ty; 143 | putenemy(ep); 144 | } 145 | } 146 |  -------------------------------------------------------------------------------- /games/hip_man/hipinit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hipman.h" 5 | #pragma nonrec 6 | #define T32NAM *((int *)0xf3bd) 7 | #define T32COL *((int *)0xf3bf) 8 | #define T32CGP *((int *)0xf3c1) 9 | 10 | extern TINY Maze[23][25]; 11 | extern int Dot; 12 | 13 | static char Font[48] = { 14 | 0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 15 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 16 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 17 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 18 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 19 | 0x50, 0xe0, 0xe0, 0x40, 0x00, 0x00, 0x00, 0x00 }; 20 | 21 | static char Spr[32] = { 22 | 0x00, 0x00, 0x03, 0x0f, 0x1f, 0x33, 0x27, 0x7f, 23 | 0x4f, 0x4f, 0x4f, 0x4f, 0x27, 0x3f, 0x1e, 0x00, 24 | 0x00, 0x00, 0xe0, 0xf8, 0xfc, 0xfe, 0xfe, 0xff, 25 | 0xff, 0xff, 0xff, 0xff, 0x7e, 0x7e, 0x3c, 0x00 }; 26 | 27 | static char Ptnmaze[23][26] = { 28 | "deeeeefdeeeeeeeeefdeeeeef", 29 | "fhhhhiffhhhhhhhhhffihhhhf", 30 | "fhdefhffhdeeeeefhffhdefhf", 31 | "fheeghegheef deghegheeghf", 32 | "fhhhhhhhhhhf fhhhhhhhhhhf", 33 | "eefhdeeeefhf fhdeeeefhdeg", 34 | "degheeeeegheegheeeeegheef", 35 | "fhhhhhhhhhhhhhhhhhhhhhhhf", 36 | "fhdfhdfhdeefhdeefhdfhdfhf", 37 | "fhffhffhfdegheeffhffhffhf", 38 | "fhffhffhffhhhhhffhffhffhf", 39 | "fhffhegheghdefhegheghffhf", 40 | "fhffhhhhhhhf fhhhhhhhffhf", 41 | "fhfeefhdfhdg efhdfhdegfhf", 42 | "fheeeghegheeeeghegheeeghf", 43 | "fhhhhhhhhhhh hhhhhhhhhhhf", 44 | "eeefhdeeefhdefhdeeefhdeeg", 45 | "deeghfdeeghf fheeeffheeef", 46 | "fhhhhffihhhf fhhhiffhhhhf", 47 | "fhdfhffhdeeg eeefhffhdfhf", 48 | "fheghegheeeeeeeeghegheghf", 49 | "fhhhhhhhhhhhhhhhhhhhhhhhf", 50 | "eeeeeeeeeeeeeeeeeeeeeeeeg" }; 51 | 52 | VOID drawmaze() 53 | { 54 | int i, j; 55 | TINY m; 56 | 57 | for (j = 0; j < 23; ++j) 58 | ldirvm(T32NAM + (j + 1) * 32 + 1, Ptnmaze[j], 25); 59 | 60 | Dot = 0; 61 | for (j = 0; j < 23; ++j) { 62 | for (i = 0; i < 25; ++i) { 63 | switch (Ptnmaze[j][i]) { 64 | case ' ': m = SPACE; break; 65 | case 'd': 66 | case 'e': 67 | case 'f': 68 | case 'g': m = WALL; break; 69 | case 'h': m = DOT; ++Dot; break; 70 | case 'i': m = CHIP; ++Dot; break; 71 | } 72 | Maze[j][i] = m; 73 | } 74 | } 75 | } 76 | 77 | VOID init() 78 | { 79 | color(15, 1, 1); 80 | screen(1); 81 | ldirvm(T32CGP + 100 * 8, Font, 48); 82 | vpoke(T32COL + 12, 0x41); 83 | vpoke(T32COL + 13, 0xb1); 84 | ldirvm(T32NAM + 26 + 1 * 32, "+---+", 5); 85 | ldirvm(T32NAM + 26 + 2 * 32, "+HIP+", 5); 86 | ldirvm(T32NAM + 26 + 3 * 32, "+MAN+", 5); 87 | ldirvm(T32NAM + 26 + 4 * 32, "+---+", 5); 88 | ldirvm(T32NAM + 26 + 7 * 32, "SCORE", 5); 89 | ldirvm(T32NAM + 26 + 13 * 32, "REST", 4); 90 | ldirvm(T32NAM + 26 + 19 * 32, "STAGE", 5); 91 | drawmaze(); 92 | inispr(2); 93 | sprite(0, Spr); 94 | } 95 | 96 | 97 |  -------------------------------------------------------------------------------- /lib/msxclib.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | VOID _dmy1_() { } 5 | 6 | VOID screen(md) 7 | int md; 8 | { 9 | struct regs r; 10 | 11 | r.a = (char)md; 12 | calbio(0x005f, &r); 13 | } 14 | 15 | VOID color(fg, bg, bd) 16 | int fg, bg, bd; 17 | { 18 | struct regs r; 19 | 20 | *((char *)0xf3e9) = (char)fg; 21 | *((char *)0xf3ea) = (char)bg; 22 | *((char *)0xf3eb) = (char)bd; 23 | calbio(0x0062, &r); 24 | } 25 | 26 | VOID inispr(sz) 27 | int sz; 28 | { 29 | struct regs r; 30 | 31 | r.bc = (int)((*((char *)0xf3e0) & 0xfc) | sz) * 256 + 1; 32 | calbio(0x0047, &r); 33 | if (*((char *)0xfaf8) != 0){ 34 | r.bc = (int)(*((char *)0xffe7) & 0xfd) * 256 + 8; 35 | calbio(0x0047, &r); 36 | } 37 | calbio(0x0069,&r); 38 | } 39 | 40 | VOID sprite(no,dt) 41 | int no; 42 | char *dt; 43 | { 44 | if (*((char *)0xf3e0) & 2) 45 | ldirvm(*((int *)0xf926) + no * 8, dt, 32); 46 | else 47 | ldirvm(*((int *)0xf926) + no * 8, dt, 8); 48 | } 49 | 50 | VOID putspr(pl, x, y, cl, pt) 51 | int pl, x, y, cl, pt; 52 | { 53 | char dt[4]; 54 | 55 | dt[0] = (char)y; 56 | dt[1] = (char)x; 57 | dt[2] = (char)pt; 58 | dt[3] = (char)cl; 59 | ldirvm(*((int *)0xf928) + pl * 4, dt, 4); 60 | } 61 | 62 | VOID colspr(pl, dt) 63 | int pl; 64 | char *dt; 65 | { 66 | if (*((char *)0xf3e0) & 2) 67 | ldirvm(*((int *)0xf928) - 512 + pl * 16, dt, 16); 68 | else 69 | ldirvm(*((int *)0xf928) - 512 + pl * 16, dt, 8); 70 | } 71 | 72 | TINY gtstck(no) 73 | int no; 74 | { 75 | struct regs r; 76 | 77 | r.a =(char)no; 78 | calbio(0x00d5, &r); 79 | return (r.a); 80 | } 81 | 82 | TINY gttrig(no) 83 | int no; 84 | { 85 | struct regs r; 86 | 87 | r.a =(char)no; 88 | calbio(0x00d8, &r); 89 | return (r.a != 0); 90 | } 91 | 92 | int gtpad(no) 93 | int no; 94 | { 95 | struct regs r; 96 | 97 | r.a = (char)no; 98 | calbio(0x00db, &r); 99 | if (r.a & 0x80) 100 | return (int)(r.a) - 256; 101 | else 102 | return (int)(r.a); 103 | } 104 | 105 | TINY snsmat(mt) 106 | int mt; 107 | { 108 | struct regs r; 109 | 110 | r.a = (char)mt; 111 | calbio(0x0141, &r); 112 | return (r.a); 113 | } 114 | 115 | VOID kilbuf() 116 | { 117 | struct regs r; 118 | 119 | calbio(0x0156, &r); 120 | } 121 | 122 | VOID gicini() 123 | { 124 | struct regs r; 125 | 126 | calbio(0x0090, &r); 127 | } 128 | 129 | VOID sound(rg, dt) 130 | int rg, dt; 131 | { 132 | struct regs r; 133 | 134 | r.a = (char)rg; 135 | r.de = dt; 136 | calbio(0x0093, &r); 137 | } 138 | 139 | int sgn(vl) 140 | int vl; 141 | { 142 | if (vl < 0) 143 | return -1; 144 | if (vl != 0) 145 | return 1; 146 | return 0; 147 | } 148 | 149 | VOID srnd() 150 | { 151 | extern int RNDSPD[2]; 152 | 153 | RNDSPD[1] = *((int *)0xfca2); 154 | } 155 | 156 | VOID _dmy2_() { } 157 | -------------------------------------------------------------------------------- /games/oichokabu/OICHO.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | # pragma nonrec 5 | 6 | #define LINLEN *((char *)0xf3b0) 7 | 8 | int Rank[5][3]; 9 | int Chip[5]; 10 | int Card[4][10]; 11 | int Gold; 12 | 13 | VOID locate(x, y) 14 | int x, y; 15 | { 16 | printf("\33Y%c%c", y+32, x+32); 17 | } 18 | 19 | VOID lclear() 20 | { 21 | printf("\33K"); 22 | } 23 | 24 | VOID dealcards(i,j) 25 | int i, j; 26 | { 27 | static char *rk[10] = { 28 | "10","A","2","3","4","5","6","7","8","9" }; 29 | 30 | int s, r; 31 | 32 | s = rnd(4); 33 | r = rnd(10); 34 | while (Card[s][r] == 1) { 35 | if (++s == 4) { 36 | s = 0; 37 | if (++r == 10) 38 | r = 0; 39 | } 40 | } 41 | Card[s][r] = 1; 42 | Rank[i][j] = r; 43 | 44 | locate(j * 4, (i == 0) ? 3 : 4 + i); 45 | printf("%c%s", 128 + s, rk[r]); 46 | } 47 | 48 | VOID putgold() 49 | { 50 | locate(0, 0); printf("GOLD:%3d", Gold); 51 | } 52 | 53 | VOID init() 54 | { 55 | int i, j; 56 | 57 | printf("\f\33x5"); 58 | putgold(); 59 | memset(Card, 0, sizeof(Card)); 60 | memset(Rank, 0, sizeof(Rank)); 61 | for (i = 0; i <= 4; ++i) 62 | dealcards(i, 0); 63 | } 64 | 65 | VOID bet() 66 | { 67 | int i, g; 68 | char buf[7]; 69 | 70 | for (i = 1; i <= 4; ++i) { 71 | if (Gold == 0) 72 | g = 0; 73 | else { 74 | do { 75 | locate(6, 4+i); 76 | printf("Bet how much? "); 77 | lclear(); 78 | /* fflush(stdout); */ 79 | fgets(buf, 7, stdin); 80 | locate(6, 4+i); 81 | lclear(); 82 | g = atoi(buf); 83 | } while (g < 0 || Gold < g); 84 | } 85 | locate(13, 4+i); 86 | printf("%d", g); 87 | Gold -= (Chip[i] = g); 88 | putgold(); 89 | } 90 | } 91 | 92 | VOID play() 93 | { 94 | char k; 95 | int i; 96 | 97 | for (i = 1; i <= 4; ++i) { 98 | dealcards(i, 1); 99 | if (Chip[i] == 0) 100 | continue; 101 | locate(17, 4 + i); 102 | printf("more? (y/n)"); 103 | /* fflush(stdout); */ 104 | k = getch(); 105 | if (k == 'Y' || k == 'Y') 106 | dealcards(i, 2); 107 | locate(14, 4 + i); 108 | lclear(); 109 | } 110 | } 111 | 112 | VOID judge() 113 | { 114 | int i, j; 115 | int p[5]; 116 | 117 | for (i = 0; i <=4; ++i) { 118 | j = (Rank[i][0] + Rank[i][1] + Rank[i][2]) % 10; 119 | p[i] = j; 120 | locate(18, (i == 0) ? 3 : 4 + i); 121 | printf("[%d]", j); 122 | } 123 | 124 | for (i = 1; i <=4; ++i) { 125 | if (Chip[i] == 0) 126 | continue; 127 | if (Rank[i][0] == Rank[i][1] && Rank[i][0] == Rank[i][2]) { 128 | Gold += Chip[i] * 3; 129 | locate(22, 4+i); printf("ARASHI!"); 130 | } 131 | else if (p[i] > p[0]) { 132 | Gold += Chip[i] * 2; 133 | locate(22, 4+i); printf("WIN"); 134 | } 135 | else { 136 | locate(22, 4+i); printf("LOSE"); 137 | } 138 | } 139 | putgold(); 140 | } 141 | 142 | VOID dealer() 143 | { 144 | int j, r0, r1; 145 | 146 | dealcards(0, 1); 147 | r0 = Rank[0][0]; 148 | r1 = Rank[0][1]; 149 | 150 | if ((r0==1 && r1 ==4) || (r0==4 && r1==1)) { 151 | locate(13, 3); 152 | printf("Dealer's SIPPIN"); 153 | } 154 | else if ((r0==1 && r1==9) || (r0==9 && r1==1)) { 155 | locate(13, 3); 156 | printf("Dealer's KUPPIN"); 157 | } 158 | else { 159 | j = (r0 + r1) % 10; 160 | if (j < 5 || (j < 7 && rnd(j) < 4)) 161 | dealcards(0, 2); 162 | judge(); 163 | } 164 | } 165 | 166 | VOID main() 167 | { 168 | char k; 169 | 170 | screen(1); 171 | LINLEN = 31; 172 | srnd(); 173 | Gold = 10; 174 | 175 | do { 176 | init(); 177 | bet(); 178 | play(); 179 | dealer(); 180 | if (Gold == 0) 181 | break; 182 | locate(0, 11); 183 | printf("One more game? (y/n)"); 184 | /* fflush(stdout); */ 185 | k = getch(); 186 | } while ( k!= 'N' && k != 'n'); 187 | 188 | if (Gold == 0) { 189 | locate(0, 12); 190 | printf("You lost all money.\n"); 191 | } 192 | else { 193 | locate(0,13); 194 | printf("You get %d golds.", Gold); 195 | } 196 | } 197 |  -------------------------------------------------------------------------------- /games/hip_man/hipman.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hipman.h" 5 | #pragma nonrec 6 | 7 | #define T32NAM *((int *)0xf3bd) 8 | #define ALIVE 0 9 | #define DEAD 1 10 | 11 | TINY Maze[23][25]; 12 | unsigned Stage; 13 | unsigned Dot, Rest; 14 | int Hx, Hy; 15 | int Htx, Hty; 16 | unsigned Score, Addsco; 17 | struct enemy E[3]; 18 | int Ecl[5] = { 8, 13, 3, 7, 4 }; 19 | 20 | extern VOID init(), drawmaze(); 21 | extern VOID highscore(); 22 | extern VOID putenemy(), mvenemy(); 23 | 24 | VOID putnum(x, y, n) 25 | int x, y; 26 | unsigned n; 27 | { 28 | char digit[5]; 29 | char *p; 30 | 31 | strcpy(digit, " "); 32 | p = &(digit[5]); 33 | 34 | do { 35 | *--p = (n % 10) + '0'; 36 | } while ((n /= 10) != 0); 37 | 38 | ldirvm(T32NAM + x + y * 32, digit, 5); 39 | } 40 | 41 | VOID putstr(x, y, s) 42 | int x, y; 43 | char *s; 44 | { 45 | ldirvm(T32NAM + x + y * 32, s, strlen(s)); 46 | } 47 | 48 | VOID mvplayer() 49 | { 50 | static int movex[9] = { 0, 0, 0, 1, 0, 0, 0, -1, 0}; 51 | static int movey[9] = { 0, -1, 0, 0, 0, 1, 0, 0, 0}; 52 | int i; 53 | 54 | i = (gtstck(0) | gtstck(1)); 55 | 56 | if (i != 0 && Maze[Hy + movey[i]][Hx + movex[i]] != WALL) { 57 | Htx = movex[i]; 58 | Hty = movey[i]; 59 | } 60 | 61 | switch (Maze[Hy + Hty][Hx + Htx]) { 62 | case SPACE: 63 | Hx += Htx; 64 | Hy += Hty; 65 | break; 66 | case CHIP: 67 | for (i = 0; i < 3; ++i) { 68 | if (E[i].st != FAINT) { 69 | E[i].st = WEAK; 70 | E[i].wt = 85; 71 | } 72 | } 73 | Addsco = 10; 74 | /*FALLTHROUGH*/ 75 | case DOT: 76 | --Dot; 77 | ++Score; 78 | Hx += Htx; 79 | Hy += Hty; 80 | Maze[Hy][Hx] = SPACE; 81 | vpoke(T32NAM + (Hy+1) * 32 + (Hx+1), ' '); 82 | break; 83 | } 84 | putspr(0, Hx * 8 , Hy * 8, 10, 0); 85 | } 86 | 87 | static int distance(ep) 88 | struct enemy *ep; 89 | { 90 | return abs(Hx - ep->x) + abs(Hy - ep->y); 91 | } 92 | 93 | TINY judge() 94 | { 95 | struct enemy *ep; 96 | 97 | for (ep = &E[0]; ep <= &E[2]; ++ep) { 98 | switch (ep->st) { 99 | case RED: 100 | case PINK: 101 | case GREEN: 102 | if (distance(ep) < 2) 103 | return DEAD; 104 | break; 105 | case WEAK: 106 | if (distance(ep) < 2) { 107 | ep->st = FAINT; 108 | ep->wt = 60; ep->tx = ep->ty = 0; 109 | putenemy(ep); 110 | Score += Addsco; 111 | Addsco *= 2; 112 | } 113 | break; 114 | } 115 | } 116 | return ALIVE; 117 | } 118 | 119 | VOID starting() 120 | { 121 | static int rndx[8] = { 1, 4, 7, 10, 14, 17, 20, 23 }; 122 | static int rndy[4] = { 4, 7, 10, 21 }; 123 | struct enemy *ep; 124 | 125 | srnd(); 126 | Hx = 12; 127 | Hy = 15; 128 | Htx = 0; 129 | Hty = 0; 130 | putspr(0, Hx * 8, Hy * 8, 10, 0); 131 | 132 | for (ep = &E[0]; ep <= &E[2]; ++ep) { 133 | ep->st = ep - &E[0]; 134 | ep->x = rndx[rnd(8)]; 135 | ep->y = rndy[rnd(4)]; 136 | ep->tx = 0; 137 | ep->ty = 0; 138 | ep->wt = 0; 139 | putenemy(ep); 140 | } 141 | 142 | putnum(26, 8, Score); 143 | putnum(26, 14, Rest); 144 | putnum(26, 20, Stage); 145 | putstr(6, 0, "HIT SPACE KEY!!"); 146 | while (!gttrig(0) && !gttrig(1)); 147 | putstr(6, 0, " "); 148 | } 149 | 150 | static unsigned adjustspeed() 151 | { 152 | return ((Stage > 81) ? 100 : (6580 - Stage *80)); 153 | } 154 | 155 | VOID game() 156 | { 157 | unsigned wait, i; 158 | 159 | Score = 0; 160 | Stage = 1; 161 | wait = adjustspeed(); 162 | for (Rest = 3; Rest > 0; --Rest) { 163 | starting(); 164 | for (;;) { 165 | if (Dot == 0) { 166 | ++Stage; 167 | drawmaze(); 168 | starting(); 169 | wait = adjustspeed(); 170 | } 171 | for (i = 0; i < wait; ++i); 172 | mvplayer(); 173 | if (judge() == DEAD) 174 | break; 175 | putnum(26, 8, Score); 176 | mvenemy(); 177 | if (judge() == DEAD) 178 | break; 179 | } 180 | for (i = 0; i < 50000; ++i); 181 | } 182 | } 183 | 184 | TINY replay() 185 | { 186 | char c; 187 | 188 | printf("\33Y%c%cREPLAY ? (Y/N)", 32+20, 32+7); kilbuf(); 189 | /* fflush(stdout); */ 190 | return ((c = getch()) == 'y' || c == 'y'); 191 | } 192 | 193 | VOID main() 194 | { 195 | ginit(); 196 | 197 | do { 198 | init(); 199 | game(); 200 | highscore(); 201 | } while (replay()); 202 | 203 | screen(0); 204 | } 205 |  -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # Introduction to MSX-C (second part) 2 | 3 | *Authors*: Koji Sakurada, Tetsuto Someya 4 | *ISBN*: 4-7561-0057-0 5 | *Publisher*: ASCII Publications 6 | *Publication date*: December 1990 7 | 8 | 9 | The second book (green cover) of the Introduction to MSX-C applies the matter explained in the first book to the development of games for MSX2 computers. The authors developed a simple C library to handle several aspects of the MSX hardware, and provide several simple example games. 10 | 11 | The books can be found on the [Internet Archive](https://archive.org/details/texts): 12 | * [Introduction to MSX-C (first part)](https://archive.org/details/MSX-CJoukan) 13 | * [Introduction to MSX-C (second part)](https://archive.org/details/MSX-CGekan) 14 | 15 | 16 | ## Libraries 17 | 18 | ### MSXALIB 19 | | Function | Description | 20 | | ------------ | ------------ | 21 | | VOID ginit(); | Initialize the graphic mode | 22 | | VOID calbio(unsigned ad, regs *rg); | Call bios routines with the regs struct (see below table). | 23 | | VOID vpoke(unsigned ad, char dt); | Write VRAM | 24 | | VOID vpeek(unsigned ad); | Read VRAM | 25 | | VOID ldirvm(unsigned ds, char *sr, unsigned ln); | Block transfer to VRAM from memory | 26 | | VOID ldirmv(char *ds, unsigned sr, unsigned ln); | Block transfer to memory from VRAM | 27 | | VOID filvrm(unsigned ad, unsigned ln, char dt); | Fill VRAM with value | 28 | | VOID boxfil(int x1, int y1, int x2, int y2, int cl , int lg); | Draw a filled box | 29 | | VOID line(int x1,int y1,int x2,int y2, int cl, int lg); | Draw a line | 30 | | VOID cpym2v(char *sr, int dr, int dx, int dy, int dp, int lg); | Copy RAM to VRAM | 31 | | VOID cpyv2v(int x1, int y1, int x2, int y2, int sp, in dex, int dy, int dp, int lg); | Copy VRAM to VRAM | 32 | | VOID palett(int pl, int r, int g, int b);| Change color palett | 33 | | unsigned rnd(unsigned n);| Generate random number with a max of n, n can be 1 till 65535 | 34 | 35 | Register Structure for the calbio() function. 36 | 37 | ``` 38 | struct regs { 39 | char f; 40 | char a; 41 | unsigned bc; 42 | unsigned de; 43 | unsigned hl; 44 | }; 45 | ``` 46 | 47 | ### MSXCLIB 48 | 49 | | Function | Description | 50 | | ------------ | ------------ | 51 | | VOID screen(int md); | Switches to given screenmode | 52 | | VOID color(int fg, int bg, int bd); | Changes the screencolors | 53 | | VOID inispr(int sz); | Set sprite size | 54 | | VOID sprite(int no, char *dt); | Define sprite | 55 | | VOID putspr(int no, int x, int y, int cl, int pt); | Put sprite on screen | 56 | | VOID colspr(int no, char *dt); | Define color sprite | 57 | | TINY gtstck(int no); | Returns the joystick status (0 = cursors, 1 = port 1, 2 = port 2) | 58 | | TINY gttrig(int no); | Returns current trigger status (0 = spacebar, 1 = port 1, button A, 2 = port 2, button A, 3 = port 1, button B, 4 = port 2, button B)| 59 | | int gtpad(int no); | Returns current touch pad status | 60 | | TINY snsmat(int mt); | Returns the value of the specified line from the keyboard matrix | 61 | | VOID kilbuf(); | Clear keyboard buffer | 62 | | VOID gicini(); | Initialises PSG and sets initial value for the PLAY statement | 63 | | VOID sound(int rg, int dt); | Play sound| 64 | | int sgn(n); | Sign function, n can be -32768 ~ +32767, returns -1, 0, 1. | 65 | | VOID srnd(); | Seed random number generator. | 66 | 67 | ### How to create the libraries 68 | To create the libraries the following steps are needed: 69 | 70 | 1. Copy the following files to a directory: 71 | ``` 72 | LIB/MSXALIB.MAC 73 | DOS2/AMAKE.BAT 74 | DOS2/ACHG.BAT 75 | LIB/MSXCLIB.C 76 | DOS2/CMAKE.BAT 77 | DOS2/CCHG.BAT 78 | DOS2/CC.BAT 79 | INCLUDE/MSXALIB.H 80 | INCLUDE/MSXCLIB.H 81 | ``` 82 | *If you use DOS1 use the batch files from the DOS1 directory!* 83 | 84 | 2. Copy the following files from your MSX-C disks: 85 | ``` 86 | LIB80.COM 87 | M80.COM 88 | MX.COM 89 | CF.COM 90 | CG.COM 91 | AREL.BAT 92 | CREL.BAT 93 | STUDIO.H 94 | ``` 95 | 3. Create MSXALIB.REL with 96 | ``` 97 | A>AMAKE 98 | ``` 99 | 4. Create MSXCLIB.REL with 100 | ``` 101 | A>CMAKE 102 | ``` 103 | 104 | 5. Use the CC.BAT command to compile the games/examples. 105 | 106 | 107 | **TODO**: Explain ACHG and CCHG (examples: ACHG LINE, CCHG SCREEN) 108 | 109 | 110 | ## Games 111 | The book contains 4 games which can be found in the games directory: 112 | 113 | * Egypt (p104) 114 | "Egypt" is a text-based puzzle game.Your mission is to across the desert with your vehicle "@". 115 | Your vehicle uses 1 food to move.You can load 5 foods at point "A" and deposit foods on each point. 116 | You also can reload foods where foods are already deposited. 117 | Right and left key to move.Up and down to load/deposit foods. 118 | * Oicho Kabu (p112) 119 | "Oicho Kabu" is a Japanese traditional card game. 120 | Please watch the one's digit of sum of dealt cards.If your digit is greater than COM's,you will win a bet. 121 | When the number of three your cards are same,also you will win(It is called "Arashi",a hand of Oicho Kabu). 122 | But if COM has 4 and 1(Shippin) or 9 and 1(Kuppin),you'll lose. 123 | * Tatakare Mogura, alias Mole (p122) 124 | * Hip Man (p155) 125 | Pac Man Clone 126 | 127 | ## Links 128 | * [Relearning MSX](http://www.lavandeira.net/relearning-msx/) 129 | Greate series of blog posts written by Javier Lavandeira to setup your MSX-C environment and start learning MSX-C. 130 | * [Generation MSX](http://www.generation-msx.nl) 131 | Large MSX Software database. 132 | * [MSX Resource Center](http://www.msx.org) 133 | All the MSX News you need! 134 | * [MSX-DOS2 Tools](http://www.geocities.jp/fullmsx2/u-yan/msxdos-tools.html) 135 | Japanese page explaining the usages of MSX-C/MSX-DOS Tools/MSX-S BUG2 136 | * [DownDown Game](http://fukenko.hatenablog.com/entry/2014/09/11/073327) 137 | Source code of DownDown game written in MSX-C with msxclib. 138 | -------------------------------------------------------------------------------- /lib/msxalib.mac: -------------------------------------------------------------------------------- 1 | cseg 2 | 3 | ;--- dummy --- 4 | MODULE DMY1 5 | ENDMODULE 6 | 7 | ;--- GINIT --- 8 | MODULE GINIT 9 | EXPTBL equ 0fcc1h ;slot address of BIOS ROM 10 | GINIT@:: 11 | ld hl,6 12 | ld a,(EXPTBL) 13 | call 000ch 14 | ld (RDPORT@),a 15 | ld hl,7 16 | ld a,(EXPTBL) 17 | call 000ch 18 | ei 19 | ld (WRPORT@),a 20 | ret 21 | dseg 22 | RDPORT@:: 23 | db 98h ;This initial value is for ill-behaviored 24 | WRPORT@:: 25 | db 98h ;programs 26 | cseg 27 | ENDMODULE 28 | 29 | ;--- CALBIO --- 30 | MODULE CALBIO 31 | CALSLT equ 001ch 32 | EXPTBL equ 0fcc1h ;slot address of BIOS ROM 33 | CALBIO@:: 34 | push hl 35 | pop ix 36 | push de 37 | ex de,hl 38 | ld iy,0 39 | add iy,sp 40 | di 41 | ld sp,hl 42 | pop af 43 | pop bc 44 | pop de 45 | pop hl 46 | ei 47 | ld sp,iy 48 | push iy 49 | ld iy,(EXPTBL-1) 50 | call CALSLT 51 | pop iy 52 | exx 53 | pop hl 54 | ld bc,8 55 | add hl,bc 56 | di 57 | ld sp,hl 58 | exx 59 | push hl 60 | push de 61 | push bc 62 | push af 63 | ei 64 | ld sp,iy 65 | pop af 66 | ret 67 | ENDMODULE 68 | 69 | ;--- SETADR --- 70 | ;low level routine for SETRD and SETWRT 71 | ;entry HL..read/write address 72 | MODULE SETADR 73 | ACPAGE equ 0faf6h 74 | EXBRSA equ 0faf8h 75 | SCRMOD equ 0fcafh 76 | SETADR:: 77 | ld c,a 78 | inc c 79 | ld a,(EXBRSA) 80 | or a ;MSX1? 81 | jr z,SETAD3 ;yes 82 | ld a,(SCRMOD) 83 | cp 5 84 | jr c,SETAD3 85 | ld b,h ;extract the high address 86 | cp 7 87 | ld a,(ACPAGE) 88 | jr c,SETAD1 89 | sla b 90 | rla 91 | jr SETAD2 92 | SETAD1: 93 | sla b 94 | SETAD2: 95 | sla b 96 | rla 97 | di 98 | out (c),a ;set data to be written 99 | ld a,14+80h ;set it ti registar #14 100 | out (c),a 101 | SETAD3: 102 | di 103 | out (c),l ;set the low address 104 | ld a,h ;prepare to set the middle address 105 | and 3fh 106 | ret 107 | ENDMODULE 108 | 109 | ;--- SETWRT --- 110 | ;sets up the VDP for write 111 | MODULE SETWRT 112 | extrn SETADR 113 | extrn WRPORT@ 114 | SETWRT@:: 115 | ld a,(WRPORT@) 116 | call SETADR 117 | or 01000000b ;set the low address with write bit 118 | out (c),a 119 | dec c 120 | ei 121 | ret 122 | ENDMODULE 123 | 124 | ;--- SETRD --- 125 | ;sets up the VDP for read 126 | MODULE SETRD 127 | extrn SETADR 128 | extrn RDPORT@ 129 | SETRD@:: 130 | ld a,(RDPORT@) 131 | call SETADR 132 | out (c),a 133 | dec c 134 | ei 135 | ret 136 | ENDMODULE 137 | 138 | ;--- VPOKE --- 139 | ;writes to the VRAM 140 | MODULE VPOKE 141 | extrn SETWRT@ 142 | VPOKE@:: 143 | call SETWRT@ 144 | out (c),e 145 | ret 146 | ENDMODULE 147 | 148 | ;--- VPEEK --- 149 | ;reads the VRAM 150 | MODULE VPEEK 151 | extrn SETRD@ 152 | VPEEK@:: 153 | call SETRD@ 154 | in a,(c) 155 | ret 156 | ENDMODULE 157 | 158 | ;--- LDIRVM --- 159 | ;moves block from memory to the VRAM 160 | MODULE LDIRVM 161 | extrn SETWRT@ 162 | LDIRVM@:: 163 | push bc ;save length 164 | call SETWRT@ 165 | ex de,hl ;C..(WRPORT@) 166 | pop de ;HL..pointer to source DE..length 167 | ld b,e ;set lower byte of length 168 | ld a,e 169 | or a 170 | ld a,d ;set higher byte of length 171 | jr z,LDIRV1 172 | inc a 173 | LDIRV1: 174 | outi 175 | jp nz,LDIRV1 176 | dec a 177 | jp nz,LDIRV1 178 | ret 179 | ENDMODULE 180 | 181 | ;--- LDIRMV --- 182 | ;moves block from VRAM to memory 183 | MODULE LDIRMV 184 | extrn SETRD@ 185 | LDIRMV@:: 186 | ex de,hl ;HL..pointer to source 187 | push bc ;save length 188 | call SETRD@ 189 | ex de,hl ;C..(RDPORT@) 190 | pop de ;HL..pointer to destination DE..length 191 | ld b,e ;set lower byte of length 192 | ld a,e 193 | or a 194 | ld a,d ;set higher byte of length 195 | jr z,LDIRM1 196 | inc a 197 | LDIRM1: 198 | ini 199 | jp nz,LDIRM1 200 | dec a 201 | jp nz,LDIRM1 202 | ret 203 | ENDMODULE 204 | 205 | ;--- FILVRM --- 206 | ;fills the VRAM 207 | MODULE FILVRM 208 | extrn SETWRT@ 209 | FILVRM@:: 210 | push bc ;save data 211 | call SETWRT@ 212 | pop hl ;L..data DE..length C..(WPORT@) 213 | ld b,e ;set lower byte of length 214 | ld a,e 215 | or a 216 | ld a,d ;set higher byte of length 217 | jr z,FILVR1 218 | inc a 219 | FILVR1: 220 | out (c),l 221 | djnz FILVR1 222 | dec a 223 | jr nz,FILVR1 224 | ret 225 | ENDMODULE 226 | 227 | ;--- GETSTAT --- 228 | ; Wait VDP Ready 229 | ;modify af,bc 230 | MODULE GETSTAT 231 | extrn WRPORT@ 232 | extrn RDPORT@ 233 | GETSTAT:: 234 | push bc 235 | ld bc,(WRPORT@) ;Read Status Register Specified by A 236 | inc c 237 | out (c),a 238 | ld a,8fh 239 | out (c),a 240 | ld bc,(RDPORT@) 241 | inc c 242 | in a,(c) 243 | pop bc 244 | ret 245 | ENDMODULE 246 | 247 | ;--- WAITVDP --- 248 | MODULE WAITVDP 249 | extrn GETSTAT 250 | WAITVDP:: 251 | ld a,2 252 | call GETSTAT 253 | and 1 254 | jr nz,WAITVDP 255 | xor a 256 | jp GETSTAT 257 | ENDMODULE 258 | 259 | ;--- BOXFIL --- 260 | MODULE BOXFIL 261 | extrn WAITVDP 262 | extrn WRPORT@ 263 | ACPAGE equ 0faf6h 264 | LINWRK equ 0fc18h 265 | SCRMOD equ 0fcafh 266 | BOXFIL@:: 267 | pop iy ;return address 268 | ld (LINWRK+4),hl ;save x start 269 | ld a,(SCRMOD) 270 | cp 7 271 | ld a,(ACPAGE) ;active page 272 | jr c,BOXFI1 273 | add a,a 274 | BOXFI1: 275 | add a,d 276 | ld (LINWRK+7),a ;save y start 277 | ld a,e 278 | ld (LINWRK+6),a 279 | ld a,4 280 | or a 281 | sbc hl,bc ;hl..x start - x end 282 | jr nc,BOXFI2 283 | ld c,l 284 | ld b,h 285 | ld hl,0 286 | or a 287 | sbc hl,bc 288 | xor a 289 | BOXFI2: 290 | inc hl 291 | ld (LINWRK+8),hl ;save number of dots for x 292 | ld (LINWRK+13),a ;arg 293 | pop hl ;hl..y end 294 | or a 295 | sbc hl,de ;hl..y end - y start 296 | jr nc,BOXFI3 297 | ex de,hl 298 | ld hl,0 299 | or a 300 | sbc hl,de 301 | ld a,(LINWRK+13) 302 | set 3,a 303 | ld (LINWRK+13),a 304 | BOXFI3: 305 | inc hl 306 | ld (LINWRK+10),hl ;save number of dots for y 307 | pop hl 308 | ld a,l 309 | ld (LINWRK+12),a ;color code 310 | pop hl ;logical operation 311 | ld a,l 312 | or 10000000b ;LMMV command 313 | ld (LINWRK+14),a 314 | push hl ;adjust stack 315 | push hl 316 | push hl 317 | push iy ;return address 318 | ld hl,LINWRK+4 319 | di 320 | call WAITVDP 321 | ld a,(WRPORT@) 322 | ld c,a 323 | inc c 324 | ld a,36 325 | out (c),a 326 | ld a,17+80h 327 | out (c),a 328 | inc c 329 | inc c 330 | ld b,11 331 | otir 332 | ei 333 | ret 334 | ENDMODULE 335 | 336 | ;--- LINE --- 337 | MODULE LINE 338 | extrn WAITVDP 339 | extrn WRPORT@ 340 | ACPAGE equ 0faf6h 341 | LINWRK equ 0fc18h 342 | SCRMOD equ 0fcafh 343 | LINE@:: 344 | pop iy ;return address 345 | ld (LINWRK+4),hl ;save x start 346 | ld a,(SCRMOD) 347 | cp 7 348 | ld a,(ACPAGE) ;active page 349 | jr c,LINE1 350 | ADD a,a 351 | LINE1: 352 | add a,d 353 | ld (LINWRK+7),a ;save y start 354 | ld a,e 355 | ld (LINWRK+6),a 356 | ld a,4 357 | or a 358 | sbc hl,bc ;hk..x start - x end 359 | jr nc,LINE2 360 | ld c,l 361 | ld b,h 362 | ld hl,0 363 | or a 364 | sbc hl,bc 365 | xor a 366 | LINE2: 367 | ld (LINWRK+8),hl ;save number of dots for x 368 | ld (LINWRK+13),a ;arg 369 | pop hl ;hl..y end 370 | or a 371 | sbc hl,de ;hl..y end - y start 372 | jr nc,LINE3 373 | ex de,hl 374 | ld hl,0 375 | or a 376 | sbc hl,de 377 | ld a,(LINWRK+13) 378 | set 3,a 379 | ld (LINWRK+13),a 380 | LINE3: 381 | ld de,(LINWRK+8) ;number of dots for x 382 | or a 383 | sbc hl,de 384 | jr nc,LINE4 385 | add hl,de 386 | ld (LINWRK+10),hl ;save number of dots for y 387 | jr LINE5 388 | LINE4: 389 | ld a,(LINWRK+13) 390 | set 0,a 391 | ld (LINWRK+13),a 392 | ld (LINWRK+10),de ;save number of dots for x 393 | add hl,de 394 | ld (LINWRK+8),hl ;number of dots for y 395 | LINE5: 396 | pop hl 397 | ld a,l 398 | ld (LINWRK+12),a ;color code 399 | pop hl ;logical operation 400 | ld a,l 401 | or 01110000b ;LINE command 402 | ld (LINWRK+14),a 403 | push hl ;adjust stack 404 | push hl 405 | push hl 406 | push iy ;return address 407 | ld hl,LINWRK+4 408 | di 409 | call WAITVDP 410 | ld a,(WRPORT@) 411 | ld c,a 412 | inc c 413 | ld a,36 414 | out (c),a 415 | ld a,17+80h 416 | out (c),a 417 | inc c 418 | inc c 419 | ld b,11 420 | otir 421 | ei 422 | ret 423 | ENDMODULE 424 | 425 | ;--- CPYM2V --- 426 | MODULE CPYM2V 427 | extrn WAITVDP 428 | extrn GETSTAT 429 | extrn WRPORT@ 430 | LINWRK equ 0fc18h 431 | SCRMOD equ 0fcafh 432 | CPYM2V@:: 433 | pop iy ;return address 434 | ld a,e 435 | and 3 436 | rlca 437 | rlca 438 | ld (LINWRK+13),a ;arg 439 | ld (LINWRK+4),bc ;save destination x start 440 | pop bc ;destination y start 441 | pop de ;destination page 442 | ld a,(SCRMOD) 443 | cp 7 444 | ld a,e 445 | jr c,CPYMV1 446 | add a,a 447 | CPYMV1: 448 | add a,b 449 | ld (LINWRK+7),a ;save destination y start 450 | ld a,c 451 | ld (LINWRK+6),a 452 | pop bc ;logop 453 | ld a,c 454 | or 10110000b ;LMMC command 455 | ld (LINWRK+14),a 456 | ld de,LINWRK+8 457 | ld bc,4 458 | ldir 459 | ld a,(hl) 460 | ld (LINWRK+12),a 461 | push hl ;adjust stack 462 | push hl 463 | push hl 464 | push iy ;return address 465 | ; 466 | push hl 467 | ld hl,LINWRK+4 468 | di 469 | call WAITVDP 470 | ld a,(WRPORT@) 471 | ld c,a 472 | inc c 473 | ld a,36 474 | out (c),a 475 | ld a,17+80h 476 | out (c),a 477 | inc c 478 | inc c 479 | ld b,11 480 | otir 481 | pop hl 482 | ; 483 | dec c 484 | dec c ;C:port#1's address 485 | CPYMV2: 486 | ld a,2 487 | call GETSTAT 488 | bit 0,a 489 | jr z,CPYMV3 ;check CE bit 490 | bit 7,a 491 | jr z,CPYMV2 ;check TR bit 492 | inc hl 493 | ld a,(hl) 494 | out (c),a 495 | ld a,80h+44 496 | out (c),a 497 | jr CPYMV2 498 | CPYMV3: 499 | xor a 500 | call GETSTAT 501 | ei 502 | ret 503 | ENDMODULE 504 | 505 | ;--- CPYV2V --- 506 | MODULE CPYV2V 507 | extrn WAITVDP 508 | extrn WRPORT@ 509 | LINWRK equ 0fc18h 510 | SCRMOD equ 0fcafh 511 | CPYV2V@:: 512 | pop iy ;return address 513 | ld (LINWRK),hl ;save source x start 514 | ld a,4 515 | or a 516 | sbc hl,bc ;hl..sx start - sx end 517 | jr nc,CPYVV1 518 | ld c,l 519 | ld b,h 520 | ld hl,0 521 | or a 522 | sbc hl,bc 523 | xor a 524 | CPYVV1: 525 | inc hl 526 | ld (LINWRK+8),hl ;save number of dots for x 527 | ld (LINWRK+13),a ;arg 528 | pop hl ;hl..source y end 529 | pop bc 530 | ld a,(SCRMOD) 531 | cp 7 532 | ld a,c 533 | jr c,CPYVV2 534 | add a,a 535 | CPYVV2: 536 | add a,d 537 | ld (LINWRK+3),a ;save source y start 538 | ld a,e 539 | ld (LINWRK+2),a 540 | or a 541 | sbc hl,de ;hl..sy end - sy start 542 | jr nc,CPYVV3 543 | ex de,hl 544 | ld hl,0 545 | or a 546 | sbc hl,de 547 | ld a,(LINWRK+13) 548 | set 3,a 549 | ld (LINWRK+13),a 550 | CPYVV3: 551 | inc hl 552 | ld (LINWRK+10),hl ;save number of dots for y 553 | pop hl ;destination x start 554 | pop de ;destination y start 555 | pop bc ;destination page 556 | ld (LINWRK+4),hl 557 | ld a,(SCRMOD) 558 | cp 7 559 | ld a,c 560 | jr c,CPYVV4 561 | add a,a 562 | CPYVV4: 563 | add a,d 564 | ld (LINWRK+7),a ;save destination y start 565 | ld a,e 566 | ld (LINWRK+6),a 567 | pop hl ;logical operation 568 | ld a,l 569 | or 10010000b ;LMMM command 570 | ld (LINWRK+14),a 571 | push hl ;adjust stack 572 | push hl 573 | push hl 574 | push hl 575 | push hl 576 | push hl 577 | push iy ;return address 578 | ld hl,LINWRK 579 | di 580 | call WAITVDP 581 | ld a,(WRPORT@) 582 | ld c,a 583 | inc c 584 | ld a,32 585 | out (c),a 586 | ld a,17+80h 587 | out (c),a 588 | inc c 589 | inc c 590 | ld b,15 591 | otir 592 | ei 593 | ret 594 | ENDMODULE 595 | 596 | ;--- PALETT --- 597 | ;set palette datum 598 | MODULE PALETT 599 | extrn WRPORT@ 600 | PALETT@:: 601 | ;set palette 602 | ;entry b...palette number e..red*8+blue d..green 603 | pop ix 604 | ld b,l 605 | pop hl 606 | ld a,c 607 | and 7 608 | ld d,a 609 | ld a,e 610 | and 7 611 | rlca 612 | rlca 613 | rlca 614 | rlca 615 | ld e,a 616 | ld a,l 617 | and 7 618 | or e 619 | ld e,a 620 | push hl 621 | push ix 622 | ld a,(WRPORT@) 623 | ld c,a 624 | inc c 625 | di 626 | out (c),b ;palette number 627 | ld a,16+80h 628 | out (c),a 629 | inc c 630 | out (c),e 631 | push bc 632 | pop bc 633 | push bc 634 | pop bc 635 | out (c),d 636 | ei 637 | ret 638 | ENDMODULE 639 | 640 | ;--- RND --- 641 | MODULE RND 642 | RND@:: 643 | ld a,h 644 | or l 645 | ret z 646 | ex de,hl ;save the range 647 | ld hl,(RNDSPD@) 648 | ld b,h 649 | ld c,l 650 | add hl,hl 651 | add hl,hl 652 | add hl,bc 653 | ld (RNDSPD@),hl 654 | ld hl,(RNDSPD@+2) 655 | adc hl,hl 656 | adc hl,bc 657 | ld (RNDSPD@+2),hl 658 | ld a,h 659 | ld c,l 660 | ld hl,0 661 | ld b,16 662 | srl a 663 | rr c 664 | RND1: jr nc,RND2 665 | add hl,de 666 | RND2: rr h 667 | rr l 668 | rra 669 | rr c 670 | djnz RND1 671 | ret 672 | dseg 673 | RNDSPD@:: dw 1991h,0c204h 674 | cseg 675 | ENDMODULE 676 | 677 | ;--- dummy --- 678 | MODULE DMY2 679 | ENDMODULE 680 | 681 |  -------------------------------------------------------------------------------- /games/mole/mole.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #pragma nonrec 5 | 6 | #define PHIDE 0 7 | #define PFACE 1 8 | #define PBODY 2 9 | #define PBOO 3 10 | #define PKYU 4 11 | 12 | #define SFACE1 0 13 | #define SBODY1 1 14 | #define SBODY2 2 15 | #define SBOO 3 16 | #define SFACE2 4 17 | #define SHIDE 5 18 | #define SKYU 6 19 | 20 | #define HUP 0 21 | #define HDOWN 8 22 | 23 | int Molex[10] = { 24,96,168,62,134,32,104,176,56,128 }; 24 | int Moley[10] = { 50,50,50,90,90,130,130,130,170,170 }; 25 | 26 | struct { 27 | int st; 28 | int ct; 29 | } Mole[10]; 30 | 31 | TINY Hmst; 32 | TINY Hmct; 33 | int Hmx; 34 | int Hmy; 35 | 36 | int Score; 37 | 38 | VOID initscrn() 39 | { 40 | ginit(); 41 | gicini(); 42 | color(15, 12, 12); 43 | screen(5); 44 | palett(6, 5, 3, 0); 45 | } 46 | 47 | VOID initspr() 48 | { 49 | static char clspr1[16] = { 50 | 1, 1, 1, 1, 1, 1, 1, 1, 51 | 1, 1, 1, 1, 1, 1, 1, 1,}; 52 | 53 | static char clspr2[16] = { 54 | 14+64,14+64,14+64,14+64,14+64,14+64,14+64,14+64, 55 | 14+64,14+64,14+64,14+64,14+64,14+64,14+64,14+64 }; 56 | 57 | static char ptspr1[32] = { 58 | 3, 7, 15, 15, 15, 15, 15, 15, 59 | 15, 15, 15, 4, 3, 1, 1, 1, 60 | 224,240,232,232,104,168, 8,232, 61 | 216,200,136, 16,224, 64, 64,192 }; 62 | 63 | static char ptspr2[32] = { 64 | 0, 3, 7, 6, 6, 7, 7, 4, 65 | 3, 7, 7, 3, 0, 0, 0, 0, 66 | 0,224,112,176,176,112,240, 16, 67 | 224,240,240,224, 0,128,128, 0 }; 68 | 69 | static char ptspr3[32] = { 70 | 3, 7, 15, 15, 15, 12, 15, 15, 71 | 15, 15, 15, 7, 3, 1, 1, 0, 72 | 224,240,248,248,232, 8,136,232, 73 | 104, 72, 72, 80, 96, 64,192, 0 }; 74 | 75 | static char ptspr4[32] = { 76 | 0, 3, 7, 3, 4, 7, 7, 7, 77 | 6, 6, 6, 2, 0, 0, 0, 0, 78 | 0,224,240,224, 16,240,240,112, 79 | 176,176,176,160,128,128, 0, 0 }; 80 | 81 | inispr(3); 82 | sprite(0, ptspr1); 83 | sprite(4, ptspr2); 84 | sprite(8, ptspr3); 85 | sprite(12, ptspr4); 86 | colspr(0, clspr1); 87 | colspr(1, clspr2); 88 | } 89 | 90 | VOID cpymole() 91 | { 92 | static char ptmole[5][1284] = { 93 | 94 | { 32, 0, 32, 0, 95 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 96 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 97 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 98 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 99 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 100 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 101 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 102 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 103 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 104 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 105 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 106 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 107 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 108 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 109 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 110 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 111 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 112 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 113 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 114 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 115 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 116 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 117 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 118 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 119 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 120 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 121 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 122 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 123 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 124 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 125 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 126 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 127 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 128 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 129 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 130 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 131 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 132 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 133 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 134 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 135 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 136 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 137 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 138 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 139 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 140 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 141 | 12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 1, 142 | 1, 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12, 143 | 12,12,12,12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 144 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12,12,12,12,12, 145 | 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 146 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12,12, 147 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 148 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12, 149 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 150 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12, 151 | 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 152 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12,12, 153 | 12,12,12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 154 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,12,12,12,12, 155 | 12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 156 | 1, 1, 1, 1, 1, 1, 1, 1, 1,12,12,12,12,12,12,12, 157 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 158 | 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12 }, 159 | 160 | { 32, 0, 32, 0, 161 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 162 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 163 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 164 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 165 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 166 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 167 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 168 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 169 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 170 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 171 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 172 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 173 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 174 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 175 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 176 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 177 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 178 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 179 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 180 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 181 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 182 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 183 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 184 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 185 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 186 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 187 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 188 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 189 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 190 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 191 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1,12, 1, 192 | 12,12, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12, 193 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 1, 194 | 12, 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 195 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 196 | 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 197 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 198 | 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12,12, 199 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 6, 6, 6, 6, 200 | 6, 6, 6, 1, 1,12,12,12,12,12,12,12,12,12,12,12, 201 | 12,12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 202 | 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12,12, 203 | 12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 204 | 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12, 205 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 206 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 207 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 208 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 209 | 12,12,12,12, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 210 | 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1,12,12,12,12, 211 | 12, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 1, 1, 6, 6, 6, 212 | 6, 6, 1, 1, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1,12,12, 213 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 214 | 6, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1,12, 215 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 216 | 6, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1,12, 217 | 12, 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 218 | 6, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1,12,12, 219 | 12,12,12, 1, 1, 1, 1, 1, 6, 6, 1,15,15, 1, 6, 6, 220 | 6, 1,15,15, 1, 6, 6, 1, 1, 1, 1, 1,12,12,12,12, 221 | 12,12,12,12,12,12, 1, 1, 1, 1, 1,15,15, 1, 6, 6, 222 | 6, 1,15,15, 1, 1, 1, 1, 1,12,12,12,12,12,12,12, 223 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 224 | 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12 }, 225 | 226 | { 32, 0, 32, 0, 227 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 228 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 229 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1,12, 1, 230 | 12,12, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12, 231 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 1, 232 | 12, 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 233 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 234 | 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 235 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 236 | 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12,12, 237 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 6, 6, 6, 6, 238 | 6, 6, 6, 1, 1,12,12,12,12,12,12,12,12,12,12,12, 239 | 12,12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 240 | 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12,12, 241 | 12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 242 | 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12, 243 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 244 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 245 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 246 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 247 | 12,12,12,12,12,12, 1, 6, 6, 6, 6, 1, 1, 6, 6, 6, 248 | 6, 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 249 | 12,12,12,12,12,12, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 250 | 6, 6, 1, 1, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 251 | 12,12,12,12,12,12, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 252 | 6, 1, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12,12, 253 | 12,12,12,12,12,12, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 254 | 6, 1, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12,12, 255 | 12,12,12,12,12, 1, 6, 6, 6, 6, 1, 1, 1, 1, 6, 6, 256 | 6, 1, 1, 1, 1, 6, 6, 6, 6, 1,12,12,12,12,12,12, 257 | 12,12,12,12,12, 1, 6, 6, 6, 6, 1, 1, 1, 6, 6, 6, 258 | 6, 1, 1, 1, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12, 259 | 12,12,12, 1, 1, 1, 6, 6, 6, 6, 1, 1, 1, 1, 6, 6, 260 | 6, 1, 1, 1, 1, 6, 6, 6, 6, 1, 1, 1,12,12,12,12, 261 | 12,12,12,12,12, 1, 1, 1, 6, 6, 1, 1, 1, 1, 6, 6, 262 | 6, 1, 1, 1, 1, 6, 6, 6, 1, 1,12,12,12,12,12,12, 263 | 12,12, 1, 1, 1, 6, 6, 6, 1, 6, 1, 1, 1, 1, 6, 6, 264 | 6, 1, 1, 1, 1, 6, 1, 1, 6, 1, 1, 1, 1,12,12,12, 265 | 12,12,12, 1, 6, 6, 6, 6, 1, 1, 6, 1, 1, 6, 6, 6, 266 | 6, 6, 1, 1, 6, 1, 6, 6, 1, 1,12,12,12,12,12,12, 267 | 12,12,12, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 268 | 6, 6, 6, 6, 6, 6, 1, 1, 6, 1,12,12,12,12,12,12, 269 | 12,12, 1, 6, 6, 1, 1, 6, 1, 6, 6, 6, 6, 6, 6, 6, 270 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12, 271 | 12,12, 1, 6, 6, 6, 6, 6, 1, 6, 1, 6, 6, 6, 6, 6, 272 | 6, 6, 6, 6, 1, 6, 6, 6, 6, 1,12,12,12,12,12,12, 273 | 12,12, 1, 6, 6, 1, 6, 1, 6, 6, 6, 1, 6, 6, 6, 6, 274 | 6, 6, 6, 1, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12, 275 | 12,12, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 1, 1, 6, 6, 276 | 6, 1, 1, 6, 6, 6, 6, 6, 6, 1, 1, 1,12,12,12,12, 277 | 12, 1, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 1, 1, 278 | 1, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12, 279 | 1, 1, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 280 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1,12, 281 | 1, 1, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 282 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1,12, 283 | 12, 1, 1, 1, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 284 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12, 285 | 12,12,12, 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 286 | 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1,12,12,12,12, 287 | 12,12,12,12,12,12, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 288 | 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12,12,12,12,12,12, 289 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 290 | 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12 }, 291 | 292 | { 32, 0, 32, 0, 293 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1,12, 294 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 295 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 1, 296 | 12,12,12, 1,12,12,12,12,12,12,12,12,12,12,12,12, 297 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1,12, 1, 298 | 12, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12,12, 299 | 12,12,12,12,12,12,12,12,12,12,12, 1,12,12, 1, 1, 300 | 1,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 301 | 12,12,12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 302 | 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12,12,12, 303 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 6, 6, 6, 6, 304 | 6, 6, 6, 1, 1,12,12,12,12,12,12,12,12,12,12,12, 305 | 12,12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 306 | 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12,12, 307 | 12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 308 | 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12,12, 309 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 310 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 311 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 312 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 313 | 12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 314 | 6, 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 315 | 12,12,12,12,12,12, 1, 6, 6, 6, 6, 6,15,15,15, 6, 316 | 6, 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 317 | 12,12,12,12,12,12, 1, 6, 6, 6, 6,15,15,15,15, 6, 318 | 6, 6,15,15, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 319 | 12,12,12,12,12,12, 1, 6, 6, 6,15,15,15,15, 6, 6, 320 | 6,15,15, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12,12, 321 | 12,12,12,12,12, 1, 6, 6, 6, 6,15, 1, 1, 1, 6, 6, 322 | 6,15,15, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12, 323 | 12,12,12,12,12, 1, 6, 6, 6,15, 1, 1, 1, 1, 6, 6, 324 | 6,15,15,15, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12, 325 | 12,12,12, 1, 1, 1, 6, 6, 6,15, 1, 1, 1, 6, 6, 6, 326 | 6, 6,15,15,15,15,15, 6, 6, 1, 1, 1,12,12,12,12, 327 | 12,12,12,12,12, 1, 1, 6, 6,15,15,15, 6, 6, 6, 6, 328 | 6, 6, 6,15,15,15,15, 6, 1, 1,12,12,12,12,12,12, 329 | 12,12, 1, 1, 1, 1, 6, 1, 1,15,15,15, 6, 6, 6, 6, 330 | 6, 6, 6, 6, 6,15, 1, 1, 6, 1, 1, 1, 1,12,12,12, 331 | 12,12,12,12,12, 1, 1, 6, 6, 1, 6, 6, 6, 6, 6, 6, 332 | 6, 6, 6, 6, 6, 1, 6, 6, 1, 1,12,12,12,12,12,12, 333 | 12,12,12,12,12, 1, 6, 1, 1, 6, 6, 6, 6, 6, 6, 6, 334 | 6, 6, 6, 6, 6, 6, 1, 1, 6, 1,12,12,12,12,12,12, 335 | 12,12,12,12,12, 1, 6, 6, 6, 6, 1, 1, 6, 6, 6, 6, 336 | 6, 6, 1, 1, 1, 6, 6, 6, 6, 1,12,12,12,12,12,12, 337 | 12,12,12,12, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, 6, 6, 338 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12, 339 | 12,12,12, 1, 6, 6, 6, 1, 6, 1, 1, 1, 1, 1, 1, 1, 340 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12, 341 | 12,12, 1, 6, 6, 6, 6, 1, 6, 1, 1, 1, 1, 1, 1, 1, 342 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1,12,12,12,12, 343 | 12, 1, 1, 6, 6, 6, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1, 344 | 1, 1, 1, 1, 1, 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12, 345 | 1, 1, 6, 6, 1, 1, 6, 1, 6, 6, 6, 1, 1, 1, 1, 8, 346 | 8, 8, 8, 1, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1,12, 347 | 1, 1, 6, 6, 6, 6, 6, 1, 6, 6, 6, 6, 6, 1, 8, 8, 348 | 8, 8, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1, 1,12, 349 | 12, 1, 1, 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 350 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12, 351 | 12,12,12, 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 352 | 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 1, 1,12,12,12,12, 353 | 12,12,12,12,12,12, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 354 | 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12,12,12,12,12,12, 355 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 356 | 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12 }, 357 | 358 | { 32, 0, 32, 0, 359 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 360 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 361 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12, 8,12, 362 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 363 | 12,12,10,10,12,12,12,12,12,12,12,12,12,12,12,12, 364 | 12,12, 8,12,12,12,12,12,12,12,12,12,12,12,12,12, 365 | 12,12,12,12,10,12,12,12,12,12,12,12,12,12,12,12, 366 | 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 367 | 12,12,10,10,10,12,12,12,12,12,12, 8,12,12,12,12, 368 | 8,12,12,12,12,15,12,12,12,12,15,12,12,12,12,12, 369 | 12,10,12,12,10,10,12,12,12,12,12,12,12,12,12, 1, 370 | 12,12,12,12,15,15,15,12,12,15,15,15,12,12,12,12, 371 | 10,12,12,10,12,10,12,12,12,12, 1, 1,12,12,12, 1, 372 | 12,12, 1, 1,12,15,15,15,15,15,15,12,12,12,12,12, 373 | 12,10,10,12,10,10,10,12,12,12,12,12,12, 1,12, 1, 374 | 12, 1,12,12,12,12,15,15,15,15,12,12,12,12,12,12, 375 | 12,12,12,10,12,12,10,12,12,12,12,12, 1, 1, 1, 1, 376 | 1, 1, 1,12,12,12,15,15,15,15,12,12,12,12,12,12, 377 | 12,12,10,12,12,10,12,10,12,12, 1, 1, 6, 6, 6, 6, 378 | 6, 6, 6, 1,12,15,15,15,15,15,15,12,12,12,12,12, 379 | 12,12,12,10,10,12,12,10,12, 1, 6, 6, 6, 6, 6, 6, 380 | 6, 6, 6, 6,15,15,15,12,12,15,15,15,12,12,12,12, 381 | 12,12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 382 | 6, 6, 6, 6, 6,15, 1,12,12,12,15,12,12,12,12,12, 383 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 384 | 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 385 | 12,12,12,12,12,12,12, 1, 6, 6, 6, 1, 1, 6, 6, 6, 386 | 6, 6,15,15, 6, 6, 6, 1,12,12,12,12,12,12,12,12, 387 | 12,12,12,12,12,12, 1, 6, 6, 6, 1, 1, 1, 1, 6, 6, 388 | 6,15,15,15,15, 6, 6, 6, 1,12,12,12,12,12,12,12, 389 | 12,12,12,12,12,12, 1, 6, 6, 6,15, 1, 1,15, 6, 6, 390 | 6,15, 1, 1,15, 6, 6, 6, 1,12,12,12,12,12,12,12, 391 | 12,12,12,12,12,12, 1, 6, 6, 6,15,15,15,15, 6, 6, 392 | 6, 1, 1, 1, 1, 6, 6, 6, 1,12,12,12,12,12,12,12, 393 | 12,12,12,12,12,12, 1, 6, 6, 6, 6,15,15, 6, 6, 6, 394 | 6, 6, 1, 1, 6, 6, 6, 6, 1,12,12,12,12,12,12,12, 395 | 12,12,12,12,12, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 396 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 1,12,12,12,12,12,12, 397 | 12,12,12,12,12, 1, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 398 | 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,12,12,12,12,12,12, 399 | 12,12,12,12, 1, 1, 6, 6, 1, 6, 6, 6,15, 1, 1, 1, 400 | 1, 1,15, 6, 6, 6, 1, 6, 6, 1, 1,12,12,12,12,12, 401 | 12,12,12, 1,12, 1, 1, 1, 6, 6, 1,15,15, 1, 1, 1, 402 | 1, 1,15,15, 1, 6, 6, 1, 1, 1,12, 1,12,12,12,12, 403 | 12,12,12,12, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 404 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1,12,12,12,12,12, 405 | 12,12,12, 1,12, 1, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 406 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 1,12, 1,12,12,12,12, 407 | 12,12,12, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 408 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1,12,12,12,12, 409 | 12, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 410 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1,12,12, 411 | 1, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, 1, 1, 1, 412 | 1, 1, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 1, 1,12, 413 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1, 1, 414 | 1, 1, 1, 1, 1, 1, 6, 6, 6, 1, 1, 1, 1, 1, 1,12, 415 | 12, 1, 1, 1, 1, 1, 6, 6, 6, 6, 1, 1, 1, 8, 8, 1, 416 | 8, 8, 1, 1, 1, 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12, 417 | 12,12,12, 1, 1, 1, 1, 6, 6, 6, 6, 6, 8, 8, 8, 8, 418 | 1, 8, 8, 6, 6, 6, 6, 6, 1, 1, 1, 1,12,12,12,12, 419 | 12,12,12,12,12,12, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 420 | 6, 6, 6, 6, 1, 1, 1, 1, 1,12,12,12,12,12,12,12, 421 | 12,12,12,12,12,12,12,12,12,12, 1, 1, 1, 1, 1, 1, 422 | 1, 1, 1, 1, 1,12,12,12,12,12,12,12,12,12,12,12 } }; 423 | int i; 424 | 425 | for (i = 0; i < 5; ++i) 426 | cpym2v(ptmole[i], 0, i * 32, 0, 1, 0); 427 | } 428 | 429 | VOID cpyhammer() 430 | { 431 | static char pthit[53] = { 7, 0, 7, 0, 432 | 12,12,12,15,12,12,12,15,15,15,15,15,15,14, 433 | 15,15,15,15,15,15,14,15,15,14,14,14,14,14, 434 | 12,12,12,15,12,12,12,12,12,12,15,12,12,12, 435 | 12,12,12,15,12,12,12 }; 436 | 437 | cpym2v(pthit, 0, 160, 0, 1,0); 438 | } 439 | 440 | VOID drawmole(i) 441 | int i; 442 | { 443 | static int pat[7] = { 444 | PFACE, PBODY, PBODY, PBOO, PFACE, PHIDE, PKYU }; 445 | int x; 446 | 447 | x = pat[Mole[i].st] * 32; 448 | cpyv2v(x, 0, x+31, 31, 1, Molex[i], Moley[i], 0, 0); 449 | } 450 | 451 | VOID movemole() 452 | { 453 | int i, next; 454 | static int act[3] = { SBODY1, SBODY2, SHIDE }; 455 | static int wt[6] = { 5, 12, 10, 6, 8, 25}; 456 | static int wr[6] = {10, 8, 1, 14, 1, 95}; 457 | 458 | for (i = 0; i < 10; ++i) { 459 | if (--Mole[i].ct == 0) { 460 | switch (Mole[i].st) { 461 | case SFACE1: next = act[rnd(3)]; break; 462 | case SBODY1: next = SFACE2; break; 463 | case SBODY2: next = SBOO; break; 464 | case SBOO: next = SFACE2; break; 465 | case SFACE2: next = SHIDE; break; 466 | case SHIDE: next = SFACE1; break; 467 | case SKYU: next = SFACE2; break; 468 | } 469 | Mole[i].st = next; 470 | Mole[i].ct = wt[next] + rnd(wr[next]); 471 | drawmole(i); 472 | } 473 | } 474 | } 475 | 476 | VOID drawhammer() 477 | { 478 | putspr(0, Hmx, Hmy, 0, Hmst); 479 | putspr(1, Hmx, Hmy, 0, Hmst + 4); 480 | } 481 | 482 | VOID transfer() 483 | { 484 | static int trnx[8] = { 0, 8, 10, 8, 0, -8, -10, -8 }; 485 | static int trny[8] = { -10, -8, 0, 8, 10, 8, 0, -8 }; 486 | TINY i; 487 | 488 | if ((i = gtstck(0)) != 0) { 489 | Hmx += trnx[i-1]; 490 | Hmy += trny[i-1]; 491 | } 492 | else { 493 | gtpad(12); 494 | Hmx += gtpad(13)/2; 495 | Hmy += gtpad(14)/2; 496 | } 497 | 498 | if (Hmx < 8) Hmx = 8; 499 | if (Hmx > 216) Hmx = 216; 500 | if (Hmy < 8) Hmy = 8; 501 | if (Hmy > 174) Hmy = 174; 502 | } 503 | 504 | VOID hammer() 505 | { 506 | if (Hmst == HUP) { 507 | transfer(); 508 | if (gttrig(0) || gttrig(1)) { 509 | Hmst = HDOWN; 510 | Hmct = 3; 511 | } 512 | } 513 | else { 514 | if (--Hmct == 0) { 515 | Hmst = HUP; 516 | gtpad(12); 517 | } 518 | } 519 | drawhammer(); 520 | } 521 | 522 | VOID prnscore() 523 | { 524 | int x, y; 525 | 526 | y = ((Score - 1) / 20) * 8; 527 | x = ((Score - 1) % 20) * 8; 528 | if (x > 9*8) x += 8; 529 | cpyv2v(160, 0, 166, 6, 1, 48+x, y, 0, 0); 530 | } 531 | 532 | VOID subjudge(i) 533 | int i; 534 | { 535 | if (Hmx < Molex[i] - 15) return; 536 | if (Hmx > Molex[i] + 15) return; 537 | if (Hmy < Moley[i] - 20) return; 538 | if (Hmy > Moley[i] - 6) return; 539 | 540 | Mole[i].st = SKYU; 541 | Mole[i].ct = 12; 542 | ++Score; 543 | drawmole(i); 544 | prnscore(); 545 | 546 | sound(0, 64); 547 | sound(1, 1); 548 | sound(6, 24); 549 | sound(7, 54); 550 | sound(8, 16); 551 | sound(11, 0); 552 | sound(12, 20); 553 | sound(13, 0); 554 | } 555 | 556 | VOID judge() 557 | { 558 | int i, s; 559 | 560 | if (Hmst == HDOWN) { 561 | for (i = 0; i < 10; ++i) { 562 | s = Mole[i].st; 563 | if (s == SBODY1 || s == SBODY2 || s == SBOO) 564 | subjudge(i); 565 | } 566 | } 567 | } 568 | 569 | VOID starting() 570 | { 571 | int i; 572 | 573 | srnd(); 574 | Hmx = 120; 575 | Hmy = 100; 576 | Hmst = HUP; 577 | Hmct = 0; 578 | Score = 0; 579 | 580 | for (i = 0; i < 10; ++i) { 581 | Mole[i].st = SHIDE; 582 | Mole[i].ct = rnd(100); 583 | drawmole(i); 584 | } 585 | 586 | drawhammer(); 587 | boxfil(224, 40, 233, 189, 10,0); 588 | } 589 | 590 | VOID game() 591 | { 592 | int i, j, wait; 593 | 594 | for (i = 0; i < 150; ++i) { 595 | line(224, 40 + i, 233, 40 + i, 1, 0); 596 | for (j = 0; j < 10; ++j) { 597 | hammer(); 598 | movemole(); 599 | judge(); 600 | for (wait = 0;wait < 1000; ++wait); 601 | } 602 | } 603 | } 604 | 605 | VOID ending() 606 | { 607 | int wait, loop; 608 | 609 | for (loop = 9; loop > 0; --loop) { 610 | palett(12, 6, 1, 1); 611 | for (wait = 0; wait < 1000; ++wait); 612 | sound(0, 29 + loop * 24); 613 | sound(1, 1); 614 | sound(7, 62); 615 | sound(8, 16); 616 | sound(11, 0); 617 | sound(12, 24); 618 | sound(13,0); 619 | palett(12, 1, 4, 1); 620 | for (wait = 0; wait < 1000; ++wait); 621 | } 622 | 623 | while (!gttrig(0) && !gttrig(1)); 624 | } 625 | 626 | VOID main() 627 | { 628 | initscrn(); 629 | initspr(); 630 | cpymole(); 631 | cpyhammer(); 632 | starting(); 633 | game(); 634 | ending(); 635 | kilbuf(); 636 | color(15, 1, 1); 637 | screen(0); 638 | printf("your score: %6d\n", Score); 639 | } 640 |  --------------------------------------------------------------------------------