Other operators
    Il "Quarto" fuso ] The 4th Time Zone ]   


 

Introduction
Input/Output operations
Mathematical Operators
Stack operators
Other operators
Colon definition
Control structures
Conditional branching
Constants and variables
Other Forth words
Using the editor
Error messages


                                   

[ Index ][ Back ][ Next ]

!

This will store the second number on the stack at the a address held on the top of the stack. (pronounced “store”)

e.g.             suppose the stack is as follow

HEX

C000 TOS

FFEE

this will store FFEE at the addresses C000/C001. i.e. EE at C000; FF at C001.

If we try

            HEX FF00 C000 ! <CR>

this will store FF00 at C000/C001, i.e. C000 contains low byte 00 and C001 contains high byte FF. Remember that each 16 bit number takes up 2 bytes.

@

This will replace the address held on the top of the stack with the 16 bit contents of that address. (pronounced “at”).

Suppose the memory contents are as following:

Address

6100 6101 6102 6103 6104 6105

Contents

00 C3 8F 70 00 C3

then

HEX 6100 @ . <CR>

will print C300.

If you wish to deal with single bytes, then a variation of the above will be used.

C!

Will store a single byte held in the second number on the stack at the address held on the top of the stack.

e.g.      HEX FF C000 C! <CR>

will store a single byte FF at the address C000.

C@

Will place the contents of the address held on the top of the stack – this single byte must be pushed on the stack as a 16 bit number, but with the high byte 00.

With reference to the memory contents shown previously, if we key in

HEX 6100 C@ . <CR>

this will print 00 (and not C300 as with @).

+!

This will add the number held in the second number of the stack to the value held at the address on the top of the stack. (pronounced “Plus-store”)

e.g.      4 HEX C000 +! <CR>  

will add 4 to the value at C000/C001. As will be shown later, this is of use when using variables.

[ Index ][ Back ][ Next ]


Ultimo aggiornamento: 10-12-2002. Copyright (c) 2000-2002 Matteo Vitturi. 
Per problemi o domande relativamente a questo sito contattare il webmaster
Last update: 12.10.2002. Copyright (c) 2000-2002 Matteo Vitturi.
For problems or questions related to this web please contact the webmaster.
1