0

Hi. I have this example for an lab and I don't understand what's happening. Especially what MEM32[0] means...

DATA SEGMENT
MEM32 DD 316423
DATA ENDS
CODE SEGMENT
… …
MOV AX, 43981
SUB DX, DX ;load dx ax 43981
ADD AX, WORD PTR MEM32[0] ;add inf. word
ADC DX, WORD PTR MEM32[2] ;add sup. word 316423
; --------
;result in dx,ax 360404
… …
CODE ENDS

Edited by chira.laura.9

2
Contributors
1
Reply
6
Views
4 Years
Discussion Span
Last Post by mathematician
1
MEM32 DD 316423                        ;reserves 4 bytes of memory for the number 316423
MOV AX, 43981                          ;loads the least significant bits of 43981 into ax
                                       ;and since 43981 < 65535, that means all of it
SUB DX, DX                             ;make sure dx = 0, so that all 32 bits of dx:ax now
                                       ;hold the number 43981
ADD AX, WORD PTR MEM32[0]              ;add the least significant word of 43981
                                       ;to the least gignificant two bytes of the number
                                       ;held in MEM32. Any carry from the addition will
                                       ;go into the carry flag.
ADC DX, WORD PTR MEM32[2]              ;add the carry from the previous "column" and
                                       ;the most significant word of 43981 to the most
                                       ;significant word of 316423
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.