Howdy, Stranger!

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

Categories

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
«1345

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : 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
  • kmtdkkmtdk Member Posts: 30
    : 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
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : 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
  • kmtdkkmtdk Member Posts: 30
    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
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : 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
  • anthrax11anthrax11 Member Posts: 511
    : 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.
  • kmtdkkmtdk Member Posts: 30
    : use segment A000h. Monochrome text video memory resides at segment
    : B000h.

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

    Kmt
  • anthrax11anthrax11 Member Posts: 511
    : : 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!
  • kmtdkkmtdk Member Posts: 30
    : 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
  • anthrax11anthrax11 Member Posts: 511
    : : 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!
«1345
Sign In or Register to comment.