Color? Why not! (2007)
This commit is contained in:
parent
c7d8df0fb9
commit
d671237f78
58
demos/colour.h
Normal file
58
demos/colour.h
Normal file
@ -0,0 +1,58 @@
|
||||
#include <stdio.h>
|
||||
#include <dos.h>
|
||||
|
||||
#define VIDEO 0x10
|
||||
|
||||
#define FG_BLACK 0x00
|
||||
#define FG_BLUE 0x01
|
||||
#define FG_GREEN 0x02
|
||||
#define FG_CYAN 0x03
|
||||
#define FG_RED 0x4
|
||||
#define FG_MAGENTA 0x05
|
||||
#define FG_BROWN 0x06
|
||||
#define FG_GRAY 0x07
|
||||
#define BG_BLACK 0x00
|
||||
#define BG_BLUE 0x10
|
||||
#define BG_GREEN 0x20
|
||||
#define BG_CYAN 0x30
|
||||
#define BG_RED 0x40
|
||||
#define BG_MAGENTA 0x50
|
||||
#define BG_BROWN 0x60
|
||||
#define BG_GRAY 0x70
|
||||
#define Bright 0x08
|
||||
#define Blinking 0x80
|
||||
|
||||
void dcolour(char ch,unsigned char colour)
|
||||
{
|
||||
union REGS regs;
|
||||
int x,y;
|
||||
|
||||
regs.h.ah = 0x03;
|
||||
regs.h.bh = 0x00;
|
||||
int86(VIDEO,®s,®s);
|
||||
y = regs.h.dl;
|
||||
x = regs.h.dh;
|
||||
|
||||
regs.h.ah = 0x09;
|
||||
regs.h.al = ch;
|
||||
regs.h.bh = 0x00;
|
||||
regs.h.bl = colour;
|
||||
regs.x.cx = 1;
|
||||
int86(VIDEO,®s,®s);
|
||||
|
||||
y++;
|
||||
|
||||
regs.h.ah = 0x02;
|
||||
regs.h.bh = 0x00;
|
||||
regs.h.dh = x;
|
||||
regs.h.dl = y;
|
||||
int86(VIDEO,®s,®s);
|
||||
}
|
||||
void dscolour(char *string,unsigned char colour)
|
||||
{
|
||||
while(*string)
|
||||
{
|
||||
dcolour(*string,colour);
|
||||
string++;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user