Skip to content

Instantly share code, notes, and snippets.

@pepinisillo
Last active May 25, 2025 04:06
Show Gist options
  • Save pepinisillo/afb8f5911f9c1767ac65a7abd9b5fcf2 to your computer and use it in GitHub Desktop.
Save pepinisillo/afb8f5911f9c1767ac65a7abd9b5fcf2 to your computer and use it in GitHub Desktop.
Programa 1 Dame tu nombre Código Assembly ARM64 Capturar nombre y mostralo para RaspbianOS
/*
______ ____ ____ __ __
/\ _ \/\ _`\ /'\_/`\ /'___\/\ \\ \
\ \ \L\ \ \ \L\ \/\ \/\ \__/\ \ \\ \
\ \ __ \ \ , /\ \ \__\ \ \ _``\ \ \\ \_
\ \ \/\ \ \ \\ \\ \ \_/\ \ \ \L\ \ \__ ,__\
\ \_\ \_\ \_\ \_\ \_\\ \_\ \____/\/_/\_\_/
\/_/\/_/\/_/\/ /\/_/ \/_/\/___/ \/_/
♡ ∩_∩
(„• ֊ •„)♡
| ̄U U ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
| • Lenguajes de Interfaz en TECNM Campus ITT |
| • Autor: Alejandro Suarez Sandoval |
| • Fecha: 2025/04/01 |
| • Descripción: Programa para capturar y mostrar |
| nombre, incluyendo C# y Assembly ARM64 para RaspbianOS. |
| • Demostración: |
| https://asciinema.org/a/711547 |
| • Compilación (Raspberry Pi ARM64): |
| as mostrar_nombre.s -o mostrar_nombre.o |
| ld mostrar_nombre.o -o mostrar_nombre |
| • Ejecución: ./mostrar_nombre |
 ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄
⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂ ⠂⠄⠄⠂☆
═════════•°• Demostración Código en lenguaje C# •°•═════════
using System;
class Program
{
static void Main()
{
// Mostrar un mensaje en la consola
Console.WriteLine("Por favor, ingresa tu nombre:");
// Capturar la entrada del usuario
string nombre = Console.ReadLine();
// Mostrar el nombre capturado
Console.WriteLine($"¡Hola, {nombre}!");
}
}
════════════════════•°• ☆ •°•══════════════════════════════
/*
/* ⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂⠁⠁⠂⠄⠄⠂ ⠂⠄⠄⠂☆
═════════════•°• Código en ARM64 Assembly •°•═════════════ */
.section .bss
buffer: .skip 50 // Espacio para almacenar el nombre (50 bytes)
.section .data
msg_input: .asciz "Introduce tu nombre: "
msg_output: .asciz "Hola, "
.section .text
.global _start
_start:
// Escribir mensaje de entrada
mov x0, 1 // stdout
ldr x1, =msg_input // Dirección del mensaje
mov x2, 20 // Longitud del mensaje
mov x8, 64 // syscall: write
svc 0 // Llamar al kernel
// Leer entrada del usuario
mov x0, 0 // stdin
ldr x1, =buffer // Dirección del buffer
mov x2, 50 // Tamaño máximo a leer
mov x8, 63 // syscall: read
svc 0 // Llamar al kernel
// Escribir "Hola, "
mov x0, 1 // stdout
ldr x1, =msg_output // Dirección del mensaje
mov x2, 6 // Longitud del mensaje
mov x8, 64 // syscall: write
svc 0 // Llamar al kernel
// Escribir el nombre capturado
mov x0, 1 // stdout
ldr x1, =buffer // Dirección del buffer con el nombre
mov x2, 50 // Tamaño leído
mov x8, 64 // syscall: write
svc 0 // Llamar al kernel
// Salir del programa
mov x8, 93 // syscall: exit
mov x0, 0 // Código de salida 0
svc 0 // Llamar al kernel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment