+#include "cdpmi.h"
+#include "inttypes.h"
+
+#ifdef __DJGPP__
+#include <pc.h>
+#include <sys/nearptr.h>
+
+#define SEG_ADDR(s) (((uint32_t)(s) << 4) - __djgpp_base_address)
+
+#define outp(p, v) outportb(p, v)
+#else
+#define SEG_ADDR(s) ((uint32_t)(s) << 4)
+#endif
static struct vbe_info *info;
struct dpmi_real_regs regs;
if(!info) {
/* allocate 32 paragraphs (512 bytes) */
static struct vbe_info *info;
struct dpmi_real_regs regs;
if(!info) {
/* allocate 32 paragraphs (512 bytes) */
- info_block_seg = dpmi_alloc(32);
- info = (struct vbe_info*)(info_block_seg << 4);
+ info_block_seg = dpmi_alloc(32, &info_block_selector);
+ info = (struct vbe_info*)SEG_ADDR(info_block_seg);
static struct vbe_mode_info *mi;
struct dpmi_real_regs regs;
if(!mi) {
/* allocate 16 paragraphs (256 bytes) */
static struct vbe_mode_info *mi;
struct dpmi_real_regs regs;
if(!mi) {
/* allocate 16 paragraphs (256 bytes) */
- mode_info_seg = dpmi_alloc(16);
- mi = (struct vbe_mode_info*)(mode_info_seg << 4);
+ mode_info_seg = dpmi_alloc(16, &mode_info_selector);
+ mi = (struct vbe_mode_info*)SEG_ADDR(mode_info_seg);
regs.ebx = bits << 8; /* bits in bh */
dpmi_real_int(0x10, ®s);
regs.ebx = bits << 8; /* bits in bh */
dpmi_real_int(0x10, ®s);
fprintf(fp, "red bits: %d (mask: %x)\n", (int)mi->rmask_size, get_mask(mi->rmask_size, mi->rpos));
fprintf(fp, "green bits: %d (mask: %x)\n", (int)mi->gmask_size, get_mask(mi->gmask_size, mi->gpos));
fprintf(fp, "blue bits: %d (mask: %x)\n", (int)mi->bmask_size, get_mask(mi->bmask_size, mi->bpos));
fprintf(fp, "red bits: %d (mask: %x)\n", (int)mi->rmask_size, get_mask(mi->rmask_size, mi->rpos));
fprintf(fp, "green bits: %d (mask: %x)\n", (int)mi->gmask_size, get_mask(mi->gmask_size, mi->gpos));
fprintf(fp, "blue bits: %d (mask: %x)\n", (int)mi->bmask_size, get_mask(mi->bmask_size, mi->bpos));