⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 time.asm

📁 汇编时钟代码,实现定时器简单功能,可作基本命令使用例子
💻 ASM
字号:
.model	small
.data
now	db 'system time now is:$'
set	db 'set system time:$'
hour	db 'get the hour:$'
minute db 'get the minute:$'
second db 'get the second:$'
temp	db	?
.stack 100h
.code
start:
mov	ax,@data
mov	ds,ax
call	distime
call	settime
call	distime
exit:
mov	ah,4ch
int	21h

newline proc	;format display
mov dl,0ah
mov ah,02h
int 21h
mov dl,0dh
mov ah,02h
int 21h
ret
newline endp

distime proc
lea	dx,now
mov	ah,9h
int	21h
mov	ah,2ch		;get system time
int	21h
mov	temp,cl
mov	al,ch
mov	bl,al
mov	cl,10d
call	bind
mov	cl,1d
call	bind
mov	dl,':'
mov	ah,02h
int	21h
mov	cl,temp
mov	al,cl
mov	bl,al
mov	cl,10d
call bind
mov	cl,1d
call	bind
mov	dl,':'
mov	ah,02h
int	21h
mov	al,dh
mov	bl,al
mov	cl,10d
call	bind
mov	cl,1d
call	bind
call	newline
ret
distime endp

settime	proc
lea	dx,set
mov	ah,9h
int	21h
lea	dx,hour	;input hour
mov	ah,9h
int	21h
mov	ah,01h
int 	21h
sub 	al,30h
mov 	bl,10d
mul	bl
mov 	bx,ax
mov 	ah,01h
int 	21h
sub 	al,30h
add 	al,bl
mov	ch,al
call newline

lea	dx,minute	;input minute
mov	ah,9h
int 	21h
mov	ah,01h
int 	21h
sub 	al,30h
mov 	bl,10d
mul	bl
mov 	bx,ax
mov 	ah,01h
int 	21h
sub 	al,30h
add 	al,bl
mov 	cl,al
call 	newline

lea	dx,second	;input Second
mov	ah,9h
int 	21h
mov 	ah,01h
int 	21h
sub	al,30h
mov 	bl,10d
mul 	bl
mov 	bx,ax
mov 	ah,01h
int 	21h
sub 	al,30h
add 	al,bl
mov 	dh,al
call newline

mov	dl,0
mov	ah,2dh		;set systime time
int	21h

bind	proc		;binary to	decade
mov	al,bl
mov	ah,0
div	cl
mov	bl,ah
add	al,30h
mov	dl,al
mov	ah,02h
int	21h
ret
  bind endp
  end	start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -