/*FILE HEADER**************************************************************
 *
 *  File name		: $Id$
 *  RCS Revision Number	: $Revision: 1.1 $
 *  Last Modified	: $Date: 94/10/28 09:23:32 $
 *  CSCI name		: Real-Time Graphics System - Applications Interface
 *  CSC name		: All functions
 *  Notes:
 *      This file contains code used to debug and test the SVME-770 RTGS.
 *      This code is provided as an example of how to call the RTGS functions
 *      from a host application.
 *  History		:
 *      Created 94/01/17 by Jeff Sanderson
 *
 *END FILE HEADER*********************************************************/

#include "dy4std.h"
#include "es.h"
#include "css.h"

#include "rtgs_ai.h"
#include "video.h"
#include "colours.h"

#include "test.h"


void test_mvvideo( void );
#define CLR_1 0
/*-----------------------------------------------------------------------*/


void test_mvvideo( void )
{
    int    i;
    video_params_t *gcc_vid_params;

    init( "Move video test" );

    gcc_vid_params = (video_params_t *)Gcc_malloc(sizeof(video_params_t), 0);
    malloc_check( gcc_vid_params );

    Set_gcc_base_address( 0x70000000 );
    Initialize_graphics();
    Initialize_video( 5 );
    Clear_screen( RED, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x10 );

    return;

    Set_gcc_base_address( 0xE0000000 );
    Initialize_video( 5 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );

    Key_wait();

    Printf("Walking phase adjust\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Set_phase_alignment( %d )\n",i);
	Set_phase_alignment( i );
        Gcc_sync();
	Key_wait();
    }
    Set_phase_alignment( 0 );
    Gcc_sync();

    Printf("Walking video vertical\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_vertical( %d )\n",i);
	Initialize_video( 5 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_vertical( i );
	Key_wait();
    }
    Initialize_video( 5 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );
    
    Printf("Walking video horizontal\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_horizontal( %d )\n",i);
	Initialize_video( 5 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_horizontal( i );
	Key_wait();
    }

    Set_gcc_base_address( 0x70000000 );
    Initialize_graphics();
    Initialize_video( 2 );
    Clear_screen( RED, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x10 );

    Set_gcc_base_address( 0xE0000000 );
    Initialize_video( 9 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );

    Key_wait();

    Printf("Walking phase adjust from -8 to +8\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Set_phase_alignment( %d )\n",i);
	Set_phase_alignment( i );
        Gcc_sync();
	Key_wait();
    }
    Set_phase_alignment( 0 );
    Gcc_sync();

    Printf("Walking video vertical\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_vertical( %d )\n",i);
	Initialize_video( 9 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_vertical( i );
	Key_wait();
    }
    Initialize_video( 9 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );
    
    Printf("Walking video horizontal\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_horizontal( %d )\n",i);
	Initialize_video( 9 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_horizontal( i );
	Key_wait();
    }

    Set_gcc_base_address( 0x70000000 );
    Initialize_graphics();
    Initialize_video( 10 );
    Clear_screen( RED, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x10 );

    Set_gcc_base_address( 0xE0000000 );
    Initialize_video( 12 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );

    Key_wait();

    Printf("Walking phase adjust from -8 to +8\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Set_phase_alignment( %d )\n",i);
	Set_phase_alignment( i );
        Gcc_sync();
	Key_wait();
    }
    Set_phase_alignment( 0 );
    Gcc_sync();

    Printf("Walking video vertical\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_vertical( %d )\n",i);
	Initialize_video( 12 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_vertical( i );
	Key_wait();
    }
    Initialize_video( 12 );
    Clear_screen( CLR_1, 0, 0 );
    Set_foreground_colour( WHITE );
    Draw_grid( 0x20 );
    
    Printf("Walking video horizontal\n");

    for( i = -3; i < 3 ; i++ )
    {
	Printf("Move_video_horizontal( %d )\n",i);
	Initialize_video( 12 );
	Clear_screen( CLR_1, 0, 0 );
	Set_foreground_colour( WHITE );
	Draw_grid( 0x20 );
	Move_video_horizontal( i );
	Key_wait();
    }
    Key_wait();
}

