llvm-mos-sdk
bios.h
Go to the documentation of this file.
1 #ifndef _BIOS_H_
2 #define _BIOS_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
9  unsigned char licensee;
10  char name[4];
11  char version;
12  char side_num;
13  char disk_num;
14  char disk_type;
15  char _unk;
16  char num_files;
17 };
18 
20  char id;
21  char name[8];
22  char *dest;
23  unsigned int size;
24  char type;
25  char *source;
27 };
28 
29 #define FDS_XFR_MODE_COPY 0
30 #define FDS_XFR_MODE_FILL 1
31 
32 #define FDS_XFR_INC_1 0
33 #define FDS_XFR_INC_32 1
34 
36  unsigned int address;
37  unsigned int length : 6;
38  unsigned int mode : 1;
39  unsigned int increment : 1;
40 };
41 
42 #define FDS_OBJ_NORMAL 0x00
43 #define FDS_OBJ_SKIP 0x01
44 #define FDS_OBJ_HIDE 0x80
45 
47  unsigned char render_flag;
48  unsigned char y;
49  unsigned char y_fractional;
50  unsigned char x;
51  unsigned char x_fractional;
52  unsigned char anim_frame;
53  unsigned int tile_arrange_ptr;
54  struct {
55  unsigned int flip_y : 1;
56  unsigned int _unused : 3;
57  unsigned int flip_x : 1;
58  } flags;
59  unsigned char palette;
60  struct {
61  unsigned int width : 4;
62  unsigned int height : 4;
63  } size;
64  unsigned char oam_idx;
65 };
66 
67 struct fds_bios_pads {
68  unsigned char pad[2];
69  unsigned char exp[2];
70 };
71 
73  unsigned char pad_1;
74  unsigned char pad_2;
75 };
76 
78  unsigned char trans[2];
79  unsigned char data[2];
80 };
81 
83  unsigned char trans[4];
84  unsigned char data[4];
85 };
86 
88  unsigned char y;
89  unsigned char x;
90 };
91 
93  char clr_home : 1;
94  char up : 1;
95  char right : 1;
96  char left : 1;
97  char down : 1;
98  char space : 1;
99  char del : 1;
100  char ins : 1;
101 
102  char f1 : 1;
103  char esc : 1;
104  char q : 1;
105  char ctr : 1;
106  char lshift : 1;
107  char grph : 1;
108  char one : 1;
109  char two : 1;
110 
111  char f2 : 1;
112  char w : 1;
113  char s : 1;
114  char a : 1;
115  char x : 1;
116  char z : 1;
117  char e : 1;
118  char three : 1;
119 
120  char f3 : 1;
121  char t : 1;
122  char r : 1;
123  char d : 1;
124  char f : 1;
125  char c : 1;
126  char five : 1;
127  char four : 1;
128 
129  char f4 : 1;
130  char y : 1;
131  char g : 1;
132  char h : 1;
133  char b : 1;
134  char v : 1;
135  char seven : 1;
136  char six : 1;
137 
138  char f5 : 1;
139  char i : 1;
140  char u : 1;
141  char j : 1;
142  char m : 1;
143  char n : 1;
144  char nine : 1;
145  char eight : 1;
146 
147  char f6 : 1;
148  char o : 1;
149  char l : 1;
150  char k : 1;
151  char period : 1;
152  char comma : 1;
153  char p : 1;
154  char zero : 1;
155 
156  char f7 : 1;
157  char at : 1;
158  char colon : 1;
159  char semicolon : 1;
160  char underscore : 1;
161  char slash : 1;
162  char dash : 1;
163  char caret : 1;
164 
165  char f8 : 1;
166  char ret : 1;
167  char lbracket : 1;
168  char rbracket : 1;
169  char kana : 1;
170  char rshift : 1;
171  char yen : 1;
172  char stop : 1;
173 };
174 
175 // Load files from disk.
176 __attribute__((leaf)) char fds_bios_LoadFiles(struct fds_bios_disk_id *disk_id,
177  char *file_ids, char *loaded);
178 // Append a file to disk.
179 __attribute__((leaf)) char
180 fds_bios_AppendFile(struct fds_bios_disk_id *disk_id,
182 // Write a file to disk.
183 __attribute__((leaf)) char
184 fds_bios_WriteFile(struct fds_bios_disk_id *disk_id,
186 // Compare and set the file count on disk.
187 __attribute__((leaf)) char
188 fds_bios_CheckFileCount(struct fds_bios_disk_id *disk_id, char count);
189 // Decrement the file count on disk.
190 __attribute__((leaf)) char
191 fds_bios_AdjustFileCount(struct fds_bios_disk_id *disk_id, char count);
192 // Set the file count + 1.
193 __attribute__((leaf)) char
194 fds_bios_SetFileCount1(struct fds_bios_disk_id *disk_id, char count);
195 // Set the file count.
196 __attribute__((leaf)) char
197 fds_bios_SetFileCount(struct fds_bios_disk_id *disk_id, char count);
198 // Get the ID info of the current disk.
199 __attribute__((leaf)) char
200 fds_bios_GetDiskInfo(struct fds_bios_disk_id *disk_id);
201 
202 // Compares the current disk header to the input string.
203 char fds_bios_CheckDiskHeader(char string[10]);
204 // Gets the listed amount of files from disk.
205 unsigned char fds_bios_GetNumFiles(void);
206 // Set the listed amount of files on disk.
207 void fds_bios_SetNumFiles(unsigned char num);
208 // Loads the provided file IDs from disk. Returns 0x00 if a match is found, or
209 // 0xFF if no match is found (or an entry in the list with a value of 0xFF is
210 // found).
211 char fds_bios_FileMatchTest(char *ids);
212 // Skip loading the given amount of files.
213 void fds_bios_SkipFiles(unsigned char num);
214 
215 // Delay by (at least) 131 CPU cycles.
216 void fds_bios_Delay131(void);
217 // Delay by (approximately) the given value in milliseconds.
218 __attribute__((leaf)) void fds_bios_Delayms(char delay);
219 
220 // Disable sprite/background rendering.
221 void fds_bios_DisPFObj(void);
222 // Enable sprite/background rendering.
223 void fds_bios_EnPFObj(void);
224 // Disable sprite rendering.
225 void fds_bios_DisObj(void);
226 // Enable sprite rendering.
227 void fds_bios_EnObj(void);
228 // Disable background rendering.
229 void fds_bios_DisPF(void);
230 // Enable background rendering.
231 void fds_bios_EnPF(void);
232 
233 // Wait until next vblank NMI.
234 void fds_bios_VINTWait(void);
235 
236 // Convert pixel coordinates to a nametable address.
237 unsigned fds_bios_Pixel2NamConv(struct fds_bios_coords coords);
238 // Convert a nametable address to pixel coordinates.
239 struct fds_bios_coords fds_bios_Nam2PixelConv(unsigned addr);
240 
241 // Perform sprite DMA. Should be used after `fds_bios_UploadObject`.
243 
244 // Read hardwired and expansion joypads.
245 struct fds_bios_pads fds_bios_ReadPads(void);
246 // Combines inputs from hardwired and expansion joypads.
247 // Use after `fds_bios_ReadPads`.
249 // Read up/down button transitions on hardwired joypads.
251 // Read up/down button transitions on hardwired and expansion joypads.
253 // Read up/down button transitions on hardwired joypads until two reads match.
255 // Read up/down button transitions on hardwired and expansion joypads until two
256 // reads match.
258 // Read up/down button transitions on hardwired and expansion joypads
259 // separately.
261 
262 // If tile_row > 0x20, fills pattern table with value for 16 * rows_attr tiles.
263 // If tile_row > = 0x20, fills corresponding nametable with value and attribute
264 // table with rows_attr.
265 __attribute__((leaf)) void fds_bios_VRAMFill(char tile_row, char value,
266  char rows_attr);
267 // Fill a section of RAM with a value.
268 __attribute__((leaf)) void fds_bios_MemFill(char value, char start, char end);
269 
270 // Reads from the Family BASIC Keyboard. Returns 0x00 if not connected, 0xFF if
271 // no errors.
272 __attribute__((leaf)) char
273 fds_bios_ReadKeyboard(struct fds_bios_keyboard_data *data);
274 
275 // Uploads an object to be used with `fds_bios_SpriteDMA`.
277 
278 #ifdef __cplusplus
279 }
280 #endif
281 
282 #endif
void delay(unsigned ms)
char char end
Definition: bios.h:268
char char * loaded
Definition: bios.h:177
struct fds_bios_file_header char file_num
Definition: bios.h:185
struct fds_bios_trans_pads * fds_bios_ReadDownVerifyPads(void)
char value
Definition: bios.h:265
void fds_bios_EnPFObj(void)
void fds_bios_EnObj(void)
char char rows_attr
Definition: bios.h:266
void fds_bios_SkipFiles(unsigned char num)
char fds_bios_CheckDiskHeader(char string[10])
void fds_bios_EnPF(void)
void fds_bios_DisPF(void)
char fds_bios_FileMatchTest(char *ids)
char * file_ids
Definition: bios.h:177
struct fds_bios_trans_pads * fds_bios_ReadOrDownPads(void)
char count
Definition: bios.h:188
unsigned char fds_bios_GetNumFiles(void)
void fds_bios_UploadObject(struct fds_bios_object *obj)
void fds_bios_VINTWait(void)
void fds_bios_SetNumFiles(unsigned char num)
struct fds_bios_pads_combined fds_bios_OrPads(struct fds_bios_pads pads)
void fds_bios_DisObj(void)
unsigned fds_bios_Pixel2NamConv(struct fds_bios_coords coords)
struct fds_bios_trans_exp_pads * fds_bios_ReadDownExpPads(void)
void fds_bios_SpriteDMA(void)
void fds_bios_DisPFObj(void)
char start
Definition: bios.h:268
struct fds_bios_coords fds_bios_Nam2PixelConv(unsigned addr)
struct fds_bios_trans_pads * fds_bios_ReadOrDownVerifyPads(void)
struct fds_bios_pads fds_bios_ReadPads(void)
struct fds_bios_trans_pads * fds_bios_ReadDownPads(void)
void fds_bios_Delay131(void)
char const void * data
Definition: neslib.h:92
Definition: bios.h:87
unsigned char x
Definition: bios.h:89
unsigned char y
Definition: bios.h:88
Definition: bios.h:8
char num_files
Definition: bios.h:16
char disk_num
Definition: bios.h:13
char _unk
Definition: bios.h:15
char name[4]
Definition: bios.h:10
char version
Definition: bios.h:11
char side_num
Definition: bios.h:12
unsigned char licensee
Definition: bios.h:9
char disk_type
Definition: bios.h:14
Definition: bios.h:19
char source_type
Definition: bios.h:26
unsigned int size
Definition: bios.h:23
char type
Definition: bios.h:24
char * source
Definition: bios.h:25
char * dest
Definition: bios.h:22
char id
Definition: bios.h:20
char name[8]
Definition: bios.h:21
Definition: bios.h:92
char f4
Definition: bios.h:129
char n
Definition: bios.h:143
char clr_home
Definition: bios.h:93
char right
Definition: bios.h:95
char l
Definition: bios.h:149
char p
Definition: bios.h:153
char t
Definition: bios.h:121
char b
Definition: bios.h:133
char j
Definition: bios.h:141
char z
Definition: bios.h:116
char lshift
Definition: bios.h:106
char kana
Definition: bios.h:169
char four
Definition: bios.h:127
char slash
Definition: bios.h:161
char one
Definition: bios.h:108
char f5
Definition: bios.h:138
char semicolon
Definition: bios.h:159
char del
Definition: bios.h:99
char ctr
Definition: bios.h:105
char rshift
Definition: bios.h:170
char nine
Definition: bios.h:144
char u
Definition: bios.h:140
char v
Definition: bios.h:134
char i
Definition: bios.h:139
char k
Definition: bios.h:150
char g
Definition: bios.h:131
char f3
Definition: bios.h:120
char w
Definition: bios.h:112
char f
Definition: bios.h:124
char c
Definition: bios.h:125
char grph
Definition: bios.h:107
char five
Definition: bios.h:126
char left
Definition: bios.h:96
char d
Definition: bios.h:123
char r
Definition: bios.h:122
char yen
Definition: bios.h:171
char m
Definition: bios.h:142
char a
Definition: bios.h:114
char lbracket
Definition: bios.h:167
char down
Definition: bios.h:97
char s
Definition: bios.h:113
char e
Definition: bios.h:117
char stop
Definition: bios.h:172
char f1
Definition: bios.h:102
char esc
Definition: bios.h:103
char o
Definition: bios.h:148
char two
Definition: bios.h:109
char up
Definition: bios.h:94
char h
Definition: bios.h:132
char colon
Definition: bios.h:158
char zero
Definition: bios.h:154
char three
Definition: bios.h:118
char six
Definition: bios.h:136
char x
Definition: bios.h:115
char f6
Definition: bios.h:147
char at
Definition: bios.h:157
char caret
Definition: bios.h:163
char dash
Definition: bios.h:162
char ins
Definition: bios.h:100
char space
Definition: bios.h:98
char f8
Definition: bios.h:165
char q
Definition: bios.h:104
char y
Definition: bios.h:130
char f2
Definition: bios.h:111
char f7
Definition: bios.h:156
char underscore
Definition: bios.h:160
char rbracket
Definition: bios.h:168
char ret
Definition: bios.h:166
char comma
Definition: bios.h:152
char seven
Definition: bios.h:135
char period
Definition: bios.h:151
char eight
Definition: bios.h:145
Definition: bios.h:46
unsigned char render_flag
Definition: bios.h:47
struct fds_bios_object::@125 flags
unsigned char anim_frame
Definition: bios.h:52
unsigned int width
Definition: bios.h:61
unsigned int height
Definition: bios.h:62
unsigned int flip_x
Definition: bios.h:57
unsigned char oam_idx
Definition: bios.h:64
unsigned int tile_arrange_ptr
Definition: bios.h:53
unsigned int flip_y
Definition: bios.h:55
unsigned int _unused
Definition: bios.h:56
unsigned char x
Definition: bios.h:50
unsigned char y
Definition: bios.h:48
unsigned char x_fractional
Definition: bios.h:51
unsigned char y_fractional
Definition: bios.h:49
struct fds_bios_object::@126 size
unsigned char palette
Definition: bios.h:59
Definition: bios.h:72
unsigned char pad_2
Definition: bios.h:74
unsigned char pad_1
Definition: bios.h:73
Definition: bios.h:67
unsigned char exp[2]
Definition: bios.h:69
unsigned char pad[2]
Definition: bios.h:68
Definition: bios.h:82
unsigned char trans[4]
Definition: bios.h:83
unsigned char data[4]
Definition: bios.h:84
Definition: bios.h:77
unsigned char trans[2]
Definition: bios.h:78
unsigned char data[2]
Definition: bios.h:79
Definition: bios.h:35
unsigned int length
Definition: bios.h:37
unsigned int increment
Definition: bios.h:39
unsigned int mode
Definition: bios.h:38
unsigned int address
Definition: bios.h:36
Definition: geos_types.h:124