Taking an Assembly Course, Stuck in DOS!
Asked Answered
F

8

8

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 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?

Franciscafranciscan answered 8/2, 2010 at 20:36 Comment(2)
To get a bit of feeling for assembly language it's better to focus on 8086. 80386 and beyond (Pentium etc.) require much more knowledge about memory management and mainly use larger sized registers (32 or 64 bit instead of 8 or 16-bit). There are plenty of emulators (see answers below) available.Adamski
@Roalt: That advice is ridiculous, simplicity alone should not mean throwing away pragmatic knowledge. The ax bx cx dx 16 bit registers are all included in 386+, and nobody is forced to be in protected mode. A modern x86 processor in 16-bit realmode, is simple enough. You start with the basics, and slowly integrate in the additional features.Sosthina
W
8

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.

Welltodo answered 8/2, 2010 at 20:40 Comment(1)
I wonder how DosBox would fare... it's geared towards running old DOS games, but I know I've gotten it to run some really old GW-BASIC programs that I wrote way back in '93 and '94!Hardihood
G
5

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.

Giagiacamo answered 8/2, 2010 at 20:51 Comment(0)
B
3

I would look into running Sun's VirtualBox (Free) to run a DOS VM on any platform (Windows, Mac, Linux, ...)

Begrime answered 8/2, 2010 at 20:39 Comment(0)
C
2

I used this emulator bochs while back together with free dos is pretty good if you just need basic dos

Cannula answered 8/2, 2010 at 20:44 Comment(1)
qemu has generally replaced bochs, it also has mature virtualization support.Sosthina
S
1

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.

Stormi answered 8/2, 2010 at 20:39 Comment(4)
I haven't really tried FreeDOS and can't say anything about the compatibility. I highly doubt it to be 100% compatible with all the bugs MS-DOS had. 100% compatibility with any software is next to unachievable.Stormi
FreeDOS is exceptionally compatible. I wouldn't expect very many people to find differences that caused actual problems.Quantitative
If that's the case, it should work too. Getting access to the actual MSDOS shouldn't be very hard either. Regardless, VM is the way to go. NTVDM is definitely not.Stormi
Generally I've been able to run everything in FreeDOS, without much issues. MSDOS does contain idiosyncrasies, and might be problematic if someone coded for them specifically. So if you follow 'sane' coding practices, you should be fine.Sosthina
P
0

If you type COMMMAND instead of CMD from the Start menu and select run you will be in DOS.

Paxwax answered 8/2, 2010 at 20:39 Comment(7)
Use these links and you'll get tips on how to get started. website.masm32.com and microsoft.com/downloads/…Paxwax
Interesting. How compatible is that with old software? Like.. tetris for example?Salt
I strongly recommend against doing this for the purpose of learning. There are plenty of quirks in running in virtual 8086 mode that may mislead a learner esp. at the assembly language level--and it's not available on x64 anyway.Stormi
I agree with Mahrdad Afshari, this does not provide a 16-bit environment, and masm32 is for a 32-bit (Protected Mode) environment, which is very dissimilar from Saad's instruction at school.Giagiacamo
If you're running 64 Bit Windows 7 you could download Windows XP mode which would allow you to do it. I'm not against a VM, but if he must then Sun VirtualBox with FreeDos would be my choice. freedos.orgPaxwax
I thought COMMAND and CMD were synonymous once you got to XP. I'm also not sure how well he's going to be able to poke at actual registers that are part of windows protected mode memory or direct disk writes. You can do a lot more in actual "DOS" than you can in windows itself. I'd go with a FreeDOS in a VM for less "Trouble". I'd hate to see him debugging a problem related to windows protecting the OS.Welltodo
They are not. COMMAND is the Windows 16 bit emulator and CMD is the Windows XP Command Shell. It doesn't matter wheter you are in either as you never have access to the direct hardware (except in some rare cases with signed drivers) in any Windows greater than Windows Me as the Kernel abstracts that from you.Paxwax
A
0

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
Aronarondel answered 8/2, 2010 at 20:44 Comment(0)
L
0

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.

Lusatian answered 8/2, 2010 at 21:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.