void vga_set_amode (void) { u8 byte; write_att(0x0c, ATC_MODE); //reset palette to normal in the case it was changed write_att(0x0, ATC_COLOR_PAGE); // // display is off at this point write_seq(0x3,SEQ_PLANE_WRITE); // planes 0 & 1 byte = read_seq_b(SEQ_MEMORY_MODE) & ~0x04; write_seq(byte,SEQ_MEMORY_MODE); byte = read_gra_b(GDC_MODE) & ~0x60; write_gra(byte|0x10,GDC_MODE); write_gra(0x0e, GDC_MISC); write_crtc(0x00, CRTC_CURSOR_START); write_crtc(CHAR_HEIGHT-1, CRTC_CURSOR_END); byte = read_crtc_b(CRTC_MODE) & ~0xe0; write_crtc(byte|0xa0, CRTC_MODE); byte = read_crtc_b(CRTC_MAX_SCAN) & ~0x01f; write_crtc(byte | (CHAR_HEIGHT-1), CRTC_MAX_SCAN); // turn on display, disable access to attr palette inb(IS1_RC); outb(0x20, ATT_IW); }
int main_interleave(int argc, char *argv[]) { gzFile fp1, fp2; kseq_t *seq[2]; kstring_t str; if (argc < 3) { fprintf(stderr, "Usage: fermi interleave <in1.fq> <in2.fq>\n"); return 1; } str.l = str.m = 0; str.s = 0; fp1 = strcmp(argv[1], "-")? gzopen(argv[1], "r") : gzdopen(fileno(stdin), "r"); fp2 = strcmp(argv[2], "-")? gzopen(argv[2], "r") : gzdopen(fileno(stdin), "r"); seq[0] = kseq_init(fp1); seq[1] = kseq_init(fp2); while (kseq_read(seq[0]) >= 0) { if (kseq_read(seq[1]) < 0) break; // one file ends str.l = 0; if (seq[0]->name.l > 2 && seq[0]->name.s[seq[0]->name.l-2] == '/' && isdigit(seq[0]->name.s[seq[0]->name.l-1])) seq[0]->name.s[(seq[0]->name.l -= 2)] = 0; // trim tailing "/[0-9]$" seq[1]->name.l = 0; kputsn(seq[0]->name.s, seq[0]->name.l, &seq[1]->name); // make sure two ends having the same name write_seq(seq[0], &str); write_seq(seq[1], &str); fputs(str.s, stdout); } kseq_destroy(seq[0]); gzclose(fp1); kseq_destroy(seq[1]); gzclose(fp2); free(str.s); return 0; }
void vga_set_gmode (void) { u8 byte; byte = read_att_b(ATC_MODE) & ~0x0f; write_att(byte|0x1, ATC_MODE); // // display is off at this point byte = read_seq_b(SEQ_PLANE_WRITE) & ~0xf; write_seq(byte|0xf,SEQ_PLANE_WRITE); // all planes byte = read_seq_b(SEQ_MEMORY_MODE); write_seq(byte|4,SEQ_MEMORY_MODE); byte = read_gra_b(GDC_MODE) & ~0x10; write_gra(byte,GDC_MODE); write_gra(0x05, GDC_MISC); write_crtc(0x20, CRTC_CURSOR_START); write_crtc(0x00, CRTC_CURSOR_END); byte = read_crtc_b(CRTC_MODE) & ~0xe0; write_crtc(byte|0xe0, CRTC_MODE); byte = read_crtc_b(CRTC_MAX_SCAN) & ~0x01f; write_crtc(byte, CRTC_MAX_SCAN); byte = inb(MIS_R); // get 3c2 value by reading 3cc outb(byte & ~0xc,MIS_W); // clear last bits to set 25Mhz clock and low page // turn on display, disable access to attr palette inb(IS1_RC); outb(0x20, ATT_IW); }
void Forwarder::write_seq(const std::string &seq_filename, size_t no_states, size_t seq_no) const { std::ofstream seq_stream(seq_filename.c_str()); if(!seq_stream) { std::cerr << "Unable to open \"" << seq_filename << "\"" << std::endl; exit(-1); } write_seq(seq_stream, no_states, seq_no); }
void vga_font_load(unsigned char *vidmem, const unsigned char *font, int height, int num_chars) { /* Note: the font table is 'height' long but the font storage area * is 32 bytes long. */ int i,j; u8 byte; // set sequencer map 2, odd/even off byte = read_seq_b(SEQ_PLANE_WRITE) & ~0xf; write_seq(byte|4,SEQ_PLANE_WRITE); byte = read_seq_b(SEQ_MEMORY_MODE); write_seq(byte|4,SEQ_MEMORY_MODE); // select graphics map 2, odd/even off, map starts at 0xa0000 write_gra(2,GDC_PLANE_READ); byte = read_gra_b(GDC_MODE) & ~0x10; write_gra(byte,GDC_MODE); write_gra(0,GDC_MISC); for (i = 0 ; i < num_chars ; i++) { for (j = 0 ; j < height ; j++) { vidmem[i*32+j] = font[i*16+j]; } } // set sequencer back to maps 0,1, odd/even on byte = read_seq_b(SEQ_PLANE_WRITE) & ~0xf; write_seq(byte|3,SEQ_PLANE_WRITE); byte = read_seq_b(SEQ_MEMORY_MODE) & ~0x4; write_seq(byte,SEQ_MEMORY_MODE); // select graphics back to map 0,1, odd/even on write_gra(0,GDC_PLANE_READ); byte = read_gra_b(GDC_MODE); write_gra(byte|0x10,GDC_MODE); write_gra(0xe,GDC_MISC); }
void Forwarder::write_seqs(const std::string &nstates2seq_absolute_dir_name) const { for(std::map<size_t, std::vector<std::vector<unsigned> > >::const_iterator it = nStates2seqs.begin(); it != nStates2seqs.end(); ++it) { size_t nStates = (*it).first; const std::vector<std::vector<unsigned> > &sequences = (*it).second; std::stringstream nStatesDirname_stream; nStatesDirname_stream << nstates2seq_absolute_dir_name << "/" << nStates; std::string nStatesDirname = nStatesDirname_stream.str(); mk_dir(nStatesDirname); for(size_t i = 0; i < sequences.size(); ++i) { std::stringstream seq_filename_stream; seq_filename_stream << nStatesDirname << "/" << i << ".seq"; write_seq(seq_filename_stream.str(), nStates, i); } } }
static void write_single_file(FILE *out, const char *path) { static const char c1[] = "const char *gl_"; static const char c2[] = " = \""; static const char c3[] = "\";\n"; const char *name; char *content; size_t len; name = get_basename(path); content = read_file(path, &len); fwrite(c1, sizeof(c1) - 1, 1, out); write_name(out, name); fwrite(c2, sizeof(c2) - 1, 1, out); write_seq(out, content, len); fwrite(c3, sizeof(c3) - 1, 1, out); free(content); }