rayzor
annotate src/dpmi.c @ 17:79609d482762
the renderer renders, also fixed an unnoticed matrix conversion problem between scenegraph and min3d
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 14 Apr 2014 07:34:45 +0300 |
parents | |
children |
rev | line source |
---|---|
nuclear@0 | 1 #include "dpmi.h" |
nuclear@0 | 2 |
nuclear@0 | 3 void dpmi_real_int(int inum, struct dpmi_real_regs *regs) |
nuclear@0 | 4 { |
nuclear@0 | 5 unsigned char int_num = (unsigned char)inum; |
nuclear@0 | 6 __asm { |
nuclear@0 | 7 mov eax, 0x300 |
nuclear@0 | 8 mov edi, regs |
nuclear@0 | 9 mov bl, int_num |
nuclear@0 | 10 mov bh, 0 |
nuclear@0 | 11 xor ecx, ecx |
nuclear@0 | 12 int 0x31 |
nuclear@0 | 13 } |
nuclear@0 | 14 } |
nuclear@0 | 15 |
nuclear@0 | 16 void *dpmi_mmap(uint32_t phys_addr, unsigned int size) |
nuclear@0 | 17 { |
nuclear@0 | 18 uint16_t mem_high, mem_low; |
nuclear@0 | 19 uint16_t phys_high = phys_addr >> 16; |
nuclear@0 | 20 uint16_t phys_low = phys_addr & 0xffff; |
nuclear@0 | 21 uint16_t size_high = size >> 16; |
nuclear@0 | 22 uint16_t size_low = size & 0xffff; |
nuclear@0 | 23 unsigned int err, res = 0; |
nuclear@0 | 24 |
nuclear@0 | 25 __asm { |
nuclear@0 | 26 mov eax, 0x800 |
nuclear@0 | 27 mov bx, phys_high |
nuclear@0 | 28 mov cx, phys_low |
nuclear@0 | 29 mov si, size_high |
nuclear@0 | 30 mov di, size_low |
nuclear@0 | 31 int 0x31 |
nuclear@0 | 32 add res, 1 |
nuclear@0 | 33 mov err, eax |
nuclear@0 | 34 mov mem_high, bx |
nuclear@0 | 35 mov mem_low, cx |
nuclear@0 | 36 } |
nuclear@0 | 37 |
nuclear@0 | 38 if(res == 2) { |
nuclear@0 | 39 return 0; |
nuclear@0 | 40 } |
nuclear@0 | 41 return (void*)(((uint32_t)mem_high << 16) | ((uint32_t)mem_low)); |
nuclear@0 | 42 } |
nuclear@0 | 43 |
nuclear@0 | 44 void dpmi_munmap(void *addr) |
nuclear@0 | 45 { |
nuclear@0 | 46 uint16_t mem_high = (uint32_t)addr >> 16; |
nuclear@0 | 47 uint16_t mem_low = (uint16_t)addr; |
nuclear@0 | 48 |
nuclear@0 | 49 __asm { |
nuclear@0 | 50 mov eax, 0x801 |
nuclear@0 | 51 mov bx, mem_high |
nuclear@0 | 52 mov cx, mem_low |
nuclear@0 | 53 int 0x31 |
nuclear@0 | 54 } |
nuclear@0 | 55 } |