masm32 が使用する正確なディレクティブを思い出せませんが、基本的な構造は次のようになります。
mov edi, addr tiles ; might be called offset, some assemblers (notably gas) would use something like lea edi, [tiles] instead
mov ecx, 12 ; the count, this could be gotten from an equ, read from a variable etc.
for_loop:
add byte ptr [edi], 2 ; tiles[i] += 2
inc edi ; move to next tile
dec ecx ; count--
jnz for_loop ; if (count != 0) goto for_loop
または、C# コードのように構造化する場合は、次のようにします。
mov edi, addr tiles
sub ecx, ecx ; ecx = 0
for_loop:
cmp ecx, 12 ; ecx < tiles.Length ?
jnl done ; jump not less
add byte ptr [edi+ecx], 2 ; tiles[i] += 2
inc ecx ; i++
jmp for_loop
done:
tiles
一部のコードのタイプを変更すると、変更が必要になることに注意してください (edi
特に関連するもの)。