[英]label or instruction expected at start of line YASM
我正在尝试构建程序集YASM代码,该代码应用于计算2D平面上两个点(A和B)之间的距离。
这是我用来构建代码的命令:
yasm -f elf64 -g dwarf2 -l distance.lst distance.asm
distance.asm:2:错误:在行开始处期望的标签或指令距离.asm:4:错误:在行开始处期望的标签或指令
我是组装的新手,无法弄清楚如何修复错误:
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
我的问题是:为什么我会收到上面显示的错误? (我已经阅读了关于stackoverflow的类似问题,但是我仍然无法弄清楚我的代码出了什么问题)
代替标签
Ax, Ay, Bx, By
使用其他人,例如
Mx, My, Nx, Ny
因为标签不能是AX
, BX
, CX
,...等寄存器名( Ay
和By
可以)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.