Assembler
Assembler
I normally run OpenBSD, and I like it as a development platform. It has NASM in it's port collection. How should I decide what assembler to use? Can I write/assemble my code on OpenBSD or should I use DOS? It shouldn't be dependant on the OS it's written on since it's going to be a standalone OS, right?
RE:Assembler
No replies? Hmm, maybe I should try to make my question more clear? Please excuse me, I'm new to forums and such.
RE:Assembler
That's OK, we all have to learn from our mistakes like that. In this case, it's simply a matter of time; fora like this one are more like AbuseNet newsgroups than chat relays, in that they are not in real time. On a relatively small and sparse (that is, having few posters in any one time zone) it can take several hours (or even a day or two) for a response to come in. The advantage is that the posters have time to formulate detailed answers, and threads can continue for weeks or even months.
Now, regarding your question: yes, there should be no problem using NASM under OpenBSD to do your system coding; in fact, it should make for an excellent development platform. This should be no surprise; after all, OpenBSD is it's own home development platform.
For working with NASM, the most important things will be assembling to raw binary, and copying your boot block to a floppy disk. The command lines for both of these should be the same on all Unix type platforms:
nasm bootblk.asm -f bin -o bootblk -l bootblk.lst
dd if=bootblk of=/dev/fd0 count=1
with the appropriate changes of file and device name. Copying later sections of your OS will require the addition of suitable 'oseek=' statements, as well, but by the time you'll need that you should be more than sufficiently familiar with it to work it out on your own. Also, while the listing option for nasm is not strictly necessary, it *is* a very good idea.
Given the familial resemblance between Unices, most of the advice given on this message board to Linux users should work identically or with some slight changes on OpenBSD. The most important OS development tool which you may want to use that could be a problem is Bochs; while a generic Unix/X11 source distro is available for it, there's no port specifically for OpenBSD, and it may require a bit of hand-tweaking to get it to work. See the Bochs homepage (http://bochs.sourceforge.net/) for details and advice.
Now, regarding your question: yes, there should be no problem using NASM under OpenBSD to do your system coding; in fact, it should make for an excellent development platform. This should be no surprise; after all, OpenBSD is it's own home development platform.
For working with NASM, the most important things will be assembling to raw binary, and copying your boot block to a floppy disk. The command lines for both of these should be the same on all Unix type platforms:
nasm bootblk.asm -f bin -o bootblk -l bootblk.lst
dd if=bootblk of=/dev/fd0 count=1
with the appropriate changes of file and device name. Copying later sections of your OS will require the addition of suitable 'oseek=' statements, as well, but by the time you'll need that you should be more than sufficiently familiar with it to work it out on your own. Also, while the listing option for nasm is not strictly necessary, it *is* a very good idea.
Given the familial resemblance between Unices, most of the advice given on this message board to Linux users should work identically or with some slight changes on OpenBSD. The most important OS development tool which you may want to use that could be a problem is Bochs; while a generic Unix/X11 source distro is available for it, there's no port specifically for OpenBSD, and it may require a bit of hand-tweaking to get it to work. See the Bochs homepage (http://bochs.sourceforge.net/) for details and advice.
RE:Assembler
Thank you for your very helpful and informative post! I'm ordering some written material on operating systems today. I already know some asm, but it would help a lot if I could freshen up a bit. Any *NIX specific tutorials on nasm? Also, I don't understand why I want Bochs? I want to write everything on my OS from scratch - that's what you people do, right? I'm planning to write it in asm only.
RE:Assembler
well, if you want to write standalone OS, so why do you need *NIX specification for nasm? it runs same on every OS.
if you dont want to reboot your computer after some code changes use software x86 emulator, it is a program that simulates another computer, so you dont need to do reboot, write your OS on diskette/hdd. please, go on bochs homesite and read some stuff about it.
greetz
if you dont want to reboot your computer after some code changes use software x86 emulator, it is a program that simulates another computer, so you dont need to do reboot, write your OS on diskette/hdd. please, go on bochs homesite and read some stuff about it.
greetz
RE:Assembler
Most of the books and tutorials I've seen for assembly language have been aimed at DOS users; those written for Unix programmers usually provide examples in as, which uses the AT&T standard syntax; while it is more or less universal now elsewhere, it is rather rarely used in the x86 world. NASM uses the more familiar (to x86 programmers) Intel syntax, which is substantially diferent.
There is one book you may look into though, one I've recommended repeatedly on this forum: _Assembly Language Step by Step_ by Jeff Duntemann. While it, too, uses DOS for the bulk of it's examples, it does give several chapters on *Linux* assembly; hoever, at the assembly language level, Linux and OpenBSD are quite different. Still, it should be close enough that it will serve you needs.
Also, unique among published books, it uses NASM as development platform, and NASM is fairly close to universal on x86 systems. If your goal is cross-development of a new OS, then the differences between Unices are of little importance - after all, your code will be running in a vaccuum, so to speak. NASM behaves pretty much the same on all platforms.
For your last question, well, Bochs is actually a very useful program, *particularly* for developing new operating systems. It is a software x86 emulator: it allows you to run your system code on a simulated PC and test it's behavior directly and safely on your development platform, without stopping. While it is no substitute for a true testbed machine (you do *not* want to use your development workstation as a 'live' testbed for your OS, trust me on this!), it can speed up the testing and development process considerably, and save you all sorts of headaches. A very useful tool, indeed.
There is one book you may look into though, one I've recommended repeatedly on this forum: _Assembly Language Step by Step_ by Jeff Duntemann. While it, too, uses DOS for the bulk of it's examples, it does give several chapters on *Linux* assembly; hoever, at the assembly language level, Linux and OpenBSD are quite different. Still, it should be close enough that it will serve you needs.
Also, unique among published books, it uses NASM as development platform, and NASM is fairly close to universal on x86 systems. If your goal is cross-development of a new OS, then the differences between Unices are of little importance - after all, your code will be running in a vaccuum, so to speak. NASM behaves pretty much the same on all platforms.
For your last question, well, Bochs is actually a very useful program, *particularly* for developing new operating systems. It is a software x86 emulator: it allows you to run your system code on a simulated PC and test it's behavior directly and safely on your development platform, without stopping. While it is no substitute for a true testbed machine (you do *not* want to use your development workstation as a 'live' testbed for your OS, trust me on this!), it can speed up the testing and development process considerably, and save you all sorts of headaches. A very useful tool, indeed.
RE:Assembler
try using NASM on linux...along with DD (thats an essentiality)
...ive laways used it
...ive laways used it