943,879 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Marked Solved
  • Views: 1937
  • Assembly RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Sep 14th, 2009
0

Re: bootstrap code fails

Are you clobberng your Segment register on purpose?
Asm Syntax (Toggle Plain Text)
  1. xor ax,ax ;zero out ax
  2. mov ds,ax ;initialise data segment
  3. mov ss,ax
this should be more like
Asm Syntax (Toggle Plain Text)
  1. mov ax,cs
  2. mov ds,ax
  3. mov ss,ax
Last edited by wildgoose; Sep 14th, 2009 at 5:53 pm.
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Sep 14th, 2009
0

Re: bootstrap code fails

Click to Expand / Collapse  Quote originally posted by wildgoose ...
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 5:59 pm.
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006
Sep 14th, 2009
0

Re: bootstrap code fails

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 6:10 pm.
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Sep 14th, 2009
0

Re: bootstrap code fails

Click to Expand / Collapse  Quote originally posted by wildgoose ...
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 6:14 pm.
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006
Sep 14th, 2009
0

Re: bootstrap code fails

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?
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Sep 14th, 2009
0

Re: bootstrap code fails

As an experiment replace your
Asm Syntax (Toggle Plain Text)
  1. lodsb ; AL = [DS:SI]
with
Asm Syntax (Toggle Plain Text)
  1. mov al,cs:[si]
  2. inc si

It'll then force the string load from the code segment!
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Sep 14th, 2009
0

Re: bootstrap code fails

Click to Expand / Collapse  Quote originally posted by wildgoose ...
You were using C definitions in the posted code.
I was using the syntax used by C and some assemblers.


Quote ...
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).
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006
Sep 14th, 2009
0

Re: bootstrap code fails

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.
Assembly Syntax (Toggle Plain Text)
  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 6:30 pm.
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009
Sep 14th, 2009
0

Re: bootstrap code fails

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?
Reputation Points: 36
Solved Threads: 19
Junior Poster
NotNull is offline Offline
198 posts
since Oct 2008
Sep 15th, 2009
0

Re: bootstrap code fails

Click to Expand / Collapse  Quote originally posted by NotNull ...
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 8:48 am.
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Nohau Emulator Problem
Next Thread in Assembly Forum Timeline: Faulty observation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC