我正在制作一个简单的程序来打印“你好,世界!” 以十六进制 ASCII 字符表示。这是我的代码:
SECTION .DATA
msg db 'Printing Hello world in ASCII values: ', 0
msglen EQU $-msg
char1 db 064h ; 'd' character
char2 db 06Ch ; 'l' character
char3 db 072h ; 'r'
char4 db 06Fh ; 'o'
char5 db 077h ; 'w'
char6 db 020h ; (space)
char7 db 06Fh ; 'o'
char8 db 06Ch ; 'l'
char9 db 06Ch ; 'l'
char10 db 065h ; 'e'
char11 db 048h ; 'H'
SECTION .bss
SECTION .text
GLOBAL _start:
_start:
nop
mov esi, 0
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, msglen
int 80h
; printing 'H'
mov eax, 4
mov ebx, 1
mov ecx, char11
mov edx, 1
int 80h
; printing 'e'
mov eax, 4
mov ebx, 1
mov ecx, char10
mov edx, 1
int 80h
; printing 'l'
mov eax, 4
mov ebx, 1
mov ecx, char9
mov edx, 1
int 80h
; printing 'l'
mov eax, 4
mov ebx, 1
mov ecx, char8
mov edx, 1
int 80h
; printing 'o'
mov eax, 4
mov ebx, 1
mov ecx, char7
mov edx, 1
int 80h
; printing space
mov eax, 4
mov ebx, 1
mov ecx, char6
mov edx, 1
int 80h
; printing 'w'
mov eax, 4
mov ebx, 1
mov ecx, char5
mov edx, 1
int 80h
; printing 'o'
mov eax, 4
mov ebx, 1
mov ecx, char4
mov edx, 1
int 80h
; printing 'r'
mov eax, 4
mov ebx, 1
mov ecx, char3
mov edx, 1
int 80h
; printing 'l'
mov eax, 4
mov ebx, 1
mov ecx, char2
mov edx, 1
int 80h
; printing 'd'
mov eax, 4
mov ebx, 1
mov ecx, char1
mov edx, 1
int 80h
; end
mov eax, 1
mov ebx, 0
int 80h
我的问题:
我该怎么做这样的事情:
loop:
mov eax, 4
mov ebx, 1
mov ecx, char[incremented variable]
mov edx, 1
int 80h
inc (incremented variable)
jmp loop
我的意思是如何将一个变量和一个递增计数器作为一个变量读取?
提前致谢。