大会 - 节目中储阵列空间? [英] Assembly - Reserve array space during program?

查看:204
本文介绍了大会 - 节目中储阵列空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在汇编程序的中间,我要声明一个数组。我有一个寄存器中的数组的大小,我知道元素的类型(即每个元素的字节数是) - 我怎么能在堆预留空间为这个阵列(然后访问特定的元素)?我需要调用malloc?

I am in the middle of an assembly program and I want to declare an array. I have the array size in a register and I know the type of the elements (i.e. how many bytes each element is) - how can I reserve space in the heap for this array (and then access particular elements)? Do I need to call malloc?

推荐答案

我觉得最好的办法是确实调用malloc。考虑这个code为FASM:

I think the best way is to indeed call malloc. Consider this code for FASM:

 include 'win32a.inc' 
 ...
 invoke  malloc,eax
 mov     [myHeap],eax 

退房: http://www.delorie.com/djgpp /doc/ug/asm/calling.html

这篇关于大会 - 节目中储阵列空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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