short cut to ... [main] [news] [forum] [download] [Hall of Fame] [game] [cg] [link]

SYSINIT
-------------------------------------------------------------------------------
󤷤SYSINITˤ
-------------------------------------------------------------------------------
  󤷤SYSINITˤ

  offset 0x0118 : (8byte) "TOWNS   " ()
  offset 0x0120 : (dword) ǡ⥸塼ꥹȤΥɥ쥹
  offset 0x0124 : (dword) ǡ⥸塼ΰ賫ϥɥ쥹
  offset 0x0128 : (dword) ĥ̤ΰ賫ϥɥ쥹
                          (ǡ⥸塼ΰ轪λɥ쥹ܣ)

ң;Υǡ⥸塼ˤϥ쥯 0x40 ͳƥǽ


ǡ⥸塼ꥹȤι¤
  offset 0x0000 : (dword) ɤ߹ǡθĿ
  offset 0x0004 : (dword) ɤ߹ǡХȿ
  offset 0x0010         ɤ߹ޤƤƥǡξ(16Хñ)
          +0x00 : (dword)ǡƬɥ쥹
          +0x04 : (4byte)ǡ(4ʸ)
          +0x08 : (dword)ǡ(Хñ)
          +0x0c : (byte) ѥץ
          +0x0e : (word) ƺѥ쥯(̤Ƥʤ 0)


߳ǧǤƤǡ
  "FONT" : 12ɥåȥե
  "ICON" : 24ɥåȥ
  "SKBD" : T-OS V2.1Υեȥܡɥѥ
  "MSGD" : ɥåȷǡ
  "FINF" : եȾǡ
  "CLIP" : ݥåΰ
  "FO20" : 20ɥåīΥե

-------------------------------------------------------------------------------
t_os.lib  mma_allocSeg/mma_freeSeg ǤδΤ
-------------------------------------------------------------------------------

mma_allocSeg 

SYSINIT ǧ

DOS-Extender ĥ funciton  AX=2511h Ѥơ
int 21h / ah=52h (DOSfunction / ƬMCB) ȯ
MCB ˺ǸޤǸơ
MCBƬ + 128h  'TOWN' ȤʸΤΤõƤ롣


ѤƤ뤫ǧ

ǡꥹȤγǡ򸡺롣
+0ch(byte) ɤ߽Фͤ 7fh ʾʤƼԡ

+0ch  0 Ǥʤϡ˲餫ΥץǻѤƤȽ̤
+0eh 饻쥯ͤɡΥ쥯¸ߥӥåȤĴ١
Υ쥯¸ߤС+0ch ͤ򥤥󥯥Ȥ
¸ߤ륻쥯֤ͤƥ롼λ

쥯Υ

 0 쥯롣
θ CR3 쥸򻲾Ȥ쥿 40h Ѥʤ顢
ʥ쥯 40h ʪȣУǤȲƤ
ڡơ֥ڤӥȥǥץľʿ¬ˡ

ܺ٤̤Ĵ

֤ͤ

+0ch ͤ򥤥󥯥ȡ
+0eh ˥쥯ͤꤷơ롼λ


¾ͻ

쥯¿ť󤷤ʤ褦ˤʤäƤ롣
餯ڡơ֥ʤɤ¿ť󤷤ʤ褦ˤʤäƤ
פ롣
ǥץ¸ߤ뤫ǧȤ顢LDT ʣĶ
Ϥޤ LDT ˲줿ʤɤꤷƤȻפ롣
¬ˡڡơ֥뤬˹ۤƤʤɤ
ꤷƤǽ롣



T-BIOS  CoCo Τ褦 RUN386 ˤεǽͿʤäΤ档
ɬפʤȤ󤷤ʤ顩
DOS-Extender ĥȤ鷺ľܥƥ쥸ƤΤ档
ʥڡơ֥뤬­ʤǽͤơ

-------------------------------------------------------------------------------
ե
-------------------------------------------------------------------------------
	mma_allocSeg(char *('NAME'))
	{
		mma_alloc(char *('NAME'),000)
	}


	mma_alloc('NAME', XXX)
	{
		s = _mma_scanDirTbl(*('NAME'), 4, 1)
		if (s==0) return 0;

		;s = 'NAME' ǡ󤬤Ƭݥ󥿡ʥ˥ɥ쥹

		edi = s;
		ebx = [edi + 8]  /* size */
		esi = [edi] & 0fffff000h;  /* data top */
		al  = [edi + 0ch]
		if (al > 7fh) return 0
		if (al != 0) {
			push ebx
			ebx = [edi + 0eh];
			call _mma_getDesc;	/* ASM  */
			eax = bx;
			pop ebx
			if (dl & 80h) goto RET:; /* 쥯¸ߤƤ */
		}
		b [edi +0ch] = 0;
		eax =(ebx >>12);  /* eax = size [/page] */
		if (XXX==0)  call _mma_mapDatsSeg (esi, eax)
			else call _mma_mapCodeSeg (esi, eax)
				/* eax= return */

		/*** __mma_cleanup ***/
		push ebx
		ebx = eax;  /* ebx = selector */
		while (1)
		{
			s = _mma_scanDirTbl(ebx, 0eh, 0);
			if (s) {
				w [eax + 0eh] = 0h
				b [eax + 0ch] = 0h
			} else 	break;
		}
		eax = ebx;
		pop ebx
		[edi + 0eh] = ax;	/* alloc selector */
	RET:
		[edi + 0ch] ++;		/* ѥ? */
		edx = esi /*  */
		ecx = ebx /*  */
	}

	_mma_getDesc(쥸 bx:쥯)
	{
		push ebx;
		ebx = bx;
		ecx = selector_size(bx) +1  /* lsl ecx,bx; ecx++; */
		ecx = ecx >>12; /* page ñ */
		ds  = LDT/GDT 쥯 (bx ͤȽ)
		ebx &= 0fff8h;
		eax = 쥯١եå;
		dx  = 쥯°;
		pop ebx
	}

	_mma_scanDirTbl('NAME', xx0, xx1 )
	{
		if (xx1) *(19eh)=66 else *(19eh)=90
		s = mma_getDirPtr()
		if (s==0) return 0;

		c = *(s)   /* ˥ɥ쥹 word ɤ߽Ф */
		if (c==0) return 0;

		s += 10h;
		s += xx0;
		d  = 'NAME'

		/* ơ֥뤫 'NAME' õ */
		if (found = yes)
		{
			p = 'NAME'Τݥ;
			p &= 0ffff_fff0h;
			return p;
		} else  return 0;
	}

	mma_getDirPtr()
	{
		s = _mma_srch(char *buf)
		if (s==0) return 0;
		return [s + 20h]  << ˥ɥ쥹
	}

	_mma_srch(char *buf)
	{
		buf Ȥä MCB Ƭ (int 21h / ah=52h)
		bx + 22h : UMB? θ
		bx - 2   : MCB θ
			MCBľΥѥ饰դ PSP Ǥ뤳ȤǧƤ
		'TOWN' ȤʸõƤ

		return MCB or 0 (=)
	}
	
	mma_allocCodeAlias( sel )
	{
		int 21h / ax=2513 (make alias)
		return sel  / (Ԥʤ return 0)
	}

	_mma_mapCodeSeg (XX0, XX1)
	_mma_mapDataSeg (XX0, XX1)
	{
		if (_mma_mapCodeSeg) al = 93h  쥯° R/W
		if (_mma_mapDataSeg) al = 9bh  쥯° R/X
		ah = c0h;			ø٥ʤ
		call _mma_mapSeg(XX0, XX1, eax)
	}
	_mma_mapSeg(XX0, XX1, eax)	/* ʴؿϤʤ */
	{
		sel = (int 21h / ah=48h);    礭 0 Υ쥯
		if () return 0 (edx = 顼);

		_mma_page(sel, XX0, XX1, eax);
		if () 쥯 return 0 (edx = sel);

		return sel; ( sel != 0 Ǥ)
	}


	_mma_page(sel, XX0, XX1, ACC)
	{
		ڡơ֥ľˤ롢
		ʪĥĤ
	}