⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example2.c

📁 XLIB 2.0版 32位应用程序开发 ASM/C语言的DOS 扩展库
💻 C
字号:
#include <stdio.h>
#include <xlib.h>
#define som _emit 0x66               /* switch operand mode */
#define sam _emit 0x67               /* switch address mode */
long __far getextmem(long address);

int goterr = 0;                      /* error flag */

main()
{
  long l;
  l = INITXLIB();                    /* initialize XLIB */
  if(l != 0)
  {
    printf("Library initialization error:  %lX",l);
    return 0;
  }
  l = getextmem(0x100000);           /* read first address in 2ond meg */
  if(goterr != 0)
  {
    printf("Inline mode-switch error:  %lX",l);
    return 0;
  }
  printf("%lX\n",l);
}

long __far getextmem(long address)
{
  __asm
  {
    som                             ;mov  eax,[bp+6]
    mov       ax,[bp+6]             ;  ""
    call      INLINEPM
    jc        error                 ;Error code in ax
    mov       ds,es:FLATDSEL
    sam                             ;push dword ptr [eax]
    som                             ;  ""
    _emit     0ffh                  ;  ""
    _emit     030h                  ;  ""
    pop       ax
    pop       dx
    call      es:INLINERMPTR
    jmp       done
error:
    xor       dx,dx                 ;Return error code in dx:ax
    inc       goterr
done:
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -