
//2015.4.19
//开始设计日期显示器第一版

unit display
{
	//[i] linkinterface_clock clock;
	link unit clock {}
	
	//[i] linkinterface_char char;
	link unit char {}
	
	//---------------------------------------------------
	//[i] function_void OS_init;
	public void OS_init()
	{
		
	}
	//---------------------------------------------------
	//[i] function_void ShowYearMouthDay int32 int32;
	void ShowYearMouthDay( int32 line, int32 column )
	{
		//char.write_char( line, column + 0, '0' );
		//char.write_char( line, column + 1, '0' );
		//char.write_char( line, column + 2, '0' );
		//char.write_char( line, column + 3, '0' );
		char.write_char( line, column + 4, '.' );
		
		char.write_char( line, column + 5, '0' );
		//char.write_char( line, column + 6, '0' );
		char.write_char( line, column + 7, '.' );
		
		char.write_char( line, column + 8, '0' );
		//char.write_char( line, column + 9, '0' );
		
		int16 year = (int16)clock.year;
		char.write_char( line, column + 3, '0' + (int8)(year % 10) ); year / 10;
		char.write_char( line, column + 2, '0' + (int8)(year % 10) ); year / 10;
		char.write_char( line, column + 1, '0' + (int8)(year % 10) ); year / 10;
		char.write_char( line, column + 0, '0' + (int8)(year % 10) ); year / 10;
		
		int8 month = (int8)(int16)clock.month;
		char.write_char( line, column + 6, '0' + (month % 10) ); month / 10;
		char.write_char( line, column + 5, '0' + (month % 10) ); month / 10;
		
		int8 day = (int8)(int16)clock.day;
		char.write_char( line, column + 9, '0' + (day % 10) ); day / 10;
		char.write_char( line, column + 8, '0' + (day % 10) ); day / 10;
	}
	//---------------------------------------------------
	//[i] function_void ShowHourMinuteSecond int32 int32;
	void ShowHourMinuteSecond( int32 line, int32 column )
	{
		char.write_char( line, column + 0, '0' );
		//char.write_char( line, column + 1, '0' );
		char.write_char( line, column + 2, ':' );
		
		char.write_char( line, column + 3, '0' );
		//char.write_char( line, column + 4, '0' );
		char.write_char( line, column + 5, ':' );
		
		char.write_char( line, column + 6, '0' );
		//char.write_char( line, column + 7, '0' );
		
		int16 Hour = (int16)clock.hour;
		char.write_char( line, column + 1, '0' + (int8)(Hour % 10) ); Hour / 10;
		char.write_char( line, column + 0, '0' + (int8)(Hour % 10) ); Hour / 10;
		
		int8 minute = (int8)(int16)clock.minute;
		char.write_char( line, column + 4, '0' + (minute % 10) ); minute / 10;
		char.write_char( line, column + 3, '0' + (minute % 10) ); minute / 10;
		
		int8 second = (int8)(int16)clock.second;
		char.write_char( line, column + 7, '0' + (second % 10) ); second / 10;
		char.write_char( line, column + 6, '0' + (second % 10) ); second / 10;
	}
}








