llvm-mos-sdk
pet.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 // Originally from cc65. Modified from original version.
7 
8 // clang-format off
9 
10 /*****************************************************************************/
11 /* */
12 /* pet.h */
13 /* */
14 /* PET system specific definitions */
15 /* */
16 /* */
17 /* */
18 /* (C) 1998-2005 Ullrich von Bassewitz */
19 /* Roemerstrasse 52 */
20 /* D-70794 Filderstadt */
21 /* EMail: uz@cc65.org */
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 
44 
45 #ifndef _PET_H
46 #define _PET_H
47 
48 
49 
50 /* Check for errors */
51 #if !defined(__PET__)
52 # error This module may only be used when compiling for the CBM PET!
53 #endif
54 
55 
56 
57 /*****************************************************************************/
58 /* Data */
59 /*****************************************************************************/
60 
61 
62 
63 /* Color defines */
64 #define COLOR_BLACK 0x00
65 #define COLOR_WHITE 0x01
66 
67 /* Masks for joy_read */
68 #define JOY_UP_MASK 0x01
69 #define JOY_DOWN_MASK 0x02
70 #define JOY_LEFT_MASK 0x04
71 #define JOY_RIGHT_MASK 0x08
72 #define JOY_BTN_1_MASK 0x10
73 
74 /* Define hardware */
75 #include <_pia.h>
76 #define PIA1 (*(volatile struct __pia*)0xE810)
77 #define PIA2 (*(volatile struct __pia*)0xE820)
78 
79 #include <_6522.h>
80 #define VIA (*(volatile struct __6522*)0xE840)
81 
82 /* All models from 40xx and above */
83 #include <_6545.h>
84 #define CRTC (*(volatile struct __6545)0xE880)
85 
86 /* SuperPET only */
87 #include <_6551.h>
88 #define ACIA (*(volatile struct __6551*)0xEFF0)
89 
90 
91 
92 /* End of pet.h */
93 #endif
_6551.h
_pia.h
_6545.h
_6522.h