XPost: alt.windows7.general   
   From: notsaying@invalid.org   
      
   On Sun, 23 Sep 2018 16:20:00 GMT, Brian Gregory   
    wrote:   
      
   > On 20/09/2018 20:58, Herbert Kleebauer wrote:   
   >> winmain::   
   >>   
   >>        jsr.l  (GetCommandLine)   
   >> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ;   
   >> skip program name        eor.l  r1,r1             
   >> ; not within "" flag        dec.l  r0   
   >> _20:   inc.l  r0   
   >>        cmp.b  #0,(r0)   
   >>        beq.b  _10   
   >>        cmp.b  #'"',(r0)   
   >>        bne.b  _30   
   >>        not.l  r1   
   >> _30:   or.l   r1,r1   
   >>        bne.b  _20   
   >>        cmp.b  #' ',(r0)   
   >>        bne.b  _20   
   >>        inc.l  r0   
   >>   
   >> _10:   move.l r0,-(sp)   
   >>        jsr.l  (GetConsoleWindow)   
   >>        move.l r0,-(sp)   
   >>        jsr.l  (SetWindowTextA)   
   >> Â Â Â Â Â Â Â moveq.l #0,-(sp)   
   >>        jsr.l  (ExitProcess)  ; exit program   
   >   
   > Is that really what Intel assembler looks like nowadays?   
   >   
   > Looks more like Motorola 68000 assembler to me.   
   >   
      
   Not quite, with those Â's in it!   
   Herbert prefers Motorola syntax.   
      
   But it's not complicated; this is what I think it'd be in nasm format:   
      
    xor bx,bx ;instr flag =false   
    dec si   
   _20:   
    inc si   
    cmp byte [si],0   
    jz _10   
    cmp byte [si],'"'   
    jne _30   
    not bx ; flag as instr   
   _30:   
    or bx,bx   
    jne _20   
    cmp byte [si],' '   
    jne _20   
    inc si   
   _10:   
      
   I'd make the first one a 'lodsb', then test al.   
   so   
    mov ah,0 ; quoted str flag off   
   nextc:   
    lodsb   
    cmp al,0   
    je havestr   
    cmp al,'"'   
    jne notaquote   
    mov ah,1   
   notaquote:   
    cmp ah,1   
    jne nextc   
    cmp al,0x20 ; space   
    jne nextc   
    inc si ; skip it   
   havestr:   
      
      
   --   
   Bah, and indeed, Humbug.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|