mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-30 20:34:45 +01:00
fixed golden sun saves (return 64k flash id for 64k chips)
This commit is contained in:
parent
01eadfd5a6
commit
ed6d42b2e2
1 changed files with 5 additions and 3 deletions
|
@ -20,18 +20,20 @@ class Flash < Storage
|
|||
SET_BANK = 0xB0
|
||||
end
|
||||
|
||||
SANYO = 0x1362_u16
|
||||
|
||||
@state = State::READY
|
||||
@bank = 0_u8
|
||||
|
||||
def initialize(@type : Type)
|
||||
@memory = Bytes.new(@type.bytes, 0xFF)
|
||||
@id = case @type
|
||||
when Type::FLASH1M then 0x1362 # Sanyo
|
||||
else 0x1B32 # Panasonic
|
||||
end
|
||||
end
|
||||
|
||||
def [](index : Int) : Byte
|
||||
if @state.includes?(State::IDENTIFICATION) && 0 <= index <= 1
|
||||
(SANYO >> (8 * index) & 0xFF).to_u8!
|
||||
(@id >> (8 * index) & 0xFF).to_u8!
|
||||
else
|
||||
@memory[0x10000 * @bank + index]
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue