Compile and simulate a Snake game [bug manufacturing expert]

Source: Internet
Author: User
Tags mul

As the title says, this is a bug manufacturing expert. The program is not only a simple, ugly program, but also a bug.

 

assume cs:code,ss:stack,ds:datastack segment    db 64 dup (0)stack endsdata segment data endscode segment    show_arr:cli             mov ax,0b800h             mov es,ax                          mov bx,0             mov cx,4000             mov ax,0000001000000000b          s: mov es:[bx],ax             inc bx             inc bx             loop s                          mov bx,0             mov cx,80             mov dl,'-'             mov ax,0        line:mov bx,ax             add bx,ax             mov es:[bx],dl             mov es:[bx+24*160],dl             inc ax             loop line                          mov bx,0             mov cx,25             mov dl,'|'             mov di,0        col: mov bx,di             mov al,160             mul bl             mov bx,ax             mov es:[bx],dl             mov es:[bx+158],dl             inc di             loop col                snak_body:jmp snak           trend dw +2,+2,-160,-2,+160                                     snak:mov dl,'*'             mov si,16*160+24*2             mov bx,si             mov cx,4             mov ax,0             mov ax,trend[0]     snak_0: add bx,ax             mov es:[bx],dl             loop snak_0                          push bx             mov bx,160*8+2*56             mov byte ptr es:[bx],'

Pop BX mov ax, trend [2] STI move: Add Bx, trend [0] CMP byte ptr es: [BX], '| 'Je over CMP byte ptr es: [BX], '-'Je over CMP byte ptr es: [BX],' * 'Je over CMP byte ptr es: [BX],'
Je set_money MAID: Call timelag mov es: [BX], DL Add Si, ax CMP byte ptr es: [Si], '*' JNE cls_snk_chg cls_snk: moV byte ptr es: [Si], 0 JMP move cls_snk_chg: Sub Si, ax mov ax, 2 Add Si, ax CMP byte ptr es: [Si], '* 'Je cls_snk sub Si, ax mov ax,-2 add
Si, ax CMP byte ptr es: [Si], '*' je cls_snk sub Si, ax mov ax,-160 Add Si, ax CMP byte ptr es: [Si], '* 'Je cls_snk sub Si, ax mov ax, 160 Add Si, ax CMP byte ptr es: [Si],' * 'Je cls_snk timelag: Push bx push ax mov BX, 09ffh fr_1: Dec BX mov ax, 0 ffffh fr_2: Dec ax
CMP ax, 0 JNE fr_2 cmp bx, 0 JNE fr_1 pop ax pop bx ret over: JMP show_over over_show dB 'game over! ', 0 set_money: mov ES: [BX], DL Add Bx, trend [0] push ax push BX push CX push DX mov ah, 02 int 1ah mov Al, DH mov ah, 0 mov DH, 79 Div DH Inc Ah mov Al, Ah mov DH, 2 MUL
DH mov BX, ax call timelag mov ah, 02 h int 1ah mov Al, DH mov ah, 0 mov DH, 23 Div DH Inc Ah mov Al, Ah mov DH, 160 Mul DH Add Bx, ax mov byte ptr es: [BX],'
Pop DX pop CX pop BX pop ax JMP mov_snk show_over: mov BX, 12*160 + 30*2 mov ax, 0 mov Di, 0 f_show: mov Al, over_show [di] CMP Al, 0 je over_show_end mov ES: [BX], Al Inc di Add Bx, 2 JMP f_show over_show_end: mov ax, 0 mov ds, ax mov ax, DS: [200 h] mov DS: [4*9], ax mov
Ax, DS: [202 h] mov DS: [4*9 + 2], ax mov ax, 4c00h int 21 h int_9: push ax push bx push ds in Al, 60 h pushf mov BX, 0 mov ds, BX call dword ptr ds: [200 h] CMP Al, 4dh je life CMP Al, 48 h je up CMP Al, 4bh je right CMP Al, 50 h je down JMP int_9end life: mov ax, trend [2] mov
Trend [0], ax JMP int_9end up: mov ax, trend [4] mov trend [0], ax JMP int_9end right: mov ax, trend [6] mov trend [0], ax JMP int_9end down: mov ax, trend [8] mov trend, ax JMP int_9end int_9end: Pop DS pop BX pop ax iret start: CLI mov ax, 0 mov ds, ax mov ax, DS: [4*9] mov
DS: [200 h], ax mov ax, DS: [4*9 + 2] mov DS: [202 h], ax mov ax, CS mov word ptr ds: [4*9], offset int_9 mov word ptr ds: [4*9 + 2], ax call show_arrcode endsend start

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.