Program termination: Difference between revisions

Content added Content deleted
No edit summary
Line 1,681: Line 1,681:
<lang XPL0>if Problem then exit 1;
<lang XPL0>if Problem then exit 1;
</lang>
</lang>

=={{header|Z80 Assembly}}==
This mostly depends on the hardware, but typically home computers would boot in BASIC and <code>CALL</code> the starting address on the disk. This means that the return address for BASIC is on top of the stack, and an <code>RET</code> will exit the program and return to BASIC, provided that execution is not inside one of the disk's subroutines. The example below is typical of a home computer such as the Amstrad CPC:

<lang z80>;assumes this runs inline
org &1000 ;program start
main:
call GetInput ;unimplemented input get routine, returns key press in accumulator
cp 'Y' ;compare to ascii capital Y
ret z ;return to BASIC if equal
jp main ;loop back to main</lang>


=={{header|zkl}}==
=={{header|zkl}}==