||Polychronopoulos, Spring 2000|
|Assigned||Thursday, March 23, 2000|
|Purpose||Protected Mode, Video Mode Graphics, Networking, Mouse|
|Checkpoint Due Date||Tuesday April 4 5:00pm|
|Final Due Date||Tuesday April 11 5:00pm (April 4, 5:00pm for 5 point bonus)|
Having made your way through the previous four Machine Problems, and the exam, you've shown yourself to be a true ECE 291 student. Now you can almost see the carrot dangling out there, just this double-MP, a final project, and two exams away.
So we're stepping up the difficulty - and the rewards are commensurate. Have you ever looked at what we're doing in assembly and wondered how something like Quake is possible? The sheer size alone is daunting - how can you fit that in 64k? You can't. How about a few segments, like you started using in MP3? Nope - still too big.
Hey wait! What about the fact that text mode is obviously not up to the task of representing a 3D world, much less a complex 2D world?
Enter Protected Mode (often referred to as P-Mode), a powerful way of gaining access to as much memory as the computer has to offer. With this power comes some limitations, and differences. Right off the bat you'll have to adjust to writing for NASM instead of MASM. Here's a quick reference on the surface differences between the two. Similarly, you are welcome to read through the entire MP tutorial. For more about the development environment (and how to install it at home), see this page from the tutorial.
Be sure to read carefully through the preliminary procedure as some things have changed from previous MPs. This includes the build process, as you'll be using tools that are much more like Unix tools (make and gcc) than the Microsoft Unix-ish tools you've been using in past MPs.
To help make the transition to protected mode easier, a large library has been provided to you. The documentation for all the library functions is online, and even the entire source code is available in the MP's lib/ directory! Please notice that all functions the library provides and all the functions you will be writing for this MP conform to the C calling convention. This means the arguments are passed on the stack in reverse order, you are free to modify (without saving) eax, ebx, ecx, and edx (this also means that you should not expect these registers to be preserved when calling a library function), and the return value is in eax/ax/al (depending on its size). A few macros have been provided to make coding C procedures easier. Also, a very large library, written in assembly and with source, has been given to you to make coding some parts of this MP much easier. The source can be found in the lib/ directory of the MP, and the Library Reference is available online to help you find the functions you need.
Also remember that you now have full usage of the entire Intel instruction set, including all 32-bit registers and extended addressing modes. This means that you are free to address with any register, and even have an index register multiplied by a power of two, e.g.: mov eax, [edx+ecx*4+5]. You can use this to your definite advantage when you need to multiply by 3, 5, or 9: just look up the LEA instruction and think about the advanced addressing modes. Don't forget that you can't access the high 16 bits of the 32 bit registers directly, you either need to clear, shift, or load out of memory to set those bits. Feel free to look at the library source code for ideas and examples of how to use the extended registers and addressing modes!
The final three things that enter into play here are graphics, mouse control, and networking. The first two are amazingly easy to use, both conceptually and otherwise. There is a library for the third, but its use can seem a little obtuse. Time to move on to the Problem Description pages, and then start programming.