Repository navigation
Expand file tree
/
Copy pathutilities.c
More file actions
115 lines (95 loc) · 2.03 KB
/
Copy pathutilities.c
File metadata and controls
115 lines (95 loc) · 2.03 KB
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
#include "utilities.h"
void __fastcall__ enableBacklight()
{
#ifdef BACKLIGHT_412B_C
R412B = 0xFF;
R412C = 0x00;
#elif defined(BACKLIGHT_4138_9_F)
R413F = 0x1F;
R4138 = 0x0B;
R4139 = 0x0F;
#endif
}
void __fastcall__ enableBacklight_G5()
{
// Seems to be turning on the backlight + screen??
unsigned char i = 0;
i = R4139;
i = i | 0x02;
R4139 = i;
R413F = 0x1F;
}
void __fastcall__ initPPU()
{
PPU.control = 0x80;
PPU.mask = 0x0A;
PPU.scroll = 0x00;
PPU.scroll = 0x00;
}
void __fastcall__ disablePPU()
{
PPU.control = 0x00;
PPU.mask = 0x00;
PPU.scroll = 0x00;
PPU.scroll = 0x00;
}
void __fastcall__ initPPU_OneBus()
{
R2016 = 0x00;
R2017 = 0x02;
R2012 = 0x04;
R2013 = 0x05;
R2014 = 0x06;
R2015 = 0x07;
R2018 = 0x20;
R201A = 0x00;
}
void __fastcall__ fillBackgroundZeros()
{
signed char a0 = PPU.status;
unsigned int i;
PPU.vram.address = 0x20;
PPU.vram.address = 0x00;
for(i = 0; i < 960; ++i)
{
PPU.vram.data = 0x00;
}
}
void __fastcall__ printText(unsigned PPU_addr, char* buffer)
{
PPU.vram.address = PPU_addr >> 8;
PPU.vram.address = PPU_addr & 0xff;
while(*buffer)
PPU.vram.data = *buffer++;
}
void __fastcall__ itoa3(char* digitsChr, unsigned int a)
{
unsigned char tensPart;
digitsChr[0] = (a / 100) + 0x30;
tensPart = a % 100;
digitsChr[1] = (tensPart / 10) + 0x30;
digitsChr[2] = (tensPart % 10) + 0x30;
digitsChr[3] = '\0';
}
void __fastcall__ placeTile(unsigned int PPU_addr, unsigned char tileNo)
{
PPU.vram.address = PPU_addr >> 8;
PPU.vram.address = PPU_addr & 0xff;
PPU.vram.data = tileNo;
}
void __fastcall__ disableRender()
{
//waitvsync();
//PPU.control = 0x00;
PPU.mask &= 0b11110111;
}
void __fastcall__ enableRender()
{
signed char a0 = 0;
waitvsync();
a0 = PPU.status;
PPU.scroll = 0x00;
PPU.scroll = 0x00;
//PPU.control = 0x80;
PPU.mask |= 0b00001000;
}