Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly Language > Re: Another pro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 11 Topic 4918 of 5166
Post > Topic >>

Re: Another problem

by Frank Kotler <fbkotler@[EMAIL PROTECTED] > Mar 18, 2008 at 09:38 PM

Stéphane thibaud wrote:
> I'm sorry for bothering y'all again... I have a little problem:

We only reply if we wanna... :)

> mov al,byte[MemoryMap_start.mapSize]
> 
> The line above points to the wrong address when ran with bochs... if I
> change it to:
> 
> mov al,byte[MemoryMap_start.mapSize - Code_start + 0x500]     ;0x500
> is the address where my code is loaded
> 
> then it does point to the right address...
> 
> Both versions assemble without a problem. Is there someting I'm doing
> wrong?

Apparently!

> [ORG 0x0500] doesn't work.

"Why not?" would be a start. "org" and ds need to be "synchronized", or 
the addresses Nasm calculates will be wrong. If you don't want "org 
0x500" on all your code, a new section...

section code_to_move vstart=0x500

may help... (???).

Another possible issue is the way "MemoryMap_start" is declared. If it's 
a "struc", "MemoryMap_start.mapsize" will evaluate to the offset from 
the start of the structure, not a complete memory address - *very* 
different from the same syntax in C!!! If ".mapsize" is just a local 
label under MemoryMap_start, it would be the complete address - 
"correct" or not would depend on "org", if any (or "vstart"), and ds.

We may need to see more of your code, if you can't find the problem. 
What, if any "org" (Nasm defaults to zero, if you don't say), what's in 
ds, where and how MemoryMap_start is declared, when and how the code 
gets to be loaded at 0x500... A number of things need to "cooperate" for 
it all to work... Lessee...

mov al,byte[MemoryMap_start.mapSize - Code_start + 0x500]     ;0x500

"Code_start", assuming that it's in the obvious place, should be equal 
to "org"... zero if none. If you need a specific "org"... say 0x7C00... 
the (relatively "new") vstart feature may be what you want. May need 
some "extras"...

org 0x7C00
section .text
xor ax, ax
mov ds, ax
....

section code_to_move follows=.text align=1 vstart=0x500
....
mov ds, ??? ;?
mov al, [MemoryMap_start.mapsize]
....

section bootsig follows=code_to_move start=0x7DFE
db 0x55, 0xAA

(or is it AA 55?) "Something like that"...

Best,
Frank
 




 11 Posts in Topic:
Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-18 11:46:29 
Re: Another problem
Frank Kotler <fbkotler  2008-03-18 21:38:14 
Re: Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-18 17:28:09 
Re: Another problem
Frank Kotler <fbkotler  2008-03-19 10:40:46 
Re: Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-18 17:36:24 
Re: Another problem
"Rod Pemberton"  2008-03-19 05:02:25 
Re: Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-19 04:17:17 
Re: Another problem
Frank Kotler <fbkotler  2008-03-20 12:00:28 
Re: Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-20 06:30:19 
Re: Another problem
Frank Kotler <fbkotler  2008-03-21 02:56:34 
Re: Another problem
=?ISO-8859-1?Q?St=E9phane  2008-03-21 10:18:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Oct 16 0:59:18 CDT 2008.