Skip to content

Commit 544b539

Browse files
committed
Added some checks to prevent useless note setting
1 parent f0e28f2 commit 544b539

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/speaker.c

+8
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ static u16 notes[7][12] = {
1717
};
1818

1919
bool note_playing = false;
20+
u8 current_note = NOTE_NONE;
21+
u8 current_octave = 0;
2022

2123
void speaker_note(u8 octave, u8 note) {
24+
if (octave == current_octave && note == current_note)
25+
return;
26+
27+
current_octave = octave;
28+
current_note = note;
29+
2230
if (note == NOTE_NONE)
2331
{
2432
speaker_pause();

src/stage0.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ _start:
3838
How many sectors do we read, value in cx
3939
*/
4040

41-
movw $0x40, %cx
41+
movw $0x23, %cx
4242
movw $0x1000, segment
4343
movw $0x0000, offset
4444
movw $1, sector

0 commit comments

Comments
 (0)