Beginner's Programming Tutorial in QBasic

(Kiana) #1

Memory


(Before you study this chapter, you may need to read chapter 18, Numbering systems .)


Bits


A "bit" is the smallest piece of data stored in your computer's memory. The value of a bit can beeither 0 or 1. All data in your computer has a certain number of bits.


Bytes


A "byte" is 8 bits , and can have a value between 0 and 255 (or, in binary, between 0 and
11111111 ). A character, such as Q, takes up one byte of memory. This is because there are 256
different characters.
(If you don't fully understand bits and bytes, don't worry about it.)


How data is stored


Data is stored in RAM at a certain memory address , as explained in chapter 3 ( Variables ). Each
address takes up 1 byte of memory. Therefore, it can only have a value between 0 and 255.
A memory address (on a 32-bit computer) can be somewhere between hexadecimal, this is between 0 and FFFFFFFF. 0 and 4,294,967,295. In


Each memory address is divided into two parts: segments and offsets. See the figure below.


Segments and offsets
Free download pdf