[Assembly Language] 배열과 주소
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
|
%include "io64.inc"
section .text
global CMAIN
CMAIN:
mov rbp, rsp; for correct debugging
; 배열과 주소
; 배열 : 동일한 타입의 데이터 묶음
; - 배열을 구성하는 각 값을 배열 요소(element)라고 함
; - 배열의 위치를 가리키는 숫자를 인덱스(index)라고 함
; 주소
; [시작 주소 + 인덱스 * 크기]
mov rax, a
; 연습문제 : a배열의 모든 데이터 출력해보기
xor ecx, ecx
LABEL_PRINT_A:
PRINT_HEX 1, [a+ecx]
NEWLINE
inc ecs ; add ecx, 1
cmp ecx, 5
jne LABEL_PRINT_A
xor ecx, ecx
LABEL_PRINT_B:
PRINT_HEX 2, [b+ecx*2]
NEWLINE
inc ecx
cmp ecx, 5
jne LABEL_PRINT"_B
;0x100
xor rax, rax
ret
; 초기화 되지 않은 데이터
;[변수이름] [크기] [개수]`
;[크기] resb(1) resw(2) resd(4) resq(8)
section .data
msg db 'Hello World', 0x00
a db 0x01, 0x02, 0x03, 0x04, 0x05 ; 5*1 = 5 Byte
; 0x0001
b times 5 dw 1 ; 5*2 = 10 Byte
; 초기화 되지 않은 데이터
;[변수이름] [크기] [개수]`
;[크기] resb(1) resw(2) resd(4) resq(8)
section .bss
e resb 10
|
cs |
'⭐ Programming > Assembly Language' 카테고리의 다른 글
[Assembly Language] Stack Memory 스택 메모리 (0) | 2022.03.19 |
---|---|
[Assembly Language] 함수 기초 (0) | 2022.03.19 |
[Assembly Language] 분기문, IA-32 Register (0) | 2022.03.18 |
[Assembly Language] Shift Operation & Logical Operation 시프트 연산과 논리 연산 (0) | 2022.03.17 |
[Assembly Language] 사칙연산 (0) | 2022.03.17 |
댓글
이 글 공유하기
다른 글
-
[Assembly Language] Stack Memory 스택 메모리
[Assembly Language] Stack Memory 스택 메모리
2022.03.19 -
[Assembly Language] 함수 기초
[Assembly Language] 함수 기초
2022.03.19 -
[Assembly Language] 분기문, IA-32 Register
[Assembly Language] 분기문, IA-32 Register
2022.03.18 -
[Assembly Language] Shift Operation & Logical Operation 시프트 연산과 논리 연산
[Assembly Language] Shift Operation & Logical Operation 시프트 연산과 논리 연산
2022.03.17
댓글을 사용할 수 없습니다.