彙編helloworld程式

2021-07-06 11:26:05 字數 582 閱讀 2600

data segment;定義資料段

output db 'hello world! $' ;定義乙個字串,記得要以$為結束標誌

data ends ;資料段結束

code segment ;**段定義開始

assume ds:data,cs:code

start:

mov ax,data ;實現段位址datas載入到ds

mov ds,ax

mov dx,offset output ;取string的偏移位址到dx中

lea dx,output ;兩種都可以

mov ah,09h ;呼叫9號功能呼叫輸出字串

int 21h

mov ah,4ch ;實現返回mos-dos視窗

int 21h

code ends ;**段結束

end start ;整個程式結束

mov ax,data ;實現段位址datas載入到ds

mov ds,ax

這裡不直接用mov ds, data是因為不支援該指令

匯程式設計序的Hello world

一 匯程式設計序的hello world x86 at t data msg ascii hello world,hello at t asm n len msg text global start start movl len,edx 顯示的字元數 movl msg,ecx 緩衝區指標 movl ...

mips彙編列印 hello world

mips組合語言列印 hello world 字串。已在pcspim下編印通過 print hello world programed by stevie zou text segment text globl main main la a0,str a0儲存要列印字元的位址 li v0,4 為sy...

linux 彙編 hello world 除錯

section data 初始化的變數 output ascii hello,world n 要列印的字串,data為初始化值的變數。output是標籤,指示字串開始的位置,ascii為資料型別 section bss 未初始化的變數,由0填充的緩衝區 lcomm num,20 lcomm為本地記憶...