C Barebones ported to MASM - Errors

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
bluman
Posts: 3
Joined: Sat Sep 25, 2010 7:57 am

C Barebones ported to MASM - Errors

Post by bluman »

Hello!
This is my first post here and I was wondering if you could help me with a small basic kernel that I've translated to masm. Here is the code: http://pastebin.com/QSJ4sDeR

The problem is with the multiboot header(or at least that is what qemu says). Please don't say that nasm is better or something like that, because I've used this syntax for programming under Win32.

Thanks,
Paul Herman
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: C Barebones ported to MASM - Errors

Post by f2 »

bluman wrote: Please don't say that nasm is better or something like that, because I've used this syntax for programming under Win32.
I just want to say that the MASM license doesn't allow you to write an OS with it. So, you should use JWasm. This assembler is fully compatible with MASM-syntax.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: C Barebones ported to MASM - Errors

Post by gerryg400 »

Have you checked your output file with a hex editor to make sure the header is correctly formed and in the right place ?
If a trainstation is where trains stop, what is a workstation ?
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: C Barebones ported to MASM - Errors

Post by Combuster »

OS development is not windows development. The barebones assumes a cross-compiler targeting ELF, because that's what the bootloader expects to find. You can not simply use the PE format that windows-targeted tools use because it means you are violating the specification.
"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 ]
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: C Barebones ported to MASM - Errors

Post by neon »

I just want to say that the MASM license doesn't allow you to write an OS with it. So, you should use JWasm. This assembler is fully compatible with MASM-syntax.
MASM32's license restricts this, not MASM.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
iLewis
Posts: 22
Joined: Mon Nov 01, 2010 5:46 pm
Location: Ballarat, Victoria, Australia
Contact:

Re: C Barebones ported to MASM - Errors

Post by iLewis »

neon wrote:
I just want to say that the MASM license doesn't allow you to write an OS with it. So, you should use JWasm. This assembler is fully compatible with MASM-syntax.
MASM32's license restricts this, not MASM.
MASM64 is under the MASM32 license too right?
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: C Barebones ported to MASM - Errors

Post by neon »

iLewis wrote:MASM64 is under the MASM32 license too right?
Sorry, not sure, never used MASM64. I would think so if its from the MASM32 site.

MASM is a Microsoft product; MASM32 and MASM64 are not which is probably why it gets confused alot.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
bluman
Posts: 3
Joined: Sat Sep 25, 2010 7:57 am

Re: C Barebones ported to MASM - Errors

Post by bluman »

OK, I've "compiled" with jwASM and linked with LD, now it simply reboots without any message. Also does anyone know how to make the start label global? LD tells me that it can't find the start label. I think there is a problem as in my code I don't have .text and .bss
Post Reply