어셈블러의 간소화 쓰기

[설명] 어셈블리 언어는 단락 정의 등 간략한 쓰기의 위조 조작을 제공하여 코드를 더욱 간략하게 쓸 수 있다.어셈블리 언어를 업무 언어로 사용하는 학생은 이 방면에서 자료를 찾아 깊이 있게 연구할 수 있다
[사례] Hello World 출력!
.8086
.MODEL small
.data
  str db 'hello world!$'
.stack 20H
.code
start: mov ax,@data
       mov ds,ax
       lea bx,str ; mov bx, 0 。 , debug 
output:mov dl, [bx]
       cmp dl, '$'
       je stop
       mov ah, 02H
       int 21h
       inc bx
       jmp output

 stop: mov ax,4c00h
       int 21h
end start

다음 쓰기 작업은 동일한 결과를 가져옵니다.
assume cs:codesg, ss:stacksg, ds:datasg
stacksg segment
    db  32 dup (0)
stacksg ends
datasg segment
     str db 'hello world!$'
datasg ends
codesg segment
start: mov ax,datasg
       mov ds,ax
       mov ax, stacksg
       mov ss, ax
       mov sp, 20h

       lea bx,str
output:mov dl, [bx]
       cmp dl, '$'
       je stop
       mov ah, 02H
       int 21h
       inc bx
       jmp output

 stop: mov ax,4c00h
       int 21h
codesg ends
end start

좋은 웹페이지 즐겨찾기