This Tutorial explains registers and their purpose. Registers store data for programs. There are 8 bit and 16 bit registers. Each 8 bit is between positive and negative 255. Each 16 bit is formed from two 8 bit registers and is between positive and negative 65535. These registers can be specified as binary, hexidecimal, or binary. Placing a 'b', 'h', or 'b' after the number will correspond respectively, or you may place a '%' for binary or '$' for hexidecimal before. If nothing is specified, decimal is presumed.

Decimal is our everyday number system, in case you didn't know. Binary is made from 0's and 1's. Each place signifies that number multiplied by 2^the place the number is in. For example, starting from the right, 0101b would be equivilant to 1*2^0 + 0*2^1 + 1*2^2 + 0*2^3, which would be 1+0+4+0 or 5. Hexidecimal works in the same way, except instead of 2 possibilities, there are 16. 0 to 9 are the same, while A-F stand for 10-15. Therefore 001Ah would be 10*16^0 + 1*16^1 + 0*16^2 + 0*16^3, also being 10+16+0+0 or 26.

The 8 bit registers that you will use are a, b, c, d, e, h, and l. You can use bc, de, and hl as 16 bit registers. There are also a few more that we will not be using directly for now, such as af, ix, iy, and pc. The registers a and hl are special registers. These are immediate address registers, which are used only in certain situations. The a register is called the accumulator and is used for loading data. The hl register is used for storing memory addresses. You may use the command 'ld a,5' to

Make your own free website on