Subversion Repositories SvarDOS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
28 mv_fox 1
/*
2
 * Video routines used by the Svarog386 installer
3
 * Copyright (C) 2016 Mateusz Viste
4
 *
5
 * All video routines output data directly to VRAM, and they all do that
6
 * to both B8000:0000 and B0000:0000 areas simulteanously, for compatibility
7
 * with all possible video adapters in all possible modes.
8
 */
9
 
10
#include <dos.h>
11
#include "video.h" /* include self for control */
12
 
13
/* pointers to VGA/MDA screens */
14
static unsigned short far *vga = (unsigned short far *)0xB8000000L;
15
static unsigned short far *mda = (unsigned short far *)0xB0000000L;
16
 
17
void video_clear(unsigned short attr, int offset) {
18
  int x;
19
  for (x = offset; x < 2000; x++) {
20
    vga[x] = attr;
21
    mda[x] = attr;
22
  }
23
}
24
 
25
void video_putchar(int y, int x, unsigned short attr, int c) {
26
  int offset = (y << 6) + (y << 4) + x;
27
  vga[offset] = attr | c;
28
  mda[offset] = attr | c;
29
}
30
 
31
void video_putcharmulti(int y, int x, unsigned short attr, int c, int repeat, int step) {
32
  int offset = (y << 6) + (y << 4) + x;
33
  while (repeat-- > 0) {
34
    vga[offset] = attr | c;
35
    mda[offset] = attr | c;
36
    offset += step;
37
  }
38
}
39
 
40
void video_putstring(int y, int x, unsigned short attr, char *s) {
41
  x += (y << 6) + (y << 4); /* I use x as an offset now */
42
  while (*s != 0) {
43
    unsigned short b = attr | *s;
44
    vga[x] = b;
45
    mda[x] = b;
46
    x++;
47
    s++;
48
  }
49
}
50
 
51
void video_putstringfix(int y, int x, unsigned short attr, char *s, int w) {
52
  x += (y << 6) + (y << 4); /* I use x as an offset now */
53
  while (w-- > 0) {
54
    unsigned short b;
55
    b = attr | *s;
56
    if (*s != 0) s++;
57
    vga[x] = b;
58
    mda[x] = b;
59
    x++;
60
  }
61
}
62
 
63
void video_movecursor(int y, int x) {
64
  union REGS r;
65
  r.h.ah = 2;
66
  r.h.bh = 0;
67
  r.h.dh = y;
68
  r.h.dl = x;
69
  int86(0x10, &r, &r);
70
}