Os programmering

hello alle programmer out there
im quite new in assembler, and i have not programmede in other languages before , (exept web programmering).
Now i plays with os programmering, and i have read some tutorials (and i can say the best is mt2002's).
But now when i have made a code, and maked sure that it dont have a error, i try to start it up (it is supose to write a ascii sign on the screen). but it just dosen't do. Then i tryede with the code with the oem block , and that work.
How can that be ???


KMT
«13

Comments

  • : hello alle programmer out there
    : im quite new in assembler, and i have not programmede in other
    : languages before , (exept web programmering).
    : Now i plays with os programmering, and i have read some tutorials
    : (and i can say the best is mt2002's).
    : But now when i have made a code, and maked sure that it dont have a
    : error, i try to start it up (it is supose to write a ascii sign on
    : the screen). but it just dosen't do. Then i tryede with the code
    : with the oem block , and that work.
    : How can that be ???
    :
    :
    : KMT

    Try adding "cld" right after the klar: label

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • : Try adding "cld" right after the klar: label
    :
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry

    Thanks for the fast reply, now i have tryed it on a real floppy (but stille the samme happend), i also tryede on an emulatede, but stille the same.
    can it have someting to do when bios loads the bootloader, it also search for the oem, ????

    Kmt
  • : Thanks for the fast reply, now i have tryed it on a real floppy (but
    : stille the samme happend), i also tryede on an emulatede, but stille
    : the same.
    : can it have someting to do when bios loads the bootloader, it also
    : search for the oem, ????
    :

    BIOS only checks for the signature bytes.

    There is nothing wrong with the code... I even tried it myself and it works fine. Something must be wrong with putting it on the floppy.
    Are you following MT2002's tutorial? Basically, everything I told you/can tell you I know because of his work ;)

    Could you please post how you go from the ASM code to compile and to floppy?

    Be sure you use partcopy to copy the binary file to sector 0 of the floppy.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • Hmmmmm
    i do just as mt2002s tutorial, but i must do something wrong, i do it like this: first i assemble the code,
    (nasm -f bin 1.asm -o boot.bin)
    using a .bat file, (i make the file and if it is a com i works), then i do the folowing using partcopy (also a .bat file)
    "partcopy boot.bin 0 3 -f0 0"
    "partcopy boot.bin 3e 1c2 -f0 3e"


    Kmt

    now i tryede with debug.exe, (w 100 0 0 1) and that works.
    so.... But Thanks a lot, for answering.
    Thanks bitbybit Thor

    by the way, do you know how to use the video memory, i can't realy get a ideer on how to accesc it under real mode
  • : Hmmmmm
    : i do just as mt2002s tutorial, but i must do something wrong, i do
    : it like this: first i assemble the code,
    : (nasm -f bin 1.asm -o boot.bin)
    : using a .bat file, (i make the file and if it is a com i works),
    : then i do the folowing using partcopy (also a .bat file)
    : "partcopy boot.bin 0 3 -f0 0"
    : "partcopy boot.bin 3e 1c2 -f0 3e"
    :

    If you want to do it with partcopy use:
    partcopy boot.bin 0 200 -f0 0

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • : by the way, do you know how to use the video memory, i can't realy
    : get a ideer on how to accesc it under real mode

    In real mode, coloured text video memory is directly accessible at
    segment B800h. If you are using EGA/VGA modes (such as mode 13h), then
    use segment A000h. Monochrome text video memory resides at segment B000h.
  • : use segment A000h. Monochrome text video memory resides at segment
    : B000h.

    hmmm
    could you not make a little source code ....
    Thanks a lot

    Kmt
  • : : use segment A000h. Monochrome text video memory resides at segment
    : : B000h.
    :
    : hmmm
    : could you not make a little source code ....
    : Thanks a lot
    :
    : Kmt

    Sure.
    [code]
    ; Set the video mode to 40x25 16-colour text
    mov ah, 0
    mov al, 1 ; Mode 1
    int 10h

    ; Coloured text video memory is at segment 0B800h
    mov ax, 0B800h
    mov ds, ax
    mov es, ax

    ; Knowing that in colour text video memory, there is the
    ; letter followed by it's colour, let's write a colourful "abc"
    ; to the beginning of the screen
    mov di, 0
    mov byte ptr [di], "a"
    mov byte ptr [di+1], 2
    mov byte ptr [di+2], "b"
    mov byte ptr [di+3], 11
    mov byte ptr [di+4], "c"
    mov byte ptr [di+5], 13
    [/code]Here's a list of video modes:
    http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte6l9s.htm

    The idea is the same for monochrome text, just skip the colour bytes.
    You probably won't be using EGA/VGA modes(seg A000h) in your OS, but
    once you get the hang of the basic video graphics stuff, then you
    might want to check out SVGA, which will enable you to use larger video
    modes with more colours.

    May the Google be with you!
  • : May the Google be with you!
    Thanks for the code.
    it was just what i neede to get how it worked.
    ...
    but is there not an eayser way, ???
    and now when we are in it, what about putting a pixel, (i i mean without int 10 , because it is slow, and will not work in protectede mode)

    thanks ....

    kmt
  • : : May the Google be with you!
    : Thanks for the code.
    : it was just what i neede to get how it worked.
    : ...
    : but is there not an eayser way, ???

    Umm, sorry, but I can't really figure out what the hard part was here..


    : and now when we are in it, what about putting a pixel, (i i mean
    : without int 10 , because it is slow, and will not work in protectede
    : mode)
    :

    When it comes to using pixels, you will need to choose some graphics
    mode instead of a text mode (just replace "mov al, 1" with "mov al, 13h").
    You don't have to use int 10h/function 0Ch to print pixels, just write
    the pixel colour values into video memory at segment A000h and they will
    appear as pixels on the screen.

    I'm relatively new to low-level pmode programming, but from what I can
    understand, you have to set up the graphics mode in real mode. Then in
    order to use the screen in pmode, set up a Descriptor Table with the
    base address 0A000h:0000 (A0000h in pmode) and a limit of 64kB. Then
    you can use the DT to write to vmem. (Yeah, may sound tricky, but it'll
    be clear to you once you learn more about pmode..) Also remember that
    in graphics modes, the BIOS won't help you with writing text, so you
    need your own font and functions to get the text on the screen.

    EGA/VGA is limited to a resolution of 640*480, so I wouldn't even
    recommend it as a graphics mode. Modern operating systems use VESA
    SVGA to get to the larger resolutions. The screen mode can also be
    switched directly in pmode without dropping back to real mode.

    Btw, I think PH messed up the previous link I gave, so here's another one:
    http://www.bookcase.com/library/dos/ints/video_modes.html

    Feel free to ask more questions!
  • : : : May the Google be with you!
    : : Thanks for the code.
    : : it was just what i neede to get how it worked.
    : : ...
    : : but is there not an eayser way, ???
    :
    : Umm, sorry, but I can't really figure out what the hard part was
    : here..

    i have alredy figur that out (it was becasue of the source code, mov byte ptr [di],xx)
    i have tryede to make a rutine, but it fails , can you find the fails,
    code:
    skriv:
    mov ax,b800; text mode
    mov ds,ax
    mov es,ax
    xor di,di
    mov ah,0f;farvene
    lodsb
    or al,al
    jz skrivf
    pop di
    mov [di],ax
    inc di
    push di ; save the new addrese for writting char
    jmp skriv
    skrivf:
    ret
    it is supouse to write a msg (di:si points to msg address)

    and im glad that you wanner have more questions.
    because, my next questions is a little hard to answere, how to draw a sceen mode, (and by that i undstood, you are a little new, ....)

    kmt
  • : i have alredy figur that out (it was becasue of the source code, mov
    : byte ptr [di],xx)
    :
    : and im glad that you wanner have more questions.
    : because, my next questions is a little hard to answere, how to draw
    : a sceen mode, (and by that i undstood, you are a little new, ....)
    :
    : kmt
    :

    Jees, I should visit this part more often ;-)

    In the upcomming tutorial, it creates some routines for directly clearing
    and writing text on screen at any x/y location, and very basic VGA in text mode 7. This is protected mode though.

    What do you mean by "draw a screen mode"?

    If you want to go into a graphics mode from Real Mode, you can still use the Video interrupts. For example:
    [code]
    ; switch video modes - Real mode only
    mov ah, 0x0 ; fucntion 0
    mov al, 0x13 ; Mode 0x13 is a very standard VGA mode
    int 0x10 ; switch modes
    [/code]
    From here, reference memory at 0xA0000 (0xA000:0) to access video memory.

    Doing this in protected mode is alot more harder as it requires VGA controller programming.

    Drawing in this mode is not that tricky because it uses only one byte per pixel. This pixel value is an index into a palette array. Some of it is mathematic intensive though, such as plotting lines. Because of this, it is MUCH easier to do this in C.

    I would like to add that you do not need to create a new descriptor table to access video memory within protected mode. I personally do not recommend it, anyways. The reason for this is that you can remap the region the video controller uses as video display. This is just my opinion, though.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • : Doing this in protected mode is alot more harder as it requires VGA
    : controller programming.
    well that is was i want, so if tou know something about it i will be happy, for it is not easy to understand, (found a good site http://www.stanford.edu/class/cs140/projects/pintos/specs/freevga/home.htm)

    and if im right, windows uses controller programming, for drawind the "windows"


    Kmt
  • I would first recommend going into protected mode first. Your current
    code does not do that.

    It seems to me that you are trying to jump into graphics without developing
    the basics first, nor without having a design. One cannot do much within
    the 512 byte limitation of bootloaders.

    That site is a very nice refrence that you can use. I might want to stress
    on the warnings listed on that page, though. VGA Programming can get
    quite complex in protected mode. If you do not understand that site,
    take a look at basic direct hardware programming concepts at my site
    first, along with protected mode programming.

    Windows does not directly use controller programming. Windows loads
    specific drivers that abstracts the hardware dependencies. These drivers
    are written by the chip manufacturers, useually. Hence, these drivers
    are very hardware dependent. It is the drivers that run in Kernel mode
    (Ring 0) that use microcontroller programming, and provide the interface
    to the hardware.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.mt2002.sitesled.com]Website :: OS Development Series[rightbr][/link][/size]
  • : and if im right, windows uses controller programming, for drawind
    : the "windows"

    If I'd have to guess, Windows would so it something like this:
    Windows has a driver for the video controller, and probably an API encapsulation for the more standard Windows tasks, and then above that are Windows API's that call those routines.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
Sign In or Register to comment.

Howdy, Stranger!

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

Categories