flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
tantrikwizard
You cannot use every register as a displacement in 16 bit code, only in 32 bit code can you do this. Displacement registers in 16 bit code are BX, SI, DI, SP and BP. This is not a DOS limitation, it's by design of the processor when not running in protected mode.
|
|||
![]() |
|
dvlfrnd
i see,
Thank you very much for your explanation tantrikwizard |
|||
![]() |
|
LocoDelAssembly
Code: mov ax, [bx+bx] Error reported by fasm: "invalid address" Code: mov ax, [es:cx] Error reported by fasm: "reserved word used as symbol" Why fasm doesn't report "invalid address" for the last one too? |
|||
![]() |
|
tantrikwizard
LocoDelAssembly wrote: Why fasm doesn't report "invalid address" for the last one too? Not sure, its something to do with the stage of compilation that produces the error. In either case it's invalid in 16 bit code. Code: mov ax, [bx+bx] This is using Index+Displacement addressing, it can be achieved in 16 bit code using: Code: add bx, bx mov ax, [bx] valid 16 bit addressing modes are (from intel manual): [BX + SI] [BX + DI] [BP + SI] [BP + DI] [SI] [DI] disp16 [BX] [BX+SI]+disp8 [BX+DI]+disp8 [BP+SI]+disp8 [BP+DI]+disp8 [SI]+disp8 [DI]+disp8 [BP]+disp8 [BX]+disp8 [BX+SI]+disp16 [BX+DI]+disp16 [BX+SI]+disp16 [BX+DI]+disp16 [SI]+disp16 [DI]+disp16 [BP]+disp16 [BX]+disp16 I erronously said SP could be used as an addressing mode in 16 bit code in the previous post. |
|||
![]() |
|
Goplat
dvlfrnd: Your two code samples are not equivalent, the first one fills addresses 0 to 63999, the other does 1 to 64000.
|
|||
![]() |
|
dvlfrnd
Quote: dvlfrnd: Your two code samples are not equivalent, the first one fills addresses 0 to 63999, the other does 1 to 64000. oh,yes i haven't noticed it,thanks ![]() |
|||
![]() |
|
LocoDelAssembly
tantrikwizard, both codes was just an example to trigger the error messages, I'm not really needing "mov ax, [bx+bx]" to get working
![]() I'll not tell that reporting "reserved word used as symbol" when things like [bx+cx] (no need for segment override to trigger the same error message) appears, but I think that it misguide the unprevented programmer. A "invalid address" or "invalid addressing" are more appropiate IMHO. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.