vbeinfo
annotate src/dpmi.c @ 4:d2c44edd8b77
print the framebuffer address
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 07 Jan 2019 13:52:58 +0200 |
parents | 4b33fa83e381 |
children |
rev | line source |
---|---|
nuclear@3 | 1 #ifdef __WATCOMC__ |
nuclear@0 | 2 #include "dpmi.h" |
nuclear@0 | 3 |
nuclear@0 | 4 void dpmi_real_int(int inum, struct dpmi_real_regs *regs) |
nuclear@0 | 5 { |
nuclear@0 | 6 unsigned char int_num = (unsigned char)inum; |
nuclear@0 | 7 __asm { |
nuclear@0 | 8 mov eax, 0x300 |
nuclear@0 | 9 mov edi, regs |
nuclear@0 | 10 mov bl, int_num |
nuclear@0 | 11 mov bh, 0 |
nuclear@0 | 12 xor ecx, ecx |
nuclear@0 | 13 int 0x31 |
nuclear@0 | 14 } |
nuclear@0 | 15 } |
nuclear@0 | 16 |
nuclear@0 | 17 void *dpmi_mmap(uint32_t phys_addr, unsigned int size) |
nuclear@0 | 18 { |
nuclear@0 | 19 uint16_t mem_high, mem_low; |
nuclear@0 | 20 uint16_t phys_high = phys_addr >> 16; |
nuclear@0 | 21 uint16_t phys_low = phys_addr & 0xffff; |
nuclear@0 | 22 uint16_t size_high = size >> 16; |
nuclear@0 | 23 uint16_t size_low = size & 0xffff; |
nuclear@0 | 24 unsigned int err, res = 0; |
nuclear@0 | 25 |
nuclear@0 | 26 __asm { |
nuclear@0 | 27 mov eax, 0x800 |
nuclear@0 | 28 mov bx, phys_high |
nuclear@0 | 29 mov cx, phys_low |
nuclear@0 | 30 mov si, size_high |
nuclear@0 | 31 mov di, size_low |
nuclear@0 | 32 int 0x31 |
nuclear@0 | 33 add res, 1 |
nuclear@0 | 34 mov err, eax |
nuclear@0 | 35 mov mem_high, bx |
nuclear@0 | 36 mov mem_low, cx |
nuclear@0 | 37 } |
nuclear@0 | 38 |
nuclear@0 | 39 if(res == 2) { |
nuclear@0 | 40 return 0; |
nuclear@0 | 41 } |
nuclear@0 | 42 return (void*)(((uint32_t)mem_high << 16) | ((uint32_t)mem_low)); |
nuclear@0 | 43 } |
nuclear@0 | 44 |
nuclear@0 | 45 void dpmi_munmap(void *addr) |
nuclear@0 | 46 { |
nuclear@0 | 47 uint16_t mem_high = (uint32_t)addr >> 16; |
nuclear@0 | 48 uint16_t mem_low = (uint16_t)addr; |
nuclear@0 | 49 |
nuclear@0 | 50 __asm { |
nuclear@0 | 51 mov eax, 0x801 |
nuclear@0 | 52 mov bx, mem_high |
nuclear@0 | 53 mov cx, mem_low |
nuclear@0 | 54 int 0x31 |
nuclear@0 | 55 } |
nuclear@0 | 56 } |
nuclear@3 | 57 #else |
nuclear@3 | 58 int stop_gcc_crying_about_empty_translation_units = 0; |
nuclear@3 | 59 #endif /* __WATCOM__ */ |