level 4
二楼贴出代码
stack segment para stack 'stack'
dw 100 dup ( 0 )
stack ends
code segment
assume ds:code,cs:code,ss:stack
time db 0, 0
count db 0
correct db 0 ;代码段和数据段写在一起,方便调用
int_start: ;驻留程序入口
push ax
push bx
push cx
push dx
cmp count,18 ;利用1ch中断实现每秒输出一个字符
jne exit
mov count,0
cmp time[0],-8 ;测试time[0]的值
jne exit
mov ah,0eh ;输出time[0]对应的数字(根据初始化应该是0才对)
mov al,time[0]
add al,48
mov bl,0
int 10h
exit:
inc count
pop dx
pop cx
pop bx
pop ax
iret ;驻留程序返回
start:
mov ax,code
mov ds,ax ;数据初始化
mov sp,200 ;堆栈指针初始化
mov dx,offset int_start
mov ax,0251ch
int 21h ;设置中断向量
mov dx,start-int_start
mov cl,4
shr dx,cl
add dx,11h
mov ah,31h
int 21h ;驻留退出
code ends
end start
2014年06月11日 22点06分
