Hello word

Post here questions, problems and suggestions in English language
  • About debugger:
    1. It will be better if you compile your programme with .dbg file (this can be done in at least three ways: compile from KolibriOS with "create debug information" option enabled; use fasm extensions; compile to elf or another such format and get symbols from it)
    2. Run mtdbg (KolibriOS debugger). Enter 'load /path/to/file' (to use debugging symbols, you need to put it in the same directory as executable).
    3. You can use ctrl-f7/f8 to do step (normal or wide). Little help can be found using command help..
    I get two passes
    What do you mean? If fasm output is like
    flat assembler version 1.68 (16384 kilobytes memory)
    2 passes, 229 bytes.
    it means that compilation is successful.

    PS: IMHO, it is bad idea to write graphical applications now and with kernel built-in features...
    Last edited by vkos on Thu Dec 10, 2009 5:43 pm, edited 1 time in total.
  • Hi, I'm analizing the program which Lrz showed me in the threat.
    With the debugger I can see this:

    Image

    With a hex editor I can see this one:

    Image

    The lines 0,10,20 and 30 match between them, these lines are header and data, are they important?

    I can't see the rest of the lines in the debbuger, why?

    Thanks very much

    Ángel
  • To see the rest of the data in the debugger, you must use the 'd' command, followed by the hex address of the data you want to see.
    All lines should match.
    What is your definition of 'important'?
    Without the header, the program cannot be loaded, without the data, it will probably not function correctly.
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • I think that I'm understanding it. :D

    But, how can I know if the instructions begins in the 24 position memory? :roll:

    How can I find out in which position are the data?

    Which is the program structure?

    Is there any documentation about the structure of kolibrios programs? :twisted:

    Thanks very much

    Ángel
  • angel wrote:I think that I'm understanding it. :D

    But, how can I know if the instructions begins in the 24 position memory? :roll:

    How can I find out in which position are the data?

    Which is the program structure?

    Is there any documentation about the structure of kolibrios programs? :twisted:

    Thanks very much

    Ángel
    0x24, it is the address of the label 'START'. If you look in the data at offset 12 (8 + 4) you can see the DWORD 24 00 00 00)
    This dword, wich is a part of the so called header tells the kernel where the first instruction to be executed is.

    You can find more info about how to program for kolibrios in the distribution, and in the application 'docpack' in kolibrios.
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • That interesting :shock: :shock: :shock: :shock: :shock:

    Does the program always begin at the 12 position?

    What is the ralation between "24 00 00 00" and "B8 28 00 00 00" y "mov eax, 28h" ? :roll:

    Thank you very much

    Ángel
  • angel wrote:That interesting :shock: :shock: :shock: :shock: :shock:

    Does the program always begin at the 12 position?

    What is the ralation between "24 00 00 00" and "B8 28 00 00 00" y "mov eax, 28h" ? :roll:

    Thank you very much

    Ángel
    No, the program begins where the START label is, it is possible to put other code, or data before it. (between the header and START label)

    24 00 00 00 is the DWORD 24h (36 decimal)
    B8 28 00 00 00 is a piece of code in wich B8 probably means mov eax, ... and 28 00 00 00 is the data to be put in eax
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • How can I relate what I see with the hex editor with the instructions that I see in the debuger? :?:

    For example: The header MENUETO1 = 4D 45 4E 55 45 54 30 31

    I'd like to make a little kolibrios / menuetos emulator. :twisted:

    Thanks very much :mrgreen:
  • MENUET01 = 4dh 45h ... is just an ascii conversion (www.Asciitable.com) it is how the text really is stored in your computer.

    currently there are only MENUET00 (old, should not be used for new programs) and MENUET01 headers
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • I try to explain it with an example:

    Image

    The program tries to simulate to OS, but I don´t know how to interpret the opcodes.

    Can you help me, please?

    Thanks so much

    Ángel
  • The dword after 'MENUET01' gives is the header version number, it should be 1.
    The dword after that is the pointer to start of code, as explained before.
    The next dword is the size of the whole file, in bytes.
    The dword after that is the size the program will take in memory (this should be at least as big as the previous dword, if not larger)
    The dword after that is the stack pointer, when the program is loaded, the OS sets the esp register (search on google to know what this register does) to this value.
    The last 2 dword are I_Param and I_Path, they are optional and should be 0 if the program does not want to use them.

    If you are looking for a way to interpret the code itself, perhaps the source code of MTDBG or Klbrinwin or MeOSEmul can help you out.
    "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." Albert Einstein
  • 1) There is already emulator for windows - KlbrInWin.
    2) To emulate kolibri in such way, you need to write x86-32 emulator which is not good idea really ;) (the better option is to take Qemu or Bochs, for example). But if you want to write x86-32 emulator, you can see opcode meanings in the Intel 80386 Programmers Reference manual.
    3) PHP programme will be extreamly slow.

    hidnplayr
    If you are looking for a way to interpret the code itself, perhaps the source code of MTDBG or Klbrinwin or MeOSEmul can help you out.
    KlbrInWin doesn't emulate processor instructions (and MeOSEmul, I think, too).
  • If you are looking for a way to interpret the code itself, perhaps the source code of MTDBG or Klbrinwin or MeOSEmul can help you out.
    I've used Klbrinwin and MeOSEmul, but I haven't found MTDBG. Where is it?
    1) There is already emulator for windows - KlbrInWin.
    Yes, but not for Uzebox.

    I made a didactic PLC, for my students, with Uzebox.
    3) PHP programme will be extreamly slow.
    I use PHP for undestanding the program code. The emulator will be written in C.

    I keep working on understanding the code

    Thanks and Image Merry christmas Image

    Ángel
  • Who is online

    Users browsing this forum: No registered users and 1 guest