Assembly Extended Registers not working

烈酒焚心 提交于 2021-01-29 20:43:17

问题


I am fairly new to Assembly and TASM and i have the following question. I want to use the extended version of the registers, specifically EBX. By using the code below, but without the ".386" directive, it doesn't work, saying that "Undefined symbol EBX". But with it, it doesn't recognize the INT 21h instruction which from what i understands terminated the program and is useful when debugging it with TurboDebugger. Can someone tell me how i can avoid this situation?

PS: Yes, i know that TASM and TD are very old and there are newer better ones like NASM or MASM, but we have to use this one at the university, so please don't tell me to use the other ones.

Here is the code:

.386
CODE  SEGMENT
        ASSUME  CS : CODE , DS : CODE , SS : CODE
        ORG  100H
    ENTRY:    JMP  L1
            ; data definitions come here
            ;.   .   .
    L1:

    MOV  EBX, 10H
    MOV  AX ,  4C00H
    INT  21H
    CODE  ENDS
    END  ENTRY

回答1:


It is relevant where to put .386. In your case the SEGMENT directive will be interpreted a USE32-segment, but you need a USE16-segment.

Change

CODE  SEGMENT

to

CODE  SEGMENT USE16

or put the .386 directive after the CODE SEGMENT-line.



来源:https://stackoverflow.com/questions/26828591/assembly-extended-registers-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!