init_mem.c
来自「上课老师给的8086仿真器」· C语言 代码 · 共 36 行
C
36 行
/***********************************************************************/
/* This file is part of the C51 Compiler package */
/* Copyright KEIL ELEKTRONIK GmbH 1993 */
/***********************************************************************/
/* */
/* INIT_MEM.C: */
/* */
/* To translate this file use C51 with the following invocation: */
/* */
/* C51 INIT_MEM.C <memory model> */
/* */
/* To link the modified INIT_MEM.OBJ file to your application use the */
/* following L51 invocation: */
/* */
/* L51 <your object file list>, INIT_MEM.OBJ <controls> */
/* */
/***********************************************************************/
struct mem {
struct mem xdata *next;
struct mem xdata *prev;
unsigned int len;
unsigned char mem[1];
};
struct mem xdata *__mp__;
void init_mempool (struct mem xdata *p, unsigned int size) {
if (!p) { p = (void xdata *) p + 1; size--; }
__mp__ = p;
p->next = ((void xdata *) p) + size - (sizeof (struct mem) - 1);
p->next->next = (void xdata *) 0;
p->prev = (void xdata *) 0;
p->len = 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?