flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 06 Oct 2018, 06:37
The DX register is 16-bits wide, 2 bytes. You are trying to load 12 bytes into the 2 byte register. fasm complains because it won't fit.
Code: mov dx,'a' ;okay DX=0x0061 mov dx,'ab' ;okay DX=0x6261 mov dx,'abc' ;error 0x636261 is too large for the DX register Last edited by revolution on 06 Oct 2018, 12:19; edited 1 time in total |
|||
![]() |
|
Adcock 06 Oct 2018, 08:35
Okay. Thanks.
![]() Opps... So I was passing variable's address not content. Wait. Isn't dx supposed to work with whatever passed to it? How does it distinguish between content and address. Are all addresses 2 bytes long? Btw, thanks for properly naming this thread. [whoever did it] |
|||
![]() |
|
Tomasz Grysztar 06 Oct 2018, 10:01
Adcock wrote: Isn't dx supposed to work with whatever passed to it? For example, if you put a number 102 into DX, it is a binary number 1100110b and these are the bits that are set in DX. Depending on how you then use this value, it may be interpreted in different ways, for example this number corresponds to ASCII/Unicode character "f", so if you use this value where it is interpreted as character, it is going to be seen as such. If you use this value as an address, this is going to be an address of something stored starting from 102th byte of memory (counted starting from 0 within a segment or linear address space, but that is another story). Adcock wrote: Are all addresses 2 bytes long? |
|||
![]() |
|
DimonSoft 06 Oct 2018, 12:00
Tomasz Grysztar wrote:
Well, to be precise, in 16-bit real mode the full address is 32 bits, while 16 bits is the size of an offset, i.e. the most used part of such address. Just for the sake of completeness… |
|||
![]() |
|
Tomasz Grysztar 06 Oct 2018, 12:06
DimonSoft wrote:
|
|||
![]() |
|
Adcock 06 Oct 2018, 12:16
Okay.
Thanks guys. ![]() |
|||
![]() |
|
DimonSoft 07 Oct 2018, 09:49
Tomasz Grysztar wrote:
My bad. That’s what happens when I write posts too fast focusing just on the logical concepts. But I like the way this stuff just gets our attention, layer-by-layer. |
|||
![]() |
|
revolution 07 Oct 2018, 10:01
DimonSoft wrote:
Whew, that should be enough to make you go crazy with useless knowledge. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.