nasm20241125003mmx.asm


;; (C) David Vajda
;; x86/i386/i586/amd64 - MMX - nur i586 .. :-)
;; 2024-11-25

global _start
    section .data
        op1: db "00000000", 10, 13
        op2: db 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
    section .text
_start:
    movq xmm1, [op1]
    movq xmm2, [op2]
    paddb xmm1, xmm2
    movq [op1], xmm1

    mov ecx, op1
    mov edx, 10
    mov ebx, 1
    mov eax, 4
    int 0x80

    mov eax, 1
    mov ebx, 0
    int 0x80

Alternative:


;; (C) David Vajda
;; x86/i386/i586/amd64 - MMX - nur i586 .. :-)
;; 2024-11-25

global _start
    section .data
        op1: db "00000000", 10, 13
        op2: db 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00
    section .text
_start:
    movq xmm1, [op1]
    movq xmm2, [op2]
    paddq xmm1, xmm2
    movq [op1], xmm1

    mov ecx, op1
    mov edx, 10
    mov ebx, 1
    mov eax, 4
    int 0x80

    mov eax, 1
    mov ebx, 0
    int 0x80

Ausgabe


vid@work:~$ nasm -f elf32 nasm20241125003mmx.asm
david@work:~$  ld -m elf_i386 nasm20241125003mmx.o -o nasm20241125003mmx
david@work:~$ ./nasm20241125003mmx
76543210
david@work:~$ nasm -f elf32 nasm20241125003mmx.asm
david@work:~$  ld -m elf_i386 nasm20241125003mmx.o -o nasm20241125003mmx
david@work:~$ ./nasm20241125003mmx
76543210
david@work:~$