82 lines
898 B
NASM
Raw Normal View History

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