Command duplicate word in assambler

0

I need help in Assambler , which makes the command DUP in this line

APRI    DW  2    DUP(5, -6)
    
asked by Julio Mizrahi 09.07.2018 в 12:05
source

1 answer

1

APRI is the tag

DW is type word (16 bits)

2 is the number of times to duplicate

DUP duplicates and initializes with the values you give

in this case APRI points to 2 groups of 2 words one with the value 5 and another with the value -6, or in other words "using words 2 times (5, -6)"

(signed short 16bit)  5 : 0005
(signed short 16bit) -6 : FFFA

In x86 intel memory the numbers are saved with the least significant byte first for being little endian (although the newest of intel handle both endiannes) so in memory would be:

05 00 FA FF 05 00 FA FF

that's why the DW (Define Word) is important because if you then treat it as a string of bytes every 2 would be "upside down".

Note: What I'm not sure is if every compiler would let you put a negative number in a word or if you have to specify it as signed word SWORD .

link

    
answered by 09.07.2018 / 19:20
source