diff options
Diffstat (limited to 'c/src/lib/libbsp/arm/nds/libnds/source/arm9')
22 files changed, 0 insertions, 3525 deletions
diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S deleted file mode 100644 index 405e9f74a6..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/COS.S +++ /dev/null @@ -1,75 +0,0 @@ -/* Generated by BIN2S - please don't edit directly */ - .section .rodata - .balign 4 - .global COS_bin_size -COS_bin_size: .int 1024 - .global COS_bin -COS_bin: - .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15 - .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15 - .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15 - .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14 - .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14 - .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13 - .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12 - .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11 - .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10 - .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9 - .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7 - .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6 - .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4 - .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3 - .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1 - .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0 - .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254 - .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253 - .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251 - .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250 - .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248 - .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247 - .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246 - .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244 - .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243 - .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242 - .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241 - .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241 - .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240 - .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240 - .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240 - .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240 - .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240 - .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240 - .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240 - .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241 - .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241 - .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242 - .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243 - .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244 - .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245 - .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246 - .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248 - .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249 - .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251 - .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252 - .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254 - .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255 - .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1 - .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2 - .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4 - .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5 - .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7 - .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8 - .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9 - .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11 - .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12 - .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13 - .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14 - .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14 - .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15 - .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15 - .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15 - .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15 - - .global COS_bin_end -COS_bin_end: - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S deleted file mode 100644 index 7a9723b39b..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/SIN.S +++ /dev/null @@ -1,75 +0,0 @@ -/* Generated by BIN2S - please don't edit directly */ - .section .rodata - .balign 4 - .global SIN_bin_size -SIN_bin_size: .int 1024 - .global SIN_bin -SIN_bin: - .byte 0, 0, 50, 0,100, 0,150, 0,200, 0,251, 0, 45, 1, 95, 1 - .byte 145, 1,195, 1,245, 1, 39, 2, 89, 2,138, 2,188, 2,237, 2 - .byte 31, 3, 80, 3,129, 3,178, 3,227, 3, 19, 4, 68, 4,116, 4 - .byte 165, 4,213, 4, 4, 5, 52, 5, 99, 5,147, 5,194, 5,240, 5 - .byte 31, 6, 77, 6,123, 6,169, 6,215, 6, 4, 7, 49, 7, 94, 7 - .byte 138, 7,183, 7,226, 7, 14, 8, 57, 8,100, 8,143, 8,185, 8 - .byte 227, 8, 13, 9, 54, 9, 95, 9,135, 9,176, 9,215, 9,255, 9 - .byte 38, 10, 77, 10,115, 10,153, 10,190, 10,227, 10, 8, 11, 44, 11 - .byte 80, 11,115, 11,150, 11,184, 11,218, 11,252, 11, 29, 12, 62, 12 - .byte 94, 12,125, 12,157, 12,187, 12,217, 12,247, 12, 20, 13, 49, 13 - .byte 77, 13,105, 13,132, 13,159, 13,185, 13,210, 13,235, 13, 4, 14 - .byte 28, 14, 51, 14, 74, 14, 96, 14,118, 14,139, 14,160, 14,180, 14 - .byte 200, 14,219, 14,237, 14,255, 14, 16, 15, 33, 15, 49, 15, 64, 15 - .byte 79, 15, 93, 15,107, 15,120, 15,133, 15,145, 15,156, 15,167, 15 - .byte 177, 15,186, 15,195, 15,203, 15,211, 15,218, 15,225, 15,231, 15 - .byte 236, 15,240, 15,244, 15,248, 15,251, 15,253, 15,254, 15,255, 15 - .byte 0, 16,255, 15,254, 15,253, 15,251, 15,248, 15,244, 15,240, 15 - .byte 236, 15,231, 15,225, 15,218, 15,211, 15,203, 15,195, 15,186, 15 - .byte 177, 15,167, 15,156, 15,145, 15,133, 15,120, 15,107, 15, 93, 15 - .byte 79, 15, 64, 15, 49, 15, 33, 15, 16, 15,255, 14,237, 14,219, 14 - .byte 200, 14,180, 14,160, 14,139, 14,118, 14, 96, 14, 74, 14, 51, 14 - .byte 28, 14, 4, 14,235, 13,210, 13,185, 13,159, 13,132, 13,105, 13 - .byte 77, 13, 49, 13, 20, 13,247, 12,217, 12,187, 12,157, 12,125, 12 - .byte 94, 12, 62, 12, 29, 12,252, 11,218, 11,184, 11,150, 11,115, 11 - .byte 80, 11, 44, 11, 8, 11,227, 10,190, 10,153, 10,115, 10, 77, 10 - .byte 38, 10,255, 9,215, 9,176, 9,135, 9, 95, 9, 54, 9, 13, 9 - .byte 227, 8,185, 8,143, 8,100, 8, 57, 8, 14, 8,226, 7,183, 7 - .byte 138, 7, 94, 7, 49, 7, 4, 7,215, 6,169, 6,123, 6, 77, 6 - .byte 31, 6,240, 5,194, 5,147, 5, 99, 5, 52, 5, 4, 5,213, 4 - .byte 165, 4,116, 4, 68, 4, 19, 4,227, 3,178, 3,129, 3, 80, 3 - .byte 31, 3,237, 2,188, 2,138, 2, 89, 2, 39, 2,245, 1,195, 1 - .byte 145, 1, 95, 1, 45, 1,251, 0,200, 0,150, 0,100, 0, 50, 0 - .byte 0, 0,206,255,156,255,106,255, 56,255, 5,255,211,254,161,254 - .byte 111,254, 61,254, 11,254,217,253,167,253,118,253, 68,253, 19,253 - .byte 225,252,176,252,127,252, 78,252, 29,252,237,251,188,251,140,251 - .byte 91,251, 43,251,252,250,204,250,157,250,109,250, 62,250, 16,250 - .byte 225,249,179,249,133,249, 87,249, 41,249,252,248,207,248,162,248 - .byte 118,248, 73,248, 30,248,242,247,199,247,156,247,113,247, 71,247 - .byte 29,247,243,246,202,246,161,246,121,246, 80,246, 41,246, 1,246 - .byte 218,245,179,245,141,245,103,245, 66,245, 29,245,248,244,212,244 - .byte 176,244,141,244,106,244, 72,244, 38,244, 4,244,227,243,194,243 - .byte 162,243,131,243, 99,243, 69,243, 39,243, 9,243,236,242,207,242 - .byte 179,242,151,242,124,242, 97,242, 71,242, 46,242, 21,242,252,241 - .byte 228,241,205,241,182,241,160,241,138,241,117,241, 96,241, 76,241 - .byte 56,241, 37,241, 19,241, 1,241,240,240,223,240,207,240,192,240 - .byte 177,240,163,240,149,240,136,240,123,240,111,240,100,240, 89,240 - .byte 79,240, 70,240, 61,240, 53,240, 45,240, 38,240, 31,240, 25,240 - .byte 20,240, 16,240, 12,240, 8,240, 5,240, 3,240, 2,240, 1,240 - .byte 0,240, 1,240, 2,240, 3,240, 5,240, 8,240, 12,240, 16,240 - .byte 20,240, 25,240, 31,240, 38,240, 45,240, 53,240, 61,240, 70,240 - .byte 79,240, 89,240,100,240,111,240,123,240,136,240,149,240,163,240 - .byte 177,240,192,240,207,240,223,240,240,240, 1,241, 19,241, 37,241 - .byte 56,241, 76,241, 96,241,117,241,138,241,160,241,182,241,205,241 - .byte 228,241,252,241, 21,242, 46,242, 71,242, 97,242,124,242,151,242 - .byte 179,242,207,242,236,242, 9,243, 39,243, 69,243, 99,243,131,243 - .byte 162,243,194,243,227,243, 4,244, 38,244, 72,244,106,244,141,244 - .byte 176,244,212,244,248,244, 29,245, 66,245,103,245,141,245,179,245 - .byte 218,245, 1,246, 41,246, 80,246,121,246,161,246,202,246,243,246 - .byte 29,247, 71,247,113,247,156,247,199,247,242,247, 30,248, 73,248 - .byte 118,248,162,248,207,248,252,248, 41,249, 87,249,133,249,179,249 - .byte 225,249, 16,250, 62,250,109,250,157,250,204,250,252,250, 43,251 - .byte 91,251,140,251,188,251,237,251, 29,252, 78,252,127,252,176,252 - .byte 225,252, 19,253, 68,253,118,253,167,253,217,253, 11,254, 61,254 - .byte 111,254,161,254,211,254, 5,255, 56,255,106,255,156,255,206,255 - - .global SIN_bin_end -SIN_bin_end: - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S deleted file mode 100644 index c30a88de43..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/TAN.S +++ /dev/null @@ -1,75 +0,0 @@ -/* Generated by BIN2S - please don't edit directly */ - .section .rodata - .balign 4 - .global TAN_bin_size -TAN_bin_size: .int 1024 - .global TAN_bin -TAN_bin: - .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1 - .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2 - .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4 - .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6 - .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8 - .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10 - .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12 - .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15 - .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19 - .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23 - .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29 - .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37 - .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50 - .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75 - .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144 - .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23 - .byte 80,248, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70 - .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170 - .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200 - .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215 - .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225 - .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231 - .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236 - .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239 - .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242 - .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245 - .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247 - .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249 - .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250 - .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252 - .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254 - .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255 - .byte 0, 0, 50, 0,100, 0,150, 0,201, 0,251, 0, 46, 1, 96, 1 - .byte 147, 1,198, 1,249, 1, 44, 2, 95, 2,147, 2,198, 2,250, 2 - .byte 46, 3, 99, 3,151, 3,204, 3, 1, 4, 55, 4,109, 4,163, 4 - .byte 218, 4, 17, 5, 73, 5,129, 5,185, 5,242, 5, 44, 6,102, 6 - .byte 160, 6,219, 6, 23, 7, 84, 7,145, 7,207, 7, 13, 8, 77, 8 - .byte 141, 8,206, 8, 16, 9, 83, 9,151, 9,219, 9, 33, 10,104, 10 - .byte 176, 10,250, 10, 68, 11,144, 11,221, 11, 44, 12,124, 12,206, 12 - .byte 33, 13,118, 13,205, 13, 37, 14,128, 14,220, 14, 59, 15,156, 15 - .byte 255, 15,101, 16,206, 16, 57, 17,167, 17, 24, 18,140, 18, 3, 19 - .byte 126, 19,253, 19,128, 20, 7, 21,146, 21, 34, 22,183, 22, 82, 23 - .byte 242, 23,152, 24, 68, 25,247, 25,177, 26,115, 27, 62, 28, 17, 29 - .byte 239, 29,214, 30,201, 31,200, 32,212, 33,238, 34, 24, 36, 83, 37 - .byte 160, 38, 2, 40,122, 41, 11, 43,183, 44,130, 46,110, 48,129, 50 - .byte 190, 52, 44, 55,209, 57,180, 60,224, 63, 95, 67, 64, 71,147, 75 - .byte 111, 80,239, 85, 53, 92,112, 99,220,107,206,117,185,129, 70,144 - .byte 115,162,204,185,232,216,110, 4,175, 69,103,178,196,139,187, 23 - .byte 196,128, 69,232, 60,116,153, 77, 81,186,146,251, 24, 39, 52, 70 - .byte 141, 93,186,111, 71,126, 50,138, 36,148,144,156,203,163, 17,170 - .byte 145,175,109,180,192,184,161,188, 32,192, 76,195, 47,198,212,200 - .byte 66,203,127,205,146,207,126,209, 73,211,245,212,134,214,254,215 - .byte 96,217,173,218,232,219, 18,221, 44,222, 56,223, 55,224, 42,225 - .byte 17,226,239,226,194,227,141,228, 79,229, 9,230,188,230,104,231 - .byte 14,232,174,232, 73,233,222,233,110,234,249,234,128,235, 3,236 - .byte 130,236,253,236,116,237,232,237, 89,238,199,238, 50,239,155,239 - .byte 0,240,100,240,197,240, 36,241,128,241,219,241, 51,242,138,242 - .byte 223,242, 50,243,132,243,212,243, 35,244,112,244,188,244, 6,245 - .byte 80,245,152,245,223,245, 37,246,105,246,173,246,240,246, 50,247 - .byte 115,247,179,247,243,247, 49,248,111,248,172,248,233,248, 37,249 - .byte 96,249,154,249,212,249, 14,250, 71,250,127,250,183,250,239,250 - .byte 38,251, 93,251,147,251,201,251,255,251, 52,252,105,252,157,252 - .byte 210,252, 6,253, 58,253,109,253,161,253,212,253, 7,254, 58,254 - .byte 109,254,160,254,210,254, 5,255, 55,255,106,255,156,255,206,255 - - .global TAN_bin_end -TAN_bin_end: - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c deleted file mode 100644 index 8335635c33..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/boxtest.c +++ /dev/null @@ -1,97 +0,0 @@ -/*--------------------------------------------------------------------------------- - BoxTest.c -- Code for performing hardware box test against viewing frustrum - - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/arm9/video.h> -#include <nds/arm9/videoGL.h> - -/* - * Prototypes - * - * NOTE: This code appears to be externally available test code. - */ -void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth); -int BoxTestf(float x, float y, float z, float width, float height, float depth); -void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth); -int BoxTestResult(void); -int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth); - -//--------------------------------------------------------------------------------- -void BoxTest_Asynch(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth) -//--------------------------------------------------------------------------------- -{ - glPolyFmt(BIT(12) | BIT(13)); - glBegin(GL_TRIANGLES); - glEnd(); - - GFX_BOX_TEST = VERTEX_PACK(x, y); - GFX_BOX_TEST = VERTEX_PACK(z, width); - GFX_BOX_TEST = VERTEX_PACK(height, depth); -} - -//--------------------------------------------------------------------------------- -void BoxTestf_Asynch(float x, float y, float z, float width, float height, float depth) -//--------------------------------------------------------------------------------- -{ - BoxTest_Asynch(floattov16(x), floattov16(y), floattov16(z), - floattov16(width), floattov16(height), floattov16(depth)); -} - -//--------------------------------------------------------------------------------- -int BoxTestResult(void) -//--------------------------------------------------------------------------------- -{ - while(GFX_STATUS & BIT(0)); - - return (GFX_STATUS & BIT(1)); -} - -//--------------------------------------------------------------------------------- -int BoxTest(v16 x, v16 y, v16 z, v16 width, v16 height, v16 depth) -//--------------------------------------------------------------------------------- -{ - glPolyFmt(BIT(12) | BIT(13)); - glBegin(GL_TRIANGLES); - glEnd(); - - GFX_BOX_TEST = VERTEX_PACK(x, y); - GFX_BOX_TEST = VERTEX_PACK(z, width); - GFX_BOX_TEST = VERTEX_PACK(height, depth); - - while(GFX_STATUS & BIT(0)); - - return (GFX_STATUS & BIT(1)); -} - -//--------------------------------------------------------------------------------- -int BoxTestf(float x, float y, float z, float width, float height, float depth) -//--------------------------------------------------------------------------------- -{ - return BoxTest(floattov16(x), floattov16(y), floattov16(z), - floattov16(width), floattov16(height), floattov16(depth)); -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c deleted file mode 100644 index 23adf4c0c2..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/console.c +++ /dev/null @@ -1,456 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/jtypes.h> -#include <nds/memory.h> -#include <nds/arm9/console.h> -#include <nds/arm9/video.h> -#include <nds/arm9/background.h> -#include <default_font_bin.h> - -#include <stdio.h> -#include <stdarg.h> -#include <sys/iosupport.h> - -// global console variables - -#define CONSOLE_WIDTH 32 -#define CONSOLE_HEIGHT 24 -#define TAB_SIZE 3 - -// map to print to -static u16* fontMap; - -// location of cursor -static int row, col; -static int savedX, savedY; - -// font may not start on a character base boundry -static u16 fontOffset; - -// the first character in the set (0 if you have a full set) -static u16 fontStart; - -// the 16-color palette to use -bool fontBold = false; -static u16 fontPal; - -static int consoleInitialised = 0; - -void consolePrintChar(char c); - - -//--------------------------------------------------------------------------------- -static void consoleCls(char mode) { -//--------------------------------------------------------------------------------- - - int i = 0; - int colTemp,rowTemp; - - switch (mode) - { - case '0': - { - colTemp = col; - rowTemp = row; - - while(i++ < ((CONSOLE_HEIGHT * CONSOLE_WIDTH) - (rowTemp * CONSOLE_WIDTH + colTemp))) consolePrintChar(' '); - - col = colTemp; - row = rowTemp; - break; - } - case '1': - { - colTemp = col; - rowTemp = row; - - row = 0; - col = 0; - - while (i++ < (rowTemp * CONSOLE_WIDTH + colTemp)) consolePrintChar(' '); - - col = colTemp; - row = rowTemp; - break; - } - case '2': - { - row = 0; - col = 0; - - while(i++ < CONSOLE_HEIGHT * CONSOLE_WIDTH) consolePrintChar(' '); - - row = 0; - col = 0; - break; - } - } -} -//--------------------------------------------------------------------------------- -static void consoleClearLine(char mode) { -//--------------------------------------------------------------------------------- - - int i = 0; - int colTemp; - - switch (mode) - { - case '0': - { - colTemp = col; - - while(i++ < (CONSOLE_WIDTH - colTemp)) { - consolePrintChar(' '); - } - - col = colTemp; - - break; - } - case '1': - { - colTemp = col; - - col = 0; - - while(i++ < ((CONSOLE_WIDTH - colTemp)-2)) { - consolePrintChar(' '); - } - - col = colTemp; - - break; - } - case '2': - { - colTemp = col; - - col = 0; - - while(i++ < CONSOLE_WIDTH) { - consolePrintChar(' '); - } - - col = colTemp; - - break; - } - default: - { - colTemp = col; - - while(i++ < (CONSOLE_WIDTH - colTemp)) { - consolePrintChar(' '); - } - - col = colTemp; - - break; - } - } -} -//--------------------------------------------------------------------------------- -static int con_write(struct _reent *r,int fd,const char *ptr,int len) { -//--------------------------------------------------------------------------------- - - if (!consoleInitialised) return -1; - - char chr; - - int i, count = 0; - char *tmp = (char*)ptr; - - if(!tmp || len<=0) return -1; - - i = 0; - while(*tmp!='\0' && i<len) { - - chr = *(tmp++); - i++; count++; - - if ( chr == 0x1b && *tmp == '[' ) { - bool escaping = true; - char *escapeseq = tmp; - int escapelen = 0; - - do { - chr = *(tmp++); - i++; count++; escapelen++; - int parameter; - - switch (chr) { - ///////////////////////////////////////// - // Cursor directional movement - ///////////////////////////////////////// - case 'A': - siscanf(escapeseq,"[%dA", ¶meter); - row = (row - parameter) < 0 ? 0 : row - parameter; - escaping = false; - break; - case 'B': - siscanf(escapeseq,"[%dB", ¶meter); - row = (row + parameter) > CONSOLE_HEIGHT - 1 ? CONSOLE_HEIGHT - 1 : row + parameter; - escaping = false; - break; - case 'C': - siscanf(escapeseq,"[%dC", ¶meter); - col = (col + parameter) > CONSOLE_WIDTH - 1 ? CONSOLE_WIDTH - 1 : col + parameter; - escaping = false; - break; - case 'D': - siscanf(escapeseq,"[%dC", ¶meter); - col = (col - parameter) < 0 ? 0 : col - parameter; - escaping = false; - break; - ///////////////////////////////////////// - // Cursor position movement - ///////////////////////////////////////// - case 'H': - case 'f': - siscanf(escapeseq,"[%d;%df", &row, &col); - escaping = false; - break; - ///////////////////////////////////////// - // Screen clear - ///////////////////////////////////////// - case 'J': - consoleCls(escapeseq[escapelen-2]); - escaping = false; - break; - ///////////////////////////////////////// - // Line clear - ///////////////////////////////////////// - case 'K': - consoleClearLine(escapeseq[escapelen-2]); - escaping = false; - break; - ///////////////////////////////////////// - // Save cursor position - ///////////////////////////////////////// - case 's': - savedX = col; - savedY = row; - escaping = false; - break; - ///////////////////////////////////////// - // Load cursor position - ///////////////////////////////////////// - case 'u': - col = savedX; - row = savedY; - escaping = false; - break; - } - } while (escaping); - continue; - } - - consolePrintChar(chr); - } - - return count; -} - -const devoptab_t dotab_stdout = { - "con", - NULL, - NULL, - con_write, - NULL, - NULL, - NULL -}; - - -/*--------------------------------------------------------------------------------- - consoleInit - param: - font: 16 color font - charBase: the location the font data will be loaded to - numCharacters: count of characters in the font - charStart: The ascii number of the first character in the font set - if you have a full set this will be zero - map: pointer to the map you will be printing to. - pal: specifies the 16 color palette to use, if > 15 it will change all non-zero - entries in the font to use palette index 255 ----------------------------------------------------------------------------------*/ -void consoleInit( u16* font, u16* charBase, - u16 numCharacters, u8 charStart, - u16* map, u8 pal, u8 bitDepth) { -//--------------------------------------------------------------------------------- - int i; - - row = col = 0; - - fontStart = charStart; - - fontOffset = 0; - - fontMap = map; - - if(bitDepth == 16) - { - if(pal < 16) - { - fontPal = pal << 12; - - for (i = 0; i < numCharacters * 16; i++) - charBase[i] = font[i]; - } - else - { - fontPal = 15 << 12; - - for (i = 0; i < numCharacters * 16; i++) - { - u16 temp = 0; - - if(font[i] & 0xF) - temp |= 0xF; - if(font[i] & 0xF0) - temp |= 0xF0; - if(font[i] & 0xF00) - temp |= 0xF00; - if(font[i] & 0xF000) - temp |= 0xF000; - - charBase[i] = temp; - } - } - }//end if bitdepth - else - { - fontPal = 0; - for(i = 0; i < numCharacters * 16; i++) - { - u32 temp = 0; - - if(font[i] & 0xF) - temp = 255; - if(font[i] & 0xF0) - temp |= 255 << 8; - if(font[i] & 0xF00) - temp |= 255 << 16; - if(font[i] & 0xF000) - temp |= 255 << 24; - - ((u32*)charBase)[i] = temp; - - } - } - - devoptab_list[STD_OUT] = &dotab_stdout; - devoptab_list[STD_ERR] = &dotab_stdout; - setvbuf(stderr, NULL , _IONBF, 0); - setvbuf(stdout, NULL , _IONBF, 0); - consoleCls('2'); - consoleInitialised = 1; - -} - -//--------------------------------------------------------------------------------- -// Places the console in a default mode using bg0 of the sub display, and vram c for -// font and map..this is provided for rapid prototyping and nothing more -void consoleDemoInit(void) { -//--------------------------------------------------------------------------------- - videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text - vramSetBankC(VRAM_C_SUB_BG); - - SUB_BG0_CR = BG_MAP_BASE(31); - - BG_PALETTE_SUB[255] = RGB15(31,31,31); //by default font will be rendered with color 255 - - //consoleInit() is a lot more flexible but this gets you up and running quick - consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); -} - -//--------------------------------------------------------------------------------- -void consoleInitDefault(u16* map, u16* charBase, u8 bitDepth) { -//--------------------------------------------------------------------------------- - consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth); -} - -//void consoleInitColorDefault(u16* map, u16* charBase) { -// consoleInit((u16*)default_font_bin, charBase, 256, 0, map, CONSOLE_USE_COLOR255, bitDepth); -//} - -//--------------------------------------------------------------------------------- -static void newRow(void) { -//--------------------------------------------------------------------------------- - int i; - row++; - if(row >= CONSOLE_HEIGHT) { - row--; - - for(i = CONSOLE_WIDTH; i < CONSOLE_HEIGHT * CONSOLE_WIDTH; i++) fontMap[i - CONSOLE_WIDTH] = fontMap[i]; - - for(i = 0; i < CONSOLE_WIDTH; i++) fontMap[i + (CONSOLE_HEIGHT-1)*CONSOLE_WIDTH] = fontPal | (u16)(' ' + fontOffset - fontStart); - - } -} - - -//--------------------------------------------------------------------------------- -void consolePrintChar(char c) { -//--------------------------------------------------------------------------------- - - if(col >= CONSOLE_WIDTH) { - col = 0; - - newRow(); - } - - switch(c) { - /* - The only special characters we will handle are tab (\t), carriage return (\r) & line feed (\n). - Carriage return & line feed will function the same: go to next line and put cursor at the beginning. - For everything else, use VT sequences. - - Reason: VT sequences are more specific to the task of cursor placement. - The special escape sequences \b \f & \v are archaic and non-portable. - */ - case 9: - col += TAB_SIZE; - break; - case 10: - case 13: - newRow(); - col = 0; - break; - default: - fontMap[col + row * CONSOLE_WIDTH] = fontPal | (u16)(c + fontOffset - fontStart); - ++col; - break; - } -} - -//--------------------------------------------------------------------------------- -void consoleClear(void) { -//--------------------------------------------------------------------------------- - iprintf("\x1b[2J"); -} - - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S deleted file mode 100644 index 85f409b2be..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/dcache.S +++ /dev/null @@ -1,92 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#define ICACHE_SIZE 0x2000 -#define DCACHE_SIZE 0x1000 -#define CACHE_LINE_SIZE 32 -//--------------------------------------------------------------------------------- - .arm -//--------------------------------------------------------------------------------- - .global DC_FlushAll -//--------------------------------------------------------------------------------- -DC_FlushAll: -/*--------------------------------------------------------------------------------- - Clean and invalidate entire data cache ----------------------------------------------------------------------------------*/ - mov r1, #0 -outer_loop: - mov r0, #0 -inner_loop: - orr r2, r1, r0 @ generate segment and line address - mcr p15, 0, r2, c7, c14, 2 @ clean and flush the line - add r0, r0, #CACHE_LINE_SIZE - cmp r0, #DCACHE_SIZE/4 - bne inner_loop - add r1, r1, #0x40000000 - cmp r1, #0 - bne outer_loop - bx lr - -//--------------------------------------------------------------------------------- - .global DC_FlushRange -//--------------------------------------------------------------------------------- -DC_FlushRange: -/*--------------------------------------------------------------------------------- - Clean and invalidate a range ----------------------------------------------------------------------------------*/ - add r1, r1, r0 - bic r0, r0, #(CACHE_LINE_SIZE - 1) -.flush: - mcr p15, 0, r0, c7, c14, 1 @ clean and flush address - add r0, r0, #CACHE_LINE_SIZE - cmp r0, r1 - blt .flush - bx lr - -//--------------------------------------------------------------------------------- - .global DC_InvalidateAll -//--------------------------------------------------------------------------------- -DC_InvalidateAll: -/*--------------------------------------------------------------------------------- - Clean and invalidate entire data cache ----------------------------------------------------------------------------------*/ - mov r0, #0 - mcr p15, 0, r0, c7, c6, 0 - bx lr - -//--------------------------------------------------------------------------------- - .global DC_InvalidateRange -//--------------------------------------------------------------------------------- -DC_InvalidateRange: -/*--------------------------------------------------------------------------------- - Invalidate a range ----------------------------------------------------------------------------------*/ - add r1, r1, r0 - bic r0, r0, #CACHE_LINE_SIZE - 1 -.invalidate: - mcr p15, 0, r0, c7, c6, 1 - add r0, r0, #CACHE_LINE_SIZE - cmp r0, r1 - blt .invalidate - bx lr diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S deleted file mode 100644 index 743677700e..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/default_font.S +++ /dev/null @@ -1,523 +0,0 @@ -/* Generated by BIN2S - please don't edit directly */ - .section .rodata - .balign 4 - .global default_font_bin_size -default_font_bin_size: .int 8192 - .global default_font_bin -default_font_bin: - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 1, 1, 0, 0, 16, 1, 1, 16, 16, 1, 0, 0, 16 - .byte 1, 17, 17, 16, 1, 16, 1, 16, 1, 0, 0, 16, 16, 17, 17, 1 - .byte 16, 17, 17, 1, 17, 17, 17, 17, 17, 16, 1, 17, 17, 17, 17, 17 - .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 16, 17, 17, 1 - .byte 16, 1, 17, 0, 17, 17, 17, 1, 17, 17, 17, 1, 17, 17, 17, 1 - .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1 - .byte 16, 17, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 17, 17, 17, 17 - .byte 17, 1, 16, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 17, 17, 1 - .byte 17, 1, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 17, 17, 0 - .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 1, 16, 17, 17, 0, 0, 17 - .byte 17, 0, 0, 17, 17, 1, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17 - .byte 0, 0, 0, 0, 0, 17, 17, 0, 16, 1, 16, 1, 16, 0, 0, 1 - .byte 16, 0, 0, 1, 16, 1, 16, 1, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 17, 0, 0, 17, 1, 16, 1, 16, 1, 17, 17, 16 - .byte 1, 17, 17, 16, 1, 16, 1, 16, 17, 0, 0, 17, 17, 17, 17, 17 - .byte 0, 0, 17, 17, 0, 0, 16, 17, 0, 0, 17, 17, 16, 17, 17, 16 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0 - .byte 0, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1 - .byte 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0 - .byte 0, 0, 1, 0, 0, 0, 17, 0, 0, 0, 1, 1, 0, 0, 1, 1 - .byte 0, 0, 1, 0, 16, 17, 1, 0, 17, 17, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 16, 0, 0, 16, 1, 1, 0, 16, 16, 1 - .byte 16, 17, 0, 1, 17, 1, 0, 1, 0, 0, 17, 1, 0, 16, 17, 0 - .byte 0, 16, 0, 0, 16, 16, 16, 0, 0, 17, 1, 0, 17, 1, 17, 1 - .byte 0, 17, 1, 0, 16, 16, 16, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 1, 0, 0, 0, 17, 1, 0, 0, 17, 17, 1, 0, 17, 17, 17, 1 - .byte 17, 17, 1, 0, 17, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 1, 0, 0, 17, 1, 0, 17, 17, 1, 17, 17, 17, 1 - .byte 0, 17, 17, 1, 0, 0, 17, 1, 0, 0, 0, 1, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0 - .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1 - .byte 16, 1, 16, 1, 0, 0, 0, 0, 16, 1, 16, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 17, 17, 16, 1, 17, 17, 16, 1, 17, 17, 16, 1, 17 - .byte 16, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0 - .byte 0, 16, 17, 0, 0, 1, 0, 1, 0, 17, 1, 0, 16, 0, 16, 0 - .byte 16, 0, 16, 0, 0, 17, 1, 0, 1, 0, 1, 0, 16, 17, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 1, 16, 17, 17, 1, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0 - .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1 - .byte 0, 16, 1, 0, 0, 17, 17, 0, 16, 16, 1, 1, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 16, 16, 1, 1, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 17, 17, 17, 1 - .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 17, 17, 1 - .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0 - .byte 17, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 1, 16, 0, 16, 0, 0, 1, 17, 17, 17, 17 - .byte 16, 0, 0, 1, 0, 1, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 17, 17, 0 - .byte 17, 17, 17, 1, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 17, 17, 17, 1, 17, 17, 17, 1, 16, 17, 17, 0 - .byte 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 16, 1, 17, 0, 0, 1, 16, 0, 0, 1, 16, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 16, 1, 17, 0, 16, 1, 17, 0, 17, 17, 17, 1, 16, 1, 17, 0 - .byte 17, 17, 17, 1, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 0, 0, 16, 17, 17, 0 - .byte 0, 16, 16, 1, 17, 17, 17, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 16, 1, 16, 1, 1, 1, 17, 0, 17, 16, 1, 0 - .byte 0, 17, 16, 1, 16, 1, 1, 1, 17, 0, 17, 0, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 16, 0, 17, 0, 0, 17, 1, 0, 16, 17, 1, 0 - .byte 17, 0, 17, 1, 17, 0, 17, 0, 16, 17, 1, 1, 0, 0, 0, 0 - .byte 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0 - .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 16, 1, 16, 1, 0, 17, 17, 0, 17, 17, 17, 17 - .byte 0, 17, 17, 0, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0 - .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 1, 17, 16, 17, 1, 17, 17, 16, 1 - .byte 17, 1, 16, 1, 17, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 1, 0, 16, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 0 - .byte 16, 17, 0, 0, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 0 - .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 17, 0, 0, 17, 17, 0, 16, 1, 17, 0, 17, 0, 17, 0 - .byte 17, 17, 17, 1, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 17, 17, 17, 0, 0, 0, 16, 1 - .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 17, 17, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 17, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 1 - .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0 - .byte 0, 0, 17, 0, 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0 - .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0 - .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 1, 0, 17, 0, 17, 0, 0, 0, 17, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 1, 16, 17, 1, 1, 1, 16, 1 - .byte 1, 16, 17, 1, 1, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0 - .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0 - .byte 16, 1, 1, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 1, 0, 16, 17, 1, 0 - .byte 16, 1, 1, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 0 - .byte 17, 0, 17, 1, 17, 0, 16, 1, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 17, 1, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0 - .byte 17, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 0, 16, 17, 1, 0 - .byte 16, 1, 17, 0, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0 - .byte 17, 17, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0 - .byte 16, 1, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 1, 0, 0, 1, 17, 0, 16, 1, 17, 1, 17, 1, 17, 17, 17, 1 - .byte 17, 16, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 17, 1, 16, 1, 17, 17, 16, 1, 17, 16, 17, 1 - .byte 17, 0, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0 - .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 16, 16, 1, 17, 16, 17, 1, 16, 17, 17, 0, 0, 0, 16, 1 - .byte 17, 17, 17, 0, 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 16, 17, 17, 0 - .byte 0, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 1, 16, 16, 1, 1, 16, 16, 1, 1, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 16, 1, 17, 17, 17, 1 - .byte 17, 1, 17, 1, 17, 0, 16, 1, 1, 0, 0, 1, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 16, 1, 17, 0, 0, 17, 1, 0, 0, 17, 1, 0 - .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 17, 17, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 17, 0, 16, 1, 1, 0, 17, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 1, 16, 1, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0 - .byte 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0 - .byte 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0 - .byte 0, 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 1, 0, 0, 0, 0 - .byte 16, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 1, 0, 0, 0, 0, 0 - .byte 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17 - .byte 0, 17, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 0, 0, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0, 16, 17, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 17, 0, 0, 17, 16, 1, 0, 17, 0, 0, 16, 17, 1, 0 - .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 1, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 16, 17, 1, 0 - .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 17, 0, 16, 17, 16, 1 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 16, 1, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 0 - .byte 0, 0, 17, 0, 0, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0 - .byte 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 16, 1, 16, 1, 17, 0 - .byte 16, 17, 1, 0, 16, 1, 17, 0, 17, 1, 16, 1, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 17, 17, 1 - .byte 17, 16, 16, 1, 17, 16, 16, 1, 17, 16, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 0, 16, 1, 16, 1 - .byte 16, 1, 16, 1, 16, 17, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 16, 17, 1, 16, 17, 16, 1 - .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0 - .byte 16, 17, 17, 0, 0, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 0, 0, 0, 17, 0, 0, 17, 17, 17, 0, 0, 17, 0, 0 - .byte 0, 17, 0, 0, 0, 17, 16, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 16, 1, 17, 0, 0, 17, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 17, 16, 16, 1 - .byte 17, 16, 16, 1, 17, 17, 17, 1, 16, 1, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 16, 1, 16, 1, 17, 0 - .byte 0, 17, 1, 0, 16, 1, 17, 0, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 1, 16, 1, 0 - .byte 0, 17, 0, 0, 16, 1, 16, 0, 17, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 17, 1, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 0, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0, 0 - .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 16, 1, 17, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 0, 0, 17, 0, 0, 0 - .byte 17, 0, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0 - .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 17, 0, 17, 0, 0, 0, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 17, 0, 0, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0 - .byte 17, 0, 0, 0, 16, 17, 17, 0, 0, 16, 1, 0, 16, 17, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 0, 0, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 0, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 0, 17, 1, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 17, 17, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 17, 17, 1, 16, 1, 0, 0 - .byte 16, 17, 1, 0, 16, 1, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 16, 0, 1 - .byte 16, 17, 17, 1, 17, 16, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 1, 17, 0, 1, 0, 17, 0, 1, 0, 17, 17, 17, 1 - .byte 17, 0, 1, 0, 17, 0, 1, 0, 17, 0, 17, 1, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 1, 0, 0, 1, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 17, 1, 0, 0, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 17, 0, 17, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 16, 17, 17, 0, 0, 0, 17, 0, 17, 17, 1, 0 - .byte 17, 0, 16, 1, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 0, 16, 1, 0, 0, 0, 0, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 16, 17, 17, 0, 17, 16, 16, 1, 17, 16, 0, 0 - .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0, 0 - .byte 16, 1, 0, 0, 17, 17, 0, 1, 17, 16, 17, 0, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 0, 17, 17, 0, 0, 16, 1, 0, 16, 17, 17, 1 - .byte 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 17, 17, 1, 0, 17, 0, 17, 0, 17, 17, 1, 0, 17, 0, 16, 0 - .byte 17, 0, 17, 0, 17, 16, 17, 1, 17, 0, 17, 0, 0, 0, 16, 1 - .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 0, 0, 17, 17, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 1, 0, 0, 0, 17, 0 - .byte 16, 17, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 0, 17, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 16, 17, 0, 16, 1, 16, 1 - .byte 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 16, 1, 0, 0, 0, 0 - .byte 16, 1, 16, 1, 1, 16, 1, 0, 17, 1, 16, 1, 17, 17, 16, 1 - .byte 17, 16, 17, 1, 17, 0, 17, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 0, 0, 17, 0, 0, 17, 17, 0, 0, 17, 16, 0 - .byte 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 0, 17, 1, 0 - .byte 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 16, 1, 0, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0 - .byte 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0 - .byte 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 17, 17, 1 - .byte 16, 0, 16, 1, 1, 0, 17, 0, 0, 16, 17, 1, 0, 0, 0, 0 - .byte 17, 0, 0, 0, 17, 0, 1, 0, 17, 16, 0, 0, 17, 1, 17, 0 - .byte 16, 16, 17, 0, 1, 17, 17, 1, 0, 0, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 16, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 17, 16, 1, 16, 1, 17, 0, 17, 16, 1, 0 - .byte 16, 1, 17, 0, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 17, 16, 1, 0, 16, 1, 17, 0, 0, 17, 16, 1 - .byte 16, 1, 17, 0, 17, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0 - .byte 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0 - .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1 - .byte 16, 16, 16, 16, 1, 1, 1, 1, 16, 16, 16, 16, 1, 1, 1, 1 - .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1 - .byte 17, 16, 1, 17, 16, 17, 16, 17, 17, 16, 1, 17, 17, 1, 17, 1 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1 - .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 16, 1 - .byte 17, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 1, 0, 0, 16, 1 - .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0 - .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0 - .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 0, 17, 0, 0 - .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0 - .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 17, 0, 17, 0, 0 - .byte 0, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 17, 17, 16, 17, 0, 0, 0, 0 - .byte 17, 17, 16, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 17, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 17, 17, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 17, 17, 0, 16, 1, 0 - .byte 0, 16, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 16, 1, 0 - .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 17, 17, 17, 17, 0, 17, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 17, 17, 17, 17, 0, 16, 1, 0 - .byte 17, 17, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 17, 17, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 - .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 - .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0 - .byte 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0 - .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17 - .byte 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17, 0, 0, 17, 17 - .byte 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 16, 0, 17, 0, 17, 0 - .byte 17, 0, 1, 0, 17, 16, 17, 0, 16, 17, 16, 1, 0, 0, 0, 0 - .byte 16, 17, 1, 0, 17, 0, 17, 0, 17, 16, 1, 0, 17, 0, 17, 0 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 16, 17, 0, 16, 0, 0, 0 - .byte 17, 17, 17, 1, 16, 1, 0, 1, 16, 1, 0, 0, 16, 1, 0, 0 - .byte 16, 1, 0, 0, 16, 1, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 1, 16, 17, 17, 1, 17, 1, 17, 0 - .byte 16, 1, 17, 0, 16, 1, 17, 0, 16, 0, 1, 0, 0, 0, 0, 0 - .byte 17, 17, 17, 1, 16, 1, 0, 1, 0, 17, 0, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 16, 1, 0, 1, 17, 17, 17, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 0, 0 - .byte 17, 0, 1, 0, 17, 0, 1, 0, 16, 17, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 17, 0, 17, 0, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 17, 17, 1, 0, 1, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 1, 17, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 0, 16, 0, 0, 16, 17, 17, 0, 17, 16, 16, 1 - .byte 17, 16, 16, 1, 16, 17, 17, 0, 0, 16, 0, 0, 0, 17, 1, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 17, 17, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 16, 1, 17, 0, 0, 1, 1, 0, 17, 1, 17, 1, 0, 0, 0, 0 - .byte 0, 17, 17, 0, 0, 1, 0, 1, 0, 16, 1, 0, 16, 17, 17, 0 - .byte 17, 0, 17, 0, 17, 0, 17, 0, 16, 17, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 16, 1, 1, 16, 1, 16 - .byte 1, 16, 1, 16, 16, 1, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 16, 1, 16, 17, 17, 0, 1, 16, 17, 1 - .byte 17, 17, 0, 1, 16, 17, 17, 0, 17, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 0, 0 - .byte 17, 17, 1, 0, 17, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 16, 17, 17, 0, 17, 0, 16, 1, 17, 0, 16, 1 - .byte 17, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 17, 17, 17, 1 - .byte 0, 0, 0, 0, 17, 17, 17, 1, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 16, 17, 17, 1, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1, 0, 0, 0, 0 - .byte 0, 17, 0, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0, 16, 1, 0 - .byte 0, 17, 0, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 17, 0, 0, 16, 1, 0, 0, 0, 17, 0, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 0, 0, 0, 0, 0 - .byte 0, 0, 17, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 17, 16, 1, 0, 17, 16, 1, 0, 16, 17, 0, 0 - .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 16, 17, 17, 1 - .byte 0, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0 - .byte 16, 17, 16, 1, 17, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 17, 1, 0, 16, 1, 17, 0, 0, 17, 1, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 1, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 17, 17, 0, 0, 17, 0, 0, 0, 17, 0, 0, 0, 17, 0 - .byte 17, 1, 17, 0, 16, 1, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0 - .byte 17, 16, 1, 0, 16, 1, 17, 0, 16, 1, 17, 0, 16, 1, 17, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 17, 17, 0, 0, 0, 17, 0, 0, 17, 0, 0, 0, 17, 17, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17, 0, 0, 17, 17, 0 - .byte 0, 17, 17, 0, 0, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - - .global default_font_bin_end -default_font_bin_end: - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S deleted file mode 100644 index 74711537eb..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptionHandler.S +++ /dev/null @@ -1,109 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - .text - - .arm - -@--------------------------------------------------------------------------------- - .global getCPSR -@--------------------------------------------------------------------------------- -getCPSR: -@--------------------------------------------------------------------------------- - mrs r0,cpsr - bx r14 - -@--------------------------------------------------------------------------------- - .global enterException -@--------------------------------------------------------------------------------- -enterException: -@--------------------------------------------------------------------------------- - // store context - ldr r12,=exceptionRegisters - stmia r12,{r0-r11} - str r13,[r12,#oldStack - exceptionRegisters] - // assign a stack - ldr r13,=exceptionStack - ldr r13,[r13] - - // renable MPU - mrc p15,0,r0,c1,c0,0 - orr r0,r0,#1 - mcr p15,0,r0,c1,c0,0 - - // bios exception stack - ldr r0, =0x027FFD90 - - // grab r15 from bios exception stack - ldr r2,[r0,#8] - str r2,[r12,#reg15 - exceptionRegisters] - - // grab stored r12 and SPSR from bios exception stack - ldmia r0,{r2,r12} - - - // grab banked registers from correct processor mode - mrs r3,cpsr - bic r4,r3,#0x1F - and r2,r2,#0x1F - orr r4,r4,r2 - msr cpsr,r4 - ldr r0,=reg12 - stmia r0,{r12-r14} - msr cpsr,r3 - - // Get C function & call it - ldr r12,=exceptionC - ldr r12,[r12,#0] - bxne r12 - - // restore registers - ldr r12,=exceptionRegisters - ldmia r12,{r0-r11} - ldr r13,[r12,#oldStack - exceptionRegisters] - - // return through bios - mov pc,lr - -@--------------------------------------------------------------------------------- - .global exceptionC -@--------------------------------------------------------------------------------- -exceptionC: -@--------------------------------------------------------------------------------- - .word 0x00000000 -@--------------------------------------------------------------------------------- - .global exceptionStack -@--------------------------------------------------------------------------------- -exceptionStack: -@--------------------------------------------------------------------------------- - .word 0x00000000 -@--------------------------------------------------------------------------------- - .global exceptionRegisters -@--------------------------------------------------------------------------------- -exceptionRegisters: -@--------------------------------------------------------------------------------- - .space 12 * 4 -reg12: .word 0 -reg13: .word 0 -reg14: .word 0 -reg15: .word 0 -oldStack: .word 0 diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c deleted file mode 100644 index 94c2d7c19b..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/exceptions.c +++ /dev/null @@ -1,34 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/jtypes.h> -#include <nds/arm9/exceptions.h> - -//--------------------------------------------------------------------------------- -void setExceptionHandler(VoidFunctionPointer handler) { -//--------------------------------------------------------------------------------- - exceptionStack = (u32)0x23EFFFC ; - EXCEPTION_VECTOR = enterException ; - *exceptionC = handler ; -} - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c deleted file mode 100644 index f0bd2bb41a..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/gurumeditation.c +++ /dev/null @@ -1,270 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/jtypes.h> -#include <nds/memory.h> - -#include <nds/arm9/video.h> -#include <nds/arm9/console.h> -#include <nds/arm9/exceptions.h> -#include <nds/arm9/background.h> - -#include <stdio.h> -#include <inttypes.h> - -#include <bsp/linker-symbols.h> - -//--------------------------------------------------------------------------------- -static unsigned long ARMShift(unsigned long value,unsigned char shift) { -//--------------------------------------------------------------------------------- - // no shift at all - if (shift == 0x0B) return value ; - int index ; - if (shift & 0x01) { - // shift index is a register - index = exceptionRegisters[(shift >> 4) & 0x0F]; - } else { - // constant shift index - index = ((shift >> 3) & 0x1F) ; - } ; - int i ; - bool isN ; - switch (shift & 0x06) { - case 0x00: - // logical left - return (value << index) ; - case 0x02: - // logical right - return (value >> index) ; - case 0x04: - // arithmetical right - isN = (value & 0x80000000) ; - value = value >> index ; - if (isN) { - for (i=31;i>31-index;i--) { - value = value | (1 << i) ; - } ; - } ; - return value ; - case 0x06: - // rotate right - index = index & 0x1F; - value = (value >> index) | (value << (32-index)); - return value; - }; - return value; -} - - -//--------------------------------------------------------------------------------- -static u32 getExceptionAddress( u32 opcodeAddress, u32 thumbState) { -//--------------------------------------------------------------------------------- - - int Rf, Rb, Rd, Rn, Rm; - - if (thumbState) { - // Thumb - - unsigned short opcode = *(unsigned short *)opcodeAddress ; - // ldr r,[pc,###] 01001ddd ffffffff - // ldr r,[r,r] 0101xx0f ffbbbddd - // ldrsh 0101xx1f ffbbbddd - // ldr r,[r,imm] 011xxfff ffbbbddd - // ldrh 1000xfff ffbbbddd - // ldr r,[sp,###] 1001xddd ffffffff - // push 1011x10l llllllll - // ldm 1100xbbb llllllll - - - if ((opcode & 0xF800) == 0x4800) { - // ldr r,[pc,###] - s8 offset = opcode & 0xff; - return exceptionRegisters[15] + offset; - } else if ((opcode & 0xF200) == 0x5000) { - // ldr r,[r,r] - Rb = (opcode >> 3) & 0x07 ; - Rf = (opcode >> 6) & 0x07 ; - return exceptionRegisters[Rb] + exceptionRegisters[Rf]; - - } else if ((opcode & 0xF200) == 0x5200) { - // ldrsh - Rb = (opcode >> 3) & 0x07; - Rf = (opcode >> 6) & 0x03; - return exceptionRegisters[Rb] + exceptionRegisters[Rf]; - - } else if ((opcode & 0xE000) == 0x6000) { - // ldr r,[r,imm] - Rb = (opcode >> 3) & 0x07; - Rf = (opcode >> 6) & 0x1F ; - return exceptionRegisters[Rb] + (Rf << 2); - } else if ((opcode & 0xF000) == 0x8000) { - // ldrh - Rb = (opcode >> 3) & 0x07 ; - Rf = (opcode >> 6) & 0x1F ; - return exceptionRegisters[Rb] + (Rf << 2); - } else if ((opcode & 0xF000) == 0x9000) { - // ldr r,[sp,#imm] - s8 offset = opcode & 0xff; - return exceptionRegisters[13] + offset; - } else if ((opcode & 0xF700) == 0xB500) { - // push/pop - return exceptionRegisters[13]; - } else if ((opcode & 0xF000) == 0xC000) { - // ldm/stm - Rd = (opcode >> 8) & 0x07; - return exceptionRegisters[Rd]; - } - } else { - // arm32 - unsigned long opcode = *(unsigned long *)opcodeAddress ; - - // SWP xxxx0001 0x00nnnn dddd0000 1001mmmm - // STR/LDR xxxx01xx xxxxnnnn ddddffff ffffffff - // STRH/LDRH xxxx000x x0xxnnnn dddd0000 1xx1mmmm - // STRH/LDRH xxxx000x x1xxnnnn ddddffff 1xx1ffff - // STM/LDM xxxx100x xxxxnnnn llllllll llllllll - - if ((opcode & 0x0FB00FF0) == 0x01000090) { - // SWP - Rn = (opcode >> 16) & 0x0F; - return exceptionRegisters[Rn]; - } else if ((opcode & 0x0C000000) == 0x04000000) { - // STR/LDR - Rn = (opcode >> 16) & 0x0F; - if (opcode & 0x02000000) { - // Register offset - Rm = opcode & 0x0F; - if (opcode & 0x01000000) { - unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF) ; - // pre indexing - long Offset = ARMShift(exceptionRegisters[Rm],shift); - // add or sub the offset depending on the U-Bit - return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset); - } else { - // post indexing - return exceptionRegisters[Rn]; - } - } else { - // Immediate offset - unsigned long Offset = (opcode & 0xFFF) ; - if (opcode & 0x01000000) { - // pre indexing - // add or sub the offset depending on the U-Bit - return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset); - } else { - // post indexing - return exceptionRegisters[Rn]; - } - } - } else if ((opcode & 0x0E400F90) == 0x00000090) { - // LDRH/STRH with register Rm - Rn = (opcode >> 16) & 0x0F; - Rd = (opcode >> 12) & 0x0F; - Rm = opcode & 0x0F; - unsigned short shift = (unsigned short)((opcode >> 4) & 0xFF); - long Offset = ARMShift(exceptionRegisters[Rm],shift); - // add or sub the offset depending on the U-Bit - return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset); - } else if ((opcode & 0x0E400F90) == 0x00400090) { - // LDRH/STRH with immediate offset - Rn = (opcode >> 16) & 0x0F; - Rd = (opcode >> 12) & 0x0F; - unsigned long Offset = (opcode & 0xF) | ((opcode & 0xF00)>>8) ; - // add or sub the offset depending on the U-Bit - return exceptionRegisters[Rn] + ((opcode & 0x00800000)?Offset:-Offset) ; - } else if ((opcode & 0x0E000000) == 0x08000000) { - // LDM/STM - Rn = (opcode >> 16) & 0x0F; - return exceptionRegisters[Rn]; - } - } - return 0; -} - -static const char *registerNames[] = - { "r0","r1","r2","r3","r4","r5","r6","r7", - "r8 ","r9 ","r10","r11","r12","sp ","lr ","pc " }; - -//--------------------------------------------------------------------------------- -static void defaultHandler(void) { -//--------------------------------------------------------------------------------- - videoSetMode(0); - videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); - vramSetBankC(VRAM_C_SUB_BG); - - SUB_BG0_CR = BG_MAP_BASE(31); - - BG_PALETTE_SUB[0] = RGB15(31,0,0); - BG_PALETTE_SUB[255] = RGB15(31,31,31); - - consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16); - - iprintf("\x1b[5CGuru Meditation Error!\n"); - u32 currentMode = getCPSR() & 0x1f; - u32 thumbState = ((*(u32*)0x027FFD90) & 0x20); - - u32 codeAddress, exceptionAddress = 0; - - int offset = 8; - - if ( currentMode == 0x17 ) { - iprintf ("\x1b[10Cdata abort!\n\n"); - codeAddress = exceptionRegisters[15] - offset; - if ( (codeAddress > 0x02000000 && codeAddress < 0x02400000) || - (codeAddress > (u32)bsp_section_fast_text_begin && codeAddress < (u32)(bsp_section_fast_text_begin + 32768)) ) - exceptionAddress = getExceptionAddress( codeAddress, thumbState); - else - exceptionAddress = codeAddress; - - } else { - if (thumbState) - offset = 2; - else - offset = 4; - iprintf("\x1b[5Cundefined instruction!\n\n"); - codeAddress = exceptionRegisters[15] - offset; - exceptionAddress = codeAddress; - } - - iprintf(" pc: %08" PRIX32 " addr: %08" PRIX32 "\n\n",codeAddress,exceptionAddress); - - int i; - for ( i=0; i < 8; i++ ) { - iprintf( " %s: %08" PRIX32 " %s: %08" PRIX32 "\n", - registerNames[i], exceptionRegisters[i], - registerNames[i+8],exceptionRegisters[i+8]); - } - iprintf("\n"); - u32 *stack = (u32 *)exceptionRegisters[13]; - for ( i=0; i<10; i++ ) { - iprintf( "\x1b[%d;2H%08" PRIX32 ": %08" PRIX32 " %08" PRIX32 "", i + 14, (u32)&stack[i*2],stack[i*2], stack[(i*2)+1] ); - } - while(1); - -} - -//--------------------------------------------------------------------------------- -void defaultExceptionHandler() { -//--------------------------------------------------------------------------------- - setExceptionHandler(defaultHandler) ; -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S deleted file mode 100644 index 19a89573ec..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/icache.S +++ /dev/null @@ -1,55 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#define ICACHE_SIZE 0x2000 -#define DCACHE_SIZE 0x1000 -#define CACHE_LINE_SIZE 32 -//--------------------------------------------------------------------------------- - .arm -//--------------------------------------------------------------------------------- - .global IC_InvalidateAll -//--------------------------------------------------------------------------------- -IC_InvalidateAll: -/*--------------------------------------------------------------------------------- - Clean and invalidate entire data cache ----------------------------------------------------------------------------------*/ - mov r0, #0 - mcr p15, 0, r0, c7, c5, 0 - bx lr - -//--------------------------------------------------------------------------------- - .global IC_InvalidateRange -//--------------------------------------------------------------------------------- -IC_InvalidateRange: -/*--------------------------------------------------------------------------------- - Invalidate a range ----------------------------------------------------------------------------------*/ - add r1, r1, r0 - bic r0, r0, #CACHE_LINE_SIZE - 1 -.invalidate: - mcr p15, 0, r0, c7, c5, 1 - add r0, r0, #CACHE_LINE_SIZE - cmp r0, r1 - blt .invalidate - bx lr diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c deleted file mode 100644 index bef1fa2fc0..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/image.c +++ /dev/null @@ -1,132 +0,0 @@ -/*--------------------------------------------------------------------------------- - - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#include <nds/jtypes.h> -#include <nds/arm9/image.h> -#include <nds/dma.h> - - -#include <malloc.h> - -//--------------------------------------------------------------------------------- -void image24to16(sImage* img) { -//--------------------------------------------------------------------------------- - - int x; - int y; - - u16* temp = (u16*)malloc(img->height*img->width*2); - - for(y=0;y<img->height;y++) - { - for(x=0;x<img->width;x++) - temp[x+y*img->width]=(1<<15)|RGB15(img->image.data8[x*3+y*img->width*3]>>3, \ - img->image.data8[x*3+y*img->width*3+1]>>3, img->image.data8[x*3+y*img->width*3+2]>>3); - } - - free(img->image.data8); - - img->bpp=16; - img->image.data16 = temp; -} - -//--------------------------------------------------------------------------------- -void image8to16(sImage* img) { -//--------------------------------------------------------------------------------- - int i; - - u16* temp = (u16*)malloc(img->height*img->width*2); - - for(i = 0; i < img->height * img->width; i++) - temp[i] = img->palette[img->image.data8[i]] | (1<<15); - - free (img->image.data8); - free (img->palette); - - img->bpp = 16; - img->image.data16 = temp; -} - -//--------------------------------------------------------------------------------- -void image8to16trans(sImage* img, u8 transparentColor) { -//--------------------------------------------------------------------------------- - int i; - u8 c; - - u16* temp = (u16*)malloc(img->height*img->width*2); - - for(i = 0; i < img->height * img->width; i++) { - - c = img->image.data8[i]; - - if(c != transparentColor) - temp[i] = img->palette[c] | (1<<15); - else - temp[i] = img->palette[c]; - } - - free (img->image.data8); - free (img->palette); - - img->bpp = 16; - img->image.data16 = temp; -} -//--------------------------------------------------------------------------------- -void imageTileData(sImage* img) { -//--------------------------------------------------------------------------------- - u32* temp; - - int ix, iy, tx, ty; - - int th, tw; - - int i = 0; - - //can only tile 8 bit data that is a multiple of 8 in dimention - if(img->bpp != 8 || (img->height & 3) != 0 || (img->width & 3) != 0) return; - - th = img->height >> 3; - tw = img->width >> 3; - - //buffer to hold data - temp = (u32*)malloc(img->height * img->width); - - for(ty = 0; ty < th; ty++) - for(tx = 0; tx < tw; tx++) - for(iy = 0; iy < 8; iy++) - for(ix = 0; ix < 2; ix++) - temp[i++] = img->image.data32[ix + tx * 2 + (iy + ty * 8) * tw * 2 ]; - - free(img->image.data32); - - img->image.data32 = (unsigned int *)temp; -} - -//--------------------------------------------------------------------------------- -void imageDestroy(sImage* img) { -//--------------------------------------------------------------------------------- - if(img->image.data8) free (img->image.data8); - if(img->palette && img->bpp == 8) free (img->palette); -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c deleted file mode 100644 index da401ac506..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/initSystem.c +++ /dev/null @@ -1,94 +0,0 @@ -/*--------------------------------------------------------------------------------- - - initSystem.c -- Code for initialising the DS - - Copyright (C) 2007 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#include <nds/jtypes.h> -#include <nds/system.h> -#include <nds/memory.h> -#include <nds/timers.h> -#include <nds/dma.h> -#include <nds/ipc.h> -#include <nds/arm9/video.h> - -#include <time.h> - -/* - * Prototypes - * - * NOTE: Called from start.S - */ -void initSystem(void); - -extern time_t *punixTime; - -//--------------------------------------------------------------------------------- -// Reset the DS registers to sensible defaults -//--------------------------------------------------------------------------------- -void initSystem(void) { -//--------------------------------------------------------------------------------- - register int i; - - //clear out ARM9 DMA channels - for (i=0; i<4; i++) { - DMA_CR(i) = 0; - DMA_SRC(i) = 0; - DMA_DEST(i) = 0; - TIMER_CR(i) = 0; - TIMER_DATA(i) = 0; - } - - VRAM_CR = 0x80808080; - VRAM_E_CR = 0x80; - VRAM_F_CR = 0x80; - VRAM_G_CR = 0x80; - VRAM_H_CR = 0x80; - VRAM_I_CR = 0x80; - - (*(vu32*)0x027FFE04) = 0; // temporary variable - PALETTE[0] = 0xFFFF; - dmaFillWords((void*)0x027FFE04, PALETTE+1, (2*1024)-2); - dmaFillWords((void*)0x027FFE04, OAM, 2*1024); - dmaFillWords((void*)0x027FFE04, (void*)0x04000000, 0x56); //clear main display registers - dmaFillWords((void*)0x027FFE04, (void*)0x04001000, 0x56); //clear sub display registers - dmaFillWords((void*)0x027FFE04, VRAM, 656*1024); - - REG_DISPSTAT = 0; - videoSetMode(0); - videoSetModeSub(0); - VRAM_A_CR = 0; - VRAM_B_CR = 0; - VRAM_C_CR = 0; - VRAM_D_CR = 0; - VRAM_E_CR = 0; - VRAM_F_CR = 0; - VRAM_G_CR = 0; - VRAM_H_CR = 0; - VRAM_I_CR = 0; - VRAM_CR = 0x03000000; - - punixTime = (time_t*)&IPC->unixTime; - -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c deleted file mode 100644 index 8f71d96682..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/keys.c +++ /dev/null @@ -1,97 +0,0 @@ -/*------------------------------------------------------------------------------ - key input code -- provides slightly higher level input forming - - Copyright (C) 2005 - Christian Auby (DesktopMan) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - -------------------------------------------------------------------------------*/ - -#include <stdlib.h> - -#include <nds/ipc.h> -#include <nds/system.h> -#include <nds/arm9/input.h> - -//------------------------------------------------------------------------------ - -#define KEYS_CUR (( ((~REG_KEYINPUT)&0x3ff) | (((~IPC->buttons)&3)<<10) | (((~IPC->buttons)<<6) & (KEY_TOUCH|KEY_LID) ))^KEY_LID) - -static uint16 keys = 0; -static uint16 keysold = 0; -static uint16 keysrepeat = 0; - -static u8 delay = 60, repeat = 30, count = 60; - -//------------------------------------------------------------------------------ -void scanKeys(void) { -//------------------------------------------------------------------------------ - keysold = keys; - keys = KEYS_CUR; - - if ( delay != 0 ) { - if ( keys != keysold ) { - count = delay ; - keysrepeat = keysDown() ; - } - count--; - if ( count == 0 ) { - count = repeat; - keysrepeat = keys; - } - } -} - -//------------------------------------------------------------------------------ -uint32 keysHeld(void) { -//------------------------------------------------------------------------------ - return keys; -} - -//------------------------------------------------------------------------------ -uint32 keysDown(void) { -//------------------------------------------------------------------------------ - return (keys ^ keysold) & keys; -} - -//------------------------------------------------------------------------------ -uint32 keysDownRepeat(void) { -//------------------------------------------------------------------------------ - uint32 tmp = keysrepeat; - - keysrepeat = 0; - - return tmp; -} - -//------------------------------------------------------------------------------ -void keysSetRepeat( u8 setDelay, u8 setRepeat ) { -//------------------------------------------------------------------------------ - delay = setDelay ; - repeat = setRepeat ; - count = delay ; - keysrepeat = 0 ; -} - -//------------------------------------------------------------------------------ -uint32 keysUp(void) { -//------------------------------------------------------------------------------ - return (keys ^ keysold) & (~keys); -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c deleted file mode 100644 index 1faadcd5de..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/ndsmotion.c +++ /dev/null @@ -1,488 +0,0 @@ -/*--------------------------------------------------------------------------------- - DS Motion Card/DS Motion Pak functionality - - Copyright (C) 2007 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - Keith Epstein (KeithE) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/card.h> -#include <nds/system.h> -#include <nds/memory.h> -#include <nds/bios.h> -#include <nds/arm9/ndsmotion.h> - -#define WAIT_CYCLES 185 - -#define CARD_WaitBusy() while (CARD_CR1 & /*BUSY*/0x80); - -// enables SPI bus at 4.19 MHz -#define SPI_On() CARD_CR1 = /*E*/0x8000 | /*SEL*/0x2000 | /*MODE*/0x40 | 0; - -// disables SPI bus -#define SPI_Off() CARD_CR1 = 0; - -// Volatile GBA bus SRAM for reading from DS Motion Pak -#define V_SRAM ((volatile unsigned char*)0x0A000000) - - -int card_type = -1; - -//these are the default calibration values for sensitivity and offset -MotionCalibration calibration = {2048, 2048, 2048, 1680, 819, 819, 819, 825}; - -// sends and receives 1 byte on the SPI bus -static unsigned char motion_spi(unsigned char in_byte){ - - unsigned char out_byte; - CARD_EEPDATA = in_byte; // send the output byte to the SPI bus - CARD_WaitBusy(); // wait for transmission to complete - out_byte=CARD_EEPDATA; // read the input byte from the SPI bus - return out_byte; -} - - -static void motion_MK6_sensor_mode(void) { - // send some commands on the SPI bus - SPI_On() - motion_spi(0xFE); - SPI_Off() - SPI_On() - motion_spi(0xFD); - SPI_Off() - SPI_On() - motion_spi(0xFB); - SPI_Off() - SPI_On() - motion_spi(0xF8); - SPI_Off() -} - -static void motion_MK6_EEPROM_mode(void) { - // send some commands on the SPI bus - SPI_On() - motion_spi(0xFE); - SPI_Off() - SPI_On() - motion_spi(0xFD); - SPI_Off() - SPI_On() - motion_spi(0xFB); - SPI_Off() - SPI_On() - motion_spi(0xF9); - SPI_Off() -} - -// checks whether a DS Motion Pak is plugged in -static int motion_pak_is_inserted(void){ - int motion_pak = 0; - unsigned char return_byte = V_SRAM[10]; // read first byte of DS Motion Pak check - swiDelay(WAIT_CYCLES); - return_byte = V_SRAM[0]; - swiDelay(WAIT_CYCLES); - if (return_byte==0xF0) { // DS Motion Pak returns 0xF0 - return_byte = V_SRAM[0]; // read second byte of DS Motion Pak check - swiDelay(WAIT_CYCLES); - if(return_byte==0x0F) { // DS Motion Pak returns 0x0F - motion_pak = 1; - } - } - return motion_pak; -} - -// checks whether a DS Motion Card is plugged in -// this only works after motion_init() -// it will return false if it is run before motion_init() -static int motion_card_is_inserted(void){ - // send 0x03 to read from DS Motion Card control register - SPI_On() - motion_spi(0x03); // command to read from control register - // if the control register is 0x04 then the enable was successful - if( motion_spi(0x00) == 0x04) - { - SPI_Off() - return 1; - } - SPI_Off(); - return 0; -} - -// turn on the DS Motion Sensor (DS Motion Pak or DS Motion Card) -// Requires knowing which type is present (can be found by using motion_init) -static int motion_enable(int card_type) { - switch (card_type) - { - case 1: // DS Motion Pak - automatically enabled on powerup - // check to see whether Motion Pak is alive - return motion_pak_is_inserted(); - break; - case 2: // DS Motion Card - // send 0x04, 0x04 to enable - SPI_On() - motion_spi(0x04); // command to write to control register - motion_spi(0x04); // enable - SPI_Off() - // check to see whether Motion Card is alive - return motion_card_is_inserted(); - break; - case 3: // MK6 - same command as DS Motion Card - // send 0x04, 0x04 to enable - SPI_On() - motion_spi(0x04); // command to write to control register - motion_spi(0x04); // enable - SPI_Off() - // check to see whether Motion Card is alive - return motion_card_is_inserted(); - break; - default: // if input parameter is not recognized, return 0 - return 0; - break; - } -} - -// Initialize the DS Motion Sensor -// Determines which DS Motion Sensor is present -// Turns it on -// Does not require knowing which type is present -int motion_init(void) { - sysSetBusOwners(true, true); - // first, check for the DS Motion Pak - type 1 - if( motion_pak_is_inserted() == 1 ) - { - card_type = 1; - return 1; - }// next, check for DS Motion Card - type 2 - if( motion_enable(2) == 1 ) - { - card_type = 2; - return 2; - } - - motion_MK6_sensor_mode(); // send command to switch MK6 to sensor mode - - if( motion_enable(3) == 1 ) - { - card_type = 3; - return 3; - }// if neither cases are true, then return 0 to indicate no DS Motion Sensor - return 0; -} - -// Deinitialize the DS Motion Sensor -// In the case of a DS Motion Pak, do nothing - there is nothing to de-init -// In the case of a DS Motion Card, turns off the accelerometer -// In the case of an MK6, turns off accelerometer and switches out of sensor mode into EEPROM mode -void motion_deinit(void) { - // DS Motion Card - turn off accelerometer - SPI_On() - motion_spi(0x04); // command to write to control register - motion_spi(0x00); // turn it off - SPI_Off() - // MK6 - switch to EEPROM mode - motion_MK6_EEPROM_mode(); // switch MK6 to EEPROM mode -} - -// read the X acceleration -signed int motion_read_x(void) { - unsigned char High_byte = 0; - unsigned char Low_byte = 0; - signed int output = 0; - switch(card_type) - { - case 1: // DS Motion Pak - High_byte = V_SRAM[2]; // Command to load X High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; - break; - case 2: // DS Motion Card - SPI_On() - motion_spi(0x00); // command to convert X axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - case 3: // MK6 - same command as DS Motion Card - SPI_On() - motion_spi(0x00); // command to convert X axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - default: - return 0; - break; - } -} - -// read the Y acceleration -signed int motion_read_y(void) { - unsigned char High_byte = 0; - unsigned char Low_byte = 0; - signed int output = 0; - switch (card_type) - { - case 1: // DS Motion Pak - High_byte = V_SRAM[4]; // Command to load Y High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; - break; - case 2: // DS Motion Card - SPI_On() - motion_spi(0x02); // command to convert Y axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - case 3: // MK6 - same command as DS Motion Card - SPI_On() - motion_spi(0x02); // command to convert Y axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - default: - return 0; - break; - } -} - -// read the Z acceleration -signed int motion_read_z(void) { - unsigned char High_byte = 0; - unsigned char Low_byte = 0; - signed int output = 0; - switch (card_type) - { - case 1: // DS Motion Pak - High_byte = V_SRAM[6]; // Command to load Z High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; - break; - case 2: // DS Motion Card - SPI_On() - motion_spi(0x01); // command to convert Z axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - case 3: // MK6 - same command as DS Motion Card - SPI_On() - motion_spi(0x01); // command to convert Z axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - default: - return 0; - break; - } -} - -// read the Z rotation (gyro) -signed int motion_read_gyro(void) { - unsigned char High_byte = 0; - unsigned char Low_byte = 0; - signed int output = 0; - switch (card_type) - { - case 1: // DS Motion Pak - High_byte = V_SRAM[8]; // Command to load Gyro High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; - break; - case 2: // DS Motion Card - SPI_On() - motion_spi(0x07); // command to convert Gyro axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - case 3: // MK6 - same command as DS Motion Card - SPI_On() - motion_spi(0x07); // command to convert Gyro axis - swiDelay(625); // wait at least 40 microseconds for the A-D conversion - output = ( (motion_spi(0x00)<<8)|motion_spi(0x00) )>>4; // read 16 bits and store as a 12 bit number - SPI_Off() - return output; - break; - default: - return 0; - break; - } -} - -//gets acceleration value in mili G (where g is 9.8 m/s*s) -int motion_acceleration_x(void){ - int accel = motion_read_x(); - return (accel - calibration.xoff) * 1000 / calibration.xsens; -} - -//gets acceleration value in mili G (where g is 9.8 m/s*s) -int motion_acceleration_y(void){ - int accel = motion_read_y(); - return (accel - calibration.yoff) * 1000 / calibration.ysens; -} -//gets acceleration value in mili G (where g is 9.8 m/s*s) -int motion_acceleration_z(void){ - int accel = motion_read_z(); - return (accel - calibration.zoff) * 1000 / calibration.zsens; -} - -//converts raw rotation value to degrees per second -int motion_rotation(void){ - int rotation = motion_read_gyro(); - return (rotation - calibration.goff) * 1000 / calibration.gsens; -} - -//this should be passed the raw reading at 1g for accurate -//acceleration calculations. Default is 819 -void motion_set_sens_x(int sens){ - calibration.xsens = sens - calibration.xoff; -} - -//this should be passed the raw reading at 1g for accurate -//acceleration calculations. Default is 819 -void motion_set_sens_y(int sens){ - calibration.ysens = sens - calibration.yoff; -} - -//this should be passed the raw reading at 1g for accurate -//acceleration calculations. Default is 819 -void motion_set_sens_z(int sens){ - calibration.zsens = sens - calibration.zoff; -} - -//this should be passed the raw reading at 1g for accurate -//acceleration calculations. Default is 825 -void motion_set_sens_gyro(int sens){ - calibration.gsens = sens; -} - -//this should be called when the axis is under no acceleration -//default is 2048 -void motion_set_offs_x(void){ - calibration.xoff = motion_read_x(); -} - -//this should be called when the axis is under no acceleration -//default is 2048 -void motion_set_offs_y(void){ - calibration.yoff = motion_read_y(); -} - -//this should be called when the axis is under no acceleration -//default is 2048 -void motion_set_offs_z(void){ - calibration.zoff = motion_read_z(); -} - -//this should be called when the axis is under no acceleration -//default is 1680 -void motion_set_offs_gyro(void){ - calibration.goff = motion_read_gyro(); -} - -MotionCalibration* motion_get_calibration(void){ - return &calibration; -} - -void motion_set_calibration(MotionCalibration* cal){ - calibration.xsens = cal->xsens; - calibration.ysens = cal->ysens; - calibration.zsens = cal->zsens; - calibration.gsens = cal->gsens; - calibration.xoff = cal->xoff; - calibration.yoff = cal->yoff; - calibration.zoff = cal->zoff; - calibration.goff = cal->goff; -} - -// enable analog input number 1 (ain_1) -void motion_enable_ain_1(void){ - unsigned char return_byte; - (void) return_byte; /* avoid set but unused warning */ - return_byte = V_SRAM[16]; - swiDelay(WAIT_CYCLES); -} - -// enable analog input number 2 (ain_2) -void motion_enable_ain_2(void){ - unsigned char return_byte; - (void) return_byte; /* avoid set but unused warning */ - return_byte = V_SRAM[18]; - swiDelay(WAIT_CYCLES); -} - -// read from the analog input number 1 - requires enabling ain_1 first -int motion_read_ain_1(void){ - unsigned char High_byte = V_SRAM[12]; // Command to load AIN_1 High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - unsigned char Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; -} - -// read from the analog input number 2 - requires enabling ain_2 first -int motion_read_ain_2(void){ - unsigned char High_byte = V_SRAM[14]; // Command to load AIN_1 High onto bus - swiDelay(WAIT_CYCLES); // wait for data ready - High_byte = V_SRAM[0]; // get the high byte - swiDelay(WAIT_CYCLES); // wait for data ready - unsigned char Low_byte = V_SRAM[0]; // get the low byte - swiDelay(WAIT_CYCLES); // wait after for Motion Pak to be ready for next command - signed int output = (signed int)( (High_byte<<8 | Low_byte)>>4); - return output; -} - - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c deleted file mode 100644 index 292f70fb6c..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/pcx.c +++ /dev/null @@ -1,85 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#include <nds/jtypes.h> -#include <nds/arm9/video.h> -#include <nds/arm9/image.h> -#include <malloc.h> - -//--------------------------------------------------------------------------------- -int loadPCX(unsigned char* pcx, sImage* image) { -//--------------------------------------------------------------------------------- - //struct rgb {unsigned char b,g,r;}; - RGB_24* pal; - - PCXHeader* hdr = (PCXHeader*) pcx; - - pcx += sizeof(PCXHeader); - - unsigned char c; - int size; - int count; - int run; - int i; - - image->width = hdr->xmax - hdr->xmin + 1 ; - image->height = hdr->ymax - hdr->ymin + 1; - - size = image->width *image->height; - - image->image.data8 = (unsigned char*)malloc(size); - image->palette = (unsigned short*)malloc(256 * 2); - - if(hdr->bitsPerPixel != 8) - return 0; - - count = 0; - - while(count < size) { - c = *pcx++; - - if(c < 192) { - image->image.data8[count++] = c; - } else { - run = c - 192; - - c = *pcx++; - - for(i = 0; i < run; i++) - image->image.data8[count++] = c; - } - } - - pal = (RGB_24*)(pcx + 1); - - image->bpp = 8; - - for(i = 0; i < 256; i++) - { - u8 r = (pal[i].r + 4 > 255) ? 255 : (pal[i].r + 4); - u8 g = (pal[i].g + 4 > 255) ? 255 : (pal[i].g + 4); - u8 b = (pal[i].b + 4 > 255) ? 255 : (pal[i].b + 4); - image->palette[i] = RGB15(r >> 3 , g >> 3 , b >> 3) ; - } - return 1; -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c deleted file mode 100644 index fc340cd07a..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/rumble.c +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------------- - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - Mike Parks (BigRedPimp) - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#include <nds/jtypes.h> -#include <nds/memory.h> -#include <nds/arm9/rumble.h> - -static RUMBLE_TYPE rumbleType; - -//--------------------------------------------------------------------------------- -bool isRumbleInserted(void) { -//--------------------------------------------------------------------------------- - uint16 four[4]; - sysSetCartOwner(BUS_OWNER_ARM9); - // First, check for 0x96 to see if it's a GBA game - if (GBA_HEADER.is96h == 0x96) { - - //if it is a game, we check the game code - //to see if it is warioware twisted - if ( (GBA_HEADER.gamecode[0] == 'R') && - (GBA_HEADER.gamecode[1] == 'Z') && - (GBA_HEADER.gamecode[2] == 'W') && - (GBA_HEADER.gamecode[3] == 'E') - ) - { - rumbleType = WARIOWARE; - WARIOWARE_ENABLE = 8; - return true; - } - return false; - - } else { - - rumbleType = RUMBLE; - // Now check to see if it's true open bus, or if D1 is pulled low - four[0] = GBA_BUS[0] & 0xFF; - four[1] = GBA_BUS[1] & 0xFF; - four[2] = GBA_BUS[2] & 0xFF; - four[3] = GBA_BUS[3] & 0xFF; - return (four[0] == 0x00) && (four[2] == 0x00) && (four[1] == 0x01) && (four[3] == 0x01); - } -} -//--------------------------------------------------------------------------------- -void setRumble(bool position) { -//--------------------------------------------------------------------------------- - - if( rumbleType == WARIOWARE) { - WARIOWARE_PAK = (position ? 8 : 0); - } else { - RUMBLE_PAK = (position ? 2 : 0); - } - -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c deleted file mode 100644 index 7f03f69f19..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/sound.c +++ /dev/null @@ -1,72 +0,0 @@ -/*--------------------------------------------------------------------------------- - Sound Functions - - Copyright (C) 2005 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ -#include <nds/arm9/sound.h> -#include <nds/arm9/cache.h> -#include <string.h> - -//--------------------------------------------------------------------------------- -static void playSoundBlock(TransferSound *snd) { -//--------------------------------------------------------------------------------- - DC_FlushRange( snd, sizeof(TransferSound) ); - - IPC->soundData = snd; -} - -//--------------------------------------------------------------------------------- -static TransferSound Snd; -static TransferSoundData SndDat = { (void *)0 , 0, 11025, 64, 64, 1 }; - -//--------------------------------------------------------------------------------- -void setGenericSound( u32 rate, u8 vol, u8 pan, u8 format) { -//--------------------------------------------------------------------------------- - - SndDat.rate = rate; - SndDat.vol = vol; - SndDat.pan = pan; - SndDat.format = format; -} - -//--------------------------------------------------------------------------------- -void playSound( pTransferSoundData sound) { -//--------------------------------------------------------------------------------- - Snd.count = 1; - - memcpy( &Snd.data[0], sound, sizeof(TransferSoundData) ); - - playSoundBlock(&Snd); - -} - -//--------------------------------------------------------------------------------- -void playGenericSound(const void* data, u32 length) { -//--------------------------------------------------------------------------------- - Snd.count = 1; - - memcpy( &Snd.data[0], &SndDat, sizeof(TransferSoundData) ); - Snd.data[0].data = data; - Snd.data[0].len = length; - - playSoundBlock(&Snd); -} diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c deleted file mode 100644 index aea29bad69..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/system.c +++ /dev/null @@ -1,31 +0,0 @@ -/*--------------------------------------------------------------------------------- - -system.c -- System code - -Copyright (C) 2005 -Michael Noland (joat) -Jason Rogers (dovoto) -Dave Murphy (WinterMute) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you -must not claim that you wrote the original software. If you use -this software in a product, an acknowledgment in the product -documentation would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. - ----------------------------------------------------------------------------------*/ - -#include <nds/memory.h> diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c deleted file mode 100644 index 9417d03577..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/touch.c +++ /dev/null @@ -1,46 +0,0 @@ -/*--------------------------------------------------------------------------------- - touch screen input code - - Copyright (C) 2005 - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - ----------------------------------------------------------------------------------*/ - -//#include <nds.h> - -#include <nds/ipc.h> -#include <nds/arm9/input.h> - -//--------------------------------------------------------------------------------- -touchPosition touchReadXY() { -//--------------------------------------------------------------------------------- - - touchPosition touchPos; - - touchPos.x = IPC->touchX; - touchPos.y = IPC->touchY; - - touchPos.px = IPC->touchXpx; - touchPos.py = IPC->touchYpx; - - return touchPos; - -} - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c deleted file mode 100644 index 6b516db57c..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/video.c +++ /dev/null @@ -1,122 +0,0 @@ -////////////////////////////////////////////////////////////////////// -// -// video.cpp -- Vram control -// -// version 0.1, February 19, 2005 -// -// Copyright (C) 2005 Michael Noland (joat) and Jason Rogers (dovoto) -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any -// damages arising from the use of this software. -// -// Permission is granted to anyone to use this software for any -// purpose, including commercial applications, and to alter it and -// redistribute it freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you -// must not claim that you wrote the original software. If you use -// this software in a product, an acknowledgment in the product -// documentation would be appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and -// must not be misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source -// distribution. -// -// Changelog: -// 0.1: First version -// -////////////////////////////////////////////////////////////////////// - -#include <nds/jtypes.h> -#include <nds/arm9/video.h> - -////////////////////////////////////////////////////////////////////// - -uint32 vramSetMainBanks(VRAM_A_TYPE a, VRAM_B_TYPE b, VRAM_C_TYPE c, VRAM_D_TYPE d) -{ - uint32 vramTemp = VRAM_CR; - - VRAM_A_CR = VRAM_ENABLE | a; - VRAM_B_CR = VRAM_ENABLE | b; - VRAM_C_CR = VRAM_ENABLE | c; - VRAM_D_CR = VRAM_ENABLE | d; - - return vramTemp; -} - -////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// - -void vramRestoreMainBanks(uint32 vramTemp); /* used in videoGL.c */ -void vramRestoreMainBanks(uint32 vramTemp) -{ - VRAM_CR = vramTemp; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankA(VRAM_A_TYPE a) -{ - VRAM_A_CR = VRAM_ENABLE | a; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankB(VRAM_B_TYPE b) -{ - VRAM_B_CR = VRAM_ENABLE | b; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankC(VRAM_C_TYPE c) -{ - VRAM_C_CR = VRAM_ENABLE | c; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankD(VRAM_D_TYPE d) -{ - VRAM_D_CR = VRAM_ENABLE | d; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankE(VRAM_E_TYPE e) -{ - VRAM_E_CR = VRAM_ENABLE | e; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankF(VRAM_F_TYPE f) -{ - VRAM_F_CR = VRAM_ENABLE | f; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankG(VRAM_G_TYPE g) -{ - VRAM_G_CR = VRAM_ENABLE | g; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankH(VRAM_H_TYPE h) -{ - VRAM_H_CR = VRAM_ENABLE | h; -} - -////////////////////////////////////////////////////////////////////// - -void vramSetBankI(VRAM_I_TYPE i) -{ - VRAM_I_CR = VRAM_ENABLE | i; -} - -////////////////////////////////////////////////////////////////////// - diff --git a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c b/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c deleted file mode 100644 index 013e666acd..0000000000 --- a/c/src/lib/libbsp/arm/nds/libnds/source/arm9/videoGL.c +++ /dev/null @@ -1,424 +0,0 @@ -/*--------------------------------------------------------------------------------- - Video API vaguely similar to OpenGL - - Copyright (C) 2005 - Michael Noland (joat) - Jason Rogers (dovoto) - Dave Murphy (WinterMute) - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any - damages arising from the use of this software. - - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and - redistribute it freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you - must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product - documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and - must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source - distribution. - - ----------------------------------------------------------------------------------*/ - -#include <nds/jtypes.h> -#include <nds/memory.h> -#include <nds/bios.h> -#include <nds/arm9/math.h> -#include <nds/arm9/video.h> -#include <nds/arm9/videoGL.h> -#include <nds/arm9/trig_lut.h> - -// this is the actual data of the globals for videoGL -// Please use the glGlob pointer to access this data since that makes it easier to move stuff in/out of the header. -static gl_hidden_globals glGlobalData; - -// This returns the pointer to the globals for videoGL -gl_hidden_globals* glGetGlobals() { - return &glGlobalData; -} - -//--------------------------------------------------------------------------------- -void glRotatef32i(int angle, int32 x, int32 y, int32 z) { -//--------------------------------------------------------------------------------- - int32 axis[3]; - int32 sine = SIN[angle & LUT_MASK]; - int32 cosine = COS[angle & LUT_MASK]; - int32 one_minus_cosine = inttof32(1) - cosine; - - axis[0]=x; - axis[1]=y; - axis[2]=z; - - normalizef32(axis); // should require passed in normalized? - - MATRIX_MULT3x3 = cosine + mulf32(one_minus_cosine, mulf32(axis[0], axis[0])); - MATRIX_MULT3x3 = mulf32(one_minus_cosine, mulf32(axis[0], axis[1])) - mulf32(axis[2], sine); - MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) + mulf32(axis[1], sine); - - MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[1]) + mulf32(axis[2], sine); - MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[1]), axis[1]); - MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) - mulf32(axis[0], sine); - - MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[0]), axis[2]) - mulf32(axis[1], sine); - MATRIX_MULT3x3 = mulf32(mulf32(one_minus_cosine, axis[1]), axis[2]) + mulf32(axis[0], sine); - MATRIX_MULT3x3 = cosine + mulf32(mulf32(one_minus_cosine, axis[2]), axis[2]); -} - - - - -//--------------------------------------------------------------------------------- -void glMaterialf(GL_MATERIALS_ENUM mode, rgb color) { -//--------------------------------------------------------------------------------- - static uint32 diffuse_ambient = 0; - static uint32 specular_emission = 0; - - switch(mode) { - case GL_AMBIENT: - diffuse_ambient = (color << 16) | (diffuse_ambient & 0xFFFF); - break; - case GL_DIFFUSE: - diffuse_ambient = color | (diffuse_ambient & 0xFFFF0000); - break; - case GL_AMBIENT_AND_DIFFUSE: - diffuse_ambient= color + (color << 16); - break; - case GL_SPECULAR: - specular_emission = color | (specular_emission & 0xFFFF0000); - break; - case GL_SHININESS: - break; - case GL_EMISSION: - specular_emission = (color << 16) | (specular_emission & 0xFFFF); - break; - } - - GFX_DIFFUSE_AMBIENT = diffuse_ambient; - GFX_SPECULAR_EMISSION = specular_emission; -} - -//--------------------------------------------------------------------------------- -void glInit_C(void) { -//--------------------------------------------------------------------------------- - glGlob = glGetGlobals(); - - glGlob->clearColor = 0; - - // init texture globals - glGlob->activeTexture = 0; - glGlob->nextBlock = (uint32*)0x06800000; - glGlob->nextPBlock = 0; - glGlob->nameCount = 1; - - while (GFX_STATUS & (1<<27)); // wait till gfx engine is not busy - - // Clear the FIFO - GFX_STATUS |= (1<<29); - - // Clear overflows from list memory - glResetMatrixStack(); - - // prime the vertex/polygon buffers - glFlush(0); - - // reset the control bits - GFX_CONTROL = 0; - - // reset the rear-plane(a.k.a. clear color) to black, ID=0, and opaque - glClearColor(0,0,0,31); - glClearPolyID(0); - - // reset stored texture locations - glResetTextures(); - - // reset the depth to it's max - glClearDepth(GL_MAX_DEPTH); - - GFX_TEX_FORMAT = 0; - GFX_POLY_FORMAT = 0; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); -} - -//--------------------------------------------------------------------------------- -void glResetTextures(void) { -//--------------------------------------------------------------------------------- - glGlob->activeTexture = 0; - glGlob->nextBlock = (uint32*)0x06800000; - glGlob->nextPBlock = 0; - glGlob->nameCount = 1; -} - -//--------------------------------------------------------------------------------- -// glGenTextures creates integer names for your table -// takes n as the number of textures to generate and -// a pointer to the names array that it needs to fill. -// Returns 1 if succesful and 0 if out of texture names -//--------------------------------------------------------------------------------- - -int glGenTextures(int n, int *names) { -//--------------------------------------------------------------------------------- - int index = 0; - for(index = 0; index < n; index++) { - if(glGlob->nameCount >= MAX_TEXTURES) - return 0; - else - names[index] = glGlob->nameCount++; - } - return 1; -} - -//--------------------------------------------------------------------------------- -// glBindTexure sets the current named -// texture to the active texture. Target -// is ignored as all DS textures are 2D -//--------------------------------------------------------------------------------- -void glBindTexture(int target, int name) { -//--------------------------------------------------------------------------------- - if (name == 0) - GFX_TEX_FORMAT = 0; - else - GFX_TEX_FORMAT = glGlob->textures[name]; - - - glGlob->activeTexture = name; -} -//--------------------------------------------------------------------------------- -// glColorTable establishes the location of the current palette. -// Roughly follows glColorTableEXT. Association of palettes with -// named textures is left to the application. -//--------------------------------------------------------------------------------- -void glColorTable( uint8 format, uint32 addr ) { -//--------------------------------------------------------------------------------- - GFX_PAL_FORMAT = addr>>(4-(format==GL_RGB4)); -} - -//--------------------------------------------------------------------------------- -//--------------------------------------------------------------------------------- -void glTexCoord2f32(int32 u, int32 v) { -//--------------------------------------------------------------------------------- - int x, y; - - x = ((glGlob->textures[glGlob->activeTexture]) >> 20) & 7; - y = ((glGlob->textures[glGlob->activeTexture]) >> 23) & 7; - - glTexCoord2t16(f32tot16 (mulf32(u,inttof32(8<<x))), f32tot16 (mulf32(v,inttof32(8<<y)))); -} - -//--------------------------------------------------------------------------------- -// glTexParameter although named the same -// as its gl counterpart it is not compatible -// Effort may be made in the future to make it so. -//--------------------------------------------------------------------------------- -void glTexParameter( uint8 sizeX, uint8 sizeY, - const uint32* addr, - GL_TEXTURE_TYPE_ENUM mode, - uint32 param) { -//--------------------------------------------------------------------------------- - glGlob->textures[glGlob->activeTexture] = param | (sizeX << 20) | (sizeY << 23) | (((uint32)addr >> 3) & 0xFFFF) | (mode << 26); -} -//--------------------------------------------------------------------------------- -//glGetTexturePointer gets a pointer to vram which contains the texture -// -//--------------------------------------------------------------------------------- -void* glGetTexturePointer( int name) { -//--------------------------------------------------------------------------------- - return (void*) ((glGlob->textures[name] & 0xFFFF) << 3); -} - -//--------------------------------------------------------------------------------- -u32 glGetTexParameter(){ -//--------------------------------------------------------------------------------- - return glGlob->textures[glGlob->activeTexture]; -} - - -//--------------------------------------------------------------------------------- -static inline uint32 alignVal( uint32 val, uint32 to ) { - return (val & (to-1))? (val & ~(to-1)) + to : val; -} - -//--------------------------------------------------------------------------------- -static int getNextPaletteSlot(u16 count, uint8 format) { -//--------------------------------------------------------------------------------- - // ensure the result aligns on a palette block for this format - uint32 result = alignVal(glGlob->nextPBlock, 1<<(4-(format==GL_RGB4))); - - // convert count to bytes and align to next (smallest format) palette block - count = alignVal( count<<1, 1<<3 ); - - // ensure that end is within palette video mem - if( result+count > 0x10000 ) // VRAM_F - VRAM_E - return -1; - - glGlob->nextPBlock = result+count; - return (int)result; -} - -//--------------------------------------------------------------------------------- -static uint16* vramGetBank(uint16 *addr) { -//--------------------------------------------------------------------------------- - if(addr >= VRAM_A && addr < VRAM_B) - return VRAM_A; - else if(addr >= VRAM_B && addr < VRAM_C) - return VRAM_B; - else if(addr >= VRAM_C && addr < VRAM_D) - return VRAM_C; - else if(addr >= VRAM_D && addr < VRAM_E) - return VRAM_D; - else if(addr >= VRAM_E && addr < VRAM_F) - return VRAM_E; - else if(addr >= VRAM_F && addr < VRAM_G) - return VRAM_F; - else if(addr >= VRAM_G && addr < VRAM_H) - return VRAM_H; - else if(addr >= VRAM_H && addr < VRAM_I) - return VRAM_H; - else return VRAM_I; -} - - -//--------------------------------------------------------------------------------- -static int vramIsTextureBank(uint16 *addr) { -//--------------------------------------------------------------------------------- - uint16* vram = vramGetBank(addr); - - if(vram == VRAM_A) - { - if((VRAM_A_CR & 3) == ((VRAM_A_TEXTURE) & 3)) - return 1; - else return 0; - } - else if(vram == VRAM_B) - { - if((VRAM_B_CR & 3) == ((VRAM_B_TEXTURE) & 3)) - return 1; - else return 0; - } - else if(vram == VRAM_C) - { - if((VRAM_C_CR & 3) == ((VRAM_C_TEXTURE) & 3)) - return 1; - else return 0; - } - else if(vram == VRAM_D) - { - if((VRAM_D_CR & 3) == ((VRAM_D_TEXTURE) & 3)) - return 1; - else return 0; - } - else - return 0; -} -//--------------------------------------------------------------------------------- -static uint32* getNextTextureSlot(int size) { -//--------------------------------------------------------------------------------- - uint32* result = glGlob->nextBlock; - glGlob->nextBlock += size >> 2; - - //uh-oh...out of texture memory in this bank...find next one assigned to textures - while(!vramIsTextureBank((uint16*)glGlob->nextBlock - 1) && glGlob->nextBlock <= (uint32*)VRAM_E) - { - glGlob->nextBlock = (uint32*)vramGetBank((uint16*)result) + (0x20000 >> 2); //next bank - result = glGlob->nextBlock; - glGlob->nextBlock += size >> 2; - } - - if(glGlob->nextBlock > (uint32*)VRAM_E) { - result = 0; - } - return result; -} - -//--------------------------------------------------------------------------------- -// Similer to glTextImage2D from gl it takes a pointer to data -// Empty fields and target are unused but provided for code compatibility. -// type is simply the texture type (GL_RGB, GL_RGB8 ect...) -//--------------------------------------------------------------------------------- -int glTexImage2D(int target, int empty1, GL_TEXTURE_TYPE_ENUM type, int sizeX, int sizeY, int empty2, int param, const uint8* texture) { -//--------------------------------------------------------------------------------- - uint32 size = 0; - uint32* addr; - uint32 vramTemp; - - size = 1 << (sizeX + sizeY + 6); - - - switch (type) { - case GL_RGB: - case GL_RGBA: - size = size << 1; - break; - case GL_RGB4: - size = size >> 2; - break; - case GL_RGB16: - size = size >> 1; - break; - default: - break; - } - - addr = getNextTextureSlot(size); - - if(!addr) - return 0; - - // unlock texture memory - vramTemp = vramSetMainBanks(VRAM_A_LCD,VRAM_B_LCD,VRAM_C_LCD,VRAM_D_LCD); - - if (type == GL_RGB) { - // We do GL_RGB as GL_RGBA, but we set each alpha bit to 1 during the copy - u16 * src = (u16*)texture; - u16 * dest = (u16*)addr; - - glTexParameter(sizeX, sizeY, addr, GL_RGBA, param); - - while (size--) { - *dest++ = *src | (1 << 15); - src++; - } - } else { - // For everything else, we do a straight copy - glTexParameter(sizeX, sizeY, addr, type, param); - swiCopy((uint32*)texture, addr , size / 4 | COPY_MODE_WORD); - } - vramRestoreMainBanks(vramTemp); - return 1; -} - -//--------------------------------------------------------------------------------- -void glTexLoadPal(const u16* pal, u16 count, u32 addr) { -//--------------------------------------------------------------------------------- - vramSetBankE(VRAM_E_LCD); - swiCopy( pal, &VRAM_E[addr>>1] , count / 2 | COPY_MODE_WORD); - vramSetBankE(VRAM_E_TEX_PALETTE); -} - -//--------------------------------------------------------------------------------- -int gluTexLoadPal(const u16* pal, u16 count, uint8 format) { -//--------------------------------------------------------------------------------- - int addr = getNextPaletteSlot(count, format); - if( addr>=0 ) - glTexLoadPal(pal, count, (u32) addr); - - return addr; -} - - - - - |