flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Windows > How to save the quantity of digits in constant during work

Author
Thread Post new topic Reply to topic
Sloppysecond



Joined: 01 May 2017
Posts: 8
How to save the quantity of digits in constant during work
Hello there!
I get the number from the keyborad using function ReadConsole which saves the length of the inputed number in one of its arguments.
How could i use this argument as an index of array? (The number it is the array which i define as

Code:
number db 500 dup(0


I used to use constants or registers in such situatons but in this case all registers are busy and i can not do something like that :

Code:

length_number = 0
length_number = [symbols_was_read]



or

Code:

mov ecx,  [symbols_was_read] (now it is free but it will be used later and can not use as index)
length_number = ecx
How can i create run-time constant in FASM?



I was invented lots of variants but all of them fallen.
And i always wanted to know why can not i do such thing :

Code:
mov cl,[first_number + [symbols_was_read]]


(Use normal variable as an index).
Post 17 May 2017, 23:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15158
Location: GW170817
If all the registers are in use then you don't really have any other options. Just save one of the register values to somewhere and then use the now free register for other processing. Usually a convenient place to save temporary values is the stack.
Post 18 May 2017, 11:18
View user's profile Send private message Visit poster's website Reply with quote
Sloppysecond



Joined: 01 May 2017
Posts: 8

revolution wrote:
If all the registers are in use then you don't really have any other options. Just save one of the register values to somewhere and then use the now free register for other processing. Usually a convenient place to save temporary values is the stack.


I will try to do it.
Thank you for the answer!
Post 18 May 2017, 15:58
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.