;------------------------------------------------- ; Инициализация обработчика событий ;------------------------------------------------- InitEvent: ld hl,what ld b,8 xor a ld (hl),a inc hl djnz $-2 ld a,1 ; очистить буфер клавы rst 20h ld a,4 ; Get Mouse coord and buttons rst 30h ret ;------------------------------------------------- ; Чтение событий ;------------------------------------------------- handle_event: ld ix,what ; поле событий ld (ix+0),evNothing call get_mouse_info ; Get mouse coords & buttons jr nz,ButtPress ; Button Press ld a,2 ; опрос клавы без ожидания rst 20h ret z ; no keys or a jr z,CursKey bit 7,d jr z,CodeKey ; no press combination cp 9 ; Tab + CombKeys jr z,CursKey CodeKey: ld (ix+0),evKeyboard ld (ix+1),e ; code key ld (ix+2),d ; scan code ret CursKey:ld (ix+0),evCombKey ; Keyboard combination ld (ix+1),b ; keyboard flag ld (ix+2),d ; код курс. клавиш ret ButtPress: ld d,a ;bit 0,a ; правый бутон ? ;jr nz,RgtButt ; да ld (ix+0),evMouseFr ; Mouse buttons press ld (ix+1),l ; coord X ld (ix+2),h ; coord Y ret ;RgtButt:ld (ix+0),evCommand ;ld (ix+1),cmLocMenuM ;ret ; поле событий what: ds 8