Transfer osViModes to C files (#438)

* Transfer osViModes to C files

* Finish spec

* Import data to and Improve vi.c

* spec, again

* Format

* Use defines for the types
This commit is contained in:
EllipticEllipsis
2021-11-11 04:04:57 +00:00
committed by GitHub
parent 29746156af
commit 304bfa443e
8 changed files with 155 additions and 11 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "global.h"
OSViMode osViModeMpalLan1 = {
OS_VI_MPAL_LAN1, // type
{
// comRegs
0x311E, // ctrl
SCREEN_WIDTH, // width
0x4651E39, // burst
0x20D, // vSync
0x40C11, // hSync
0xC190C1A, // leap
0x6C02EC, // hStart
0x200, // xScale
0, // vCurrent
},
{ // fldRegs
{
// [0]
0x280, // origin
0x400, // yScale
0x2501FF, // vStart
0xE0204, // vBurst
2, // vIntr
},
{
// [1]
0x280, // origin
0x400, // yScale
0x2501FF, // vStart
0xE0204, // vBurst
2, // vIntr
} },
};
+34
View File
@@ -0,0 +1,34 @@
#include "global.h"
OSViMode osViModeNtscHpf1 = {
OS_VI_NTSC_HPF1, // type
{
// comRegs
0x324E, // ctrl
640, // width
0x3E52239, // burst
0x20C, // vSync
0xC15, // hSync
0xC150C15, // leap
0x6C02EC, // hStart
0x400, // xScale
0, // vCurrent
},
{ // fldRegs
{
// [0]
0x500, // origin
0x2000800, // yScale
0x2301FD, // vStart
0xE0204, // vBurst
2, // vIntr
},
{
// [1]
0xA00, // origin
0x2000800, // yScale
0x2501FF, // vStart
0xE0204, // vBurst
2 // vIntr
} },
};
+34
View File
@@ -0,0 +1,34 @@
#include "global.h"
OSViMode osViModeNtscLan1 = {
OS_VI_NTSC_LAN1, // type
{
// comRegs
0x311E, // ctrl
SCREEN_WIDTH, // width
0x3E52239, // burst
0x20D, // vSync
0xC15, // hSync
0xC150C15, // leap
0x6C02EC, // hStart
0x200, // xScale
0, // vCurrent
},
{ // fldRegs
{
// [0]
0x280, // origin
0x400, // yScale
0x2501FF, // vStart
0xE0204, // vBurst
2, // vIntr
},
{
// [1]
0x280, // origin
0x400, // yScale
0x2501FF, // vStart
0xE0204, // vBurst
2, // vIntr
} },
};
+34
View File
@@ -0,0 +1,34 @@
#include "global.h"
OSViMode osViModePalLan1 = {
OS_VI_PAL_LAN1, // type
{
// comRegs
0x311E, // ctrl
SCREEN_WIDTH, // width
0x4541E3A, // burst
0x271, // vSync
0x170C69, // hSync
0xC6F0C6D, // leap
0x800300, // hStart
0x200, // xScale
0, // vCurrent
},
{ // fldRegs
{
// [0]
0x280, // origin
0x400, // yScale
0x5F0239, // vStart
0x9026B, // vBurst
2, // vIntr
},
{
// [1]
0x280, // origin
0x400, // yScale
0x5F0239, // vStart
0x9026B, // vBurst
2 // vIntr
} },
};
+9 -6
View File
@@ -1,5 +1,9 @@
#include "global.h"
__OSViContext D_80098060[2] = { 0 };
__OSViContext* __osViCurr = &D_80098060[0];
__OSViContext* __osViNext = &D_80098060[1];
void __osViInit(void) {
bzero(D_80098060, sizeof(D_80098060));
__osViCurr = &D_80098060[0];
@@ -9,9 +13,9 @@ void __osViInit(void) {
__osViNext->buffer = (void*)0x80000000;
__osViCurr->buffer = (void*)0x80000000;
if (osTvType == 0) {
if (osTvType == OS_TV_PAL) {
__osViNext->modep = &osViModePalLan1;
} else if (osTvType == 2) {
} else if (osTvType == OS_TV_MPAL) {
__osViNext->modep = &osViModeMpalLan1;
} else {
__osViNext->modep = &osViModeNtscLan1;
@@ -20,10 +24,9 @@ void __osViInit(void) {
__osViNext->state = 0x20;
__osViNext->features = __osViNext->modep->comRegs.ctrl;
while (*(vu32*)0xA4400010 > 10) {
;
}
*(vu32*)0xA4400000 = 0;
while (HW_REG(VI_CURRENT_REG, u32) > 10) {}
HW_REG(VI_STATUS_REG, u32) = 0;
__osViSwapContext();
}