用x86汇编语言将寄存器移到数组的索引中 [英] Moving a register into an index of an array in x86 assembly language

查看:144
本文介绍了用x86汇编语言将寄存器移到数组的索引中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 bl 寄存器移动到x86汇编语言的字节数组中,但是以下语句会从masm汇编程序中产生一条错误消息.

I'm trying to move the bl register into an array of bytes in x86 assembly language, but the following statement produces an error message from the masm assembler.

mov arr [2],bl 生成输出 1> p4.asm(48):错误A2101:无法添加两个可重定位标签.

是否可以使用x86汇编语言将寄存器移到数组中?

Is it possible to move a register into an array in x86 assembly language?

推荐答案

基本上,以下内容应适用于硬编码的索引值:

Basically something that the following should work for a hard coded index value:

mov byte ptr [arr + 2], bl  ;store bl

[] 是可选的:MASM32 中的混淆括号

以更通用的方式:

mov si, 2                ;your index
mov al, bl               ;bl = byte value from your question
mov bx, offset arr
mov byte ptr [bx+si], al

这篇关于用x86汇编语言将寄存器移到数组的索引中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆