Exemple #1
0
void mem(struct multiboot_info* mbt) 
{
	char *clear_screen = " ";
	int len = (int)mbt->mmap_length;
	unsigned long x = 0, mem=0;
	char *welcome = "Welcome to FIFOS: The System memory is: ";
	char *mb=" MB";

	memory_map_t* mmap = (memory_map_t*)mbt->mmap_addr;

		while(mmap <(mbt->mmap_addr + len))
		{
			if(mmap->type == 1)
				{
					x = mmap->length_low;
					mem = mem + x;
				}
							
			mmap = (memory_map_t*) ( (unsigned int)mmap + mmap->size + sizeof(unsigned int) );
		}
		mem = mem>>20;
		
		pos_x=0;
		pos_y=0;
		
		//clearing the screen before writing on it 
		while(1)
		{	
			WriteCharacter(clear_screen);
			if(pos_y>25)
				break;
		}
		
		//resetting the cursor value
		pos_x=0;
		pos_y=0;
	
		
		//printing the welcome message
			WriteCharacter(welcome);
		//printing the amount of free memory	
			print_num (mem);			
		//printing the unit of the free system memory
			WriteCharacter(mb);
		pos_y ++;
		pos_x = 0;
	return;
}
Exemple #2
0
void TUnicodeCompressor::WriteCharacterFromBuffer()
	{
	const TAction& action = iInputBuffer[iInputBufferStart];
	iInputBufferSize--;
	iInputBufferStart = (iInputBufferStart + 1) % EMaxInputBufferSize;
	WriteCharacter(action);
	}
 void    MIDIFileWrite::WriteShort( unsigned short c )	
 {
   ENTER( "void    MIDIFileWrite::WriteShort()" );
   
   WriteCharacter( (unsigned char)((c>>8)&0xff) );
   WriteCharacter( (unsigned char)((c&0xff)) );
 } 
Exemple #4
0
void gdt_done()
{
	char *gdt = "GDT initialised...";
	WriteCharacter(gdt);
	
	return;
}
 void	MIDIFileWrite::Write3Char( long c )	
 {
   ENTER( "void	MIDIFileWrite::Write3Char()" );
   
   WriteCharacter( (unsigned char)((c>>16)&0xff) );
   WriteCharacter( (unsigned char)((c>>8)&0xff) );
   WriteCharacter( (unsigned char)((c&0xff)) );
 } 
Exemple #6
0
void WriteString(char *str, unsigned int x, unsigned int y)
{
//	int i;
	for(int i=0; i < strlen(str); i++)
	{
		WriteCharacter(str[i], x+i, y);
	}
}
 void	MIDIFileWrite::WriteTrackHeader( unsigned long length )	
 {
   ENTER( "void	MIDIFileWrite::WriteTrackHeader()" );
   
   track_position=file_length;
   track_length=0;
   track_time=0;
   running_status=0;
   
   WriteCharacter( (unsigned char) 'M' );
   WriteCharacter( (unsigned char) 'T' );
   WriteCharacter( (unsigned char) 'r' );
   WriteCharacter( (unsigned char) 'k' );
   
   WriteLong( length );
   file_length+=8;
   within_track=true;
 } 
 void	MIDIFileWrite::WriteFileHeader(
   int format,
   int ntrks,
   int division
   )	
 {
   ENTER( "void	MIDIFileWrite::WriteFileHeader()" );
   
   WriteCharacter( (unsigned char) 'M' );
   WriteCharacter( (unsigned char) 'T' );
   WriteCharacter( (unsigned char) 'h' );
   WriteCharacter( (unsigned char) 'd' );
   WriteLong( 6 );
   WriteShort( (short)format );
   WriteShort( (short)ntrks );
   WriteShort( (short)division );
   file_length=4+4+6;
 } 
Exemple #9
0
void print_num(unsigned long mem)
{
	int j=0,n[10],m;
	char *ch="";
	
	
	while(mem>0)
	{
		n[j] = mem%10;
		mem = mem/10;
		j++;
	}
	for(m=j-1;m>=0;m--)
	{
		*ch = n[m] + '0';
		WriteCharacter(ch);
		//pos_x= pos_x -2;
	}

	pos_x = 0;
	pos_y +=1;	

return;
}
 int	MIDIFileWrite::WriteVariableNum( unsigned long n )	
 {
   ENTER( "short	MIDIFileWrite::WriteVariableNum()" );
   
   register unsigned long buffer;
   short cnt=0;
   
   buffer=n&0x7f;
   while( (n>>=7) > 0)
   {
     buffer <<=8;
     buffer|=0x80;
     buffer+=(n&0x7f);
   }
   
   while( true )
   {
     WriteCharacter( (unsigned char) (buffer&0xff) );
     cnt++;
     if( buffer&0x80 )
       buffer>>=8;
     else
       break;
   }
Exemple #11
0
void Int10Handler(struct Registers * registers)
{
	//Call the function for this function code
	switch(registers->r_ax.b.h)
	{
	//int 0x10/ah=0x00: Set video mode
	case 0x00:
		SetMode(registers);
		break;

	//int 0x10/ah=0x01: Set text mode cursor shape - Unimplemented
	case 0x01:
		break;

	//int 0x10/ah=0x02: Set cursor position
	case 0x02:
		SetCursorPos(registers->r_dx.b.l, registers->r_dx.b.h);
		break;

	//int 0x10/ah=0x03: Get cursor position and size
	//TODO: Cursor size
	case 0x03:
		registers->r_dx.w = *(Word far *)MK_FP(BDA_SEG, BDA_CURSOR_X);
		break;

	//int 0x10/ah=0x05: Set active display page - Unimplemented
	case 0x05:
		break;

	//int 0x10/ah=0x06: Scroll up window
	case 0x06:
		ScrollUpWindow(registers);
		break;

	//int 0x10/ah=0x07: Scroll down window
	case 0x07:
		ScrollDownWindow(registers);
		break;

	//int 0x10/ah=0x08: Read character and attribute
	case 0x08:
		ReadCharacterAndAttribute(registers);
		break;

	//int 0x10/ah=0x09: Write character and attribute
	case 0x09:
		{
			Word i;
			for(i = 0; i < registers->r_cx.w; ++i)
				WriteCharacter(registers->r_ax.b.l, TRUE, registers->r_bx.b.l);
		}
		break;

	//int 0x10/ah=0x0a: Write character
	case 0x0a:
		{
			Word i;
			for(i = 0; i < registers->r_cx.w; ++i)
				WriteCharacter(registers->r_ax.b.l, FALSE, 0x00);
		}
		break;

	//int 0x10/ah=0x0b: Function selected by bh - None implemented
	case 0x0b:
		break;

	//int 0x10/ah=0x0e: Teletype output
	case 0x0e:
		WriteCharacter(registers->r_ax.b.l, FALSE, 0x00);
		break;

	//int 0x10/ah=0x0f: Get current video mode
	case 0x0f:
		registers->r_ax.b.h = 0x50;					//AH: Number of character columns - TODO
		registers->r_ax.b.l = *(Byte far *)MK_FP(BDA_SEG, BDA_VIDEO_MODE);	//AL: Video mode
		break;

	//int 0x10/ah=0x10: Function selected by al
	case 0x10:
		switch(registers->r_ax.b.l)
		{
		//int 0x10/ax=0x1000: Set palette register
		case 0x00:
			{
				Word ioPortBase = *(Word far *)MK_FP(BDA_SEG, BDA_VGA_IO_PORT_BASE);
				inportb(ioPortBase + 6);

				outportb(0x3c0, registers->r_bx.b.l);
				outportb(0x3c0, registers->r_bx.b.h);
			}
			break;

		//int 0x10/ax=0x1001: Set border color - Not supported
		case 0x01:
			break;

		//int 0x10/ax=0x1002: Set all palette registers
		case 0x02:
			SetAllPaletteRegisters(registers);
			break;

		//int 0x10/ax=0x1003: Toggle intensity/blinking bit
		case 0x03:
			ToggleBlinking(registers->r_bx.b.l);
			break;

		//int 0x10/ax=0x1010: Set color register
		case 0x10:
			outportb(0x03c8, registers->r_bx.b.l);
			outportb(0x03c9, registers->r_cx.b.h);
			outportb(0x03c9, registers->r_cx.b.l);
			outportb(0x03c9, registers->r_dx.b.h);
			break;

		//int 0x10/ax=0x1012: Set block of color registers
		case 0x12:
			SetColorRegisters(registers);
			break;
		}
		break;

	//int 0x10/ah=0x11: Character generator functions - Unimplemented
	case 0x11:
		break;

	//int 0x10/ah=0x12: Alternate function select, selected by bl
	case 0x12:
		switch(registers->r_bx.b.l)
		{
		//int 0x10/ah=0x12/bl=0x10: Get EGA info
		case 0x10:
			registers->r_ax.b.l = 0x03;	//AL: Unknown
										//BH: Color/Mono mode in effect
			registers->r_bx.b.h =
				(*(Word far *)MK_FP(BDA_SEG, BDA_VGA_IO_PORT_BASE) == 0x3d4) ? 0x00 : 0x01;
			registers->r_bx.b.l = 0x03;	//BL: 256K memory installed
			registers->r_cx.b.h = 0x00;	//CH: Feature connector bits
			registers->r_cx.b.l = 0x09;	//CL: Switch settings
			break;
		}
		break;

	//int 0x10/ah=0x1a: Display combination code functions, selected by al
	case 0x1a:
		switch(registers->r_ax.b.l)
		{
		//int 0x10/ax=0x1a00: Get display combination code
		case 0x00:
			registers->r_bx.w = *(Word far *)MK_FP(EBDA_SEG, EBDA_DISPLAY_CODE);

			//Return "function supported"
			registers->r_ax.b.l = 0x1a;
			break;

		//int 0x10/ax=0x1a01: Set display combination code
		case 0x01:
			*(Word far *)MK_FP(EBDA_SEG, EBDA_DISPLAY_CODE) = registers->r_bx.w;

			//Return "function supported"
			registers->r_ax.b.l = 0x1a;
            break;
		}
		break;

	//int 0x10/ah=0x1b: Functionality/state information - Unimplemented
	case 0x1b:
		break;

	//int 0x10/ah=0x4f: VESA VBE functions - Unimplemented
	case 0x4f:
		break;

	//int 0x10/ah=0x6f: Video7 VGA functions, selected by al - None supported
	case 0x6f:
		break;
	}
}