以下代码用MASM5.0编译,在WinXP,Win98的dos下运行正常. 其中,运行中按上,下,左,右,pageup,pagedown键分别可调整年月日时分秒的显示 属性. caps lock键控制分割符"\"显示属性,Esc键退出. 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

评论