flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 16 Jan 2021, 22:30
What do you want it to do?
|
|||
![]() |
|
Jin X 17 Jan 2021, 00:23
I want to check parameter and if it satisfies the conditions, then use it (or another parameter) in instruction.
The problem is that if check fails, instruction will be illegal (mov reg,v will be illegal if reg is bx+si but it shouldn't be generated if parameter is set to e.g. bx+si=$100 and v is near to $100). Compiler raises an error in that case (if condition contains refer to variable), even though instruction shouldn't be generated! I can't use match for condition, because it contain math calculations. |
|||
![]() |
|
revolution 17 Jan 2021, 03:30
Please show the output you expect:
Code: get_v bx=$100 ; generate what code? get_v bx+si=$100 ; generate what code? |
|||
![]() |
|
Calanor 17 Jan 2021, 08:00
Jin X: v is assigned a value after the macro call. If you swap the last two lines, it should work.
|
|||
![]() |
|
Jin X 18 Jan 2021, 18:32
revolution,
Code: mov ax,[bx+v-$100] mov ax,[bx+si+v-$100] Using get_v and get_v bx=$1000 should generate: Code: mov bx,v mov ax,[bx] Calanor wrote: Jin X: v is assigned a value after the macro call. If you swap the last two lines, it should work. |
|||
![]() |
|
bitRAKE 18 Jan 2021, 20:02
I'm still having trouble understanding fully your desired output, but perhaps:
Code: org $100 macro get_v rv { local modreg, ofs match ,rv \{ mov bx,v \} match any,rv \{ modreg equ rv ofs = 0 match r==val, rv \\{ modreg equ r if (val)-128 <= v & (val)+127 >= v ofs = v-val end if \\} mov ax,[modreg+ofs] \} } get_v bx+si=$100 v = $ |
|||
![]() |
|
Calanor 18 Jan 2021, 20:05
OK, I think I might have misunderstood what you were trying to do. Well, try replacing "mov reg, v" with "mov word[reg], v".
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.