llvm-mos-sdk
lynx.h
Go to the documentation of this file.
1 // Copyright 2024 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 // Originally from cc65. Modified from original version.
7 
8 // clang-format off
9 
10 /*****************************************************************************/
11 /* */
12 /* lynx.h */
13 /* */
14 /* Lynx system-specific definitions */
15 /* */
16 /* */
17 /* */
18 /* (C) 2003 Shawn Jefferson */
19 /* */
20 /* Adapted with many changes Ullrich von Bassewitz, 2004-10-09 */
21 /* */
22 /* */
23 /* */
24 /* This software is provided 'as-is', without any expressed or implied */
25 /* warranty. In no event will the authors be held liable for any damages */
26 /* arising from the use of this software. */
27 /* */
28 /* Permission is granted to anyone to use this software for any purpose, */
29 /* including commercial applications, and to alter it and redistribute it */
30 /* freely, subject to the following restrictions: */
31 /* */
32 /* 1. The origin of this software must not be misrepresented; you must not */
33 /* claim that you wrote the original software. If you use this software */
34 /* in a product, an acknowledgment in the product documentation would be */
35 /* appreciated but is not required. */
36 /* 2. Altered source versions must be plainly marked as such, and must not */
37 /* be misrepresented as being the original software. */
38 /* 3. This notice may not be removed or altered from any source */
39 /* distribution. */
40 /* */
41 /*****************************************************************************/
42 
43 #ifndef _LYNX_H
44 #define _LYNX_H
45 
46 /* Check for errors */
47 #if !defined(__LYNX__)
48 # error This module may only be used when compiling for the Lynx game console!
49 #endif
50 
51 /* Masks for joy_read */
52 #define JOY_UP_MASK 0x80
53 #define JOY_DOWN_MASK 0x40
54 #define JOY_LEFT_MASK 0x20
55 #define JOY_RIGHT_MASK 0x10
56 #define JOY_BTN_1_MASK 0x01
57 #define JOY_BTN_2_MASK 0x02
58 
59 #define JOY_BTN_A_MASK JOY_BTN_1_MASK
60 #define JOY_BTN_B_MASK JOY_BTN_2_MASK
61 
62 #define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
63 #define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
64 
65 /* Define Hardware */
66 #include <_mikey.h>
67 #define MIKEY (*(volatile struct __mikey *)0xFD00)
68 
69 #define _MIKEY_TIMERS (*(volatile struct _mikey_all_timers *) 0xFD00) // mikey_timers[8]
70 #define _HBL_TIMER (*(volatile struct _mikey_timer *) 0xFD00) // timer0 (HBL)
71 #define _VBL_TIMER (*(volatile struct _mikey_timer *) 0xFD08) // timer2 (VBL)
72 #define _UART_TIMER (*(volatile struct _mikey_timer *) 0xFD14) // timer4 (UART)
73 #define _VIDDMA (*(volatile unsigned int *) 0xFD92) // dispctl/viddma
74 
75 #include <_suzy.h>
76 #define SUZY (*(volatile struct __suzy*)0xFC00)
77 
78 /* End of lynx.h */
79 #endif
_suzy.h
_mikey.h