Página 1 de 1

[NASM] Obteniendo datos (Practicando syscall 1,3,4)

Publicado: 16 Oct 2015, 09:04
por KHC
Ando practicando assembler y compartiré lo que vaya realizando para entretenerme :P
Aun soy novatillo en asm y muchos códigos son para practicar y memorizar la syscalls, paso de argumentos, etcétera.
;KHC
;Simple read keys
;indetectables.net

section .data
	getMsg db 'Ingrese un numero:', 0h 	;len = 18
	showMsg db 'Ingresastesssss:', 0Ah	;len = 16

section .bss	;datos sin inicializar
	obtenied resb 32	;reservando 32 bytes

section .text
	global _start

_start:
;llamada a sys_write
	mov edx, 18		;18 bytes
	mov ecx, getMsg
	mov ebx, 1		;STDOUT
	mov eax, 4		;syscall (sys_write)
	int 80h

;obteniendo datos
	mov edx, 31		;31 bytes
	mov ecx, obtenied
	mov ebx, 2		;STDIN
	mov eax, 3		;syscall (sys_read)
	int 80h

;mostrando datos
	;mostrando mensaje
	mov edx, 16		;16 bytes
	mov ecx, showMsg
	mov ebx, 1		;STDOUT
	mov eax, 4		;syscall (sys_write)
	int 80h;
	;mostrando datos obtenidos
	mov edx, 31		;31 bytes
	mov ecx, obtenied
	mov ebx, 1		;STDOUT
	mov eax, 4		;sycall (sys_write)
	int 80h

;saliendo...
	mov ebx, 0
	mov eax, 1
	int 80h
Siempre es bien recibido algunos truquillos o consejos!

Publicado: 23 Sep 2022, 02:11
por Flight embedded
Hola KHC, compilé este programa en kali linux y funciona perfectamente. Estos hilos sí merecen ser reflotados. 👌