📄 tetris.lst
字号:
40000661: 6a 20 push $0x20
40000663: 68 f1 04 00 40 push $0x400004f1
40000668: e8 43 02 00 00 call 400008b0 <_printf>
tetris.c:372
printf("\x1B[9;%dH"" ", SCN_WID * 2 + 2);
4000066d: 83 c4 20 add $0x20,%esp
40000670: 83 c4 f8 add $0xfffffff8,%esp
40000673: 6a 20 push $0x20
40000675: 68 0f 05 00 40 push $0x4000050f
4000067a: e8 31 02 00 00 call 400008b0 <_printf>
tetris.c:373
init_screen();
4000067f: e8 3c fb ff ff call 400001c0 <_init_screen>
tetris.c:374
goto FOO;
40000684: e9 3f 01 00 00 jmp 400007c8 <_NEW+0x199>
40000689: 8d b4 26 00 00 00 00 lea 0x0(%esi,1),%esi
tetris.c:379
while(1)
{
fell = 0;
new_shape = shape;
40000690: 8a 45 fa mov 0xfffffffa(%ebp),%al
40000693: 88 45 fd mov %al,0xfffffffd(%ebp)
tetris.c:380
new_x = x;
40000696: 8a 45 f9 mov 0xfffffff9(%ebp),%al
40000699: 88 45 fc mov %al,0xfffffffc(%ebp)
tetris.c:381
new_y = y;
4000069c: 8a 45 f8 mov 0xfffffff8(%ebp),%al
4000069f: 88 45 fb mov %al,0xfffffffb(%ebp)
tetris.c:382
key = get_key();
400006a2: e8 2d fd ff ff call 400003d4 <_get_key>
400006a7: 88 c2 mov %al,%dl
400006a9: 88 55 ff mov %dl,0xffffffff(%ebp)
tetris.c:383
if(key == 0)
400006ac: 84 c0 test %al,%al
400006ae: 75 11 jne 400006c1 <_NEW+0x92>
tetris.c:385
{
new_y++;
400006b0: 8a 45 f8 mov 0xfffffff8(%ebp),%al
400006b3: fe c0 inc %al
400006b5: 88 45 fb mov %al,0xfffffffb(%ebp)
tetris.c:386
fell = 1;
400006b8: c6 45 fe 01 movb $0x1,0xfffffffe(%ebp)
tetris.c:387
}
400006bc: e9 86 00 00 00 jmp 40000747 <_NEW+0x118>
tetris.c:390
else
{
if(key == 'q' || key == 'Q' || key == 27)
400006c1: 3c 71 cmp $0x71,%al
400006c3: 0f 84 a1 01 00 00 je 4000086a <_FIN>
400006c9: 3c 51 cmp $0x51,%al
400006cb: 0f 84 99 01 00 00 je 4000086a <_FIN>
400006d1: 3c 1b cmp $0x1b,%al
400006d3: 0f 84 91 01 00 00 je 4000086a <_FIN>
tetris.c:393
//break;
goto FIN;
if(key == '1')
400006d9: 3c 31 cmp $0x31,%al
400006db: 75 13 jne 400006f0 <_NEW+0xc1>
tetris.c:394
new_shape = _shapes[shape].plus_90;
400006dd: 8d 04 bf lea (%edi,%edi,4),%eax
400006e0: 8a 04 85 00 10 00 40 mov 0x40001000(,%eax,4),%al
400006e7: 88 45 fd mov %al,0xfffffffd(%ebp)
400006ea: eb 57 jmp 40000743 <_NEW+0x114>
400006ec: 8d 74 26 00 lea 0x0(%esi,1),%esi
tetris.c:395
else if(key == '2')
400006f0: 3c 32 cmp $0x32,%al
400006f2: 75 0f jne 40000703 <_NEW+0xd4>
tetris.c:396
new_shape = _shapes[shape].minus_90;
400006f4: 8d 04 bf lea (%edi,%edi,4),%eax
400006f7: 8a 04 85 01 10 00 40 mov 0x40001001(,%eax,4),%al
400006fe: 88 45 fd mov %al,0xfffffffd(%ebp)
40000701: eb 40 jmp 40000743 <_NEW+0x114>
tetris.c:397
else if(key == KEY_LFT)
40000703: 3c 96 cmp $0x96,%al
40000705: 75 10 jne 40000717 <_NEW+0xe8>
tetris.c:399
{
if(x > 0)
40000707: 80 7d f9 00 cmpb $0x0,0xfffffff9(%ebp)
4000070b: 74 36 je 40000743 <_NEW+0x114>
tetris.c:400
new_x = x - 1;
4000070d: 8a 45 f9 mov 0xfffffff9(%ebp),%al
40000710: fe c8 dec %al
40000712: 88 45 fc mov %al,0xfffffffc(%ebp)
tetris.c:401
}
40000715: eb 2c jmp 40000743 <_NEW+0x114>
tetris.c:402
else if(key == KEY_RT)
40000717: 3c 99 cmp $0x99,%al
40000719: 75 15 jne 40000730 <_NEW+0x101>
tetris.c:404
{
if(x < SCN_WID - 1)
4000071b: 80 7d f9 0d cmpb $0xd,0xfffffff9(%ebp)
4000071f: 77 22 ja 40000743 <_NEW+0x114>
tetris.c:405
new_x = x + 1;
40000721: 8a 45 f9 mov 0xfffffff9(%ebp),%al
40000724: fe c0 inc %al
40000726: 88 45 fc mov %al,0xfffffffc(%ebp)
tetris.c:406
}
40000729: eb 18 jmp 40000743 <_NEW+0x114>
4000072b: 90 nop
4000072c: 8d 74 26 00 lea 0x0(%esi,1),%esi
tetris.c:412
/* else if(key == KEY_UP)
{
if(y > 0)
new_y = y - 1; cheat
} */
else if(key == KEY_DN)
40000730: 80 fa 98 cmp $0x98,%dl
40000733: 75 0e jne 40000743 <_NEW+0x114>
tetris.c:414
{
if(y < SCN_HT - 1)
40000735: 80 7d f8 12 cmpb $0x12,0xfffffff8(%ebp)
40000739: 77 08 ja 40000743 <_NEW+0x114>
tetris.c:415
new_y = y + 1;
4000073b: 8a 45 f8 mov 0xfffffff8(%ebp),%al
4000073e: fe c0 inc %al
40000740: 88 45 fb mov %al,0xfffffffb(%ebp)
tetris.c:417
}
fell = 0;
40000743: c6 45 fe 00 movb $0x0,0xfffffffe(%ebp)
tetris.c:420
}
/* if nothing has changed, skip the bottom half of this loop */
if(new_x == x && new_y == y && new_shape == shape)
40000747: 8a 45 fc mov 0xfffffffc(%ebp),%al
4000074a: 3a 45 f9 cmp 0xfffffff9(%ebp),%al
4000074d: 75 14 jne 40000763 <_NEW+0x134>
4000074f: 8a 45 fb mov 0xfffffffb(%ebp),%al
40000752: 3a 45 f8 cmp 0xfffffff8(%ebp),%al
40000755: 75 0c jne 40000763 <_NEW+0x134>
40000757: 8a 45 fd mov 0xfffffffd(%ebp),%al
4000075a: 3a 45 fa cmp 0xfffffffa(%ebp),%al
4000075d: 0f 84 2d ff ff ff je 40000690 <_NEW+0x61>
tetris.c:423
continue;
/* otherwise, erase old shape from the old pos'n */
erase_shape(x, y, shape);
40000763: 83 c4 fc add $0xfffffffc,%esp
40000766: 31 db xor %ebx,%ebx
40000768: 8a 5d fa mov 0xfffffffa(%ebp),%bl
4000076b: 53 push %ebx
4000076c: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
4000076f: 50 push %eax
40000770: 56 push %esi
40000771: e8 72 f9 ff ff call 400000e8 <_erase_shape>
tetris.c:425
/* hit anything? */
if(detect_shape_hit(new_x, new_y, new_shape) == 0)
40000776: 83 c4 fc add $0xfffffffc,%esp
40000779: 31 c0 xor %eax,%eax
4000077b: 8a 45 fd mov 0xfffffffd(%ebp),%al
4000077e: 50 push %eax
4000077f: 31 c0 xor %eax,%eax
40000781: 8a 45 fb mov 0xfffffffb(%ebp),%al
40000784: 50 push %eax
40000785: 31 c0 xor %eax,%eax
40000787: 8a 45 fc mov 0xfffffffc(%ebp),%al
4000078a: 50 push %eax
4000078b: e8 c4 f9 ff ff call 40000154 <_detect_shape_hit>
40000790: 83 c4 20 add $0x20,%esp
40000793: 85 c0 test %eax,%eax
40000795: 75 19 jne 400007b0 <_NEW+0x181>
tetris.c:428
{
/* no, update pos'n */
x = new_x;
40000797: 8a 45 fc mov 0xfffffffc(%ebp),%al
4000079a: 88 45 f9 mov %al,0xfffffff9(%ebp)
tetris.c:429
y = new_y;
4000079d: 8a 45 fb mov 0xfffffffb(%ebp),%al
400007a0: 88 45 f8 mov %al,0xfffffff8(%ebp)
tetris.c:430
shape = new_shape;
400007a3: 8a 45 fd mov 0xfffffffd(%ebp),%al
400007a6: 88 45 fa mov %al,0xfffffffa(%ebp)
tetris.c:431
}
400007a9: e9 d3 00 00 00 jmp 40000881 <_FIN+0x17>
400007ae: 89 f6 mov %esi,%esi
tetris.c:433
/* yes -- did the piece hit something while falling on its own? */
else if(fell)
400007b0: 80 7d fe 00 cmpb $0x0,0xfffffffe(%ebp)
400007b4: 0f 84 c7 00 00 00 je 40000881 <_FIN+0x17>
tetris.c:436
{
/* yes, draw it at the old pos'n... */
draw_shape(x, y, shape);
400007ba: 83 c4 fc add $0xfffffffc,%esp
400007bd: 53 push %ebx
400007be: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
400007c1: 50 push %eax
400007c2: 56 push %esi
400007c3: e8 90 f8 ff ff call 40000058 <_draw_shape>
400007c8: 83 c4 10 add $0x10,%esp
tetris.c:438
/* ... and spawn new shape */
FOO: y = 3;
400007cb: c6 45 f8 03 movb $0x3,0xfffffff8(%ebp)
tetris.c:439
x = SCN_WID / 2;
400007cf: c6 45 f9 07 movb $0x7,0xfffffff9(%ebp)
tetris.c:440
shape = rand();
400007d3: e8 d8 01 00 00 call 400009b0 <_rand>
400007d8: 88 45 fa mov %al,0xfffffffa(%ebp)
tetris.c:442
/* debug to get rid of "invisible" (black) shapes */
printf("\x1B[24;0H""shape=%d, shape%%19=%d ", shape, shape % 19);
400007db: 83 c4 fc add $0xfffffffc,%esp
400007de: 31 d2 xor %edx,%edx
400007e0: 88 c2 mov %al,%dl
400007e2: 8d 04 12 lea (%edx,%edx,1),%eax
400007e5: 01 d0 add %edx,%eax
400007e7: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
400007ee: 01 d0 add %edx,%eax
400007f0: 66 c1 e8 08 shr $0x8,%ax
400007f4: 88 c2 mov %al,%dl
400007f6: c0 ea 01 shr $0x1,%dl
400007f9: 8d 04 d5 00 00 00 00 lea 0x0(,%edx,8),%eax
40000800: 00 d0 add %dl,%al
40000802: 00 c0 add %al,%al
40000804: 00 d0 add %dl,%al
40000806: 8a 5d fa mov 0xfffffffa(%ebp),%bl
40000809: 28 c3 sub %al,%bl
4000080b: 31 c0 xor %eax,%eax
4000080d: 88 d8 mov %bl,%al
4000080f: 50 push %eax
40000810: 31 c0 xor %eax,%eax
40000812: 8a 45 fa mov 0xfffffffa(%ebp),%al
40000815: 50 push %eax
40000816: 68 40 05 00 40 push $0x40000540
4000081b: e8 90 00 00 00 call 400008b0 <_printf>
tetris.c:443
shape %= 19;
40000820: 88 5d fa mov %bl,0xfffffffa(%ebp)
tetris.c:444
if(shape > 18) { shape = 18; printf("too big! "); }
40000823: 83 c4 10 add $0x10,%esp
40000826: 80 fb 12 cmp $0x12,%bl
40000829: 76 14 jbe 4000083f <_NEW+0x210>
4000082b: c6 45 fa 12 movb $0x12,0xfffffffa(%ebp)
4000082f: 83 c4 f4 add $0xfffffff4,%esp
40000832: 68 61 05 00 40 push $0x40000561
40000837: e8 74 00 00 00 call 400008b0 <_printf>
4000083c: 83 c4 10 add $0x10,%esp
tetris.c:445
fflush(stdout);
4000083f: 83 c4 f4 add $0xfffffff4,%esp
40000842: 68 98 11 00 40 push $0x40001198
40000847: e8 84 00 00 00 call 400008d0 <_fflush>
tetris.c:446
collapse();
4000084c: e8 7b fa ff ff call 400002cc <_collapse>
tetris.c:448
/* if newly spawned shape hits something, game over */
if(detect_shape_hit(x, y, shape))
40000851: 83 c4 fc add $0xfffffffc,%esp
40000854: 31 c0 xor %eax,%eax
40000856: 8a 45 fa mov 0xfffffffa(%ebp),%al
40000859: 50 push %eax
4000085a: 6a 03 push $0x3
4000085c: 6a 07 push $0x7
4000085e: e8 f1 f8 ff ff call 40000154 <_detect_shape_hit>
40000863: 83 c4 20 add $0x20,%esp
40000866: 85 c0 test %eax,%eax
40000868: 74 17 je 40000881 <_FIN+0x17>
4000086a <_FIN>:
tetris.c:450
FIN: {
printf("\x1B[8;%dH""\x1B[37;40;1m"
4000086a: 83 c4 f8 add $0xfffffff8,%esp
4000086d: 6a 20 push $0x20
4000086f: 68 80 05 00 40 push $0x40000580
40000874: e8 37 00 00 00 call 400008b0 <_printf>
tetris.c:453
" GAME OVER""\x1B[0m",
SCN_WID * 2 + 2);
goto NEW;
40000879: 83 c4 10 add $0x10,%esp
4000087c: e9 ae fd ff ff jmp 4000062f <_NEW>
tetris.c:457
}
}
/* hit something because of user movement/rotate OR no hit: just redraw it */
draw_shape(x, y, shape);
40000881: 83 c4 fc add $0xfffffffc,%esp
40000884: 0f b6 7d fa movzbl 0xfffffffa(%ebp),%edi
40000888: 57 push %edi
40000889: 0f b6 75 f8 movzbl 0xfffffff8(%ebp),%esi
4000088d: 56 push %esi
4000088e: 31 db xor %ebx,%ebx
40000890: 8a 5d f9 mov 0xfffffff9(%ebp),%bl
40000893: 53 push %ebx
40000894: e8 bf f7 ff ff call 40000058 <_draw_shape>
tetris.c:458
refresh();
40000899: e8 a2 f9 ff ff call 40000240 <_refresh>
tetris.c:459
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -