简体   繁体   English

TASM 代码在 YASM 中给出错误:label 之后预期的指令

[英]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:我有我为 TASM 编写的代码,据我所知 YASM 与该代码兼容,所以 IDK 为什么会出现这些错误:

 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.据我所知,YASM 与 TASM兼容。 It's compatible with N ASM which uses totally different directives.它与使用完全不同指令的N ASM 兼容。 (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.) (对于mov reg, label的不同含义 - 在 NASM/YASM 中,它是地址的 mov-immediate,与 TASM/MASM 不同,它是负载。)

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).没有:的东西本身就可以是 label (如果它不被识别为指令助记符,这就是 YASM 所假设的)。

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.但是,如果它后面跟着其他也不能理解为指令的东西(比如MODEL small small ,那就是语法错误。

Use NASM / YASM syntax for YASM.对 YASM 使用 NASM / YASM 语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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