flat assembler
Message board for the users of flat assembler.

Index > Main > 256 1Byte register for write to mem address

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 27 Jun 2022, 08:40
Registers:
X00: 00h
X01: 01h
...
XFE: feh
XFF: ffh

mov [0000000000000000],X80
or
x0000000000000000X80
Post 27 Jun 2022, 08:40
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 27 Jun 2022, 09:12
You cannot write from memory to memory directly. Have to use real registers.
Post 27 Jun 2022, 09:12
View user's profile Send private message Visit poster's website Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 27 Jun 2022, 11:25
Overclick wrote:
You cannot write from memory to memory directly. Have to use real registers.


Yes. You can write to mem 00h from reg X00, 01h from reg X01. No need to mov al,00h and mov [ffffffff], al.
Double speed.
Post 27 Jun 2022, 11:25
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 27 Jun 2022, 12:26
What is register X00 ?
Shocked

mov [000],X00
Its mean this ?
mov [000],0 digit
Post 27 Jun 2022, 12:26
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 27 Jun 2022, 12:52
We need 256 1Byte register. Unfortunatelly we have less reg.

mov al,20h
mov ah,40h
mov bl,60h
mov bh,80h
mov cl,a0h
mov ch,c0h
mov dl,e0h
mov dh,ffh

mov [00000001],dh
mov [00000002],dl...

9 color pictures .Background color is 00h.
Post 27 Jun 2022, 12:52
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 27 Jun 2022, 12:57
U can use xmm/mmx/r8-15 to extend your wishes
Also you can use some Roman's macro ideas for auto registers query
Post 27 Jun 2022, 12:57
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 27 Jun 2022, 13:04
Also each register can be 8 bit shifted to hold full size data on it
Post 27 Jun 2022, 13:04
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 27 Jun 2022, 15:40
Overclick wrote:
You cannot write from memory to memory directly.
?
Code:
push [mem]
pop [mem]
movsb
mov [mem],imm    
Post 27 Jun 2022, 15:40
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 27 Jun 2022, 18:16
It is not the same. You need extra operations to set up that "copy" at your own. rsi rdi rsp
Post 27 Jun 2022, 18:16
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 27 Jun 2022, 18:47
You don't need any registers for
Code:
mov dword[0x12345678],0x56789abc    
Post 27 Jun 2022, 18:47
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 27 Jun 2022, 18:52
You still need a rip Smile
Post 27 Jun 2022, 18:52
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 27 Jun 2022, 18:58
Quote:

mov dword[0x12345678],0x56789abc

It is not the data section. It is not the data at all. It is constant fixed to one instruction
Post 27 Jun 2022, 18:58
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 27 Jun 2022, 19:22
Overclick wrote:
Quote:

mov dword[0x12345678],0x56789abc

It is not the data section. It is not the data at all. It is constant fixed to one instruction
However, the commands are in RAM. And it moves the value between two different segments (cs -> ds). So this is an operation between two memory cells. But in 64-bit mode, rip is implicitly involved in it anyway.

Although the commands themselves are selected using the command pointer register. But how do registers differ from memory cells? the absence of a numeric address or being in the processor (ALU). But memory is also not being directly read from banks right now. It is also now all in the processor - in the cache.
Post 27 Jun 2022, 19:22
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18963
Location: In your JS exploiting you and your system
revolution 27 Jun 2022, 19:26
In 32-bit code EIP is not a register you can access anyway, right? But wait, what does jmp do?
Code:
jmp label ; mov eip, label    
It gets tricky to define precisely.
Post 27 Jun 2022, 19:26
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 27 Jun 2022, 19:40
revolution wrote:
In 32-bit code EIP is not a register you can access anyway, right? But wait, what does jmp do?
Code:
jmp label ; mov eip, label    
It gets tricky to define precisely.
Code:
add eip, imm    

Code:
the absence of a numeric address or being in the processor (ALU)    
If you do not understand this statement, then this is sarcasm. Numeric register addresses are set directly in commands - implicitly. So this is also a memory.
Post 27 Jun 2022, 19:40
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 28 Jun 2022, 07:10
Overclick wrote:
You cannot write from memory to memory directly. Have to use real registers.


I think you mean we cannot do this:

Code:
mov dword [_len1], dword [_len2]
    
Post 28 Jun 2022, 07:10
View user's profile Send private message Reply with quote
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes 01 Jul 2022, 12:51
Overclick wrote:
U can use xmm/mmx/r8-15 to extend your wishes
Also you can use some Roman's macro ideas for auto registers query


How can we write single Byte to/from mm0/xmm0?
Post 01 Jul 2022, 12:51
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1964
Furs 01 Jul 2022, 13:18
macomics wrote:
If you do not understand this statement, then this is sarcasm. Numeric register addresses are set directly in commands - implicitly. So this is also a memory.
By that logic everything is memory since all instructions have opcodes and operand encodings in memory.
Post 01 Jul 2022, 13:18
View user's profile Send private message Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 676
Location: Russia
macomics 01 Jul 2022, 13:22
Everything is somewhat different. The memory for applications is in the processor's cache after the OS is loaded. And this means that all manipulations are carried out inside the processor.
Post 01 Jul 2022, 13:22
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 587
Location: Ukraine
Overclick 01 Jul 2022, 16:00
Quote:

How can we write single Byte to/from mm0/xmm0?

Via regular registers
Code:
movzx  eax,byte[mem]
movd  xmm0,eax
...
movq  rax,xmm0
mov  byte[mem],al
    

You may pack a group before moving for best utilization as xmm provided for group operations anyway.

Also you can use PEXTRB (SSE4.1) for single byte extraction,


Last edited by Overclick on 01 Jul 2022, 16:06; edited 2 times in total
Post 01 Jul 2022, 16:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.