Re: Help data conversion
- From: "¬a\\/b" <al@xxx>
- Date: Mon, 08 Aug 2005 07:42:26 GMT
On Sun, 07 Aug 2005 14:47:19 -0400, Frank Kotler
<fbkotler@xxxxxxxxxxx> wrote:
>¬a\/b wrote:
>
>> for me it is right
>> if first of jump es=0400h, after jump i have to set ds=0400h (because
>> the jump set cs:ip, right?) is it true? (it is all right if after jump
>> 'es' point where is the data
>> and data is in 0400h in the case cs=ds==0400h. Is it ok?)
>
>Well, when the bios transfers control to our bootsector, we don't know
>how registers are set (except dl = boot device) - varies from one
>machine to another. We know it jumps to 07C00h - usually cs = 0 and ip -
>7C00h, but there are rumors that some machines (certain Compac Presario
>models?) jump to cs = 7C0h, ip = 0.
if push cs; pop ds; i don't see (for the boot programme i have) the
problem even if in the boot programme (it seems to me the programme
that load disk in the memory) use some data
I have a boot prog that say something like
ORG 7c00h
jump start
ROUTINE_FOR_PRINT
msg db "message", 13, 10, 0
start:
ax=07c0h| ss=ax| sp=03feh
push cs
pop ds
mov ah, 00h| mov al, 03h| int 10h
push di| mov di, msg| call ROUTINE_FOR_PRINT| pop di
ah=02h | al=02h |ch=0 | cl=2 | dh=0 | dl=0;
bx=0800h | es=bx| bx=0| int 13h
jump 0800h:0000h
yes in case cs:ip =0000:7c00 is it a problem if
ss:sp =07c0:03fe ?
does ORG 07c00h mean cs:ip = 07c0:0000 or cs:ip =0000:7c00?
or some other? (i think org sets only offset *for data*; so ORG
07c00h means if label is find its address is
offset_label_from_start_of_file+07c00 ) it is right? and if overflow?
org does not influence instructions?
>REM's code starts with a far jump
>(which loads cs *and* ip - that's what makes it "far") to 7C0h:00xx, so
>we know for sure what cs is at that point. Then he sets ds and es to
>that value.
>This needs to be "coordinated" with the "org" statement!
>If you've got a
>variable like "numbuff", the number that Nasm replaces this with is
>calculated by the offset into the file, plus the origin ("org" - Nasm
>defaults to "org 0", if you don't say).
so "a label" is an offset from the begin of file for the assembler?
>Incidentally, "numbuf dw 0" is
>only two bytes - not long enough to hold "1,111,111,111", 0 - but
>there's nothing after it to overwrite, so it works even if it isn't
>"right". A bootsector at "org 7C00h" (which is common) wants ds (and es,
>perhaps) set to 0.
org 7C00h
why es=ds=0
why not es=ds=cs=7c00?
[]
>Thanks for the on-topic discussion!
thank you
.
- Follow-Ups:
- Re: Help data conversion
- From: Frank Kotler
- Re: Help data conversion
- References:
- Re: Help data conversion
- From: Frank Kotler
- Re: Help data conversion
- From: ¬a\\/b
- Re: Help data conversion
- From: Frank Kotler
- Re: Help data conversion
- Prev by Date: Re: How do you pronounce "HLL"
- Next by Date: Re: Help data conversion
- Previous by thread: Re: Help data conversion
- Next by thread: Re: Help data conversion
- Index(es):
Relevant Pages
|