-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathVariableDeclearation.asm
More file actions
69 lines (54 loc) · 1.52 KB
/
VariableDeclearation.asm
File metadata and controls
69 lines (54 loc) · 1.52 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
; Variable Decleration Example
;
; author : suraj singh bisht
; Email : surajsinghbisht054@gmail.com
;
; includable functions
%include 'includable_functions_without_start.asm'
; ====================================================
; [ Includable File]
; Functions:
; _strlen
; _exit
; _print
; _printline
;
; ====================================================
;
; bss section
SECTION .bss
; data section
SECTION .data
VName DB 'Hey! Suraj!', 0h ; Decleare String
VSingle DB 's' ; Allocate 1 Byte [Single]
VWord0 DW 1234 ; Allocate 2 Bytes [Word]
VWord1 DW -1234 ; Allocate 2 Bytes [Word]
VReal0 DD 1.1234 ; Allocate 4 Bytes [Double]
VReal1 DQ 1234.4567 ; Allocate 8 Bytes [Quadword]
VBignm DQ 123465789 ; Allocate 8 Bytes [Quadword]
; text section
SECTION .text
global _start ; linker trigger
; trigger function
_start:
; =================================================
; Note
; =================================================
; We can't directly print number on terminal in assembly.
; To print any digit, first we have to convert it into ASCII code.
; actually, assembly prints all character/Digit/Number/Word According
; To ASCII code Table.
; Let's print
mov eax, VName ; Load Memory address
call _printline ; call _printline Routine
; let's print anoter character
mov eax, VSingle ; Load Memory Address
call _printline ; Call _printline Routine
; Exit
jmp _exit ; Exit routine
;
; Output:
; Hey! Suraj!
; s�.��ˏ?U0*��I�@=�[
;
;