aboutsummaryrefslogtreecommitdiff
path: root/player/player.z80
blob: d6fed1a5bda47e315491c305c954c07e8e3610b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
ISR_TABLE_START = 0xfe00
ISR_TABLE_START_LO = 0xfe
ISR_TABLE_VALUE = 0xfd
ISR_TABLE_START_JP = 0xfdfd

EFX_TABLE_ADDR = 32000
EFX_IN_ADDR = EFX_TABLE_ADDR - 1

.area	_HOME
.area	_CODE
.area	_INITIALIZER
.area   _GSINIT
.area   _GSFINAL

.area	_DATA
.area	_INITIALIZED
.area	_BSEG
.area   _BSS
.area   _HEAP

.area   _CODE

_main::
	di
	ld sp, #0
	ei

        ld hl, #EFX_TABLE_ADDR
        ld (sfx_data), hl

        ld hl, #ISR_TABLE_START
	ld (hl), #ISR_TABLE_VALUE
        ld e, l
        ld d, h
	inc de
	ld bc, #257
	ldir

	ld a, #ISR_TABLE_START_LO
	ld i, a
	im 2

	ld hl, #ISR_TABLE_START_JP
	ld de, #isr
	ld a, #0xc3
	ld (hl), a
	inc hl
	ld (hl), e
	inc hl
	ld (hl), d
	ei

        ld a, (EFX_IN_ADDR)
        ld l, a
        call _beeper_queue

wait::
        ld a, (sfx_type)
        or a
        jr nz, wait

        halt
        halt
        halt
        halt

        out (0xff), a

        di
        halt

isr:
	ex af,af
	push hl
        push ix
	push iy
	push bc
	push de

        call _beeper_play

	pop de
	pop bc
	pop iy
	pop ix
	pop hl
	ex af,af
	ei

        ret

.include "../sdcc/beeper.z80"