Skip to content

Commit

Permalink
it's better to declare hardware registers as volatile
Browse files Browse the repository at this point in the history
(cherry picked from commit ca30a49)
  • Loading branch information
untoxa authored and Zal0 committed Aug 18, 2023
1 parent b64f79c commit ffca1a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/src/Sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
#include <stdarg.h>
#include "Music.h"

typedef volatile UINT8 * REG_PTR;

const UINT8 FX_REG_SIZES[] = {5, 4, 5, 4, 3};
const UINT16 FX_ADDRESS[] = {0xFF10, 0xFF16, 0xFF1A, 0xFF20, 0xFF24};

extern UINT8 music_mute_frames;

void PlayFx(SOUND_CHANNEL channel, UINT8 mute_frames, ...) {
UINT8 i;
UINT8* reg = (UINT8*)FX_ADDRESS[channel];
REG_PTR reg = (REG_PTR)FX_ADDRESS[channel];
va_list list;

if(channel != CHANNEL_5) {
Expand Down

0 comments on commit ffca1a1

Please sign in to comment.