https://leetarxiv.substack.com/p/mov-is ... ementation
This effectively performs an If with mov, compile with x86 Assembler back end
Code: Select all
DataSection
!memory: rd 256
!value1: dd 10 ;change to 20
!value2: dd 20
!result: dd 0
out:
EndDataSection
!mov eax, ptr value1
!mov dword [memory + eax], 0
; Step 2: Store 1 at memory[value2]
!mov eax, [value2] ; Load value2 into eax
!mov byte [memory + eax], 1 ; Store 1 at memory[value2]
; Step 3: Read the value at memory[value1] into result
!mov eax, [value1] ; Load value1 into eax
!mov bl, [memory + eax] ; Move the value at memory[value1] into bl
!mov byte [result], bl ; Move the value of bl into result
Debug PeekL(?out-4)