flat assembler
Message board for the users of flat assembler.
Index
> Main > [fasmg] "display" is executed even just after an "err" |
Author |
|
VEG 05 May 2017, 19:27
Much simpler example which explains the problem:
Code: display 'before the error1',13,10 err 'error1' display 'before the error2',13,10 err 'error2' display 'after everything',13,10 Code: flat assembler version g.hs4p0 before the error1 before the error2 after everything test.asm [2] Custom error: error1. |
|||
05 May 2017, 19:27 |
|
Tomasz Grysztar 05 May 2017, 19:42
The documentation of ERR is perhaps not clear enough, this directive simply registers an error to be signaled but this does not alter the flow of the assembly. This is because almost all errors that may happen during the assembly with fasmg are potentially "recoverable" - which means that they may vanish in the consecutive passes of the resolving process (the only exception, a "fatal" error, is when assembler runs out of memory). If you need to use DISPLAY to provide additional information related to an error, you have to put it under the same condition as the ERR directive.
VEG wrote: How can it be possible? The first assert prevented assembling, but actually it is not: all display directives were executed. |
|||
05 May 2017, 19:42 |
|
VEG 05 May 2017, 20:07
Quote: If you need to use DISPLAY to provide additional information related to an error, you have to put it under the same condition as the ERR directive. Code: macro call1 val if val > 0x1000 display 'detailed info about an error',13,10 err "can't be more than 0x1000" else dw val end if end macro call1 0x2000 call1 0x2000 Code: flat assembler version g.hs4p0 detailed info about an error detailed info about an error test.asm [12]: call1 0x2000 macro call1 [4] Custom error: can't be more than 0x1000. Quote: This is because almost all errors that may happen during the assembly with fasmg are potentially "recoverable" - which means that they may vanish in the consecutive passes of the resolving process (the only exception, a "fatal" error, is when assembler runs out of memory). |
|||
05 May 2017, 20:07 |
|
Tomasz Grysztar 05 May 2017, 20:09
VEG wrote: Maybe it is better at least to hide all messages from the "display" directive after an "err"? |
|||
05 May 2017, 20:09 |
|
Tomasz Grysztar 05 May 2017, 20:13
VEG wrote:
Code: flat assembler version g.hs4p0 detailed info about an error detailed info about an error a.asm [12]: call1 0x2000 macro call1 [4] Custom error: can't be more than 0x1000. a.asm [13]: call1 0x2000 macro call1 [4] Custom error: can't be more than 0x1000. |
|||
05 May 2017, 20:13 |
|
Tomasz Grysztar 05 May 2017, 20:22
Here's an example how you can construct a multi-line error message:
Code: macro call1 val if val > 0x1000 local errmsg virtual at 0 db "can't be more than 0x1000",13,10 db 'detailed info about an error' load errmsg:$ from 0 end virtual err errmsg else dw val end if end macro call1 0x2000 call1 0x2000 Code: >fasmg test.asm nul -e100 flat assembler version g.hs4p0 a.asm [15]: call1 0x2000 macro call1 [8] Custom error: can't be more than 0x1000 detailed info about an error. a.asm [16]: call1 0x2000 macro call1 [8] Custom error: can't be more than 0x1000 detailed info about an error. |
|||
05 May 2017, 20:22 |
|
Tomasz Grysztar 05 May 2017, 20:26
And the second example is how you can do it with DISPLAY only if for some reason you'd need this information in STDOUT instead of STDERR:
Code: macro call1 val if val > 0x1000 local errmsg virtual at 0 db "error in ",__FILE__ repeat 1, n:__LINE__ db ", line number ",`n,":",13,10 end repeat db "can't be more than 0x1000",13,10 db 'detailed info about an error',13,10 load errmsg:$ from 0 end virtual display errmsg else dw val end if end macro call1 0x2000 call1 0x2000 |
|||
05 May 2017, 20:26 |
|
VEG 05 May 2017, 20:29
Yeah, it seems that it is better to avoid the "display" directive for information about errors Maybe "display" will be useful for displaying of some statistics.
Thank you for the example. |
|||
05 May 2017, 20:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.