-
Notifications
You must be signed in to change notification settings - Fork 19
/
gpu.c
49 lines (39 loc) · 1.09 KB
/
gpu.c
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
/*
* Demul
* Copyright (C) 2006 Demul Team
*
* Demul is not free software: you can't redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Demul isn't distributed in the hope that it will be useful,
* and WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#include "gpu.h"
#include "sh4.h"
#include "asic.h"
#include "plugins.h"
void FASTCALL gpuIrq(u32 code) {
hwInt(code);
}
void FASTCALL hblank() {
u32 count = ASIC32(0x810c) & 0x3ff;
ASIC32(0x810c) &= ~0x2000;
if (count == ((ASIC32(0x80cc) >> 16) & 0x3ff)) hwInt(0x0004);
if (count == ((ASIC32(0x80cc) >> 0) & 0x3ff)) hwInt(0x0003);
if (count == ((ASIC32(0x80f0) >> 0) & 0x3ff)) {
ASIC32(0x810c) |= 0x2000;
hwInt(0x0005);
}
count++;
if (count > 524) {
gpuSync();
count = 0;
}
ASIC32(0x810c) &= ~0x3ff;
ASIC32(0x810c) |= count;
// spuSync();
}