Memory usage

classic Classic list List threaded Threaded
2 messages Options
Guy
Reply | Threaded
Open this post in threaded view
|

Memory usage

Guy
I don't understand something:
Am I right that a "user" can input data only between RAM[0] to RAM[15]? Because every allocation I make in the program, starts with RAM[16], so if the user input something there - it will be ran over.
If that's the case - it sounds really weird to me that there are only 15 fields of input..
What am I missing?
Reply | Threaded
Open this post in threaded view
|

Re: Memory usage

cadet1620
Administrator
Guy wrote
I don't understand something:
Am I right that a "user" can input data only between RAM[0] to RAM[15]? Because every allocation I make in the program, starts with RAM[16], so if the user input something there - it will be ran over.
If that's the case - it sounds really weird to me that there are only 15 fields of input..
What am I missing?
RAM[0..15] also has especially important usage as you will learn in chapter 7, Virtual Machine, and following.

Using low RAM addresses for input and output values is only done for limited testing purposes.  When you program with a high-level language, user input comes from operating system functions and is stored in the assembler allocated RAM variables.

It's actually a bit more complex than that, as you will learn in the software chapters, because variables can also be automatically allocated on the stack or dynamically allocated from the heap (unallocated RAM above the stack).

--Mark