home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- /* dostv - (C) Copyright ムンパッパ (MHB02550)
- * Ver. 1.0 1990/5/27
- * Ver. 1.1 1990/5/31
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation.
- */
- #include <dos.h>
-
- #define MAXBLK 32
-
- main(argc, argv)
- int argc;
- char *argv[];
- {
- static short on_tbl[MAXBLK] ={
- 0x86, 0x610, 0, 0, 0x71b, 0x6, 0xc, 0x12,
- 0x20c, 0x1a4, 0x6c9, 0x1a4, 0x6c9, 0x54, 0x20a, 0x54,
- 0x20a, 0, 0x1a4, 0x50, 0xa0, 0, 0x1a4, 0x80,
- 0x100, 0x64, 0x7, 0x101, 0x401f, 0xc, 0xb, 0x1ca};
- /* ful=3 */
-
- static short off_tbl[MAXBLK] ={
- 0x40, 0x320, 0, 0, 0x35f, 0, 0x10, 0,
- 0x36f, 0x9c, 0x31c, 0x9c, 0x31c, 0x40, 0x360, 0x40,
- 0x360, 0, 0x9c, 0, 0x50, 0, 0x9c, 0,
- 0x80, 0x4a, 0x1, 0, 0x3f, 0x3, 0x0, 0x150};
-
- register int i, argcnt;
- int bright;
- static int off_flg = 0;
- static int priority = 5;
- static int ctr = 0x15;
- static short *table = on_tbl;
-
- for (argcnt = 1; argc >= 2; --argc, ++argcnt) {
- if ((!strcmp(argv[argcnt],"off"))||(!strcmp(argv[argcnt],"OFF"))) {
- off_flg = 1;
- table = off_tbl;
- }
- else if ((!strcmp(argv[argcnt],"ful"))||(!strcmp(argv[argcnt],"FUL"))) {
- on_tbl[30] = 3; /* フルト-ン */
- }
- else if ((!strcmp(argv[argcnt],"high"))||(!strcmp(argv[argcnt],"HIGH"))) {
- priority &= 0xfb; /* 高輝度 */
- }
- else if ((!strcmp(argv[argcnt],"dos"))||(!strcmp(argv[argcnt],"DOS"))) {
- priority |= 0x8; /* ス-パ-インポ-ズOFF */
- on_tbl[28] &= 0xbf; /* 内部同期 */
- }
- else if ((!strcmp(argv[argcnt],"video"))||(!strcmp(argv[argcnt],"VIDEO"))) {
- ctr = 0x10; /* DISPLAY OFF */
- }
- else {
- fprintf(stderr,"USAGE: %s [options]\n", argv[0]);
- fprintf(stderr,"option\n");
- fprintf(stderr," off : TVを切る\n");
- fprintf(stderr," ful : フルト-ン(デフォルトはハ-フト-ン)\n");
- fprintf(stderr," high : 高輝度(デフォルトは低輝度)\n");
- fprintf(stderr," dos : MS-DOS出力のみ(デフォルトはス-パ-インポ-ズ)\n");
- fprintf(stderr," video : ビデオ出力のみ(デフォルトはス-パ-インポ-ズ)\n");
- exit(1);
- }
- }
- outportb(0x440, (unsigned char)28);
- outport(0x442, 0x3f);
- while (inport(0x442) & 0x8000) ; /* 表示終了まで待つ */
-
- for (i = 0; i < MAXBLK; ++i) {
- outportb(0x440, (unsigned char)i);
- outport(0x442, table[i]);
- }
- if (off_flg) {
- outportb(0x448, (unsigned char)0);
- outportb(0x44a, 0x15);
- outportb(0x448, (unsigned char)1);
- outportb(0x44a, 8);
- outportb(0xfda0, 0xf);
- outportb(0x440, (unsigned char)28);
- outport(0x442, 0x803f); /* ビデオ スタ-ト */
- /* 電子ボリュ-ム */
- outportb(0x04e1, 0x0); /* LINE 左 OFF */
- outportb(0x04e1, 0x1); /* LINE 右 OFF */
- outportb(0x04e0, 0x0); /* ボリュ-ム MIN */
- }
- else {
- outportb(0x448, (unsigned char)0);
- outportb(0x44a, ctr);
- outportb(0x448, (unsigned char)1);
- outportb(0x44a, priority);
- outportb(0xfda0, 0xf);
- outportb(0x440, (unsigned char)28);
- outport(0x442, on_tbl[28] | 0x8000); /* ビデオ スタ-ト */
-
- /* 電子ボリュ-ム */
-
- outportb(0x04e1, 0x04); /* LINE 左 ON */
- outportb(0x04e1, 0x05); /* LINE 右 ON */
- outportb(0x04e0, 0x3f); /* ボリュ-ム MAX */
- }
- }
-