diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 19:51:29 -0700 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-09-09 19:51:29 -0700 |
commit | 0d6efda9bb3aa99cc9d28b9b9e7edaae121b7d75 (patch) | |
tree | e804b9ed15832481d632904f42355743d9232515 /home/sram.asm | |
parent | 6d7043c0c65161ad8ee97fa66b94beba86761d25 (diff) | |
parent | 84a9b3907b9db08ee38e873554d8a6b4ac1b72b4 (diff) |
Merge pull request #198 from yenatch/split-predefs-specials-stds
decouple home/ from engine/
Diffstat (limited to 'home/sram.asm')
-rw-r--r-- | home/sram.asm | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/home/sram.asm b/home/sram.asm new file mode 100644 index 000000000..3c42e7618 --- /dev/null +++ b/home/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 + |