简体   繁体   中英

TASM code gives error in YASM: instruction expected after label

I have code I made for TASM, and to my knowledge YASM is compatible with that, so IDK why I get these errors:

 91.asm:3: error: instruction expected after label 91.asm:4: error: instruction expected after label 91.asm:27: error: instruction expected after label

for this code:

IDEAL
MODEL small
STACK 21h
DATASEG
; --------------------------
; Your variables here
; --------------------------
CODESEG
global start
start:
; --------------------------
; Your code here
; --------------------------
    mov cx, 21
    mov ax, 1000h
    cmp cx, 0
    je myExit
addStack:
    push ax
    inc ax
    loop addStack
myExit:
exit:
    mov ax, 4C00h
    int 21h
END start

YASM is not compatible with TASM, not to my knowledge. It's compatible with N ASM which uses totally different directives. (And different meaning for mov reg, label - in NASM/YASM it's a mov-immediate of the address, unlike TASM/MASM where it's a load.)

Something on a line by itself without a : can be a label (and this is what YASM assumes if it's not recognized as an instruction mnemonic).

But if it's followed by something else that's also not understood as an instruction (like small in MODEL small ), that's a syntax error.

Use NASM / YASM syntax for YASM.

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