mirror of
https://github.com/mattrberry/crab.git
synced 2024-11-16 19:49:30 +01:00
make io register byte accesses respect non-writable bits (FIX SUPERSTAR SAGA)
The fact that this fixes Supestar Saga is both happy and sad for me. I spent so much time trying to fix that game before, but I didn't even mean to fix it this time. Either way, it works now. Finally.
This commit is contained in:
parent
7c45654b16
commit
73712b10ba
1 changed files with 4 additions and 4 deletions
|
@ -2,26 +2,26 @@ module GBA
|
|||
module Reg
|
||||
module Base16
|
||||
def read_byte(byte_num : Int) : Byte
|
||||
(@value >> (8 * byte_num)).to_u8!
|
||||
(value >> (8 * byte_num)).to_u8!
|
||||
end
|
||||
|
||||
def write_byte(byte_num : Int, byte : Byte) : Byte
|
||||
shift = 8 * byte_num
|
||||
mask = ~(0xFF_u16 << shift)
|
||||
@value = (@value & mask) | byte.to_u16 << shift
|
||||
self.value = (@value & mask) | byte.to_u16 << shift
|
||||
byte
|
||||
end
|
||||
end
|
||||
|
||||
module Base32
|
||||
def read_byte(byte_num : Int) : Byte
|
||||
(@value >> (8 * byte_num)).to_u8!
|
||||
(value >> (8 * byte_num)).to_u8!
|
||||
end
|
||||
|
||||
def write_byte(byte_num : Int, byte : Byte) : Byte
|
||||
shift = 8 * byte_num
|
||||
mask = ~(0xFF_u32 << shift)
|
||||
@value = (@value & mask) | byte.to_u32 << shift
|
||||
self.value = (@value & mask) | byte.to_u32 << shift
|
||||
byte
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue