llvm-mos-sdk
mapper_rom_single.h
Go to the documentation of this file.
1 // Copyright 2023 LLVM-MOS Project
2 // Licensed under the Apache License, Version 2.0 with LLVM Exceptions.
3 // See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
4 // information.
5 
6 // Mapper functions for single-area bank switching schemes.
7 // (F8, F6, F4, 3E, FA, E7, F0, UA, 0840)
8 
9 #ifndef _MAPPER_ROM_SINGLE_H_
10 #define _MAPPER_ROM_SINGLE_H_
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 // ROM bank index type.
17 typedef unsigned char rom_bank_t;
18 
19 // Switch in a ROM bank.
21 
22 // Switch in a ROM or RAM bank, depending on the high bit (if set, it's RAM)
24 
25 // Get the currently switched bank index.
26 // If the high bit is set, it's a RAM bank, otherwise it's a ROM bank.
28 
29 // Switch to another ROM bank and call this function. Note: Using banked_call to
30 // call a second function from within another banked_call is safe. This function
31 // works no matter which switchable bank the function is in.
32 __attribute__((callback(2))) void banked_call_rom(rom_bank_t bank_id,
33  void (*method)(void));
34 
35 #ifdef __cplusplus
36 }
37 #endif
38 
39 #endif
rom_bank_t
unsigned char rom_bank_t
Definition: mapper_rom_single.h:17
bank_select
void bank_select(rom_bank_t bank_id)
method
void(* method)(void))
Definition: mapper_rom_single.h:33
rom_bank_t
unsigned char rom_bank_t
Definition: mapper_rom_multi.h:17
set_current_bank
void set_current_bank(rom_bank_t bank_id)
bank_id
char bank_id
Definition: mapper.h:97
get_current_bank
rom_bank_t get_current_bank(void)