Zilog Z16F2810 User Manual
Page 93
![background image](https://www.manualsdir.com/files/771158/content/doc093.png)
UM018809-0611
ATM Instruction
ZNEO
®
CPU Core
User Manual
77
ATM
Definition
Atomic Execution
Syntax
ATM
Operation
Block all interrupt and DMA requests during execution of the next 3 instructions.
Description
The Atomic instruction forces the ZNEO CPU to execute the next three instructions as a single
block (that is, atom) of operations. During execution of these next three instructions, all inter-
rupts and DMA requests are prevented. This allows operations to be performed on memory loca-
tions that might otherwise be changed or used during the operation by interrupts or DMA.
Flags
Flags are not affected by this instruction.
Syntax and Opcodes
Example
The following example tests a bit used to lock a resource, then sets the bit if it is clear. ATM
ensures that the tested bit can be set before another routine tests it.
Instruction, Operands
Word 0
Word 1
Word 2
ATM
0004H
LD R7, #00000010B
;Load mask for bit 1
Object Code: 3702
ATM
;Block interrupt/DMA requests Object Code: 0004
TM.B B047H:RAM, R7
;Test semaphore with bit mask Object Code: 7657 B047
JP NZ, Msg1_In_Use
;JP if resource is in use
Object Code: EE xx
OR.B B047H:RAM, R7
;Else set masked bit
; to lock resource
Object Code: 7357 B047