demOS

- Main Page
- Modules
- Data Structures
- Files

- File List

All Data Structures Files Modules Pages
SYSTEM.H
Go to the documentation of this file.
1 /*------------------------------------------------------------------------------ -----------------
2 Copyright J.Hubert 2015
3
4 This file is part of demOS
5
6 demOS is free software: you can redistribute it and/or modify it under the terms of
7 the GNU Lesser General Public License as published by the Free Software Foundation,
8 either version 3 of the License, or (at your option) any later version.
9
10 demOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ;
11 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 See the GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License along with demOS.
15 If not, see <http://www.gnu.org/licenses/>.
16 ------------------------------------------------------------------------------------------------- */
17
42 #ifndef SYSTEM_H
43 #define SYSTEM_H
44
45 #include "DEMOSDK\BASTYPES.H"
46 #include "DEMOSDK\ALLOC.H"
47
48 ENUM(SYSemulator)
49 {
50 SYSemulator_NOTDETECTED,
51 SYSemulator_STEEM,
52 SYSemulator_TOSBOX,
53 SYSemulator_PACIFIST
54 };
55
56 STRUCT(SYScore)
57 {
58 RINGallocator coremem;
59 RINGallocator mem;
60 void* bakGemdos32;
61 void* bakUSP;
62 u8 bakvideoMode;
63 u8 bakmfpInterruptEnableA;
64 u8 bakmfpInterruptMaskA;
65 u8 bakmfpInterruptEnableB;
66 u8 bakmfpInterruptMaskB;
67 u8 bakmfpVectorBase;
68 u32 bakvbl;
69 u32 bakdma;
70 u8 bakvideoAdr[3];
71 bool has2Drives;
72 u8 lastKey;
73 SYSemulator emulator;
74 u8* idleThreadStackBase;
75
76 u8* font;
77 u16 fontChars[256];
78
79 MEMallocator allocatorCoreMem;
80 MEMallocator allocatorMem;
81
82 # if !defined(DEMOS_OPTIMIZED) && !defined(DEMOS_USES_BOOTSECTOR)
83 MEMallocator allocatorStandard;
84 # endif
85
86 # ifndef __TOS__
87 u32 memoryMapHigh;
88 # endif
89 };
90
91 typedef void (*SYSthread)(void);
92
93 STRUCT(SYSinitParam)
94 {
95 void* coreAdr;
96 u32 coreSize;
97 void* adr;
98 u32 size;
99 SYSthread idleThread;
100 u16 idleThreadStackSize;
101 };
102
103 #ifndef SYSTEM_C
104 extern SYScore sys;
105 extern u16 SYSbeginFrameNum;
106
107 #endif
108
109 void SYSinit (SYSinitParam* _param);
110 void SYS_shutdown (void);
111 void SYSvsync (void);
112 void SYScheckHWRequirements (void);
113
114 extern volatile u32 SYSvblcount;
115 extern volatile u16 SYSvblLcount;
116
117 #ifdef __TOS__
118 # define SYSvsync { u16 currentvblcount = SYSvblLcount; while (SYSvblLcount == currentvblcount); }
119 # define SYSmemoryHighMap 0
120 #else
121 # define SYSvsync
122 # define SYSmemoryHighMap sys.memoryMapHigh
123 #endif
124
125 void SYSswitchIdle(void);
126 bool SYSsetIdlethread(void* _stacklow, void*_stackhigh);
127 void SYStune(void);
128 u32 SYSreadVideoBase (void);
129 void SYSwriteVideoBase (u32 _val);
130
131 #define SYS_kbhit (sys.lastKey != *HW_KEYBOARD_DATA)
132 u8 SYSgetKb(void);
133
134 void SYSfastPrint(char* _s, void* _screenprintadr, u16 _screenPitch, u16 _bitplanPitch, u32 _fontadr);
135
136 #define SYS_1P_BITSHIFT 1
137 #define SYS_2P_BITSHIFT 2
138 #define SYS_4P_BITSHIFT 3
139
140 #ifdef DEMOS_DEBUG
141 u16 SYStraceFPS (void* _image, u16 _pitch, u16 _planePitch, u16 _y);
142 u16 SYStraceAllocators (void* _image, u16 _pitch, u16 _planePitch, u16 _y);
143 u16 SYStraceHW (void* _image, u16 _pitch, u16 _planePitch, u16 _y);
144
145 void SYSdebugPrint (void* _screen, u16 _screenPitch, u16 _bitplanPitchShift, u16 _col, u16 _y, char* _s);
146 #else
147 # define SYSdebugPrint(_screen, _screenPitch, _bitplanPitchShift, _col, _y, _s)
148 #endif
149
150 typedef s8 SYSlock;
151
152 #define SYSlockInit(_lock) { _lock = 0; }
153
154 bool SYSlockMain (SYSlock* _lock); /* when called from main thread => you should manage retry if locked (non blocking strategy) */
155 void SYSlockIdle (SYSlock* _lock); /* when called from idle thread, it will spin till it is unlocked by main thread (blocking strategy) */
156
157 void* SYSgemdosSetMode (void* _adr);
158 void SYSreset (void);
159
160 #endif
MEMallocator
Definition: BASTYPES.H:125
RINGallocator
Definition: ALLOC.H:40
SYSinitParam
Definition: SYSTEM.H:93
ALLOC.H
RING
BASTYPES.H
BASTYPES
SYScore
Definition: SYSTEM.H:56