檢測點11.4

來源:互聯網
上載者:User

題目:下面的程式執行後,ax的值是多少?

assume cs:codesg<br />datasg segment<br />db 16 dup(0)<br />datasg ends<br />codesg segment<br /> start:<br /> mov ax,0<br /> push ax<br /> popf</p><p> mov ax,0fff0h<br /> add ax,0010h</p><p> pushf<br /> pop ax<br /> and al,11000101b<br /> and ah,00001000b</p><p> mov ax,4c00h<br /> int 21h</p><p> codesg ends<br /> end start

解析:

assume cs:codesg<br />datasg segment<br />db 16 dup(0)<br />datasg ends<br />codesg segment<br /> start:<br /> mov ax,0<br /> push ax<br /> popf;把0賦值給標誌寄存器,即把其所有標誌位清零</p><p> mov ax,0fff0h<br /> add ax,0010h;執行此加法運算後,ax的值為0,但是產生了進位,且有0(偶數)個1。所以pf=1、zf=1、cf=1,所以標誌寄存器中的值就是0045h,但是在調試時卻是0047h,不明白為什嗎?</p><p> pushf<br /> pop ax;把標誌寄存器的值給ax,即ax=0045h<br /> and al,11000101b;al的值45h魚器and後還是45h<br /> and ah,00001000b;由於ah的值為0,所以ah and之後的值就是0</p><p> mov ax,4c00h<br /> int 21h</p><p> codesg ends<br /> end start

所以ax的值為0045h

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.