标签或指令应在行首 YASM
label or instruction expected at start of line YASM
我正在尝试构建用于计算二维平面上两点(A 和 B)之间距离的汇编 YASM 代码。
这是我用来构建代码的命令:
yasm -f elf64 -g dwarf2 -l distance.lst distance.asm
distance.asm:2: error: label or instruction expected at start of line
distance.asm:4: error: label or instruction expected at start of line
我是汇编新手,不知道如何修复错误:
segment .data
Ax dq 0 ; x coordinate of A
Ay dq 0 ; y coordinate of A
Bx dq 1 ; x coordinate of B
By dq 1 ; y coordinate of B
segment .text
global _start
_start:
mov rax, [Ax] ; Writing values
mov rbx, [Ay] ; of A and B
mov rcx, [Bx] ; coordinates to
mov rdx, [By] ; registers
sub rax, rcx ; Length of the first cathetus
sub rbx, rdx ; Length of the second cathetus
imul rax, rbx ; Suqare of distanse between A and B
我的问题是:为什么会出现上面显示的错误?
(我在Whosebug上看过类似的问题,但我还是没弄清楚我的代码有什么问题)
而不是标签
Ax, Ay, Bx, By
使用其他人,例如。 g.
Mx, My, Nx, Ny
因为标签不能注册为 AX
、BX
、CX
、...(Ay
和 By
都可以)。
我正在尝试构建用于计算二维平面上两点(A 和 B)之间距离的汇编 YASM 代码。
这是我用来构建代码的命令:
yasm -f elf64 -g dwarf2 -l distance.lst distance.asm
distance.asm:2: error: label or instruction expected at start of line distance.asm:4: error: label or instruction expected at start of line
我是汇编新手,不知道如何修复错误:
segment .data
Ax dq 0 ; x coordinate of A
Ay dq 0 ; y coordinate of A
Bx dq 1 ; x coordinate of B
By dq 1 ; y coordinate of B
segment .text
global _start
_start:
mov rax, [Ax] ; Writing values
mov rbx, [Ay] ; of A and B
mov rcx, [Bx] ; coordinates to
mov rdx, [By] ; registers
sub rax, rcx ; Length of the first cathetus
sub rbx, rdx ; Length of the second cathetus
imul rax, rbx ; Suqare of distanse between A and B
我的问题是:为什么会出现上面显示的错误? (我在Whosebug上看过类似的问题,但我还是没弄清楚我的代码有什么问题)
而不是标签
Ax, Ay, Bx, By
使用其他人,例如。 g.
Mx, My, Nx, Ny
因为标签不能注册为 AX
、BX
、CX
、...(Ay
和 By
都可以)。