Другие языки программирования и технологии

Ассэмблер нужна помощь

Добрый день. Нуждаюсь в помощи, есть такая задача: Написать программу в ассэмблере, которая выводит на экран введенный с клавиатуры символ N раз. Число повторов N ввести с клавиатуры.
 section .data 
prompt db 'Enter a character:', 0
repeat_prompt db 'Enter the number of repetitions:', 0
input db 0
repeat_input dw 0

section .bss
buffer resb 1

section .text
global _start

_start:
; Print the prompt
mov eax, 4
mov ebx, 1
mov ecx, prompt
mov edx, 14
int 0x80

; Read the input
mov eax, 3
mov ebx, 0
mov ecx, buffer
mov edx, 1
int 0x80

; Print the repeat prompt
mov eax, 4
mov ebx, 1
mov ecx, repeat_prompt
mov edx, 30
int 0x80

; Read the repeat input
mov eax, 3
mov ebx, 0
mov ecx, repeat_input
mov edx, 2
int 0x80

; Move the repeat input into the ecx register
mov ecx, [repeat_input]

print_loop:
; Print the input
mov eax, 4
mov ebx, 1
mov edx, 1
mov edx, buffer
int 0x80

; Decrement the counter
dec ecx
jnz print_loop

exit:
; Exit the program
mov eax, 1
xor ebx, ebx
int 0x80
Сергей Фисунов
Сергей Фисунов
1 192
Лучший ответ
section .data
msg db "Enter the character: "
len equ $-msg
msg2 db "Enter the number of repetitions: "
len2 equ $-msg2
n db 0
section .bss
character resb 1
section .text
global _start

_start:
; Print message to enter character
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, len
int 0x80

; Get character from keyboard
mov eax, 3
mov ebx, 0
mov ecx, character
mov edx, 1
int 0x80

; Print message to enter number of repetitions
mov eax, 4
mov ebx, 1
mov ecx, msg2
mov edx, len2
int 0x80

; Get number of repetitions from keyboard
mov eax, 3
mov ebx, 0
mov ecx, n
mov edx, 1
int 0x80

; Convert ASCII number to binary number
mov bl, [n]
sub bl, '0'

; Print character N times
mov ecx, ebx
mov edx, 1
mov eax, 4
mov ebx, 1
mov eax, 4
mov edx, 1
mov ebx, 1
mov ecx, character
rep stosb
mov eax, 1
xor ebx, ebx
int 0x80
Юрий Землянов
Юрий Землянов
1 565