Taking an Assembly Course, Stuck in DOS!
I'm taking a course on Microprocessor Programming as part of my Electronic Engineering degree. Unfortunately, in the labs, we have to work in DOS using MASM.
Now, I don't really find DOS a hindrance, but I just don't have it on a computer at home (and none of the computers that I have have floppy开发者_C百科 drives), so I am unable to practice writing programs. I have tried under Windows, but it just doesn't assemble (I am guessing this is because of Protected Mode).
Any advice on what should I do? Should I just learn to program in Protected Mode? Will that help me with the course? The course is focused on the 8086.
Perhaps a virtual machine could help? If so, where can I get DOS and MASM for it?
FreeDOS is another option, and running it in virtualbox
http://www.freedos.org/
BTW, Free DOS can also be booted from a CD. I think you can even install it on a thumb drive if so inclined.
I would suggest using a virtual machine such as the free VirtualBox, or qemu, an x86 (+ others) emulator. I would suggest using MS-DOS as the guest OS, as my previous attempts at trying some basic assembly under FreeDOS under VirtualBox were unreliable.
MASM v8 is available for download from Microsoft - but I don't remember if that includes a 16-bit assembler or not. Also read Randall Hyde's blurb on MASM. The Art of Assembly website is a go-to spot for learning assembly. Of course Wikipedia has a comparison of assemblers. You'll want one that is MASM compatible and runs under DOS (i.e. 16-bit).
Added Note: Older versions of MS-Windows prior to Windows XP included MS-DOS, including Windows 95 and 98. If you have or can find an old copy on CD, otherwise people will likely give the CD freely if they have one - ask friends, local computer stores, family, and you should be able to install them in a virtual machine with little or no effort.
I would look into running Sun's VirtualBox (Free) to run a DOS VM on any platform (Windows, Mac, Linux, ...)
I used this emulator bochs while back together with free dos is pretty good if you just need basic dos
A virtual machine would do. I'm pretty sure DOS is freely available on MSDNAA if your academic institution provides access to it. If you're using Windows, I suggest using the Microsoft Virtual PC for DOS VMs. While I personally prefer VMware as a VM host, for DOS specifically, Virtual PC seems to be doing a better job at emulation.
If you type COMMMAND
instead of CMD
from the Start menu and select run you will be in DOS.
Inline::ASM - Write Perl Subroutines in assembler.
SYNOPSIS
print "9 + 16 = ", add(9, 16), "\n";
print "9 - 16 = ", subtract(9, 16), "\n";
use Inline ASM => 'DATA',
AS => 'as',
PROTO => {add => 'int(int,int)'};
use Inline ASM => 'DATA',
AS => 'nasm',
ASFLAGS => '-f elf',
PROTO => {subtract => 'int(int,int)'};
__END__
__ASM__
.text
.globl add
add: movl 4(%esp),%eax
addl 8(%esp),%eax
ret
__ASM__
GLOBAL subtract
SECTION .text
subtract: mov eax,[esp+4]
sub eax,[esp+8]
ret
VMWare would do. Just find the DOS image(.iso or floppy) and install it on the VMWare. You can do whatever you want with it without any harm to your host machine. You can even play with int13 interrupt if you want ;). Oh I miss the time when I did the "resident"applications hooking interrupt subroutines under DOS on my i386 :)
Good Luck and have fun with asm.
精彩评论