asm: segment 的使用(win_intel)
一、segment(段)的使用
1 ; file_name = segment.asm
2 ; assume ds:data_s, ss:stack_s, cs:code_s
3
4
5
6
7 assume ds:data_s, ss:stack_s, cs:code_s
8
9
10
11
12 ; 0ah = \n ; 0dh = \r
13 data_s segment
14 msg1 db "hello", " world, ", "2023-01-10", " !", 0ah, 0dh, '$'
15 msg2 db "hello", " houdini19.5, ", "2023-01-10", " !", 0ah, 0dh, '$'
16 data_s ends
17
18
19
20
21 stack_s segment stack
22 dw 20 dup(0)
23 stack_s ends
24
25
26
27
28 code_s segment
29
30
31 start:
32
33 mov ax, data_s
34 mov ds, ax
35
36 mov dx, offset msg1
37 sub ax, ax
38 mov ah, 09h
39 int 21h
40
41 mov dx, offset msg2
42 sub ax, ax
43 mov ah, 09h
44 int 21h
45
46 ; mov dx, offset msg1
47 ; mov ah, 09h
48 ; int 21h
49
50
51 mov ah, 4ch
52 int 21h
53
54 code_s ends
55
56
57
58
59 end start
二、运行结果
1、汇编、链接
2、运行
本文由 lnlidawei 原创、整理、转载,本文来自于【博客园】; 整理和转载的文章的版权归属于【原创作者】; 转载或引用时请【保留文章的来源信息】:https://www.cnblogs.com/lnlidawei/p/17038968.html