From 64ee605076b4f63e3a3a65316323cc61f210f030 Mon Sep 17 00:00:00 2001 From: Toad King Date: Sun, 11 Sep 2016 15:55:39 -0500 Subject: [PATCH] emscripten does not guarantee byte arrays to be aligned on word boundaries, specify alignment for them --- core/vdp_ctrl.c | 18 +++++++++--------- core/vdp_render.c | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/vdp_ctrl.c b/core/vdp_ctrl.c index f630765..ce8b1a1 100644 --- a/core/vdp_ctrl.c +++ b/core/vdp_ctrl.c @@ -54,15 +54,15 @@ } /* VDP context */ -uint8 sat[0x400]; /* Internal copy of sprite attribute table */ -uint8 vram[0x10000]; /* Video RAM (64K x 8-bit) */ -uint8 cram[0x80]; /* On-chip color RAM (64 x 9-bit) */ -uint8 vsram[0x80]; /* On-chip vertical scroll RAM (40 x 11-bit) */ -uint8 reg[0x20]; /* Internal VDP registers (23 x 8-bit) */ -uint8 hint_pending; /* 0= Line interrupt is pending */ -uint8 vint_pending; /* 1= Frame interrupt is pending */ -uint16 status; /* VDP status flags */ -uint32 dma_length; /* DMA remaining length */ +uint8 sat[0x400] __attribute__((aligned(4))); /* Internal copy of sprite attribute table */ +uint8 vram[0x10000] __attribute__((aligned(4))); /* Video RAM (64K x 8-bit) */ +uint8 cram[0x80] __attribute__((aligned(4))); /* On-chip color RAM (64 x 9-bit) */ +uint8 vsram[0x80] __attribute__((aligned(4))); /* On-chip vertical scroll RAM (40 x 11-bit) */ +uint8 reg[0x20]; /* Internal VDP registers (23 x 8-bit) */ +uint8 hint_pending; /* 0= Line interrupt is pending */ +uint8 vint_pending; /* 1= Frame interrupt is pending */ +uint16 status; /* VDP status flags */ +uint32 dma_length; /* DMA remaining length */ /* Global variables */ uint16 ntab; /* Name table A base address */ diff --git a/core/vdp_render.c b/core/vdp_render.c index 485949a..c9493b3 100644 --- a/core/vdp_render.c +++ b/core/vdp_render.c @@ -553,7 +553,7 @@ static const uint32 tms_palette[16] = #endif /* Cached and flipped patterns */ -static uint8 bg_pattern_cache[0x80000]; +static uint8 bg_pattern_cache[0x80000] __attribute__((aligned(4))); /* Sprite pattern name offset look-up table (Mode 5) */ static uint8 name_lut[0x400];