΢»úÔ­ÀíÈ«²¿ÊµÑé ÏÂÔر¾ÎÄ

¼ÆËã»úÔ­ÀíʵÑéÊÒʵÑ鱨¸æ ¶þ£®ÀíÂÛ·ÖÎö»òËã·¨·ÖÎö ÎÄ×ÖÃèÊöÒÔ¼°Ëã·¨Á÷³Ìͼ(ÎÄ×ÖÖ÷ÒªÃèÊö»ù±¾ÒªÇóºÍÀ©Õ¹ÒªÇóµÄËã·¨Á÷³ÌÇø±ð)

¼ÆËã»úÔ­ÀíʵÑéÊÒʵÑ鱨¸æ Èý£®ÊµÏÖ·½·¨£¨º¬ÊµÏÖ˼·¡¢³ÌÐòÁ÷³Ìͼ¡¢ÊµÑéµç·ͼºÍÔ´³ÌÐòÁбíµÈ£© »ù±¾ÒªÇóÔ´´úÂë, À©Õ¹ÒªÇó¹Ø¼ü´úÂë #start=Traffic_Lights.exe# name \ mov ax, all_red out 4, ax mov si, offset situation xor bx, bx ; ÐÂÔö±êÖ¾ next: mov ax, [si] out 4, ax xor bl, bl OR bl, bh ;switch(bl) jnz jd1 ; case 0: s0 ; wait 1 seconds (1 million microseconds) mov cx, 0fh ; 004f4240h = 1,000,000 mov dx, 4240h jmp short jde ; break; jd1: dec bl jnz jd2 ; case 1: s1 ; wait 1 seconds (1 million microseconds) mov cx, 0fh ; 004f4240h = 1,000,000 mov dx, 4240h jmp short jde ; break; jd2: dec bl jnz jd3 ; case 2: s2 ; wait 10 seconds (10 million microseconds) mov cx, 98h ; 00989680h = 10,000,000 mov dx, 9680h jmp short jde ; break; jd3: dec bl jnz jd4 ; case 3: s3 ; wait 5 seconds (5 million microseconds) mov cx, 98h ; 00989680h = 10,000,000 mov dx, 9680h ¼ÆËã»úÔ­ÀíʵÑéÊÒʵÑ鱨¸æ jmp short jde ; break; jd4: dec bl mov bh, -1 ; default: case 4: s4 ; wait 5 seconds (5 million microseconds) mov cx, 98h ; 00989680h = 10,000,000 mov dx, 9680h jde: inc bh ;end switch mov ah, 86h int 15h add si, 2 cmp si, sit_end jb next mov si, offset situation jmp next situation dw 0000_0011_0000_1100b;ÉÏÏÂÂÌ,×óÓÒºì CASEO s1 dw 0000_0110_1001_1010b;ÉÏÏ»Æ,×óÓһƺìCASE1 s2 dw 0000_1000_0110_0001b;ÉÏϺì,×óÓÒÂÌ CASE2 s3 dw 0000_1000_0110_0001b;ÉÏϺì,×óÓÒÂÌCASE3 s4 dw 0000_0100_1101_0011b;ÉÏϺì»Æ,×óÓÒ»ÆCASE4 sit_end = $ all_red equ 0000_0010_0100_1001b ËÄ£®ÊµÑé½á¹û·ÖÎö£¨º¬Ö´Ðнá¹ûÑéÖ¤¡¢Êä³öÏÔʾÐÅÏ¢¡¢Í¼ÐΡ¢µ÷ÊÔ¹ý³ÌÖÐËùÓöµÄÎÊÌâ¼°´¦Àí·½·¨µÈ£© ¼ÆËã»úÔ­ÀíʵÑéÊÒʵÑ鱨¸æ Î壮½áÂÛ Íê³ÉÁ˱¾´ÎʵÑéÒªÇóµÄ8255½»Í¨µÆʵÑéÄÚÈÝ£¬ÊµÏÖÁ˶¡×Ö·¿Ú½»Í¨µÆµÄת»»¡£