News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Please help a total newbie.

Started by starsarecrossed, April 16, 2009, 10:45:26 PM

Previous topic - Next topic

starsarecrossed

Hi!

I'm not really sure if this the right place where to ask this, but I am new to programming (assembling). I know only a few things such like how the counting is done (all thought, I have serious problems with math...), some registers and something about interrupts, but I'm not a keen on what, how and when, exactly to put in register. What I'm trying to do is to write my own boot loader/bootstrap, but I'm not sure how to write the code, it's a start of operating system, yes, but I do not need all the stuff about kernel (at least I guess), if I want only to make my own boot loader. And what's done if I want this to be done through USB... Is there any source for a nut like I am?

My goal is to make the screen goes black, then white, then the text appears and that's about it.
Thank for any kind of advices on this one, and please don't laugh at me. Maybe this is too much for a newbie...

FORTRANS

Hi,

   See the alt.os.development usenet group, use Google Groups if
you don't have a news provider.  Search for terms you need help
with and use its FAQ.  Or just browse the postings.  Fun, if a bit
thick at times.

   I would start by writing DOS programs in the COM format to do
the actions that you plan to see your boot loader do, using only
BIOS functions.  That should give you a skeleton to convert into
a OS independent version.  And let you work out stack requirements,
video modes, and the like.

HTH,

Steve N.

SteveCurtis

Quote from: starsarecrossed on April 16, 2009, 10:45:26 PM
Hi!

I'm not really sure if this the right place where to ask this, but I am new to programming (assembling). I know only a few things such like how the counting is done (all thought, I have serious problems with math...), some registers and something about interrupts, but I'm not a keen on what, how and when, exactly to put in register. What I'm trying to do is to write my own boot loader/bootstrap, but I'm not sure how to write the code, it's a start of operating system, yes, but I do not need all the stuff about kernel (at least I guess), if I want only to make my own boot loader. And what's done if I want this to be done through USB... Is there any source for a nut like I am?

My goal is to make the screen goes black, then white, then the text appears and that's about it.
Thank for any kind of advices on this one, and please don't laugh at me. Maybe this is too much for a newbie...

Don't worry- No Laughing.

What I did was to buy a book on assembler for the PC. I have bought several, but the best so far was 'Assembly Language Step by Step' by Jeff Duntemenn.

Now this book starts out by assuming you know 'nothing about computers innards' and proceeds from there. The steps you are talking about where you want to boot up from a boot up loader is commendable and it is good to know what goes on under the hood. However I would defer that until you have more basic stuff out of the way. There is a useful Protected Mode tutorial by 'Alexei A. Frounze' that goes into quite some detail regarding the boot up process in 16 bit 'Real Mode' and then makes the jump to 32 bit 'Protected mode' (where Windows NT type OS's run) But I think you will  not gain much of use to you until you can deal with more common ideas regarding the internal structure of the CPU and memory organisation in particular. Buy the Duntemann book and read it page by page, doing the excersizes he sets. Then start on your quest for a boot loader perhaps.

But really you need to practcise with a C compiler and look at the assembler it produces too. There are some simple and standard ways of controlling loops and switch statements for example you can plagiarise and also how to call functions and procedures that you can template in assembler taking hints from the way a compiler does it. You can then write C compatible assembler modules and include these in your C code.

There you will learn about register usage in function calling conventions for example, but from what you say, it is the basic use of regsiters that you need to usnderstand. Registers are halfway 'scratch pad' areas that the CPU uses to operate on before the values are put back into memory. They are that of course --and-- MUCH-MUCH more, so you will become implictly more expert with register usage as you write more assembler. Practice and familiarity is the ONLY answer here!

It is ALWAYS useful to understand the grains of sand, but you really should probaly shelve this until you can navigate in C (for my preference) and look down into the detail from a height, rather than being confused at the lowest levels, There are just too many confusing details that don't have labels attached, saying which is important to know and which is for later etc.

Download TurboC versions 1,2 or 3 from Borland (it's free) and the NASM-IDE to edit 16 bit assembler and NASM asembler plus the ALINK linker itself to do both 16 and 32bit assembler. When and if you want to migrate to 32bit though, MY suggestion is you should download the MASM32 environment from this forum site. It however is highly geared to the Windows NT,2000,XP type operating systems and wraps OS calls in macros that make them easy to use and document. There are many other links here on the forum too that integrate assembler with OS functionality and a RAD like environment that are quite VB like excepot the underlying language is in assembler, not Visual Basic. Using MASM32 you can create windows based applications entirely from assembler and code stubs that call the OS functions to create complex windows and any dialog or button or visual component you like to name that is supported by the OS.  I hope that give you an outline for your possible trajectory, but seriously -- buy the Duntemann book as a start I think.

To boot from a USB is no particular problem, you just need a USB boot capable motherboard, but that is the LEAST of your concerns.  It is principles first, (the machanism is not really a primary concern at the beginning) about program control and flow. Then you need to understand how these thing happen, so you can know what questions to ask. And then I would go for it with Alexie Frounze tutorials and you will get the goal quickly. In fact, if you go straight to the tutorials he offers and run them, you will get what you want straight away, but  you will not have learned anything.

Regards,
Steve