Пример #1
0
void
debug_putc (const char c)
{
	static uint16_t* buff = (uint16_t*)0xB8000;
	switch (c) {
	case '\t':
		{
		memsetw(buff, 0x4E00, 4);
		buff += 4;
		break;
		}
	case '\n':
		{
		size_t len = 80 - (((size_t)buff-0xB8000)/2 + 80) % 80;
		memsetw(buff, 0x4E00, len);
		buff += len;
		break;
		}
	default:
		*buff++ = (uint16_t)(0x4E00 | c);
		break;
	}
	if ((size_t)buff >= 0xB8000+(80*25*2)) {
		buff = (uint16_t*)0xB8000;
	}
}
void ff_mpeg4_clean_buffers(MpegEncContext *s)
{
	int c_wrap, c_xy, l_wrap, l_xy;

	l_wrap= s->b8_stride;
	l_xy= (2*s->mb_y-1)*l_wrap + s->mb_x*2 - 1;
	c_wrap= s->mb_stride;
	c_xy= (s->mb_y-1)*c_wrap + s->mb_x - 1;

#if 0
	/* clean DC */
	memsetw(s->dc_val[0] + l_xy, 1024, l_wrap*2+1);
	memsetw(s->dc_val[1] + c_xy, 1024, c_wrap+1);
	memsetw(s->dc_val[2] + c_xy, 1024, c_wrap+1);
#endif

	/* clean AC */
	memset(s->ac_val[0] + l_xy, 0, (l_wrap*2+1)*16*sizeof(int16_t));
	memset(s->ac_val[1] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));
	memset(s->ac_val[2] + c_xy, 0, (c_wrap  +1)*16*sizeof(int16_t));

	/* clean MV */
	// we can't clear the MVs as they might be needed by a b frame
//    memset(s->motion_val + l_xy, 0, (l_wrap*2+1)*2*sizeof(int16_t));
//    memset(s->motion_val, 0, 2*sizeof(int16_t)*(2 + s->mb_width*2)*(2 + s->mb_height*2));
	s->last_mv[0][0][0]=
	    s->last_mv[0][0][1]=
	        s->last_mv[1][0][0]=
	            s->last_mv[1][0][1]= 0;
}
Пример #3
0
// clears the screen
void clear()
{
    memsetw(video_mem, blank, 80*25);
    // reset cursor location
    cursor_x = cursor_y = 0;
    move_cursor(cursor_y, cursor_x);
}
Пример #4
0
void *
memset(void *v, int c, size_t _n)
{
	char *p;
	size_t n0;
	size_t n = _n;

	if (n == 0) return NULL; // zra: complain here?

	p = v;

    while (n > 0 && ((uintptr_t)p & (sizeof(long)-1)))
	{
		*p++ = c;
		n--;
	}

	if (n >= sizeof(long))
	{
		n0 = n / sizeof(long) * sizeof(long);
		memsetw((long*)p, c, n0);
		n -= n0;
		p += n0;
	}

	while (n > 0)
	{
		*p++ = c;
		n--;
	}

	return v;
}
Пример #5
0
// clear everything including scrollback
void cls(void) {
	memsetw(&buffer, blank, BUFFER_SIZE);
	clear_screen();
	buf_csr = &buffer;
	view_offset = &buffer;
	move_csr();
}
Пример #6
0
quiet ()
{
  register short vce;

  for (vce = 0; vce < 12; vce++)	/* for each voice ... */
    sendval (vce, 2, 0);	/* ... set level = 0 */

  memsetw (seqflag, 0, 16);	/* stop the sequences */
  memsetw (seqtime, 0, 16);	/* ... */

  memsetw (trstate, 0, 16);	/* reset the triggers */

  seqdupd = 0xFFFF;		/* request display update */

  stmproc (NULL_DEF);		/* trigger the blank definer */
}
Пример #7
0
void fork()
{
	struct Task* task = malloc(sizeof(struct Task));

	if(!task)
		panic("Task alloc failed!");

	memcpy(task, current_task, sizeof(struct Task));

	task->segment = task_seg;
	task_seg += 0x1000;

	farmemcpy(0x0000, 0x0000, 0x8000, task->segment, current_task->segment);
	farmemcpy(0x8000, 0x8000, 0x8000, task->segment, current_task->segment);

	memsetw(task->stack, 0, KERNEL_STACK_WORDS);

	/* create a kernel stack for returning to userspace */
	task->stack[KERNEL_STACK_WORDS - 1] = &kernel_exit; /* return address */
	task->stack[KERNEL_STACK_WORDS - 2] = 0x0000; /* bp */
	task->stack[KERNEL_STACK_WORDS - 3] = 0x0000; /* ax */
	task->stack[KERNEL_STACK_WORDS - 4] = 0x0000; /* si */
	task->stack[KERNEL_STACK_WORDS - 5] = 0x0000; /* di */

	task->kernel_sp = &task->stack[KERNEL_STACK_WORDS - 5];
	task->stack_top = &task->stack[KERNEL_STACK_WORDS - 1];

	pokew(task->segment, task->user_sp + 18, task->segment);
	pokew(task->segment, task->user_sp + 12, 0);

	task->next = task_list;
	task_list = task;

	return;
}
Пример #8
0
void SimpleConsole::ScrollUp()
{
	memcpyw( buffer, buffer+width, width*(height-1) );
	memsetw( buffer + width *( height - 1 ), charStyle , width );
	memcpyw( video, buffer, width * height );
	cursorY --;
}
Пример #9
0
/* Clears the screen */
void cls()
{
    uint16_t blank;
    int i;

    /* Again, we need the 'short' that will be used to
    *  represent a space with color */
    blank = 0x20 | (attrib << 8);

    /* set background color of status line */
    for (i=0; i < screen_w; i++)
        *((uint8_t*)(textmemptr + i)+1) = attrib_status;

    /* Sets the entire screen to spaces in our current
    *  color */
    /* skip first line (used as status monitor) */
    for(i = 1; i < screen_h; i++)
        memsetw (textmemptr + i * screen_w, blank, screen_w);

    /* Update out virtual cursor, and then move the
    *  hardware cursor */
    csr_x = 0;
    csr_y = 0;
#   if !defined(EARLY) && SCROLLBACK_BUF_SIZE
    buf_x = 0;
    buf_y++;
    if (buf_y > SCROLLBACK_BUF_SIZE) {
        buf_y = 0;
        printf("Scrollback overflow!\n");
    }
#   endif
    move_csr();
}
Пример #10
0
/**
 * Scrolls up the screen
 */
void scroll() 
{
	unsigned blank, temp;
	
	// Blank
	blank = 0x20 | (attribute << 8);
	
	/*
	 * We scroll by moving ALL the video 
	 * memory a row higher and filling the last row
	 * with blanks
	 */
	 if(cursor_y >= 25)
	 {
		temp = cursor_y - 25 + 1;
		
		// Move the current text chunck back by a line. 
		// (By the way the x2 is because memcpy copies bytes and we need shorts)
		memcpy(videomem, videomem + temp * width_of_screen, (height_of_screen - temp) * width_of_screen * 2);
		
		// Set the last line to blank
		memsetw(videomem + (height_of_screen - temp) * width_of_screen, blank, width_of_screen);
		
		cursor_y = height_of_screen - 1;
	 }
}
Пример #11
0
void SimpleConsole::ClearScreen()
{
	memsetw( buffer, charStyle, width * height );
	RefreshBuffer();
	cursorX = 0;
	cursorY = 0;
	MoveCursor();
}
Пример #12
0
/* scroll up one line. */
void scroll(void) {
    if(py >= 25) {
        uint pos = py-25+1;
        memcpy(vgamem, &vgamem[pos][0], (25-pos)*80*sizeof(struct vchar));
        memsetw(&vgamem[25-pos][0], VC_BLANK, 80);
        py = 25-1;
    }
}
Пример #13
0
int
nb_name_encode(struct nb_name *np, u_char *dst)
{
	u_char *name, *plen;
	u_char *cp = dst;
	int i, lblen;

	*cp++ = NB_ENCNAMELEN;
	name = np->nn_name;
	if (name[0] == '*' && name[1] == 0) {
		*(u_short*)cp = NBENCODE('*');
		memsetw(cp + 2, NB_NAMELEN - 1, NBENCODE(' '));
		cp += NB_ENCNAMELEN;
	} else {
		for (i = 0; *name && i < NB_NAMELEN - 1; i++, cp += 2, name++)
			*(u_short*)cp = NBENCODE(toupper(*name));
		i = NB_NAMELEN - i - 1;
		if (i > 0) {
			memsetw(cp, i, NBENCODE(' '));
			cp += i * 2;
		}
		*(u_short*)cp = NBENCODE(np->nn_type);
		cp += 2;
	}
	*cp = 0;
	if (np->nn_scope == NULL)
		return nb_encname_len(dst);
	plen = cp++;
	lblen = 0;
	for (name = np->nn_scope; ; name++) {
		if (*name == '.' || *name == 0) {
			*plen = lblen;
			plen = cp++;
			*plen = 0;
			if (*name == 0)
				break;
		} else {
			if (lblen < NB_MAXLABLEN) {
				*cp++ = *name;
				lblen++;
			}
		}
	}
	return nb_encname_len(dst);
}
Пример #14
0
/**
 * Allocate a block of memory.
 * Fill it with zeroes.
 */
void *mem_alloc (mem_pool_t *m, size_t required)
{
	void *p;

	p = mem_alloc_dirty (m, required);
	if (p && required > 0)
		memsetw (p, 0, required);
	return p;
}
Пример #15
0
static void scroll() {
  if (cursor_y >= 25) {
    memcpy((uint8_t*)video_memory,
           (uint8_t*)&video_memory[80], 2 * 80 * 24);
    memsetw(&video_memory[80 * 24],
            MAKE_CHAR(' ', c_back, c_back), 80);
    cursor_y = 24;
  }
}
Пример #16
0
// Clears the console
void cls() {
    unsigned blank = attrib | ' ';

    for(int i = 0; i < CRT_SIZE; ++i)
        memsetw(crt.buf, blank, CRT_SIZE);

    crt.pos = 0;
    update_cursor();
}
Пример #17
0
void clear(){
	uint16_t blank = 0x20 | (terminal_color << 8);

	memsetw(video_memory, blank, VGA_COLS*VGA_ROWS);

	terminal_row = 0;
	terminal_column = 0;
	update_cursor();
}
Пример #18
0
// scrolls the text one line upwards if necessary
static inline void scroll()
{
    if (cursor_y >= 25) {
        memmoved(video_mem, video_mem+80, 80*24/2);
        memsetw(video_mem+80*24, blank, 80); // fill the last row with blank

        cursor_y = 24;
    }
}
Пример #19
0
long
scinit ()
{
  register long i, *cp;

  se1_cnt = 0L;			/* fragments */
  size1 = E_NULL;
  se2_cnt = 0L;
  size2 = E_NULL;
  se3_cnt = 0L;
  size3 = E_NULL;
  se_chg = TRUE;
  frags = 0L;

  spcount = (long) MAX_SE;	/* storage pool */
  pspool = spool;
  cp = spool;

  for (i = spcount; i-- > 0;)
    *cp++ = 0L;

  for (i = 0; i < N_SCORES; i++)	/* score names */
    memcpy (scname[i], "{ empty score  }", 16);

  memsetw (scores, 0, 2 * N_SCORES);	/* score list */
  memsetw (hplist, 0, 2 * N_SCORES * N_TYPES);	/* header lists */
  memsetw (seclist, 0, 2 * N_SCORES * N_SECTS);	/* section lists */
  memset (stimes, 0, 12 * N_SCORES * N_SECTS);	/* section times */

  t_cur = t_ctr = 0L;		/* times */
  t_bak = t_cur - TO_BAK;
  t_fwd = t_cur + TO_FWD;

  p_bak = E_NULL;		/* pointers */
  p_cur = E_NULL;
  p_ctr = E_NULL;
  p_fwd = E_NULL;
  scp = E_NULL;

  curscor = 0;			/* current score */
  cursect = 0;			/* current section */

  return (evleft ());
}
Пример #20
0
static void _exicc vh_vio_fillrect(EXI_DATA, u32t col, u32t line, u32t width, u32t height, char ch, u16t color) {
   instance_void(vd);
   if (!width || !height) return;
   if (!ch) ch = ' ';
   // alloc dynamic buffer
   u16t *vb = new u16t[width*height];
   memsetw(vb, color<<8|ch, width*height);
   vh_vio_writebuf(data, 0, col, line, width, height, vb, width<<1);
   delete vb;
}
Пример #21
0
void cls()
{
    unsigned short i;
    for(i=1;i<25;i++)
    {
       memsetw(pVidmem + i*gs_cons_cols,gs_win_blank,gs_cons_cols);  
    }
    cursorx = 0;
    cursory = 1;
    set_cursor();    	
}
Пример #22
0
void cls(void) {
    unsigned blank;
    int i;
    blank = 0x20 | (attrib << 8);
    for (i = 0; i < 25; i++)
        memsetw(((unsigned short *) txtMemPtr) + i * 80, blank, 80);

    csr_x = 0;
    csr_y = 0;
    move_csr();
}
Пример #23
0
void clear()
{
    unsigned blank_space = 0x20 | (attrib << 8);
    for (int i = 0; i < 25; i++)
    {
        memsetw(textptr + i * 80, blank_space, 80);
    }
    csr_x = 0;
    csr_y = 0;
    move_cursor();
}
Пример #24
0
void scroll()
{
    /* Scroll the screen up one line if needed */
    if(cursory >= 25)
    {
      memcpy(pVidmem + gs_cons_cols,pVidmem + (gs_cons_cols << 1),80*24*2);
      /* Blank out the last line */
      memsetw(pVidmem + ((24) * gs_cons_cols), gs_win_blank, 80);
      cursory = 24;
    }
}
Пример #25
0
void scroll(void){
	unsigned blank= 0x20 |(attrib << 8); //Space character, black background
	if(csr_y>=25){
		//after 25 lines we must scroll the screen
//		memcpy(textmemptr,textmemptr+(csr_y-25+1)*80,(25-csr_y-25+1)*80*2);
		memcpy(textmemptr,textmemptr+80,24*80*2);
		memsetw(textmemptr+(25-(csr_y-25+1))*80,blank,80);
//		csr_y=25-1;
		csr_y=24;
	};
};
Пример #26
0
void scroll(void) {
    unsigned blank, temp;
    blank = 0x20 | (attrib << 8);

    if (csr_y >= 25) {
        temp = csr_y - 25 + 1;
        memcpyw(txtMemPtr, txtMemPtr + temp * 80, (25 - temp) * 80 * 2);
        memsetw(((unsigned short *) txtMemPtr) + (25 - temp) * 80, blank, 80);
        csr_y = 25 - 1;
    }
}
Пример #27
0
Файл: scrn.c Проект: shmuga/maOS
void scroll(void)
{
    unsigned blank, temp;
    blank = 0x20 | (attrib << 8);
    if(csr_y >= 25)
    {
        temp = csr_y - 25 + 1;
        memcpy (textmemptr, textmemptr + temp * 80, (25 - temp) * 80 * 2);
        memsetw (textmemptr + (25 - temp) * 80, blank, 80);
        csr_y = 25 - 1;
    }
}
Пример #28
0
void scroll(){
	uint16_t blank = 0x20 | (terminal_color << 8);

	size_t shift = 0;
	if(terminal_row >= VGA_ROWS){
		shift = terminal_row - VGA_ROWS + 1;
		memcpy((uint8_t*)video_memory, (uint8_t*)(video_memory + (shift * VGA_COLS)), (VGA_ROWS - shift) * VGA_COLS * 2);

		memsetw(video_memory + (VGA_ROWS - shift) * VGA_COLS, blank,  VGA_COLS);
		terminal_row = VGA_ROWS - 1;
	}
}
Пример #29
0
void tty(void){
	oprintf("try to mount device1:partation:3:%s\n",mount("/mnt/",1,3)?"success":"failed");
	int crt_start;
	__asm__("cli");
	loadbuf=kmalloc(SIZE_LOAD_BUF);
	oprintf("tty running..welcome^.^\n");
	buff=kmalloc(23);
	for(int j=0;j<0;j++){
		oprintf("j=%u,i will do open\n",j);
//		int fd=open("/mnt/home/wws/dimg",0);
		int fd=open("/mnt/short");
		oprintf("fd:%u,inode:%u\n",fd,fd_table[fd].inode);
		int newseek=lseek(fd,-2,2);
		int r_bytes=read(fd,tmp,7);
		oprintf("r_bytes:%u,newseek:%u\n",r_bytes,newseek);
//		while(1);
	}
	while(1){
new_prompt:
		reset_cmd_asciis();
		memsetw((u16*)loadbuf,SIZE_LOAD_BUF/2,0);
		oprintf("#   ");
wait_input:
		while(1){
			unsigned ascii=getchar();
			switch(ascii){
				case 128://ctrl+l
					k_screen_reset();
					goto new_prompt;
				case 129://ctrl+c
					kill(front_pid);
					oprintf("^C\n");
					goto new_prompt;
				case 130://ctrl+u
					crt_start=get_start();
					set_start(crt_start>=80?crt_start-80:crt_start);
					goto wait_input;
				case 131://ctrl+d
					crt_start=get_start();
					set_start(crt_start<(80*24*4-1)?crt_start+80:crt_start);
					goto wait_input;
			}
			oprintf("%c",ascii);//oprintf函数有能力打印控制字符,但更多的ctrl,shift组合还要跟进
			if(ascii=='\n'){//回车符执行命令
				parse_cmd_asciis();
				break;
			}
			//执行到这儿,说明是普通输入,写入cmd_asciis
			write_cmd_asciis(ascii);
		}
	}
}
Пример #30
0
void scroll()
{
    unsigned blank_space = 0x20 | (attrib << 8);
    unsigned temp;
    if (csr_y >= 25)
    {
        temp = csr_y - 25 + 1;
        //memsetw(textptr + i * 80, blank_space, 80);
        memcpy(textptr, textptr + temp * 80, (25 - temp) * 80 * 2);
        memsetw(textptr + (25 - temp) * 80, blank_space, 80);
        csr_y = 25 - 1;
    }
}