set/reset a bit using Assembly language!

section .data


.byte 0b01111111 # This is 127 in decimal... we are gonna make it 255 by setting the least significant bit.

.section .text

.globl _start


movl $0, %edi # set the index

movb byte_data(,%edi,1), %al

or $0b10000000, %eax # Result of OR operation will go the eax register

and $0b10111111, %eax # This is for reseting a bit

movl %eax, %ebx

movl $1, %eax

int $0x80

Share on : Twitter, Facebook or Google+