Flow-control structures: Difference between revisions

→‎{{header|Z80 Assembly}}: added conditional jumps
m (→‎{{header|Z80 Assembly}}: added JR and interrupts.)
(→‎{{header|Z80 Assembly}}: added conditional jumps)
Line 3,017:
 
=={{header|Z80 Assembly}}==
<lang z80>JP &XXXX ; jump to an absolute address.
JP z,&XXXX ; conditionally jump to an absolute address. If the condition is not met, no jump shall occur and execution continues to the
JR &XX ; jump XX bytes forward or backward (this is a signed offset)
; next instruction.
JR z,&XX ; conditionally jump forward or backward (JR cannot use parity, overflow, or sign flags to jump. JP, CALL, and RET can.
 
JP (HL) ; copy the value in HL to the program counter
JR &XX ; jump XX bytes forward or backward (this is a signed offset)
JR z,&XX ; conditionally jump forward or backward (JR cannot use parity, overflow, or sign flags to jump. JP, CALL, and RET can.)
PUSH rr RET ; fake a return address and "return" to that address
CALL label ; call a subroutine named "label"
1,489

edits