Open Herringway opened 9 months ago
UNKNOWN_C41DB6 - glyph blitting? UNKNOWN_C41EB9, UNKNOWN_C41EC9, UNKNOWN_C41ED9 - blitting bitmasks UNKNOWN_C41EE9 - keeps track of maximum of ???
UNKNOWN_7E3B12 - blitting buffer UNKNOWN_7E3C14, UNKNOWN_7E3C16, UNKNOWN_7E3C18, UNKNOWN_7E3C1C , UNKNOWN_7E3C1E - relevant blitting vars
Blitting is done with handwritten assembly. The logic is something like
ushort[] vwfBuf;
ubyte[] unknown7E3B12;
int unknown7E3C14;
int unknown7E3C16;
int unknown7E3C18;
int unknown7E3C1C;
void unknownC41EE9(int);
void unknownC41EF4(int);
void unknownC41BCA(int, ubyte*, int);
void unknownC41DB6(int a) {
int x08 = unknown7E3C16 & 7;
int x0A = ((unknown7E3C16 / 8) * unknown7E3C18) + (unknown7E3C14 / 8) + unknown7E3C1C * 8 + x08;
unknownC41EE9(x0A);
immutable x0E = [0xFFFF, 0x7F7F, 0x3F3F, 0x1F1F, 0x0F0F, 0x0707, 0x0303, 0x0101][unknown7E3C14 & 7];
immutable x10 = [0xF0F0, 0xF8F8, 0xFCFC, 0xFEFE, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF][unknown7E3C14 & 7];
immutable x12 = [0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8080, 0xC0C0, 0xE0E0][unknown7E3C14 & 7];
unknownC41BCA(a - 0x8000, &unknown7E3B12[0], unknown7E3C14 & 7);
for (int i = 0; i < 36; i += 3) {
vwfBuf[x0A] = ((unknown7E3B12[i] | (unknown7E3B12[i] << 8)) ^ vwfBuf[x0A] & x0E) ^ vwfBuf[x0A];
vwfBuf[x0A + 16] = ((unknown7E3B12[i + 1] | (unknown7E3B12[i + 1] << 8)) ^ vwfBuf[x0A + 16] & x10) ^ vwfBuf[x0A + 16];
if (x12 != 0) {
vwfBuf[x0A + 32] = ((unknown7E3B12[i + 2] | (unknown7E3B12[i + 2] << 8)) ^ vwfBuf[x0A + 32] & x12) ^ vwfBuf[x0A + 32];
}
x08 = (x08 + 1) & 7;
if (x08 == 0) {
x0A += (unknown7E3C18 - 1) * 16;
}
}
x0A += 16;
if (x12 != 0) {
x0A += 16;
}
unknownC41EF4(x0A);
}
Renders tiles to VRAM $7900-7C00 (96 tiles) UNKNOWN_C3EF26 - character widths? starts at character 0x10 UNKNOWN_C45DDD - sets up the transfer to VRAM
note that these labels reflect their addresses in earthbound, rather than in mother 2