flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > irps { % } |
Author |
|
revolution 06 Feb 2018, 14:43
"%" is an assembly variable. IRPS is a preprocessor directive so it is processed at a different time from the assembly stage.
|
|||
06 Feb 2018, 14:43 |
|
ProMiNick 06 Feb 2018, 19:20
[ENG]
Hello, Gyricon, thou maybe want to get solution of your problem instead of reading that way thou goes is wrong. Code: macro syntax v { IF v eq define ?s 1 ELSE define ?s v END IF } if.syntax fix IF ?s eq if.not.syntax fix IF ?s eq 0 ;;;;;;;;;;;;;; NUMERIC CONSTANTS ;;;;;;;;;;;;;;;;; ; create incremental (0-n) list of numeric ; constants with optional prefix. each token ; can be assigned or it equals previous+1. ; if first token ends with *, it becomes the ; prefix for subsequent tokens. example: ; numeric COLOR.*,\ ; BLACK, WHITE, RED, GREEN, BLUE ; COLOR.BLACK=0 ; output... ; COLOR.WHITE=1 ; COLOR.RED=2 ; COLOR.GREEN=3 ; COLOR.BLUE=4 macro numeric ?p, [p] { common local n n=0 ; n=0 syntax 0 match z$*, ?p \{ ; extract prefix syntax 1 \} match a==b, ?p \{ ; first item a=b n=b+1 syntax 1 \} match =0, ?s \{ ; else, first=0 ?p=0 n=1 \} forward syntax 0 match a==b, p \{ ; assigment? n=b ; set n match z$*, ?p \\{ ; extract prefix z$\\#a=b syntax 1 \\} if.syntax 0 ; no prefix a=b END IF syntax 1 ; yes, specified \} match =0, ?s \{ ; else=n (previous+1) match z$*, ?p \\{ ; extract prefix z$\\#p=n syntax 1 \\} if.syntax 0 ; no prefix p=n END IF \} n=n+1 ; n++ } KB=1024 ; 1<<10 MB=1048576 ; 1<<20 GB=1073741824 ; 1<<30 numeric YES=1, NO=0, TRUE=1, FALSE=0,\ NULL=0, DEFAULT=0, NONE=-1, INVALID=-1,\ DETECT=-1, INFINITE=-1, NOTHING=-1 All such things like above in attachment of topic https://board.flatassembler.net/topic.php?t=17600 codestar is author. (To codestar: You are realy bad guy, in your sources author is missed, it was hard to find your topic) In freshlib ( http://fresh.flatassembler.net/ ) it is solved too. Or maybe not, however, there too a lot of tasty macros. the main author - john found (there more then 1 author). use this two sources as base for exploring fasm macros. [RUS] Не увлекайся сильно высокоуровневыми украшательствами. |
|||
06 Feb 2018, 19:20 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.