Exemple #1
0
NVALUE srvc_dump(NPVALUE none) {
  int i;
  for(i=0;i<SRVC_SIZE;i++) {
    if(srvc_entries[i].sid != 0) {
      vid_print(srvc_entries[i].name,0x0A); vid_print (" at ",0x0A); vid_print(nitoa((int)srvc_entries[i].sid,10),0x0A); vid_print("\r\n",0x0A);
    }
  }
}
Exemple #2
0
void syscall_halt(void)
{
	vid_clr();
	vid_cursor(12, 34);
	vid_print("Halted X'(", 11);
	_halt();
}
Exemple #3
0
NVALUE vid_init_drv() {
  NUSHORT vid_sid = srvc_register_service("video");
  rpc_register_func("vid_print",(NPVALUE)viddrv_print,vid_sid);
  rpc_register_func("vid_clear_mem",(NPVALUE)viddrv_clear_mem,vid_sid);
  rpc_register_func("vid_get_height",(NPVALUE)viddrv_get_height,vid_sid);
  rpc_register_func("vid_get_width",(NPVALUE)viddrv_get_width,vid_sid);
  rpc_register_func("vid_get_row",(NPVALUE)viddrv_get_row,vid_sid);
  rpc_register_func("vid_get_column",(NPVALUE)viddrv_get_column,vid_sid);
  rpc_register_func("vid_set_row",(NPVALUE)viddrv_set_row,vid_sid);
  rpc_register_func("vid_set_column",(NPVALUE)viddrv_set_column,vid_sid);
  rpc_register_func("vid_get_ptr",(NPVALUE)viddrv_get_ptr,vid_sid);
  vid_print("[ VIDEO ] Registered functions for RPC\r\n",0x7);
}
Exemple #4
0
int syscall_write(unsigned int fd, char *str, unsigned int size)
{
	switch (fd) {
		case STDOUT:
		vid_color(colors[0], colors[1]);
		break;
		case STDERR:
		vid_color(colors[2], colors[3]);
		break;
		
		case STDRAW:
		vid_raw_print(str, size);
		return size;

		default:
		return -1;
	}
	vid_print(str, size);
	return size;
}
Exemple #5
0
NVALUE kbd_init_layout() {
  vid_print("[ KEYBOARD ] Keyboard layout: U.S\r\n",0x07);

  /*
    Numbers
  */
  keys[0x02] = '1'; keys[0x03] = '2'; keys[0x04] = '3';
  keys[0x05] = '4'; keys[0x06] = '5'; keys[0x06] = '5';
  keys[0x07] = '6'; keys[0x08] = '7'; keys[0x09] = '8';
  keys[0x0A] = '9'; keys[0x0B] = '0';

  /*
    First row
  */
  keys[0x10] = 'q'; keys[0x11] = 'w'; keys[0x12] = 'e';
  keys[0x13] = 'r'; keys[0x14] = 't'; keys[0x15] = 'y';
  keys[0x16] = 'u'; keys[0x17] = 'i'; keys[0x18] = 'o';
  keys[0x19] = 'p';

  /*
   Second row
  */
  keys[0x1E] = 'a'; keys[0x1F] = 's'; keys[0x20] = 'd';
  keys[0x21] = 'f'; keys[0x22] = 'g'; keys[0x23] = 'h';
  keys[0x24] = 'j'; keys[0x25] = 'k'; keys[0x26] = 'l'; 

  /*
   Third row
  */
  keys[0x2C] = 'z'; keys[0x2D] = 'x'; keys[0x2E] = 'c';
  keys[0x2F] = 'v'; keys[0x30] = 'b'; keys[0x31] = 'n';
  keys[0x32] = 'm';

  /*
   Special characters
  */
  keys[0x39] = ' '; keys[0x1C] = '\n'; keys[0x01] = '\r';
}
Exemple #6
0
NUSHORT srvc_get_id(NPCHAR name) { 
  NUSHORT i;
  for(i=0;i<SRVC_SIZE;i++) {
    
    if(nstrlen(srvc_entries[i].name) != nstrlen(name)) continue;
    if(nstrcmp(srvc_entries[i].name,name) != 1) continue;
#ifdef DEBUG_LVL_TWO
    vid_print("[ SRVC ] Found as: ",0x0A);
    vid_print(nitoa((int)srvc_entries[i].sid,10),0x0A);
    vid_print("\r\n",0x07);
    vid_print(srvc_entries[i].name,0x08);
    vid_print(" /SRVC\r\n",0x08);
#endif
    return srvc_entries[i].sid;
  }
#ifdef DEBUG_LVL_TWO
  vid_print("[ SRVC ] srvc_get_id could not find this service :(\r\n",0x04);
  vid_print(name,0x4);
#endif
  //kstop();
  return 0;
}
Exemple #7
0
NUSHORT srvc_register_service(NPCHAR name) {
#ifdef DEBUG_LVL_ONE
  vid_print("[ SRVC ] srvc_register_service: ",0x0A);
  vid_print(name,0x0A);
  vid_print("\r\n",0x07);
#endif
  struct SRVCEntry entry;
  entry.name = (NPCHAR)mem_alloc(nstrlen(name)+1);
#ifdef DEBUG_LVL_ONE
  vid_print("[ SRVC ] Name of service: ",0x0A);
  vid_print(name,0x0A); char buffer[256];
  vid_print(" ptr = ",0x0A); nultoa((NULONG)(NPVALUE)entry.name,16,buffer); vid_print(buffer,0xf);
  vid_print("\r\n",0x0A);
#endif
  NUSHORT i;
  NUINT len = nstrlen(name)+1;
  for(i=0;i<len;i++) {
    entry.name[i] = name[i];
  }
  entry.sid = srvc_sid;
  srvc_sid++;
  srvc_entries[srvc_index] = entry;
#ifdef DEBUG_LVL_ONE
  vid_print("[ SRVC ] Registered as: ",0x0A);
  vid_print(nitoa((int)srvc_entries[srvc_index].sid,10),0x0A);
  vid_print("\r\n",0x07);
#endif
  srvc_index++;
  return entry.sid;
}
Exemple #8
0
NVALUE viddrv_print(struct NCOLOREDTEXT* text) {
  /* Wrap driver handler */
  vid_print(text->text,text->color);
}
Exemple #9
0
NVALUE panic(NPCHAR message) {
  vid_print(message,0x04);
  kstop();
}
Exemple #10
0
NVALUE kprint(NPCHAR message) {
  vid_print("[NoOS] ",0x05);
  vid_print(message,0x02);
}