简体   繁体   中英

Assembly Extended Registers not working

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM