From 1a48f95a870559112eb7d3a6ecf236c78db13f5b Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 10 Jul 2018 20:27:21 -0700 Subject: 4338 - preliminary support for data segments --- subx/012indirect_addressing.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'subx/012indirect_addressing.cc') diff --git a/subx/012indirect_addressing.cc b/subx/012indirect_addressing.cc index 2901f8d5..304467f7 100644 --- a/subx/012indirect_addressing.cc +++ b/subx/012indirect_addressing.cc @@ -1,12 +1,15 @@ //: operating on memory at the address provided by some register +//: we'll now start providing data in a separate segment :(scenario add_r32_to_mem_at_r32) % Reg[3].i = 0x10; % Reg[0].i = 0x60; -% write_mem_i32(0x60, 1); +== 0x01 # code segment # op ModR/M SIB displacement immediate 01 18 # add EBX to *EAX # ModR/M in binary: 00 (indirect mode) 011 (src EAX) 000 (dest EAX) +== 0x60 # data segment +01 00 00 00 # 1 +run: add EBX to r/m32 +run: effective address is 0x60 (EAX) +run: storing 0x00000011 -- cgit 1.4.1-2-gfad0