flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
zhak 20 Apr 2016, 22:33
How do I concatenate multiple strings into one?
Code: macro cpu? type include 'arch/'#`type#'.inc' end macro cpu 8086 doesn't seem to be working in fasm g |
|||
![]() |
|
bitRAKE 21 Apr 2016, 03:38
I don't know if this is the intended way?
Code: macro cpu? type* eval 'include "arch/',`type,'.inc"' end macro cpu 8086 ![]() |
|||
![]() |
|
zhak 21 Apr 2016, 07:05
I'm so dumb
![]() |
|||
![]() |
|
Tomasz Grysztar 21 Apr 2016, 08:47
I have uploaded the bugfix. Now that macro works correctly also in this form:
Code: struc concat? first*,rest*& . = string first iterate s, rest . = string . + (s) shl (((bsr . - 1) shr 3 + 1) shl 3) end iterate end struc |
|||
![]() |
|
fabbel 31 Jan 2023, 07:56
Hi
Quote:
Any particular reason why not adding some string operators indeed ? Tx Rgds |
|||
![]() |
|
Tomasz Grysztar 31 Jan 2023, 12:14
fabbel wrote: Any particular reason why not adding some string operators indeed ? The reason why this never was especially pressing issue is that it tends to become hidden once you have some kind of framework established. Let me show a couple samples: Code: include 'inline.inc' inlinemacro strcat? a*, b* return = string (a) or (b) shl (8*lengthof (a)) end inlinemacro inlinemacro concat? head*, tail& local buffer buffer = string head iterate item, tail buffer = strcat(buffer,item) end iterate return = buffer end inlinemacro inlinemacro current_line rept 1, line:__line__ return = concat(__file__,' [',`line,']') end rept end inlinemacro display 'Current line: ', current_line() Code: include 'xcalm.inc' calminstruction calminstruction?.err? list*& local buffer, item compute buffer, '' loop: match item=,list, list jno final compute buffer, string buffer + item shl (8*lengthof buffer) jump loop final: compute buffer, string buffer + list shl (8*lengthof buffer) asm err buffer end calminstruction calminstruction test err 'This is a',10,9,9,'multi-line message' end calminstruction test To be clear: I'm not saying that specialized operators are completely unnecessary because you can emulate them with existing features. It's just that their implementation becomes less crucial because of that and I like to focus on things that open new doors. But the right hour for implementing them may still come. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.