X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fdos%2Fvbe.c;h=3ada182faa32171e2dd97f2e0225c043b2aba781;hp=f4fabdf55094beffd0e0293704655f5c2fe88dd5;hb=102f82ec5a8128cb076371aa3d9821e684b94380;hpb=57348c2e13f4de9e49f8428b9fec3f47f863a257 diff --git a/src/dos/vbe.c b/src/dos/vbe.c index f4fabdf..3ada182 100644 --- a/src/dos/vbe.c +++ b/src/dos/vbe.c @@ -16,7 +16,7 @@ } else { \ paddr = ((uint32_t)pseg << 4) + poffs; \ } \ - (ptr) = (void*)paddr; \ + (ptr) = (void*)phys_to_virt(paddr); \ } while(0) /* hijack the "VESA" sig field, to pre-cache number of modes */ @@ -40,7 +40,7 @@ int vbe_info(struct vbe_info *info) if(!(seg = dpmi_alloc(sizeof *info / 16, &sel))) { return -1; } - lowbuf = (void*)((uint32_t)seg << 4); + lowbuf = (void*)phys_to_virt((uint32_t)seg << 4); memcpy(lowbuf, "VBE2", 4); @@ -107,7 +107,7 @@ int vbe_mode_info(int mode, struct vbe_mode_info *minf) if(!(seg = dpmi_alloc(sizeof *minf / 16, &sel))) { return -1; } - lowbuf = (void*)((uint32_t)seg << 4); + lowbuf = (void*)phys_to_virt((uint32_t)seg << 4); regs.eax = 0x4f01; regs.ecx = mode; @@ -222,6 +222,8 @@ int vbe_setmode(uint16_t mode) if((regs.eax & 0xffff) != 0x4f) { return -1; } + + cur_pitch = vbe_getpitch(); return 0; } @@ -236,7 +238,7 @@ int vbe_setmode_crtc(uint16_t mode, struct vbe_crtc_info *crtc) if(!(seg = dpmi_alloc((sizeof *crtc + 15) / 16, &sel))) { return -1; } - lowbuf = (void*)((uint32_t)seg << 4); + lowbuf = (void*)phys_to_virt((uint32_t)seg << 4); memcpy(lowbuf, crtc, sizeof *crtc); @@ -250,6 +252,8 @@ int vbe_setmode_crtc(uint16_t mode, struct vbe_crtc_info *crtc) if((regs.eax & 0xffff) != 0x4f) { return -1; } + + cur_pitch = vbe_getpitch(); return 0; } @@ -289,7 +293,7 @@ int vbe_save(void *stbuf, int sz, unsigned int flags) if(!(seg = dpmi_alloc((sz + 15) / 16, &sel))) { return -1; } - lowbuf = (void*)((uint32_t)seg << 4); + lowbuf = (void*)phys_to_virt((uint32_t)seg << 4); regs.eax = 0x4f04; regs.edx = 1; /* save */ @@ -315,7 +319,7 @@ int vbe_restore(void *stbuf, int sz, unsigned int flags) if(!(seg = dpmi_alloc((sz + 15) / 16, &sel))) { return -1; } - lowbuf = (void*)((uint32_t)seg << 4); + lowbuf = (void*)phys_to_virt((uint32_t)seg << 4); memcpy(lowbuf, stbuf, sz); @@ -378,6 +382,7 @@ int vbe_setscanlen(int len_pix) return -1; } + cur_pitch = vbe_getpitch(); return regs.ecx; } @@ -432,8 +437,8 @@ enum { SDISP_GET = 0x01, SDISP_ALTSET = 0x02, SDISP_SET_STEREO = 0x03, - SDISP_GETSCHED = 0x04, - SDISP_STEREO_ON = 0x05, + SDISP_GETSCHED = 0x04, + SDISP_STEREO_ON = 0x05, SDISP_STEREO_OFF = 0x06, SDISP_SET_VBLANK = 0x80, SDISP_ALTSET_VBLANK = 0x82,