HW1: Boot Blocks
CS 321 Homework,
Dr. Lawlor, 2006/01/20. Due Monday, Jan 30.
Here's a series of problems regarding the x86 "boot block" or "boot
sector". You're expected to turn in the result of each problem to
Blackboard, by clicking on "Assignments", "View/Complete Assignment",
attaching your files, and clicking "Submit" (be careful! "Save"
isn't the same as "Submit"!).
Download all the input files for this assignment: (Directory, Zip, Tar-gzip)
- Download the x86 PC boot block problem1.bin
and run it. You can do this on a real PC by copying the boot
block to a floppy disk (in UNIX, just do "dd if=problem1.bin
of=/dev/fd0"). But I recommend using the QEMU emulator,
where you'd just run "qemu problem1.bin". This boot block will
print out four characters and then stop. Turn in the four
characters in a text file named "problem1.txt". (Yes, this
problem sounds really easy--you've just got to run an existing boot
block! But you've got to get QEMU running, and figure out how to
use it--that's worth a few points.)
- Friday update: QEMU is annoying to run directly on Windows--
it's not in your PATH, so you've got to pass the absolute path
to the executable, *and* it can't find the PC BIOS image, so you
have to pass "-L" and the path to the bios/ subdirectory.
I've written a little Windows-specific qemu.bat file
that directly calls QEMU with the proper arguments. You can drag-and-drop
an image like problem1.bin onto qemu.bat, and it should run. Be aware the
script assumes you've installed QEMU in the standard "C:/Program Files/qemu",
so you'll have to tweak the script if you've installed it elsewhere.
This is my bad--I should have tested out QEMU on Windows more thoroughly.
- Download the x86 assembly source file problem2.s and the assembler NASM.
Compile the source file into a boot block with "nasm -f bin problem2.s
-o problem2.bin". Run it like before. Initially, this
source file will print out the four characters "Nope". Change the
source file so it prints out the same four characters as problem 1, and
turn in your modified "problem2.s".
- Download the x86 assembly source file problem3.s
and run as usual. Change the
source file so it continuously echos the characters you type in
(alphanumeric only; don't worry about special characters). Also
make the 'r' key reboot the machine--but note that QEMU reboots so fast
you might not even see it! Turn in your modified "problem3.s".
Half your homework grade is to complete any five open-ended problems
(miniprojects) throughout the semester. I'll try to offer at
least one open-ended problem with each week's homework. If you
complete more than five open-ended problems through the semester, I'll take the five with the highest grades.
Turn in open-ended problems by naming the source code "problem.s" and
submitting it on blackboard as HW1_O. HW1_O is due Monday,
February 6 at 5pm.
- Write any reasonably interesting interactive game in the
boot block. (e.g., character-based pong, brickles, maze, or a 2-person
tank battle). Reasonably interesting means it runs and responds
to input, not that you could sell it for $39.95.
- In the boot block, change the screen to VGA graphics mode
and display something reasonably interesting. Heck, a gradient
fill is reasonably interesting. Random garbage or a black screen
is not interesting.