bootstrap code fails

Thread Solved

Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: bootstrap code fails

 
0
  #11
Sep 14th, 2009
Are you clobberng your Segment register on purpose?
  1. xor ax,ax ;zero out ax
  2. mov ds,ax ;initialise data segment
  3. mov ss,ax
this should be more like
  1. mov ax,cs
  2. mov ds,ax
  3. mov ss,ax
Last edited by wildgoose; Sep 14th, 2009 at 4:53 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 134
Reputation: mathematician is an unknown quantity at this point 
Solved Threads: 3
mathematician mathematician is offline Offline
Junior Poster

Re: bootstrap code fails

 
0
  #12
Sep 14th, 2009
Originally Posted by wildgoose View Post
Are you clobberng your Segment register on purpose?
I'm not clobbering anything. The boot sector always gets loaded at an absolute address of 7c00h, which means that the ds register must contain zero if the code is org'd at 7c00h.
Last edited by mathematician; Sep 14th, 2009 at 4:59 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: bootstrap code fails

 
0
  #13
Sep 14th, 2009
Okay then.

Does your assembler understand C defines?

mov sp, 0x7c00

0x7c00 is a C definition.
0x10

Assemblers typically are looking for 07c00h
10h
Last edited by wildgoose; Sep 14th, 2009 at 5:10 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 134
Reputation: mathematician is an unknown quantity at this point 
Solved Threads: 3
mathematician mathematician is offline Offline
Junior Poster

Re: bootstrap code fails

 
0
  #14
Sep 14th, 2009
Originally Posted by wildgoose View Post
Okay then.

Does your assembler understand C defines?

mov sp, 0x7c00

0x7c00 is a C definition.
0x10

Assemblers typically are looking for 07c00h
10h

Since I use MASM it recognises 7c00h, but if I used NASM it would recognise 0x7c00.
Last edited by mathematician; Sep 14th, 2009 at 5:14 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: bootstrap code fails

 
0
  #15
Sep 14th, 2009
You were using C definitions in the posted code.

Examine your CS register and IP register.
What are their hex values when you first begin the code?
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: bootstrap code fails

 
0
  #16
Sep 14th, 2009
As an experiment replace your
  1. lodsb ; AL = [DS:SI]
with
  1. mov al,cs:[si]
  2. inc si

It'll then force the string load from the code segment!
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 134
Reputation: mathematician is an unknown quantity at this point 
Solved Threads: 3
mathematician mathematician is offline Offline
Junior Poster

Re: bootstrap code fails

 
0
  #17
Sep 14th, 2009
Originally Posted by wildgoose View Post
You were using C definitions in the posted code.
I was using the syntax used by C and some assemblers.


Examine your CS register and IP register.
What are their hex values when you first begin the code?
In the case of a boot sector cs=0 and ip=7c00h (always).
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 830
Reputation: wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all wildgoose is a name known to all 
Solved Threads: 94
wildgoose's Avatar
wildgoose wildgoose is offline Offline
Practically a Posting Shark

Re: bootstrap code fails

 
0
  #18
Sep 14th, 2009
Everything looks correct but I still think its a Segment:Offset issue.

Initialize your Graphics card Page#0 column 0, row 0. Before doing anything.

And try writing your ASCII letters directly into the text frame buffer.
  1. mov ax,0b800h
  2. mov es,ax
  3. xor edi,edi
  4.  
  5. mov es:[edi],al
  6. inc edi
  7. inc edi
Last edited by wildgoose; Sep 14th, 2009 at 5:30 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 163
Reputation: NotNull is an unknown quantity at this point 
Solved Threads: 15
NotNull's Avatar
NotNull NotNull is offline Offline
Junior Poster

Re: bootstrap code fails

 
0
  #19
Sep 14th, 2009
It's been a while, but I think this is right.
Upon execution of the bootloader
CS,DS,ES will be zero,
And there is a 512-byte stack allocated by the BIOS.
SS (points where?) SP ?
I do not know if interrupts are disabled.

Has anyone else tested this bootloader?
Could it be because of this guys hardware configuration?
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 134
Reputation: mathematician is an unknown quantity at this point 
Solved Threads: 3
mathematician mathematician is offline Offline
Junior Poster

Re: bootstrap code fails

 
0
  #20
Sep 15th, 2009
Originally Posted by NotNull View Post
It's been a while, but I think this is right.
Upon execution of the bootloader
CS,DS,ES will be zero,
And there is a 512-byte stack allocated by the BIOS.
SS (points where?) SP ?
I do not know if interrupts are disabled.

Has anyone else tested this bootloader?
Could it be because of this guys hardware configuration?
He says that he can print the first character. I suppose it is possible that the direction flag is set when the boot sector gets control, so instead of pointing to the e after the H has been printed, it points to??? Solution: clear the direction flag (as above).

It is difficult to see how the hardware configuration can be responsible, assuming that it is running on a PC. The 6845 will have been set up by the bios so that messages like "Not a System Disk" can be displayed.

I haven't got a floppy drive fitted to my computer, so I can't test it.
Last edited by mathematician; Sep 15th, 2009 at 7:48 am.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 1304 | Replies: 22
Thread Tools Search this Thread



Tag cloud for Assembly
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC