flat assembler
Message board for the users of flat assembler.

Index > Main > Help convert AT&T text to Intel text.

Author
Thread Post new topic Reply to topic
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 12 Jul 2022, 19:31
Fasmw 1.73
My program get asc2 text.
Convert this text.
Code:
; 5     x = x + y * 2;
        .line   5
        movss   _$3,%xmm5
        mulss   -4(%rbp),%xmm5
        addss   -8(%rbp),%xmm5
        movss   %xmm5,-8(%rbp)
    

To this text
Code:
; 5     x = x + y * 2;
        .line   5
        movss   xmm5,[_$3]
        mulss   xmm5,[rbp-4]
        addss   xmm5,[rbp-8]
        movss   [rbp-8],xmm5

    


How do this more elegant and simple ?
I mean small code for this convertion.
Post 12 Jul 2022, 19:31
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 12 Jul 2022, 20:20
You need to set your disassembler to output Intel mode, and not use AT&T mode.
Post 12 Jul 2022, 20:20
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 12 Jul 2022, 20:34
lcc64.exe
i try but not found how do this.
https://lcc-win32.services.net/
Post 12 Jul 2022, 20:34
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 12 Jul 2022, 20:55
Use a different disassembler.
Post 12 Jul 2022, 20:55
View user's profile Send private message Visit poster's website Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 13 Jul 2022, 04:02
Code:
txtzz     db 40 dup (0)
txtz2     db 40 dup (0)  
txtfx     db 40 dup (0)      
                pars:     db 'inc    %rbp',13,10
                          db 'movss     _$3,%xmm5',13,10
                          db 'mulss   -4(%rbp),%xmm5',13,10
                          db 'addss   -8(%rbp),%xmm5',13,10
                          db 'movss   %xmm5,-8(%rbp)',13,0
section '.code' code readable writeable executable
macro txtfixer in { local .ccc,.ss ,.xx
                mov      edx,in-1
                movups   xmm0,dqword [in]
                movaps   xmm1,xmm0
.ccc:           inc      edx
                cmp      byte [edx],0
                jz       .xx
                PALIGNR  xmm1,xmm1,1
                cmp      byte [edx],'('
                jnz      .ccc

                mov     byte [in],'['
                movq     qword [in+1],xmm1
                movups      dqword [in+4],xmm0
                mov      rax,in+4
.ss:            inc      rax
                cmp      byte [rax],'('
                jnz     .ss
                mov     word [rax],0x005D
.xx:           ; Msg     in
      }
macro txtfixer2 in { local .l1,.ll,.up,.hh,.xx
      mov  rdx,txtfx
      mov  rax,in
      mov  rbx,rax
.l1:  inc  rbx
      cmp  byte [rbx],13
      jbe  .ll
      cmp  byte [rbx],'('
      jnz  .l1

.up:  mov  cl,[rbx]
      mov  [rdx],cl
      inc  rbx
      inc  rdx
      cmp  cl,')'
      jnz  .up
      mov  byte [rdx-1],' '
.hh:
      inc  rdx
      mov  cl,[rax]
      mov  [rdx-1],cl
      inc  rax
      cmp  cl,'('
      jnz  .hh
      mov  byte [rdx-1],')'
      mov  word [rdx],0

      mov  rdx,txtfx
      mov  rbx,in
.xx:  mov  al,[rdx]
      mov  [rbx],al
      inc  rdx
      inc  rbx
      test al,al
      jnz  .xx
.ll:
      }               
macro FindLineT reg,tkn,mcopy,mcopyB { local .l1,.l2,.l3,.ll,.oo
                sub  ch,ch
.l1:            inc  reg
                cmp  byte [reg],13
                jbe  .ll
                cmp  byte [reg],tkn
                jnz  .l1
                inc  ch
                mov  rdx,reg
.oo:            dec  rdx
                cmp  byte [rdx],9
                jz   .oo
                cmp  byte [rdx],32
                ja   .oo
                mov  r10,rdx
                inc r10
                mov  rax,mcopyB
.uu:            mov  cl,[rdx]
                cmp  cl,'%'
                jz   .u2
                mov  [rax],cl
                inc  rax
.u2:            inc  rdx
                cmp  cl,','
                jnz  .uu
                mov  word [rax-1],0
                mov  rax,mcopy
.l2:            inc  reg
                mov  cl,[reg]
                cmp  cl,'%'
                jz   .l3
                mov  [rax],cl
                inc  rax
.l3:
                cmp  cl,13
                ja   .l2
                mov  word [rax-1],0

.ll:
                }
Start:          sub     rsp,8                
                mov     r15,pars
 .kk:         FindLineT r15,',',txtzz,txtz2
                cmp byte [r15],0
                jz  .enn
                test     ch,ch
                jz   .kk
                txtfixer txtzz
                txtfixer txtz2  
                mov      rdx,txtzz-1
.yy:            inc     rdx
                mov     al,[rdx]
                test    al,al
                jz      .o
                mov     [r10],al
                inc     r10
                jmp     .yy
.o:             mov     byte [r10],','
                inc     r10
                mov      rdx,txtz2-1
.yy2:            inc     rdx
                mov     al,[rdx]
                test    al,al
                jz      .o2
                mov     [r10],al
                inc     r10
                jmp     .yy2
.o2:            mov     byte [r10],' '
                jmp     .kk
.enn:           mov     r15,pars
.en2:           inc     r15
                cmp byte [r15],0
                jz  .en3
                cmp byte [r15],')'
                jnz .we1
                mov byte [r15],']'
                jmp .en2
.we1:            cmp byte [r15],'('
                jnz .we2
                mov byte [r15],'['
                jmp .en2
.we2:
                cmp byte [r15],'%'
                jnz  .en2
                mov   byte [r15],' '
                jmp   .en2
.en3:
                invoke MessageBox,0,pars,0,0             

    


Last edited by Roman on 13 Jul 2022, 11:56; edited 2 times in total
Post 13 Jul 2022, 04:02
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 13 Jul 2022, 05:53
https://www.youtube.com/watch?v=gkibySbPeq0&ab_channel=Roman8139
My question could sse xmm1 rol text ?
Movq to xmm1 "-8(%rbp)"
Rol xmm1 and get "(%rbp)-8"


Last edited by Roman on 13 Jul 2022, 07:26; edited 1 time in total
Post 13 Jul 2022, 05:53
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 13 Jul 2022, 06:51
I found VPROLVD and pshufb
But VPROLVD xmm1,xmm1,xmm1 crash.

pshufb get result.
Code:
Rev dB 3,4,5,6,7,0,1,2,8,9,10,11,12,13,14,15
mov rax,"-8(%rbp)"
movq xmm1,rax

movups xmm2,dqword [rev]
pshufb   xmm1, xmm2 ;xmm1 "%rbp)-8("

    
Post 13 Jul 2022, 06:51
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 13 Jul 2022, 11:41
If you have the raw machine code, you can paste it on onlinedisassembler.com for Intel mnemonic. (It lets you choose Intel or AT&T mnemonics)


Description:
Filesize: 21.92 KB
Viewed: 1104 Time(s)

Screenshot 2022-07-13 194020.png


Post 13 Jul 2022, 11:41
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 13 Jul 2022, 14:01
FlierMate1 wrote:
you can paste it on onlinedisassembler.com

This site not open. I try.
Two reason write owner parser.
No Internet or not open site.
Post 13 Jul 2022, 14:01
View user's profile Send private message Reply with quote
FlierMate1



Joined: 31 May 2022
Posts: 118
FlierMate1 13 Jul 2022, 14:20
Roman wrote:
FlierMate1 wrote:
you can paste it on onlinedisassembler.com

This site not open. I try.
Two reason write owner parser.
No Internet or not open site.


The direct link is : https://onlinedisassembler.com/odaweb/

Strange, why is it not opened? Censorship?

You can try other online disassembler but this "odaweb" is the best I have found to-date.


Description: Screenshot of odaweb
Filesize: 304 KB
Viewed: 1073 Time(s)

Screenshot 2022-07-13 221840.png


Post 13 Jul 2022, 14:20
View user's profile Send private message Reply with quote
Roman



Joined: 21 Apr 2012
Posts: 1286
Roman 13 Jul 2022, 15:15

This site not open.
Post 13 Jul 2022, 15:15
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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.