llvm-mos-sdk
mapper.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 #ifndef _MAPPER_H_
7 #define _MAPPER_H_
8 
9 #include <ines.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
18 #define MAPPER_USE_1_SCREEN \
19  asm(".globl __mirroring\n.globl __four_screen\n__mirroring = 0\n__four_screen = 1\n")
20 
28 #define MAPPER_USE_4_SCREEN_NAMETABLE \
29  asm(".globl __mirroring\n.globl __four_screen\n__mirroring = 1\n__four_screen = 1\n")
30 
37 #define MAPPER_USE_SELF_FLASHABLE_BOARD \
38  asm(".globl __battery\n__battery = 1\n")
39 
40 #define PRG_BANK_MASK 0x1F
41 #define PRG_BANK_SHIFT 0
42 #define CHR_BANK_MASK 0x60
43 #define CHR_BANK_SHIFT 5
44 #define CHR_BANK(n) ((n) << 5)
45 #define CHR_BANK_0 CHR_BANK(0)
46 #define CHR_BANK_1 CHR_BANK(1)
47 #define CHR_BANK_2 CHR_BANK(2)
48 #define CHR_BANK_3 CHR_BANK(3)
49 #define MIRROR_SCREEN_MASK 0x80
50 #define MIRROR_SCREEN_SHIFT 7
51 #define MIRROR_SCREEN_1 0x00
52 #define MIRROR_SCREEN_2 0x80
53 
59 __attribute__((leaf)) char get_bank_state(void);
60 
67 __attribute__((leaf)) char set_bank_state(char value);
68 
75 __attribute__((leaf, callback(2))) void banked_call(char bank_id,
76  void (*method)(void));
77 
83 __attribute__((leaf)) char get_prg_bank(void);
84 
91 __attribute__((leaf)) char set_prg_bank(char bank_id);
92 
98 __attribute__((leaf)) void set_chr_bank(char bank_id);
99 
107 __attribute__((leaf)) void swap_chr_bank(char bank_id);
108 
116 __attribute__((leaf)) void split_chr_bank(char bank_id);
117 
124 __attribute__((leaf)) void set_mirrored_screen(char screen_id);
125 
134 __attribute__((leaf)) void swap_mirrored_screen(char screen_id);
135 
144 __attribute__((leaf)) void split_mirrored_screen(char screen_id);
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif // _MAPPER_H_
ines.h
method
void(* method)(void))
Definition: mapper.h:41
bank_id
char bank_id
Definition: mapper.h:97