Common subdirectories: tetris.org/bitmap and tetris.new/bitmap diff -c tetris.org/init.c tetris.new/init.c *** tetris.org/init.c Fri Apr 02 23:30:18 1999 --- tetris.new/init.c Tue Aug 10 22:39:42 1999 *************** *** 19,25 **** /* * system clock */ ! sys_clock(5); /* * sound volume --- 19,25 ---- /* * system clock */ ! sys_clock(6); /* * sound volume *************** *** 203,209 **** *(volatile unsigned int *)0xa800028 &= ~0x4; /* stop timer2 */ *(volatile unsigned int *)0xa800000 = 500000/32; ! sys_clock(5); *(volatile unsigned int *)0xa800008 |= 0x4; /* start timer0 */ } } --- 203,209 ---- *(volatile unsigned int *)0xa800028 &= ~0x4; /* stop timer2 */ *(volatile unsigned int *)0xa800000 = 500000/32; ! sys_clock(6); *(volatile unsigned int *)0xa800008 |= 0x4; /* start timer0 */ } } diff -c tetris.org/locore.S tetris.new/locore.S *** tetris.org/locore.S Fri Apr 02 23:30:18 1999 --- tetris.new/locore.S Thu Aug 12 03:29:36 1999 *************** *** 30,39 **** .word _progstart ! .space 16*2 .space 16*16/2 IconAp: .word 0x00000000,0x00000000,0x00000000,0x00000000 .word 0x00000000,0x00000000,0x1919ee3c,0x3dbe7fcf .word 0x7ffe60cc,0x67e660cc,0x07c667cc,0x0ffe61cc --- 30,58 ---- .word _progstart ! /* .space 16*2 .space 16*16/2 + */ + .word 0, 0, 0, 0, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0xffff0000, 0xffff0000 + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff + .word 0x0000ffff, 0x0000ffff IconAp: + /* .word 0x00000000,0x00000000,0x00000000,0x00000000 .word 0x00000000,0x00000000,0x1919ee3c,0x3dbe7fcf .word 0x7ffe60cc,0x67e660cc,0x07c667cc,0x0ffe61cc *************** *** 42,47 **** --- 61,76 ---- .word 0x00000000,0x00000000,0x00000000,0x00000000 .word 0x00000000,0x00000000,0x00000000,0x00000000 .word 0x00000000,0x00000000,0x00000000,0x00000000 + */ + .word 0x00000000,0x00000000,0x00000000,0x00000000 + .word 0x00000000,0x399ef79f,0x4da660cc,0x0da660cc + .word 0x39a667cc,0x619e60cc,0x618e60cc,0x659660cc + .word 0x39a6678c,0x00000000,0x00000000,0xffffffff + .word 0x00000000,0x08000010,0x08f00010,0x08f00010 + .word 0x083c0010,0x083c0010,0x08000010,0x08000010 + .word 0x08c303d0,0x08c303d0,0x0bffcfd0,0x0bffcfd0 + .word 0x0bffffd0,0x0bffffd0,0x08000010,0x0ffffff0 + .byte 1,0 .byte 1,0 *************** *** 61,67 **** */ .globl __gccmain __gccmain: ! mov pc, lr /* * swi --- 90,97 ---- */ .globl __gccmain __gccmain: ! bx lr ! /* * swi *************** *** 74,80 **** .globl sys_handler sys_handler: swi 1 ! mov pc, lr /* * save --- 104,110 ---- .globl sys_handler sys_handler: swi 1 ! bx lr /* * save *************** *** 84,90 **** .globl sys_save sys_save: swi 3 ! mov pc, lr /* * set system clock --- 114,120 ---- .globl sys_save sys_save: swi 3 ! bx lr /* * set system clock *************** *** 93,99 **** .globl sys_clock sys_clock: swi 4 ! mov pc, lr /* * set exec argument --- 123,129 ---- .globl sys_clock sys_clock: swi 4 ! bx lr /* * set exec argument *************** *** 104,110 **** .globl sys_execset sys_execset: swi 8 ! mov pc, lr /* * exec application --- 134,140 ---- .globl sys_execset sys_execset: swi 8 ! bx lr /* * exec application *************** *** 120,126 **** .globl sys_gettime sys_gettime: swi 14 ! mov pc, lr /* * set playstation communicate --- 150,156 ---- .globl sys_gettime sys_gettime: swi 14 ! bx lr /* * set playstation communicate *************** *** 129,135 **** .globl sys_pscomm sys_pscomm: swi 17 ! mov pc, lr /* * get system status --- 159,165 ---- .globl sys_pscomm sys_pscomm: swi 17 ! bx lr /* * get system status *************** *** 138,144 **** sys_status: swi 19 ldr r0, [r0] ! mov pc, lr /* * get application number --- 168,174 ---- sys_status: swi 19 ldr r0, [r0] ! bx lr /* * get application number *************** *** 146,152 **** .globl sys_appnum sys_appnum: swi 22 ! mov pc, lr /* * interrupt handler --- 176,182 ---- .globl sys_appnum sys_appnum: swi 22 ! bx lr /* * interrupt handler diff -c tetris.org/shapes.c tetris.new/shapes.c *** tetris.org/shapes.c Sun Mar 07 23:26:28 1999 --- tetris.new/shapes.c Tue Aug 10 12:39:08 1999 *************** *** 57,81 **** #define BR B_COLS+1 /* bottom right */ struct shape shapes[] = { ! /* 0*/ { 7, { TL, TC, MR, } }, ! /* 1*/ { 8, { TC, TR, ML, } }, ! /* 2*/ { 9, { ML, MR, BC, } }, ! /* 3*/ { 3, { TL, TC, ML, } }, ! /* 4*/ { 12, { ML, BL, MR, } }, ! /* 5*/ { 15, { ML, BR, MR, } }, ! /* 6*/ { 18, { ML, MR, 2 } }, /* sticks out */ ! /* 7*/ { 0, { TC, ML, BL, } }, ! /* 8*/ { 1, { TC, MR, BR, } }, ! /* 9*/ { 10, { TC, MR, BC, } }, ! /*10*/ { 11, { TC, ML, MR, } }, ! /*11*/ { 2, { TC, ML, BC, } }, ! /*12*/ { 13, { TC, BC, BR, } }, ! /*13*/ { 14, { TR, ML, MR, } }, ! /*14*/ { 4, { TL, TC, BC, } }, ! /*15*/ { 16, { TR, TC, BC, } }, ! /*16*/ { 17, { TL, MR, ML, } }, ! /*17*/ { 5, { TC, BC, BL, } }, ! /*18*/ { 6, { TC, BC, 2*B_COLS } } /* sticks out */ }; /* --- 57,81 ---- #define BR B_COLS+1 /* bottom right */ struct shape shapes[] = { ! /* 0*/ { 7, { ML, BC, BR, 0} }, /* murasaki */ ! /* 1*/ { 8, { BC, MR, BL, 0} }, /* green */ ! /* 2*/ { 9, { ML, MR, BC, 0} }, ! /* 3*/ { 3, { BL, BC, ML, 0} }, ! /* 4*/ { 12, { ML, BL, MR, 0} }, ! /* 5*/ { 15, { ML, BR, MR, 0} }, ! /* 6*/ { 18, { ML, MR, -2, 0} }, /* sticks out */ ! /* 7*/ { 0, { TR, MR, BC, 0} }, /* murasaki */ ! /* 8*/ { 1, { TL, ML, BC, 0} }, /* green */ ! /* 9*/ { 10, { TC, MR, BC, 0} }, ! /*10*/ { 11, { BC, BL, BR, 0} }, ! /*11*/ { 2, { TC, ML, BC, 0} }, ! /*12*/ { 13, { TC, BC, BR, 0} }, ! /*13*/ { 14, { MR, BL, BR, BC} }, ! /*14*/ { 4, { TL, TC, BC, 0} }, ! /*15*/ { 16, { TR, TC, BC, 0} }, ! /*16*/ { 17, { ML, BR, BL, BC} }, ! /*17*/ { 5, { TC, BC, BL, 0} }, ! /*18*/ { 6, { TC, BC, 2*B_COLS, 0} } /* sticks out */ }; /* *************** *** 89,95 **** { register int *o = shape->off; ! if (board[pos] || board[pos + *o++] || board[pos + *o++] || board[pos + *o]) return 0; return 1; --- 89,95 ---- { register int *o = shape->off; ! if (board[pos + *o++] || board[pos + *o++] || board[pos + *o++] || board[pos + *o]) return 0; return 1; *************** *** 106,112 **** { register int *o = shape->off; ! board[pos] = onoff; board[pos + *o++] = onoff; board[pos + *o++] = onoff; board[pos + *o] = onoff; --- 106,112 ---- { register int *o = shape->off; ! board[pos + *o++] = onoff; board[pos + *o++] = onoff; board[pos + *o++] = onoff; board[pos + *o] = onoff; diff -c tetris.org/tetris.c tetris.new/tetris.c *** tetris.org/tetris.c Fri Apr 02 23:30:18 1999 --- tetris.new/tetris.c Fri Aug 13 01:52:50 1999 *************** *** 95,133 **** /* * Elide any full active rows. */ ! static int ! elide() { ! int i, j, base, ln; cell *p; ln = 0; for (i = ROW_FIRST + 1; i <= ROW_LAST; i++) { base = i * B_COLS + COL_FIRST; p = &board[base]; ! for (j = COL_LENGTH; *p++ != 0;) { ! if (--j <= 0) { /* this row is to be elided */ ! int k; ! ln++; ! memset(&board[base], 0, COL_LENGTH); ! vsync_wait(); ! scr_write(); ! for (k = 0; k < 2; k++) ! vsync_wait(); ! ! for (k = i; k >= ROW_FIRST; k--) { ! memcpy(&board[k * B_COLS + COL_FIRST], ! &board[(k - 1) * B_COLS + COL_FIRST], ! COL_LENGTH); ! } ! break; } } } ! return (ln); } /* --- 95,137 ---- /* * Elide any full active rows. */ ! static int elide() { ! static int i, j, base, ln, k; cell *p; + static int by[4]; /* elide される y 座標 */ + ln = 0; for (i = ROW_FIRST + 1; i <= ROW_LAST; i++) { base = i * B_COLS + COL_FIRST; p = &board[base]; ! for (j = 0, k = 0; j < COL_LENGTH; j++) { ! if (*(p++)) k++; ! } ! if (k == 10) { /* this row is to be elided */ ! by[ln] = i; ! memset(&board[base], 0, COL_LENGTH); ! ln++; ! } ! } ! if (ln) { ! for (k = 0; k < 10; k++) { ! scr_write(); ! vsync_wait(); ! } ! for (i = 0; i < ln; i++) { ! for (k = by[i]; k >= ROW_FIRST; k--) { ! memcpy(&board[k * B_COLS + COL_FIRST], ! &board[(k - 1) * B_COLS + COL_FIRST], ! COL_LENGTH); } } } ! return ln; } /* *************** *** 164,175 **** return (pad); } int main(argc, argv) ! int argc; ! char *argv[]; { ! static int pos, l, ln; static int fallcount, stopflag, stopcount; static int ostatus, status, bcount, rcount, lcount; static int next_block; --- 168,190 ---- return (pad); } + #if 1 + int fallcount0(int level) { + static int fctable[16] = { + 60, 30, 20, 10, 8, 6, 4, 3, 2, + 20, 10, 6, 4, 2, 1}; + /* if (level >= 30) return (level & 1);*/ + if (level >= 15) return 0; + else return fctable[level - 1] - 1; + } + #endif + int main(argc, argv) ! int argc; ! char *argv[]; { ! static int pos, l, ln, i; static int fallcount, stopflag, stopcount; static int ostatus, status, bcount, rcount, lcount; static int next_block; *************** *** 177,183 **** /* * for bianero ! */ *(volatile int *)0x200 = 0; *(volatile char *)0x200 = 'B'; *(volatile char *)0x201 = 'N'; --- 192,198 ---- /* * for bianero ! v */ *(volatile int *)0x200 = 0; *(volatile char *)0x200 = 'B'; *(volatile char *)0x201 = 'N'; *************** *** 202,210 **** score = 0; bcount = rcount = lcount = 0; ! fallcount = 32 / level; stopflag = stopcount = 0; ! ostatus = padread(); for (;;) { place(curshape, pos, 1); --- 217,225 ---- score = 0; bcount = rcount = lcount = 0; ! fallcount = fallcount0(level); stopflag = stopcount = 0; ! status = padread(); for (;;) { place(curshape, pos, 1); *************** *** 218,225 **** bcount++; else bcount = 0; ! if (bcount >= 32 * 3) cont_exit(); scr_write(); place(curshape, pos, 0); --- 233,242 ---- bcount++; else bcount = 0; ! if (bcount >= 32 * 3) { cont_exit(); + bcount = 0; + } scr_write(); place(curshape, pos, 0); *************** *** 230,243 **** */ if (fits_in(curshape, pos + B_COLS)) { pos += B_COLS; ! fallcount = 32 / level; goto next; } if (stopflag == 0) { stopflag++; ! fallcount = 32 / level; stopcount = 10; goto next; } else { if (--stopcount > 0) --- 247,267 ---- */ if (fits_in(curshape, pos + B_COLS)) { pos += B_COLS; ! fallcount = fallcount0(level); ! #if 1 ! stopcount = 30; ! #endif goto next; } if (stopflag == 0) { stopflag++; ! fallcount = fallcount0(level); ! #if 0 stopcount = 10; + #else + stopcount = 30; + #endif goto next; } else { if (--stopcount > 0) *************** *** 251,268 **** */ place(curshape, pos, 1); l = elide(); score += (l * l * 10 * level); line += l; ln += l; if (ln >= 10) { level++; ln -= 10; } ! /* * Choose a new shape. If it does not fit, * the game is over. */ place(nextshape, 8 * B_COLS + 25, 0); curshape = &shapes[next_block]; --- 275,309 ---- */ place(curshape, pos, 1); l = elide(); + #if 0 score += (l * l * 10 * level); + #else + { + static int stab[5] = {0, 100,400,900,2000}; + if (level > 10) score += stab[l] * 5; + else score += stab[l] * ((level + 1) / 2); + } + #endif line += l; ln += l; + #if 0 if (ln >= 10) { level++; ln -= 10; } ! #else ! if (ln >= 4) level++, ln = 0; ! #endif /* * Choose a new shape. If it does not fit, * the game is over. */ + #if 1 + for (i = 0; i < 10; i++) vsync_wait(); + status = padread(); + if (status & 4) lcount = 10; + if (status & 2) rcount = 10; + #endif place(nextshape, 8 * B_COLS + 25, 0); curshape = &shapes[next_block]; *************** *** 280,296 **** } next: ! if (status & (1 << 1)) { rcount++; if (rcount > 5) { ostatus &= ~(1 << 1); } } else { rcount = 0; } ! if (status & (1 << 2)) { lcount++; if (lcount > 5) { ostatus &= ~(1 << 2); } } else { --- 321,345 ---- } next: ! if (status & 2) { rcount++; + #if 0 if (rcount > 5) { + #else + if (rcount > 10) { + #endif ostatus &= ~(1 << 1); } } else { rcount = 0; } ! if (status & 4) { lcount++; + #if 0 if (lcount > 5) { + #else + if (lcount > 10) { + #endif ostatus &= ~(1 << 2); } } else { *************** *** 301,324 **** ostatus = status; status &= ~(l & 7); ! if (status & (1 << 2)) { /* move left */ if (fits_in(curshape, pos - 1)) pos--; } ! if (status & (1 << 0)) { /* turn */ struct shape *new = &shapes[curshape->rot]; if (fits_in(new, pos)) curshape = new; } ! if (status & (1 << 1)) { /* move right */ if (fits_in(curshape, pos + 1)) pos++; } ! if (status & (1 << 3)) { fallcount = 0; stopcount = 0; score++; --- 350,373 ---- ostatus = status; status &= ~(l & 7); ! if (status & 4) { /* move left */ if (fits_in(curshape, pos - 1)) pos--; } ! if (status & 1) { /* turn */ struct shape *new = &shapes[curshape->rot]; if (fits_in(new, pos)) curshape = new; } ! if (status & 2) { /* move right */ if (fits_in(curshape, pos + 1)) pos++; } ! if (status & 8) { fallcount = 0; stopcount = 0; score++; *************** *** 403,412 **** lv = 1; } if (status & ((1 << 1) | (1 << 3))) { if (++lv > 32) lv = 32; } - printnumber(23, 23, 0); printnumber(27, 23, lv); } --- 452,463 ---- lv = 1; } if (status & ((1 << 1) | (1 << 3))) { + #if 0 if (++lv > 32) lv = 32; + #endif + if (++lv > 15) lv = 15; } printnumber(23, 23, 0); printnumber(27, 23, lv); } diff -c tetris.org/tetris.h tetris.new/tetris.h *** tetris.org/tetris.h Wed Mar 24 00:12:16 1999 --- tetris.new/tetris.h Tue Aug 10 12:35:32 1999 *************** *** 109,115 **** */ struct shape { int rot; /* index of rotated version of this shape */ ! int off[3]; /* offsets to other blots if center is at (0,0) */ }; extern struct shape shapes[]; --- 109,115 ---- */ struct shape { int rot; /* index of rotated version of this shape */ ! int off[4]; /* offsets to other blots if center is at (0,0) */ }; extern struct shape shapes[];