Exemplo n.º 1
0
void drawImage(enum vga_color img[25][80])
{
    size_t x, y;
    for (x = 0; x < 80; ++x)
    {
        for (y = 0; y < 25; ++y)
        {
            terminal_set_pos(x,y);
            terminal_setcolor(0, img[y][x]);
            terminal_writestring(" ");
        }
    }
}
Exemplo n.º 2
0
void drawBox(size_t minX, size_t minY, size_t  maxX, size_t maxY, enum vga_color fg, enum vga_color bg)
{
    size_t x, y;
    terminal_setcolor(fg, bg);

    for (x = minX; x < maxX; ++x)
    {
        for (y = minY; y < maxY; ++y)
        {
            terminal_set_pos(x, y);
            terminal_writestring(" ");
        }
    }

}
Exemplo n.º 3
0
void load_hex_to_rom(const char *path) {
		void *entry;
		HexStat stat = {0, 0xFFFFFFFF};
		RomHeader header;
		int x, y;
		int fd;
		
		printf("Erasing ROM... ");
		
		rom_erase();
		while(rom_status() & 0x1);
		
		terminal_set_fg(TERMINAL_COLOR_LIGHT_GREEN);
		printf("done.\n");
		terminal_set_fg(TERMINAL_COLOR_LIGHT_GRAY);
		
		printf("Writing to ROM... ");
		terminal_get_pos(&x, &y);
		
		fd = fat_open(path, O_RDONLY);
		
		if(hexload(get_byte, fd, _write_rom_byte, &stat, &entry) < 0) {
			terminal_set_fg(TERMINAL_COLOR_RED);
			printf("Invalid hex file");
			terminal_set_fg(TERMINAL_COLOR_LIGHT_GRAY);
			
			fat_close(fd);
			return;
		}
		fat_close(fd);
		
		header.magic = 0xDEADBEEF;
		header.entry = (uint32_t) entry;
		header.size = stat.size;
		header.dest_addr = LLRAM_BASE | stat.offset;
		header.flash_offset = stat.offset;
		
		rom_write(ROM_SIZE - 512, (void *) &header, sizeof(header));
		
		terminal_set_pos(x, y);
		terminal_set_fg(TERMINAL_COLOR_LIGHT_GREEN);
		printf("done.\n");
		terminal_set_fg(TERMINAL_COLOR_LIGHT_GRAY);
		printf("Press any key...");
}