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、运行
标签:code,intel,win,mov,data,ax,segment,stack From: https://www.cnblogs.com/lnlidawei/p/17038968.html