flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 02 Mar 2017, 18:24
You could try to use separate namespaces for some macro sets:
Code: include '8086.inc' namespace i386 include '80386.inc' end namespace mov ah,4Ch int 21h namespace i386 bsf eax,ebx end namespace bsf eax,ebx ; error The more flexible option would be to somehow alter how the macros are defined: Code: macro require? option macro macro?! declaration& esc macro declaration if ~ option err 'illegal instruction' end if end macro end macro macro end?.require? purge macro? end macro require SOME_OPTION macro instruction db 0 end macro end require |
|||
![]() |
|
zhak 13 Mar 2017, 22:51
I just came up with the following idea for defining CPU architectures:
Code: CPU_UNDEFINED = 0 CPU_8086 = 1 CPU_ARM = 2 define __cpu__ __cpu__.family = CPU_UNDEFINED macro cpu? arg if __cpu__.family <> CPU_UNDEFINED end namespace end if __cpu__.family = CPU_UNDEFINED match =8086, arg __cpu__.family = CPU_8086 namespace x86 else match =arm?, arg __cpu__.family = CPU_ARM namespace arm end match end macro postpone ? end namespace end postpone and all instructions macros wrapped in corresponding namespace. All labels will be addressed in the architecture namespace, so should not be the problem. But could there be any other issues with such approach? I haven't tested it much, yet |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.