Regsv
Listing index
Space
Routine:        Reset   
Function:       Restarts the entire system, if RST is pressed for longer than 0.5s
Called by:      Clock.
Calls:          None
Entry:          None
Exit:           None
Preserved:      C,D,E,H,L,IX,IY


RESET   IN      A,(8)
        OR      224
        CP      239
; Check if Rst key is being pressed, return if not.
        RET     NZ
        IN      A,(6)
        ADD     A,25
; Load B with current 50 Hz counter value + 25.
        LD      B,A
RESET1  IN      A,(8)
        OR      224
        CP      239
; Check that the Rst key is still pressed.
        RET     NZ
        IN      A,(6)
        CP      B
; Loop until 0.5 seconds have passed.
        JR      NZ,RESET1
; Jump to 0, i.e a system reset.
        RST     0
 
Regsv
Listing index
Space