MOV AX, 0x0000 doesn't work.

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: MOV AX, 0x0000 doesn't work.

Post by Gigasoft »

Why don't you use the Bochs debugger and step through everything starting at 0:0x500?
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

Yeah I'm gonna try it soon, Ive just installed Bochs with debugger.
I'll let you know what, if anything, I found.

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

I've found nothing so far, only that some Enable A20 routines were skipped due to a typo ](*,) ](*,) ](*,).
I'll look tommorow if I can find something more.

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
User avatar
DednDave
Posts: 18
Joined: Fri Feb 05, 2010 10:40 am
Location: Mesa, Arizona

Re: MOV AX, 0x0000 doesn't work.

Post by DednDave »

you might look for an unbalanced stack
i have no experience with bochs, so i can't really follow the code very well
but it sounds like a RET instruction is not getting a valid return IP value off the stack
if it pops a value of -1, the next instruction would cause segment wrap
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: MOV AX, 0x0000 doesn't work.

Post by jal »

RGOS wrote:PS. Sorry for my English, I'm Dutch.
[offtopic]What's that supposed to mean? Unless suffering from a serious lack of education, no Dutch person should say that as an excuse. Moreover, your English seems fine, so it's false modesty.[/offtopic]


JAL
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

@jal: I'm still going to school, in fact I'm just back home (I'm 14 now).
But, yes, you hav a point, every Dutch person has to speak English.
But I'm going to do something now, I'm going to check for an unbalanced stack later.

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: MOV AX, 0x0000 doesn't work.

Post by jal »

RGOS wrote:I'm still going to school, in fact I'm just back home (I'm 14 now).
Ok, given your young age, apologies for ranting. It may have been better if you'd have stated your age instead of your nationality, knowing you're just 14 will make most people much more lenient in answering questions usually triggering an RTFM (although even when you're 14, reading the manual is always a good thing :)).


JAL
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

I've tried to figure uot why I get the error, but I don't find anything.
I also don't know how to watch the value of (E)IP in bochs, how (if) can you watch the value of (E)IP, or set a watch- or breakpoint on (E)IP?

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: MOV AX, 0x0000 doesn't work.

Post by Gigasoft »

To set a breakpoint, enter vb segment:offset. For example, vb 0:0x500. The command "cont" continues execution. Type "s" to step forward one instruction, and "n" to step over a call or int. To pause the program at the current instruction while it's running, press Ctrl+C. Every time the program is paused, Bochs shows the value of CS and EIP and disassembles the next instruction.
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

Thank you for that info, but is there maybe a way of setting a "breakpoint" over IP, so that if the value of IP changes to -1 that the breakpoint activates?

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
User avatar
Combuster
Member
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: MOV AX, 0x0000 doesn't work.

Post by Combuster »

RGOS wrote:so that if the value of IP changes to -1 that the breakpoint activates?
While you can try to catch the case IP=0xFFFF, it will not tell you how it got there.

Also, I never saw you fix this problem:
I wrote:the crash occurs well outside where your code is supposed to be. Most interesting, there's nothing after your code, you just let it roam free into whatever is there in RAM.
Did you put in some code to stop the processor yet?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Gigasoft
Member
Member
Posts: 856
Joined: Sat Nov 21, 2009 5:11 pm

Re: MOV AX, 0x0000 doesn't work.

Post by Gigasoft »

The code doesn't seem to roam. It ends with:

call ebp
cli
hlt

Anyway, the only way to find out where the code goes wrong is to step through it with the "n" command.
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

I don't find anything, but i'm gonna try to set the CS-register to 0 in the called code, would this help I don't know, but I can allways give it a try :) .

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
User avatar
RGOS
Member
Member
Posts: 38
Joined: Sat Feb 13, 2010 10:52 am
Location: Buurmalsen, The Netherlands
Contact:

Re: MOV AX, 0x0000 doesn't work.

Post by RGOS »

Hello,

Okay that didn't work, but I've copy-pasted the "FindFile" code in the main KERNEL.ASM code, and still I get the error.
I relly don't know what to do. Do any of you have an idea? I really can't find a typo or any other miniscule thing :( :? .

Thanks.
Program development: Think, think more and think again, then find the solution and code it.
OS development: Don't think, think less and don't think again, then the solution will come, else you're screwed.
Most of the time at OSDev you're screwed.
geppyfx
Member
Member
Posts: 87
Joined: Tue Apr 28, 2009 4:58 pm

Re: MOV AX, 0x0000 doesn't work.

Post by geppyfx »

simplify your code, remove functionality, use 'jmp $' as a part of debugging process, display something on the screen (as simple as 'mov word [ds:videomem], 0404h' ;a red diamond I think)
Locked