| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1167 人关注过本帖
标题:[求助]一个系统时间显示程序,小弟新人看不懂
只看楼主 加入收藏
stu_scau
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-5-17
收藏
 问题点数:0 回复次数:1 
[求助]一个系统时间显示程序,小弟新人看不懂

看不懂啊,请牛人帮忙注释一下……
谢谢!
assume cs:code
data segment
dw 0,0
data ends
stack segment
db 128 dup(0)
stack ends

code segment
begin:
mov bx,0
mov ax,0b800h
mov es,ax
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,128
push es
mov ax,0
mov es,ax
push es:[9*4]
pop ds:[0]
push es:[9*4+2]
pop ds:[2]
mov ax,offset int9
cli
mov es:[9*4],ax
mov es:[9*4+2],cs
sti
pop es

mov cx,4000
s: mov es:[di],byte ptr 0
inc di
loop s

mov cx,17
a: mov es:[160*12][2*30+1][bx],byte ptr 1 ;year_h Air
add bx,2
loop a

t: mov bx,0
mov cx,3
mov dh,9
s1: mov al,dh
out 70h,al
dec dh
in al,71h
push cx
mov cl,4
mov dl,al
shr al,cl
add al,30h
mov es:[160*12][2*30][bx],al ;year high byte
and dl,00001111b
add dl,30h
mov es:[160*12+2*30+2][bx],dl ;year low byte
mov es:[160*12][2*30+4][bx],byte ptr '/'
add bx,6
pop cx
loop s1

mov cx,3
mov dh,4
s3: mov al,dh
out 70h,al
in al,71h
mov dl,al
push cx
mov cl,4
shr al,cl
add al,30h
and dl,00001111b
add dl,30h
mov bp,1
mov es:[160*12][2*30][bx],al
mov es:[160*12][2*30][bx].2,dl
mov es:[160*12][2*30][bx].4,byte ptr ':'
add bx,6
sub dh,2
pop cx
loop s3
mov es:[160*12][2*30+4][bx-6].1,byte ptr 0
jmp t

i8: pop es
pop es
pop es
pop bx
pop ax
iret
mov ax,0
mov es,ax
push ds:[0]
pop es:[9*4]
push ds:[2]
pop es:[9*4+2]
mov ax,4c00h
int 21h

int9: push ax
push bx
push es
mov ax,0b800h
mov es,ax
in al,60h

pushf
pushf
pop bx
and bh,11111100b
push bx
popf
call dword ptr ds:[0] ;真INT9例程的返回

cmp al,48h
jne i1
inc byte ptr es:[160*12][2*30+1]
inc byte ptr es:[160*12][2*30+3]
jmp intend

i1: cmp al,4bh
jne i2
inc byte ptr es:[160*12][2*30+7]
inc byte ptr es:[160*12][2*30+9]
jmp intend

i2: cmp al,50h
jne i3
inc byte ptr es:[160*12][2*30+13]
inc byte ptr es:[160*12][2*30+15]
jmp intend

i3: cmp al,4dh
jne i4
inc byte ptr es:[160*12][2*30+19]
inc byte ptr es:[160*12][2*30+21]
jmp intend

i4: cmp al,49h
jne i5
inc byte ptr es:[160*12][2*30+25]
inc byte ptr es:[160*12][2*30+27]
jmp intend

i5: cmp al,51h
jne i6
inc byte ptr es:[160*12][2*30+31]
inc byte ptr es:[160*12][2*30+33]
jmp intend

i6: cmp al,3ah
jne i7
inc byte ptr es:[160*12][2*30+5]
inc byte ptr es:[160*12][2*30+11]
inc byte ptr es:[160*12][2*30+17]
inc byte ptr es:[160*12][2*30+23]
inc byte ptr es:[160*12][2*30+29]
jmp intend

i7: cmp al,01h
jne intend
jmp far ptr i8

intend: pop es
pop bx
pop ax
iret ;假INT9例程的返回

code ends
end begin

搜索更多相关主题的帖子: mov segment 新人 stack 
2007-07-08 21:04
zhulei1978
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:53
帖 子:1351
专家分:1200
注 册:2006-12-17
收藏
得分:0 
以下是引用stu_scau在2007-7-8 21:04:45的发言:

看不懂啊,请牛人帮忙注释一下……
谢谢!
assume cs:code
data segment
dw 0,0
data ends
stack segment
db 128 dup(0)
stack ends

code segment
begin:
mov bx,0
mov ax,0b800h
mov es,ax
mov ax,data
mov ds,ax
mov ax,stack
mov ss,ax
mov sp,128
push es
mov ax,0
mov es,ax
;保存系统9号中断
push es:[9*4]
pop ds:[0]
push es:[9*4+2]
pop ds:[2]
mov ax,offset int9
cli
;用自定义的9号中断取代系统9号中断
mov es:[9*4],ax
mov es:[9*4+2],cs
sti
pop es

mov cx,4000
;将整个屏幕背景色设为黑色
s: mov es:[di],byte ptr 0
inc di
loop s

mov cx,17
;将前景色设为蓝色
a: mov es:[160*12][2*30+1][bx],byte ptr 1 ;year_h Air
add bx,2
loop a

t: mov bx,0
mov cx,3
mov dh,9
;取得年月日并显示
s1: mov al,dh
out 70h,al
dec dh
in al,71h
push cx
mov cl,4
mov dl,al
shr al,cl
add al,30h
mov es:[160*12][2*30][bx],al ;year high byte
and dl,00001111b
add dl,30h
mov es:[160*12+2*30+2][bx],dl ;year low byte
mov es:[160*12][2*30+4][bx],byte ptr '/'
add bx,6
pop cx
loop s1

mov cx,3
mov dh,4
;取得时分秒并显示
s3: mov al,dh
out 70h,al
in al,71h
mov dl,al
push cx
mov cl,4
shr al,cl
add al,30h
and dl,00001111b
add dl,30h
mov bp,1
mov es:[160*12][2*30][bx],al
mov es:[160*12][2*30][bx].2,dl
mov es:[160*12][2*30][bx].4,byte ptr ':'
add bx,6
sub dh,2
pop cx
loop s3
mov es:[160*12][2*30+4][bx-6].1,byte ptr 0
jmp t

i8: pop es
pop es
pop es
pop bx
pop ax
iret
mov ax,0
mov es,ax
;恢复9号中断
push ds:[0]
pop es:[9*4]
push ds:[2]
pop es:[9*4+2]
mov ax,4c00h
int 21h

int9: push ax
push bx
push es
mov ax,0b800h
mov es,ax
in al,60h

pushf
pushf
pop bx
and bh,11111100b
push bx
popf
call dword ptr ds:[0] ;真INT9例程的返回

;如果按下方向键上,改变年的显示属性
cmp al,48h
jne i1
inc byte ptr es:[160*12][2*30+1]
inc byte ptr es:[160*12][2*30+3]
jmp intend

;如果按下方向键左,改变月的显示属性
i1: cmp al,4bh
jne i2
inc byte ptr es:[160*12][2*30+7]
inc byte ptr es:[160*12][2*30+9]
jmp intend

;如果按下方向键下,改变日的显示属性

i2: cmp al,50h
jne i3
inc byte ptr es:[160*12][2*30+13]
inc byte ptr es:[160*12][2*30+15]
jmp intend

;如果按下方向键右,改变时的显示属性

i3: cmp al,4dh
jne i4
inc byte ptr es:[160*12][2*30+19]
inc byte ptr es:[160*12][2*30+21]
jmp intend


;如果按下pageup,改变分的显示属性

i4: cmp al,49h
jne i5
inc byte ptr es:[160*12][2*30+25]
inc byte ptr es:[160*12][2*30+27]
jmp intend


;如果按下pagedown,改变秒的显示属性

i5: cmp al,51h
jne i6
inc byte ptr es:[160*12][2*30+31]
inc byte ptr es:[160*12][2*30+33]
jmp intend


;如果按下capslock,改变间隔符的显示属性

i6: cmp al,3ah
jne i7
inc byte ptr es:[160*12][2*30+5]
inc byte ptr es:[160*12][2*30+11]
inc byte ptr es:[160*12][2*30+17]
inc byte ptr es:[160*12][2*30+23]
inc byte ptr es:[160*12][2*30+29]
jmp intend

i7: cmp al,01h
jne intend
jmp far ptr i8

intend: pop es
pop bx
pop ax
iret ;假INT9例程的返回

code ends
end begin


其实我就是改变社会风气,提高少女素质,刺激电影市道,提高年轻人内涵,玉树临风,风度翩翩的整蛊专家,我名叫古晶,英文名叫JingKoo!
2007-07-21 13:48
快速回复:[求助]一个系统时间显示程序,小弟新人看不懂
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022239 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved