; Прочее...

        MAIN "",134

; HL - вызов на прерываниях стрелки

ARW_SCN EI 
        LD (Arw_Lp+1),HL
Arw_Lp  CALL 0
        CALL PUTARW
        HALT 
        CALL DIRSCN
        CALL MOVES
        CALL GETARW
        CALL BUTTON
        RET C
        LD A,(DIRECT)
        AND #10
        JR Z,Arw_Lp
        XOR A
        RET 

WAITKEY EI 
        HALT 
        XOR A
        IN A,(#FE)
        CPL 
        AND #1F
        PUSH AF
        CALL DIRSCN
        POP BC
        LD A,(CANCEL)
        AND A
        RET NZ
        LD A,(DIRECT)
        AND #10
        OR B
        JR Z,WAITKEY
        RET 

NOKEY   EI 
        HALT 
        XOR A
        IN A,(#FE)
        CPL 
        AND #1F
        PUSH AF
        CALL DIRSCN
        POP BC
        LD A,(CANCEL)
        AND A
        JR NZ,NOKEY
        LD A,(DIRECT)
        AND #10
        OR B
        JR NZ,NOKEY
        RET 

BUTTON  CALL MBUTTON
        LD A,(FIRE)
        AND A
        JR NZ,BUTTON1   ;MICE OK
        LD A,(CANCEL)
        AND A
        JR NZ,BUTTON2   ;MICE CANCEL
        LD A,#FEFE
        IN A,(#FE)
        RRCA 
        JR NC,BUTTON3   ;CS PRESSED
        CALL dirscn
;       CALL DIRSCN
        AND #10
        JR Z,nothing
        XOR A
        LD A,%001
brk     LD (BRK),A
        RET             ;"KEYBOARD OK PRESSED"

BUTTON3 LD A,#7F
        IN A,(#FE)
        RRCA 
        JR C,BUTTON4    ;MAY BE "EDIT" PRESSED?
        SCF 
        LD A,%010
        JR brk          ;"KEYBOARD CANCEL PRESSED"

BUTTON4 LD A,#F7
        IN A,(#FE)
        RRCA 
        JR C,nothing    ;NOTHING PRESSED
        SCF 
        LD A,%010
        JR brk          ;"KEYBOARD CANCEL PRESSED"

nothing XOR A
        JR brk

BUTTON1 XOR A
        LD A,%101
        JR brk          ;"MICE OK PRESSED"

BUTTON2 SCF 
        LD A,%110
        JR brk          ;"MICE CANCEL PRESSED"

