use MAP_ADDR_TO_PAGE for memory mapping experimental_memory_mapper_v2

Wed, 13 Mar 2013 00:40:42 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 13 Mar 2013 00:40:42 +0000
branch
experimental_memory_mapper_v2
changeset 133
84ed5ec1d1e0
parent 132
8a7dc9b5b1db
child 135
159f937af10d

use MAP_ADDR_TO_PAGE for memory mapping

src/memory.c file | annotate | diff | revisions
     1.1 --- a/src/memory.c	Fri Jan 18 22:52:43 2013 +0000
     1.2 +++ b/src/memory.c	Wed Mar 13 00:40:42 2013 +0000
     1.3 @@ -19,9 +19,9 @@
     1.4   ******************/
     1.5  
     1.6  /// Set a page bit
     1.7 -#define MAP_SET_PAGEBIT(addr, bit) state.map[(((addr) >> 12) & 0x3FF)*2] |=  (bit << 2)
     1.8 +#define MAP_SET_PAGEBIT(addr, bit) state.map[(MAP_ADDR_TO_PAGE(addr))*2] |=  ((uint8_t)bit << 2)
     1.9  /// Clear a page bit
    1.10 -#define MAP_CLR_PAGEBIT(addr, bit) state.map[(((addr) >> 12) & 0x3FF)*2] &= ~(bit << 2)
    1.11 +#define MAP_CLR_PAGEBIT(addr, bit) state.map[(MAP_ADDR_TO_PAGE(addr))*2] &= ~((uint8_t)bit << 2)
    1.12  
    1.13  
    1.14  /********************************************************