1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| ;al存放从cmos的ram中读取的数据,ah中存放数据显示的格式。 ;es:di 用来指定在屏幕中那个位置显示,以何种样式。
assume cs:code,ds:data data segment
data ends
code segment s: mov bx,0b800h mov es,bx from: mov di,160*11+80 ;es:[di],di用来存放开始的位置; ;显示时间 mov ah,':' ;;;;; mov al,4 out 70h,al in al,71h ;取时 call display call dis_maohao ;取分钟 mov al,2 out 70h,al in al,71h call display call dis_maohao ;取秒 mov al,0 out 70h,al in al,71h call display ;显示年份与月份 mov ah,'/' mov di,12*160+80 ;取年份 mov al,9 out 70h,al in al,71h call display call dis_maohao ;取月份 mov al,8 out 70h,al in al,71h call display call dis_maohao ;取日期 mov al,7 out 70h,al in al,71h call display jmp from mov ax,4c00h int 21h ;子函数 display: push ax mov cl,4 shr al,cl add al,48 call display_son pop ax and al,0fh add al,48 call display_son ret display_son: ;将al中的数据显示在screen中 mov byte ptr es:[di],al inc di mov byte ptr es:[di],01000010b inc di ret dis_maohao: mov byte ptr es:[di],ah inc di mov byte ptr es:[di],01000010b inc di ret code ends end s
|