50 likes | 148 Views
CS344-321 Assembly Language Programming. Period 18. Segment Overrides ตัวอย่าง data segmentvar1 db 1 data ends buffer segment var2 db 2 buffer ends code segment var3 db 3 assume cs:code, ds: data , es:buffer inc var1
E N D
CS344-321 Assembly Language Programming Period 18
Segment Overrides ตัวอย่าง data segmentvar1 db 1 data ends buffer segment var2 db 2 buffer ends code segment var3 db 3 assume cs:code, ds:data, es:buffer inc var1 inc var2 inc var3 code ends end
Microsoft MACRO Assembler Version 3.00 Page 1-1 09-28-99 0000 data segment 0000 01 var1 db 1 0001 data ends 0000 buffer segment 0000 02 var2 db 2 0001 buffer ends 0000 code segment 0000 03 var3 db 3 assume cs:code, ds:data, es:buffer 0001 FE 06 0000 R inc var1 0005 26: FE 06 0000 R inc var2 000A 2E: FE 06 0000 R inc var3 000F code ends end หมายเหตุ26:หมายถึง segment override ES: และ 2E:หมายถึง CS:
ตัวอย่าง data segment var1 db 1 data ends buffer segment var2 db 2 buffer ends code segment var3 db 3 ; assume cs:code, ds:data, es:buffer inc var1 inc var2 inc var3 code ends end
0000 data segment 0000 01 var1 db 1 0001 data ends 0000 buffer segment 0000 02 var2 db 2 0001 buffer ends 0000 code segment 0000 03 var3 db 3 ; assume cs:code, ds:data, es:buffer 0001 FE 06 0000 R inc var1 E r r o r --- 68:Can't reach with segment reg 0005 FE 06 0000 R inc var2 E r r o r --- 68:Can't reach with segment reg 0009 FE 06 0000 R inc var3 E r r o r --- 68:Can't reach with segment reg 000D code ends end