GNU/Linux xterm-256color bash 147 views

**
Nombre: bucle.s
Autor: Karla Itzel Vázquez Cruz
Fecha: 08-04-2025
Descripción: Contador del 0 al 9 usando
Plataforma: Raspberry Pi OS 64-bit
Asciinema: bucle.s


Versión en C:

Versión en ARM64 RaspbianOS Linux:

.section .data
buffer: .skip 12

.section .text
.global _start

_start:
    mov x19, 0              // contador = 0

loop_count:
    cmp x19, 10
    bge fin_count

    // convertir y mostrar número
    mov x0, x19
    ldr x1, =buffer
    bl int_to_ascii

    // write(stdout, x1, 12)
    mov x0, 1
    mov x2, 12
    mov x8, 64
    svc 0

    add x19, x19, 1
    b loop_count

fin_count:
    mov x0, 0
    mov x8, 93
    svc 0

int_to_ascii:
    mov x2, x1
    mov x3, 10
    add x1, x1, 11
    mov w4, 10
    strb w4, [x1]
    sub x1, x1, 1

.conv:
    udiv x5, x0, x3
    msub x6, x5, x3, x0
    add x6, x6, '0'
    strb w6, [x1]
    mov x0, x5
    cmp x0, 0
    sub x1, x1, 1
    bne .conv

    add x1, x1, 1
    ret

More recordings by Itzel

Browse all

PAR O IMPAR 3:37

by Itzel

FAHRENHEIT A CELSIUS 1:26

by Itzel

LARGO DE UNA CADENA 1:50

by Itzel

OpenWeatherDashing 2:43

by Itzel