Page 1 of 1

I'm making book loader for 1week. help me

Posted: Thu May 27, 2004 8:59 pm
by Johnny
I'm making very simple boot loader, which just print '====' out
But It does work, I dont know why..
The code is from tute that is in ORCR
Let me show my source code at first.

[ORG 0]

jmp 07C0h:start ; Goto segment 07C0

start:
; Update the segment registers
mov ax, cs
mov ds, ax
mov es, ax

mov ah, 9 ; Print "===="
mov al, '=' ;
mov bx, 7 ;
mov cx, 4 ;
int 10h ;

hang: ; Hang!
jmp hang

times 510-($-$$) db 0
dw 0AA55h

I made img file with 'WinImage' And tested with VMWare
It is expected to print '====' and then hang
But It doesn't print out and noting shown in VMWare

I'm working on Windows XP Professional

What do I do to get expected result?

Some others say this code looks doesn't reach entry point, which is start: in my source code and I need to debug it.
But I even don't know how to debug like in CodeView by using trace..

Thank you in advance..~

Re:I'm making book loader for 1week. help me

Posted: Fri May 28, 2004 12:43 am
by Brendan
Hi,
Johnny wrote: I made img file with 'WinImage' And tested with VMWare
It is expected to print '====' and then hang
But It doesn't print out and noting shown in VMWare

I'm working on Windows XP Professional

What do I do to get expected result?

Some others say this code looks doesn't reach entry point, which is start: in my source code and I need to debug it.
But I even don't know how to debug like in CodeView by using trace..

Thank you in advance..~
There's nothing wrong with your code, apart from not setting up a stack. Not setting up a stack probably doesn't matter (if it mattered then your code would crash), so this isn't the problem. This leaves 3 possibilities:

- your assembler is adding some sort of exe header
- it's not being stored in the correct spot on the floppy image
- VMWare isn't configured properly

If you're using NASM then you shouldn't get any headers or anything as binary is usually the default output format. It's best to make sure though - try "NDISASM boot.bin > out.txt" and check to see that out.txt looks like your original source code without anything extra. If you're not using NASM you should be able to do something similar.

I've not used VMWare or WinImage, so I'm not much help there :-)

I'd expect VMWare to do something though - either saying it can't boot, or running your code and not displaying anything (perhaps INT 0x10, ah=9 isn't supported by VMWare, or it's using a non-standard display page). Does VMWare generate a log that shows where CS:IP was when it stopped? If so checking to see where it stopped would be a good idea..

As for WinImage it looks fairly confusing to me (heaps of options), and I haven't been able to figure out if it's images are in raw binary format or if it adds information to it (like DOS filesystem).

To create floppy images for Bochs I just use NASM:

Code: Select all

   org 0
start:
incbin "\os\bin\boot144.bin"
;incbin "\os\install.img"
   times 1474558-$+start db 0xf0
   dw 0x0a5f
You might also want to take a look at rawrite (http://uranus.it.swin.edu.au/~jn/linux/rawwrite.htm) to create real boot floppies.

Cheers,

Brendan

Re:I'm making book loader for 1week. help me

Posted: Fri May 28, 2004 2:19 am
by Johnny
After I use your asm code to make boot image,
I works well..
Thanks a lot
I think WinImage might have some problems..

Re:I'm making book loader for 1week. help me

Posted: Fri May 28, 2004 2:55 am
by Pype.Clicker
i dunno if it has a problem or not ... at least it has a manual ;D some image-writing programs *need* a floppy-sized source, others don't care ...