Assembly ile Basit Toplama,Çıkartma,Çarpma ve Bölme Yapan Basit Bir Hesap Makinesi

Assembly dili hakkında bilgiler, kaynaklar, dokümanlar ve örneklerin bulunduğu bölümümüz.
Cevapla
Kullanıcı avatarı
admin
Sistem Geliştiricisi
Sistem Geliştiricisi
Mesajlar: 803
Kayıt: 28 Ağu 2022 04:38
Konum: Database
Meslek: Teknisyen
Teşekkür etti: 434 kez
Teşekkür edildi: 297 kez
İletişim:

İşte iki sayı üzerinde toplama, çıkarma, çarpma ve bölme işlemlerini yapabilen x86 derleme dilinde basit bir hesap makinesi programı :

Kod: Tümünü seç

section .data

section .text

global _start

_start:

    ; Print a message to ask the user to enter two numbers
    mov eax, 4
    mov ebx, 1
    mov ecx, message
    mov edx, len
    int 0x80

    ; Read in the first number
    mov eax, 3
    mov ebx, 0
    mov ecx, number1
    mov edx, len
    int 0x80

    ; Read in the second number
    mov eax, 3
    mov ebx, 0
    mov ecx, number2
    mov edx, len
    int 0x80

    ; Convert the numbers from ASCII to integers
    mov eax, [number1]
    sub eax, '0'
    mov ebx, [number2]
    sub ebx, '0'

    ; Print a message to ask the user to choose an operation
    mov eax, 4
    mov ebx, 1
    mov ecx, op_message
    mov edx, op_len
    int 0x80

    ; Read in the operation
    mov eax, 3
    mov ebx, 0
    mov ecx, operation
    mov edx, 1
    int 0x80

    ; Perform the chosen operation
    cmp byte [operation], '+'
    je add
    cmp byte [operation], '-'
    je sub
    cmp byte
Daha zeki olmanın tek yolu, daha zeki bir rakiple oynamaktır.

Etiketler:
Cevapla

“Assembly” sayfasına dön