-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdisplay_string_direct.asm
More file actions
48 lines (40 loc) · 1.78 KB
/
display_string_direct.asm
File metadata and controls
48 lines (40 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
; =============================================================================
; TITLE: Display String Direct
; DESCRIPTION: Direct string output demonstration using the DOS 09H service
; with a standard segment layout.
; AUTHOR: Amey Thakur (https://github.com/Amey-Thakur)
; REPOSITORY: https://github.com/Amey-Thakur/8086-ASSEMBLY-LANGUAGE-PROGRAMS
; LICENSE: MIT License
; =============================================================================
; -----------------------------------------------------------------------------
; DATA SEGMENT - Constant storage
; -----------------------------------------------------------------------------
DATA SEGMENT
MESSAGE DB "Hello World - This is a direct string test!$"
DATA ENDS
; -----------------------------------------------------------------------------
; CODE SEGMENT - Implementation
; -----------------------------------------------------------------------------
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START:
; Point data segment register to our data area
MOV AX, DATA
MOV DS, AX
; Setup Display String function
MOV AH, 09H ; Function 09h: Print string at DS:DX
LEA DX, MESSAGE ; Pointer to the string
INT 21H ; Call DOS kernel
; Exit safely
MOV AX, 4C00H
INT 21H
CODE ENDS
END START
; =============================================================================
; TECHNICAL NOTES
; =============================================================================
; 1. STRING NOTES:
; - The string must exist in a segment pointed to by DS.
; - LEA (Load Effective Address) is a highly efficient way to get the
; offset of a memory label.
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =