Page 2 of 2

Re: Asm question

Posted: Fri Jan 29, 2010 4:53 pm
by Coty
try making an image like this:

Code: Select all

format binary as "img"
file "/path/to/boot.bin"
That will add the boot loader to an image file. Works with FASM anyway :D

Re: Asm question

Posted: Fri Jan 29, 2010 4:56 pm
by tera4d
Coddy wrote:try making an image like this:

Code: Select all

format binary as "img"
file "/path/to/boot.bin"
To be honest :roll: That is what I use WinImage for since I do not use linux (Windows xp user here)
The code which you provided would compile with nasm and work just fine if I add it to a image (As a bootsector) with WinImage.

Re: Asm question

Posted: Fri Jan 29, 2010 5:01 pm
by Coty
That code works fine with XP, I just made an image with it on XP, I don't see why it wouldn't its
all ASM code. And I tried to use win image before, but never had to much luck with that. I always
got what you said happened. black screen and a cursor.

Re: Asm question

Posted: Sat Jan 30, 2010 5:39 am
by tera4d
Coddy wrote:That code works fine with XP, I just made an image with it on XP, I don't see why it wouldn't its
all ASM code. And I tried to use win image before, but never had to much luck with that. I always
got what you said happened. black screen and a cursor.
Hmm do you have any idea why it doesnt do what its supposed to do?
I tested my code on real hardware to (2 pc's and 1 laptop) and all show a blinking cursor.
That code is supposed to switch to video mode 13h as you can see and then print the text.
Could someone please help me out with this one?

Re: Asm question

Posted: Sun Jan 31, 2010 1:58 pm
by Gigasoft
You can't use WinImage to install a non-FAT boot sector on an image. The boot sector will be overwritten with FAT information. The BIN file made from your ASM source almost works in Bochs, but you can't use mov es, si to initialize ES since there's no guarrantee that SI will be 0. There's also no need to clear AX, CX and BX before setting them.

Re: Asm question

Posted: Mon Feb 01, 2010 11:45 am
by tera4d
@Gigasoft:
If Winimage does such a thing how would it be possible for me to create a Image then? Because I cant boot from a file right? (Just the blank bin and point to it)
What do you mean by 'almost' run in bochs?
And by clearing ax, cx and bx was a pretty dumb mistake :roll: I realized it short after I scripted it haha but thanks for pointing it out.

Re: Asm question

Posted: Mon Feb 01, 2010 12:17 pm
by Coty
tera4d wrote:If Winimage does such a thing how would it be possible for me to create a Image then? .
I posted how to up there, remember this code?

Code: Select all

 
format binary as "img"
file "/path/to/boot.bin"
only in nasm I think you would need to put a percent sign in front of the 'file'.

Re: Asm question

Posted: Mon Feb 01, 2010 1:57 pm
by Combuster
Coddy wrote:only in nasm I think you would need to put a percent sign in front of the 'file'.
In nasm/yasm, you'll want the incbin directive:

Code: Select all

incbin "path/to/file"

Re: Asm question

Posted: Mon Feb 01, 2010 2:04 pm
by Gigasoft
By almost runs, I mean it shows something, but it's just garbage letters. It's because ES isn't set to 0.