Certainly! Below is a simple 8086 assembly language program that increments a byte value stored in a memory location by 2. The result is stored back in the same memory location:
```assembly
section .data
value db 51h ; Initial byte value, change as needed
section .text
global _start
_start:
mov al, [value] ; Load the byte value into AL register
add al, 2 ; Increment AL by 2
mov [value], al ; Store the result back in the memory location
; Add any additional code here if needed
; Exit the program
mov eax, 1 ; System call number for sys_exit
xor ebx, ebx ; Exit code 0
int 0x80 ; Call kernel
```
This program uses Linux system calls for simplicity (`int 0x80`). If you are running it on a modern 64-bit system, you might need to adjust it accordingly.
Compile and run the program using an assembler and linker. For example, using NASM and LD:
```bash
nasm -f elf32 your_program.asm -o your_program.o
ld -m elf_i386 -s -o your_program your_program.o
./your_program
```
Make sure to replace `your_program.asm` with the actual filename you save the program in. The program increments the initial byte value (`51h`) by 2, and the final value is stored back in the same memory location.
0 टिप्पणियाँ:
Post a Comment