Created
April 11, 2025 06:24
-
-
Save Alex-JAML/530ee5a72c608517e46ece8636c9d1cf to your computer and use it in GitHub Desktop.
Codigo Assembly ARM64 para RaspbianOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * --------------------------------------------------------------------------------- | |
| * Lenguajes de Interfaz en TECNM Campus ITT | |
| * Autor: Jorge Alejandro Martinez Lopez | |
| * Fecha: 2025-04-09 | |
| * Descripción: Conversión de kilogramos a libras (212 kg a lbs) | |
| * Demostración: [ASCIINEMA.ORG/XXXXXX] | |
| * --------------------------------------------------------------------------------- | |
| */ | |
| /* | |
| * ---------------------------------------------- | |
| * C# "Conversión Kg a Libras" (Referencia) | |
| * ---------------------------------------------- | |
| * using System; | |
| * | |
| * class Program { | |
| * static void Main() { | |
| * double kg = 212.0; | |
| * double conversion = 2.2; // 1 kg = 2.2 lbs | |
| * double libras = kg * conversion; | |
| * Console.WriteLine("212 kilogramos equivalen a: " + | |
| * libras.ToString("N1") + " libras\n"); | |
| * } | |
| * } | |
| */ | |
| .global _start | |
| .section .data | |
| mensaje: .ascii "212 kilogramos equivalen a: 466.4 libras" | |
| len_mensaje = . - mensaje | |
| newline: .ascii "\n" | |
| len_newline = . - newline | |
| .section .text | |
| _start: | |
| // ============ IMPRIMIR MENSAJE PRINCIPAL ============ | |
| mov x0, #1 // stdout | |
| adrp x1, mensaje // Carga dirección base | |
| add x1, x1, :lo12:mensaje // Offset bajo de 12 bits | |
| mov x2, len_mensaje // Longitud automática (39 bytes) | |
| mov x8, #64 // sys_write | |
| svc #0 | |
| // ============ IMPRIMIR SALTO DE LÍNEA ============ | |
| mov x0, #1 // stdout | |
| adrp x1, newline // Dirección del salto | |
| add x1, x1, :lo12:newline // Offset exacto | |
| mov x2, len_newline // 1 byte | |
| mov x8, #64 // sys_write | |
| svc #0 | |
| // ============ TERMINAR PROGRAMA ============ | |
| mov x0, #0 // Código de éxito | |
| mov x8, #93 // sys_exit | |
| svc #0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment