flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > work with string parts |
Author |
|
Lion17 03 Jun 2006, 19:54
have string
Code: 'abcd' need string Code: 'abc','d'+80h if there way to do it? |
|||
03 Jun 2006, 19:54 |
|
comrade 03 Jun 2006, 20:36
Last one doesn't work, it should be:
Code: mov eax,'abcd' mov eax,('abc' shr 8) OR ('d'+80h) |
|||
03 Jun 2006, 20:36 |
|
comrade 03 Jun 2006, 20:38
Or rather like this:
Code: mov eax,('a' shl 24) OR ('b' shl 16) or ('c' shl 8) OR ('d') |
|||
03 Jun 2006, 20:38 |
|
comrade 03 Jun 2006, 20:38
You can swap the order (abcd -> dcba), if you like.
|
|||
03 Jun 2006, 20:38 |
|
Lion17 04 Jun 2006, 06:55
the point is use ordinar string 'abc...def'
and I need modify only last character of it how I can split string in mscro on two part: header and last character? |
|||
04 Jun 2006, 06:55 |
|
comrade 04 Jun 2006, 08:23
please provide more context
how/where are you trying to use this technique? |
|||
04 Jun 2006, 08:23 |
|
Lion17 04 Jun 2006, 16:07
I use strings with end marked by hi bit of last character.
now I define string with next code: Code: db 'Sample strin','g'+80h but I want macro to define such strings by macro with code like: Code: EndBitString 'Sample string' |
|||
04 Jun 2006, 16:07 |
|
Tomasz Grysztar 04 Jun 2006, 16:29
Code: macro EndBitString str { db str local lastchr load lastchr byte from $-1 lastchr=lastchr or 80h store byte lastchr at $-1 } |
|||
04 Jun 2006, 16:29 |
|
LocoDelAssembly 04 Jun 2006, 17:10
or
Code: struc EndBitString str { . db str local ..lastchr load ..lastchr byte from $-1 ..lastchr=..lastchr or 80h store byte ..lastchr at $-1 } In case you want things like Code: aString EndBitString 'Hello World' Tomasz, is not better to use local names prefixed with two dots? |
|||
04 Jun 2006, 17:10 |
|
Tomasz Grysztar 04 Jun 2006, 18:06
It matters when you use those names as labels, but here it is a numeric variable ("=" and "load" define numeric variables).
|
|||
04 Jun 2006, 18:06 |
|
LocoDelAssembly 04 Jun 2006, 18:19
Code: .a = '0' b = 1 c = .a + b display c works Thanks for the info!! |
|||
04 Jun 2006, 18:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.