flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > SI explanation please |
Author |
|
Tomasz Grysztar 14 Mar 2005, 13:32
ring0 wrote: 1/ The value i get for si and ax is different - why? (I believe ax is correct) It is the same when you write it like this. Probably you've got some mistake elsewhere. ring0 wrote: 2/ Given that the bios will always load this code at 7C00 what is the effect of ORG? When you define some labels in your source, the assembler needs to know where the resulting code will be loaded into memory to give them the correct values, and you use the ORG directive to tell the right base address to the assembler. You would use ORG 100h for the .COM program binary, for example. See also the section 2.2.3 of the fasm's manual. |
|||
14 Mar 2005, 13:32 |
|
Scanner 14 May 2005, 12:09
Yip, the 'more code' sections is probably the problem.
As for the ORG. Change it and have a look at the resulting list file, you will notice that the 'mov ax,prompt' lines will refer to different addresses because the origin of the code has been changed. The assembler needs to know the origin of the code for instructions such as the mov mentioned because it refers to an address that is dependant on the location of the code. |
|||
14 May 2005, 12:09 |
|
bubach 16 May 2005, 10:58
When you use org 0x7c00 and do something like: "mov ax, prompt" it's "translated" to "mov ax, prompt + 0x7c00" since both CS and DS points to zero.
If you where to use ORG 0, you would have to point both CS and DS to 0x07C0 instead (for it to work)... |
|||
16 May 2005, 10:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.