diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 15:59:08 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 15:59:08 -0500 |
commit | 3a2dbb5289e745dfb5f26844148c0981f14e8fcf (patch) | |
tree | dfb418aa41502c67ae3f75bab4d3df91b5cfd6c1 /common/sram.asm | |
parent | 37e1aa4e8ec2400ba97db4c767bd3a9fcd43a1ac (diff) | |
parent | abb7f2fa20e49cf56a55c81d4ec86431e3009098 (diff) |
Merge branch 'yenatch/split-predefs-specials-stds' into fix-split-predefs-specials-stds
https://github.com/kanzure/pokecrystal/pull/198
Diffstat (limited to 'common/sram.asm')
-rw-r--r-- | common/sram.asm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/common/sram.asm b/common/sram.asm new file mode 100644 index 000000000..3c42e7618 --- /dev/null +++ b/common/sram.asm @@ -0,0 +1,34 @@ +GetSRAMBank: ; 2fcb +; load sram bank a +; if invalid bank, sram is disabled + cp NUM_SRAM_BANKS + jr c, OpenSRAM + jr CloseSRAM +; 2fd1 + +OpenSRAM: ; 2fd1 +; switch to sram bank a + push af +; latch clock data + ld a, 1 + ld [MBC3LatchClock], a +; enable sram/clock write + ld a, SRAM_ENABLE + ld [MBC3SRamEnable], a +; select sram bank + pop af + ld [MBC3SRamBank], a + ret +; 2fe1 + +CloseSRAM: ; 2fe1 + push af + ld a, SRAM_DISABLE +; reset clock latch for next time + ld [MBC3LatchClock], a +; disable sram/clock write + ld [MBC3SRamEnable], a + pop af + ret +; 2fec + |