Asm question

Programming, for all ages and all languages.
User avatar
Coty
Member
Member
Posts: 286
Joined: Thu Feb 12, 2009 5:12 pm

Re: Asm question

Post 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
My hero, is Mel.
tera4d
Member
Member
Posts: 37
Joined: Sun Apr 26, 2009 11:22 am

Re: Asm question

Post 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.
User avatar
Coty
Member
Member
Posts: 286
Joined: Thu Feb 12, 2009 5:12 pm

Re: Asm question

Post 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.
My hero, is Mel.
tera4d
Member
Member
Posts: 37
Joined: Sun Apr 26, 2009 11:22 am

Re: Asm question

Post 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?
Gigasoft
Member
Member
Posts: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: Asm question

Post 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.
tera4d
Member
Member
Posts: 37
Joined: Sun Apr 26, 2009 11:22 am

Re: Asm question

Post 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.
User avatar
Coty
Member
Member
Posts: 286
Joined: Thu Feb 12, 2009 5:12 pm

Re: Asm question

Post 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'.
My hero, is Mel.
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: Asm question

Post 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"
"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: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: Asm question

Post 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.
Post Reply