flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Azu 24 Nov 2009, 10:42
How do I specify the number of bytes for it to load instead of choosing from just byte/word/dword?
|
|||
![]() |
|
vid 24 Nov 2009, 11:45
No way... FASM doesn't have arbitrary-length compile-time variables. There was a discussion on this limitation long time ago.
|
|||
![]() |
|
ass0 24 Nov 2009, 12:00
Code: var: 'abc' It's just a pointer to the offset of 'a'. _________________ ![]() Nombre: Aquiles Castro. Location2: about:robots |
|||
![]() |
|
Azu 24 Nov 2009, 12:05
ass0 wrote:
Code: var: db 'abc' That would be more analogous to store. I'm asking about load. |
|||
![]() |
|
ass0 24 Nov 2009, 12:50
heeh xD yeah you are rite.
[edit] No wait!, what do u mean by load? Because 'load' would be OS dependant to something like: Code: push var call [someLoaderAPI] _________________ ![]() Nombre: Aquiles Castro. Location2: about:robots Last edited by ass0 on 24 Nov 2009, 12:55; edited 1 time in total |
|||
![]() |
|
Azu 24 Nov 2009, 12:53
The load directive described here.
|
|||
![]() |
|
cod3b453 24 Nov 2009, 15:25
You can use something like this:
Code: macro load_array var,src,n { rept n i:0 \{ match j,i \\{ load var\\#j byte from src+i \\} \} match i,n \{ var#_length equ i \} } macro store_array var { n equ var#_length rept n i:0 \{ match j,i \\{ db var\\#j \\} \} } dinp db 'my example data.' ; ^ ; dinp+4 load_array myVar,dinp+4,5 ; myVar0 = 'x' ; 1 = 'a' ; 2 = 'm' ; 3 = 'p' ; 4 = 'l' ; myVar_length = 5 gap db 'myVar = ' dout: db '0'+myVar_length,':' store_array myVar ; This should print: ; myVar = 5:xampl Hope that helps. |
|||
![]() |
|
Azu 24 Nov 2009, 15:45
Thanks
![]() It works perfectly. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.