#include <PR/os.h>
#include <PR/rcp.h>
#include <io/viint.h>

/**
 * Rare implemented their own FPAL mode, which was later added to libultra.
 * 
 * In the FPAL mode, 48 more lines than the conventional PAL mode are added to
 * the number of scan lines according to the difference in resolution between
 * PAL and NTSC. However, since only a 320x240 frame buffer is prepared with
 * NTSC, when an FPAL 320x288 display is performed, the area at the bottom of
 * the screen not considered in NTSC is displayed.
*/

OSViMode osViModePalLan1 = {
    OS_VI_PAL_LAN1,  // type
    {
        // comRegs
        VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON |
            VI_CTRL_DIVOT_ON | VI_CTRL_ANTIALIAS_MODE_1 | 0x3000,  // ctrl
        WIDTH(320),                                                // width
        BURST(58, 35, 4, 64),                                      // burst
        VSYNC(625),                                                // vSync
        HSYNC(3177, 21),                                           // hSync
        LEAP(3183, 3182),                                          // leap
        HSTART(128, 768),                                          // hStart
        SCALE(2, 0),                                               // xScale
        VCURRENT(0),                                               // vCurrent
    },
    {// fldRegs
     {
         //[0]
         ORIGIN(640),          // origin
         SCALE(1, 0),          // yScale
         HSTART(95, 569),      // vStart
         BURST(107, 2, 9, 0),  // vBurst
         VINTR(2),             // vIntr
     },
     {
         //[1]
         ORIGIN(640),          // origin
         SCALE(1, 0),          // yScale
         HSTART(95, 569),      // vStart
         BURST(107, 2, 9, 0),  // vBurst
         VINTR(2),             // vIntr
     }}};
