Amos Professional Manual  Contents  Index

Machine Code


This character acts as an introduction sign, to indicate that the number which follows it is in hexadecimal notation, rather than the standard decimal system.

After the decimal value that is to be converted, an optional number can be added which sets the number of digits to be returned in the hex string. If this parameter is omitted, AMOS Professional will return the value in the fewest possible digits needed to express the hex number. For example:

E> Print Hex$(100)
   Print Hex$(100,3)

HEX$ is often used with the COLOUR function to display the precise mixture of Red, Green and Blue components in a particular colour, as follows:

D> Print Hex$(Colour(2))

Hexadecimal notation is ideal for handling large numbers such as addresses, and it may be entered directly in any AMOS Professional Basic expression. The $ (dollar) character must be placed in front of hex numbers, and they will be converted into standard decimal notation automatically. For example:

E> Print $64
   Print $A

Do not confuse the use of the leading $ character for a hex number with the use of a trailing $ character for a string. $A is a hexadecimal number, but A$ is a variable!

Manipulating memory
A "byte" is a single unit of data, resident at an address in memory. If no unit of data exists at a particular address, the address remains empty. Each byte can hold a number between 0 and 255. Each byte is made up of eight smaller units of memory called "bits", and a bit is the smallest unit of data that can be represented in a computer's memory by a 1 or a 0.

PEEK
function: read a byte from an address
byte=Peek(address)

The PEEK function returns a single 8-bit byte from an address in memory.

POKE
instruction: change a byte at an address
Poke address,number

The POKE command moves a number from 0 to 255 into the memory location at the specified address. Take great care with this instruction! Only POKE addresses that you completely understand, such as the contents of an AMOS Professional memory bank. Random poking will provoke your Amiga into taking horrible reprisals!

Back    Next
14.A.03