From d671237f78219af73e2e86331b2eae42dd7d5868 Mon Sep 17 00:00:00 2001 From: kougyokugentou <41278462+kougyokugentou@users.noreply.github.com> Date: Sun, 24 Oct 2021 16:14:17 -0700 Subject: [PATCH] Color? Why not! (2007) --- demos/colour.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 demos/colour.h diff --git a/demos/colour.h b/demos/colour.h new file mode 100644 index 0000000..9339714 --- /dev/null +++ b/demos/colour.h @@ -0,0 +1,58 @@ +#include +#include + +#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++; + } +}