flat assembler
Message board for the users of flat assembler.
Index
> Main > Adding something to a variable |
Author |
|
Imagist 29 Jul 2004, 14:28
That's why I started FASM too, but I think it is a worthwhile language on its own merit now.
As per your question, I think you need to develop a macro for that. As far as I know, there aren't any string operations. |
|||
29 Jul 2004, 14:28 |
|
vid 29 Jul 2004, 18:32
joey: hardly for a newbie (i think). In high-level languages (pascal, C) you already have done libraries that do all the job for you. In asm there isn't such library (OK, there is one, in Fresh package). But I quess you want to know how is it done.
First, you need place (called "buffer") where both strings you want to "concatenate" (this is word used for this operation) will both fit. Then, you copy first string to this place, except ending 0. Then, you copy second string to the end of copied first. And then you have new string in your buffer (so now you can't use label "String" to acces it, you must use address of that buffer). Anyway, string manipulation is one of hardest things in assembly, it is better to start with something other. I think you will comprehend much by reading (carefully) something from my tutorials http://board.flatassembler.net/topic.php?t=1178 |
|||
29 Jul 2004, 18:32 |
|
Joey 29 Jul 2004, 23:26
Ah bummer i thought it might be quite a hard task. makes me appreciate my pascal compiler a little more now didnt think building a BASIC compiler would involve so much ASM but i was wrong heehee. Got alot of learning todo.
Your tutorials great i understand most stuff on there just need to get a realy understanding tho |
|||
29 Jul 2004, 23:26 |
|
BlueOwl 30 Jul 2004, 17:26
> would involve so much ASM
When you compile a program, all is translated to binary (ASM) . |
|||
30 Jul 2004, 17:26 |
|
VitalOne 31 Jul 2004, 05:57
Joey wrote: I'm very new to assembler. I'm only realy learning it so i can build a compiler. Well, you need to allocate the number of bytes you want the string to be, then you simply add the character(s) on to the string, which would just be replacing the zeros allocated into memory. But for your situation, you aren't actually adding at all, you're just replacing the first byte with 32. To allocate, you can either use GlobalAlloc (which is simpler) or VirtualAlloc (which supports addresses). You should probably make a proc to do it for you everytime you add. |
|||
31 Jul 2004, 05:57 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.