Author Topic: CodeEdit, the Christmas Edition  (Read 884 times)

HSE

  • Member
  • *****
  • Posts: 2362
  • AMD 7-32 / i3 10-64
Re: CodeEdit, the Christmas Edition
« Reply #30 on: December 27, 2022, 09:49:37 AM »
Seems like its OS difference with older OS versions.

 :thumbsup: This OS is 2 years old, but perhaps could be related to OS language.

Later: Explorer have 2 years. Win say OS is from October 18, 2022  :biggrin:
Equations in Assembly: SmplMath

zedd151

  • Member
  • *****
  • Posts: 1931
Re: CodeEdit, the Christmas Edition
« Reply #31 on: December 27, 2022, 09:53:01 AM »
Now to test hutch's other 64 bit editors...  :badgrin:
If they used the same command line handling code, it is worth a look. I'll look into it later on sometime.
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: CodeEdit, the Christmas Edition
« Reply #32 on: December 27, 2022, 10:35:48 AM »
Seems like its OS difference with older OS versions.

I couldn't see any differences between XP, 7 and 10, see reply #29. Tomorrow, if I find the time, I will test it on my Win98 machine.

zedd151

  • Member
  • *****
  • Posts: 1931
Re: CodeEdit, the Christmas Edition
« Reply #33 on: December 27, 2022, 12:12:02 PM »

Now to test hutch's other 64 bit editors...  :badgrin:
If they used the same command line handling code, it is worth a look. I'll look into it later on sometime.

tEditor.exe from Masm64 SDK and tEdit.exe from Masm64/Examples/Advanced/tEdit also cannot be opened via Windows Explorer right click context menu "Open With...". I have not checked any further ... as I am 99% sure that they use the same command line handling.
Regards, zedd.
:tongue:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10313
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: CodeEdit, the Christmas Edition
« Reply #34 on: December 27, 2022, 02:11:43 PM »
You are probably right Z, they all work perfectly on my US language version of Win10 64 Pro. What Hector has said also makes sense, different language versions of Windows sometimes do things differently and you only find out via experience as things like that are never documented by Microsoft.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10313
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: CodeEdit, the Christmas Edition
« Reply #35 on: December 27, 2022, 05:03:42 PM »
I thought this one was worth the effort, its an algo that only removes the leading and trailing double quote. You could probably get it a bit faster but I doubt its worth the effort.

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

    include \masm64\include64\masm64rt.inc

    .data
      cln db 34,"  How   D, I  am quoted   text.   ",34,0
      pcl dq cln

    .code

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

 entry_point proc

    USING r12

    SaveRegs

    conout pcl,lf           ; before

    rcall unquote,pcl       ; strip the leading and trailing quotes
    rcall szMono,pcl        ; monospace the string

    conout pcl,lf           ; after

    waitkey
    RestoreRegs
    .exit

 entry_point endp

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

NOSTACKFRAME

unquote proc
  ; -------------------------------------------------------
  ; remove single leading and single trailing double quotes
  ; -------------------------------------------------------
    mov r10, rcx                    ; source and dest are same address
    mov r11, rcx

    sub r10, 1
  @@:
    add r10, 1
    cmp BYTE PTR [r10], 34          ; strip the leading quote
    je @B

  @@:
    add r10, 1
    movzx rax, BYTE PTR [r10]       ; read byte from 1st address
    test rax, rax                   ; safety margin for text with no quotes
    jz @F                           ; exit on ASCII zero
    mov BYTE PTR [r11], al          ; copy byte to 2nd address
    add r11, 1
    cmp rax, 34                     ; test if its a quote
    jne @B
    mov BYTE PTR [r11-1], 0         ; terminate and overwrite trailing quote

  @@:

    ret

unquote endp

STACKFRAME

; «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»

    end
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: CodeEdit, the Christmas Edition
« Reply #36 on: December 27, 2022, 08:17:19 PM »
different language versions of Windows sometimes do things differently

I can confirm that in the Italian versions of Win XP, 7 and 10 Explorer has that habit of putting "quotes around paths with spaces". Now we still need to verify that behaviour for Win 11 and UK, US, Russian, Chinese etc versions.

For those who have one of the Windows versions with this behaviour, there is a really simple solution taking advantage of a dedicated WinAPI function that gives you the un-quoted path for use with exist, ptr

See also https://learn.microsoft.com/en-us/troubleshoot/windows-server/deployment/filenames-with-spaces-require-quotation-mark - unfortunately, Micros*t doesn't give you a list of supported Windows versions :cool:

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10313
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: CodeEdit, the Christmas Edition
« Reply #37 on: December 27, 2022, 09:44:13 PM »
Interesting stuff but I would prefer one that was coded in assembler that I knew worked. One for ASCII, another for UNICODE. The one I posted above will accept any string and if it has quotes at either end, it will remove them.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: