include.asm

来自「汇编语言 参考书 包含作业与答案 从入门到精通 通俗易懂」· 汇编 代码 · 共 82 行

ASM
82
字号
; This sample shows
; the use of emu8086.inc
; library of predefined
; macros and procedures.

#make_COM#

INCLUDE 'emu8086.inc'

ORG     100h

; print out some chars,
; using macro:
PUTC    'H'
PUTC    'i'
PUTC    ' '
PUTC    'T'
PUTC    'h'
PUTC    'e'
PUTC    'r'
PUTC    'e'
PUTC    '!'

; new line:
PUTC    13
PUTC    10

; print string using macro
; with carriage return in the end:
PRINTN 'I love Assembly!'

; print string using procedure:
LEA     SI, msg
CALL    print_string

; input a number into CX
; using procedure:
CALL    scan_num

; new line:
PUTC    13
PUTC    10

PRINT "You've entered: "
MOV     AX, CX
; print out the number in AX
; using procedure:
CALL    print_num


RET

msg     DB      'Enter a number: ', 0

;=================================
; here we define the functions
; from emu8086.inc

; SCAN_NUM reads a
; number from the user and stores
; it in CX register:
DEFINE_SCAN_NUM

; PRINT_STRING prints a null
; terminated string, the address
; of the string is in DS:SI 
DEFINE_PRINT_STRING

; PRINT_NUM prints a signed
; number in AX.
; (PRINT_NUM requires the declaration
; of PRINT_NUM_UNS).
; PRINT_NUM_UNS prints an unsigned
; number in AX:

DEFINE_PRINT_NUM
DEFINE_PRINT_NUM_UNS

;=================================

END

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?