The majority of forums are now only available as archives, which means posting/editing is disabled.
The Anything and Everything forum is still open.
The Anything and Everything forum is still open.
Why won't this code work?
|
|||
|
Rank: Unregistered
|
Hi
I am pretty new to assembly. I am trying to write some real mode bootsector code. I am using NASM. I seem to be having trouble understanding how NASM or x86 real mode handle segments and offsets. For the moment, I am mixing my code and data into one plain binary file. To my mind, the following code should work: Code:
When I compile and run this code, my Vmware BIOS prints a single 'S'. I haven't tried it on other BIOS's yet. This is not the intended result. Shouldn't it print an 'H'? I am aware of an easy workaround. I can just tell NASM to start at 0x07C00 (instead of default 0x00?) by adding a [ORG 0x07C00] to the start, and then setting DS to 0x00, rather than setting it to CS. That's fine, and that's what I do for the moment, but Id still like to know why the above code doesn't work - what am I missing? When I make a memory reference such as [message], presumably this is just a 'displacement' reference using DS as the segment? Thanks in advance, Anonymous Coward |
||
|
Please login or register to post a reply.
