Assembly
-
- Posts: 13
- Joined: Sat Jan 24, 2009 11:25 am
- Location: Belgium
Assembly
Maybe this has been asked several times, but i can't find it any site so..here's my question
how can i halt and vieuw the result if i load some values into EAX, EBX and IBX and then substrac them and do more with them. Is there a way that i can vieuw the result or can execute my code step by step?
thx in advance
how can i halt and vieuw the result if i load some values into EAX, EBX and IBX and then substrac them and do more with them. Is there a way that i can vieuw the result or can execute my code step by step?
thx in advance
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Assembly
Well, if I remember correctly, there is a breakpoint flag or something that calls an exception every instruction if it's set, but I'm not sure how it works...
If you have calls that can print a byte in, let's say AL, as hexadecimal, you can use that to print AX, and then use that to print EAX. Using that, you could even get IP and print out the next four or so bytes (and, if you're really good at assembly, have a listing of all the base x86 instructions and disassemble them.)
Cheers,
Troy
If you have calls that can print a byte in, let's say AL, as hexadecimal, you can use that to print AX, and then use that to print EAX. Using that, you could even get IP and print out the next four or so bytes (and, if you're really good at assembly, have a listing of all the base x86 instructions and disassemble them.)
I'm assuming you mean EBP or ECX or something.RedDemon1970 wrote:and IBX
Cheers,
Troy
Re: Assembly
do you mean in your own os? just boot your OS in bochs and set a breakpoint at wherever you want to start, then start single step each instructionRedDemon1970 wrote:Maybe this has been asked several times, but i can't find it any site so..here's my question
how can i halt and vieuw the result if i load some values into EAX, EBX and IBX and then substrac them and do more with them. Is there a way that i can vieuw the result or can execute my code step by step?
thx in advance
if you want to do this for a normal binary under linux/windows just use any debugger. if you specially have an asm file under linux, then ald is a really good single stepping debugger
Re: Assembly
HI there,
if i understood your question, there's several ways to do that:
1. for me i use BORLAND TC 3.1 IDE to write kernel code,this environment has break-point
add watch,view registers,and more
2. the above useful in development session,but if you want view some debugging info
in compiled code, i suggest:
a. use #define debug , in possible errors section in your code,and write your own panic()
b. on hardware level, set ( bit 8 )TRAP flag in FLAGS registers using popf instruction
CheerS,
a.T.d
if i understood your question, there's several ways to do that:
1. for me i use BORLAND TC 3.1 IDE to write kernel code,this environment has break-point
add watch,view registers,and more
2. the above useful in development session,but if you want view some debugging info
in compiled code, i suggest:
a. use #define debug , in possible errors section in your code,and write your own panic()
b. on hardware level, set ( bit 8 )TRAP flag in FLAGS registers using popf instruction
CheerS,
a.T.d
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
-
- Posts: 13
- Joined: Sat Jan 24, 2009 11:25 am
- Location: Belgium
Re: Assembly
well I didn't meant it for my own os i meant if I put for example this
mov al, 5
mov hl, 5
add al, hl
well when I would compile this it would run but I don't see any result so wich code do I have to add to make the program halt and show the result?
mov al, 5
mov hl, 5
add al, hl
well when I would compile this it would run but I don't see any result so wich code do I have to add to make the program halt and show the result?
Re: Assembly
OK, please take look at
http://forum.osdev.org/viewtopic.php?f= ... 8&start=15
1. call the print_AX procedure itself
2. convert print_AX into interrupt, e.g. int 99h when invoke will print the result
CheerS,
a.T.d
http://forum.osdev.org/viewtopic.php?f= ... 8&start=15
you can:RedDemon1970 wrote:to make the program halt and show the result?
1. call the print_AX procedure itself
2. convert print_AX into interrupt, e.g. int 99h when invoke will print the result
CheerS,
a.T.d
Distance doesn't make you any smaller,
but it does make you part of a larger picture.
but it does make you part of a larger picture.
- Troy Martin
- Member
- Posts: 1686
- Joined: Fri Apr 18, 2008 4:40 pm
- Location: Langley, Vancouver, BC, Canada
- Contact:
Re: Assembly
First IBX, then HL... you have your registers/processor architectures confuzzled, my friend...
Re: Assembly
You could try
xor ax,ax
int 16h
before you exit code.
Also some thing like this may help you
http://www.lrr.in.tum.de/~jasmin/index.html
http://www.btinternet.com/~btketman/tutpage.html
xor ax,ax
int 16h
before you exit code.
Also some thing like this may help you
http://www.lrr.in.tum.de/~jasmin/index.html
http://www.btinternet.com/~btketman/tutpage.html
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Assembly
Seriously, get your facts straight.RedDemon1970 wrote:I put for example this
mov al, 5
mov hl, 5
add al, hl
(...) it would run
Do you consider yourself a programmer? The forum rules say that you need a good deal of experience with programming prior to attempting an OS, and if you're unable to find a way to print something that's been discussed and demonstrated a dozen times before you should be able to figure this one on your own.wich code do I have to add to make the program halt and show the result?
-
- Posts: 13
- Joined: Sat Jan 24, 2009 11:25 am
- Location: Belgium
Re: Assembly
I have never said that, and if my question doesn't belong here, well then tell me where to find a comunity where they know also a lot about assembly
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Assembly
Of course not, you typed that.I have never said that
On google. And -1 for ignoring that forum rule.well then tell me where to find a comunity where they know also a lot about assembly
Your questions fail the etiquette. You should not be asking them anywhere.if my question doesn't belong here
Now, whatever code you should need to is already here on the forums. But I leave you some time to think about the other things you need. Thread locked.