User Tools

Site Tools


ugbasic:user:kw:nop
Translations of this page:


ugBASIC User Manual

NOP

SYNTAX

   NOP

PURPOSE

NOP is short for “No OPeration” and it is a very special instruction: it generates an equivalent instruction in assembly languages that does not perform any useful operation, that is, it does not change the state of the processor or the data in memory.

By inserting a sequence of NOP instructions, you can create a timed delay within your program. This can be useful, for example, to synchronize several actions or to create animation effects. In some cases, it is necessary to align the code to certain memory locations. By inserting NOP instructions, you can “fill” the missing space and ensure correct alignment. NOP instructions can be used to insert “placeholders” into code, making debugging and testing easier.

When the program encounters a NOP instruction, it simply increments the program counter (PC) to the next instruction, without performing any data operations. In effect, the processor “wastes time” executing this empty instruction.

It is important to note that excessive use of NOP instructions can slow down the execution of the program, so it is advisable to use them sparingly and only when absolutely necessary.

EXAMPLE

  IF tooEarly THEN
     NOP: NOP: NOP: NOP: NOP
  ENDIF

ABBREVIATION

 Np

AVAILABLE ON

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY