assume cs:code,ds:data,ss:stack
data segment
db 9h,8h,7h,4h,2h,0
db '// :: '
data ends
stack segment
dw 128 dup (0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,128
call ClearScreen
LoopShow:
mov cx,6
call InitReg
LoopBody:
push cx
call ShowTimeAndDate
pop cx
loop LoopBody
jmp LoopShow
mov ax,4c00h
int 21h
;================================================
InitReg: mov ax,data
mov ds,ax
mov ax,0b800h
mov es,ax
mov si,0
mov di,160*12+30*2
ret
;================================================
ShowTimeAndDate:
mov al,ds:[si]
out 70h,al
mov ah,al
in al,71h
mov dl,al
mov dh,al
mov al,ah
mov cl,4
shr dh,cl
and dh,00001111b
and dl,00001111b
add dh,30h
add dl,30h
mov es:[di],dh
mov es:[di+2],dl
mov dh,ds:[si+6]
mov es:[di+4],dh
inc si
add di,6
ret
;================================================
ClearScreen:
mov ax,0b800h
mov es,ax
mov di,0
mov cx,2000
ClearBegin:
mov word ptr es:[di],0700h
add di,2
loop ClearBegin
ret
code ends
end start
然而我的代码风格跟咱鱼油的不一样,大家看不惯的...我也没办法了,习惯这样了,还有鱼c的代码排版不给力..内个数据段第二行采用了无名的方法