交通灯控制模拟程序设计
;*************定义数据段***********************************************
data segment
title1 db 'Traffic-System'
deng db '# # #'
sing1 db 'South-North'
sing2 db 'East - West'
sing3 db 'Red time(scend):'
time db 'Time:'
sing4 db 'Yellow time(scend):'
buff db 4 ;键盘缓冲区
buff1 db 3 dup(?) ;工作计数区
buff2 db 3 dup(?) ;数据保存区
yellow db ? ;黄灯时间
mode db 'Mode:auto(Y/N)?:'
ans db ?
ting3 db 'Red time(scend):030'
ting4 db 'Yellow time(scend):5'
;************************主程序段**********************************************
data ends
code segment
assume cs:code,ds:data,es:data
start:mov ax,data
mov ds,ax
mov es,ax
call title2 ;初始化标题
q0: call mode1 ;模式选择 自动或手动
call scanf
call atuo ; 默认设置参数启动
lea si,ans
cmp byte ptr[si],'y'
jz q1
cmp byte ptr[si],'n'
jnz q0
call ask1 ;设置红灯时间
call scanf0
call ask2 ;设置黄灯时间