Browsed by
Category: My Projects

My Projects

MSNTV2 Hardware & Architecture

MSNTV2 Hardware & Architecture

Here’s what phpSysInfo has to say:

Processors  	1
Model 	Mobile Intel(R) Celeron(TM) CPU 733MHz
CPU Speed 	731.08 Mhz
Cache Size 	256.00 KB
System Bogomips 	1445.88
PCI Devices 	
-	Ethernet controller: Intel Corporation 82801DB PRO/100 VE
-	Host bridge: Intel Corporation 82830 830 Chipset Host Bridge
-	IDE interface: Intel Corporation 82801DB
-	ISA bridge: Intel Corporation 82801DB/DBL
-	Modem: Intel Corporation 82801DB/DBL/DBM
-	Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM
-	PCI bridge: Intel Corporation 82801 PCI Bridge
-	SMBus: Intel Corporation 82801DB/DBL/DBM
-	(3x) USB Controller: Intel Corporation 82801DB/DBL/DBM
-	USB Controller: Intel Corporation 82801DB/DBM
-	VGA compatible controller: Intel Corporation 82830 CGC [Chipset Graphics Controller]
IDE Devices 	
-	hda: SanDisk SDCFB-64 (Capacity: 61.25 MB)
-	hdc: WDC WD1600JB-00GVC0 (Capacity: 149.05 GB)
SCSI Devices 	none
USB Devices 	none

Here’s the dump of /proc/cpuinfo:

$ cat cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 11
model name      : Mobile Intel(R) Celeron(TM) CPU          733MHz
stepping        : 4
cpu MHz         : 731.087
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 mtrr pge mca cmov pat pse36 mmx fxsr sse
bogomips        : 1445.88

An explaination of what the flags are is available here: IntelĀ® 64 and IA-32 Architectures Software Developer’s Manuals in Volume 2: Instruction Set Reference, specifically pages

3-172

to

3-176

of Volume 2A: Instruction Set Reference

Here is the output of lspci on an MSNTV2:

$ lspci -tvv
-[00]-+-00.0  Intel Corporation 82830 830 Chipset Host Bridge
      +-02.0  Intel Corporation 82830 CGC [Chipset Graphics Controller]
      +-1d.0  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1
      +-1d.1  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2
      +-1d.2  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3
      +-1d.7  Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller
      +-1e.0-[01]----08.0  Intel Corporation 82801DB PRO/100 VE (CNR) Ethernet Controller
      +-1f.0  Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge
      +-1f.1  Intel Corporation 82801DB (ICH4) IDE Controller
      +-1f.3  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller
      +-1f.5  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller
      \-1f.6  Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controller

Here’s the dump of /proc/ioports:

$ cat /proc/ioports
0000-001f : dma1
0020-0021 : pic1
0040-0043 : timer0
0050-0053 : timer1
0060-006f : keyboard
0070-0077 : rtc
0080-008f : dma page reg
00a0-00a1 : pic2
00c0-00df : dma2
00f0-00ff : fpu
0170-0177 : ide1
01f0-01f7 : ide0
02f8-02ff : serial
0376-0376 : ide1
03c0-03df : ega
03f6-03f6 : ide0
03f8-03ff : serial
0500-053f : 0000:00:1f.0
0cf8-0cff : PCI conf1
1000-107f : 0000:00:1f.0
8000-801f : 0000:00:1d.0
8020-803f : 0000:00:1d.1
8040-805f : 0000:00:1d.2
9000-903f : 0000:01:08.0
  9000-903f : e100
a020-a02f : 0000:00:1f.1
a040-a05f : 0000:00:1f.3
a100-a1ff : 0000:00:1f.5
a200-a23f : 0000:00:1f.5
a300-a3ff : 0000:00:1f.6
a400-a47f : 0000:00:1f.6

Here’s the dump of /proc/interrupts:

$ cat /proc/interrupts
           CPU0
  0:   32149675          XT-PIC  timer
  2:          0          XT-PIC  cascade
  4:        169          XT-PIC  serial
  5:    6825495          XT-PIC  eth0
  8:          2          XT-PIC  rtc
 14:         87          XT-PIC  ide0
 15:   14329233          XT-PIC  ide1
NMI:          0
LOC:          0
ERR:          0
MIS:          0

Update:

Probing for `SMSC 47M15x/192 Super IO Fan Sensors'
Success... found at address 0x0800

It looks like the fan controller is an SMSC 47M1, meaning you can control and monitor fan speed using programs such as lm-sensors. Here is the doc file for the SMSC 47M1.

Mod: Wizzes can’t be killed

Mod: Wizzes can’t be killed

Add this block of code to the beginning of varargs int eventDie(mixed agent) in /lib/player.c.


int mhp, msp, mmp;
string *limb_arr = ({});

if(!agent) agent = previous_object();
if(!agent) agent = this_object();

if(wizardp(agent)) {
mhp = agent->GetMaxHealthPoints();
msp = agent->GetMaxStaminaPoints();
mmp = agent->GetMaxMagicPoints();
agent->AddHP(mhp);
agent->AddStaminaPoints(msp);
agent->AddMagicPoints(mmp);
if(agent->GetPoison() > 0) agent->AddPoison(0 - agent->GetPoison());
limb_arr = agent->GetLimbs();
foreach(string limb in limb_arr) {
agent->HealLimb(limb);
}
return 1;
}

This code is formed such that when a wizard should die, they are instead healed and restored to full health, stamina, and magic.

This code falls under the Dead Souls license.

No Zapping Arch Wizzes

No Zapping Arch Wizzes

Here’s how to prevent zapping of arch wizards:

In /verbs/creators/zap.c, change:


if(!living(ob)) {
write("You can only zap living things.");
return 1;
}
else name = ob->GetName();

to


if(!living(ob)) {
write("You can only zap living things.");
return 1;
} else if (archp(ob)) {
write("You can't zap an Arch!");
return 1;
} else name = ob->GetName();

Dead Souls 2.3a1 Wordy Exit Code

Dead Souls 2.3a1 Wordy Exit Code

This is my update to the /lib/exits.c, /lib/std/room.c and /lib/interactive.c to allow for worded exits in verbose mode, and the usual short exits in brief mode.

Examples:

  • Verbose:
    • Creators’ Hall
    • Immortals come here to communicate with each other about the world they are building. The Adventurer’s Guild is north. The Arch Room is south. To visit the Dead Souls test and development mud, go west. The test lab facilities are east.
    • There are five obvious exits: west, north, east, south, and up.
  • Brief:
    • Creators’ Hall [n, s, e, w, u]

This code includes my HideExit Modifications:nod:

As usual, please see the license at Dead Souls.net, this code is not GPL.

Update: Moved one block of code in GenerateVerboseExits() in room.c to allow you to HideExit() enters. (Example: HideExit(“enter office”); )

Update 2: Fixed a problem with grammar by adding (Example: “desc” : “gate leading”) to the SetSide Mapping. If there is no “desc”, it will show “door” in the verbose exits. This was needed to be able to colorize the door based on its open/closed status. Added a modified door.c and door.h for this purpose.

Dead Souls HideExit code

Dead Souls HideExit code

This is my update to the /lib/exits.c and /lib/std/room.c to make obvious exits easier to use and worth with. It adds the following:

  • a sub-mapping to the Exits mapping in exits.c to include ([ “obv” : 0 or 1 ]).
  • HideExit(dir), which hides the given exit (and should be used in your room code to hide exits)
  • GetObvMap(), which returns a mapping of direction and hidden [Example where south is hidden by HideExit(“south”): ([ “west” : 1, “north” : 1, “east” : 1, “south” : 0 ]) ].

Room Exits default to Obvious, so there is no need to set them. The old SetObviousExits and its related functions are still included and valid for compatibility purposes.

I will be releasing another version of this code for use with muds who want more than the [n, s, e, w, u] exit list.

:thumbsup:

Insert this code into /lib/exits.c:

//Use this to get whether or not an exit is obvious.
int GetExitObv( string str ) {
    if( !Exits[str] ) return 0;
    else return Exits[str]["obv"];
}

//Use this or GetFullExitData to get a mapping of obvious or not, to use for visible/invisible doors in std/room.c
mapping GetObvMap() {
    mapping ret = ([]);
    foreach(string key in keys(Exits)){
	ret[key] = Exits[key]["obv"];
    }

    return ret;
}

//Use this to hide an exit
int HideExit( string dir ) {
	  return Exits[dir]["obv"] = 0;
}

Replace the existing GenerateObviousExits() in /lib/std/room.c with this:

 int GenerateObviousExits(){
    string *normals;
    string *exits;
    string dir_string, enters;
    mapping obv;

    exits = GetExits();
    obv = GetObvMap();

    enters = "";
    normals = ({ "north", "south", "east", "west", "up", "down" });
    normals += ({ "northeast", "southeast", "northwest", "southwest" });
    normals += ({ "out" });
    dir_string = "";

    if(sizeof(GetEnters(1)-({0}))){
			foreach(string enter in this_object()->GetEnters(1)){
			    if (obv["enter "+enter] == 1) {
				    enters += "enter "+enter;
				    if(member_array(enter,this_object()->GetEnters(1)) !=
				     sizeof(this_object()->GetEnters(1)) -1) {
							  enters +=", ";
				    }
			    }
			}
    }

    if(member_array("north",exits) != -1 && obv["north"] == 1) dir_string += "n, ";
    if(member_array("south",exits) != -1 && obv["south"] == 1) dir_string += "s, ";
    if(member_array("east",exits) != -1 && obv["east"] == 1) dir_string += "e, ";
    if(member_array("west",exits) != -1 && obv["west"] == 1) dir_string += "w, ";
    if(member_array("northeast",exits) != -1 && obv["northeast"] == 1) dir_string += "ne, ";
    if(member_array("northwest",exits) != -1 && obv["northwest"] == 1) dir_string += "nw, ";
    if(member_array("southeast",exits) != -1 && obv["southeast"] == 1) dir_string += "se, ";
    if(member_array("southwest",exits) != -1 && obv["southwest"] == 1) dir_string += "sw, ";
    if(member_array("up",exits) != -1 && obv["up"] == 1) dir_string += "u, ";
    if(member_array("down",exits) != -1 && obv["down"] == 1) dir_string += "d, ";
    if(member_array("out",exits) != -1 && obv["out"] == 1) dir_string += "out, ";

    if(sizeof(this_object()->GetEnters(1) - ({0}) )) {
			if(sizeof(this_object()->GetExits())) dir_string += ", ";
			dir_string += enters;
    }

    if(last(dir_string,2) == ", ") dir_string = truncate(dir_string,2);
    dir_string = replace_string(dir_string,", , ",", ");
    if(ObviousVisible) SetObviousExits(dir_string);
    return 1;
}
MSNTV2 Boot Tutorial

MSNTV2 Boot Tutorial

Well, it’s 3AM, but I got my first MSNTV2 server running using linux kernel 2.6.12.5, so here’s a writeup on how it’s done.

This is provided with no guarantee of accuracy or completeness

This tutorial assumes the following:

  • You will be installing a hard drive into the MSNTV2 box via an IDE cable.
    • (The process for a USB drive is similar, with the exception that you must compile the kernel as such to be able to boot from USB, and you must append rootwait=10 to the CMDLINE file)
  • You have soldered an IDE header onto the MSNTV2 motherboard
  • You have already patched the BIOS of the MSNTV2 (See “Getting into the service menu” and “Flashing the patch” on the Toc2rta Wiki
  • You already have a CompactFlash card prepared as detailed in the Toc2rta Wiki, with:
    • a CMDLINE file (root=/dev/hdc3 init=/sbin/init console=ttyS0,115200)
    • BIOS.BIN (You’ll have to search Google for it)
    • (We will be compiling the VMLINUX.BIN in this tutorial)
  • You are currently using the hard drive you wish to install into the MSNTV2. It currently has:

Note: The CompactFlash card is known as /dev/hda to the MSNTV2 box. Once the drive is installed into the MSNTV2, it will be known as /dev/hdc (If the drive has no jumpers present) or /dev/hdd (If jumpered as ‘slave’).

For those trying to compile it for themselves, and for myself for later reference:

  1. Download linux-2.6.12.5.tar.gz
  2. Move linux-2.6.12.5.tar.gz to /usr/src/ (mv linux-2.6.12.5.tar.gz /usr/src)
  3. Change directories to /usr/src/ (cd /usr/src)
  4. Extract linux-2.6.12.5.tar.gz into /usr/src/ (tar -xvf linux-2.6.12.5.tar.gz)
  5. Add the .config file:
    1. Download the attachment to this article
    2. Change directories to where the attachment was downloaded (Example: cd ~/Desktop/)
    3. Copy it to the /usr/src/linux-2.6.12.5/ folder and rename it to .config (cp msntv2-config-2.6.12.5 /usr/src/linux-2.6.12.5/.config)
  6. Make the kernel and modules:
    1. Change directories to /usr/src/linux-2.6.12.5 (cd /usr/src/linux-2.6.12.5)
    2. Make sure the source code has no temporary files, etc (make clean)
    3. Build the Kernel (make)
      1. If you are prompted whether or not to include an item that was not included in the .config, just press Enter, and it will select the default recommended setting.
    4. Install the modules (make modules_install)
  7. Copy the vmlinux.bin to the first partition of your CF card.
    1. Mount your CF card if not already done. Note: Many GUIs will do this for you. The mounted path and device may vary. (Example: mount /dev/sda1 /media/sda1)
    2. Copy the vmlinux.bin from /usr/src/linux-2.6.12.5/arch/i386/boot/compressed/vmlinux.bin to the first partition of your CF card. (Example, assuming a USB card reader mounted to /media/sda1: cp /usr/src/linux-2.6.12.5/arch/i386/boot/compressed/vmlinux.bin /media/sda1/) 
  8. Edit your /etc/fstab file: (See attachments for an example of a modified fstab)
    1. Change any references of /dev/hda to /dev/hdc
    2. Remove or comment out any /dev/cdrom entry
    3. [Experimental, for me at least] Add an entry for the first partition of the CompactFlash (/dev/hda1 none vfat defaults 0 0)
  9. Install this hard drive onto the MSNTV2 using an EIDE ribbon cable.

Picture of my current setup:

2×16 Character LCD Display

2×16 Character LCD Display

Built with the PC Starter Kit (“LCD Kit 04”) from the good folks at 411 Technology Systems, it is mounted in a computer case spacer to be mounted in a computer.

You can buy LCDs along with the PC Starter Kit, which includes the parallel port kit and a CD with schematics, code, and other plans and goodies on it (“AN-CD-01”).

You can either purchase from their eBay Store or their Web Store (LCDs | Kits & Other Stuff)

And, they pack everything in baggies, and LCDs are put into ESD bags, and shipped in boxes so things don’t get dropped, crushed, smushed, etc. And yes, I’ve bought from them again and again, and I highly recommend them for LCD stuff.