示例#1
0
文件: peekdd.c 项目: CivilPol/sdcboot
peekdd(word segm, word ofs, word *hi, word *lo)
{ 	word h, l, res;

	res = !!(h = peekw(segm, ofs + 2));
	if((l = peekw(segm, ofs)) != 0)
		res |= 2;
	if(hi) *hi = h;
	if(lo) *lo = l;
	return res;
}
示例#2
0
文件: get1mcb.c 项目: FDOS/freecom
word GetFirstMCB(void)
{	USEREGS

	_AH = 0x52;
	geninterrupt(0x21);
	return peekw(_ES, _BX - 2);
}
示例#3
0
文件: task.c 项目: ruisleipa/rmmtos
unsigned int task_get_register(struct Task* task, unsigned int reg)
{
	unsigned int value;

	peekw(task->segment, task->user_sp + reg, &value);

	return value;
}
示例#4
0
word nxtMCB(word mcb)
{	DBG_ENTER("nxtMCB", Suppl_mcb)
	DBG_ARGUMENTS( ("MCB=%u", mcb) )
	assert(mcb);

	DBG_RETURN_BI( peekb(mcb, 0) == 'M'
		? MCB2SEG(mcb) + peekw(mcb, MCB_OFF_SIZE)
		: 0)
}
示例#5
0
文件: o_modes.c 项目: TijmenW/FreeDOS
void oGetScreenDimensions(void)
{	int mode;
	USEREGS

	/* if the current output device is a device & stdout -->
		use the BIOS video to acquire the screen dimensions from */
	if(oConsole()) {
		_AH = 0xf;				/* Get active mode & page */
		geninterrupt(0x10);
		mode = _AL;
		oPage = _BH;			/* destroys AX */
		switch(mode) {
		case 0: case 1: case 4: case 5:
			oColMax = 40;
			oRowMax = 25;
			break;
		case 2: case 3: case 6: case 7:
			oColMax = 80;
			oRowMax = 25;
			break;
		default:
			oRowMax = oColMax = 0;
			break;
		}
		if((biosequip() & 0x30) == 0) {
			/* Assume VGA card */
			oRowMax = oColMax = 0;
		}
		if(!oRowMax)
			oRowMax = peekw(0x40, 0x84) + 1;
		if(!oColMax)
			oColMax = peekw(0x40, 0x4a);
	} else {			/* file output */
		oRowMax = 0;	/* unlimited */
		oColMax = 80;
		oPage = -1;
	}
	dprintf(("[OUT: page: %d, columns: %d, rows: %d]\n"
	 , oPage, oColMax, oRowMax));
}
示例#6
0
static int scan (void * arg, word segm, word ofs) {
        Context_Tag tag;
	ctxt_info_t *info;

        (void)arg;
	assert(segm);
	assert(ofs != (word)-1);

redo:
	if((tag = peekb(segm, ofs), ctxtIsInfoTag(tag))) {
		info = &CTXT_INFO_STRUCT(tag);
		if(peekb(segm, ofs + 1) == '=' && peekb(segm, ofs + 4) == 0) {
			/* status entry */
			info->c_sizemax = peekw(segm, ofs + 2) & ~0x8001;
		} else {		/* normal entry */
			char far *p = MK_FP(segm, ofs + 1);
			unsigned num;

			for(num = 0; isxdigit(*p); ++p) {
				num <<= 8;
				if(isdigit(*p))
					num |= *p & 0xf;
				else {
					assert(islower(*p));
					num |= *p - 'a' + 10;
				}
			}
			if(*p == '=') {
				info->c_sizecur += env_varlen(segm, ofs);
				if(num < info->c_nummin)
					info->c_nummin = num;
				if(num > info->c_nummax)
					info->c_nummax = num;
			} else {
				/* Invalid entry -> remove to make room for useful stuff */
				env_subVarOffset(segm, ofs);
				goto redo;
			}
		}
	} else if(tag > ' ') {			/* Alias */
		CTXT_INFO(CTXT_TAG_ALIAS, sizecur) += env_varlen(segm ,ofs);
	}

	return 0;		/* proceed */
}
示例#7
0
文件: lp.c 项目: lithoxs/elks
void lp_init(void)
{
    register struct lp_info *lp = &ports[0];
    register char *ip;
    int count = 0;

#ifdef BIOS_PORTS

    /* only ports 0, 1, 2 and 3 may exist according to RB's intlist */
    for (ip = 0; ((int)ip) < LP_PORTS; ip++) {
	/* 8 is offset for LPT info, 2 bytes for each entry */
	lp->io = (char *)peekw(0x40, (__u16) (2 * ((int)ip) + 8));
	/* returns 0 if port wasn't detected by BIOS at bootup */
	if (!lp->io)
	    break;		/* there can be no more ports */
	printk("lp%d at 0x%x, using polling driver\n", (int)ip, lp->io);
	lp->flags = LP_EXIST;
	lp++;
    }
    count = (int)ip;

#else

    /* probe for ports */
    for (ip = 0; ((int)ip) < LP_PORTS; ip++) {
	if (!lp_probe(lp)) {
	    printk("lp%d at 0x%x, using polling driver\n", (int)ip, lp->io);
	    port_order[count] = (int)ip;
	    count++;
	}
	lp++;
    }

#endif

    if (count == 0)
	printk("lp: no ports found\n");

    /* register device */
    if (register_chrdev(LP_MAJOR, LP_DEVICE_NAME, &lp_fops))
	printk("lp: unable to register\n");
}
示例#8
0
word mcb_owner(word mcb)
{	word mcb1;

	DBG_ENTER("mcb_owner", Suppl_mcb)
	DBG_ARGUMENTS( ("mcb=%u", mcb) )

	/* A PSP can be identified that the MCB has stored itself as the
		owner process. In some circumstances the "owner" field does
		not mention a process, but some other memory block allocated
		by a process. This loop resolves this situation and correctly
		returns a MCB of a PSP.

		Unused and system MCBs force this function to return with
		value "0" (zero) meaning "no owner found".
	*/
	do if((mcb1 = mcb) <= 0x40) {
		DBG_RETURN_I( 0)
	} while((mcb = peekw(mcb, MCB_OFF_OWNER)) != 0
	 && (mcb = SEG2MCB(mcb)) != mcb1);

	DBG_RETURN_I( mcb)
}
示例#9
0
pr(erequistes): 
va(lue): 0: is no shell
	\item else: is a shell
re(lated to): isMCB isPSP isEnv
se(condary subsystems): 
bu(gs): 
co(mpilers): 

*/

#include "initsupl.loc"

#ifndef _MICROC_
#include <dos.h>
#endif
#include <portable.h>
#include "mcb.h"

#include "suppldbg.h"

#ifdef RCS_Version
static char const rcsid[] = 
	"$Id: mcb_shel.c 1210 2006-06-17 03:25:06Z blairdude $";
#endif

int isShell(const word mcb)
{	DBG_ENTER("isShell", Suppl_mcb)
	DBG_ARGUMENTS( ("mcb=%u", mcb) )
	DBG_RETURN_BI( isPSP(mcb) && peekw(mcb, 0x16 + SEG_OFFSET) == MCB2SEG(mcb))
}
示例#10
0
文件: process.c 项目: Mellvik/elks
unsigned get_ustack(register struct task_struct *t,int off)
{
    return peekw(t->t_regs.ss, t->t_regs.sp+off);
}