Assembly Language Masm汇编编译器
打开masm汇编编译程序,新建一个masm源文件脚本。DATAS SEGMENT ;此处输入数据段代码 DATAS ENDSSTACKS SEGMENT ;此处输入堆栈段代码STACKS ENDSCODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKSSTART: MOV AX,DATAS MOV DS,AX ;此处输入代码段代码 MOV AH,4CH INT 21HCODES ENDS END START
在正文中输入我们的程序代码,并将文件命名为watch.asmdata segment;*****定义please等提示信息***** str db 20 db 50h,7,0,0 db 6ch,7,0,1 db 65h,7,0,1 db 61h,7,0,1 db 73h,7,0,1 db 65h, 7,0,1 db 70h,7,1,-10 db 72h,7,0,1 db 65h,7,0,1 db 73h,7,0,1 db 73h,7,0,1 db 53h,7,0,2 db 6bh,7,0,2 db 65h,7,0,1 db 79h,7,0,1 db 65h,7,0,2 db 78h,7,0,1 db 69h,7,0,1 db 74h,7,0,1 db 21h,7,0,1;*****定义0-9十个图形数字*****s0 db 6 db 5fh,7,0,0 db 7ch,7,1,-1 db 7ch,7,1,0 db 5fh,7,0,1 db 7ch,7,0,1 db 7ch,7,-1,0 sy db 2 db 7ch,7,1,0 db 7ch,7,1,0 s2 db 5 db 5fh,7,0,0 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,1,-1 db 5fh,7,0,1 s3 db 5 db 5fh,7,0,0 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,1,1 db 5fh,7,0,-1 s4 db 4 db 7ch,7,1,0 db 5fh,7,0,1 db 7ch,7,1,1 db 7ch,7,-1,0 s5 db 5 db 5fh,7,0,0 db 7ch,7,1,-1 db 5fh,7,0,1 db 7ch,7,1,1 db 5fh,7,0,-1 s6 db 6 db 5fh,7,0,0 db 7ch,7,1,-1 db 5fh,7,0,1 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,0,-1 s7 db 3 db 5fh,7,0,0 db 7ch,7,1,1 db 7ch,7,1,0 s8 db 7 db 7ch,7,1,0 db 5fh,7,-1,1 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,0,-1 s9 db 6 db 7ch,7,1,0 db 5fh,7,-1,1 db 7ch,7,1,1 db 5fh,7,0,-1 db 7ch,7,1,1 db 5fh,7,0,-1 s11 db 2 db 03h,7,1,0 db 03h,7,1,0data endsstack segment db 200 dup (0)stack endscode segment assume cs:code,ss:stack,ds:datastart: mov ax,data mov ds,ax mov ah,0 ;设置显示方式 mov al,4 int 10h mov ah,0bh ;置彩色调板 mov bh,0 mov bl,1 int 10h mov ah,0bh ;置彩色调板 mov bh,1 mov bl,4 int 10h mov ah,2 ;取系统时间 int 1ah mov ax,0 mov bx,0 mov ah,ch ;取系统时间 mov al,cl ;保存分钟 mov bh,dh ;保存秒 mov bl,dl ;保存百分之一秒 tt: push ax push bx mov ah,0 mov al,4 int 10hmov ah,0bh mov bh,0 mov bl,1 int 10h mov ah,0bh mov bh,1 mov bl,4 int 10h MOV AH,1 ;读键盘缓冲区字符 INT 16h JZ ww MOV AH,8 ;从键盘输入字符 INT 21h CMP AL,'s' ;输入s,结束程序 JE tu ww: pop bx pop ax call xian ;调用显示子程序 push ax qu: mov ah,2 ;取系统时间 int 1ah cmp bh,dh je qu pop ax inc bh ;对时间进行加1 cmp bh,100 jl tt mov bh,0 inc al call beep cmp al,100 jl tt mov al,0 inc ah cmp ah,24 jl tt mov ah,0 jmp tt tu: mov ah,4ch int 21h ret xian proc ;对时间值进行处理并显示的子程序 push si push di push dx push cx push bx push ax pop ax push ax mov bx,ax mov ax,0 mov al,bh mov cl,4 shr al,cl mov bl,al mov dh,10 mov dl,2 call ff pop ax push ax mov bx,ax mov ax,0 mov al, bh and al,0fh mov bl,al mov dh,10 mov dl,6 call ff mov dh,10 mov dl,10 mov bl,10 call ff pop ax push ax mov cl,4 shr al,cl mov bl,al mov dh,10 mov dl,14 call ff pop ax push ax and al ,0fh mov bl,al mov dh,10 mov dl,18 call ff mov dh,10 mov dl,22 mov bl,10 call ff pop ax pop bx push bx push ax mov ax,0 mov al,bh mov cl,4 shr al,cl mov bl,al mov dh,10 mov dl,26 call ff pop ax pop bx push bx push ax mov al,bh and al,0fh mov bl,al mov dh,10 mov dl,30 call ff mov dh,0 mov dl,15 mov bl,22 call ff pop ax pop bx pop cx pop dx pop di pop si retxian endpff proc ;显示具体数值 push ax push bx push cx push dx cmp bl,0 je l0 cmp bl,1 je l1 cmp bl,2 je l2 cmp bl,3 je l3 cmp bl,4 je l4 cmp bl,5 je l5 cmp bl,6 je l6 cmp bl,7 je l7 cmp bl,8 je l8 cmp bl,9 je l9 cmp bl,10 je l10 cmp bl,22 je ldl0: lea di,s0 jmp tyl1 : lea di,sy jmp tyl2: lea di,s2 jmp tyl3: lea di,s3 jmp tyl4: lea di,s4 jmp tyl5: lea di,s5 jmp tyl6: lea di,s6 jmp tyl7: lea di,s7 jmp tyl8: lea di,s8 jmp tyl9: lea di,s9 jmp tyl10: lea di,s11 jmp tyld : lea di,strty: mov ah,0fh ;示方式 int 10h sub cx,cx mov cl,[di] inc diplot_next: add dh,[di+2] add dl,[di+3] mov ah,2 int 10h mov al,[di] mov bl,[di+1] push cx mov cx,1 mov ah,09 int 10h pop cx add di,4 loop plot_next pop dx pop cx pop bx pop ax mov cx,100gg: dec cxloop ggretff endpclear proc push ax push bx push cx push dx mov ah,6 mov al,0 mov bh,1 int 10h pop dx pop cx pop bx pop axretclear endpbeep proc push ax push bx push cx push dx mov al ,10110110b out 43h,al mov ax,533h out 42h,al mov al,ah out 42h,al in al,61h mov ah,al or al,03 out 61h,al sub cx,cx mov bl,28hg7: loop g7 dec bl jnz g7 mov al,ah out 61h,al pop dx pop cx pop bx pop axretbeep endpcode ends end start
运行我们编辑的文件