//----------------------------------------------------------------------- // Obnovi z bufferu Buf vyrez obrazovky dany rozmery x0, y0, x1, y1 //------------------------------------------------------------------------ void SetScr(char x0,char y0,char x1,char y1) { uchar x,y; if(ScrBuf_ix == 0) printf("\r\nERROR-SetScr: Neni ulozen zadny vyrez, nelze obnovit obraz !"); else { if(ScrBuf_ix > ScrBuffers) cprintf("\r\nERROR-SetScr: Prekrocen maximalni index pro obnoveni vyrezu !"); else { ScrBuf_ix--; if(ScrBuf[ScrBuf_ix]==0) printf("\r\nERROR-SetScr: Nebyla alokovana pamet obraz nebyl ulozen! Index: %2d",ScrBuf_ix); else { for (y=y0; y<y1; y++) { for (x=x0; x<x1; x++) { pokeb(0xB800,x*2+y*80*2, ScrBuf[ScrBuf_ix][(x-x0)*2 + (y-y0)*(x1-x0)*2 ]); pokeb(0xB800,x*2+y*80*2 + 1,ScrBuf[ScrBuf_ix][(x-x0)*2 + (y-y0)*(x1-x0)*2 + 1]); } } farfree(ScrBuf[ScrBuf_ix]); // Uvolneni pouzite pameti ScrBuf[ScrBuf_ix]=0; // Nulovani ukazatele } } } //{ if(ScrBuf_ix) ScrBuf_ix--; // // for (y=y0;y<=y1;y++) // for (x=x0;x<=x1;x++) // { pokeb(0xB800,x*2+y*80*2,ScrBuf[ScrBuf_ix][x*2 + y*80*2]); // pokeb(0xB800,x*2+y*80*2 + 1,ScrBuf[ScrBuf_ix][x*2 + y*80*2 + 1]); } //} //else //{ gotoxy(1,1); textattr(15); // cprintf("\nChyba: SetScr: Buffer neni %2d inicializovan !",ScrBuf_ix-1); //} }
void Messages::OverwriteString(size_t n,string s) { string r=GetString(n); if(r.size()<s.size())return ; size_t pos; pointers.Load(n,&pos); for(size_t i=0;i<r.size();i++) { if(i<s.size()) pokeb(pos,s[i]); else pokeb(pos,' '); pos++; } }
void int10ax13(struct REGPACK *regs) {unsigned char far *pvar; pvar=&var; regs->r_ax=0x1300; regs->r_bx=0x000b; regs->r_dx=0x1010; regs->r_cx=0x0002; regs->r_es=FP_SEG(pvar); regs->r_bp=FP_OFF(pvar); pokeb(regs->r_es,regs->r_bp,'t'); pokeb(regs->r_es,regs->r_bp+1,'b'); printf("Writing from %04x:%04x\n",regs->r_es,regs->r_bp); intr(0x10,regs); }
CLIPPER memout() { if (! (PCOUNT==3 || ISNUM(1) || ISNUM(2) || ISNUM(3))) _retl(0); else { pokeb(_parni(1),_parni(2),(char)_parni(3)); _retl(1); } }
void change_password(MEMZ *bf, unsigned char *password) { int i; unsigned char ctow=1; if (bf->ztype != 1) return; for (i=0; i<8; i++) { if (ctow) ctow = password[i]; pokeb(bf->segment, bf->offset + 8 + 3 + i, ctow); } }
void VGASetTextMode(uint8_t high_res) { uint8_t font_height = 0; if(high_res) { VGAWriteRegisters(vga_text_90_60); vga_text_width = 90; vga_text_height = 60; font_height = 8; } else { VGAWriteRegisters(vga_text_80_25); vga_text_width = 80; vga_text_height = 25; font_height = 16; } /* Set font. */ if(font_height >= 16) { VGAWriteFont(vga_8x16_font, 16); } else { VGAWriteFont(vga_8x8_font, 8); } /* tell the BIOS what we've done, so BIOS text output works OK */ pokew(0x40, 0x4A, vga_text_width); /* columns on screen */ pokew(0x40, 0x4C, vga_text_width * vga_text_height * 2); /* framebuffer size */ pokew(0x40, 0x50, 0); /* cursor pos'n */ pokeb(0x40, 0x60, font_height - 1); /* cursor shape */ pokeb(0x40, 0x61, font_height - 2); pokeb(0x40, 0x84, vga_text_height - 1); /* rows on screen - 1 */ pokeb(0x40, 0x85, font_height); /* char height */ /* Set white-on-black for all text. */ for(size_t i = 0; i < vga_text_width * vga_text_height; i++) { pokeb(0xB800, i * 2 + 1, 7); } }
void main(void) { FILE *fp; int offset; char value; if ((fp = fopen("SAVE_SCR.DAT", "rb")) == NULL) printf("Error opening file\n"); else { for (offset = 0; offset < 8000; offset++) { fscanf(fp, "%c", &value); pokeb(VIDEO, offset, value); } fclose(fp); } }
STATIC WORD play_dj(ddt * pddt) { /* play the DJ ... */ if ((pddt->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == DF_MULTLOG) { int i; ddt *pddt2 = getddt(0); for (i = 0; i < blk_dev.dh_name[0]; i++, pddt2++) { if (pddt->ddt_driveno == pddt2->ddt_driveno && (pddt2->ddt_descflags & (DF_MULTLOG | DF_CURLOG)) == (DF_MULTLOG | DF_CURLOG)) break; } if (i == blk_dev.dh_name[0]) { put_string("Error in the DJ mechanism!\n"); /* should not happen! */ } else { xreg dx; dx.b.l = pddt->ddt_logdriveno; dx.b.h = pddt2->ddt_logdriveno; /* call int2f/ax=4a00 */ if (floppy_change(dx.x) != 0xffff) { /* if someone else does not make a nice dialog... */ template_string[DRIVE_POS] = 'A' + pddt2->ddt_logdriveno; put_string(template_string); put_string("Insert"); template_string[DRIVE_POS] = 'A' + pddt->ddt_logdriveno; put_string(template_string + 6); put_string("Press any key to continue ... \n"); fl_readkey(); } pddt2->ddt_descflags &= ~DF_CURLOG; pddt->ddt_descflags |= DF_CURLOG; pokeb(0, 0x504, pddt->ddt_logdriveno); } return M_CHANGED; } return M_NOT_CHANGED; }
void main() { unsigned seg,desplaza; char prueba[10]; int i; printf ("Antes de ejecutar este programa, desactive la tecla CAPS\n"); printf ("Oprima una tecla...\n"); getch(); seg = 0x0040; desplaza = 0x0017; pokeb (seg, desplaza, 0x40); printf ("Escriba una cadena de caracteres\n"); prueba [0] = 8; cgets (prueba); printf ("\n"); printf ("%s\n",prueba+2); getch(); }
void warmboot(void) { pokeb(0x0000,0x0472,0x1234); int86(0x19,&RATregs,&RATregs); }
void coldboot(void) { pokeb(0x0000,0x0472,0x0000); int86(0x19,&RATregs,&RATregs); }
void interrupt handle_24 (unsigned bp, unsigned di, unsigned si, unsigned ds, unsigned es, unsigned dx, unsigned cx, unsigned bx, unsigned ax) { int err,key,ret=-1; int r,c,start; err = di & 0x00FF; /* Error message, from DOS. */ /* Save section of screen that will be overwritten */ for (r=8; r<17; r++) { start = (160 * r + 54); for (c=0; c<26; c++) { screen_buf[r-8][c*2] = peekb(scr, start++); screen_buf[r-8][c*2+1] = peekb(scr, start++); } } /* Pop up error message */ fastprintz( 8,27,0x07,"������������������������ķ"); fastprintz( 9,27,0x07,"�Error! �"); fastprintz(10,27,0x07,"� �"); /* Common diagnosable problems */ switch(err) { case 0x00: fastprintz(11,27,0x07,"�Disk is write protected.�"); break; case 0x02: fastprintz(11,27,0x07,"�Disk drive is not ready.�"); break; default: fastprintz(11,17,0x07,"�Disk error. �"); break; } fastprintz(12,27,0x07,"� �"); fastprintz(13,27,0x07,"� Try again �"); fastprintz(13,29,0x0f,"T"); fastprintz(14,27,0x07,"� Exit this program �"); fastprintz(14,29,0x0f,"E"); /* In DOS 3.00 and later, they can also fail the disk access */ if (_osmajor > 2) { fastprintz(15,27,0x07,"� Cancel this operation �"); fastprintz(15,29,0x0f,"C"); } else fastprintz(15,27,0x07,"� �"); fastprintz(16,27,0x07,"������������������������Ľ"); /* Call BIOS to get a single keystroke from the user */ do { key=getbioskey(); if (key & 0x00FF) key &= 0x00FF; switch(key) { case 't': case 'T': ret = 0x0001; break; case 'e': case 'E': ret = 0x0002; break; case 'c': case 'C': if (_osmajor > 2) ret = 0x0003; break; default: break; } } while (ret < 0); /* Restore that section of the screen */ for (r=8; r<17; r++) { start = (160*r + 54); for (c=0; c<26; c++) { pokeb(scr, start++, screen_buf[r-8][c*2]); pokeb(scr, start++, screen_buf[r-8][c*2+1]); } } ax = ret; /* And please don't tell me I didn't use any of those parameters. */ #pragma warn -par }
int tty_read(struct inode *inode, struct file *file, char *data, int len) { #if 1 register struct tty *tty = determine_tty(inode->i_rdev); register char *pi = 0; int j, k; int rawmode = (tty->termios.c_lflag & ICANON) ? 0 : 1; int blocking = (file->f_flags & O_NONBLOCK) ? 0 : 1; unsigned char ch; if (len != 0) { do { if (tty->ops->read) { tty->ops->read(tty); blocking = 0; } j = chq_getch(&tty->inq, &ch, blocking); if (j == -1) { if (!blocking) break; return -EINTR; } if (!rawmode && (j == 04)) /* CTRL-D */ break; if (rawmode || (j != '\b')) { pokeb(current->t_regs.ds, (__u16) (data + ((int)pi)), ch); ++pi; tty_echo(tty, ch); } else if (((int)pi) > 0) { --pi; k = ((peekb(current->t_regs.ds, (__u16) (data + ((int)pi))) == '\t') ? TAB_SPACES : 1); do { tty_echo(tty, ch); } while (--k); } } while (((int)pi) < len && (rawmode || j != '\n')); } return (int) pi; #else register struct tty *tty = determine_tty(inode->i_rdev); int i = 0, j = 0, k, lch; int rawmode = (tty->termios.c_lflag & ICANON) ? 0 : 1; int blocking = (file->f_flags & O_NONBLOCK) ? 0 : 1; unsigned char ch; if (len == 0) return 0; do { if (tty->ops->read) { tty->ops->read(tty); blocking = 0; } j = chq_getch(&tty->inq, &ch, blocking); if (j == -1) if (blocking) return -EINTR; else break; if (!rawmode && (j == 04)) /* CTRL-D */ break; if (rawmode || (j != '\b')) { pokeb(current->t_regs.ds, (__u16) (data + i++), ch); tty_echo(tty, ch); } else if (i > 0) { lch = ((peekb(current->t_regs.ds, (__u16) (data + --i)) == '\t') ? TAB_SPACES : 1); for (k = 0; k < lch; k++) tty_echo(tty, ch); } } while (i < len && (rawmode || j != '\n')); return i; #endif }
static void vpokeb(uint8_t* address, uint8_t value) { pokeb(VGAGetFramebufferSegment(), address, value); }
void ROMBasic(void) { pokeb(0x0000,0462,0x0000); int86(0x18,&RATregs,&RATregs); }
/* 90.03.31 Modified by A.Shirahashi, support for 'SO' mode line 90.03.28 Created by A.Shirahashi */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include <dos.h> #ifndef __TURBOC__ /* 90.04.06 by S.Yoshida */ #define MK_FP(seg,ofs) ((void far *) \ (((unsigned long)(seg) << 16) | (unsigned)(ofs))) #define poke(a,b,c) (*((int far*)MK_FP((a),(b))) = (int)(c)) #define pokeb(a,b,c) (*((char far*)MK_FP((a),(b))) = (char)(c)) #endif /* __TURBOC__ */ #ifdef PC9801 /* 90.03.30 by S.Yoshida ("#ifdef" line only) */ #define iseuc1st(c) ((c) >= 0xa1 && (c) <= 0xfe) #define etoj(c1, c2) {c1 &= 0x7f; c2 &= 0x7f;} #define VRAM_SEG 0xa000 #define ATTR_SEG 0xa200 #define C_BLUE 0x02 #define C_RED 0x04 #define C_PURPLE 0x06 #define C_GREEN 0x08 #define C_CYAN 0xa0 #define C_YELLOW 0xc0 #define C_WHITE 0xe0 #define A_NORMAL 0x01 #define A_REVERSE 0x05 #define CNONE 0 /* Unknown color. */ #define CTEXT 1 /* Text color. */ #define CMODE 2 /* Mode line color. */ #ifndef TCCONIO extern char *SO; #endif #ifdef HOJO_KANJI #include "kinit.h" /* for TOUFU charactor */ #endif VOID #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ putline(int row, int column, unsigned char *s, unsigned char *t, short color) #else /* not SS_SUPPORT */ putline(int row, int column, unsigned char *s, short color) #endif /* SS_SUPPORT */ { unsigned int dest; unsigned int c1, c2; int attr; dest = 160 * (row - 1); if( color == CTEXT ) { attr = C_WHITE|A_NORMAL; } else if( color == CMODE ) { #ifdef TCCONIO attr = C_WHITE|A_REVERSE; #else switch( atoi(SO+2) ) { case 7: attr = C_WHITE|A_REVERSE; break; case 17: case 31: attr = C_RED|A_NORMAL; break; case 18: case 34: attr = C_BLUE|A_NORMAL; break; case 19: case 35: attr = C_PURPLE|A_NORMAL; break; case 20: case 32: attr = C_GREEN|A_NORMAL; break; case 21: case 33: attr = C_YELLOW|A_NORMAL; break; case 22: case 36: attr = C_CYAN|A_NORMAL; break; case 23: case 37: attr = C_WHITE|A_NORMAL; break; case 41: attr = C_RED|A_REVERSE; break; case 44: attr = C_BLUE|A_REVERSE; break; case 45: attr = C_PURPLE|A_REVERSE; break; case 42: attr = C_GREEN|A_REVERSE; break; case 43: attr = C_YELLOW|A_REVERSE; break; case 46: attr = C_CYAN|A_REVERSE; break; case 47: attr = C_WHITE|A_REVERSE; break; default: attr = C_WHITE|A_REVERSE; break; } #endif } while( *s && dest < 160 * row) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if ( ISHANKANA(*s) ) { pokeb(ATTR_SEG, dest, attr); poke(VRAM_SEG, dest, *t++); ++s; dest += 2; } else #endif /* HANKANA */ #ifdef HOJO_KANJI if ( ISHOJO(*s) ) { pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, TOUFU1ST - 0x20); pokeb(VRAM_SEG, dest++, TOUFU2ND); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, TOUFU1ST - 0x20); pokeb(VRAM_SEG, dest++, TOUFU2ND + 0x80); s += 3; } else #endif if( iseuc1st(*s) ) { c1 = *s++; c2 = *s++; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ t += 2; #endif /* HANKANA */ etoj(c1, c2); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, c1 - 0x20); pokeb(VRAM_SEG, dest++, c2); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, c1 - 0x20); pokeb(VRAM_SEG, dest++, c2 + 0x80); } else { pokeb(ATTR_SEG, dest, attr); #ifdef BACKSLASH if (*s == '\\') { poke(VRAM_SEG, dest, 0xfc); ++s; } else #endif /* BACKSLASH */ poke(VRAM_SEG, dest, *s++); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ ++t; #endif /* HANKANA */ dest += 2; } } }
/* fastprintz - shove an asciz string onto the screen */ void fastprintz(int y, int x, int attr, char *s) { int i=0,base; base = (80*y+x)<<1; /* determine offset into screen */ while (s[i]!=0) { pokeb(scr, base++, s[i++]); pokeb(scr, base++, attr); } }