【发布时间】:2019-06-23 04:47:06
【问题描述】:
我正在整个视频缓冲区中一起渲染 10x12 像素地图
buffer[20][512] = malloc(10*12)
我在 20 个组中有多达 512 个潜在的 10x12 位图。我只使用一个组号:0 buffer[group][number of 10x12 tiles]
因此,buffer[0][mapindex]
每次调用该函数时,我只需要索引不同的地图。
我将缓冲区传递给 nasm 函数 tile_render(buffer,0,mapindex);
这是我迷路的地方:
lea esi,[ebp + 12]; Passing the buffer from the stack
mov eax,[ebp + 36] ;Location of mapindex on the stack
I am looping through 10 x 12 trying to render the pixels
mov dl,[4*esi + eax +8]
move byte [edi + ebx],dl ;moving one byte at a time.
//code omitted
add ebx,320
但是,我没有找到 10x12 像素的正确地址,这意味着我只是在屏幕上出现乱码。
当然还有其他方法可以处理这个问题,我可以做得很好,但我想知道如何在汇编中更好地使用 3 维数组。在这方面,我的经验是新手,所以我希望以前有人处理过这种情况。
【问题讨论】:
-
找到了这个案例的解决方案: