forked from loadzero/si78c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsi78c_proto.h
187 lines (187 loc) · 6.93 KB
/
si78c_proto.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
static void do_logprintf(const char *file, unsigned line, const char* format, ...);
int main(int argc, char **argv);
static void input();
static void init_renderer();
static void fini_renderer();
static void render();
static void loop_core(int *credit);
static void init_game();
static void fini_game();
static void init_threads(YieldReason entry_point);
static void run_main_ctx(YieldReason entry);
static void run_int_ctx();
static unsigned checksum(Mem *m);
static void rom_load(void *mem, const char* name, size_t offset, size_t len);
static void load_rom(void *mem);
static int execute(int allowed);
static void switch_to(ucontext_t *to);
static void co_switch(ucontext_t *prev, ucontext_t *next);
static void timeslice();
static void yield(YieldReason reason);
static uint8_t get_input(int64_t ticks, uint8_t port);
static uint8_t read_port(uint8_t port);
static void write_port(uint16_t port, uint8_t v);
static void enable_interrupts();
static void irq(uint8_t v);
static int interrupted();
static void fatalerror(const char* format, ...);
static inline Word u16_to_word(uint16_t u);
static inline Word u8_u8_to_word(uint8_t h, uint8_t l);
static inline uint16_t ptr_to_u16(uint8_t *ptr);
static inline Word ptr_to_word(uint8_t *ptr);
static inline uint8_t* u16_to_ptr(uint16_t u);
static inline uint8_t* word_to_ptr(Word w);
static int is_godmode();
static uint8_t* rompos(uint8_t* ram);
static uint8_t bcd_add(uint8_t bcd, uint8_t a, uint8_t *carry);
static void do_logprintf(const char *file, unsigned line, const char* format, ...);
static void DebugMessage(Word sc, uint8_t* msg, uint8_t n);
static void reset();
static void midscreen_int();
static void vblank_int();
static void vblank_coins();
static void InitRack();
static void InitAlienRacks();
static void DrawAlien();
static void CursorNextAlien();
static Word GetAlienCoords(uint8_t *rowout, uint8_t k);
static void InitAliensSub(uint8_t* dest);
static void InitAliensP1();
static void DrawBottomLine();
static uint8_t AddDelta(uint8_t* vecptr, uint8_t c);
static void RestoreFromROM(uint8_t* addr, size_t n);
static void CopyRomtoRam();
static void CopyRAMMirror();
static void DrawShieldP1();
static void DrawShieldP2();
static void DrawShieldCommon(uint8_t* dest);
static void RememberShieldsP1();
static void RememberShieldsP2();
static void RestoreShieldsP2();
static void RestoreShieldsP1();
static void CopyShields(uint8_t dir, uint8_t* sprbuf);
static void RunGameObjs(uint8_t* ptr);
static void GameObj0(uint8_t* unused);
static void HandleBlowingUpPlayer(uint8_t anim);
static void player_death(int invaded);
static int player_death_sub(int invaded);
static void DrawPlayerShot(int op);
static void GameObj1(uint8_t* unused);
static SprDesc ReadPlyShot();
static void GameObj2(uint8_t* unused1);
static void GameObj3(uint8_t* unused);
static void ProcessSquigglyShot();
static void ToShotStruct(AShot* src, uint8_t picend);
static void FromShotStruct(AShot* dest);
static void HandleAlienShot();
static int DoHandleAlienShotMove();
static void HandleAlienShotMove();
static uint8_t FindInColumn(uint8_t *out, uint8_t col);
static void ShotBlowingUp();
static void DrawAlienShot();
static void EraseAlienShot();
static void GameObj4(uint8_t* unused);
static void RemoveSaucer();
static SprDesc GetSaucerInfo();
static void DrawPlayer();
static void DrawSaucer();
static void WaitForStart();
static void NewGame(uint8_t is2p, uint8_t cost, int skip);
static uint8_t* GetRefAlienInfo(uint8_t *dxr, Word *pos);
static uint8_t* GetAlRefPtr();
static void PromptPlayer();
static uint8_t GetShipsPerCred();
static void SpeedShots();
static void PrintMessage(Word sc, uint8_t* msg, size_t n);
static Word DrawChar(Word sc, uint8_t c);
static void TimeToSaucer();
static uint8_t GetNumberOfShips(uint8_t* *ptr);
static void CheckAndHandleExtraShipAward();
static uint8_t* AlienScoreValue(uint8_t row);
static void AdjustScore();
static void Print4Digits(Word sc, Word val);
static Word DrawHexByte(Word sc, uint8_t c);
static Word DrawHexByteSub(Word sc, uint8_t c);
static uint8_t* GetScoreDescriptor();
static void ClearPlayField();
static void HandleEndOfTurn();
static void HandleEndOfTurnSub();
static uint8_t IsPlayerAlive();
static void ScoreForAlien(uint8_t row);
static void Animate();
static Word PrintMessageDel(Word sc, uint8_t* str, uint8_t n);
static void SplashSquiggly();
static void OneSecDelay();
static void TwoSecDelay();
static void SplashDemo();
static void ISRSplTasks();
static void MessageToCenterOfScreen(uint8_t* str);
static void WaitOnDelay(uint8_t n);
static void IniSplashAni(uint8_t* src);
static uint8_t CheckPlyrShotAndBump();
static void EraseSimpleSprite(Word pos, uint8_t n);
static Word DrawSimpSprite(SprDesc *desc);
static Word CnvtPixNumber(Word pos);
static void DrawShiftedSprite(struct SprDesc *desc);
static void EraseShifted(struct SprDesc *desc);
static void DrawSprCollision(struct SprDesc *desc);
static void DrawSprite(struct SprDesc *desc);
static void DrawSpriteGeneric(struct SprDesc *desc, int op);
static Word ClearSmallSprite(Word sc, uint8_t n, uint8_t v);
static void PlayerShotHit();
static uint8_t Cnt16s(uint8_t *v, uint8_t tgt);
static Word FindRow(uint8_t y);
static Word FindColumn(uint8_t x);
static uint8_t* GetAlienStatPtr(uint8_t row, uint8_t col);
static void RackBump();
static uint8_t RackBumpEdge(Word sc);
static void CountAliens();
static uint8_t* GetPlayerDataPtr();
static void PlrFireOrDemo();
static void GameOver();
static void on_invaded();
static void AShotReloadRate();
static void ShotSound();
static void TimeFleetSound();
static void DisableFleetSound();
static void SetSoundWithoutFleet(uint8_t v);
static uint8_t FleetDelayExShip();
static uint8_t ReadInputs();
static void CheckHandleTilt();
static void on_tilt();
static void CtrlSaucerSound();
static void DrawAdvTable();
static void Draw16ByteSprite(Word sc, uint8_t* sprite);
static void PrintMessageAdv(Word sc, uint8_t* msg);
static int ReadPriStruct(PriCursor *pri);
static void SplashSprite();
static void AnimateShootingSplashAlien();
static void main_init(int skip);
static uint8_t* GetOtherPlayerAliveFlag();
static void SoundBits3On(uint8_t mask);
static void InitAliensP2();
static void PlyrShotAndBump();
static uint8_t* CurPlyAlive();
static void DrawScoreHead();
static void PrintP1Score();
static void PrintP2Score();
static void DrawScore(uint8_t* iter);
static void PrintCreditLabel();
static void DrawNumCredits();
static void PrintHiScore();
static void DrawStatus();
static void PrintTaitoCorporation();
static void CheckHiddenMes();
static void EnableGameTasks();
static void DsableGameTasks();
static void SoundBits3Off(uint8_t mask);
static void DrawNumShips(uint8_t n);
static void DrawNumShipsSub(Word pos);
static uint8_t CompXrToBeam(uint8_t* posaddr);
static void BlockCopy(void *_dest, void *_src, size_t n);
static SprDesc ReadDesc(SprDesc* src);
static Word ConvToScr(Word pos);
static void ClearScreen();
static void CopyShieldBuffer(ShieldBufferCursor *cursor, Word spr_size, uint8_t dir);
static void RemoveShip();
static void PrintNumShips(uint8_t num);