Loacation Counters and Code Segment
How these location counters have been calculate for code segment :
0000 codesg Segment
Assume cs:codesg,ds:datasg
0000 Main proc Far
0000 B8 ---- R mov ax,seg datasg
0003 8B D0 mov dx,ax
0005 A1 000A R mov ax,b2+2
0008 50 push ax
0009 A1 000A R l1: mov ax,x
000C 40 inc ax
000D开发者_如何学Python 3C 05 cmp al,5
000F 75 09 jne l2
0011 8B 0E 0008 R mov cx,a2+2
0015 E2 F2 loop l1
0017 B8 0000 mov ax,0
001A CB l2: ret
001B main endp
001B codesg ends
You just add the number of bytes in the current instruction to the current location counter and that becomes the new location counter. So if you start at location 0 and you have a 3 byte instruction then the location counter for the next instruction will be 3.
精彩评论