0

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
Sep Roland
  • 33,889
  • 7
  • 43
  • 76
sef sf
  • 117
  • 1
  • 8

1 Answers1

1

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.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • do you know a compatible assembler with TASM that can run on Linux, or make regular bin files? – sef sf Feb 09 '21 at 11:41
  • @sefsf: Possibly JWASM (I think it's at least mostly MASM compatible), but it's not like Linux can *run* DOS `.com` flat-binary executables natively. Or you could just port your code to YASM; flat binaries are pretty simple so it's not like you'll need a lot of directives. (IMO NASM/YASM syntax for actual instructions is the best designed out of all of MASM, AT&T, or other major options.) – Peter Cordes Feb 09 '21 at 11:46