sef sf
sef sf

Reputation: 119

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

Upvotes: 0

Views: 616

Answers (1)

Peter Cordes
Peter Cordes

Reputation: 365147

YASM is not compatible with TASM, not to my knowledge. It's compatible with NASM 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.

Upvotes: 1

Related Questions