org 51000 counter EQU inc_counter + 1 attrs EQU #5800 xylo EQU attrs + 40 zero_counter: xor a set_counter: ld (counter), a read_keyboard: ld a, #f7 in a, (#fe) rra jr nc, key_1 rra jr nc, key_2 rra jr nc, key_3 rra jr nc, key_4 rra jr c, read_keyboard key_5: ld de, #040C jr invoke key_2: ld de, #0103 jr invoke key_3: ld de, #0206 jr invoke key_4: ld de, #0309 jr invoke key_1: ld de, #0000 invoke: push de call highlight_key ld a, (counter) add a, d call play pop de call highlight_key inc_counter: ld a, 0 ;This value will be modified by the running code add a, 5 cp 25 jr nz, set_counter jr zero_counter highlight_key: ld hl, xylo push de ld d, 0 add hl, de ld e, 30 ld a, (hl) xor %01000000 ld b, 15 highlight_block: ld (hl), a inc hl ld (hl), a inc hl ld (hl), a add hl, de djnz highlight_block pop de ret INCLUDE "sample.asm"