{"id":73,"date":"2020-07-22T01:50:54","date_gmt":"2020-07-21T17:50:54","guid":{"rendered":"http:\/\/121.89.208.222\/?p=73"},"modified":"2020-12-10T14:24:25","modified_gmt":"2020-12-10T06:24:25","slug":"%e6%b1%87%e7%bc%96%e5%ae%9e%e7%8e%b0%e4%b8%80%e4%b8%aa0%e5%88%b09%e7%9a%84%e6%95%b4%e6%95%b0%e8%be%93%e5%85%a5","status":"publish","type":"post","link":"http:\/\/moyisuiying.com\/index.php\/study\/compilation\/73.html","title":{"rendered":"\u6c47\u7f16\u5b9e\u73b0\u4e00\u4e2a0\u52309\u7684\u6574\u6570\u8f93\u5165"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>data segment\n num BYTE  ?\n \n inputStr  DB \"please  input a  positive number:\",\"$\"\t\t;\u5b9a\u4e49\u63d0\u793a\u8f93\u5165\u7684\u5b57\u7b26\u4e32\n outStr DB \"your input is:\",\"$\"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u5b9a\u4e49\u8f93\u51fa\u7684\u5b57\u7b26\u4e32\n erroStr  DB \"erro input!\",\"$\"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u5b9a\u4e49\u9519\u8bef\u7684\u5b57\u7b26\u4e32\n CRLF   DB  0AH, 0DH,'$'        \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u5b9a\u4e49\u6362\u884c\u7b26\n data  ends\n \n code segment\n  assume  cs:code,ds:data\t\t\t\t\t\t;\u6bb5\u5206\u914d\u8bed\u53e5\u4ec5\u4ec5\u662f\u5efabai\u7acb\u6bb5\u5bc4\u5b58\u5668\u548c\u6bb5\u540d\u4e4b\u95f4\u5173\u7cfb\n  \n  start:\n  main proc far\n       mov   ax,data\t\t\t\t\t\t\t\t\t\t\t\t;\u5b9e\u5c31\u662f\u628adata\uff08\u6570\u636e\uff09 \u8f6c\u5230 DS \u6570\u636e\u6bb5\u5bc4\u5b58\u5668\uff0c\u8ba9\u6570\u636e\u6bb5\u6307\u5411\u6b63\u786e\u7684\u4f4d\u7f6e\u3002\n       mov ds,ax\n       lea  dx,inputStr\t\t\t\t\t\t\t\t\t\t;\u8f93\u5165\u63d0\u793a\u4fe1\u606f\n       mov ah,09h\t\t\t\t\t\t\t\t\t\t\t\t\t;\u8c03\u7528dos\u7cfb\u7edf09\u53f7\u4e2d\u65ad\u8fdb\u884c\u8f93\u51fa\u5b57\u7b26\u4e32\n       int  21h\n       mov ah,01h\t\t\t\t\t\t\t\t\t\t\t\t\t;\u8c03\u7528dos\u4e2d\u65ad\u51fd\u6570\u8fdb\u884c\u8f93\u5165\n       int 21h\n       cmp al,'0'\n       jb   erro \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u5c0f\u4e8e0\u8df3\u8f6c\u5230errr\n       cmp al,'9' \t\t\t\t\t\t\t\t\t\t\t\t\t\t ;\u5927\u4e8e9\u8df3\u8f6c\n       ja erro\n       jmp showInput\t\t\t\t\t\t\t\t\t\t\t;\u8f93\u5165\u57280\u52309\u4e4b\u95f4\u5219\u6b63\u5e38\u8f93\u51fa\n       \n showInput:\n\t           lea dx,CRLF\t\t\t\t\t\t\t\t\t\t\t\t;\u6362\u884c\n\t           mov ah,09h\n\t          int 21h\n\t           lea dx,outStr                               ;\u8f93\u51fa\u63d0\u793a\u4fe1\u606f\n\t          mov ah,09h                                \t;\u8c03\u7528dos\u7cfb\u7edf09\u53f7\u4e2d\u65ad\u8fdb\u884c\u8f93\u51fa\u5b57\u7b26\u4e32\n\t         int  21h\n\t        mov num,al\t\t\t\t\t\t\t\t\t\t\t\t;\u5c06\u8f93\u5165\u7f13\u51b2\u533a\u7684\u5b57\u7b26\u4f20\u9001\u5230num\u4e2d\n\t         mov dl,num\t\t\t\t\t\t\t\t\t\t\t\t\t;\u5c06num\u7684\u503c\u4f20\u9001\u5230\u8f93\u51fa\u7f13\u51b2\u533a\u4e2d\n\t         mov ah,02h\t\t\t\t\t\t\t\t\t\t\t\t ;\u8c03\u7528dos\u7cfb\u7edf02\u55ef\u5462\u4e2d\u65ad\u8fdb\u884c\u8f93\u51fa\u5b57\u7b26\n\t         int 21h\n\t         jmp  exit\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u8df3\u8f6c\u5230\u7ed3\u675f\u4ee3\u7801\u5757\n erro:\n        lea dx,CRLF\t\t\t\t\t\t\t\t\t\t\t\t;\u6362\u884c\n\t    mov ah,09h\n\t    int 21h\n       lea dx,erroStr\n       mov ah,09h\n       int 21h\n       jmp exit\n exit:\n      mov ah,4ch\t\t\t\t\t\t\t\t\t\t\t\t\t\t;\u8c03\u7528dos\u7cfb\u7edf4c\u53f7\u4e2d\u65ad\u8fdb\u884c\u7ed3\u675f\u7a0b\u5e8f\uff0c\u8fd4\u56de\u7cfb\u7edf\n      int 21h\n  main endp\n  code ends\n  end start\n<\/code><\/pre>\n\n\n\n<p><strong>ps:\u5f53\u6211\u4eec\u8f93\u5165\u83b7\u53d6\u7684\u5b57\u7b26\u65f6\uff0c\u5b9e\u9645\u4e0a\u83b7\u53d6\u7684\u662f\u4e00\u4e2aASCII\u7801\uff0c\u56e0\u6b64\u5f53\u6211\u4eec\u8fdb\u884c\u6bd4\u8f83\u7684\u65f6\u5019\u5fc5\u987b\u8981\u4f7f\u7528\u548cASCII\u7801\u8fdb\u884c\u6bd4\u8f83\u3002<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6c47\u7f16\u5b9e\u73b00-9\u7684\u6574\u6570\u8f93\u5165<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[13,14],"_links":{"self":[{"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/posts\/73"}],"collection":[{"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/comments?post=73"}],"version-history":[{"count":1,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":424,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/posts\/73\/revisions\/424"}],"wp:attachment":[{"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/media?parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/categories?post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/moyisuiying.com\/index.php\/wp-json\/wp\/v2\/tags?post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}