Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

nasm problem

MI_7MI_7 Member Posts: 36 ✭✭
when i write a program for DOS i can make it bigger then 512 bytes.

But why can't i make programs bigger then 512 bytes when i boot myselve?

I,m making a little os i have booted with my own code.(witch is 512bytes)

but when i make my kernel bigger then 512 bytes it bugs!
(it seems that it can't find the variables or code past the 512 bytes border)

NEED help!

you can email me at: [email protected] or place a message here!

Comments

  • vytzkavytzka Member Posts: 17
    : when i write a program for DOS i can make it bigger then 512 bytes.
    :
    : But why can't i make programs bigger then 512 bytes when i boot myselve?
    :
    : I,m making a little os i have booted with my own code.(witch is 512bytes)
    :
    : but when i make my kernel bigger then 512 bytes it bugs!
    : (it seems that it can't find the variables or code past the 512 bytes border)

    Ok, I'll try to do my best :). At first, boot loader and kernel are different things, and now you are talking about the former. You must write boot loader into the very first sector of the hard drive (or, I hope, you are experimenting with floppy for now :)), because when you turn on the computer, BIOS tries to load THAT sector to memory and execute it. Capacity of that sector is exactly 512 bytes long, and if you get your loader bigger, 513th and all other bytes are written either to the sector nr. 2 or are lost at all, but it doesn't make a difference for us. So they are NOT loaded to memory in boot time. So you must either make the loader smaller, or include a routine to read other sector(s) to memory and execute (via JMP or CALL).
    P.S. Maybe you'd like for me to help a bit with a project? I have not programmed in assembly language for about a year, this could be a good practice. I'm not a proffesional, just an amateur, so don't shout on me after all :)
    Vytzka
  • MI_7MI_7 Member Posts: 36 ✭✭
    : : when i write a program for DOS i can make it bigger then 512 bytes.
    : :
    : : But why can't i make programs bigger then 512 bytes when i boot myselve?
    : :
    : : I,m making a little os i have booted with my own code.(witch is 512bytes)
    : :
    : : but when i make my kernel bigger then 512 bytes it bugs!
    : : (it seems that it can't find the variables or code past the 512 bytes border)
    :
    : Ok, I'll try to do my best :). At first, boot loader and kernel are different things, and now you are talking about the former. You must write boot loader into the very first sector of the hard drive (or, I hope, you are experimenting with floppy for now :)), because when you turn on the computer, BIOS tries to load THAT sector to memory and execute it. Capacity of that sector is exactly 512 bytes long, and if you get your loader bigger, 513th and all other bytes are written either to the sector nr. 2 or are lost at all, but it doesn't make a difference for us. So they are NOT loaded to memory in boot time. So you must either make the loader smaller, or include a routine to read other sector(s) to memory and execute (via JMP or CALL).
    : P.S. Maybe you'd like for me to help a bit with a project? I have not programmed in assembly language for about a year, this could be a good practice. I'm not a proffesional, just an amateur, so don't shout on me after all :)
    : Vytzka
    :

    thx for answering me twice! :P

    I'm not good in asking questions, but i ment: :(
    running a kernel bigger than 512 bytes,
    my bootloader is 512 bytes and loads all the sectors of the kernel into memory and jumps to that position and thereby runs it!, but it bugs on things after 512 bytes. :)

    I'll contact feaster, for you joining/helping us! :)

    I'll contact you for a yes or an now

    Greatings MI-7
  • feasterfeaster Member Posts: 6
    All right.

    I think you can help us a lot if you find the key(code in this way) to programm a kernel wich is bigger then 512 bytes. So now we've got a kernel with 3 parts of 512 kb, but we have a lot of code wich is the same in part 1, 2 and 3. So if we want to change something in part 1 we must change part 2 and 3 even, so there is not an integer way of programming.

    (sorry for my bad Englisch :(, I do only speak bits&bytes :P )
  • vytzkavytzka Member Posts: 17
    : All right.
    :
    : I think you can help us a lot if you find the key(code in this way) to programm a kernel wich is bigger then 512 bytes. So now we've got a kernel with 3 parts of 512 kb, but we have a lot of code wich is the same in part 1, 2 and 3. So if we want to change something in part 1 we must change part 2 and 3 even, so there is not an integer way of programming.
    :
    : (sorry for my bad Englisch :(, I do only speak bits&bytes :P )
    :
    I can program a kernel of any size, I hope :), but your kernel seems a bit strange for me. If I am a part of project, maybe could you mail me the source to [email protected], I swear not to sell it to anyone :). I mean, maybe the problem will become clearer then. Don't worry about your English, I am Lithuanian and English isn't native for me too.
    Vytzka
  • MI_7MI_7 Member Posts: 36 ✭✭
    Whell I have the solution,

    I had to seperate my code in segments,
    like:
    //////////////////////////////////////////////
    [segment .text]
    ...
    procedures and so on....
    and the main program...
    ...
    [segment .data]
    all variables....
    ...
    [segment .bss]
    ;here could I put strings and so on.
    //////////////////////////////////////////////

    so that was the solution.
    (I had to read te nasm manual, YES I'm lazy. :P)

    To vytzka,

    see the other messageboard -> os stuff
  • Justin BibJustin Bib USAMember Posts: 0

    < http://forcoder.org /> free video tutorials and ebooks about ( Visual Basic Scratch C Objective-C JavaScript Java Ruby C# Visual Basic .NET Python R PL/SQL Delphi Swift C++ Go Perl MATLAB Assembly PHP SAS Apex COBOL Dart VBScript Logo Alice FoxPro Fortran Awk ML Erlang Scheme LabVIEW Rust Bash Ada Lisp Hack D Julia Crystal Clojure Kotlin F# ABAP Transact-SQL Prolog Scala Lua ) __

Sign In or Register to comment.