Amos Professional Manual  Contents  Index

Machine Code

The copying operation will continue until the last character of the source string is reached, and the end address will be as follows:


The address may be odd or even, and can be anywhere in the Amiga's memory space. As always, mistakes with the address can crash your computer! Here is an example of the correct technique:

X> Reserve As Data 10,1000: Rem Reserve a memory bank
   NAME=Start(10)-8 : Rem Get the address of the name
   T$="Testbank" : Rem Choose a new name of up to 8 characters
   Poke$ NAME,Left$(T$,8) : Rem Poke the first 8 characters into the name

function: read a string of characters from memory

PEEK$ reads the maximum number of characters specified in the length parameter, into a new string. If this is not a sensible value, the length is assumed to be 65500. The address parameter is the location of the first character to be read.

There is an optional stop$ parameter, and if this is included, AMOS Professional will stop in its tracks the moment a specified stop$ character is encountered in the memory area. You will then be left with a string of characters up to the final stop$. Here is an example using PEEKS:

X> Reserve As Data 10,1000 : Rem Reserve a memory bank
   NAME=Start(10)-8 : Rem Get the address of the name
   Print Peek$(NAME,8)

instruction: copy a memory block
Copy start,finish To destination

The COPY command is used to move large sections of the Amiga's memory rapidly from one place to another. Specify the start and finish locations of the data to be moved, then give the destination of the position of memory area which is to be loaded with the data. Addresses may be odd or even, and special care should be taken to ensure that the destination area points to somewhere safe!

instruction: fill memory block with the contents of a variable
Fill start To finish,pattern

The FILL instruction packs an area of memory specified from start to finish. This area is filled with multiple copies of a specified four-byte pattern. The addresses of the start and finish determine the size and position of the memory block, and they must both be even.

Back    Next