flat assembler
Message board for the users of flat assembler.
Index
> Windows > fasmg fails to compile win32console.asm |
Author |
|
Tomasz Grysztar 16 Jun 2019, 11:56
Because of fasmg's extensive use of forward-referencing, sometimes avalanche of errors occurs out of order and the first one is not very informative.
Dumping all errors with "-e1000" switch and digging through them uncovers the main problem: Code: win32console.asm [42]: if dword[strtokretval] = NULL Error: missing end directive. Changing these IF/ELSE/ENDIF to .IF/.ELSE/.ENDIF fixes the main, structural problem. What remained uncovered a small bug in the CCALL macro - I have just fixed it, please update. |
|||
16 Jun 2019, 11:56 |
|
yeohhs 16 Jun 2019, 12:35
Tomasz Grysztar wrote:
Woo hoo! Thank you very much. I used the -e1000 switch and managed to resolve another problem. Code: c:\fasmg\mycode>fasmg -e1000 win32console.asm flat assembler version g.ik0iv 5 passes, 1.3 seconds, 5632 bytes. c:\fasmg\mycode> Revised: Code: format PE CONSOLE 4.0 entry start include 'win32axp.inc' ;------------------------------------------------------------------------------- macro println arg* cinvoke printf, '%s', arg cinvoke printf, CRLF end macro ;------------------------------------------------------------------------------- section '.code' code readable executable start: stdcall getcmdargs println arg1 println arg2 println arg3 .finished: invoke ExitProcess,0 ;------------------------------------------------------------------------------- proc showhelp println progtitle println arghelptitle println arg1help println arg2help println arg3help ret endp ;------------------------------------------------------------------------------- proc getcmdargs invoke GetCommandLine cinvoke strcpy,cmdline,eax cinvoke strtok, cmdline,strsep mov dword[strtokretval], eax cinvoke strtok, NULL,strsep mov dword[strtokretval],eax .if dword[strtokretval] = NULL stdcall showhelp jmp .finished .else cinvoke strcpy, arg1, [strtokretval] .endif cinvoke strtok, NULL,strsep mov dword[strtokretval], eax .if dword[strtokretval] = NULL stdcall showhelp jmp .finished .else cinvoke strcpy, arg2, [strtokretval] .endif cinvoke strtok, NULL,strsep mov dword[strtokretval], eax .if dword[strtokretval] = NULL stdcall showhelp jmp .finished .else cinvoke strcpy, arg3, [strtokretval] .endif jmp .okay .finished: invoke ExitProcess,0 .okay: ret endp ;------------------------------------------------------------------------------- section '.data' data readable writeable progtitle db 'Win32 Console Program version 0.0.1 Copyright (c) 2018 by Yeoh HS',0 arghelptitle db 'Usage: win32console arg1 arg2 arg3',0 arg1help db 'arg1 - help for argument #1',0 arg2help db 'arg2 - help for argument #2',0 arg3help db 'arg3 - help for argument #3',0 CRLF db '',13,10,0 strfmt db '%s',0 cmdline rb 260 strsep db " ",0 strtokretval rb 1024 arg1 rb 32 arg2 rb 32 arg3 rb 32 ;------------------------------------------------------------------------------- section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ user32, 'user32.dll',\ msvcrt, 'msvcrt.dll' include 'api\kernel32.inc' include 'api\user32.inc' import msvcrt,\ strcpy, 'strcpy',\ strtok, 'strtok',\ printf, 'printf' ;------------------------------------------------------------------------------- section '.rsrc' data readable resource from 'win32console.res' ; end of file ================================================================== |
|||
16 Jun 2019, 12:35 |
|
yeohhs 16 Jun 2019, 12:43
Tomasz Grysztar wrote: What remained uncovered a small bug in the CCALL macro - I have just fixed it, please update. Thanks, I got the update from GitHub. |
|||
16 Jun 2019, 12:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.