Certainly! Here's an example of an 8086 assembly language program that compares the values of AL and BL registers. If AL is greater than BL, it clears the BL register; otherwise, it clears the AL register.
```assembly
section .data
value_al db 0CAh ; '11001010' in binary
value_bl db 0C8h ; '11001000' in binary
section .text
global _start
_start:
mov al, [value_al] ; Load the value into AL register
mov bl, [value_bl] ; Load the value into BL register
cmp al, bl ; Compare AL and BL
jle clear_al ; Jump to clear_al if AL <= BL
mov bl, 0 ; Clear BL register
jmp exit_program ; Jump to exit_program
clear_al:
mov al, 0 ; Clear AL register
exit_program:
; 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 loads the values '11001010' and '11001000' into AL and BL registers, respectively. It then compares AL and BL and clears the appropriate register based on the result of the comparison. Replace the values in `value_al` and `value_bl` with your desired values. Compile and run the program using an assembler and linker, as explained in the previous response.
0 टिप्पणियाँ:
Post a Comment