📄 print.asm
字号:
; This sample shows how
; to print string defined
; just after the CALL
; instruction without
; using 'emu8086.inc' library.
#make_COM#
ORG 100h
; set these values to registers
; for no particular reason,
; I just want to check that
; procedure does not modify
; them:
MOV SI, 1234h
MOV AX, 9876h
; 13, 10 - is the code
; for standard new
; line characters:
; 13 - carriage return.
; 10 - new line.
CALL PrintMe
db 'Hi', 0
; gets here after print:
MOV CX, 1
CALL PrintMe
db ' World!', 13, 10, 0
; gets here after print:
MOV CX, 2
CALL PrintMe
db 'Hello There!', 10
db "What's up?", 13, 10
db 'Printing!', 0
; gets here after print:
MOV CX, 3
RET ; return to OS.
;*******************************
; This code is taken from PTHIS
; procedure declared in emu8086.inc
; This example is made to enable debugging
; of this cute code.
;
; It prints a null terminated
; string at current cursor position.
; The ZERO TERMINATED string should
; be defined just after
; the CALL. For example:
;
; CALL PrintMe
; db 'Hello World!', 0
;
; Address of string is stored in the
; Stack as return address.
; Procedure updates value in the
; Stack to make return
; after string definition.
PrintMe:
MOV CS:temp1, SI ; re-store SI register.
POP SI ; get return address (IP).
PUSH AX ; store AX register.
next_char:
MOV AL, CS:[SI]
INC SI ; next byte.
CMP AL, 0
JZ printed
MOV AH, 0Eh ; teletype function.
INT 10h
JMP next_char ; loop.
printed:
POP AX ; re-store AX register.
; SI should point to next command after
; the CALL instruction and string definition:
PUSH SI ; save new return address into the Stack.
MOV SI, CS:temp1 ; re-store SI register.
RET
; variable to store original
; value of SI register.
temp1 DW ?
;*******************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -