flat assembler
Message board for the users of flat assembler.

Index > Main > Comment to "Making a real-time assembler" stream

Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 14 May 2020, 19:55
Tomasz, (as mostly always I watch last one offline) very nice.
I didn`t find its in any resources so reproduce it from video.
(1 moment: I see in video fasmg build header,inc to 8 bytes, while mine was 4 bytes - feel that in reproduction is something wrong not lefting me)
And based on this a made for fasmg.dll asmgdemo.exe (in old style, as fasm.dll used) - it is less convinient then thour last via editbox.
In thour variant I added 2 rows for scroll sinchronizing of output edit (but subclassing is my week part):
Code:
format PE GUI 4.0
entry start

include 'win32a.inc'


struct MEMORY_REGION
        address dd ?
        size dd ?
ends

EXPRESSION_MAX_LENGTH = 32767

IDR_CALCULATOR = 37

ID_EXPRESSION  = 100
ID_HEXADECIMAL = 116
ID_VERSION     = 199


section '.text' code readable executable

  start:

        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [aout.address],eax
        mov     [aout.size],0
        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [conv.address],eax
        mov     [conv.size],0

        invoke  DialogBoxParam,PE_IMAGE_BASE,IDR_CALCULATOR,HWND_DESKTOP,CalculatorDialog,0
        invoke  ExitProcess,0

CalculatorDialog: procedure (hwnd,msg,wparam,lparam)
        push    ebx, esi, edi
        cmp     [msg],WM_INITDIALOG
        je      init
        cmp     [msg],WM_COMMAND
        je      command
        cmp     [msg],WM_CLOSE
        je      close
        xor     eax,eax
        jmp     finish
    linescroll: ; but it event of ID_EXPRESSION looks uncatchable throw parent dialog , and with what event to trigger that a question
        invoke  SendDlgItemMessage,[hwnd],ID_EXPRESSION,EM_GETFIRSTVISIBLELINE,0,0
        invoke  SendDlgItemMessage,[hwnd],ID_HEXADECIMAL,EM_LINESCROLL,0,eax

        jmp     processed
    init:

        invoke  fasmg_GetVersion

        invoke  SetDlgItemText,[hwnd],ID_VERSION,eax

        jmp     processed
    command:
        cmp     [wparam],IDCANCEL
        je      close
        cmp     [wparam],IDOK
        je      processed

        cmp     [wparam],ID_EXPRESSION + EN_CHANGE shl 16
        jne     processed

        ;invoke  GetDlgItemText,[hwnd],ID_EXPRESSION,expression_buffer,EXPRESSION_MAX_LENGTH

        invoke  fasmg_Assemble,source_string,NULL,aout,NULL,NULL,NULL
        test    eax,eax
        jnz     error

        mov     eax,[aout.size]
        lea     eax,[eax*8+8]
        cmp     eax,[conv.size]
        jbe     convert_output
        mov     [conv.size],eax
        invoke  VirtualAlloc,[conv.address],eax,MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jnz     convert_output
        invoke  VirtualFree,[conv.address],0,MEM_RELEASE
        invoke  VirtualAlloc,0,[conv.size],MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jz      error
        mov     [conv.address],eax
    convert_output:

        mov     esi,[aout.address]
        mov     ecx,[aout.size]
        mov     edi,[conv.address]
        lea     ebx,[esi+ecx-4]
     listing:
        mov     ecx,[ebx-4]
        sub     ecx,[ebx]
        jecxz   hex_ready
      to_hex:
        lodsb
        mov     dl,al
        shr     al,4
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,dl
        and     al,0Fh
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,' '
        stosb
        loop    to_hex
      hex_ready:
        mov     ax,$0A0D
        stosw
        sub     ebx,4
        cmp     esi,ebx
        jb      listing
        xor     al,al
        stosb
        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,[conv.address]

        jmp     processed
    error:
        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,error_string
        jmp     processed
    close:
        invoke  EndDialog,[hwnd],0
    processed:
        mov     eax,1
    finish:
        pop     edi, esi, ebx
        ret
endp


section '.data' data readable writeable

    error_string:
        db 0

    source_string:
        file 'header.inc'
        db 10
    expression_buffer db EXPRESSION_MAX_LENGTH dup ?

    aout MEMORY_REGION
    conv MEMORY_REGION


section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          fasmg,'FASMG.DLL'

  import kernel,\
         VirtualAlloc,'VirtualAlloc',\
         VirtualFree,'VirtualFree',\
         ExitProcess,'ExitProcess'

  import user,\
         DialogBoxParam,'DialogBoxParamA',\
         GetDlgItemText,'GetDlgItemTextA',\
         SendDlgItemMessage,'SendDlgItemMessageA',\
         SetDlgItemText,'SetDlgItemTextA',\
         EndDialog,'EndDialog'

  import fasmg,\
         fasmg_GetVersion,'fasmg_GetVersion',\
         fasmg_Assemble,'fasmg_Assemble'


section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           IDR_CALCULATOR,LANG_ENGLISH+SUBLANG_DEFAULT,calculator_dialog

  dialog calculator_dialog,'fasmg-powered mini assembler',100,120,400,200,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,,,'Courier New'
    dialogitem 'EDIT','',ID_EXPRESSION,4,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_AUTOHSCROLL+ES_MULTILINE+ES_WANTRETURN+ES_AUTOVSCROLL
    dialogitem 'EDIT','',ID_HEXADECIMAL,202,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_READONLY+ES_MULTILINE
    dialogitem 'STATIC','fasm g .',-1,326,188,30,8,WS_VISIBLE+SS_RIGHT
    dialogitem 'STATIC','',ID_VERSION,356,188,20,8,WS_VISIBLE+SS_RIGHT
  enddialog    

whole fasmdlls use (fasmarm.dll,fasm.dll & fasmg.dll) - https://yadi.sk/d/qUsD5JzJb-3lYw

_________________
I don`t like to refer by "you" to one person.
My soul requires acronim "thou" instead.
Post 14 May 2020, 19:55
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 15 May 2020, 11:33
Note that this simple line synchronization might not be enough when you have a source doing more complex things - a single REPEAT loop might break it, for example (because it is going to generate multiple lines and therefore multiple collected offsets, therefore going out of sync with the source text lines). To make it more reliable, it should be modified to collect not only $% values, but also __LINE__ ones, to have line numbers paired with output offsets.

I went with a maximally simplified variant on stream, just to get a quick proof-of-concept that gives a nice effect anyway.

And another thing worth adding would be to catch the "error" and "display" pipes and present them somewhere. Also pairing errors with lines in source could be attempted, but it would require text parsing of the "error" output, as fasmg.DLL only gives out the errors as presented by console.inc functions (it would require writing some expanded DLL API to give access to original error data directly).
Post 15 May 2020, 11:33
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 15 May 2020, 11:51
I tried to pass in file handles to the DLL, but it doesn't write to the file?
Code:
format PE GUI 4.0
entry start

include 'win32a.inc'

struct MEMORY_REGION
        address dd ?
        size dd ?
ends

EXPRESSION_MAX_LENGTH = 32767

IDR_CALCULATOR = 37

ID_EXPRESSION  = 100
ID_HEXADECIMAL = 116
ID_VERSION     = 199


section '.text' code readable executable

  start:

        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [aout.address],eax
        mov     [aout.size],0
        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [conv.address],eax
        mov     [conv.size],0

        invoke  GetModuleHandle,0
        invoke  DialogBoxParam,eax,IDR_CALCULATOR,HWND_DESKTOP,CalculatorDialog,0
        invoke  ExitProcess,0

proc CalculatorDialog hwnd,msg,wparam,lparam
        push    ebx esi edi
        cmp     [msg],WM_INITDIALOG
        je      init
        cmp     [msg],WM_COMMAND
        je      command
        cmp     [msg],WM_CLOSE
        je      close
        xor     eax,eax
        jmp     finish
    linescroll:
        invoke  SendDlgItemMessage,[hwnd],ID_EXPRESSION,EM_GETFIRSTVISIBLELINE,0,0
        invoke  SendDlgItemMessage,[hwnd],ID_HEXADECIMAL,EM_LINESCROLL,0,eax

        jmp     processed
    init:

        invoke  fasmg_GetVersion
        invoke  SetDlgItemText,[hwnd],ID_VERSION,eax

; create file handles for stdout/stderr
invoke  CreateFile,_StdOut.txt,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_DELETE,\
        0,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY or FILE_FLAG_DELETE_ON_CLOSE,0
;invoke  CreateFile,_StdOut.txt,GENERIC_READ or GENERIC_WRITE,0,\
;        0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov [hStdOut],eax

        jmp     processed
    command:
        cmp     [wparam],IDCANCEL
        je      close
        cmp     [wparam],IDOK
        je      processed

        cmp     [wparam],ID_EXPRESSION + EN_CHANGE shl 16
        jne     processed

;invoke  GetDlgItemText,[hwnd],ID_EXPRESSION,expression_buffer,EXPRESSION_MAX_LENGTH

invoke SetFilePointer,[hStdOut],0,0,FILE_BEGIN
mov [std_buf_read],0

        invoke  fasmg_Assemble,\
                source_string,\         ; source string
                NULL,\                  ; source path
                aout,\                  ; output region
                NULL,\                  ; output path
                [hStdOut],\             ; stdout
                [hStdOut]               ; stderr

        test    eax,eax
        jnz     error

        mov     eax,[aout.size]
        lea     eax,[eax*8+8]
        cmp     eax,[conv.size]
        jbe     convert_output
        mov     [conv.size],eax
        invoke  VirtualAlloc,[conv.address],eax,MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jnz     convert_output
        invoke  VirtualFree,[conv.address],0,MEM_RELEASE
        invoke  VirtualAlloc,0,[conv.size],MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jz      error
        mov     [conv.address],eax
    convert_output:

        mov     esi,[aout.address]
        mov     ecx,[aout.size]
        jecxz   error
        mov     edi,[conv.address]
        lea     ebx,[esi+ecx-4]
     listing:
        mov     ecx,[ebx-4]
        sub     ecx,[ebx]
        jecxz   hex_ready
      to_hex:
        lodsb
        mov     dl,al
        shr     al,4
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,dl
        and     al,0Fh
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,' '
        stosb
        loop    to_hex
      hex_ready:
        mov     ax,$0A0D
        stosw
        sub     ebx,4
        cmp     esi,ebx
        jb      listing
        xor     al,al
        stosb
        cmp     [aout.address],esi
        jz      error
        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,[conv.address]
        jmp     processed
    error:

; always from the start, read stdout / stderr files
invoke SetFilePointer,[hStdOut],0,0,FILE_BEGIN
invoke ReadFile,[hStdOut],std_buf,std_buf_bytes,std_buf_read,0

        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,std_buf;error_string
        jmp     processed
    close:

invoke CloseHandle,[hStdOut]

        invoke  EndDialog,[hwnd],0
    processed:
        mov     eax,1
    finish:
        pop     edi esi ebx
        ret
endp


section '.data' data readable writeable

    hStdOut rd 1
;   hStdErr rd 1
    std_buf_read rd 1

    _StdOut.txt db "stdout.txt",0

    error_string:
        db 0

    source_string:
        file 'header.inc'
        db 10
    expression_buffer db EXPRESSION_MAX_LENGTH dup ?

    aout MEMORY_REGION
    conv MEMORY_REGION

    std_buf_bytes = 4096
    std_buf rb std_buf_bytes

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          fasmg,'FASMG.DLL'

  import kernel,\
         CloseHandle,'CloseHandle',\
         CreateFile,'CreateFileA',\
         GetModuleHandle,'GetModuleHandleA',\
         ReadFile,'ReadFile',\
         SetFilePointer,'SetFilePointer',\
         VirtualAlloc,'VirtualAlloc',\
         VirtualFree,'VirtualFree',\
         ExitProcess,'ExitProcess'

  import user,\
         DialogBoxParam,'DialogBoxParamA',\
         GetDlgItemText,'GetDlgItemTextA',\
         SendDlgItemMessage,'SendDlgItemMessageA',\
         SetDlgItemText,'SetDlgItemTextA',\
         EndDialog,'EndDialog'

  import fasmg,\
         fasmg_GetVersion,'fasmg_GetVersion',\
         fasmg_Assemble,'fasmg_Assemble'


section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           IDR_CALCULATOR,LANG_ENGLISH+SUBLANG_DEFAULT,calculator_dialog

  dialog calculator_dialog,'fasmg-powered mini assembler',100,120,400,200,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,,,'Courier New'
    dialogitem 'EDIT','',ID_EXPRESSION,4,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_AUTOHSCROLL+ES_MULTILINE+ES_WANTRETURN+ES_AUTOVSCROLL
    dialogitem 'EDIT','',ID_HEXADECIMAL,202,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_READONLY+ES_MULTILINE
    dialogitem 'STATIC','fasm g .',-1,326,188,30,8,WS_VISIBLE+SS_RIGHT
    dialogitem 'STATIC','',ID_VERSION,356,188,20,8,WS_VISIBLE+SS_RIGHT
  enddialog    
...don't normally program in 32-bit, maybe I missed something. All the API calls I added are returning ERROR_SUCCESS in the debugger, and stepping through the DLL never stopped on the WriteFile calls. Seems there is a flag or something skipping them - I'm not sure.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 15 May 2020, 11:51
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 15 May 2020, 12:18
You only have something written to stdout when there are DISPLAY directives in source, and you only get something written to stderr when there are errors.

You have GetDlgItemText commented out, so you are only assembling header.inc without the text that is entered. After uncommenting that line and entering some text that causes an error I get the error messages showing with your sample. And if I enter DISPLAY directive, I get the display output, too.
Post 15 May 2020, 12:18
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 15 May 2020, 20:37
That's what I get for being up at 5am, lol.
Code:
format PE GUI 4.0
entry start

include 'win32a.inc'

struct MEMORY_REGION
        address dd ?
        size dd ?
ends

EXPRESSION_MAX_LENGTH = 32767

IDR_CALCULATOR = 37

ID_EXPRESSION  = 100
ID_HEXADECIMAL = 116
ID_VERSION     = 199


section '.text' code readable executable

  start:

        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [aout.address],eax
        mov     [aout.size],0
        invoke  VirtualAlloc,0,100000h,MEM_RESERVE,PAGE_READWRITE
        mov     [conv.address],eax
        mov     [conv.size],0

        invoke  GetModuleHandle,0
        invoke  DialogBoxParam,eax,IDR_CALCULATOR,HWND_DESKTOP,CalculatorDialog,0
        invoke  ExitProcess,0

proc CalculatorDialog hwnd,msg,wparam,lparam
        push    ebx esi edi
        cmp     [msg],WM_INITDIALOG
        je      init
        cmp     [msg],WM_COMMAND
        je      command
        cmp     [msg],WM_CLOSE
        je      close
        xor     eax,eax
        jmp     finish
    linescroll:
        invoke  SendDlgItemMessage,[hwnd],ID_EXPRESSION,EM_GETFIRSTVISIBLELINE,0,0
        invoke  SendDlgItemMessage,[hwnd],ID_HEXADECIMAL,EM_LINESCROLL,0,eax

        jmp     processed
    init:

        invoke  fasmg_GetVersion
        invoke  SetDlgItemText,[hwnd],ID_VERSION,eax

        invoke  CreateFile,_StdOut.txt,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_DELETE,\
                0,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY or FILE_FLAG_DELETE_ON_CLOSE,0
        mov [hStdOut],eax
        invoke  CreateFile,_StdErr.txt,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_DELETE,\
                0,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY or FILE_FLAG_DELETE_ON_CLOSE,0
        mov [hStdErr],eax

        jmp     processed
    command:
        cmp     [wparam],IDCANCEL
        je      close
        cmp     [wparam],IDOK
        je      processed

        cmp     [wparam],ID_EXPRESSION + EN_CHANGE shl 16
        jne     processed

        invoke  GetDlgItemText,[hwnd],ID_EXPRESSION,expression_buffer,EXPRESSION_MAX_LENGTH

        invoke SetFilePointer,[hStdOut],0,0,FILE_BEGIN
        invoke SetFilePointer,[hStdErr],0,0,FILE_BEGIN
        invoke SetEndOfFile,[hStdOut]
        invoke SetEndOfFile,[hStdErr]
        invoke  fasmg_Assemble,\
                source_string,\         ; source string
                NULL,\                  ; source path
                aout,\                  ; output region
                NULL,\                  ; output path
                [hStdOut],\             ; stdout
                [hStdErr]               ; stderr

        test    eax,eax
        jnz     error

        mov     eax,[aout.size]
        lea     eax,[eax*8+8]
        cmp     eax,[conv.size]
        jbe     convert_output
        mov     [conv.size],eax
        invoke  VirtualAlloc,[conv.address],eax,MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jnz     convert_output
        invoke  VirtualFree,[conv.address],0,MEM_RELEASE
        invoke  VirtualAlloc,0,[conv.size],MEM_COMMIT,PAGE_READWRITE
        test    eax,eax
        jz      error
        mov     [conv.address],eax
    convert_output:

        mov     esi,[aout.address]
        mov     ecx,[aout.size]
        jecxz   nobytes
        mov     edi,[conv.address]
        lea     ebx,[esi+ecx-4]
     listing:
        mov     ecx,[ebx-4]
        sub     ecx,[ebx]
        jecxz   hex_ready
      to_hex:
        lodsb
        mov     dl,al
        shr     al,4
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,dl
        and     al,0Fh
        cmp     al,10
        sbb     al,69h
        das
        stosb
        mov     al,' '
        stosb
        loop    to_hex
      hex_ready:
        mov     ax,$0A0D
        stosw
        sub     ebx,4
        cmp     esi,ebx
        jb      listing
        xor     al,al
        stosb
        cmp     [aout.address],esi
        jz      nobytes
        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,[conv.address]
        jmp     processed
    nobytes:
        invoke SetFilePointer,[hStdOut],0,0,FILE_BEGIN
        mov [std_buf_read],0
        invoke ReadFile,[hStdOut],std_buf,std_buf_bytes,std_buf_read,0
        jmp bufout
    error:
        invoke SetFilePointer,[hStdErr],0,0,FILE_BEGIN
        mov [std_buf_read],0
        invoke ReadFile,[hStdErr],std_buf,std_buf_bytes,std_buf_read,0
    bufout:
        mov eax,[std_buf_read]
        mov byte[std_buf+eax],0
        invoke  SetDlgItemText,[hwnd],ID_HEXADECIMAL,std_buf;error_string
        jmp     processed
    close:
        invoke CloseHandle,[hStdOut]
        invoke CloseHandle,[hStdErr]
        invoke  EndDialog,[hwnd],0
    processed:
        mov     eax,1
    finish:
        pop     edi esi ebx
        ret
endp


section '.data' data readable writeable

    hStdOut rd 1
    hStdErr rd 1
    std_buf_read rd 1

    _StdOut.txt db "stdout.txt",0
    _StdErr.txt db "stderr.txt",0

    error_string:
        db 0

    source_string:
        file 'header.inc'
        db 10
    expression_buffer db EXPRESSION_MAX_LENGTH dup ?

    aout MEMORY_REGION
    conv MEMORY_REGION

    std_buf_bytes = 4096
    std_buf rb std_buf_bytes

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          fasmg,'FASMG.DLL'

  import kernel,\
         CloseHandle,'CloseHandle',\
         CreateFile,'CreateFileA',\
         GetModuleHandle,'GetModuleHandleA',\
         ReadFile,'ReadFile',\
         SetEndOfFile,'SetEndOfFile',\
         SetFilePointer,'SetFilePointer',\
         VirtualAlloc,'VirtualAlloc',\
         VirtualFree,'VirtualFree',\
         ExitProcess,'ExitProcess'

  import user,\
         DialogBoxParam,'DialogBoxParamA',\
         GetDlgItemText,'GetDlgItemTextA',\
         SendDlgItemMessage,'SendDlgItemMessageA',\
         SetDlgItemText,'SetDlgItemTextA',\
         EndDialog,'EndDialog'

  import fasmg,\
         fasmg_GetVersion,'fasmg_GetVersion',\
         fasmg_Assemble,'fasmg_Assemble'


section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           IDR_CALCULATOR,LANG_ENGLISH+SUBLANG_DEFAULT,calculator_dialog

  dialog calculator_dialog,'fasmg-powered mini assembler',100,120,400,200,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME,,,'Courier New'
    dialogitem 'EDIT','',ID_EXPRESSION,4,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_AUTOHSCROLL+ES_MULTILINE+ES_WANTRETURN+ES_AUTOVSCROLL
    dialogitem 'EDIT','',ID_HEXADECIMAL,202,6,194,180,WS_VISIBLE+WS_BORDER+WS_TABSTOP+WS_VSCROLL+WS_HSCROLL+ES_READONLY+ES_MULTILINE
    dialogitem 'STATIC','fasm g .',-1,326,188,30,8,WS_VISIBLE+SS_RIGHT
    dialogitem 'STATIC','',ID_VERSION,356,188,20,8,WS_VISIBLE+SS_RIGHT
  enddialog    
This works quite nicely!
Instant feedback on my typos. Very Happy

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 15 May 2020, 20:37
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 15 May 2020, 22:24
realy nice, bitRAKE.


What could bring this toy tool to more featured one.
hang immunity:
If I typed
Code:
repeat %t

end repeat
    

that hangs app immidiately.

separate thread for compilation (and ability to terminate it by timeout|request) could solve this.
for easyest thread management in one time only one compilation thread, and button that closes current thread and forces new one,
It would be convinient to switch via different views (output,error,display) and to have ability to save output view in textual or binary form.
Post 15 May 2020, 22:24
View user's profile Send private message Send e-mail Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 15 May 2020, 22:35
At this point, I would say better to make it a pluggin to existing editor/tools. Because it needs line numbers, paste filtering, etc. It's a valuable perspective that flattens the learning curve for fasmg and x86.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 15 May 2020, 22:35
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 16 May 2020, 10:08
Yes, making it multi-threaded might be an obvious next step - not only because someone might write something like "while 1" into source box, but also because allowing larger sources might lead to assembly times that would make response to keystrokes so slow to render it nearly unusable. With fasmg_Assemble launched in a separate thread, you could prematurely terminate it as soon as a new keystroke arrives.

bitRAKE wrote:
At this point, I would say better to make it a pluggin to existing editor/tools. Because it needs line numbers, paste filtering, etc. It's a valuable perspective that flattens the learning curve for fasmg and x86.
Yeah, going for a plugin to some existing fully-featured IDE might be the most promising route. But you could also easily synchronize line numbers by using flat editor control (the example that comes with fasm.DLL uses it, BTW). In fact, I should perhaps migrate flat editor to the fasmg projects repository. Since fasmg can now assemble fasmw with no issues, it is going to have no trouble with fedit.DLL.
Post 16 May 2020, 10:08
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 799
Location: Russian Federation, Sochi
ProMiNick 16 May 2020, 19:58
For fasm in flat editor control there are highlighted keywords. that almost useless for fasmg.
for classical fasmg macros could be helpful background-lighting of symbol context - white - global, grey - local,some other color for in-macro, more other for more nested level in-macro, and so on (that is for symbols in apropriate namespaces too).
But I have no idea what could be introduced in IDE to help users understand CALM specifics.That what make them intuitive understandable.
Post 16 May 2020, 19:58
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 16 May 2020, 20:29
ProMiNick wrote:
For fasm in flat editor control there are highlighted keywords. that almost useless for fasmg.
The default syntax highlighting routine of fedit.DLL is just a placeholder, there is no highlighting there at all. When fasmw sets up its fedit control, it uses FEM_SETSYNTAXHIGHLIGHT to use "fasm_syntax" routine, but this one also does not highlight any keywords, it only highlights numbers, quoted strings and special characters - just like the highlighting used for code blocks on this forum (they follow the same algorithm).
Post 16 May 2020, 20:29
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4043
Location: vpcmpistri
bitRAKE 27 Oct 2022, 20:01
I've made UI updates to asmgmini tool:
Quote:
; - size / sizing dynamics
; - environment check
; - sync edit controls on change
; - psuedo-splitter dynamics

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 27 Oct 2022, 20:01
View user's profile Send private message Visit poster's website Reply with quote
luboput



Joined: 09 Mar 2023
Posts: 8
luboput 09 Mar 2023, 17:19
not working INCLUDE

init:
; invoke GetEnvironmentVariable,'INCLUDE',std_buf,1
mov eax,11

std_buf db 'F:\FASM\inc',0,0,0,0
Post 09 Mar 2023, 17:19
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4336
Location: Now
edfed 17 Mar 2023, 04:35
time is not real.

real is not real also
Post 17 Mar 2023, 04:35
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:  


< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.